Class: Tasks

appLib/SDKDrivers/xFrameDriver/tasks.Tasks

Tasks repository.

The Tasks class allows the user to manage tasks and their properties.

Hierarchy

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new Tasks(agent)

Creates an instance of Repository.

Parameters

Name Type
agent PeerAgent

Inherited from

Repository.constructor

Methods

crudReq

crudReq(data): void

Sends a CRUD request to the xFrame.

Parameters

Name Type
data any

Returns

void

Inherited from

Repository.crudReq


crudReqSync

crudReqSync(data, options?): Promise<any>

Sends a CRUD request to the xFrame.

Parameters

Name Type Description
data any The data to send.
options Object
options.timeout? number an option to set the timeout for the request.

Returns

Promise<any>

Inherited from

Repository.crudReqSync


get

get(taskId?): Promise<SDKTask>

Retrieves a task.

If the task id is not provided, the active task is returned.

Example

Copy
Copied
const activeTask = await dl.tasks.get()

Example

Copy
Copied
const task = await dl.tasks.get('taskId-123')

Parameters

Name Type Description
taskId? string The id of the task to be retrieved.

Returns

Promise<SDKTask>

  • A promise that resolves to the retrieved task.

Implementation of

IBundle.get


updateAssignees

updateAssignees(payload): Promise<SDKTask>

Updates the assignees of a task.

Example

Copy
Copied
const task = await dl.tasks.updateAssignees({
   taskId: 'taskId-123',
   action: 'add',
   assignees: ['test@dataloop.ai']
})

Example

Copy
Copied
const task = await dl.tasks.updateAssignees({
  taskId: 'taskId-123',
  action: 'remove',
  assignees: ['test@dataloop.ai']
})

Parameters

Name Type Description
payload SDKUpdateTaskAssigneesPayload The payload of the update assignees request.

Returns

Promise<SDKTask>

  • A promise that resolves to the updated task.