mcndt / toggl-client

Client for the Toggl API built for async and await support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Toggl-Client

Client for the Toggl API built for async and await support

Usage

npm i toggl-client
const togglClient = require('toggl-client');

const client = togglClient({ apiToken: YOUR_API_TOKEN });

API

Table of Contents

TogglClient

Main class to interact with the toggl API. Calling togglClient({ apiToken: YOUR_API_TOKEN }); returns an instance of this class.

Properties

Clients

Access clients. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/clients.md

list

Gets a list of clients

Returns any an array of clients

create

Creates a new client

Parameters
  • client any

Returns any Created client

get

Gets a client by id

Parameters

Returns any client or undefined if no client with specified id was found

update

Updates a client

Parameters

Returns any updated client

delete

Deletes a client by id

Parameters

projects

Lists projects associated with the given client

Parameters
  • id (number | string)
  • active
  • String active filter active clients by specifying true/false/both

Groups

Access groups. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/groups.md

create

Creates a group

Parameters
  • group any

Returns any group created

update

Updates a group

Parameters
  • id (number | string) group id that should be updated
  • group any

Returns any result of update operation

delete

Deletes a group

Parameters

ProjectUsers

Access project users. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/project_users.md

get

Gets a project user by id

Parameters

update

Updates an existing project user

Parameters
  • id (number | string) Id of the project user to update
  • project_user any

delete

Deletes an existing project user

Parameters

create

Creates a new project user

Parameters
  • project_user any

Returns any project user created

Projects

Access projects. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/projects.md

create

Creates a new project

Parameters
  • project any

Returns any Project created

get

Gets an existing project by id

Parameters

Returns any Project if a project with the specified id exists, othererwise undefined

update

Updates an existing project

Parameters
  • id (number | string) Id of the project to be updated
  • project any

Returns any The updated project

delete

Deletes an existing project

Parameters

users

Gets users associated with the given project

Parameters

Returns any Array of users associated with the project

tasks

Gets tasks associated with the given project

Parameters

Returns any Array of tasks associated with the project

Reports

Access reports. See https://github.com/toggl/toggl_api_docs/blob/master/reports.md

weekly

Weekly report URL GET https://api.track.toggl.com/reports/api/v2/weekly

Parameters
  • workspaceId

details

Detailed report URL: GET https://api.track.toggl.com/reports/api/v2/details

Parameters
  • workspaceId

summary

Summary report URL: GET https://api.track.toggl.com/reports/api/v2/summary

Parameters
  • workspaceId

Tags

Access Tasgs. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/tags.md

create

Creates a new tag

Parameters
  • tag any

Returns any Tag created

update

Updates an existing tag

Parameters

Returns any Updated tag

delete

Deletes an existing tag

Parameters

TimeEntries

Access time entries. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md

list

Lists time entries

Parameters
  • query any

Returns any List of time entries

create

Creates a new time entry

Parameters
  • time_entry any

Returns any

Workspaces

Access workspaces. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspaces.md

list

Lists all workspaces

Returns Array<Workspace> List of workspaces

get

Gets a workspace by id

Parameters

Returns (Workspace | undefined) Workspace or undefined if the given workspace does not exist

update

Updates an existing workspace

Parameters

Returns Workspace The updated workspace

users

Gets a list of users associated with the workspace

Parameters

Returns any List of users associated with the workspace

clients

Gets a list of clients associated with the workspace

Parameters

Returns any List of clients associated with the workspace

groups

Gets a list of groups associated with the workspace

Parameters

Returns any List of groups associated with the workspace

projects

Gets a list of projects associated with the workspace

Parameters

Returns any List of projects associated with the workspace

tasks

Gets a list of tasks associated with the workspace

Parameters

Returns any List of tasks associated with the workspace

tags

Gets a list of tags associated with the workspace

Parameters

Returns any List of tags associated with the workspace

Workspace

Type: Object

Properties

  • id number Id of the workspace
  • name number Name of the workspace
  • premium boolean True if premium features are enabled
  • admin boolean True if requesting user has admin access to the workspace
  • default_hourly_rate number Default hourly rate only shown for requesting admin users
  • default_currency string Default currency
  • only_admins_may_create_projects boolean
  • only_admins_see_billable_rates boolean
  • only_admins_see_team_dashboard boolean
  • rounding number type of rounding
  • rounding_minutes number round up to nearest minute
  • at date Indicates when the workspace was created or updated

About

Client for the Toggl API built for async and await support

License:ISC License


Languages

Language:JavaScript 100.0%