Skip to content

Commit a085b48

Browse files
author
maksim.konovalov
committed
add example with box too
1 parent 0444763 commit a085b48

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

box/example_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,30 @@ func Example() {
3131
log.Fatalf("Failed to connect: %s", err)
3232
}
3333

34+
// You can use Info Request type.
35+
3436
fut := client.Do(box.NewInfoRequest())
3537

3638
resp := &box.InfoResponse{}
39+
3740
err = fut.GetTyped(resp)
3841
if err != nil {
3942
log.Fatalf("Failed get box info: %s", err)
4043
}
4144

45+
// Or use simple Box implementation.
46+
47+
b := box.New(client)
48+
49+
info, err := b.Info()
50+
if err != nil {
51+
log.Fatalf("Failed get box info: %s", err)
52+
}
53+
54+
if info.UUID != resp.Info.UUID {
55+
log.Fatalf("Box info uuids are not equal")
56+
}
57+
58+
fmt.Printf("Box info uuids are equal")
4259
fmt.Printf("Current box info: %+v\n", resp.Info)
4360
}

0 commit comments

Comments
 (0)