@timesheet/sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/README.md +59 -1
- package/dist/index.d.mts +462 -1
- package/dist/index.d.ts +462 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
## [1.0.3] - 2026-01-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- OAuth 2.1 authentication support with PKCE (Proof Key for Code Exchange)
|
|
13
|
+
- New `OAuth21Auth` class for OAuth 2.1 authorization code flow
|
|
14
|
+
- PKCE utilities: `generatePkceCodePair()`, `generateCodeVerifier()`, `generateCodeChallenge()`
|
|
15
|
+
- Support for public clients (optional client secret with PKCE)
|
|
16
|
+
- Resource indicators support (RFC 8707)
|
|
17
|
+
- Reports API integration (`reports.timesheet.io`) with full model support:
|
|
18
|
+
- `DocumentReportResource` - Document PDF/XML generation
|
|
19
|
+
- `TaskReportResource` - Task report generation
|
|
20
|
+
- `ExpenseReportResource` - Expense report generation
|
|
21
|
+
- `NoteReportResource` - Note report generation
|
|
22
|
+
- `ExportResource` - Excel/CSV/PDF exports with templates and custom fields
|
|
23
|
+
- Complete TypeScript models for reports: `DocumentReport`, `TaskReportItem`, `ExpenseReportItem`, `NoteReportItem`
|
|
24
|
+
- Export template management (CRUD operations)
|
|
25
|
+
- Custom export field management
|
|
26
|
+
- Comprehensive unit tests for Reports API
|
|
27
|
+
|
|
9
28
|
## [1.0.2] - 2025-10-25
|
|
10
29
|
|
|
11
30
|
### Added
|
|
@@ -70,7 +89,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
70
89
|
- Removed complex mocking in favor of simple validation tests
|
|
71
90
|
- Updated GitHub Actions to use non-deprecated action versions
|
|
72
91
|
|
|
73
|
-
[Unreleased]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.
|
|
92
|
+
[Unreleased]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.3...HEAD
|
|
93
|
+
[1.0.3]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.2...v1.0.3
|
|
74
94
|
[1.0.2]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.1...v1.0.2
|
|
75
95
|
[1.0.1]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.0...v1.0.1
|
|
76
96
|
[1.0.0]: https://github.com/timesheetIO/timesheet-typescript/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ The official TypeScript SDK for the [Timesheet API](https://timesheet.io), provi
|
|
|
12
12
|
|
|
13
13
|
- ✅ **Type-Safe** - Full TypeScript support with comprehensive types
|
|
14
14
|
- ✅ **Modern Architecture** - Promise-based with async/await support
|
|
15
|
-
- ✅ **Authentication** - Built-in API Key and
|
|
15
|
+
- ✅ **Authentication** - Built-in API Key, OAuth2, and OAuth 2.1 (PKCE) support
|
|
16
16
|
- ✅ **Error Handling** - Typed exceptions for better error management
|
|
17
17
|
- ✅ **Pagination** - Automatic pagination with async iterators
|
|
18
18
|
- ✅ **Retry Logic** - Configurable retry with exponential backoff
|
|
@@ -89,6 +89,64 @@ const client = new TimesheetClient({
|
|
|
89
89
|
});
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
### OAuth 2.1 Authentication (with PKCE)
|
|
93
|
+
|
|
94
|
+
OAuth 2.1 is the recommended authentication method for new applications. It requires PKCE (Proof Key for Code Exchange) for enhanced security.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { OAuth21Auth, generatePkceCodePair } from '@timesheet/sdk';
|
|
98
|
+
|
|
99
|
+
// Step 1: Generate PKCE code pair
|
|
100
|
+
const pkce = generatePkceCodePair();
|
|
101
|
+
// Store pkce.codeVerifier securely (e.g., in session storage)
|
|
102
|
+
|
|
103
|
+
// Step 2: Build authorization URL and redirect user
|
|
104
|
+
const authUrl = OAuth21Auth.buildAuthorizationUrl({
|
|
105
|
+
clientId: 'your-client-id',
|
|
106
|
+
redirectUri: 'https://your-app.com/callback',
|
|
107
|
+
codeChallenge: pkce.codeChallenge,
|
|
108
|
+
codeChallengeMethod: pkce.codeChallengeMethod,
|
|
109
|
+
state: 'random-csrf-state', // Optional but recommended
|
|
110
|
+
scope: 'read write', // Optional
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Redirect user to authUrl...
|
|
114
|
+
|
|
115
|
+
// Step 3: After user authorizes, exchange code for tokens
|
|
116
|
+
const auth = await OAuth21Auth.fromAuthorizationCode({
|
|
117
|
+
clientId: 'your-client-id',
|
|
118
|
+
clientSecret: 'your-client-secret', // Optional for public clients
|
|
119
|
+
authorizationCode: codeFromCallback,
|
|
120
|
+
redirectUri: 'https://your-app.com/callback',
|
|
121
|
+
codeVerifier: pkce.codeVerifier,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Step 4: Use with TimesheetClient
|
|
125
|
+
const client = new TimesheetClient({
|
|
126
|
+
authentication: auth
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Using OAuth 2.1 with existing tokens
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { OAuth21Auth } from '@timesheet/sdk';
|
|
134
|
+
|
|
135
|
+
// With just an access token
|
|
136
|
+
const auth = new OAuth21Auth('your-access-token');
|
|
137
|
+
|
|
138
|
+
// With refresh token for automatic token refresh
|
|
139
|
+
const auth = new OAuth21Auth({
|
|
140
|
+
clientId: 'your-client-id',
|
|
141
|
+
clientSecret: 'your-client-secret', // Optional for public clients
|
|
142
|
+
refreshToken: 'your-refresh-token',
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const client = new TimesheetClient({
|
|
146
|
+
authentication: auth
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
92
150
|
## Resources
|
|
93
151
|
|
|
94
152
|
All API resources are available through the client:
|
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,63 @@ declare class OAuth2Auth implements Authentication {
|
|
|
38
38
|
private parseTokenExpiry;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
type CodeChallengeMethod = 'S256' | 'plain';
|
|
42
|
+
interface PkceCodePair {
|
|
43
|
+
codeVerifier: string;
|
|
44
|
+
codeChallenge: string;
|
|
45
|
+
codeChallengeMethod: CodeChallengeMethod;
|
|
46
|
+
}
|
|
47
|
+
declare function generateCodeVerifier(length?: number): string;
|
|
48
|
+
declare function generateCodeChallenge(codeVerifier: string, method?: CodeChallengeMethod): string;
|
|
49
|
+
declare function generatePkceCodePair(method?: CodeChallengeMethod, verifierLength?: number): PkceCodePair;
|
|
50
|
+
declare function isValidCodeVerifier(codeVerifier: string): boolean;
|
|
51
|
+
|
|
52
|
+
interface AuthorizationUrlOptions {
|
|
53
|
+
clientId: string;
|
|
54
|
+
redirectUri: string;
|
|
55
|
+
codeChallenge: string;
|
|
56
|
+
codeChallengeMethod?: CodeChallengeMethod;
|
|
57
|
+
state?: string;
|
|
58
|
+
scope?: string;
|
|
59
|
+
resource?: string;
|
|
60
|
+
}
|
|
61
|
+
interface TokenExchangeOptions {
|
|
62
|
+
clientId: string;
|
|
63
|
+
clientSecret?: string;
|
|
64
|
+
authorizationCode: string;
|
|
65
|
+
redirectUri: string;
|
|
66
|
+
codeVerifier: string;
|
|
67
|
+
resource?: string;
|
|
68
|
+
}
|
|
69
|
+
interface OAuth21RefreshOptions {
|
|
70
|
+
clientId: string;
|
|
71
|
+
clientSecret?: string;
|
|
72
|
+
refreshToken: string;
|
|
73
|
+
resource?: string;
|
|
74
|
+
}
|
|
75
|
+
declare class OAuth21Auth implements Authentication {
|
|
76
|
+
private static readonly TOKEN_ENDPOINT;
|
|
77
|
+
private static readonly AUTH_ENDPOINT;
|
|
78
|
+
private accessToken;
|
|
79
|
+
private refreshToken?;
|
|
80
|
+
private readonly clientId?;
|
|
81
|
+
private readonly clientSecret?;
|
|
82
|
+
private readonly resource?;
|
|
83
|
+
private tokenExpiry?;
|
|
84
|
+
private refreshPromise?;
|
|
85
|
+
constructor(accessToken: string);
|
|
86
|
+
constructor(options: OAuth21RefreshOptions);
|
|
87
|
+
applyAuth(config: AxiosRequestConfig): void;
|
|
88
|
+
needsRefresh(): boolean;
|
|
89
|
+
refresh(): Promise<void>;
|
|
90
|
+
private performRefresh;
|
|
91
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
92
|
+
static fromAuthorizationCode(options: TokenExchangeOptions): Promise<OAuth21Auth>;
|
|
93
|
+
static buildAuthorizationUrl(options: AuthorizationUrlOptions): string;
|
|
94
|
+
static generatePkce(method?: CodeChallengeMethod): PkceCodePair;
|
|
95
|
+
private parseTokenExpiry;
|
|
96
|
+
}
|
|
97
|
+
|
|
41
98
|
declare class RetryConfig {
|
|
42
99
|
readonly maxRetries: number;
|
|
43
100
|
readonly initialDelay: number;
|
|
@@ -1016,6 +1073,26 @@ interface DocumentListParams extends ListParams {
|
|
|
1016
1073
|
empty?: boolean;
|
|
1017
1074
|
}
|
|
1018
1075
|
|
|
1076
|
+
type WebhookEventType = 'team.create' | 'team.update' | 'project.create' | 'project.update' | 'todo.create' | 'todo.update' | 'task.create' | 'task.update' | 'tag.create' | 'tag.update' | 'rate.create' | 'rate.update' | 'timer.start' | 'timer.stop' | 'timer.pause' | 'timer.resume';
|
|
1077
|
+
declare const WebhookEvents: {
|
|
1078
|
+
readonly TEAM_CREATE: "team.create";
|
|
1079
|
+
readonly TEAM_UPDATE: "team.update";
|
|
1080
|
+
readonly PROJECT_CREATE: "project.create";
|
|
1081
|
+
readonly PROJECT_UPDATE: "project.update";
|
|
1082
|
+
readonly TODO_CREATE: "todo.create";
|
|
1083
|
+
readonly TODO_UPDATE: "todo.update";
|
|
1084
|
+
readonly TASK_CREATE: "task.create";
|
|
1085
|
+
readonly TASK_UPDATE: "task.update";
|
|
1086
|
+
readonly TAG_CREATE: "tag.create";
|
|
1087
|
+
readonly TAG_UPDATE: "tag.update";
|
|
1088
|
+
readonly RATE_CREATE: "rate.create";
|
|
1089
|
+
readonly RATE_UPDATE: "rate.update";
|
|
1090
|
+
readonly TIMER_START: "timer.start";
|
|
1091
|
+
readonly TIMER_STOP: "timer.stop";
|
|
1092
|
+
readonly TIMER_PAUSE: "timer.pause";
|
|
1093
|
+
readonly TIMER_RESUME: "timer.resume";
|
|
1094
|
+
};
|
|
1095
|
+
declare function combineWebhookEvents(...events: WebhookEventType[]): string;
|
|
1019
1096
|
interface Webhook {
|
|
1020
1097
|
id: string;
|
|
1021
1098
|
target: string;
|
|
@@ -1163,6 +1240,332 @@ interface ProfileUpdateRequest {
|
|
|
1163
1240
|
newsletter?: boolean;
|
|
1164
1241
|
}
|
|
1165
1242
|
|
|
1243
|
+
interface TaskReportItem {
|
|
1244
|
+
taskDate?: string;
|
|
1245
|
+
taskStartTime?: string;
|
|
1246
|
+
taskEndTime?: string;
|
|
1247
|
+
taskTimeRange?: string;
|
|
1248
|
+
taskDuration?: string;
|
|
1249
|
+
taskDurationRelative?: string;
|
|
1250
|
+
pauseDuration?: string;
|
|
1251
|
+
taskDescription?: string;
|
|
1252
|
+
taskId?: string;
|
|
1253
|
+
userId?: string;
|
|
1254
|
+
invoiceId?: string;
|
|
1255
|
+
startDateTimeRaw?: string;
|
|
1256
|
+
endDateTimeRaw?: string;
|
|
1257
|
+
durationSeconds?: number;
|
|
1258
|
+
durationBreakSeconds?: number;
|
|
1259
|
+
taskLocation?: string;
|
|
1260
|
+
taskLocationStart?: string;
|
|
1261
|
+
taskLocationEnd?: string;
|
|
1262
|
+
taskDistance?: string;
|
|
1263
|
+
taskRateName?: string;
|
|
1264
|
+
taskRate?: string;
|
|
1265
|
+
taskTotal?: string;
|
|
1266
|
+
taskTotalRelative?: string;
|
|
1267
|
+
projectName?: string;
|
|
1268
|
+
projectClient?: string;
|
|
1269
|
+
projectColor?: string;
|
|
1270
|
+
memberName?: string;
|
|
1271
|
+
taskTags?: string;
|
|
1272
|
+
taskSignature?: string;
|
|
1273
|
+
quantityHours?: number;
|
|
1274
|
+
unitPriceNumeric?: number;
|
|
1275
|
+
lineTotalNumeric?: number;
|
|
1276
|
+
salaryTotalNumeric?: number;
|
|
1277
|
+
salaryBreakNumeric?: number;
|
|
1278
|
+
projectId?: string;
|
|
1279
|
+
memberId?: string;
|
|
1280
|
+
billable?: boolean;
|
|
1281
|
+
paid?: boolean;
|
|
1282
|
+
expenses?: ExpenseReportItem[];
|
|
1283
|
+
notes?: NoteReportItem[];
|
|
1284
|
+
}
|
|
1285
|
+
interface ExpenseReportItem {
|
|
1286
|
+
expenseDate?: string;
|
|
1287
|
+
expenseTime?: string;
|
|
1288
|
+
expenseAmount?: string;
|
|
1289
|
+
expenseDescription?: string;
|
|
1290
|
+
expenseDescriptionRaw?: string;
|
|
1291
|
+
expenseDateTimeRaw?: string;
|
|
1292
|
+
expenseId?: string;
|
|
1293
|
+
expenseUserId?: string;
|
|
1294
|
+
attachmentBase64?: string;
|
|
1295
|
+
expenseAuthor?: string;
|
|
1296
|
+
amountNumeric?: number;
|
|
1297
|
+
}
|
|
1298
|
+
interface NoteReportItem {
|
|
1299
|
+
noteDate?: string;
|
|
1300
|
+
noteContent?: string;
|
|
1301
|
+
attachmentBase64?: string;
|
|
1302
|
+
noteType?: string;
|
|
1303
|
+
noteAuthor?: string;
|
|
1304
|
+
}
|
|
1305
|
+
interface DocumentReport {
|
|
1306
|
+
documentTitle?: string;
|
|
1307
|
+
documentDate?: string;
|
|
1308
|
+
invoiceNumber?: string;
|
|
1309
|
+
customerNumber?: string;
|
|
1310
|
+
paymentDate?: string;
|
|
1311
|
+
paymentMethod?: string;
|
|
1312
|
+
companyName?: string;
|
|
1313
|
+
companyAddress1?: string;
|
|
1314
|
+
companyAddress2?: string;
|
|
1315
|
+
companyAddress3?: string;
|
|
1316
|
+
companyAddress4?: string;
|
|
1317
|
+
companyLogo?: string;
|
|
1318
|
+
customerName?: string;
|
|
1319
|
+
customerAddress1?: string;
|
|
1320
|
+
customerAddress2?: string;
|
|
1321
|
+
customerAddress3?: string;
|
|
1322
|
+
customerAddress4?: string;
|
|
1323
|
+
taskSubtotal?: string;
|
|
1324
|
+
expenseSubtotal?: string;
|
|
1325
|
+
subtotalAmount?: string;
|
|
1326
|
+
taxRate?: number;
|
|
1327
|
+
taxAmount?: string;
|
|
1328
|
+
taxSecondRate?: number;
|
|
1329
|
+
taxSecondAmount?: string;
|
|
1330
|
+
discountRate?: number;
|
|
1331
|
+
discountAmount?: string;
|
|
1332
|
+
discountSecondRate?: number;
|
|
1333
|
+
discountSecondAmount?: string;
|
|
1334
|
+
totalAmount?: string;
|
|
1335
|
+
totalDuration?: string;
|
|
1336
|
+
paymentAmount?: string;
|
|
1337
|
+
eInvoiceType?: string;
|
|
1338
|
+
companyVatId?: string;
|
|
1339
|
+
companyTaxNumber?: string;
|
|
1340
|
+
companyRegistrationNumber?: string;
|
|
1341
|
+
companyBankAccount?: string;
|
|
1342
|
+
companyBankBIC?: string;
|
|
1343
|
+
eInvoiceCurrency?: string;
|
|
1344
|
+
deliveryDate?: string;
|
|
1345
|
+
dueDate?: string;
|
|
1346
|
+
paymentReference?: string;
|
|
1347
|
+
orderReference?: string;
|
|
1348
|
+
taxExemptionReason?: string;
|
|
1349
|
+
reverseChargeRate?: number;
|
|
1350
|
+
isReverseCharge?: boolean;
|
|
1351
|
+
eInvoiceDocumentType?: string;
|
|
1352
|
+
invoiceTypeCode?: string;
|
|
1353
|
+
customerVatId?: string;
|
|
1354
|
+
customerTaxNumber?: string;
|
|
1355
|
+
customerOrderNumber?: string;
|
|
1356
|
+
paymentTermDays?: number;
|
|
1357
|
+
cashDiscountRate?: number;
|
|
1358
|
+
cashDiscountDays?: number;
|
|
1359
|
+
originalInvoiceNumber?: string;
|
|
1360
|
+
originalInvoiceDate?: string;
|
|
1361
|
+
projectReference?: string;
|
|
1362
|
+
costCenter?: string;
|
|
1363
|
+
isGovernmentInvoice?: boolean;
|
|
1364
|
+
procurementReference?: string;
|
|
1365
|
+
contractReference?: string;
|
|
1366
|
+
eInvoicingEnabled?: boolean;
|
|
1367
|
+
documentDescription?: string;
|
|
1368
|
+
documentTerms?: string;
|
|
1369
|
+
documentSignature?: string;
|
|
1370
|
+
showTaskTime?: boolean;
|
|
1371
|
+
showRates?: boolean;
|
|
1372
|
+
showTaxes?: boolean;
|
|
1373
|
+
showSecondTax?: boolean;
|
|
1374
|
+
showDiscount?: boolean;
|
|
1375
|
+
showSecondDiscount?: boolean;
|
|
1376
|
+
includeExpenses?: boolean;
|
|
1377
|
+
includeNotes?: boolean;
|
|
1378
|
+
showProjectTitle?: boolean;
|
|
1379
|
+
showMemberName?: boolean;
|
|
1380
|
+
showTags?: boolean;
|
|
1381
|
+
showQrCode?: boolean;
|
|
1382
|
+
qrCodeType?: string;
|
|
1383
|
+
qrCodeContent?: string;
|
|
1384
|
+
qrCodeDescription?: string;
|
|
1385
|
+
hideExpenseDateTime?: boolean;
|
|
1386
|
+
hideSummation?: boolean;
|
|
1387
|
+
useRelatives?: boolean;
|
|
1388
|
+
tasks?: TaskReportItem[];
|
|
1389
|
+
expenses?: ExpenseReportItem[];
|
|
1390
|
+
notes?: NoteReportItem[];
|
|
1391
|
+
labelDescription?: string;
|
|
1392
|
+
labelRate?: string;
|
|
1393
|
+
labelQuantity?: string;
|
|
1394
|
+
labelTotal?: string;
|
|
1395
|
+
labelTotalSum?: string;
|
|
1396
|
+
labelSubtotal?: string;
|
|
1397
|
+
labelTax?: string;
|
|
1398
|
+
labelSecondTax?: string;
|
|
1399
|
+
labelDiscount?: string;
|
|
1400
|
+
labelSecondDiscount?: string;
|
|
1401
|
+
labelExpenseTitle?: string;
|
|
1402
|
+
labelExpenseTotal?: string;
|
|
1403
|
+
templateId?: string;
|
|
1404
|
+
reportType?: string;
|
|
1405
|
+
language?: string;
|
|
1406
|
+
currency?: string;
|
|
1407
|
+
currencyCode?: string;
|
|
1408
|
+
}
|
|
1409
|
+
interface ExportedField {
|
|
1410
|
+
id: string;
|
|
1411
|
+
name?: string;
|
|
1412
|
+
position?: number;
|
|
1413
|
+
projectField?: boolean;
|
|
1414
|
+
teamField?: boolean;
|
|
1415
|
+
customField?: boolean;
|
|
1416
|
+
customValue?: string;
|
|
1417
|
+
customFormula?: string;
|
|
1418
|
+
customType?: string;
|
|
1419
|
+
}
|
|
1420
|
+
interface ExportParams {
|
|
1421
|
+
report: number;
|
|
1422
|
+
email?: string;
|
|
1423
|
+
filename?: string;
|
|
1424
|
+
teamIds?: string[];
|
|
1425
|
+
projectIds?: string[];
|
|
1426
|
+
userIds?: string[];
|
|
1427
|
+
tagIds?: string[];
|
|
1428
|
+
type?: string;
|
|
1429
|
+
startDate: string;
|
|
1430
|
+
endDate: string;
|
|
1431
|
+
format?: ExportFormat;
|
|
1432
|
+
filter?: string;
|
|
1433
|
+
splitTask?: boolean;
|
|
1434
|
+
summarize?: boolean;
|
|
1435
|
+
saveAsTemplate?: boolean;
|
|
1436
|
+
templateName?: string;
|
|
1437
|
+
exportedFields?: ExportedField[];
|
|
1438
|
+
}
|
|
1439
|
+
type ExportFormat = 'xlsx' | 'xlsx1904' | 'csv' | 'pdf';
|
|
1440
|
+
interface ExportTemplateParams {
|
|
1441
|
+
templateId: string;
|
|
1442
|
+
startDate: string;
|
|
1443
|
+
endDate: string;
|
|
1444
|
+
}
|
|
1445
|
+
interface FileResponse {
|
|
1446
|
+
url: string;
|
|
1447
|
+
filename?: string;
|
|
1448
|
+
contentType?: string;
|
|
1449
|
+
}
|
|
1450
|
+
interface ExportTemplate {
|
|
1451
|
+
id: string;
|
|
1452
|
+
user?: string;
|
|
1453
|
+
deleted?: boolean;
|
|
1454
|
+
lastUpdate?: number;
|
|
1455
|
+
created?: number;
|
|
1456
|
+
name: string;
|
|
1457
|
+
report: number;
|
|
1458
|
+
teamIds?: string[];
|
|
1459
|
+
projectIds?: string[];
|
|
1460
|
+
userIds?: string[];
|
|
1461
|
+
tagIds?: string[];
|
|
1462
|
+
type?: string;
|
|
1463
|
+
format?: string;
|
|
1464
|
+
filter?: string;
|
|
1465
|
+
splitTask?: boolean;
|
|
1466
|
+
summarize?: boolean;
|
|
1467
|
+
email?: string;
|
|
1468
|
+
filename?: string;
|
|
1469
|
+
exportedFields?: ExportedField[];
|
|
1470
|
+
}
|
|
1471
|
+
interface ExportTemplateCreateRequest {
|
|
1472
|
+
name: string;
|
|
1473
|
+
report?: number;
|
|
1474
|
+
teamIds?: string[];
|
|
1475
|
+
projectIds?: string[];
|
|
1476
|
+
userIds?: string[];
|
|
1477
|
+
tagIds?: string[];
|
|
1478
|
+
type?: string;
|
|
1479
|
+
format?: string;
|
|
1480
|
+
filter?: string;
|
|
1481
|
+
splitTask?: boolean;
|
|
1482
|
+
summarize?: boolean;
|
|
1483
|
+
email?: string;
|
|
1484
|
+
filename?: string;
|
|
1485
|
+
exportedFields?: ExportedField[];
|
|
1486
|
+
}
|
|
1487
|
+
interface ExportTemplateUpdateRequest {
|
|
1488
|
+
name?: string;
|
|
1489
|
+
report?: number;
|
|
1490
|
+
teamIds?: string[];
|
|
1491
|
+
projectIds?: string[];
|
|
1492
|
+
userIds?: string[];
|
|
1493
|
+
tagIds?: string[];
|
|
1494
|
+
type?: string;
|
|
1495
|
+
format?: string;
|
|
1496
|
+
filter?: string;
|
|
1497
|
+
splitTask?: boolean;
|
|
1498
|
+
summarize?: boolean;
|
|
1499
|
+
email?: string;
|
|
1500
|
+
filename?: string;
|
|
1501
|
+
exportedFields?: ExportedField[];
|
|
1502
|
+
}
|
|
1503
|
+
interface ExportTemplateListParams {
|
|
1504
|
+
sort?: 'alpha' | 'name' | 'created' | 'lastUpdate';
|
|
1505
|
+
order?: 'asc' | 'desc';
|
|
1506
|
+
page?: number;
|
|
1507
|
+
limit?: number;
|
|
1508
|
+
search?: string;
|
|
1509
|
+
}
|
|
1510
|
+
interface ExportFieldDefinition {
|
|
1511
|
+
fieldId: string;
|
|
1512
|
+
nameKey?: string;
|
|
1513
|
+
descriptionKey?: string;
|
|
1514
|
+
name: string;
|
|
1515
|
+
description?: string;
|
|
1516
|
+
type?: string;
|
|
1517
|
+
category?: string;
|
|
1518
|
+
scope?: string;
|
|
1519
|
+
defaultEnabled?: boolean;
|
|
1520
|
+
defaultPosition?: number;
|
|
1521
|
+
customField?: boolean;
|
|
1522
|
+
customType?: string;
|
|
1523
|
+
customValue?: string;
|
|
1524
|
+
customFormula?: string;
|
|
1525
|
+
}
|
|
1526
|
+
interface ExportFieldsResponse {
|
|
1527
|
+
fields: ExportFieldDefinition[];
|
|
1528
|
+
}
|
|
1529
|
+
interface ExportReportType {
|
|
1530
|
+
id: number;
|
|
1531
|
+
name: string;
|
|
1532
|
+
description?: string;
|
|
1533
|
+
acceptsCustomFields?: boolean;
|
|
1534
|
+
fieldScope?: string;
|
|
1535
|
+
}
|
|
1536
|
+
interface ExportReportsResponse {
|
|
1537
|
+
reports: ExportReportType[];
|
|
1538
|
+
}
|
|
1539
|
+
interface CustomExportField {
|
|
1540
|
+
id: string;
|
|
1541
|
+
user?: string;
|
|
1542
|
+
name: string;
|
|
1543
|
+
scope: string;
|
|
1544
|
+
type: string;
|
|
1545
|
+
value?: string;
|
|
1546
|
+
width?: number;
|
|
1547
|
+
deleted?: boolean;
|
|
1548
|
+
lastUpdate?: number;
|
|
1549
|
+
created?: number;
|
|
1550
|
+
}
|
|
1551
|
+
interface CustomExportFieldCreateRequest {
|
|
1552
|
+
name: string;
|
|
1553
|
+
scope: string;
|
|
1554
|
+
type: string;
|
|
1555
|
+
value?: string;
|
|
1556
|
+
width?: number;
|
|
1557
|
+
}
|
|
1558
|
+
interface CustomExportFieldUpdateRequest {
|
|
1559
|
+
name?: string;
|
|
1560
|
+
scope?: string;
|
|
1561
|
+
type?: string;
|
|
1562
|
+
value?: string;
|
|
1563
|
+
width?: number;
|
|
1564
|
+
}
|
|
1565
|
+
interface CustomExportFieldsResponse {
|
|
1566
|
+
fields: CustomExportField[];
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1166
1569
|
interface ResourceConfig {
|
|
1167
1570
|
basePath: string;
|
|
1168
1571
|
}
|
|
@@ -1333,6 +1736,60 @@ declare class WebhookResource extends Resource {
|
|
|
1333
1736
|
search(params: WebhookListParams): Promise<NavigablePage<Webhook>>;
|
|
1334
1737
|
}
|
|
1335
1738
|
|
|
1739
|
+
declare class DocumentReportResource extends Resource {
|
|
1740
|
+
constructor(client: ApiClient);
|
|
1741
|
+
get(documentId: string): Promise<DocumentReport>;
|
|
1742
|
+
getPdf(documentId: string): Promise<ArrayBuffer>;
|
|
1743
|
+
getXml(documentId: string): Promise<string>;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
declare class TaskReportResource extends Resource {
|
|
1747
|
+
constructor(client: ApiClient);
|
|
1748
|
+
get(taskId: string): Promise<TaskReportItem>;
|
|
1749
|
+
getPdf(taskId: string): Promise<ArrayBuffer>;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
declare class ExpenseReportResource extends Resource {
|
|
1753
|
+
constructor(client: ApiClient);
|
|
1754
|
+
get(expenseId: string): Promise<ExpenseReportItem>;
|
|
1755
|
+
getPdf(expenseId: string): Promise<ArrayBuffer>;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
declare class NoteReportResource extends Resource {
|
|
1759
|
+
constructor(client: ApiClient);
|
|
1760
|
+
get(noteId: string): Promise<NoteReportItem>;
|
|
1761
|
+
getPdf(noteId: string): Promise<ArrayBuffer>;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
declare class ExportResource extends Resource {
|
|
1765
|
+
constructor(client: ApiClient);
|
|
1766
|
+
generate(params: ExportParams): Promise<FileResponse>;
|
|
1767
|
+
send(params: ExportParams): Promise<void>;
|
|
1768
|
+
generateFromTemplate(params: ExportTemplateParams): Promise<ArrayBuffer>;
|
|
1769
|
+
getFields(scope?: 'all' | 'project' | 'team'): Promise<ExportFieldsResponse>;
|
|
1770
|
+
getReportTypes(): Promise<ExportReportsResponse>;
|
|
1771
|
+
listTemplates(params?: ExportTemplateListParams): Promise<NavigablePage<ExportTemplate>>;
|
|
1772
|
+
searchTemplates(params: ExportTemplateListParams): Promise<NavigablePage<ExportTemplate>>;
|
|
1773
|
+
createTemplate(data: ExportTemplateCreateRequest): Promise<ExportTemplate>;
|
|
1774
|
+
getTemplate(templateId: string): Promise<ExportTemplate>;
|
|
1775
|
+
updateTemplate(templateId: string, data: ExportTemplateUpdateRequest): Promise<ExportTemplate>;
|
|
1776
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
1777
|
+
listCustomFields(scope?: 'TASK' | 'PROJECT' | 'TEAM'): Promise<CustomExportFieldsResponse>;
|
|
1778
|
+
createCustomField(data: CustomExportFieldCreateRequest): Promise<CustomExportField>;
|
|
1779
|
+
getCustomField(fieldId: string): Promise<CustomExportField>;
|
|
1780
|
+
updateCustomField(fieldId: string, data: CustomExportFieldUpdateRequest): Promise<CustomExportField>;
|
|
1781
|
+
deleteCustomField(fieldId: string): Promise<void>;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
declare class ReportsClient {
|
|
1785
|
+
readonly documents: DocumentReportResource;
|
|
1786
|
+
readonly tasks: TaskReportResource;
|
|
1787
|
+
readonly expenses: ExpenseReportResource;
|
|
1788
|
+
readonly notes: NoteReportResource;
|
|
1789
|
+
readonly export: ExportResource;
|
|
1790
|
+
constructor(apiClient: ApiClient);
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1336
1793
|
declare class TimesheetApiError extends Error {
|
|
1337
1794
|
readonly statusCode?: number;
|
|
1338
1795
|
readonly responseBody?: string;
|
|
@@ -1352,6 +1809,7 @@ declare class TimesheetRateLimitError extends TimesheetApiError {
|
|
|
1352
1809
|
|
|
1353
1810
|
declare class TimesheetClient {
|
|
1354
1811
|
private readonly apiClient;
|
|
1812
|
+
private readonly reportsApiClient;
|
|
1355
1813
|
readonly organizations: OrganizationResource;
|
|
1356
1814
|
readonly teams: TeamResource;
|
|
1357
1815
|
readonly projects: ProjectResource;
|
|
@@ -1368,6 +1826,7 @@ declare class TimesheetClient {
|
|
|
1368
1826
|
readonly timer: TimerResource;
|
|
1369
1827
|
readonly todos: TodoResource;
|
|
1370
1828
|
readonly webhooks: WebhookResource;
|
|
1829
|
+
readonly reports: ReportsClient;
|
|
1371
1830
|
constructor(options: TimesheetClientOptions);
|
|
1372
1831
|
private createAuthentication;
|
|
1373
1832
|
}
|
|
@@ -1381,9 +1840,11 @@ interface TimesheetClientOptions {
|
|
|
1381
1840
|
};
|
|
1382
1841
|
authentication?: Authentication;
|
|
1383
1842
|
baseUrl?: string;
|
|
1843
|
+
reportsBaseUrl?: string;
|
|
1384
1844
|
retryConfig?: RetryConfig;
|
|
1385
1845
|
httpClient?: AxiosInstance;
|
|
1846
|
+
reportsHttpClient?: AxiosInstance;
|
|
1386
1847
|
}
|
|
1387
1848
|
declare function createClient(options: TimesheetClientOptions): TimesheetClient;
|
|
1388
1849
|
|
|
1389
|
-
export { type Activity, ApiClient, ApiKeyAuth, type Authentication, type Automation, type AutomationCreateRequest, type AutomationList, type AutomationListParams, AutomationResource, type AutomationUpdateRequest, type ClientConfig, type Document, type DocumentCreateRequest, type DocumentList, type DocumentListParams, type DocumentPrint, DocumentResource, type DocumentUpdateRequest, type Expense, type ExpenseCreateRequest, type ExpenseList, type ExpenseListParams, ExpenseResource, type ExpenseStatus, type ExpenseUpdateRequest, type ListParams, type Member, NavigablePage, type Note, type NoteCreateRequest, type NoteList, type NoteListParams, NoteResource, type NoteUpdateRequest, OAuth2Auth, type Organization, type OrganizationCreateRequest, type OrganizationList, type OrganizationListParams, OrganizationResource, type OrganizationUpdateRequest, type Page, type PageParams, type Pause, type PauseCreateRequest, type PauseList, type PauseListParams, PauseResource, type PauseUpdateRequest, type Profile, ProfileResource, type ProfileUpdateRequest, type Project, type ProjectCreateRequest, type ProjectList, type ProjectListParams, type ProjectMember, ProjectResource, type ProjectUpdateRequest, type Rate, type RateCreateRequest, type RateList, type RateListParams, RateResource, type RateUpdateRequest, Resource, RetryConfig, type RetryConfigOptions, type Settings, SettingsResource, type SettingsUpdateRequest, type SortablePageParams, type Tag, type TagCreateRequest, type TagList, type TagListParams, TagResource, type TagUpdateRequest, type Task, type TaskCreateRequest, type TaskList, type TaskListParams, type TaskPerformance, TaskResource, type TaskStatistic, type TaskStatusUpdateRequest, type TaskTimesUpdateRequest, type TaskUpdateRequest, type Team, type TeamCreateRequest, type TeamList, type TeamListParams, type TeamMember, type TeamMemberList, type TeamMemberListParams, TeamResource, type TeamUpdateRequest, type Timer, type TimerPauseRequest, TimerResource, type TimerResumeRequest, type TimerStartRequest, type TimerStopRequest, type TimerUpdateRequest, TimesheetApiError, TimesheetAuthError, TimesheetClient, type TimesheetClientOptions, TimesheetRateLimitError, type Todo, type TodoCreateRequest, type TodoList, type TodoListParams, TodoResource, type TodoUpdateRequest, type Webhook, type WebhookCreateRequest, type WebhookList, type WebhookListParams, WebhookResource, type WebhookUpdateRequest, createClient };
|
|
1850
|
+
export { type Activity, ApiClient, ApiKeyAuth, type Authentication, type AuthorizationUrlOptions, type Automation, type AutomationCreateRequest, type AutomationList, type AutomationListParams, AutomationResource, type AutomationUpdateRequest, type ClientConfig, type CodeChallengeMethod, type CustomExportField, type CustomExportFieldCreateRequest, type CustomExportFieldUpdateRequest, type CustomExportFieldsResponse, type Document, type DocumentCreateRequest, type DocumentList, type DocumentListParams, type DocumentPrint, type DocumentReport, DocumentReportResource, DocumentResource, type DocumentUpdateRequest, type Expense, type ExpenseCreateRequest, type ExpenseList, type ExpenseListParams, type ExpenseReportItem, ExpenseReportResource, ExpenseResource, type ExpenseStatus, type ExpenseUpdateRequest, type ExportFieldDefinition, type ExportFieldsResponse, type ExportFormat, type ExportParams, type ExportReportType, type ExportReportsResponse, ExportResource, type ExportTemplate, type ExportTemplateCreateRequest, type ExportTemplateListParams, type ExportTemplateParams, type ExportTemplateUpdateRequest, type ExportedField, type FileResponse, type ListParams, type Member, NavigablePage, type Note, type NoteCreateRequest, type NoteList, type NoteListParams, type NoteReportItem, NoteReportResource, NoteResource, type NoteUpdateRequest, OAuth21Auth, type OAuth21RefreshOptions, OAuth2Auth, type Organization, type OrganizationCreateRequest, type OrganizationList, type OrganizationListParams, OrganizationResource, type OrganizationUpdateRequest, type Page, type PageParams, type Pause, type PauseCreateRequest, type PauseList, type PauseListParams, PauseResource, type PauseUpdateRequest, type PkceCodePair, type Profile, ProfileResource, type ProfileUpdateRequest, type Project, type ProjectCreateRequest, type ProjectList, type ProjectListParams, type ProjectMember, ProjectResource, type ProjectUpdateRequest, type Rate, type RateCreateRequest, type RateList, type RateListParams, RateResource, type RateUpdateRequest, ReportsClient, Resource, RetryConfig, type RetryConfigOptions, type Settings, SettingsResource, type SettingsUpdateRequest, type SortablePageParams, type Tag, type TagCreateRequest, type TagList, type TagListParams, TagResource, type TagUpdateRequest, type Task, type TaskCreateRequest, type TaskList, type TaskListParams, type TaskPerformance, type TaskReportItem, TaskReportResource, TaskResource, type TaskStatistic, type TaskStatusUpdateRequest, type TaskTimesUpdateRequest, type TaskUpdateRequest, type Team, type TeamCreateRequest, type TeamList, type TeamListParams, type TeamMember, type TeamMemberList, type TeamMemberListParams, TeamResource, type TeamUpdateRequest, type Timer, type TimerPauseRequest, TimerResource, type TimerResumeRequest, type TimerStartRequest, type TimerStopRequest, type TimerUpdateRequest, TimesheetApiError, TimesheetAuthError, TimesheetClient, type TimesheetClientOptions, TimesheetRateLimitError, type Todo, type TodoCreateRequest, type TodoList, type TodoListParams, TodoResource, type TodoUpdateRequest, type TokenExchangeOptions, type Webhook, type WebhookCreateRequest, type WebhookEventType, WebhookEvents, type WebhookList, type WebhookListParams, WebhookResource, type WebhookUpdateRequest, combineWebhookEvents, createClient, generateCodeChallenge, generateCodeVerifier, generatePkceCodePair, isValidCodeVerifier };
|