README.md
1# go-lwApi
2LiquidWeb API Golang client
3
4[![GoDoc](https://godoc.org/github.com/liquidweb/go-lwApi?status.svg)](https://godoc.org/github.com/liquidweb/go-lwApi)
5
6## Setting up Authentication
7When creating an api client, it expects to be configured via a configuration struct. Here is an example of how to get an api client.
8
9```
10package main
11
12import (
13 "fmt"
14
15 lwApi "github.com/liquidweb/go-lwApi"
16)
17
18func main() {
19 config := lwApi.LWAPIConfig{
20 Username: "ExampleUsername",
21 Password: "ExamplePassword",
22 Url: "api.liquidweb.com",
23 }
24 apiClient, iErr := lwApi.New(&config)
25}
26```
27## Importing
28``` go
29import (
30 lwApi "github.com/liquidweb/go-lwApi"
31)
32```
33## Calling a method
34``` go
35apiClient, iErr := lwApi.New(&config)
36if iErr != nil {
37 panic(iErr)
38}
39args := map[string]interface{}{
40 "uniq_id": "2UPHPL",
41}
42got, gotErr := apiClient.Call("bleed/asset/details", args)
43if gotErr != nil {
44 panic(gotErr)
45}
46fmt.Printf("RETURNED:\n\n%+v\n\n", got)
47```
48
49As you can see, you don't need to prefix the `params` key, as that is handled in the `Call()` function for you.
50