Class Projects

The Projects API provides access for getting and manipulating projects. It can be accessed through Time.Projects, for example:

const project = await Time.Projects.createProject({ name: "My Project" })

Hierarchy

  • Projects

Methods

  • Fetches all projects for the current organisation from the database and returns them.

    Returns

    The projects for the current organisation

    Throws

    This request may fail with the following error codes:

    • ErrorCode.Unauthorised
    • ErrorCode.DifferentOrganisation

    Returns Promise<IProject[]>

  • Deletes the project with the given ID. If the project is not found in the database, the method will return the message "Project already deleted":

    {
    "message": "Project already deleted"
    }
    If you get this message, you may have to refresh the projects list in your store.

    Returns

    The deleted project or the message "Project already deleted"

    Parameters

    • projectId: string

      The ID of the project to delete

    Returns Promise<Deleted<IProject>>

  • Fetches all projects for the current organisation from the database and returns them with total hours.

    Returns

    The projects for the current organisation with total hours

    Returns Promise<IProjectWithTotalMinutes[]>