Skip to content

Latest commit

 

History

History
109 lines (78 loc) · 3.73 KB

README.md

File metadata and controls

109 lines (78 loc) · 3.73 KB

Task

(Task)

Overview

Operations related to tasks api

Available Operations

  • GetAll - Retrieve Tasks
  • Get - Retrieve a Task

GetAll

Retrieve Tasks

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.Task.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.GetTasksResponse, error

Errors

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

Get

Retrieve a Task

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

Parameters

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

Response

*operations.GetTaskResponse, error

Errors

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