Class: Datasets

repositories.Datasets

Datasets repository.

The Datasets class allows the user to manage datasets.

Hierarchy

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new Datasets(agent)

Creates an instance of Repository.

Parameters

Name Type
agent PeerAgent

Inherited from

Repository .constructor

Methods

create

create(payload): Promise<SDKDataset>

Creates a new dataset.

Example

Copy
Copied
const dataset = await dl.datasets.create({
    name: 'My Dataset'
})

Parameters

Name Type Description
payload Object An object containing the dataset's name.
payload.name string The name of the dataset to be created.

Returns

Promise<SDKDataset>

  • A promise that resolves to the created dataset.

delete

delete(datasetId): Promise<void>

Deletes a dataset by id.

Example

Copy
Copied
await dl.datasets.delete('datasetId-123')

Parameters

Name Type Description
datasetId string The id of the dataset to be deleted.

Returns

Promise<void>

  • A promise that resolves when the dataset is deleted.

get

get(datasetId?): Promise<SDKDataset>

Retrieves a dataset by id.

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

Example

Copy
Copied
const activeDataset = await dl.datasets.get()

Example

Copy
Copied
const dataset = await dl.datasets.get('datasetId-123')

Parameters

Name Type Description
datasetId? string The id of the dataset to be retrieved.

Returns

Promise<SDKDataset>

  • A promise that resolves to the retrieved dataset.

query

query(): Promise<IPagedResponse<SDKDataset>>

Retrieves a list of datasets.

Example

Copy
Copied
const pagedResponse = await dl.datasets.query()
const datasets = pagedResponse.items

Returns

Promise<IPagedResponse<SDKDataset>>

  • Returns a Promise that resolves to a paged response object of datasets.

update

update(payload): Promise<SDKDataset>

Updates a dataset --- currently not supported.

Parameters

Name Type Description
payload Partial<SDKDataset> The fields to update on the dataset.

Returns

Promise<SDKDataset>

  • A promise that resolves to the updated dataset.