Class: Projects

repositories.Projects

Projects repository.

The Projects class allows the user to manage projects and their properties.

Hierarchy

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new Projects(agent)

Creates an instance of Repository.

Parameters

Name Type
agent PeerAgent

Inherited from

Repository .constructor

Methods

create

create(payload): Promise<SDKProject>

Creates a new project.

Example

Copy
Copied
const project = await dl.projects.create({
    name: 'My Project'
})

Parameters

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

Returns

Promise<SDKProject>

  • A promise that resolves to the created project.

delete

delete(projectId): Promise<void>

Deletes a project.

Example

Copy
Copied
await dl.projects.delete('projectId-123')

Parameters

Name Type Description
projectId string The id of the project to be deleted.

Returns

Promise<void>

  • A promise that resolves when the project is deleted.

get

get(projectId?): Promise<SDKProject>

Gets a project by project id.

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

Example

Copy
Copied
const projectById = await dl.projects.get('projectId-123')
const activeProject = await dl.projects.get()

Parameters

Name Type Description
projectId? string The id of the project to be retrieved.

Returns

Promise<SDKProject>

  • A promise that resolves to the project.

Implementation of

IBundle.get


query

query(): Promise<IPagedResponse<SDKProject>>

Lists all projects.

Example

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

Returns

Promise<IPagedResponse<SDKProject>>

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

Implementation of

IBundle.query


update

update(payload): Promise<SDKProject>

Updates a project.

Example

Copy
Copied
const project = await dl.projects.update({
    id: 'projectId-123',
    name: 'New Project Name'
})

Parameters

Name Type Description
payload Object An object containing the project's id and name.
payload.id string The id of the project to be updated.
payload.name string The new name of the project.

Returns

Promise<SDKProject>

  • A promise that resolves to the updated project.

Implementation of

IBundle.update