-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_example_test.go
More file actions
38 lines (30 loc) · 867 Bytes
/
client_example_test.go
File metadata and controls
38 lines (30 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package ccatapi_test
import (
"fmt"
"net/http"
ccatapi "github.com/saniales/ccat-api"
)
func ExampleNewClient_defaults() {
// Create a new Cheshire Cat API client with only the default values.
client := ccatapi.NewClient()
// Call the Cheshire Cat API
fmt.Println(client.Status())
}
func ExampleNewClient_options() {
// Create a new Cheshire Cat API client by changing the defaults using
// options.
client := ccatapi.NewClient(
ccatapi.WithHTTPClient(&http.Client{}),
ccatapi.WithBaseURL("https://localhost:1865"),
ccatapi.WithUserAgent("cheshire-gopher-api"),
ccatapi.WithUserID("my_user"),
)
// Call the Cheshire Cat API with new settings
fmt.Println(client.Status())
}
func ExampleClient_Status() {
// Create a new Cheshire Cat API client.
client := ccatapi.NewClient()
// Call the Cheshire Cat API
fmt.Println(client.Status())
}