Skip to content

Latest commit

 

History

History
119 lines (84 loc) · 2.78 KB

README.md

File metadata and controls

119 lines (84 loc) · 2.78 KB

Task

(task())

Overview

Operations related to tasks api

Available Operations

  • getAll - Retrieve Tasks
  • get - Retrieve a Task

getAll

Retrieve Tasks

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.GetTasksResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            GetTasksResponse res = sdk.task().getAll()
                .call();

            if (res.data().isPresent()) {
                // handle response
            }
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Response

GetTasksResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*

get

Retrieve a Task

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.GetTaskResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            GetTaskResponse res = sdk.task().get()
                .taskId("<value>")
                .call();

            if (res.task().isPresent()) {
                // handle response
            }
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Parameters

Parameter Type Required Description
taskId String ✔️ ID of the task

Response

GetTaskResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*