Skip to content

Latest commit

 

History

History
271 lines (197 loc) · 12.1 KB

README.md

File metadata and controls

271 lines (197 loc) · 12.1 KB

Multistream

(Multistream)

Overview

Operations related to multistream api

Available Operations

  • GetAll - Retrieve Multistream Targets
  • Create - Create a multistream target
  • Get - Retrieve a multistream target
  • Update - Update Multistream Target
  • Delete - Delete a multistream target

GetAll

Retrieve Multistream Targets

Example Usage

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
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetMultistreamTargetsResponse, error

Errors

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

Create

Create a multistream target

Example Usage

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
    }
}

Parameters

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.

Response

*operations.CreateMultistreamTargetResponse, error

Errors

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

Get

Retrieve a multistream target

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GetMultistreamTargetResponse, error

Errors

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

Update

Update Multistream Target

Example Usage

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
    }
}

Parameters

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.

Response

*operations.UpdateMultistreamTargetResponse, error

Errors

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

Delete

Make sure to remove any references to the target on existing streams before actually deleting it from the API.

Example Usage

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
    }
}

Parameters

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.

Response

*operations.DeleteMultistreamTargetResponse, error

Errors

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /