doc: cleanup and improve for recently moved pkgs (#354)
* chore(atomicx): review docs and add usage example * chore(fsx): improve docs, return value, add examples * fix(kvstore): correct typo and add example * fix(multierror): add basic example * doc: revamp ooapi documentation
This commit is contained in:
parent
33de701263
commit
acd4ffff35
12 changed files with 172 additions and 26 deletions
36
internal/ooapi/example_test.go
Normal file
36
internal/ooapi/example_test.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package ooapi_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/kvstore"
|
||||
"github.com/ooni/probe-cli/v3/internal/ooapi"
|
||||
"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel"
|
||||
)
|
||||
|
||||
func ExampleClient() {
|
||||
clnt := &ooapi.Client{
|
||||
KVStore: &kvstore.Memory{},
|
||||
}
|
||||
ctx := context.Background()
|
||||
resp, err := clnt.CheckIn(ctx, &apimodel.CheckInRequest{
|
||||
Charging: false,
|
||||
OnWiFi: false,
|
||||
Platform: "linux",
|
||||
ProbeASN: "AS30722",
|
||||
ProbeCC: "IT",
|
||||
RunType: "timed",
|
||||
SoftwareName: "miniooni",
|
||||
SoftwareVersion: "0.1.0-dev",
|
||||
WebConnectivity: apimodel.CheckInRequestWebConnectivity{
|
||||
CategoryCodes: []string{"NEWS"},
|
||||
},
|
||||
})
|
||||
fmt.Printf("%+v\n", err)
|
||||
// Output: <nil>
|
||||
if resp == nil {
|
||||
log.Fatal("expected non-nil response")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue