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 🙏

© 2026 – Pkg Stats / Ryan Hefner

timing-api-client

v0.1.5

Published

Node.js client for the Timing App Web API

Readme

Timing API Client for Node.js

npm version

A Node.js client library for interacting with the Timing time-tracking application's Web API.

This library provides convenient methods for managing projects and time entries through the Timing API.

[!warning] This library is not officially supported by Timing. It is a community-driven project and may not cover all API features or be up-to-date with the latest API changes.

Features

  • Easy initialization with your API key.
  • Typed methods for interacting with API resources (Projects, Time Entries).
  • Handles API requests and responses.
  • Provides specific error types (ApiError) for better error handling.
  • Supports TypeScript.

Installation

npm install timing-api-client
# or
yarn add timing-api-client

(Replace timing-api-client with the actual package name if it's different on npm)

Getting Started

First, you need your Timing API key. You can find it in the Timing Web App under Settings -> Integrations -> API. It's recommended to store your API key securely, for example, using environment variables.

import { TimingClient, ApiError } from "timing-api-client"; // Use your actual package name if different

const apiKey = process.env.TIMING_API_KEY;

if (!apiKey) {
  throw new Error("TIMING_API_KEY environment variable is not set.");
}

const client = new TimingClient({ apiKey });

async function main() {
  try {
    // List projects
    console.log("Fetching projects...");
    const projects = await client.projects.list();
    console.log(`Found ${projects.length} projects.`);
    if (projects.length > 0) {
      console.log(`First project: ${projects[0].title} (${projects[0].self})`);

      // Start a timer for the first project
      const projectRef = projects[0].self; // e.g., '/projects/123'
      console.log(`\nStarting timer for project ${projectRef}...`);
      const startedEntry = await client.timeEntries.start({
        project: projectRef,
        title: "Working on SDK README",
      });
      console.log("Timer started:", startedEntry);

      // Wait a bit (e.g., 5 seconds) - in a real app, this would be user activity
      await new Promise((resolve) => setTimeout(resolve, 5000));

      // Stop the timer
      console.log("\nStopping timer...");
      const stoppedEntry = await client.timeEntries.stop();
      console.log("Timer stopped:", stoppedEntry);
    }

    // List recent time entries
    console.log("\nFetching recent time entries...");
    const timeEntries = await client.timeEntries.list({ limit: 5 });
    console.log(`Found ${timeEntries.length} recent time entries.`);
    timeEntries.forEach((entry) => {
      console.log(`  - ${entry.title || "(No title)"} (${entry.start_date})`);
    });
  } catch (error) {
    if (error instanceof ApiError) {
      // Handle API-specific errors
      console.error(`API Error (${error.status}): ${error.message}`);
      // You can inspect error.originalError for more details from Axios
    } else if (error instanceof Error) {
      // Handle other errors
      console.error(`Error: ${error.message}`);
    } else {
      console.error("An unknown error occurred:", error);
    }
  }
}

main();

API Documentation

For detailed information on all available methods, parameters, and types, please refer to the API Reference documentation.

This includes operations for:

  • Time Entries: Start, Stop, Create, List, Get, Update, Delete
  • Projects: Create, List, Get, Update, Delete, Get Time Entries for a Project

Error Handling

The client uses a custom ApiError class (exported from the package) for errors originating from the API or the request process. You can catch these errors and inspect their status and message properties. The originalError property may contain the underlying Axios error object for more details.

import { TimingClient, ApiError } from "timing-api-client";

// ... client initialization ...

try {
  await client.projects.get("non-existent-id");
} catch (error) {
  if (error instanceof ApiError) {
    console.error(`Status: ${error.status}`); // e.g., 404
    console.error(`Message: ${error.message}`); // e.g., "Not Found"
    // console.error('Original Error:', error.originalError);
  } else {
    console.error("An unexpected error occurred:", error);
  }
}

Development

  • Build: npm run build (or configure your build script in package.json)
  • Test: npm test (or configure your test script in package.json)

License

MIT