@37signals/basecamp 0.2.3 → 0.4.0

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.
Files changed (44) hide show
  1. package/dist/client.d.ts +1 -1
  2. package/dist/client.js +1 -1
  3. package/dist/generated/metadata.json +17 -1
  4. package/dist/generated/openapi-stripped.json +834 -202
  5. package/dist/generated/path-mapping.js +1 -1
  6. package/dist/generated/path-mapping.js.map +1 -1
  7. package/dist/generated/path-mapping.ts +1 -1
  8. package/dist/generated/schema.d.ts +2 -3
  9. package/dist/generated/services/reports.d.ts +18 -4
  10. package/dist/generated/services/reports.d.ts.map +1 -1
  11. package/dist/generated/services/reports.js +7 -7
  12. package/dist/generated/services/reports.js.map +1 -1
  13. package/dist/generated/services/reports.ts +19 -8
  14. package/dist/generated/services/search.d.ts +3 -5
  15. package/dist/generated/services/search.d.ts.map +1 -1
  16. package/dist/generated/services/search.js +4 -4
  17. package/dist/generated/services/search.js.map +1 -1
  18. package/dist/generated/services/search.ts +4 -6
  19. package/dist/generated/services/timeline.d.ts +5 -2
  20. package/dist/generated/services/timeline.d.ts.map +1 -1
  21. package/dist/generated/services/timeline.js +1 -1
  22. package/dist/generated/services/timeline.js.map +1 -1
  23. package/dist/generated/services/timeline.ts +4 -2
  24. package/dist/generated/services/timesheets.d.ts +18 -14
  25. package/dist/generated/services/timesheets.d.ts.map +1 -1
  26. package/dist/generated/services/timesheets.js +10 -12
  27. package/dist/generated/services/timesheets.js.map +1 -1
  28. package/dist/generated/services/timesheets.ts +22 -18
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/services/base.d.ts +13 -0
  33. package/dist/services/base.d.ts.map +1 -1
  34. package/dist/services/base.js +97 -0
  35. package/dist/services/base.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/generated/metadata.json +17 -1
  38. package/src/generated/openapi-stripped.json +834 -202
  39. package/src/generated/path-mapping.ts +1 -1
  40. package/src/generated/schema.d.ts +2 -3
  41. package/src/generated/services/reports.ts +19 -8
  42. package/src/generated/services/search.ts +4 -6
  43. package/src/generated/services/timeline.ts +4 -2
  44. package/src/generated/services/timesheets.ts +22 -18
@@ -119,7 +119,7 @@ export const PATH_TO_OPERATION: Record<string, string> = {
119
119
  "GET:/{accountId}/reports/todos/assigned.json": "ListAssignablePeople",
120
120
  "GET:/{accountId}/reports/todos/assigned/{personId}": "GetAssignedTodos",
121
121
  "GET:/{accountId}/reports/todos/overdue.json": "GetOverdueTodos",
122
- "GET:/{accountId}/reports/users/progress/{personId}": "GetPersonProgress",
122
+ "GET:/{accountId}/reports/users/progress/{personId}.json": "GetPersonProgress",
123
123
  "GET:/{accountId}/schedule_entries/{entryId}": "GetScheduleEntry",
124
124
  "PUT:/{accountId}/schedule_entries/{entryId}": "UpdateScheduleEntry",
125
125
  "GET:/{accountId}/schedule_entries/{entryId}/occurrences/{date}": "GetScheduleEntryOccurrence",
@@ -1651,7 +1651,7 @@ export interface paths {
1651
1651
  patch?: never;
1652
1652
  trace?: never;
1653
1653
  };
1654
- "/reports/users/progress/{personId}": {
1654
+ "/reports/users/progress/{personId}.json": {
1655
1655
  parameters: {
1656
1656
  query?: never;
1657
1657
  header?: never;
@@ -12449,10 +12449,9 @@ export interface operations {
12449
12449
  Search: {
12450
12450
  parameters: {
12451
12451
  query: {
12452
- query: string;
12452
+ q: string;
12453
12453
  /** @description created_at|updated_at */
12454
12454
  sort?: string;
12455
- page?: number;
12456
12455
  };
12457
12456
  header?: never;
12458
12457
  path?: never;
@@ -13,6 +13,10 @@ import type { PaginationOptions } from "../../pagination.js";
13
13
  // Types
14
14
  // =============================================================================
15
15
 
16
+ /** TimelineEvent entity from the Basecamp API. */
17
+ export type TimelineEvent = components["schemas"]["TimelineEvent"];
18
+ /** Person entity from the Basecamp API. */
19
+ export type Person = components["schemas"]["Person"];
16
20
 
17
21
  /**
18
22
  * Options for progress.
@@ -38,6 +42,12 @@ export interface AssignedReportOptions {
38
42
  groupBy?: string;
39
43
  }
40
44
 
45
+ /**
46
+ * Options for personProgress.
47
+ */
48
+ export interface PersonProgressReportOptions extends PaginationOptions {
49
+ }
50
+
41
51
 
42
52
  // =============================================================================
43
53
  // Service
@@ -51,14 +61,14 @@ export class ReportsService extends BaseService {
51
61
  /**
52
62
  * Get account-wide activity feed (progress report)
53
63
  * @param options - Optional query parameters
54
- * @returns All results across all pages, with .meta.totalCount
64
+ * @returns All TimelineEvent across all pages, with .meta.totalCount
55
65
  *
56
66
  * @example
57
67
  * ```ts
58
68
  * const result = await client.reports.progress();
59
69
  * ```
60
70
  */
61
- async progress(options?: ProgressReportOptions): Promise<components["schemas"]["GetProgressReportResponseContent"]> {
71
+ async progress(options?: ProgressReportOptions): Promise<ListResult<TimelineEvent>> {
62
72
  return this.requestPaginated(
63
73
  {
64
74
  service: "Reports",
@@ -159,15 +169,16 @@ export class ReportsService extends BaseService {
159
169
  /**
160
170
  * Get a person's activity timeline
161
171
  * @param personId - The person ID
162
- * @returns The person_progress
172
+ * @param options - Optional query parameters
173
+ * @returns Wrapper with events as ListResult<TimelineEvent> across all pages
163
174
  *
164
175
  * @example
165
176
  * ```ts
166
177
  * const result = await client.reports.personProgress(123);
167
178
  * ```
168
179
  */
169
- async personProgress(personId: number): Promise<components["schemas"]["GetPersonProgressResponseContent"]> {
170
- const response = await this.request(
180
+ async personProgress(personId: number, options?: PersonProgressReportOptions): Promise<{ person: Person; events: ListResult<TimelineEvent> }> {
181
+ return this.requestPaginatedWrapped<"events", TimelineEvent>(
171
182
  {
172
183
  service: "Reports",
173
184
  operation: "GetPersonProgress",
@@ -176,12 +187,12 @@ export class ReportsService extends BaseService {
176
187
  resourceId: personId,
177
188
  },
178
189
  () =>
179
- this.client.GET("/reports/users/progress/{personId}", {
190
+ this.client.GET("/reports/users/progress/{personId}.json", {
180
191
  params: {
181
192
  path: { personId },
182
193
  },
183
194
  })
184
- );
185
- return response;
195
+ , "events", options
196
+ ) as unknown as { person: Person; events: ListResult<TimelineEvent> };
186
197
  }
187
198
  }
@@ -20,8 +20,6 @@ import type { PaginationOptions } from "../../pagination.js";
20
20
  export interface SearchSearchOptions extends PaginationOptions {
21
21
  /** Filter by sort */
22
22
  sort?: "created_at" | "updated_at";
23
- /** Page */
24
- page?: number;
25
23
  }
26
24
 
27
25
 
@@ -36,16 +34,16 @@ export class SearchService extends BaseService {
36
34
 
37
35
  /**
38
36
  * Search for content across the account
39
- * @param query - query
37
+ * @param q - q
40
38
  * @param options - Optional query parameters
41
39
  * @returns All results across all pages, with .meta.totalCount
42
40
  *
43
41
  * @example
44
42
  * ```ts
45
- * const result = await client.search.search("query");
43
+ * const result = await client.search.search("q");
46
44
  * ```
47
45
  */
48
- async search(query: string, options?: SearchSearchOptions): Promise<components["schemas"]["SearchResponseContent"]> {
46
+ async search(q: string, options?: SearchSearchOptions): Promise<components["schemas"]["SearchResponseContent"]> {
49
47
  return this.requestPaginated(
50
48
  {
51
49
  service: "Search",
@@ -56,7 +54,7 @@ export class SearchService extends BaseService {
56
54
  () =>
57
55
  this.client.GET("/search.json", {
58
56
  params: {
59
- query: { query: query, sort: options?.sort, page: options?.page },
57
+ query: { q: q, sort: options?.sort },
60
58
  },
61
59
  })
62
60
  , options
@@ -13,6 +13,8 @@ import type { PaginationOptions } from "../../pagination.js";
13
13
  // Types
14
14
  // =============================================================================
15
15
 
16
+ /** TimelineEvent entity from the Basecamp API. */
17
+ export type TimelineEvent = components["schemas"]["TimelineEvent"];
16
18
 
17
19
  /**
18
20
  * Options for projectTimeline.
@@ -34,14 +36,14 @@ export class TimelineService extends BaseService {
34
36
  * Get project timeline
35
37
  * @param projectId - The project ID
36
38
  * @param options - Optional query parameters
37
- * @returns All results across all pages, with .meta.totalCount
39
+ * @returns All TimelineEvent across all pages, with .meta.totalCount
38
40
  *
39
41
  * @example
40
42
  * ```ts
41
43
  * const result = await client.timeline.projectTimeline(123);
42
44
  * ```
43
45
  */
44
- async projectTimeline(projectId: number, options?: ProjectTimelineTimelineOptions): Promise<components["schemas"]["GetProjectTimelineResponseContent"]> {
46
+ async projectTimeline(projectId: number, options?: ProjectTimelineTimelineOptions): Promise<ListResult<TimelineEvent>> {
45
47
  return this.requestPaginated(
46
48
  {
47
49
  service: "Timeline",
@@ -6,17 +6,21 @@
6
6
 
7
7
  import { BaseService } from "../../services/base.js";
8
8
  import type { components } from "../schema.js";
9
+ import { ListResult } from "../../pagination.js";
10
+ import type { PaginationOptions } from "../../pagination.js";
9
11
  import { Errors } from "../../errors.js";
10
12
 
11
13
  // =============================================================================
12
14
  // Types
13
15
  // =============================================================================
14
16
 
17
+ /** TimesheetEntry entity from the Basecamp API. */
18
+ export type TimesheetEntry = components["schemas"]["TimesheetEntry"];
15
19
 
16
20
  /**
17
21
  * Options for forProject.
18
22
  */
19
- export interface ForProjectTimesheetOptions {
23
+ export interface ForProjectTimesheetOptions extends PaginationOptions {
20
24
  /** From */
21
25
  from?: string;
22
26
  /** To */
@@ -28,7 +32,7 @@ export interface ForProjectTimesheetOptions {
28
32
  /**
29
33
  * Options for forRecording.
30
34
  */
31
- export interface ForRecordingTimesheetOptions {
35
+ export interface ForRecordingTimesheetOptions extends PaginationOptions {
32
36
  /** From */
33
37
  from?: string;
34
38
  /** To */
@@ -91,15 +95,15 @@ export class TimesheetsService extends BaseService {
91
95
  * Get timesheet for a specific project
92
96
  * @param projectId - The project ID
93
97
  * @param options - Optional query parameters
94
- * @returns Array of results
98
+ * @returns All TimesheetEntry across all pages, with .meta.totalCount
95
99
  *
96
100
  * @example
97
101
  * ```ts
98
102
  * const result = await client.timesheets.forProject(123);
99
103
  * ```
100
104
  */
101
- async forProject(projectId: number, options?: ForProjectTimesheetOptions): Promise<components["schemas"]["GetProjectTimesheetResponseContent"]> {
102
- const response = await this.request(
105
+ async forProject(projectId: number, options?: ForProjectTimesheetOptions): Promise<ListResult<TimesheetEntry>> {
106
+ return this.requestPaginated(
103
107
  {
104
108
  service: "Timesheets",
105
109
  operation: "GetProjectTimesheet",
@@ -114,23 +118,23 @@ export class TimesheetsService extends BaseService {
114
118
  query: { from: options?.from, to: options?.to, "person_id": options?.personId },
115
119
  },
116
120
  })
121
+ , options
117
122
  );
118
- return response ?? [];
119
123
  }
120
124
 
121
125
  /**
122
126
  * Get timesheet for a specific recording
123
127
  * @param recordingId - The recording ID
124
128
  * @param options - Optional query parameters
125
- * @returns Array of results
129
+ * @returns All TimesheetEntry across all pages, with .meta.totalCount
126
130
  *
127
131
  * @example
128
132
  * ```ts
129
133
  * const result = await client.timesheets.forRecording(123);
130
134
  * ```
131
135
  */
132
- async forRecording(recordingId: number, options?: ForRecordingTimesheetOptions): Promise<components["schemas"]["GetRecordingTimesheetResponseContent"]> {
133
- const response = await this.request(
136
+ async forRecording(recordingId: number, options?: ForRecordingTimesheetOptions): Promise<ListResult<TimesheetEntry>> {
137
+ return this.requestPaginated(
134
138
  {
135
139
  service: "Timesheets",
136
140
  operation: "GetRecordingTimesheet",
@@ -145,15 +149,15 @@ export class TimesheetsService extends BaseService {
145
149
  query: { from: options?.from, to: options?.to, "person_id": options?.personId },
146
150
  },
147
151
  })
152
+ , options
148
153
  );
149
- return response ?? [];
150
154
  }
151
155
 
152
156
  /**
153
157
  * Create a timesheet entry on a recording
154
158
  * @param recordingId - The recording ID
155
159
  * @param req - Timesheet_entry creation parameters
156
- * @returns The timesheet_entry
160
+ * @returns The TimesheetEntry
157
161
  * @throws {BasecampError} If required fields are missing or invalid
158
162
  *
159
163
  * @example
@@ -161,7 +165,7 @@ export class TimesheetsService extends BaseService {
161
165
  * const result = await client.timesheets.create(123, { date: "example", hours: "example" });
162
166
  * ```
163
167
  */
164
- async create(recordingId: number, req: CreateTimesheetRequest): Promise<components["schemas"]["CreateTimesheetEntryResponseContent"]> {
168
+ async create(recordingId: number, req: CreateTimesheetRequest): Promise<TimesheetEntry> {
165
169
  if (!req.date) {
166
170
  throw Errors.validation("Date is required");
167
171
  }
@@ -195,14 +199,14 @@ export class TimesheetsService extends BaseService {
195
199
  /**
196
200
  * Get account-wide timesheet report
197
201
  * @param options - Optional query parameters
198
- * @returns Array of results
202
+ * @returns Array of TimesheetEntry
199
203
  *
200
204
  * @example
201
205
  * ```ts
202
206
  * const result = await client.timesheets.report();
203
207
  * ```
204
208
  */
205
- async report(options?: ReportTimesheetOptions): Promise<components["schemas"]["GetTimesheetReportResponseContent"]> {
209
+ async report(options?: ReportTimesheetOptions): Promise<TimesheetEntry[]> {
206
210
  const response = await this.request(
207
211
  {
208
212
  service: "Timesheets",
@@ -223,7 +227,7 @@ export class TimesheetsService extends BaseService {
223
227
  /**
224
228
  * Get a single timesheet entry
225
229
  * @param entryId - The entry ID
226
- * @returns The timesheet_entry
230
+ * @returns The TimesheetEntry
227
231
  * @throws {BasecampError} If the resource is not found
228
232
  *
229
233
  * @example
@@ -231,7 +235,7 @@ export class TimesheetsService extends BaseService {
231
235
  * const result = await client.timesheets.get(123);
232
236
  * ```
233
237
  */
234
- async get(entryId: number): Promise<components["schemas"]["GetTimesheetEntryResponseContent"]> {
238
+ async get(entryId: number): Promise<TimesheetEntry> {
235
239
  const response = await this.request(
236
240
  {
237
241
  service: "Timesheets",
@@ -254,7 +258,7 @@ export class TimesheetsService extends BaseService {
254
258
  * Update a timesheet entry
255
259
  * @param entryId - The entry ID
256
260
  * @param req - Timesheet_entry update parameters
257
- * @returns The timesheet_entry
261
+ * @returns The TimesheetEntry
258
262
  * @throws {BasecampError} If the resource is not found or fields are invalid
259
263
  *
260
264
  * @example
@@ -262,7 +266,7 @@ export class TimesheetsService extends BaseService {
262
266
  * const result = await client.timesheets.update(123, { });
263
267
  * ```
264
268
  */
265
- async update(entryId: number, req: UpdateTimesheetRequest): Promise<components["schemas"]["UpdateTimesheetEntryResponseContent"]> {
269
+ async update(entryId: number, req: UpdateTimesheetRequest): Promise<TimesheetEntry> {
266
270
  const response = await this.request(
267
271
  {
268
272
  service: "Timesheets",