diff --git a/README.md b/README.md index f881805..13a1f69 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,17 @@ The Go SDK provides ergonomic wrappers and utilities to interact with the ## Getting started +1. Create a new Go project: + ```bash + mkdir s2-sdk-test + cd s2-sdk-test + go mod init example.com/s2-sdk-test + touch main.go + ``` + 1. Add the `s2` dependency to your project: ```bash - go get github.com/s2-streamstore/s2-sdk-go/s2 + go get github.com/s2-streamstore/s2-sdk-go/s2@latest ``` 1. Generate an authentication token by logging onto the web console at @@ -39,6 +47,8 @@ The Go SDK provides ergonomic wrappers and utilities to interact with the 1. Make a request using SDK client. ```go + // main.go + package main import ( @@ -51,18 +61,20 @@ The Go SDK provides ergonomic wrappers and utilities to interact with the func main() { client, err := s2.NewClient("") if err != nil { - // Handle error. + panic(err) } - basins, err := client.ListBasins(&s2.ListBasinsRequest{}) + basins, err := client.ListBasins(context.TODO(), &s2.ListBasinsRequest{}) if err != nil { - // Handle error. + panic(err) } fmt.Println(basins) } ``` + Run the above program using `go run main.go`. + ## Examples The [`s2/example_test.go`](./s2/example_test.go) contains a variety of example diff --git a/s2/readme.go b/s2/readme.go index d99a180..29e5761 100644 --- a/s2/readme.go +++ b/s2/readme.go @@ -8,7 +8,7 @@ The Go SDK provides ergonomic wrappers and utilities to interact with the 1. Add the s2 dependency to your project: - go get github.com/s2-streamstore/s2-sdk-go/s2 + go get github.com/s2-streamstore/s2-sdk-go/s2@latest 2. Generate an authentication token by logging onto the web console at [s2.dev]. @@ -20,7 +20,7 @@ The Go SDK provides ergonomic wrappers and utilities to interact with the // Handle error. } - basins, err := client.ListBasins(&s2.ListBasinsRequest{}) + basins, err := client.ListBasins(context.TODO(), &s2.ListBasinsRequest{}) if err != nil { // Handle error. }