npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tsheets-sdk

v1.0.0

Published

TSheets JS SDK for full API access.

Downloads

31

Readme

TSheets Javascript SDK

NPM version NPM downloads Build Status Dependency Status Code Coverage Code Climate License Code Style

Simple client for full access to TSheets REST API.

Authentication

Set the environment variable TSHEETS_TOKEN to a TSheets access token.

Usage

ES6

// Top level import
import TSheets from 'tsheets-sdk'
// or destructured
import { reports, timesheets, groups, jobcodes } from 'tsheets-sdk'

API

Reports

reports.getPayrollReport(params)

Retrieves a payroll report, with filters to narrow down the results.

Example

import { reports } from 'tsheets-sdk'
reports().getPayrollReport()
  .then(report => console.log('report:', report))
  .catch(error => console.error('error getting report:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | No | | user_ids | Array of TSheets user IDs to get time for. | number[] | No | | page | Page number for timesheets (max 50 per page). | number | No |

reports.getProjectReport(params)

Retrieves a project report, with filters to narrow down the results.

Example

import { reports } from 'tsheets-sdk'
reports().getProjectReport()
  .then(report => console.log('report:', report))
  .catch(error => console.error('error getting report:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | No | | user_ids | Array of TSheets user IDs to get time for. | number[] | No | | page | Page number for timesheets (max 50 per page). | number | No |

reports.getCurrentTotalsReport(params)

Retrieves a current totals report, with filters to narrow down the results.

Example

import { reports } from 'tsheets-sdk'
reports().getCurrentTotalsReport()
  .then(report => console.log('report:', report))
  .catch(error => console.error('error getting report:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | No | | user_ids | Array of TSheets user IDs to get time for. | number[] | No | | page | Page number for timesheets (max 50 per page). | number | No |

Timesheets

timesheets.get(params)

Gets timesheets for the specified user(s) for the provided time period.

Example


import { timesheets } from 'tsheets-sdk'
// Can be imported from top level as well
// import Tsheets from 'tsheets-sdk'
// const { timesheets } = Tsheets

timesheets().get()
  .then(report => console.log('timesheets:', timesheets))
  .catch(error => console.error('error getting timesheets:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | Yes | | user_ids | Array of TSheets user IDs to get timesheets for. | number[] | No | | page | Page number for timesheets (max 50 per page). | number | No |

Jobcodes

jobcodes.get(params)

Gets jobcodes for the specified user(s) for the provided time period.

Example

import { reports } from 'tsheets-sdk'
jobcodes().get()
  .then(report => console.log('jobcodes:', jobcodes))
  .catch(error => console.error('error getting jobcodes:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | Yes | | user_ids | Array of TSheets user IDs to get jobcodes for. | number[] | No | | page | Page number for jobcodes (max 50 per page). | number | No |

Users

users.get(params)

Gets users for the specified filters.

Example

import { reports } from 'tsheets-sdk'
const start_date = '2016-01-01'
users().get({ start_date })
  .then(report => console.log('users:', users))
  .catch(error => console.error('error getting users:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | Yes | | user_ids | Array of TSheets user IDs to get users for. | number[] | No | | page | Page number for users (max 50 per page). | number | No |

Groups

groups.get(params)

Gets groups based on filters.

Example

import { reports } from 'tsheets-sdk'
const start_date = '2016-01-01'
groups().get({ start_date })
  .then(report => console.log('groups:', groups))
  .catch(error => console.error('error getting groups:', error))

Params

| Parameter | Description | Type | Required | |------------|--------------------------------------------------|----------|----------| | start_date | YYYY-MM-DD for the starting date. | string | Yes | | end_date | YYYY-MM-DD for the end date. | string | Yes | | user_ids | Array of TSheets user IDs to get groups for. | number[] | No | | page | Page number for groups (max 50 per page). | number | No |

Contribution

Note: Make sure you set the environment variable TSHEETS_TOKEN as described above or tests will not run.

  1. Install dependencies: npm install
  2. Check/Remove lint using: npm run lint:fix
  3. Run tests using: npm run test
  4. Create a Pull Request with your changes

License

MIT © Scott Prue