tick-api
v0.2.0
Published
TypeScript/JavaScript client for the Tick v2 API providing time tracking functionality
Maintainers
Readme
Tick v2 API TS/JS Client
Implements a TypeScript/JavaScript client for the Tick v2 API, providing a simple interface to interact with Tick's time tracking features. Implemented based on the Tick v2 API documentation. Uses built-in fetch for HTTP requests, thus requiring Node.js 18+ or a compatible environment.
Installation
npm install tick-apiQuick Start
import { TickClient } from 'tick-api';
const client = new TickClient({
subscriptionId: 'your_subscription_id',
apiToken: 'your_api_token',
userAgent: 'MyCoolApp ([email protected])',
});
// Get all users (will only return the current user's data if not admin)
const users = await client.getUsers();
// Get all projects
const projects = await client.getProjects();
// Create a new time entry
const entry = await client.createEntry({
date: '2025-06-13',
hours: 8,
notes: 'Worked on project X',
task_id: 123,
});Available Methods
The TickClient provides methods for the following API endpoints:
Users
getUsers()- Get all usersgetDeletedUsers()- Get deleted users (admin only)createUser(params)- Create a new user (admin only)
Clients
getClients()- Get active clientsgetAllClients()- Get all clients including archivedgetClient(id)- Get client detailscreateClient(params)- Create new client (admin only)updateClient(id, params)- Update client (admin only)deleteClient(id)- Delete client (admin only)
Projects
getProjects(params?)- Get open projectsgetClosedProjects(params?)- Get closed projectsgetProject(id)- Get project detailscreateProject(params)- Create new project (admin only)updateProject(id, params)- Update project (admin only)deleteProject(id)- Delete project (admin only)
Tasks
getTasks()- Get all open tasksgetProjectTasks(projectId)- Get tasks for a projectgetClosedTasks()- Get all closed tasksgetProjectClosedTasks(projectId)- Get closed tasks for a projectgetTask(id)- Get task detailscreateTask(params)- Create new task (admin only)updateTask(id, params)- Update task (admin only)deleteTask(id)- Delete task (admin only)
Entries
getEntries(params)- Get time entriesgetUserEntries(userId, params)- Get entries for a usergetProjectEntries(projectId, params)- Get entries for a projectgetTaskEntries(taskId, params)- Get entries for a taskgetEntry(id)- Get entry detailscreateEntry(params)- Create new entryupdateEntry(id, params)- Update entrydeleteEntry(id)- Delete entry
Testing
This package includes both unit tests and end-to-end tests:
Unit Tests
Run the unit tests to verify the client instantiation and method availability:
npm testEnd-to-End Tests
E2E tests run against the real TickSpot API and test all non-destructive getter functions.
Setup:
- Copy the environment example file:
cp .env.example .env - Fill in your TickSpot credentials in
.env - Build the project:
npm run build
Run E2E tests:
# Run all E2E tests
npm run test:e2eSee tests/e2e/README.md for detailed E2E test documentation.
