@37signals/basecamp 0.20.0 → 0.21.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 (175) hide show
  1. package/README.md +1 -0
  2. package/dist/client.d.ts +5 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +5 -2
  5. package/dist/client.js.map +1 -1
  6. package/dist/generated/metadata.d.ts.map +1 -1
  7. package/dist/generated/metadata.js +165 -2
  8. package/dist/generated/metadata.js.map +1 -1
  9. package/dist/generated/metadata.ts +165 -2
  10. package/dist/generated/openapi-stripped.json +2747 -1259
  11. package/dist/generated/path-mapping.d.ts.map +1 -1
  12. package/dist/generated/path-mapping.js +14 -1
  13. package/dist/generated/path-mapping.js.map +1 -1
  14. package/dist/generated/path-mapping.ts +14 -1
  15. package/dist/generated/person-id-sites.d.ts.map +1 -1
  16. package/dist/generated/person-id-sites.js +61 -2
  17. package/dist/generated/person-id-sites.js.map +1 -1
  18. package/dist/generated/person-id-sites.ts +61 -2
  19. package/dist/generated/schema.d.ts +1312 -129
  20. package/dist/generated/services/bookmarks.d.ts +1 -1
  21. package/dist/generated/services/bookmarks.js +1 -1
  22. package/dist/generated/services/bookmarks.ts +1 -1
  23. package/dist/generated/services/boosts.d.ts +2 -2
  24. package/dist/generated/services/boosts.js +2 -2
  25. package/dist/generated/services/boosts.ts +2 -2
  26. package/dist/generated/services/campfires.d.ts +4 -4
  27. package/dist/generated/services/campfires.js +4 -4
  28. package/dist/generated/services/campfires.ts +4 -4
  29. package/dist/generated/services/card-steps.d.ts +15 -11
  30. package/dist/generated/services/card-steps.d.ts.map +1 -1
  31. package/dist/generated/services/card-steps.js +4 -4
  32. package/dist/generated/services/card-steps.js.map +1 -1
  33. package/dist/generated/services/card-steps.ts +15 -11
  34. package/dist/generated/services/cards.d.ts +1 -1
  35. package/dist/generated/services/cards.js +1 -1
  36. package/dist/generated/services/cards.ts +1 -1
  37. package/dist/generated/services/checkins.d.ts +4 -4
  38. package/dist/generated/services/checkins.js +4 -4
  39. package/dist/generated/services/checkins.ts +4 -4
  40. package/dist/generated/services/client-approvals.d.ts +1 -1
  41. package/dist/generated/services/client-approvals.js +1 -1
  42. package/dist/generated/services/client-approvals.ts +1 -1
  43. package/dist/generated/services/client-correspondences.d.ts +1 -1
  44. package/dist/generated/services/client-correspondences.js +1 -1
  45. package/dist/generated/services/client-correspondences.ts +1 -1
  46. package/dist/generated/services/client-replies.d.ts +1 -1
  47. package/dist/generated/services/client-replies.js +1 -1
  48. package/dist/generated/services/client-replies.ts +1 -1
  49. package/dist/generated/services/comments.d.ts +1 -1
  50. package/dist/generated/services/comments.js +1 -1
  51. package/dist/generated/services/comments.ts +1 -1
  52. package/dist/generated/services/documents.d.ts +1 -1
  53. package/dist/generated/services/documents.js +1 -1
  54. package/dist/generated/services/documents.ts +1 -1
  55. package/dist/generated/services/drafts.d.ts +1 -1
  56. package/dist/generated/services/drafts.js +1 -1
  57. package/dist/generated/services/drafts.ts +1 -1
  58. package/dist/generated/services/events.d.ts +1 -1
  59. package/dist/generated/services/events.js +1 -1
  60. package/dist/generated/services/events.ts +1 -1
  61. package/dist/generated/services/everything.d.ts +14 -14
  62. package/dist/generated/services/everything.js +14 -14
  63. package/dist/generated/services/everything.ts +14 -14
  64. package/dist/generated/services/forwards.d.ts +2 -2
  65. package/dist/generated/services/forwards.js +2 -2
  66. package/dist/generated/services/forwards.ts +2 -2
  67. package/dist/generated/services/index.d.ts +2 -1
  68. package/dist/generated/services/index.d.ts.map +1 -1
  69. package/dist/generated/services/index.js +2 -1
  70. package/dist/generated/services/index.js.map +1 -1
  71. package/dist/generated/services/index.ts +2 -1
  72. package/dist/generated/services/message-types.d.ts +1 -1
  73. package/dist/generated/services/message-types.js +1 -1
  74. package/dist/generated/services/message-types.ts +1 -1
  75. package/dist/generated/services/messages.d.ts +1 -1
  76. package/dist/generated/services/messages.js +1 -1
  77. package/dist/generated/services/messages.ts +1 -1
  78. package/dist/generated/services/my-notifications.d.ts +3 -2
  79. package/dist/generated/services/my-notifications.d.ts.map +1 -1
  80. package/dist/generated/services/my-notifications.js +1 -1
  81. package/dist/generated/services/my-notifications.js.map +1 -1
  82. package/dist/generated/services/my-notifications.ts +3 -2
  83. package/dist/generated/services/people.d.ts +3 -3
  84. package/dist/generated/services/people.js +3 -3
  85. package/dist/generated/services/people.ts +3 -3
  86. package/dist/generated/services/projects.d.ts +1 -1
  87. package/dist/generated/services/projects.js +1 -1
  88. package/dist/generated/services/projects.ts +1 -1
  89. package/dist/generated/services/recordings.d.ts +3 -3
  90. package/dist/generated/services/recordings.js +3 -3
  91. package/dist/generated/services/recordings.ts +3 -3
  92. package/dist/generated/services/reports.d.ts +1 -1
  93. package/dist/generated/services/reports.js +1 -1
  94. package/dist/generated/services/reports.ts +1 -1
  95. package/dist/generated/services/schedules.d.ts +1 -1
  96. package/dist/generated/services/schedules.js +1 -1
  97. package/dist/generated/services/schedules.ts +1 -1
  98. package/dist/generated/services/subtasks.d.ts +157 -0
  99. package/dist/generated/services/subtasks.d.ts.map +1 -0
  100. package/dist/generated/services/subtasks.js +240 -0
  101. package/dist/generated/services/subtasks.js.map +1 -0
  102. package/dist/generated/services/subtasks.ts +336 -0
  103. package/dist/generated/services/templates.d.ts +114 -10
  104. package/dist/generated/services/templates.d.ts.map +1 -1
  105. package/dist/generated/services/templates.js +147 -10
  106. package/dist/generated/services/templates.js.map +1 -1
  107. package/dist/generated/services/templates.ts +220 -13
  108. package/dist/generated/services/timeline.d.ts +1 -1
  109. package/dist/generated/services/timeline.js +1 -1
  110. package/dist/generated/services/timeline.ts +1 -1
  111. package/dist/generated/services/timesheets.d.ts +3 -3
  112. package/dist/generated/services/timesheets.js +3 -3
  113. package/dist/generated/services/timesheets.ts +3 -3
  114. package/dist/generated/services/todolist-groups.d.ts +1 -1
  115. package/dist/generated/services/todolist-groups.js +1 -1
  116. package/dist/generated/services/todolist-groups.ts +1 -1
  117. package/dist/generated/services/todolists.d.ts +1 -1
  118. package/dist/generated/services/todolists.js +1 -1
  119. package/dist/generated/services/todolists.ts +1 -1
  120. package/dist/generated/services/todos.d.ts +1 -1
  121. package/dist/generated/services/todos.js +1 -1
  122. package/dist/generated/services/todos.ts +1 -1
  123. package/dist/generated/services/uploads.d.ts +2 -2
  124. package/dist/generated/services/uploads.js +2 -2
  125. package/dist/generated/services/uploads.ts +2 -2
  126. package/dist/generated/services/vaults.d.ts +1 -1
  127. package/dist/generated/services/vaults.js +1 -1
  128. package/dist/generated/services/vaults.ts +1 -1
  129. package/dist/generated/services/webhooks.d.ts +1 -1
  130. package/dist/generated/services/webhooks.js +1 -1
  131. package/dist/generated/services/webhooks.ts +1 -1
  132. package/dist/index.d.ts +2 -1
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +3 -0
  135. package/dist/index.js.map +1 -1
  136. package/package.json +3 -3
  137. package/src/generated/metadata.ts +165 -2
  138. package/src/generated/openapi-stripped.json +2747 -1259
  139. package/src/generated/path-mapping.ts +14 -1
  140. package/src/generated/person-id-sites.ts +61 -2
  141. package/src/generated/schema.d.ts +1312 -129
  142. package/src/generated/services/bookmarks.ts +1 -1
  143. package/src/generated/services/boosts.ts +2 -2
  144. package/src/generated/services/campfires.ts +4 -4
  145. package/src/generated/services/card-steps.ts +15 -11
  146. package/src/generated/services/cards.ts +1 -1
  147. package/src/generated/services/checkins.ts +4 -4
  148. package/src/generated/services/client-approvals.ts +1 -1
  149. package/src/generated/services/client-correspondences.ts +1 -1
  150. package/src/generated/services/client-replies.ts +1 -1
  151. package/src/generated/services/comments.ts +1 -1
  152. package/src/generated/services/documents.ts +1 -1
  153. package/src/generated/services/drafts.ts +1 -1
  154. package/src/generated/services/events.ts +1 -1
  155. package/src/generated/services/everything.ts +14 -14
  156. package/src/generated/services/forwards.ts +2 -2
  157. package/src/generated/services/index.ts +2 -1
  158. package/src/generated/services/message-types.ts +1 -1
  159. package/src/generated/services/messages.ts +1 -1
  160. package/src/generated/services/my-notifications.ts +3 -2
  161. package/src/generated/services/people.ts +3 -3
  162. package/src/generated/services/projects.ts +1 -1
  163. package/src/generated/services/recordings.ts +3 -3
  164. package/src/generated/services/reports.ts +1 -1
  165. package/src/generated/services/schedules.ts +1 -1
  166. package/src/generated/services/subtasks.ts +336 -0
  167. package/src/generated/services/templates.ts +220 -13
  168. package/src/generated/services/timeline.ts +1 -1
  169. package/src/generated/services/timesheets.ts +3 -3
  170. package/src/generated/services/todolist-groups.ts +1 -1
  171. package/src/generated/services/todolists.ts +1 -1
  172. package/src/generated/services/todos.ts +1 -1
  173. package/src/generated/services/uploads.ts +2 -2
  174. package/src/generated/services/vaults.ts +1 -1
  175. package/src/generated/services/webhooks.ts +1 -1
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Subtasks service for the Basecamp API.
3
+ *
4
+ * @generated from OpenAPI spec - do not edit directly
5
+ */
6
+ import { BaseService } from "../../services/base.js";
7
+ import { Errors } from "../../errors.js";
8
+ // =============================================================================
9
+ // Service
10
+ // =============================================================================
11
+ /**
12
+ * Service for Subtasks operations.
13
+ */
14
+ export class SubtasksService extends BaseService {
15
+ /**
16
+ * List a recording's subtasks, in position order
17
+ * @param recordingId - The recording ID
18
+ * @param options - Optional query parameters
19
+ * @returns Every Subtask across all pages, with .meta.totalCount
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const result = await client.subtasks.list(123);
24
+ *
25
+ * // With options
26
+ * const filtered = await client.subtasks.list(123, { page: 1 });
27
+ * ```
28
+ */
29
+ async list(recordingId, options) {
30
+ return this.requestPaginated({
31
+ service: "Subtasks",
32
+ operation: "ListSubtasks",
33
+ resourceType: "subtask",
34
+ isMutation: false,
35
+ resourceId: recordingId,
36
+ }, () => this.client.GET("/recordings/{recordingId}/subtasks.json", {
37
+ params: {
38
+ path: { recordingId },
39
+ query: { page: options?.page },
40
+ },
41
+ }), options);
42
+ }
43
+ /**
44
+ * Create a subtask under a to-do or a card
45
+ * @param recordingId - The recording ID
46
+ * @param req - Subtask creation parameters
47
+ * @returns The Subtask
48
+ * @throws {BasecampError} If required fields are missing or invalid
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const result = await client.subtasks.create(123, { title: "example" });
53
+ * ```
54
+ */
55
+ async create(recordingId, req) {
56
+ if (!req.title) {
57
+ throw Errors.validation("Title is required");
58
+ }
59
+ if (req.dueOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.dueOn)) {
60
+ throw Errors.validation("Due on must be in YYYY-MM-DD format");
61
+ }
62
+ const response = await this.request({
63
+ service: "Subtasks",
64
+ operation: "CreateSubtask",
65
+ resourceType: "subtask",
66
+ isMutation: true,
67
+ resourceId: recordingId,
68
+ }, () => this.client.POST("/recordings/{recordingId}/subtasks.json", {
69
+ params: {
70
+ path: { recordingId },
71
+ },
72
+ body: {
73
+ title: req.title,
74
+ due_on: req.dueOn,
75
+ assignee_ids: req.assigneeIds,
76
+ },
77
+ }));
78
+ return response;
79
+ }
80
+ /**
81
+ * Get a subtask by ID
82
+ * @param subtaskId - The subtask ID
83
+ * @returns The Subtask
84
+ * @throws {BasecampError} If the resource is not found
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const result = await client.subtasks.get(123);
89
+ * ```
90
+ */
91
+ async get(subtaskId) {
92
+ const response = await this.request({
93
+ service: "Subtasks",
94
+ operation: "GetSubtask",
95
+ resourceType: "subtask",
96
+ isMutation: false,
97
+ resourceId: subtaskId,
98
+ }, () => this.client.GET("/subtasks/{subtaskId}", {
99
+ params: {
100
+ path: { subtaskId },
101
+ },
102
+ }));
103
+ return response;
104
+ }
105
+ /**
106
+ * Update a subtask
107
+ * @param subtaskId - The subtask ID
108
+ * @param req - Subtask update parameters
109
+ * @returns The Subtask
110
+ * @throws {BasecampError} If the resource is not found or fields are invalid
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const result = await client.subtasks.update(123, { });
115
+ * ```
116
+ */
117
+ async update(subtaskId, req) {
118
+ if (req.dueOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.dueOn)) {
119
+ throw Errors.validation("Due on must be in YYYY-MM-DD format");
120
+ }
121
+ const response = await this.request({
122
+ service: "Subtasks",
123
+ operation: "UpdateSubtask",
124
+ resourceType: "subtask",
125
+ isMutation: true,
126
+ resourceId: subtaskId,
127
+ }, () => this.client.PUT("/subtasks/{subtaskId}", {
128
+ params: {
129
+ path: { subtaskId },
130
+ },
131
+ body: {
132
+ title: req.title,
133
+ due_on: req.dueOn,
134
+ assignee_ids: req.assigneeIds,
135
+ },
136
+ }));
137
+ return response;
138
+ }
139
+ /**
140
+ * Delete a subtask
141
+ * @param subtaskId - The subtask ID
142
+ * @returns void
143
+ * @throws {BasecampError} If the request fails
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * await client.subtasks.delete(123);
148
+ * ```
149
+ */
150
+ async delete(subtaskId) {
151
+ await this.request({
152
+ service: "Subtasks",
153
+ operation: "DeleteSubtask",
154
+ resourceType: "subtask",
155
+ isMutation: true,
156
+ resourceId: subtaskId,
157
+ }, () => this.client.DELETE("/subtasks/{subtaskId}", {
158
+ params: {
159
+ path: { subtaskId },
160
+ },
161
+ }));
162
+ }
163
+ /**
164
+ * Mark a subtask as completed
165
+ * @param subtaskId - The subtask ID
166
+ * @returns void
167
+ * @throws {BasecampError} If the request fails
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * await client.subtasks.complete(123);
172
+ * ```
173
+ */
174
+ async complete(subtaskId) {
175
+ await this.request({
176
+ service: "Subtasks",
177
+ operation: "CompleteSubtask",
178
+ resourceType: "subtask",
179
+ isMutation: true,
180
+ resourceId: subtaskId,
181
+ }, () => this.client.POST("/subtasks/{subtaskId}/completion.json", {
182
+ params: {
183
+ path: { subtaskId },
184
+ },
185
+ }));
186
+ }
187
+ /**
188
+ * Mark a subtask as not completed
189
+ * @param subtaskId - The subtask ID
190
+ * @returns void
191
+ * @throws {BasecampError} If the request fails
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * await client.subtasks.uncomplete(123);
196
+ * ```
197
+ */
198
+ async uncomplete(subtaskId) {
199
+ await this.request({
200
+ service: "Subtasks",
201
+ operation: "UncompleteSubtask",
202
+ resourceType: "subtask",
203
+ isMutation: true,
204
+ resourceId: subtaskId,
205
+ }, () => this.client.DELETE("/subtasks/{subtaskId}/completion.json", {
206
+ params: {
207
+ path: { subtaskId },
208
+ },
209
+ }));
210
+ }
211
+ /**
212
+ * Move a subtask to a new position among its siblings
213
+ * @param subtaskId - The subtask ID
214
+ * @param req - Subtask request parameters
215
+ * @returns void
216
+ * @throws {BasecampError} If the request fails
217
+ *
218
+ * @example
219
+ * ```ts
220
+ * await client.subtasks.reposition(123, { position: 1 });
221
+ * ```
222
+ */
223
+ async reposition(subtaskId, req) {
224
+ await this.request({
225
+ service: "Subtasks",
226
+ operation: "RepositionSubtask",
227
+ resourceType: "subtask",
228
+ isMutation: true,
229
+ resourceId: subtaskId,
230
+ }, () => this.client.PUT("/subtasks/{subtaskId}/position.json", {
231
+ params: {
232
+ path: { subtaskId },
233
+ },
234
+ body: {
235
+ position: req.position,
236
+ },
237
+ }));
238
+ }
239
+ }
240
+ //# sourceMappingURL=subtasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subtasks.js","sourceRoot":"","sources":["../../../src/generated/services/subtasks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAoDzC,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAE9C;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,CAAC,WAAmB,EAAE,OAA4B;QAC1D,OAAO,IAAI,CAAC,gBAAgB,CAC1B;YACE,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,cAAc;YACzB,YAAY,EAAE,SAAS;YACvB,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,WAAW;SAC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tB,EACD,GAAG,EAAE,CACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE;YACrD,MAAM,EAAE;gBACN,IAAI,EAAE,EAAE,SAAS,EAAE;aACpB;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE,GAAG,CAAC,QAAQ;aACvB;SACF,CAAC,CACL,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Subtasks service for the Basecamp API.
3
+ *
4
+ * @generated from OpenAPI spec - do not edit directly
5
+ */
6
+
7
+ import { BaseService } from "../../services/base.js";
8
+ import type { components } from "../schema.js";
9
+ import { ListResult } from "../../pagination.js";
10
+ import type { PaginationOptions } from "../../pagination.js";
11
+ import { Errors } from "../../errors.js";
12
+
13
+ // =============================================================================
14
+ // Types
15
+ // =============================================================================
16
+
17
+ /** Subtask entity from the Basecamp API. */
18
+ export type Subtask = components["schemas"]["Subtask"];
19
+ /** @deprecated renamed to Subtask, the same Kanban::Step record. */
20
+ export type CardStep = Subtask;
21
+
22
+ /**
23
+ * Options for list.
24
+ */
25
+ export interface ListSubtaskOptions extends PaginationOptions {
26
+ /** Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8. */
27
+ page?: number;
28
+ }
29
+
30
+ /**
31
+ * Request parameters for create.
32
+ */
33
+ export interface CreateSubtaskRequest {
34
+ /** Title */
35
+ title: string;
36
+ /** Due date (YYYY-MM-DD) */
37
+ dueOn?: string;
38
+ /** Person IDs to assign to */
39
+ assigneeIds?: number[];
40
+ }
41
+
42
+ /**
43
+ * Request parameters for update.
44
+ */
45
+ export interface UpdateSubtaskRequest {
46
+ /** Title */
47
+ title?: string;
48
+ /** Due date (YYYY-MM-DD) */
49
+ dueOn?: string;
50
+ /** Person IDs to assign to */
51
+ assigneeIds?: number[];
52
+ }
53
+
54
+ /**
55
+ * Request parameters for reposition.
56
+ */
57
+ export interface RepositionSubtaskRequest {
58
+ /** The 1-based position to move it to */
59
+ position: number;
60
+ }
61
+
62
+
63
+ // =============================================================================
64
+ // Service
65
+ // =============================================================================
66
+
67
+ /**
68
+ * Service for Subtasks operations.
69
+ */
70
+ export class SubtasksService extends BaseService {
71
+
72
+ /**
73
+ * List a recording's subtasks, in position order
74
+ * @param recordingId - The recording ID
75
+ * @param options - Optional query parameters
76
+ * @returns Every Subtask across all pages, with .meta.totalCount
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const result = await client.subtasks.list(123);
81
+ *
82
+ * // With options
83
+ * const filtered = await client.subtasks.list(123, { page: 1 });
84
+ * ```
85
+ */
86
+ async list(recordingId: number, options?: ListSubtaskOptions): Promise<ListResult<Subtask>> {
87
+ return this.requestPaginated(
88
+ {
89
+ service: "Subtasks",
90
+ operation: "ListSubtasks",
91
+ resourceType: "subtask",
92
+ isMutation: false,
93
+ resourceId: recordingId,
94
+ },
95
+ () =>
96
+ this.client.GET("/recordings/{recordingId}/subtasks.json", {
97
+ params: {
98
+ path: { recordingId },
99
+ query: { page: options?.page },
100
+ },
101
+ })
102
+ , options
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Create a subtask under a to-do or a card
108
+ * @param recordingId - The recording ID
109
+ * @param req - Subtask creation parameters
110
+ * @returns The Subtask
111
+ * @throws {BasecampError} If required fields are missing or invalid
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * const result = await client.subtasks.create(123, { title: "example" });
116
+ * ```
117
+ */
118
+ async create(recordingId: number, req: CreateSubtaskRequest): Promise<Subtask> {
119
+ if (!req.title) {
120
+ throw Errors.validation("Title is required");
121
+ }
122
+ if (req.dueOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.dueOn)) {
123
+ throw Errors.validation("Due on must be in YYYY-MM-DD format");
124
+ }
125
+ const response = await this.request(
126
+ {
127
+ service: "Subtasks",
128
+ operation: "CreateSubtask",
129
+ resourceType: "subtask",
130
+ isMutation: true,
131
+ resourceId: recordingId,
132
+ },
133
+ () =>
134
+ this.client.POST("/recordings/{recordingId}/subtasks.json", {
135
+ params: {
136
+ path: { recordingId },
137
+ },
138
+ body: {
139
+ title: req.title,
140
+ due_on: req.dueOn,
141
+ assignee_ids: req.assigneeIds,
142
+ },
143
+ })
144
+ );
145
+ return response;
146
+ }
147
+
148
+ /**
149
+ * Get a subtask by ID
150
+ * @param subtaskId - The subtask ID
151
+ * @returns The Subtask
152
+ * @throws {BasecampError} If the resource is not found
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const result = await client.subtasks.get(123);
157
+ * ```
158
+ */
159
+ async get(subtaskId: number): Promise<Subtask> {
160
+ const response = await this.request(
161
+ {
162
+ service: "Subtasks",
163
+ operation: "GetSubtask",
164
+ resourceType: "subtask",
165
+ isMutation: false,
166
+ resourceId: subtaskId,
167
+ },
168
+ () =>
169
+ this.client.GET("/subtasks/{subtaskId}", {
170
+ params: {
171
+ path: { subtaskId },
172
+ },
173
+ })
174
+ );
175
+ return response;
176
+ }
177
+
178
+ /**
179
+ * Update a subtask
180
+ * @param subtaskId - The subtask ID
181
+ * @param req - Subtask update parameters
182
+ * @returns The Subtask
183
+ * @throws {BasecampError} If the resource is not found or fields are invalid
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * const result = await client.subtasks.update(123, { });
188
+ * ```
189
+ */
190
+ async update(subtaskId: number, req: UpdateSubtaskRequest): Promise<Subtask> {
191
+ if (req.dueOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.dueOn)) {
192
+ throw Errors.validation("Due on must be in YYYY-MM-DD format");
193
+ }
194
+ const response = await this.request(
195
+ {
196
+ service: "Subtasks",
197
+ operation: "UpdateSubtask",
198
+ resourceType: "subtask",
199
+ isMutation: true,
200
+ resourceId: subtaskId,
201
+ },
202
+ () =>
203
+ this.client.PUT("/subtasks/{subtaskId}", {
204
+ params: {
205
+ path: { subtaskId },
206
+ },
207
+ body: {
208
+ title: req.title,
209
+ due_on: req.dueOn,
210
+ assignee_ids: req.assigneeIds,
211
+ },
212
+ })
213
+ );
214
+ return response;
215
+ }
216
+
217
+ /**
218
+ * Delete a subtask
219
+ * @param subtaskId - The subtask ID
220
+ * @returns void
221
+ * @throws {BasecampError} If the request fails
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * await client.subtasks.delete(123);
226
+ * ```
227
+ */
228
+ async delete(subtaskId: number): Promise<void> {
229
+ await this.request(
230
+ {
231
+ service: "Subtasks",
232
+ operation: "DeleteSubtask",
233
+ resourceType: "subtask",
234
+ isMutation: true,
235
+ resourceId: subtaskId,
236
+ },
237
+ () =>
238
+ this.client.DELETE("/subtasks/{subtaskId}", {
239
+ params: {
240
+ path: { subtaskId },
241
+ },
242
+ })
243
+ );
244
+ }
245
+
246
+ /**
247
+ * Mark a subtask as completed
248
+ * @param subtaskId - The subtask ID
249
+ * @returns void
250
+ * @throws {BasecampError} If the request fails
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * await client.subtasks.complete(123);
255
+ * ```
256
+ */
257
+ async complete(subtaskId: number): Promise<void> {
258
+ await this.request(
259
+ {
260
+ service: "Subtasks",
261
+ operation: "CompleteSubtask",
262
+ resourceType: "subtask",
263
+ isMutation: true,
264
+ resourceId: subtaskId,
265
+ },
266
+ () =>
267
+ this.client.POST("/subtasks/{subtaskId}/completion.json", {
268
+ params: {
269
+ path: { subtaskId },
270
+ },
271
+ })
272
+ );
273
+ }
274
+
275
+ /**
276
+ * Mark a subtask as not completed
277
+ * @param subtaskId - The subtask ID
278
+ * @returns void
279
+ * @throws {BasecampError} If the request fails
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * await client.subtasks.uncomplete(123);
284
+ * ```
285
+ */
286
+ async uncomplete(subtaskId: number): Promise<void> {
287
+ await this.request(
288
+ {
289
+ service: "Subtasks",
290
+ operation: "UncompleteSubtask",
291
+ resourceType: "subtask",
292
+ isMutation: true,
293
+ resourceId: subtaskId,
294
+ },
295
+ () =>
296
+ this.client.DELETE("/subtasks/{subtaskId}/completion.json", {
297
+ params: {
298
+ path: { subtaskId },
299
+ },
300
+ })
301
+ );
302
+ }
303
+
304
+ /**
305
+ * Move a subtask to a new position among its siblings
306
+ * @param subtaskId - The subtask ID
307
+ * @param req - Subtask request parameters
308
+ * @returns void
309
+ * @throws {BasecampError} If the request fails
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * await client.subtasks.reposition(123, { position: 1 });
314
+ * ```
315
+ */
316
+ async reposition(subtaskId: number, req: RepositionSubtaskRequest): Promise<void> {
317
+ await this.request(
318
+ {
319
+ service: "Subtasks",
320
+ operation: "RepositionSubtask",
321
+ resourceType: "subtask",
322
+ isMutation: true,
323
+ resourceId: subtaskId,
324
+ },
325
+ () =>
326
+ this.client.PUT("/subtasks/{subtaskId}/position.json", {
327
+ params: {
328
+ path: { subtaskId },
329
+ },
330
+ body: {
331
+ position: req.position,
332
+ },
333
+ })
334
+ );
335
+ }
336
+ }