Provides methods for managing projects via the API.

This class extends ApiClient to interact with project-related endpoints, including listing, creating, updating, and deleting projects.

const projectsClient = new Projects();

// Fetch projects
const projects = await projectsClient.getProjects();
console.log(projects.data);

// Create a project
const newProject = await projectsClient.createProject({
name: "New Project",
description: "Project description",
});
console.log(newProject.data.id);

// Update a project
const updatedProject = await projectsClient.updateProject(123, {
name: "Updated Name",
});
console.log(updatedProject.data.name);

// Delete a project
const deleteResponse = await projectsClient.deleteProject(123);
console.log(deleteResponse);

Hierarchy

  • ApiClient
    • Projects

Constructors

Properties

accessToken: string
baseUrl: string
OnError?: (error: DribbbleError) => void
rateLimitHandler?: (rateLimit: RateLimit) => void

Methods

  • Creates a new project with the specified parameters.

    Parameters

    Returns Promise<FetchResponse<Project>>

    A promise that resolves to a FetchResponse containing the newly created Project.

    const newProject = await projectsClient.createProject({
    name: "New Project",
    description: "Project description",
    });
    console.log(newProject.data.id);
  • Deletes an existing project by its ID.

    Parameters

    • id: number

      The unique identifier of the project to delete.

    Returns Promise<FetchResponse<Project>>

    A promise that resolves to a FetchResponse indicating the deletion result.

    const deleteResponse = await projectsClient.deleteProject(123);
    console.log(deleteResponse);
  • Type Parameters

    • T

    Parameters

    • options: FetchOptions
    • needAccessToken: boolean = true

    Returns Promise<FetchResponse<T>>

  • Fetches a paginated list of projects.

    Parameters

    • page: number = 1

      The page number to retrieve. Defaults to 1.

    • per_page: number = 30

      The number of projects per page. Defaults to 30.

    Returns Promise<FetchResponse<Project[]>>

    A promise that resolves to a FetchResponse containing an array of Project objects.

    const projects = await projectsClient.getProjects(1, 20);
    console.log(projects.data);
  • Updates an existing project by its ID with the specified parameters.

    Parameters

    • id: number

      The unique identifier of the project to update.

    • params: ProjectParams

      The parameters for updating the project. See ProjectParams.

    Returns Promise<FetchResponse<Project>>

    A promise that resolves to a FetchResponse containing the updated Project.

    const updatedProject = await projectsClient.updateProject(123, {
    name: "Updated Project Name",
    });
    console.log(updatedProject.data.name);