@37signals/basecamp 0.2.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.
- package/README.md +600 -0
- package/dist/auth-strategy.d.ts +36 -0
- package/dist/auth-strategy.d.ts.map +1 -0
- package/dist/auth-strategy.js +33 -0
- package/dist/auth-strategy.js.map +1 -0
- package/dist/client.d.ts +224 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +715 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +137 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +269 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/metadata.json +2281 -0
- package/dist/generated/openapi-stripped.json +21268 -0
- package/dist/generated/path-mapping.d.ts +8 -0
- package/dist/generated/path-mapping.d.ts.map +1 -0
- package/dist/generated/path-mapping.js +192 -0
- package/dist/generated/path-mapping.js.map +1 -0
- package/dist/generated/path-mapping.ts +199 -0
- package/dist/generated/schema.d.ts +14883 -0
- package/dist/generated/services/attachments.d.ts +27 -0
- package/dist/generated/services/attachments.d.ts.map +1 -0
- package/dist/generated/services/attachments.js +49 -0
- package/dist/generated/services/attachments.js.map +1 -0
- package/dist/generated/services/attachments.ts +59 -0
- package/dist/generated/services/boosts.d.ts +114 -0
- package/dist/generated/services/boosts.d.ts.map +1 -0
- package/dist/generated/services/boosts.js +179 -0
- package/dist/generated/services/boosts.js.map +1 -0
- package/dist/generated/services/boosts.ts +250 -0
- package/dist/generated/services/campfires.d.ts +202 -0
- package/dist/generated/services/campfires.d.ts.map +1 -0
- package/dist/generated/services/campfires.js +309 -0
- package/dist/generated/services/campfires.js.map +1 -0
- package/dist/generated/services/campfires.ts +433 -0
- package/dist/generated/services/card-columns.d.ts +163 -0
- package/dist/generated/services/card-columns.d.ts.map +1 -0
- package/dist/generated/services/card-columns.js +264 -0
- package/dist/generated/services/card-columns.js.map +1 -0
- package/dist/generated/services/card-columns.ts +360 -0
- package/dist/generated/services/card-steps.d.ts +105 -0
- package/dist/generated/services/card-steps.d.ts.map +1 -0
- package/dist/generated/services/card-steps.js +148 -0
- package/dist/generated/services/card-steps.js.map +1 -0
- package/dist/generated/services/card-steps.ts +221 -0
- package/dist/generated/services/card-tables.d.ts +27 -0
- package/dist/generated/services/card-tables.d.ts.map +1 -0
- package/dist/generated/services/card-tables.js +40 -0
- package/dist/generated/services/card-tables.js.map +1 -0
- package/dist/generated/services/card-tables.ts +55 -0
- package/dist/generated/services/cards.d.ts +118 -0
- package/dist/generated/services/cards.d.ts.map +1 -0
- package/dist/generated/services/cards.js +166 -0
- package/dist/generated/services/cards.js.map +1 -0
- package/dist/generated/services/cards.ts +247 -0
- package/dist/generated/services/checkins.d.ts +278 -0
- package/dist/generated/services/checkins.d.ts.map +1 -0
- package/dist/generated/services/checkins.js +420 -0
- package/dist/generated/services/checkins.js.map +1 -0
- package/dist/generated/services/checkins.ts +600 -0
- package/dist/generated/services/client-approvals.d.ts +45 -0
- package/dist/generated/services/client-approvals.d.ts.map +1 -0
- package/dist/generated/services/client-approvals.js +58 -0
- package/dist/generated/services/client-approvals.js.map +1 -0
- package/dist/generated/services/client-approvals.ts +89 -0
- package/dist/generated/services/client-correspondences.d.ts +45 -0
- package/dist/generated/services/client-correspondences.d.ts.map +1 -0
- package/dist/generated/services/client-correspondences.js +58 -0
- package/dist/generated/services/client-correspondences.js.map +1 -0
- package/dist/generated/services/client-correspondences.ts +89 -0
- package/dist/generated/services/client-replies.d.ts +47 -0
- package/dist/generated/services/client-replies.d.ts.map +1 -0
- package/dist/generated/services/client-replies.js +65 -0
- package/dist/generated/services/client-replies.js.map +1 -0
- package/dist/generated/services/client-replies.ts +95 -0
- package/dist/generated/services/client-visibility.d.ts +35 -0
- package/dist/generated/services/client-visibility.d.ts.map +1 -0
- package/dist/generated/services/client-visibility.js +44 -0
- package/dist/generated/services/client-visibility.js.map +1 -0
- package/dist/generated/services/client-visibility.ts +68 -0
- package/dist/generated/services/comments.d.ts +86 -0
- package/dist/generated/services/comments.d.ts.map +1 -0
- package/dist/generated/services/comments.js +129 -0
- package/dist/generated/services/comments.js.map +1 -0
- package/dist/generated/services/comments.ts +185 -0
- package/dist/generated/services/documents.d.ts +92 -0
- package/dist/generated/services/documents.d.ts.map +1 -0
- package/dist/generated/services/documents.js +129 -0
- package/dist/generated/services/documents.js.map +1 -0
- package/dist/generated/services/documents.ts +191 -0
- package/dist/generated/services/events.d.ts +34 -0
- package/dist/generated/services/events.d.ts.map +1 -0
- package/dist/generated/services/events.js +39 -0
- package/dist/generated/services/events.js.map +1 -0
- package/dist/generated/services/events.ts +64 -0
- package/dist/generated/services/forwards.d.ts +112 -0
- package/dist/generated/services/forwards.d.ts.map +1 -0
- package/dist/generated/services/forwards.js +172 -0
- package/dist/generated/services/forwards.js.map +1 -0
- package/dist/generated/services/forwards.ts +241 -0
- package/dist/generated/services/index.d.ts +39 -0
- package/dist/generated/services/index.d.ts.map +1 -0
- package/dist/generated/services/index.js +39 -0
- package/dist/generated/services/index.js.map +1 -0
- package/dist/generated/services/index.ts +38 -0
- package/dist/generated/services/lineup.d.ts +67 -0
- package/dist/generated/services/lineup.d.ts.map +1 -0
- package/dist/generated/services/lineup.js +99 -0
- package/dist/generated/services/lineup.js.map +1 -0
- package/dist/generated/services/lineup.ts +143 -0
- package/dist/generated/services/message-boards.d.ts +27 -0
- package/dist/generated/services/message-boards.d.ts.map +1 -0
- package/dist/generated/services/message-boards.js +40 -0
- package/dist/generated/services/message-boards.js.map +1 -0
- package/dist/generated/services/message-boards.ts +55 -0
- package/dist/generated/services/message-types.d.ts +100 -0
- package/dist/generated/services/message-types.d.ts.map +1 -0
- package/dist/generated/services/message-types.js +144 -0
- package/dist/generated/services/message-types.js.map +1 -0
- package/dist/generated/services/message-types.ts +210 -0
- package/dist/generated/services/messages.d.ts +122 -0
- package/dist/generated/services/messages.d.ts.map +1 -0
- package/dist/generated/services/messages.js +180 -0
- package/dist/generated/services/messages.js.map +1 -0
- package/dist/generated/services/messages.ts +258 -0
- package/dist/generated/services/people.d.ts +122 -0
- package/dist/generated/services/people.d.ts.map +1 -0
- package/dist/generated/services/people.js +167 -0
- package/dist/generated/services/people.js.map +1 -0
- package/dist/generated/services/people.ts +252 -0
- package/dist/generated/services/projects.d.ts +109 -0
- package/dist/generated/services/projects.d.ts.map +1 -0
- package/dist/generated/services/projects.js +153 -0
- package/dist/generated/services/projects.js.map +1 -0
- package/dist/generated/services/projects.ts +224 -0
- package/dist/generated/services/recordings.d.ts +93 -0
- package/dist/generated/services/recordings.d.ts.map +1 -0
- package/dist/generated/services/recordings.js +138 -0
- package/dist/generated/services/recordings.js.map +1 -0
- package/dist/generated/services/recordings.ts +191 -0
- package/dist/generated/services/reports.d.ts +90 -0
- package/dist/generated/services/reports.d.ts.map +1 -0
- package/dist/generated/services/reports.js +124 -0
- package/dist/generated/services/reports.js.map +1 -0
- package/dist/generated/services/reports.ts +187 -0
- package/dist/generated/services/schedules.d.ts +162 -0
- package/dist/generated/services/schedules.d.ts.map +1 -0
- package/dist/generated/services/schedules.js +228 -0
- package/dist/generated/services/schedules.js.map +1 -0
- package/dist/generated/services/schedules.ts +335 -0
- package/dist/generated/services/search.d.ts +45 -0
- package/dist/generated/services/search.d.ts.map +1 -0
- package/dist/generated/services/search.js +56 -0
- package/dist/generated/services/search.js.map +1 -0
- package/dist/generated/services/search.ts +89 -0
- package/dist/generated/services/subscriptions.d.ts +73 -0
- package/dist/generated/services/subscriptions.d.ts.map +1 -0
- package/dist/generated/services/subscriptions.js +119 -0
- package/dist/generated/services/subscriptions.js.map +1 -0
- package/dist/generated/services/subscriptions.ts +160 -0
- package/dist/generated/services/templates.d.ts +140 -0
- package/dist/generated/services/templates.d.ts.map +1 -0
- package/dist/generated/services/templates.js +207 -0
- package/dist/generated/services/templates.js.map +1 -0
- package/dist/generated/services/templates.ts +294 -0
- package/dist/generated/services/timeline.d.ts +31 -0
- package/dist/generated/services/timeline.d.ts.map +1 -0
- package/dist/generated/services/timeline.js +39 -0
- package/dist/generated/services/timeline.js.map +1 -0
- package/dist/generated/services/timeline.ts +62 -0
- package/dist/generated/services/timesheets.d.ts +145 -0
- package/dist/generated/services/timesheets.d.ts.map +1 -0
- package/dist/generated/services/timesheets.js +186 -0
- package/dist/generated/services/timesheets.js.map +1 -0
- package/dist/generated/services/timesheets.ts +289 -0
- package/dist/generated/services/todolist-groups.d.ts +74 -0
- package/dist/generated/services/todolist-groups.d.ts.map +1 -0
- package/dist/generated/services/todolist-groups.js +100 -0
- package/dist/generated/services/todolist-groups.js.map +1 -0
- package/dist/generated/services/todolist-groups.ts +151 -0
- package/dist/generated/services/todolists.d.ts +95 -0
- package/dist/generated/services/todolists.d.ts.map +1 -0
- package/dist/generated/services/todolists.js +130 -0
- package/dist/generated/services/todolists.js.map +1 -0
- package/dist/generated/services/todolists.ts +192 -0
- package/dist/generated/services/todos.d.ts +175 -0
- package/dist/generated/services/todos.d.ts.map +1 -0
- package/dist/generated/services/todos.js +255 -0
- package/dist/generated/services/todos.js.map +1 -0
- package/dist/generated/services/todos.ts +369 -0
- package/dist/generated/services/todosets.d.ts +27 -0
- package/dist/generated/services/todosets.d.ts.map +1 -0
- package/dist/generated/services/todosets.js +40 -0
- package/dist/generated/services/todosets.js.map +1 -0
- package/dist/generated/services/todosets.ts +55 -0
- package/dist/generated/services/tools.d.ts +122 -0
- package/dist/generated/services/tools.d.ts.map +1 -0
- package/dist/generated/services/tools.js +197 -0
- package/dist/generated/services/tools.js.map +1 -0
- package/dist/generated/services/tools.ts +267 -0
- package/dist/generated/services/uploads.d.ts +109 -0
- package/dist/generated/services/uploads.d.ts.map +1 -0
- package/dist/generated/services/uploads.js +153 -0
- package/dist/generated/services/uploads.js.map +1 -0
- package/dist/generated/services/uploads.ts +227 -0
- package/dist/generated/services/vaults.d.ts +86 -0
- package/dist/generated/services/vaults.d.ts.map +1 -0
- package/dist/generated/services/vaults.js +126 -0
- package/dist/generated/services/vaults.js.map +1 -0
- package/dist/generated/services/vaults.ts +182 -0
- package/dist/generated/services/webhooks.d.ts +106 -0
- package/dist/generated/services/webhooks.d.ts.map +1 -0
- package/dist/generated/services/webhooks.js +157 -0
- package/dist/generated/services/webhooks.js.map +1 -0
- package/dist/generated/services/webhooks.ts +226 -0
- package/dist/hooks/otel.d.ts +136 -0
- package/dist/hooks/otel.d.ts.map +1 -0
- package/dist/hooks/otel.js +240 -0
- package/dist/hooks/otel.js.map +1 -0
- package/dist/hooks.d.ts +171 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +196 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth/authorize.d.ts +48 -0
- package/dist/oauth/authorize.d.ts.map +1 -0
- package/dist/oauth/authorize.js +56 -0
- package/dist/oauth/authorize.js.map +1 -0
- package/dist/oauth/callback-server.d.ts +56 -0
- package/dist/oauth/callback-server.d.ts.map +1 -0
- package/dist/oauth/callback-server.js +150 -0
- package/dist/oauth/callback-server.js.map +1 -0
- package/dist/oauth/discovery.d.ts +54 -0
- package/dist/oauth/discovery.d.ts.map +1 -0
- package/dist/oauth/discovery.js +116 -0
- package/dist/oauth/discovery.js.map +1 -0
- package/dist/oauth/exchange.d.ts +96 -0
- package/dist/oauth/exchange.d.ts.map +1 -0
- package/dist/oauth/exchange.js +324 -0
- package/dist/oauth/exchange.js.map +1 -0
- package/dist/oauth/identity.d.ts +30 -0
- package/dist/oauth/identity.d.ts.map +1 -0
- package/dist/oauth/identity.js +82 -0
- package/dist/oauth/identity.js.map +1 -0
- package/dist/oauth/index.d.ts +50 -0
- package/dist/oauth/index.d.ts.map +1 -0
- package/dist/oauth/index.js +58 -0
- package/dist/oauth/index.js.map +1 -0
- package/dist/oauth/interactive-login.d.ts +62 -0
- package/dist/oauth/interactive-login.d.ts.map +1 -0
- package/dist/oauth/interactive-login.js +106 -0
- package/dist/oauth/interactive-login.js.map +1 -0
- package/dist/oauth/pkce.d.ts +68 -0
- package/dist/oauth/pkce.d.ts.map +1 -0
- package/dist/oauth/pkce.js +80 -0
- package/dist/oauth/pkce.js.map +1 -0
- package/dist/oauth/token-manager.d.ts +92 -0
- package/dist/oauth/token-manager.d.ts.map +1 -0
- package/dist/oauth/token-manager.js +126 -0
- package/dist/oauth/token-manager.js.map +1 -0
- package/dist/oauth/token-store.d.ts +45 -0
- package/dist/oauth/token-store.d.ts.map +1 -0
- package/dist/oauth/token-store.js +105 -0
- package/dist/oauth/token-store.js.map +1 -0
- package/dist/oauth/types.d.ts +98 -0
- package/dist/oauth/types.d.ts.map +1 -0
- package/dist/oauth/types.js +8 -0
- package/dist/oauth/types.js.map +1 -0
- package/dist/pagination-utils.d.ts +27 -0
- package/dist/pagination-utils.d.ts.map +1 -0
- package/dist/pagination-utils.js +54 -0
- package/dist/pagination-utils.js.map +1 -0
- package/dist/pagination.d.ts +56 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +57 -0
- package/dist/pagination.js.map +1 -0
- package/dist/security.d.ts +68 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +107 -0
- package/dist/security.js.map +1 -0
- package/dist/services/authorization.d.ts +124 -0
- package/dist/services/authorization.d.ts.map +1 -0
- package/dist/services/authorization.js +117 -0
- package/dist/services/authorization.js.map +1 -0
- package/dist/services/base.d.ts +102 -0
- package/dist/services/base.d.ts.map +1 -0
- package/dist/services/base.js +230 -0
- package/dist/services/base.js.map +1 -0
- package/dist/webhooks/adapters/node-http.d.ts +14 -0
- package/dist/webhooks/adapters/node-http.d.ts.map +1 -0
- package/dist/webhooks/adapters/node-http.js +60 -0
- package/dist/webhooks/adapters/node-http.js.map +1 -0
- package/dist/webhooks/events.d.ts +52 -0
- package/dist/webhooks/events.d.ts.map +1 -0
- package/dist/webhooks/events.js +52 -0
- package/dist/webhooks/events.js.map +1 -0
- package/dist/webhooks/handler.d.ts +62 -0
- package/dist/webhooks/handler.d.ts.map +1 -0
- package/dist/webhooks/handler.js +226 -0
- package/dist/webhooks/handler.js.map +1 -0
- package/dist/webhooks/index.d.ts +5 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +5 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/verify.d.ts +11 -0
- package/dist/webhooks/verify.d.ts.map +1 -0
- package/dist/webhooks/verify.js +25 -0
- package/dist/webhooks/verify.js.map +1 -0
- package/package.json +70 -0
- package/src/generated/metadata.json +2281 -0
- package/src/generated/openapi-stripped.json +21268 -0
- package/src/generated/path-mapping.ts +199 -0
- package/src/generated/schema.d.ts +14883 -0
- package/src/generated/services/attachments.ts +59 -0
- package/src/generated/services/boosts.ts +250 -0
- package/src/generated/services/campfires.ts +433 -0
- package/src/generated/services/card-columns.ts +360 -0
- package/src/generated/services/card-steps.ts +221 -0
- package/src/generated/services/card-tables.ts +55 -0
- package/src/generated/services/cards.ts +247 -0
- package/src/generated/services/checkins.ts +600 -0
- package/src/generated/services/client-approvals.ts +89 -0
- package/src/generated/services/client-correspondences.ts +89 -0
- package/src/generated/services/client-replies.ts +95 -0
- package/src/generated/services/client-visibility.ts +68 -0
- package/src/generated/services/comments.ts +185 -0
- package/src/generated/services/documents.ts +191 -0
- package/src/generated/services/events.ts +64 -0
- package/src/generated/services/forwards.ts +241 -0
- package/src/generated/services/index.ts +38 -0
- package/src/generated/services/lineup.ts +143 -0
- package/src/generated/services/message-boards.ts +55 -0
- package/src/generated/services/message-types.ts +210 -0
- package/src/generated/services/messages.ts +258 -0
- package/src/generated/services/people.ts +252 -0
- package/src/generated/services/projects.ts +224 -0
- package/src/generated/services/recordings.ts +191 -0
- package/src/generated/services/reports.ts +187 -0
- package/src/generated/services/schedules.ts +335 -0
- package/src/generated/services/search.ts +89 -0
- package/src/generated/services/subscriptions.ts +160 -0
- package/src/generated/services/templates.ts +294 -0
- package/src/generated/services/timeline.ts +62 -0
- package/src/generated/services/timesheets.ts +289 -0
- package/src/generated/services/todolist-groups.ts +151 -0
- package/src/generated/services/todolists.ts +192 -0
- package/src/generated/services/todos.ts +369 -0
- package/src/generated/services/todosets.ts +55 -0
- package/src/generated/services/tools.ts +267 -0
- package/src/generated/services/uploads.ts +227 -0
- package/src/generated/services/vaults.ts +182 -0
- package/src/generated/services/webhooks.ts +226 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todolists 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
|
+
/** Todolist entity from the Basecamp API. */
|
|
18
|
+
export type Todolist = components["schemas"]["Todolist"];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Request parameters for update.
|
|
22
|
+
*/
|
|
23
|
+
export interface UpdateTodolistRequest {
|
|
24
|
+
/** Name (required for both Todolist and TodolistGroup) */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Description (Todolist only, ignored for groups) */
|
|
27
|
+
description?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Options for list.
|
|
32
|
+
*/
|
|
33
|
+
export interface ListTodolistOptions extends PaginationOptions {
|
|
34
|
+
/** Filter by status */
|
|
35
|
+
status?: "active" | "archived" | "trashed";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Request parameters for create.
|
|
40
|
+
*/
|
|
41
|
+
export interface CreateTodolistRequest {
|
|
42
|
+
/** Display name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Rich text description (HTML) */
|
|
45
|
+
description?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// Service
|
|
51
|
+
// =============================================================================
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Service for Todolists operations.
|
|
55
|
+
*/
|
|
56
|
+
export class TodolistsService extends BaseService {
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get a single todolist or todolist group by id
|
|
60
|
+
* @param id - The id
|
|
61
|
+
* @returns The todolist_or_group
|
|
62
|
+
* @throws {BasecampError} If the resource is not found
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const result = await client.todolists.get(123);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
async get(id: number): Promise<components["schemas"]["GetTodolistOrGroupResponseContent"]> {
|
|
70
|
+
const response = await this.request(
|
|
71
|
+
{
|
|
72
|
+
service: "Todolists",
|
|
73
|
+
operation: "GetTodolistOrGroup",
|
|
74
|
+
resourceType: "todolist_or_group",
|
|
75
|
+
isMutation: false,
|
|
76
|
+
},
|
|
77
|
+
() =>
|
|
78
|
+
this.client.GET("/todolists/{id}", {
|
|
79
|
+
params: {
|
|
80
|
+
path: { id },
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Update an existing todolist or todolist group
|
|
89
|
+
* @param id - The id
|
|
90
|
+
* @param req - Todolist_or_group update parameters
|
|
91
|
+
* @returns The todolist_or_group
|
|
92
|
+
* @throws {BasecampError} If the resource is not found or fields are invalid
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const result = await client.todolists.update(123, { });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async update(id: number, req: UpdateTodolistRequest): Promise<components["schemas"]["UpdateTodolistOrGroupResponseContent"]> {
|
|
100
|
+
const response = await this.request(
|
|
101
|
+
{
|
|
102
|
+
service: "Todolists",
|
|
103
|
+
operation: "UpdateTodolistOrGroup",
|
|
104
|
+
resourceType: "todolist_or_group",
|
|
105
|
+
isMutation: true,
|
|
106
|
+
},
|
|
107
|
+
() =>
|
|
108
|
+
this.client.PUT("/todolists/{id}", {
|
|
109
|
+
params: {
|
|
110
|
+
path: { id },
|
|
111
|
+
},
|
|
112
|
+
body: {
|
|
113
|
+
name: req.name,
|
|
114
|
+
description: req.description,
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
return response;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* List todolists in a todoset
|
|
123
|
+
* @param todosetId - The todoset ID
|
|
124
|
+
* @param options - Optional query parameters
|
|
125
|
+
* @returns All Todolist across all pages, with .meta.totalCount
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* const result = await client.todolists.list(123);
|
|
130
|
+
*
|
|
131
|
+
* // With options
|
|
132
|
+
* const filtered = await client.todolists.list(123, { status: "active" });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
async list(todosetId: number, options?: ListTodolistOptions): Promise<ListResult<Todolist>> {
|
|
136
|
+
return this.requestPaginated(
|
|
137
|
+
{
|
|
138
|
+
service: "Todolists",
|
|
139
|
+
operation: "ListTodolists",
|
|
140
|
+
resourceType: "todolist",
|
|
141
|
+
isMutation: false,
|
|
142
|
+
resourceId: todosetId,
|
|
143
|
+
},
|
|
144
|
+
() =>
|
|
145
|
+
this.client.GET("/todosets/{todosetId}/todolists.json", {
|
|
146
|
+
params: {
|
|
147
|
+
path: { todosetId },
|
|
148
|
+
query: { status: options?.status },
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
, options
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Create a new todolist in a todoset
|
|
157
|
+
* @param todosetId - The todoset ID
|
|
158
|
+
* @param req - Todolist creation parameters
|
|
159
|
+
* @returns The Todolist
|
|
160
|
+
* @throws {BasecampError} If required fields are missing or invalid
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const result = await client.todolists.create(123, { name: "My example" });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
async create(todosetId: number, req: CreateTodolistRequest): Promise<Todolist> {
|
|
168
|
+
if (!req.name) {
|
|
169
|
+
throw Errors.validation("Name is required");
|
|
170
|
+
}
|
|
171
|
+
const response = await this.request(
|
|
172
|
+
{
|
|
173
|
+
service: "Todolists",
|
|
174
|
+
operation: "CreateTodolist",
|
|
175
|
+
resourceType: "todolist",
|
|
176
|
+
isMutation: true,
|
|
177
|
+
resourceId: todosetId,
|
|
178
|
+
},
|
|
179
|
+
() =>
|
|
180
|
+
this.client.POST("/todosets/{todosetId}/todolists.json", {
|
|
181
|
+
params: {
|
|
182
|
+
path: { todosetId },
|
|
183
|
+
},
|
|
184
|
+
body: {
|
|
185
|
+
name: req.name,
|
|
186
|
+
description: req.description,
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
return response;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todos 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 type { components } from "../schema.js";
|
|
8
|
+
import { ListResult } from "../../pagination.js";
|
|
9
|
+
import type { PaginationOptions } from "../../pagination.js";
|
|
10
|
+
/** Todo entity from the Basecamp API. */
|
|
11
|
+
export type Todo = components["schemas"]["Todo"];
|
|
12
|
+
/**
|
|
13
|
+
* Options for list.
|
|
14
|
+
*/
|
|
15
|
+
export interface ListTodoOptions extends PaginationOptions {
|
|
16
|
+
/** Filter by status */
|
|
17
|
+
status?: "active" | "archived" | "trashed";
|
|
18
|
+
/** Completed */
|
|
19
|
+
completed?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Request parameters for create.
|
|
23
|
+
*/
|
|
24
|
+
export interface CreateTodoRequest {
|
|
25
|
+
/** Text content */
|
|
26
|
+
content: string;
|
|
27
|
+
/** Rich text description (HTML) */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Person IDs to assign to */
|
|
30
|
+
assigneeIds?: number[];
|
|
31
|
+
/** Person IDs to notify on completion */
|
|
32
|
+
completionSubscriberIds?: number[];
|
|
33
|
+
/** Whether to send notifications to relevant people */
|
|
34
|
+
notify?: boolean;
|
|
35
|
+
/** Due date (YYYY-MM-DD) */
|
|
36
|
+
dueOn?: string;
|
|
37
|
+
/** Start date (YYYY-MM-DD) */
|
|
38
|
+
startsOn?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Request parameters for update.
|
|
42
|
+
*/
|
|
43
|
+
export interface UpdateTodoRequest {
|
|
44
|
+
/** Text content */
|
|
45
|
+
content?: string;
|
|
46
|
+
/** Rich text description (HTML) */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Person IDs to assign to */
|
|
49
|
+
assigneeIds?: number[];
|
|
50
|
+
/** Person IDs to notify on completion */
|
|
51
|
+
completionSubscriberIds?: number[];
|
|
52
|
+
/** Whether to send notifications to relevant people */
|
|
53
|
+
notify?: boolean;
|
|
54
|
+
/** Due date (YYYY-MM-DD) */
|
|
55
|
+
dueOn?: string;
|
|
56
|
+
/** Start date (YYYY-MM-DD) */
|
|
57
|
+
startsOn?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Request parameters for reposition.
|
|
61
|
+
*/
|
|
62
|
+
export interface RepositionTodoRequest {
|
|
63
|
+
/** Position for ordering (1-based) */
|
|
64
|
+
position: number;
|
|
65
|
+
/** Optional todolist ID to move the todo to a different parent */
|
|
66
|
+
parentId?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Service for Todos operations.
|
|
70
|
+
*/
|
|
71
|
+
export declare class TodosService extends BaseService {
|
|
72
|
+
/**
|
|
73
|
+
* List todos in a todolist
|
|
74
|
+
* @param todolistId - The todolist ID
|
|
75
|
+
* @param options - Optional query parameters
|
|
76
|
+
* @returns All Todo across all pages, with .meta.totalCount
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const result = await client.todos.list(123);
|
|
81
|
+
*
|
|
82
|
+
* // With options
|
|
83
|
+
* const filtered = await client.todos.list(123, { status: "active" });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
list(todolistId: number, options?: ListTodoOptions): Promise<ListResult<Todo>>;
|
|
87
|
+
/**
|
|
88
|
+
* Create a new todo in a todolist
|
|
89
|
+
* @param todolistId - The todolist ID
|
|
90
|
+
* @param req - Todo creation parameters
|
|
91
|
+
* @returns The Todo
|
|
92
|
+
* @throws {BasecampError} If required fields are missing or invalid
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const result = await client.todos.create(123, { content: "Hello world" });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
create(todolistId: number, req: CreateTodoRequest): Promise<Todo>;
|
|
100
|
+
/**
|
|
101
|
+
* Get a single todo by id
|
|
102
|
+
* @param todoId - The todo ID
|
|
103
|
+
* @returns The Todo
|
|
104
|
+
* @throws {BasecampError} If the resource is not found
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const result = await client.todos.get(123);
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
get(todoId: number): Promise<Todo>;
|
|
112
|
+
/**
|
|
113
|
+
* Update an existing todo
|
|
114
|
+
* @param todoId - The todo ID
|
|
115
|
+
* @param req - Todo update parameters
|
|
116
|
+
* @returns The Todo
|
|
117
|
+
* @throws {BasecampError} If the resource is not found or fields are invalid
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const result = await client.todos.update(123, { });
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
update(todoId: number, req: UpdateTodoRequest): Promise<Todo>;
|
|
125
|
+
/**
|
|
126
|
+
* Trash a todo. Trashed items can be recovered.
|
|
127
|
+
* @param todoId - The todo ID
|
|
128
|
+
* @returns void
|
|
129
|
+
* @throws {BasecampError} If the request fails
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await client.todos.trash(123);
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
trash(todoId: number): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Mark a todo as complete
|
|
139
|
+
* @param todoId - The todo ID
|
|
140
|
+
* @returns void
|
|
141
|
+
* @throws {BasecampError} If the request fails
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* await client.todos.complete(123);
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
complete(todoId: number): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Mark a todo as incomplete
|
|
151
|
+
* @param todoId - The todo ID
|
|
152
|
+
* @returns void
|
|
153
|
+
* @throws {BasecampError} If the request fails
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* await client.todos.uncomplete(123);
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
uncomplete(todoId: number): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Reposition a todo within its todolist
|
|
163
|
+
* @param todoId - The todo ID
|
|
164
|
+
* @param req - Todo request parameters
|
|
165
|
+
* @returns void
|
|
166
|
+
* @throws {BasecampError} If the request fails
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* await client.todos.reposition(123, { position: 1 });
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
reposition(todoId: number, req: RepositionTodoRequest): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=todos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/generated/services/todos.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAO7D,yCAAyC;AACzC,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,uBAAuB;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,gBAAgB;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,yCAAyC;IACzC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM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7C;;;;;;;;;;OAUG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/C;;;;;;;;;;;OAWG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAqB5E"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todos 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 Todos operations.
|
|
13
|
+
*/
|
|
14
|
+
export class TodosService extends BaseService {
|
|
15
|
+
/**
|
|
16
|
+
* List todos in a todolist
|
|
17
|
+
* @param todolistId - The todolist ID
|
|
18
|
+
* @param options - Optional query parameters
|
|
19
|
+
* @returns All Todo across all pages, with .meta.totalCount
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const result = await client.todos.list(123);
|
|
24
|
+
*
|
|
25
|
+
* // With options
|
|
26
|
+
* const filtered = await client.todos.list(123, { status: "active" });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
async list(todolistId, options) {
|
|
30
|
+
return this.requestPaginated({
|
|
31
|
+
service: "Todos",
|
|
32
|
+
operation: "ListTodos",
|
|
33
|
+
resourceType: "todo",
|
|
34
|
+
isMutation: false,
|
|
35
|
+
resourceId: todolistId,
|
|
36
|
+
}, () => this.client.GET("/todolists/{todolistId}/todos.json", {
|
|
37
|
+
params: {
|
|
38
|
+
path: { todolistId },
|
|
39
|
+
query: { status: options?.status, completed: options?.completed },
|
|
40
|
+
},
|
|
41
|
+
}), options);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a new todo in a todolist
|
|
45
|
+
* @param todolistId - The todolist ID
|
|
46
|
+
* @param req - Todo creation parameters
|
|
47
|
+
* @returns The Todo
|
|
48
|
+
* @throws {BasecampError} If required fields are missing or invalid
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const result = await client.todos.create(123, { content: "Hello world" });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async create(todolistId, req) {
|
|
56
|
+
if (!req.content) {
|
|
57
|
+
throw Errors.validation("Content 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
|
+
if (req.startsOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.startsOn)) {
|
|
63
|
+
throw Errors.validation("Starts on must be in YYYY-MM-DD format");
|
|
64
|
+
}
|
|
65
|
+
const response = await this.request({
|
|
66
|
+
service: "Todos",
|
|
67
|
+
operation: "CreateTodo",
|
|
68
|
+
resourceType: "todo",
|
|
69
|
+
isMutation: true,
|
|
70
|
+
resourceId: todolistId,
|
|
71
|
+
}, () => this.client.POST("/todolists/{todolistId}/todos.json", {
|
|
72
|
+
params: {
|
|
73
|
+
path: { todolistId },
|
|
74
|
+
},
|
|
75
|
+
body: {
|
|
76
|
+
content: req.content,
|
|
77
|
+
description: req.description,
|
|
78
|
+
assignee_ids: req.assigneeIds,
|
|
79
|
+
completion_subscriber_ids: req.completionSubscriberIds,
|
|
80
|
+
notify: req.notify,
|
|
81
|
+
due_on: req.dueOn,
|
|
82
|
+
starts_on: req.startsOn,
|
|
83
|
+
},
|
|
84
|
+
}));
|
|
85
|
+
return response;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get a single todo by id
|
|
89
|
+
* @param todoId - The todo ID
|
|
90
|
+
* @returns The Todo
|
|
91
|
+
* @throws {BasecampError} If the resource is not found
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const result = await client.todos.get(123);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
async get(todoId) {
|
|
99
|
+
const response = await this.request({
|
|
100
|
+
service: "Todos",
|
|
101
|
+
operation: "GetTodo",
|
|
102
|
+
resourceType: "todo",
|
|
103
|
+
isMutation: false,
|
|
104
|
+
resourceId: todoId,
|
|
105
|
+
}, () => this.client.GET("/todos/{todoId}", {
|
|
106
|
+
params: {
|
|
107
|
+
path: { todoId },
|
|
108
|
+
},
|
|
109
|
+
}));
|
|
110
|
+
return response;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Update an existing todo
|
|
114
|
+
* @param todoId - The todo ID
|
|
115
|
+
* @param req - Todo update parameters
|
|
116
|
+
* @returns The Todo
|
|
117
|
+
* @throws {BasecampError} If the resource is not found or fields are invalid
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const result = await client.todos.update(123, { });
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
async update(todoId, req) {
|
|
125
|
+
if (req.dueOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.dueOn)) {
|
|
126
|
+
throw Errors.validation("Due on must be in YYYY-MM-DD format");
|
|
127
|
+
}
|
|
128
|
+
if (req.startsOn && !/^\d{4}-\d{2}-\d{2}$/.test(req.startsOn)) {
|
|
129
|
+
throw Errors.validation("Starts on must be in YYYY-MM-DD format");
|
|
130
|
+
}
|
|
131
|
+
const response = await this.request({
|
|
132
|
+
service: "Todos",
|
|
133
|
+
operation: "UpdateTodo",
|
|
134
|
+
resourceType: "todo",
|
|
135
|
+
isMutation: true,
|
|
136
|
+
resourceId: todoId,
|
|
137
|
+
}, () => this.client.PUT("/todos/{todoId}", {
|
|
138
|
+
params: {
|
|
139
|
+
path: { todoId },
|
|
140
|
+
},
|
|
141
|
+
body: {
|
|
142
|
+
content: req.content,
|
|
143
|
+
description: req.description,
|
|
144
|
+
assignee_ids: req.assigneeIds,
|
|
145
|
+
completion_subscriber_ids: req.completionSubscriberIds,
|
|
146
|
+
notify: req.notify,
|
|
147
|
+
due_on: req.dueOn,
|
|
148
|
+
starts_on: req.startsOn,
|
|
149
|
+
},
|
|
150
|
+
}));
|
|
151
|
+
return response;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Trash a todo. Trashed items can be recovered.
|
|
155
|
+
* @param todoId - The todo ID
|
|
156
|
+
* @returns void
|
|
157
|
+
* @throws {BasecampError} If the request fails
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* await client.todos.trash(123);
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
async trash(todoId) {
|
|
165
|
+
await this.request({
|
|
166
|
+
service: "Todos",
|
|
167
|
+
operation: "TrashTodo",
|
|
168
|
+
resourceType: "todo",
|
|
169
|
+
isMutation: true,
|
|
170
|
+
resourceId: todoId,
|
|
171
|
+
}, () => this.client.DELETE("/todos/{todoId}", {
|
|
172
|
+
params: {
|
|
173
|
+
path: { todoId },
|
|
174
|
+
},
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Mark a todo as complete
|
|
179
|
+
* @param todoId - The todo ID
|
|
180
|
+
* @returns void
|
|
181
|
+
* @throws {BasecampError} If the request fails
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* await client.todos.complete(123);
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
async complete(todoId) {
|
|
189
|
+
await this.request({
|
|
190
|
+
service: "Todos",
|
|
191
|
+
operation: "CompleteTodo",
|
|
192
|
+
resourceType: "todo",
|
|
193
|
+
isMutation: true,
|
|
194
|
+
resourceId: todoId,
|
|
195
|
+
}, () => this.client.POST("/todos/{todoId}/completion.json", {
|
|
196
|
+
params: {
|
|
197
|
+
path: { todoId },
|
|
198
|
+
},
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Mark a todo as incomplete
|
|
203
|
+
* @param todoId - The todo ID
|
|
204
|
+
* @returns void
|
|
205
|
+
* @throws {BasecampError} If the request fails
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```ts
|
|
209
|
+
* await client.todos.uncomplete(123);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
async uncomplete(todoId) {
|
|
213
|
+
await this.request({
|
|
214
|
+
service: "Todos",
|
|
215
|
+
operation: "UncompleteTodo",
|
|
216
|
+
resourceType: "todo",
|
|
217
|
+
isMutation: true,
|
|
218
|
+
resourceId: todoId,
|
|
219
|
+
}, () => this.client.DELETE("/todos/{todoId}/completion.json", {
|
|
220
|
+
params: {
|
|
221
|
+
path: { todoId },
|
|
222
|
+
},
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Reposition a todo within its todolist
|
|
227
|
+
* @param todoId - The todo ID
|
|
228
|
+
* @param req - Todo request parameters
|
|
229
|
+
* @returns void
|
|
230
|
+
* @throws {BasecampError} If the request fails
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* await client.todos.reposition(123, { position: 1 });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
async reposition(todoId, req) {
|
|
238
|
+
await this.request({
|
|
239
|
+
service: "Todos",
|
|
240
|
+
operation: "RepositionTodo",
|
|
241
|
+
resourceType: "todo",
|
|
242
|
+
isMutation: true,
|
|
243
|
+
resourceId: todoId,
|
|
244
|
+
}, () => this.client.PUT("/todos/{todoId}/position.json", {
|
|
245
|
+
params: {
|
|
246
|
+
path: { todoId },
|
|
247
|
+
},
|
|
248
|
+
body: {
|
|
249
|
+
position: req.position,
|
|
250
|
+
parent_id: req.parentId,
|
|
251
|
+
},
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=todos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.js","sourceRoot":"","sources":["../../../src/generated/services/todos.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAsEzC,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAE3C;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,CAAC,UAAkB,EAAE,OAAyB;QACtD,OAAO,IAAI,CAAC,gBAAgB,CAC1B;YACE,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,WAAW;YACtB,YAAY,EAAE,MAAM;YACpB,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,UAAU;SACvB,EACD,GAAG,EAAE,CACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,EAAE;YACpD,MAAM,EAAE;gBACN,IAAI,EAAE,EAAE,UAAU,EAAE;gBACpB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE;aAClE;SACF,CAAC,EACF,OAAO,CACV,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB,EAAE,GAAsB;QACrD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxD,MAAM,MAA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