Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdks: format Go example, typos #550

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 27 additions & 25 deletions sdks/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ go get github.com/livepeer/livepeer-go

</Step>
<Step title="Initialize the SDK">

The first step is to initialize the SDK with your Livepeer Studio API key.

```go
package main

import(
import (
"context"
"log"
"livepeer"
"livepeer/models/components"

"github.com/livepeer/livepeer-go/livepeer"
"github.com/livepeer/livepeer-go/livepeer/models/components"
)

func main() {
lpClient := livepeer.New(
livepeer.WithSecurity("") // Your API key
)
lpClient := livepeer.New(
livepeer.WithSecurity(""), // Your API key
)
}
```

Expand All @@ -50,29 +51,30 @@ Let's create a stream.
```go
package main

import(
import (
"context"
"log"
"livepeer"
"livepeer/models/components"

"github.com/livepeer/livepeer-go"
"github.com/livepeer/livepeer-go/models/components"
)

func main() {
lpClient := livepeer.New(
livepeer.WithSecurity("<api-key>"),
)

ctx := context.Background()
res, err := lpClient.Stream.Create(ctx, components.NewStreamPayload{
Name: "test_stream",
})
if err != nil {
log.Fatal(err)
}

if res.Data != nil {
// handle response
}
lpClient := livepeer.New(
livepeer.WithSecurity("<api-key>"),
)

ctx := context.Background()
res, err := lpClient.Stream.Create(ctx, components.NewStreamPayload{
Name: "test_stream",
})
if err != nil {
log.Fatal(err)
}

if res.Data != nil {
// handle response
}
}
```

Expand Down