(Multistream)
Operations related to multistream api
- GetAll - Retrieve Multistream Targets
- Create - Create a multistream target
- Get - Retrieve a multistream target
- Update - Update Multistream Target
- Delete - Delete a multistream target
Retrieve Multistream Targets
package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Multistream.GetAll(ctx)
if err != nil {
log.Fatal(err)
}
if res.Data != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetMultistreamTargetsResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Create a multistream target
package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Multistream.Create(ctx, components.MultistreamTargetInput{
URL: "rtmps://live.my-service.tv/channel/secretKey",
})
if err != nil {
log.Fatal(err)
}
if res.MultistreamTarget != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.MultistreamTargetInput | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateMultistreamTargetResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Retrieve a multistream target
package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Multistream.Get(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res.MultistreamTarget != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | ID of the multistream target |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetMultistreamTargetResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Update Multistream Target
package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Multistream.Update(ctx, "<id>", components.MultistreamTargetPatchPayload{
URL: "rtmps://live.my-service.tv/channel/secretKey",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | ID of the multistream target |
multistreamTargetPatchPayload |
components.MultistreamTargetPatchPayload | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdateMultistreamTargetResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Make sure to remove any references to the target on existing streams before actually deleting it from the API.
package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Multistream.Delete(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | ID of the multistream target |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DeleteMultistreamTargetResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |