Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

rocketlane-sdk

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rocketlane-sdk

Unofficial TypeScript SDK for Rocketlane API

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
6
-94.23%
Maintainers
1
Weekly downloads
 
Created
Source

Rocketlane SDK

Unofficial TypeScript SDK for the Rocketlane API. Provides comprehensive, type-safe access to all Rocketlane resources including tasks, projects, users, time tracking, and more.

Installation

npm install rocketlane-sdk

Quick Start

import { RocketlaneClient } from 'rocketlane-sdk';

const client = new RocketlaneClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.rocketlane.com', // Optional, defaults to this
});

// Get all tasks
const tasks = await client.tasks.list();

// Create a new task
const newTask = await client.tasks.create({
  taskName: 'Review API Integration',
  projectId: 123456,
  assignees: [78910],
});

// Get a specific project
const project = await client.projects.get(123456);

Authentication

The SDK requires an API key for authentication. You can obtain your API key from your Rocketlane account settings.

const client = new RocketlaneClient({
  apiKey: process.env.ROCKETLANE_API_KEY!,
});

Configuration

Basic Configuration

const client = new RocketlaneClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.rocketlane.com', // Optional
  timeout: 30000, // Optional, default: 30000ms
  retries: 3, // Optional, default: 3
});

Resources

Tasks

Complete task management with support for assignees, followers, dependencies, and custom fields.

// List tasks with filtering
const tasks = await client.tasks.list({
  projectId: 123456,
  status: 1, // Status ID
  assigneeId: 78910,
  pageSize: 50,
  includeFields: 'startDateActual,dueDateActual,billable',
});

// Get a specific task
const task = await client.tasks.get(987654);

// Create a task
const newTask = await client.tasks.create({
  taskName: 'Implement new feature',
  projectId: 123456,
  startDate: '2024-01-01',
  dueDate: '2024-01-15',
  assignees: [78910],
  priority: 1,
  fields: {
    'custom-field-id': 'custom value'
  }
});

// Update a task
const updatedTask = await client.tasks.update(987654, {
  taskName: 'Updated task name',
  status: 2,
  progress: 50,
});

// Add assignees to a task
await client.tasks.addAssignees(987654, {
  assignees: [11111, 22222]
});

// Move task to different phase
await client.tasks.moveToPhase(987654, {
  phaseId: 555555,
  position: 1
});

// Archive a task
await client.tasks.archive(987654);

// Helper methods
const projectTasks = await client.tasks.getByProject(123456);
const userTasks = await client.tasks.getByAssignee(78910);
const searchResults = await client.tasks.search('API integration');

Projects

Full project lifecycle management with members, phases, and templates.

// List projects
const projects = await client.projects.list({
  companyId: 12345,
  status: 1,
  pageSize: 25,
});

// Get project details
const project = await client.projects.get(123456, 'startDate,dueDate,teamMembers');

// Create a new project
const newProject = await client.projects.create({
  projectName: 'Website Redesign',
  companyId: 12345,
  startDate: '2024-01-01',
  dueDate: '2024-03-31',
  ownerId: 78910,
  teamMembers: [11111, 22222],
  visibility: 'MEMBERS',
});

// Add team members
await client.projects.addMembers(123456, {
  members: [33333, 44444]
});

// Import a template
await client.projects.importTemplate(123456, {
  templateId: 98765,
  startDate: '2024-02-01'
});

// Archive a project
await client.projects.archive(123456);

Users

User management with roles, permissions, and custom fields.

// List users
const users = await client.users.list({
  type: 'TEAM_MEMBER',
  status: 'ACTIVE',
  companyId: 12345,
});

// Get user details
const user = await client.users.get(78910);

// Create a new user
const newUser = await client.users.create({
  email: 'jane.doe@company.com',
  firstName: 'Jane',
  lastName: 'Doe',
  type: 'TEAM_MEMBER',
  companyId: 12345,
  role: 'Developer',
  capacityInMinutes: 2400, // 40 hours per week
});

// Invite users in bulk
await client.users.bulkInvite({
  users: [
    {
      email: 'user1@company.com',
      firstName: 'User',
      lastName: 'One',
      type: 'TEAM_MEMBER',
      companyId: 12345,
    },
    // ... more users
  ]
});

// Helper methods
const teamMembers = await client.users.getTeamMembers();
const activeUsers = await client.users.getActive();
const partnerUsers = await client.users.getPartners();

Time Tracking

Comprehensive time tracking with categories, approval workflows, and reporting.

// List time entries
const timeEntries = await client.timeTracking.list({
  projectId: 123456,
  userId: 78910,
  dateFrom: '2024-01-01',
  dateTo: '2024-01-31',
  billable: true,
});

// Create a time entry
const newEntry = await client.timeTracking.create({
  date: '2024-01-15',
  minutes: 120,
  projectId: 123456,
  categoryId: 87426,
  taskId: 987654,
  billable: true,
  description: 'Code review and testing',
});

// Bulk create time entries
await client.timeTracking.bulkCreate({
  entries: [
    {
      date: '2024-01-15',
      minutes: 60,
      projectId: 123456,
      categoryId: 87426,
      billable: true,
    },
    // ... more entries
  ]
});

// Approve time entries
await client.timeTracking.approve({
  timeEntryIds: [111, 222, 333]
});

// Get time entry categories
const categories = await client.timeTracking.getCategories();

// Timer functionality
const timer = await client.timeTracking.startTimer({
  projectId: 123456,
  categoryId: 87426,
  description: 'Working on new feature'
});

// Stop the timer
const completedEntry = await client.timeTracking.stopTimer(timer.timerId);

// Generate reports
const report = await client.timeTracking.getReport({
  projectId: 123456,
  dateFrom: '2024-01-01',
  dateTo: '2024-01-31',
  groupBy: 'user'
});

Custom Fields

Manage custom fields across different entity types.

// List custom fields
const fields = await client.fields.list({
  entity: 'task',
  active: true,
});

// Create a custom field
const newField = await client.fields.create({
  fieldName: 'Priority Level',
  type: 'select',
  required: true,
  visibility: {
    entities: ['task', 'project'],
  },
  options: [
    { label: 'High', value: 'high' },
    { label: 'Medium', value: 'medium' },
    { label: 'Low', value: 'low' },
  ]
});

// Update entity field values
await client.fields.updateEntityFields('task', 987654, {
  fields: {
    'field-id-1': 'high',
    'field-id-2': '2024-01-31',
  }
});

// Manage field options
await client.fields.createOption('field-id', {
  label: 'Critical',
  value: 'critical',
  color: '#ff0000'
});

Phases

Project phase management with ordering and progress tracking.

// List phases
const phases = await client.phases.list({
  projectId: 123456,
  status: 'In Progress',
});

// Create a new phase
const newPhase = await client.phases.create({
  phaseName: 'Development',
  projectId: 123456,
  startDate: '2024-01-01',
  dueDate: '2024-02-29',
  color: '#007bff',
});

// Reorder phases
await client.phases.reorder({
  phaseIds: [111, 222, 333] // New order
});

// Duplicate a phase
await client.phases.duplicate(555555, {
  newPhaseName: 'Development Phase 2',
  includeTasks: true
});

Error Handling

The SDK includes comprehensive error handling with automatic retries for transient failures.

import { RocketlaneClient, RocketlaneError } from 'rocketlane-sdk';

try {
  const tasks = await client.tasks.list();
} catch (error) {
  if (error instanceof RocketlaneError) {
    console.error(`API Error ${error.statusCode}: ${error.message}`);
    console.error('Response:', error.response?.data);
  } else {
    console.error('Unexpected error:', error);
  }
}

Pagination

The SDK provides multiple ways to handle paginated responses with two distinct approaches:

🎯 Choose Your Style

Option 1: Resource-based methods (traditional)

const response = await client.tasks.list({ pageSize: 100 });
const nextPage = await client.tasks.getNextPage(response, { pageSize: 100 });

Option 2: Response-based methods (intuitive)

const response = await client.tasks.listWithPagination({ pageSize: 100 });
const nextPage = await response.getNextPage();

Resource-Based Pagination (Traditional)

// Get next page via resource method
const firstPage = await client.tasks.list({ pageSize: 100 });
const nextPage = await client.tasks.getNextPage(firstPage, { pageSize: 100 });

// Get all results at once
const allTasks = await client.tasks.getAllTasks({ projectId: 123456 });

// Iterate through pages/items
for await (const page of client.tasks.iterateTaskPages({ status: 1 })) {
  console.log(`Page with ${page.data.length} tasks`);
}

for await (const task of client.tasks.iterateTasks({ status: 1 })) {
  console.log(`Task: ${task.taskName}`);
}

Response-Based Pagination (Intuitive)

// Get enhanced response with built-in pagination methods
const response = await client.tasks.listWithPagination({ pageSize: 100 });

// Much cleaner next page syntax
const nextPage = await response.getNextPage();
const thirdPage = await nextPage?.getNextPage();

// Get all remaining items from this response
const allRemaining = await response.getAllRemaining();

// Iterate through remaining pages/items from this response
for await (const page of response.iterateRemainingPages()) {
  console.log(`Page with ${page.data.length} tasks`);
}

for await (const task of response.iterateRemainingItems()) {
  console.log(`Task: ${task.taskName}`);
}

Comparison: Which Should You Use?

FeatureResource-BasedResponse-Based
Syntaxclient.tasks.getNextPage(response, params)response.getNextPage()
Intuitive⭐⭐⭐⭐⭐⭐⭐⭐
Flexible⭐⭐⭐⭐⭐⭐⭐⭐⭐
Type Safety⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Parameter Control⭐⭐⭐⭐⭐⭐⭐⭐

Recommendation:

  • Use response-based for simple, straightforward pagination
  • Use resource-based when you need to modify parameters between pages

Manual Pagination (Advanced)

// Manual pagination with full control
let pageToken: string | undefined;
do {
  const response = await client.tasks.list({
    projectId: 123456,
    pageToken,
    pageSize: 100
  });
  
  // Process response.data
  console.log(`Got ${response.data.length} tasks`);
  
  pageToken = response.pagination.nextPageToken;
} while (response.pagination.hasMore);

Pagination Methods Available on All Resources

Every paginated resource provides these helper methods:

  • getNextPage(response, originalParams) - Get the next page from a response
  • getAll[Resources](params) - Get all items across all pages
  • iterate[Resource]Pages(params) - Async generator for pages
  • iterate[Resources](params) - Async generator for individual items

Examples:

// Tasks
const allTasks = await client.tasks.getAllTasks();
for await (const task of client.tasks.iterateTasks()) { /* ... */ }

// Projects  
const allProjects = await client.projects.getAllProjects();
for await (const project of client.projects.iterateProjects()) { /* ... */ }

// Users
const allUsers = await client.users.getAllUsers();
for await (const user of client.users.iterateUsers()) { /* ... */ }

// Time Entries
const allTimeEntries = await client.timeTracking.getAllTimeEntries();
for await (const entry of client.timeTracking.iterateTimeEntries()) { /* ... */ }

// And so on for all resources...

TypeScript Support

The SDK is built with TypeScript and provides comprehensive type definitions:

import {
  RocketlaneClient,
  Task,
  Project,
  User,
  TimeEntry,
  CreateTaskRequest,
  TasksQueryParams,
} from 'rocketlane-sdk';

// All responses are properly typed
const tasks: Task[] = (await client.tasks.list()).data;

// Request objects have full type safety
const taskData: CreateTaskRequest = {
  taskName: 'New Task',
  projectId: 123456,
  // TypeScript will validate all properties
};

// Query parameters are type-checked
const queryParams: TasksQueryParams = {
  status: 1,
  assigneeId: 78910,
  sortBy: 'dueDate',
  sortOrder: 'asc',
  includeFields: 'startDateActual,dueDateActual'
};

Rate Limiting

The SDK automatically handles rate limiting with exponential backoff retry logic. Failed requests due to rate limiting (429 status code) or server errors (5xx) are automatically retried.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

MIT License - see LICENSE file for details.

Support

Changelog

See CHANGELOG.md for version history and updates.

Keywords

rocketlane

FAQs

Package last updated on 16 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts