(task)
Operations related to tasks api
Retrieve Tasks
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.task.getAll();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { taskGetAll } from "livepeer/funcs/taskGetAll.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await taskGetAll(livepeer);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetTasksResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Retrieve a Task
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.task.get("<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { taskGet } from "livepeer/funcs/taskGet.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await taskGet(livepeer, "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
taskId |
string | ✔️ | ID of the task |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetTaskResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |