Skip to content

Commit

Permalink
docs: Update README with detailed steps (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrongmeal authored Jan 13, 2025
1 parent f71ee13 commit bb39fcd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,26 @@ 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
[s2.dev](https://s2.dev/dashboard).

1. Make a request using SDK client.
```go
// main.go

package main

import (
Expand All @@ -51,18 +61,20 @@ The Go SDK provides ergonomic wrappers and utilities to interact with the
func main() {
client, err := s2.NewClient("<YOUR AUTH TOKEN>")
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
Expand Down
4 changes: 2 additions & 2 deletions s2/readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -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.
}
Expand Down

0 comments on commit bb39fcd

Please sign in to comment.