Node SDK: TypeScript Types
The SDK exports full TypeScript types for all API objects.
Importing Types
import type {
TimeEntry,
TimeEntryCreate,
TimeEntryUpdate,
TimeEntryStart,
TimeEntrySource,
Expense,
ExpenseCreate,
Project,
User,
PaginatedResponse,
ListTimeEntriesParams,
ListExpensesParams,
} from '@keito/sdk';
TimeEntry
interface TimeEntry {
id: string;
project_id: string;
task_id: string;
user_id: string;
spent_date: string;
hours: number;
notes: string | null;
is_running: boolean;
timer_started_at: string | null;
started_time: string | null;
ended_time: string | null;
billable: boolean;
source: TimeEntrySource;
metadata: Record<string, unknown> | null;
created_at: string;
updated_at: string;
}
TimeEntryCreate
interface TimeEntryCreate {
project_id: string;
task_id: string;
spent_date: string;
hours?: number;
notes?: string;
is_running?: boolean;
replace_running?: boolean;
started_time?: string;
ended_time?: string;
billable?: boolean;
source?: TimeEntrySource;
metadata?: Record<string, unknown>;
}
For current running timers, prefer TimeEntryStart with timeEntries.startTimer(). It omits duration fields and sets is_running internally.
Expense
interface Expense {
id: string;
project_id: string;
expense_category_id: string;
spent_date: string;
units: number | null;
unit_price: number | null;
total_cost: number;
notes: string | null;
source: 'web' | 'cli' | 'api' | 'agent';
metadata: Record<string, unknown> | null;
created_at: string;
}
Project
interface Project {
id: string;
name: string;
client_id: string;
billing_type: 'time_and_materials' | 'fixed_fee' | 'non_billable';
is_billable: boolean;
budget_hours: number | null;
budget_amount: number | null;
is_active: boolean;
created_at: string;
}
User
interface User {
id: string;
name: string;
email: string;
user_type: 'human' | 'agent';
is_active: boolean;
billable_rate: number;
cost_rate: number;
created_at: string;
}
PaginatedResponse
interface PaginatedResponse<T> {
data: T[];
page: number;
per_page: number;
total_pages: number;
total_entries: number;
hasNextPage(): boolean;
nextPage(): Promise<PaginatedResponse<T>>;
}
Source Type
type TimeEntrySource = 'web' | 'cli' | 'api' | 'agent' | 'calendar' | 'desktop';