-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcachet_example_test.go
More file actions
43 lines (33 loc) · 781 Bytes
/
cachet_example_test.go
File metadata and controls
43 lines (33 loc) · 781 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
39
40
41
42
43
package cachet_test
import (
"fmt"
"github.com/andygrunwald/cachet"
)
func ExampleGeneralService_Ping() {
client, err := cachet.NewClient("https://dev.cachethq.io/", nil)
if err != nil {
panic(err)
}
pong, resp, err := client.General.Ping()
if err != nil {
panic(err)
}
fmt.Printf("Result: %s\n", pong)
fmt.Printf("Status: %s\n", resp.Status)
// Output: Result: Pong!
// Status: 200 OK
}
func ExampleComponentsService_Get() {
client, err := cachet.NewClient("https://dev.cachethq.io/", nil)
if err != nil {
panic(err)
}
comp, resp, err := client.Components.Get(1)
if err != nil {
panic(resp)
}
fmt.Printf("Result: %s (ID: %d)\n", comp.Name, comp.ID)
fmt.Printf("Status: %s\n", resp.Status)
// Output: Result: API (ID: 1)
// Status: 200 OK
}