Skip to content

Latest commit

 

History

History
214 lines (155 loc) · 8.84 KB

README.md

File metadata and controls

214 lines (155 loc) · 8.84 KB

Session

(Session)

Overview

Operations related to session api

Available Operations

GetClips

Retrieve clips of a session

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.Session.GetClips(ctx, "<id>")
    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.
id string ✔️ ID of the parent session
opts []operations.Option The options for this request.

Response

*operations.GetSessionClipsResponse, error

Errors

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

GetAll

Retrieve sessions

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.Session.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.GetSessionsResponse, error

Errors

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

Get

Retrieve a session

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.Session.Get(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Session != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetSessionResponse, error

Errors

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

GetRecorded

Retrieve Recorded Sessions

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.Session.GetRecorded(ctx, "<value>", livepeergo.Pointer(operations.CreateRecordBoolean(
        true,
    )))
    if err != nil {
        log.Fatal(err)
    }
    if res.Data != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
parentID string ✔️ ID of the parent stream
record *operations.Record Flag indicating if the response should only include recorded
sessions
true
opts []operations.Option The options for this request.

Response

*operations.GetRecordedSessionsResponse, error

Errors

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