@todoist/sdk 0.0.0-stage → 18.0.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/LICENSE +21 -0
- package/README.md +308 -2
- package/dist/esm/authentication.js +307 -0
- package/dist/esm/clients/activity-client.js +60 -0
- package/dist/esm/clients/app-client.js +366 -0
- package/dist/esm/clients/backup-client.js +47 -0
- package/dist/esm/clients/base-client.js +29 -0
- package/dist/esm/clients/billing-client.js +160 -0
- package/dist/esm/clients/comment-client.js +92 -0
- package/dist/esm/clients/email-client.js +41 -0
- package/dist/esm/clients/filter-client.js +26 -0
- package/dist/esm/clients/folder-client.js +80 -0
- package/dist/esm/clients/id-mapping-client.js +37 -0
- package/dist/esm/clients/insights-client.js +89 -0
- package/dist/esm/clients/label-client.js +131 -0
- package/dist/esm/clients/productivity-client.js +24 -0
- package/dist/esm/clients/project-client.js +284 -0
- package/dist/esm/clients/reminder-client.js +204 -0
- package/dist/esm/clients/section-client.js +121 -0
- package/dist/esm/clients/task-client.js +264 -0
- package/dist/esm/clients/template-client.js +89 -0
- package/dist/esm/clients/ui-extension-client.js +110 -0
- package/dist/esm/clients/upload-client.js +153 -0
- package/dist/esm/clients/view-options-client.js +21 -0
- package/dist/esm/clients/workspace-client.js +384 -0
- package/dist/esm/consts/endpoints.js +193 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/test-utils/asserts.js +8 -0
- package/dist/esm/test-utils/msw-setup.js +88 -0
- package/dist/esm/test-utils/obsidian-fetch-adapter.js +51 -0
- package/dist/esm/test-utils/test-defaults.js +367 -0
- package/dist/esm/test-utils/transport-seam.js +15 -0
- package/dist/esm/test-utils/webhook-fixtures.js +26 -0
- package/dist/esm/todoist-api.js +1757 -0
- package/dist/esm/transport/fetch-with-retry.js +216 -0
- package/dist/esm/transport/http-client.js +140 -0
- package/dist/esm/transport/http-dispatcher.js +158 -0
- package/dist/esm/transport/sync-request.js +106 -0
- package/dist/esm/types/activity/index.js +2 -0
- package/dist/esm/types/activity/requests.js +1 -0
- package/dist/esm/types/activity/types.js +45 -0
- package/dist/esm/types/apps/index.js +2 -0
- package/dist/esm/types/apps/requests.js +1 -0
- package/dist/esm/types/apps/types.js +249 -0
- package/dist/esm/types/backups/index.js +2 -0
- package/dist/esm/types/backups/requests.js +1 -0
- package/dist/esm/types/backups/types.js +5 -0
- package/dist/esm/types/billing/index.js +2 -0
- package/dist/esm/types/billing/requests.js +1 -0
- package/dist/esm/types/billing/types.js +89 -0
- package/dist/esm/types/comments/index.js +2 -0
- package/dist/esm/types/comments/requests.js +1 -0
- package/dist/esm/types/comments/types.js +57 -0
- package/dist/esm/types/common.js +7 -0
- package/dist/esm/types/emails/index.js +1 -0
- package/dist/esm/types/emails/requests.js +2 -0
- package/dist/esm/types/errors.js +41 -0
- package/dist/esm/types/folders/index.js +1 -0
- package/dist/esm/types/folders/requests.js +1 -0
- package/dist/esm/types/http.js +20 -0
- package/dist/esm/types/id-mappings/index.js +2 -0
- package/dist/esm/types/id-mappings/requests.js +17 -0
- package/dist/esm/types/id-mappings/types.js +9 -0
- package/dist/esm/types/index.js +24 -0
- package/dist/esm/types/insights/index.js +2 -0
- package/dist/esm/types/insights/requests.js +1 -0
- package/dist/esm/types/insights/types.js +77 -0
- package/dist/esm/types/labels/index.js +2 -0
- package/dist/esm/types/labels/requests.js +1 -0
- package/dist/esm/types/labels/types.js +8 -0
- package/dist/esm/types/productivity/index.js +1 -0
- package/dist/esm/types/productivity/types.js +65 -0
- package/dist/esm/types/projects/index.js +2 -0
- package/dist/esm/types/projects/requests.js +1 -0
- package/dist/esm/types/projects/types.js +65 -0
- package/dist/esm/types/reminders/index.js +1 -0
- package/dist/esm/types/reminders/requests.js +92 -0
- package/dist/esm/types/sections/index.js +2 -0
- package/dist/esm/types/sections/requests.js +1 -0
- package/dist/esm/types/sections/types.js +23 -0
- package/dist/esm/types/sync/commands/calendars.js +1 -0
- package/dist/esm/types/sync/commands/filters.js +1 -0
- package/dist/esm/types/sync/commands/folders.js +1 -0
- package/dist/esm/types/sync/commands/index.js +18 -0
- package/dist/esm/types/sync/commands/labels.js +2 -0
- package/dist/esm/types/sync/commands/notes.js +1 -0
- package/dist/esm/types/sync/commands/notifications.js +1 -0
- package/dist/esm/types/sync/commands/others.js +1 -0
- package/dist/esm/types/sync/commands/project-view-options.js +1 -0
- package/dist/esm/types/sync/commands/projects.js +1 -0
- package/dist/esm/types/sync/commands/reminders.js +1 -0
- package/dist/esm/types/sync/commands/sections.js +1 -0
- package/dist/esm/types/sync/commands/shared.js +16 -0
- package/dist/esm/types/sync/commands/sharing.js +1 -0
- package/dist/esm/types/sync/commands/tasks.js +1 -0
- package/dist/esm/types/sync/commands/view-options.js +1 -0
- package/dist/esm/types/sync/commands/workspace-filters.js +1 -0
- package/dist/esm/types/sync/commands/workspaces.js +1 -0
- package/dist/esm/types/sync/index.js +6 -0
- package/dist/esm/types/sync/request.js +1 -0
- package/dist/esm/types/sync/resource-types.js +36 -0
- package/dist/esm/types/sync/resources/calendars.js +24 -0
- package/dist/esm/types/sync/resources/collaborators.js +21 -0
- package/dist/esm/types/sync/resources/completed-info.js +21 -0
- package/dist/esm/types/sync/resources/filters.js +12 -0
- package/dist/esm/types/sync/resources/folders.js +10 -0
- package/dist/esm/types/sync/resources/index.js +18 -0
- package/dist/esm/types/sync/resources/labels.js +7 -0
- package/dist/esm/types/sync/resources/live-notifications.js +35 -0
- package/dist/esm/types/sync/resources/notes.js +18 -0
- package/dist/esm/types/sync/resources/reminders.js +58 -0
- package/dist/esm/types/sync/resources/suggestions.js +33 -0
- package/dist/esm/types/sync/resources/tooltips.js +5 -0
- package/dist/esm/types/sync/resources/user-plan-limits.js +21 -0
- package/dist/esm/types/sync/resources/user-settings.js +41 -0
- package/dist/esm/types/sync/resources/user-status.js +22 -0
- package/dist/esm/types/sync/resources/user.js +109 -0
- package/dist/esm/types/sync/resources/view-options.js +128 -0
- package/dist/esm/types/sync/resources/workspace-filters.js +17 -0
- package/dist/esm/types/sync/resources/workspaces.js +69 -0
- package/dist/esm/types/sync/response.js +57 -0
- package/dist/esm/types/sync/user-preferences.js +68 -0
- package/dist/esm/types/tasks/index.js +2 -0
- package/dist/esm/types/tasks/requests.js +1 -0
- package/dist/esm/types/tasks/types.js +56 -0
- package/dist/esm/types/templates/index.js +1 -0
- package/dist/esm/types/templates/requests.js +1 -0
- package/dist/esm/types/ui-extensions/index.js +2 -0
- package/dist/esm/types/ui-extensions/requests.js +1 -0
- package/dist/esm/types/ui-extensions/types.js +74 -0
- package/dist/esm/types/uploads/index.js +1 -0
- package/dist/esm/types/uploads/requests.js +1 -0
- package/dist/esm/types/users/index.js +1 -0
- package/dist/esm/types/users/types.js +49 -0
- package/dist/esm/types/webhooks/comments.js +93 -0
- package/dist/esm/types/webhooks/envelope.js +23 -0
- package/dist/esm/types/webhooks/filters.js +27 -0
- package/dist/esm/types/webhooks/index.js +9 -0
- package/dist/esm/types/webhooks/labels.js +51 -0
- package/dist/esm/types/webhooks/projects.js +33 -0
- package/dist/esm/types/webhooks/reminders.js +32 -0
- package/dist/esm/types/webhooks/sections.js +50 -0
- package/dist/esm/types/webhooks/tasks.js +65 -0
- package/dist/esm/types/webhooks/types.js +52 -0
- package/dist/esm/types/workspaces/index.js +2 -0
- package/dist/esm/types/workspaces/requests.js +1 -0
- package/dist/esm/types/workspaces/types.js +151 -0
- package/dist/esm/utils/activity-helpers.js +53 -0
- package/dist/esm/utils/case-conversion.js +84 -0
- package/dist/esm/utils/colors.js +145 -0
- package/dist/esm/utils/file-response.js +29 -0
- package/dist/esm/utils/filter-queries.js +231 -0
- package/dist/esm/utils/filter-query-definitions.js +2789 -0
- package/dist/esm/utils/headers.js +42 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/multipart-upload.js +267 -0
- package/dist/esm/utils/person-names.js +61 -0
- package/dist/esm/utils/processing-helpers.js +12 -0
- package/dist/esm/utils/project-helpers.js +29 -0
- package/dist/esm/utils/request-helpers.js +43 -0
- package/dist/esm/utils/sanitization.js +131 -0
- package/dist/esm/utils/sync-helpers.js +19 -0
- package/dist/esm/utils/task-sorting.js +280 -0
- package/dist/esm/utils/uncompletable-helpers.js +54 -0
- package/dist/esm/utils/url-helpers.js +196 -0
- package/dist/esm/utils/validators.js +102 -0
- package/dist/esm/utils/view-options.js +15 -0
- package/dist/esm/utils/webhook-parser.js +56 -0
- package/dist/types/authentication.d.ts +262 -0
- package/dist/types/clients/activity-client.d.ts +12 -0
- package/dist/types/clients/app-client.d.ts +37 -0
- package/dist/types/clients/backup-client.d.ts +14 -0
- package/dist/types/clients/base-client.d.ts +23 -0
- package/dist/types/clients/billing-client.d.ts +22 -0
- package/dist/types/clients/comment-client.d.ts +15 -0
- package/dist/types/clients/email-client.d.ts +13 -0
- package/dist/types/clients/filter-client.d.ts +10 -0
- package/dist/types/clients/folder-client.d.ts +16 -0
- package/dist/types/clients/id-mapping-client.d.ts +13 -0
- package/dist/types/clients/insights-client.d.ts +18 -0
- package/dist/types/clients/label-client.d.ts +19 -0
- package/dist/types/clients/productivity-client.d.ts +12 -0
- package/dist/types/clients/project-client.d.ts +22 -0
- package/dist/types/clients/reminder-client.d.ts +25 -0
- package/dist/types/clients/section-client.d.ts +18 -0
- package/dist/types/clients/task-client.d.ts +25 -0
- package/dist/types/clients/template-client.d.ts +17 -0
- package/dist/types/clients/ui-extension-client.d.ts +18 -0
- package/dist/types/clients/upload-client.d.ts +17 -0
- package/dist/types/clients/view-options-client.d.ts +8 -0
- package/dist/types/clients/workspace-client.d.ts +43 -0
- package/dist/types/consts/endpoints.d.ts +120 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/test-utils/asserts.d.ts +1 -0
- package/dist/types/test-utils/msw-setup.d.ts +33 -0
- package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +29 -0
- package/dist/types/test-utils/test-defaults.d.ts +286 -0
- package/dist/types/test-utils/transport-seam.d.ts +1 -0
- package/dist/types/test-utils/webhook-fixtures.d.ts +13 -0
- package/dist/types/todoist-api.d.ts +1437 -0
- package/dist/types/transport/fetch-with-retry.d.ts +12 -0
- package/dist/types/transport/http-client.d.ts +25 -0
- package/dist/types/transport/http-dispatcher.d.ts +65 -0
- package/dist/types/transport/sync-request.d.ts +31 -0
- package/dist/types/types/activity/index.d.ts +2 -0
- package/dist/types/types/activity/requests.d.ts +85 -0
- package/dist/types/types/activity/types.d.ts +56 -0
- package/dist/types/types/apps/index.d.ts +2 -0
- package/dist/types/types/apps/requests.d.ts +89 -0
- package/dist/types/types/apps/types.d.ts +418 -0
- package/dist/types/types/backups/index.d.ts +2 -0
- package/dist/types/types/backups/requests.d.ts +16 -0
- package/dist/types/types/backups/types.d.ts +7 -0
- package/dist/types/types/billing/index.d.ts +2 -0
- package/dist/types/types/billing/requests.d.ts +62 -0
- package/dist/types/types/billing/types.d.ts +207 -0
- package/dist/types/types/comments/index.d.ts +2 -0
- package/dist/types/types/comments/requests.d.ts +64 -0
- package/dist/types/types/comments/types.d.ts +141 -0
- package/dist/types/types/common.d.ts +13 -0
- package/dist/types/types/emails/index.d.ts +1 -0
- package/dist/types/types/emails/requests.d.ts +30 -0
- package/dist/types/types/errors.d.ts +29 -0
- package/dist/types/types/folders/index.d.ts +1 -0
- package/dist/types/types/folders/requests.d.ts +20 -0
- package/dist/types/types/http.d.ts +104 -0
- package/dist/types/types/id-mappings/index.d.ts +2 -0
- package/dist/types/types/id-mappings/requests.d.ts +28 -0
- package/dist/types/types/id-mappings/types.d.ts +13 -0
- package/dist/types/types/index.d.ts +24 -0
- package/dist/types/types/insights/index.d.ts +2 -0
- package/dist/types/types/insights/requests.d.ts +26 -0
- package/dist/types/types/insights/types.d.ts +167 -0
- package/dist/types/types/labels/index.d.ts +2 -0
- package/dist/types/types/labels/requests.d.ts +75 -0
- package/dist/types/types/labels/types.d.ts +13 -0
- package/dist/types/types/productivity/index.d.ts +1 -0
- package/dist/types/types/productivity/types.d.ts +115 -0
- package/dist/types/types/projects/index.d.ts +2 -0
- package/dist/types/types/projects/requests.d.ts +206 -0
- package/dist/types/types/projects/types.d.ts +286 -0
- package/dist/types/types/reminders/index.d.ts +1 -0
- package/dist/types/types/reminders/requests.d.ts +205 -0
- package/dist/types/types/sections/index.d.ts +2 -0
- package/dist/types/types/sections/requests.d.ts +49 -0
- package/dist/types/types/sections/types.d.ts +70 -0
- package/dist/types/types/sync/commands/calendars.d.ts +14 -0
- package/dist/types/types/sync/commands/filters.d.ts +24 -0
- package/dist/types/types/sync/commands/folders.d.ts +20 -0
- package/dist/types/types/sync/commands/index.d.ts +167 -0
- package/dist/types/types/sync/commands/labels.d.ts +32 -0
- package/dist/types/types/sync/commands/notes.d.ts +27 -0
- package/dist/types/types/sync/commands/notifications.d.ts +10 -0
- package/dist/types/types/sync/commands/others.d.ts +61 -0
- package/dist/types/types/sync/commands/project-view-options.d.ts +13 -0
- package/dist/types/types/sync/commands/projects.d.ts +96 -0
- package/dist/types/types/sync/commands/reminders.d.ts +51 -0
- package/dist/types/types/sync/commands/sections.d.ts +36 -0
- package/dist/types/types/sync/commands/shared.d.ts +51 -0
- package/dist/types/types/sync/commands/sharing.d.ts +16 -0
- package/dist/types/types/sync/commands/tasks.d.ts +78 -0
- package/dist/types/types/sync/commands/view-options.d.ts +18 -0
- package/dist/types/types/sync/commands/workspace-filters.d.ts +25 -0
- package/dist/types/types/sync/commands/workspaces.d.ts +82 -0
- package/dist/types/types/sync/index.d.ts +6 -0
- package/dist/types/types/sync/request.d.ts +7 -0
- package/dist/types/types/sync/resource-types.d.ts +5 -0
- package/dist/types/types/sync/resources/calendars.d.ts +38 -0
- package/dist/types/types/sync/resources/collaborators.d.ts +45 -0
- package/dist/types/types/sync/resources/completed-info.d.ts +33 -0
- package/dist/types/types/sync/resources/filters.d.ts +13 -0
- package/dist/types/types/sync/resources/folders.d.ts +11 -0
- package/dist/types/types/sync/resources/index.d.ts +18 -0
- package/dist/types/types/sync/resources/labels.d.ts +12 -0
- package/dist/types/types/sync/resources/live-notifications.d.ts +32 -0
- package/dist/types/types/sync/resources/notes.d.ts +34 -0
- package/dist/types/types/sync/resources/reminders.d.ts +213 -0
- package/dist/types/types/sync/resources/suggestions.d.ts +96 -0
- package/dist/types/types/sync/resources/tooltips.d.ts +6 -0
- package/dist/types/types/sync/resources/user-plan-limits.d.ts +47 -0
- package/dist/types/types/sync/resources/user-settings.d.ts +40 -0
- package/dist/types/types/sync/resources/user-status.d.ts +46 -0
- package/dist/types/types/sync/resources/user.d.ts +151 -0
- package/dist/types/types/sync/resources/view-options.d.ts +157 -0
- package/dist/types/types/sync/resources/workspace-filters.d.ts +18 -0
- package/dist/types/types/sync/resources/workspaces.d.ts +142 -0
- package/dist/types/types/sync/response.d.ts +930 -0
- package/dist/types/types/sync/user-preferences.d.ts +39 -0
- package/dist/types/types/tasks/index.d.ts +2 -0
- package/dist/types/types/tasks/requests.d.ts +197 -0
- package/dist/types/types/tasks/types.d.ts +162 -0
- package/dist/types/types/templates/index.d.ts +1 -0
- package/dist/types/types/templates/requests.d.ts +92 -0
- package/dist/types/types/ui-extensions/index.d.ts +2 -0
- package/dist/types/types/ui-extensions/requests.d.ts +108 -0
- package/dist/types/types/ui-extensions/types.d.ts +185 -0
- package/dist/types/types/uploads/index.d.ts +1 -0
- package/dist/types/types/uploads/requests.d.ts +32 -0
- package/dist/types/types/users/index.d.ts +1 -0
- package/dist/types/types/users/types.d.ts +67 -0
- package/dist/types/types/webhooks/comments.d.ts +1600 -0
- package/dist/types/types/webhooks/envelope.d.ts +34 -0
- package/dist/types/types/webhooks/filters.d.ts +99 -0
- package/dist/types/types/webhooks/index.d.ts +9 -0
- package/dist/types/types/webhooks/labels.d.ts +160 -0
- package/dist/types/types/webhooks/projects.d.ts +365 -0
- package/dist/types/types/webhooks/reminders.d.ts +82 -0
- package/dist/types/types/webhooks/sections.d.ts +372 -0
- package/dist/types/types/webhooks/tasks.d.ts +981 -0
- package/dist/types/types/webhooks/types.d.ts +2606 -0
- package/dist/types/types/workspaces/index.d.ts +2 -0
- package/dist/types/types/workspaces/requests.d.ts +260 -0
- package/dist/types/types/workspaces/types.d.ts +266 -0
- package/dist/types/utils/activity-helpers.d.ts +28 -0
- package/dist/types/utils/case-conversion.d.ts +20 -0
- package/dist/types/utils/colors.d.ts +201 -0
- package/dist/types/utils/file-response.d.ts +15 -0
- package/dist/types/utils/filter-queries.d.ts +42 -0
- package/dist/types/utils/filter-query-definitions.d.ts +27 -0
- package/dist/types/utils/headers.d.ts +20 -0
- package/dist/types/utils/index.d.ts +15 -0
- package/dist/types/utils/multipart-upload.d.ts +58 -0
- package/dist/types/utils/person-names.d.ts +52 -0
- package/dist/types/utils/processing-helpers.d.ts +1 -0
- package/dist/types/utils/project-helpers.d.ts +21 -0
- package/dist/types/utils/request-helpers.d.ts +33 -0
- package/dist/types/utils/sanitization.d.ts +52 -0
- package/dist/types/utils/sync-helpers.d.ts +17 -0
- package/dist/types/utils/task-sorting.d.ts +46 -0
- package/dist/types/utils/uncompletable-helpers.d.ts +30 -0
- package/dist/types/utils/url-helpers.d.ts +120 -0
- package/dist/types/utils/validators.d.ts +1917 -0
- package/dist/types/utils/view-options.d.ts +11 -0
- package/dist/types/utils/webhook-parser.d.ts +48 -0
- package/package.json +88 -5
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Available subscription statuses. */
|
|
3
|
+
export declare const BILLING_SUBSCRIPTION_STATUSES: readonly ["none", "autorenew", "canceled", "expired", "trial", "trial_canceled"];
|
|
4
|
+
/** Current subscription status. */
|
|
5
|
+
export type BillingSubscriptionStatus = (typeof BILLING_SUBSCRIPTION_STATUSES)[number];
|
|
6
|
+
/** Available plan tiers. */
|
|
7
|
+
export declare const BILLING_PLANS: readonly ["free", "pro", "pro_gifted", "pro_legacy"];
|
|
8
|
+
/** Plan tier a user is currently on. */
|
|
9
|
+
export type BillingPlan = (typeof BILLING_PLANS)[number];
|
|
10
|
+
/** Ways an active subscription can be purchased. */
|
|
11
|
+
export declare const BILLING_ACTIVATION_METHODS: readonly ["stripe", "appstore", "playstore", "teams", "manual"];
|
|
12
|
+
/** How an active subscription was purchased. */
|
|
13
|
+
export type BillingActivationMethod = (typeof BILLING_ACTIVATION_METHODS)[number];
|
|
14
|
+
/** Available billing cycles. */
|
|
15
|
+
export declare const BILLING_CYCLES: readonly ["monthly", "yearly"];
|
|
16
|
+
/** Billing cycle for a plan price. */
|
|
17
|
+
export type BillingCycle = (typeof BILLING_CYCLES)[number];
|
|
18
|
+
/** Available tax behaviors for a price. */
|
|
19
|
+
export declare const TAX_BEHAVIORS: readonly ["exclusive", "inclusive", "unspecified"];
|
|
20
|
+
/** Tax behavior for a plan price. */
|
|
21
|
+
export type TaxBehavior = (typeof TAX_BEHAVIORS)[number];
|
|
22
|
+
export declare const BillingPlanPriceSchema: z.ZodObject<{
|
|
23
|
+
amount: z.ZodString;
|
|
24
|
+
rawAmount: z.ZodNumber;
|
|
25
|
+
currency: z.ZodString;
|
|
26
|
+
billingCycle: z.ZodNullable<z.ZodEnum<{
|
|
27
|
+
monthly: "monthly";
|
|
28
|
+
yearly: "yearly";
|
|
29
|
+
}>>;
|
|
30
|
+
taxBehavior: z.ZodEnum<{
|
|
31
|
+
inclusive: "inclusive";
|
|
32
|
+
exclusive: "exclusive";
|
|
33
|
+
unspecified: "unspecified";
|
|
34
|
+
}>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/** Price of an active plan. */
|
|
37
|
+
export type BillingPlanPrice = z.infer<typeof BillingPlanPriceSchema>;
|
|
38
|
+
export declare const SubscriptionInfoSchema: z.ZodObject<{
|
|
39
|
+
status: z.ZodEnum<{
|
|
40
|
+
none: "none";
|
|
41
|
+
autorenew: "autorenew";
|
|
42
|
+
canceled: "canceled";
|
|
43
|
+
expired: "expired";
|
|
44
|
+
trial: "trial";
|
|
45
|
+
trial_canceled: "trial_canceled";
|
|
46
|
+
}>;
|
|
47
|
+
plan: z.ZodEnum<{
|
|
48
|
+
free: "free";
|
|
49
|
+
pro: "pro";
|
|
50
|
+
pro_gifted: "pro_gifted";
|
|
51
|
+
pro_legacy: "pro_legacy";
|
|
52
|
+
}>;
|
|
53
|
+
expirationDate: z.ZodNullable<z.ZodString>;
|
|
54
|
+
activationMethod: z.ZodEnum<{
|
|
55
|
+
manual: "manual";
|
|
56
|
+
stripe: "stripe";
|
|
57
|
+
appstore: "appstore";
|
|
58
|
+
playstore: "playstore";
|
|
59
|
+
teams: "teams";
|
|
60
|
+
}>;
|
|
61
|
+
planPrice: z.ZodNullable<z.ZodObject<{
|
|
62
|
+
amount: z.ZodString;
|
|
63
|
+
rawAmount: z.ZodNumber;
|
|
64
|
+
currency: z.ZodString;
|
|
65
|
+
billingCycle: z.ZodNullable<z.ZodEnum<{
|
|
66
|
+
monthly: "monthly";
|
|
67
|
+
yearly: "yearly";
|
|
68
|
+
}>>;
|
|
69
|
+
taxBehavior: z.ZodEnum<{
|
|
70
|
+
inclusive: "inclusive";
|
|
71
|
+
exclusive: "exclusive";
|
|
72
|
+
unspecified: "unspecified";
|
|
73
|
+
}>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
billingPortalUrl: z.ZodNullable<z.ZodString>;
|
|
76
|
+
billingPortalSwitchToAnnualUrl: z.ZodNullable<z.ZodString>;
|
|
77
|
+
hasBillingPortal: z.ZodBoolean;
|
|
78
|
+
hasBillingPortalSwitchToAnnual: z.ZodBoolean;
|
|
79
|
+
invoiceCreditBalance: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
80
|
+
hasSwitchLegacyToCurrent: z.ZodBoolean;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
/** Current subscription state of a user. */
|
|
83
|
+
export type SubscriptionInfo = z.infer<typeof SubscriptionInfoSchema>;
|
|
84
|
+
export declare const FormattedPriceSchema: z.ZodObject<{
|
|
85
|
+
currency: z.ZodString;
|
|
86
|
+
unitAmount: z.ZodNumber;
|
|
87
|
+
taxBehavior: z.ZodEnum<{
|
|
88
|
+
inclusive: "inclusive";
|
|
89
|
+
exclusive: "exclusive";
|
|
90
|
+
unspecified: "unspecified";
|
|
91
|
+
}>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
/** A single price within a billing-cycle listing. */
|
|
94
|
+
export type FormattedPrice = z.infer<typeof FormattedPriceSchema>;
|
|
95
|
+
export declare const PriceListingSchema: z.ZodObject<{
|
|
96
|
+
billingCycle: z.ZodEnum<{
|
|
97
|
+
monthly: "monthly";
|
|
98
|
+
yearly: "yearly";
|
|
99
|
+
}>;
|
|
100
|
+
prices: z.ZodArray<z.ZodObject<{
|
|
101
|
+
currency: z.ZodString;
|
|
102
|
+
unitAmount: z.ZodNumber;
|
|
103
|
+
taxBehavior: z.ZodEnum<{
|
|
104
|
+
inclusive: "inclusive";
|
|
105
|
+
exclusive: "exclusive";
|
|
106
|
+
unspecified: "unspecified";
|
|
107
|
+
}>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
/** Prices available for a given billing cycle. */
|
|
111
|
+
export type PriceListing = z.infer<typeof PriceListingSchema>;
|
|
112
|
+
export declare const ProPlanDetailsSchema: z.ZodObject<{
|
|
113
|
+
currentPlanStatus: z.ZodEnum<{
|
|
114
|
+
Active: "Active";
|
|
115
|
+
Downgraded: "Downgraded";
|
|
116
|
+
Cancelled: "Cancelled";
|
|
117
|
+
NeverSubscribed: "NeverSubscribed";
|
|
118
|
+
}>;
|
|
119
|
+
downgradeAt: z.ZodNullable<z.ZodString>;
|
|
120
|
+
priceList: z.ZodArray<z.ZodObject<{
|
|
121
|
+
billingCycle: z.ZodEnum<{
|
|
122
|
+
monthly: "monthly";
|
|
123
|
+
yearly: "yearly";
|
|
124
|
+
}>;
|
|
125
|
+
prices: z.ZodArray<z.ZodObject<{
|
|
126
|
+
currency: z.ZodString;
|
|
127
|
+
unitAmount: z.ZodNumber;
|
|
128
|
+
taxBehavior: z.ZodEnum<{
|
|
129
|
+
inclusive: "inclusive";
|
|
130
|
+
exclusive: "exclusive";
|
|
131
|
+
unspecified: "unspecified";
|
|
132
|
+
}>;
|
|
133
|
+
}, z.core.$strip>>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
/** Pro plan and billing details. */
|
|
137
|
+
export type ProPlanDetails = z.infer<typeof ProPlanDetailsSchema>;
|
|
138
|
+
export declare const PricesResponseSchema: z.ZodObject<{
|
|
139
|
+
pro: z.ZodArray<z.ZodObject<{
|
|
140
|
+
billingCycle: z.ZodEnum<{
|
|
141
|
+
monthly: "monthly";
|
|
142
|
+
yearly: "yearly";
|
|
143
|
+
}>;
|
|
144
|
+
prices: z.ZodArray<z.ZodObject<{
|
|
145
|
+
currency: z.ZodString;
|
|
146
|
+
unitAmount: z.ZodNumber;
|
|
147
|
+
taxBehavior: z.ZodEnum<{
|
|
148
|
+
inclusive: "inclusive";
|
|
149
|
+
exclusive: "exclusive";
|
|
150
|
+
unspecified: "unspecified";
|
|
151
|
+
}>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
teams: z.ZodArray<z.ZodObject<{
|
|
155
|
+
billingCycle: z.ZodEnum<{
|
|
156
|
+
monthly: "monthly";
|
|
157
|
+
yearly: "yearly";
|
|
158
|
+
}>;
|
|
159
|
+
prices: z.ZodArray<z.ZodObject<{
|
|
160
|
+
currency: z.ZodString;
|
|
161
|
+
unitAmount: z.ZodNumber;
|
|
162
|
+
taxBehavior: z.ZodEnum<{
|
|
163
|
+
inclusive: "inclusive";
|
|
164
|
+
exclusive: "exclusive";
|
|
165
|
+
unspecified: "unspecified";
|
|
166
|
+
}>;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
/** Available Pro and Teams prices. */
|
|
171
|
+
export type PricesResponse = z.infer<typeof PricesResponseSchema>;
|
|
172
|
+
/**
|
|
173
|
+
* Monthly and yearly amounts for a single currency. Each amount is a number in
|
|
174
|
+
* the currency's smallest unit, or a localized formatted string when the
|
|
175
|
+
* `pricing` endpoint is called with `formatted: true`.
|
|
176
|
+
*/
|
|
177
|
+
export declare const PricingTermsSchema: z.ZodObject<{
|
|
178
|
+
monthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
179
|
+
yearly: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
/** Monthly/yearly amounts for one currency. */
|
|
182
|
+
export type PricingTerms = z.infer<typeof PricingTermsSchema>;
|
|
183
|
+
/**
|
|
184
|
+
* A pricing version entry: plan name (`pro` / `biz`) → currency code →
|
|
185
|
+
* {@link PricingTerms}.
|
|
186
|
+
*/
|
|
187
|
+
export declare const PricingVersionSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
188
|
+
monthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
189
|
+
yearly: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
190
|
+
}, z.core.$strip>>>;
|
|
191
|
+
/** Prices for one pricing version, keyed by plan then currency. */
|
|
192
|
+
export type PricingVersion = z.infer<typeof PricingVersionSchema>;
|
|
193
|
+
/**
|
|
194
|
+
* Response of the `pricing` endpoint: fixed version-pointer string fields plus
|
|
195
|
+
* dynamic version keys (`v1`, `v2`, …), each a {@link PricingVersion}.
|
|
196
|
+
*/
|
|
197
|
+
export declare const PricingResponseSchema: z.ZodObject<{
|
|
198
|
+
latestPro: z.ZodString;
|
|
199
|
+
latestBiz: z.ZodString;
|
|
200
|
+
sessionPro: z.ZodString;
|
|
201
|
+
sessionBiz: z.ZodString;
|
|
202
|
+
}, z.core.$catchall<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
203
|
+
monthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
204
|
+
yearly: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
205
|
+
}, z.core.$strip>>>>>;
|
|
206
|
+
/** Current and legacy Pro/Teams pricing keyed by version. */
|
|
207
|
+
export type PricingResponse = z.infer<typeof PricingResponseSchema>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { RequireExactlyOne } from 'type-fest';
|
|
2
|
+
import type { Comment } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Arguments for retrieving comments.
|
|
5
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments/operation/get_comments_api_v1_comments_get
|
|
6
|
+
*/
|
|
7
|
+
export type GetCommentsArgs = {
|
|
8
|
+
taskId: string;
|
|
9
|
+
projectId?: never;
|
|
10
|
+
cursor?: string | null;
|
|
11
|
+
limit?: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Arguments for retrieving task comments.
|
|
15
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments/operation/get_comments_api_v1_comments_get
|
|
16
|
+
*/
|
|
17
|
+
export type GetTaskCommentsArgs = {
|
|
18
|
+
taskId: string;
|
|
19
|
+
projectId?: never;
|
|
20
|
+
cursor?: string | null;
|
|
21
|
+
limit?: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Arguments for retrieving project comments.
|
|
25
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments/operation/get_comments_api_v1_comments_get
|
|
26
|
+
*/
|
|
27
|
+
export type GetProjectCommentsArgs = {
|
|
28
|
+
projectId: string;
|
|
29
|
+
taskId?: never;
|
|
30
|
+
cursor?: string | null;
|
|
31
|
+
limit?: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Response from retrieving comments.
|
|
35
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments/operation/get_comments_api_v1_comments_get
|
|
36
|
+
*/
|
|
37
|
+
export type GetCommentsResponse = {
|
|
38
|
+
results: Comment[];
|
|
39
|
+
nextCursor: string | null;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Arguments for creating a new comment.
|
|
43
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments/operation/create_comment_api_v1_comments_post
|
|
44
|
+
*/
|
|
45
|
+
export type AddCommentArgs = {
|
|
46
|
+
content: string;
|
|
47
|
+
attachment?: {
|
|
48
|
+
fileName?: string;
|
|
49
|
+
fileUrl: string;
|
|
50
|
+
fileType?: string;
|
|
51
|
+
resourceType?: string;
|
|
52
|
+
} | null;
|
|
53
|
+
uidsToNotify?: string[];
|
|
54
|
+
} & RequireExactlyOne<{
|
|
55
|
+
taskId?: string;
|
|
56
|
+
projectId?: string;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Arguments for updating a comment.
|
|
60
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments/operation/update_comment_api_v1_comments__comment_id__post
|
|
61
|
+
*/
|
|
62
|
+
export type UpdateCommentArgs = {
|
|
63
|
+
content: string;
|
|
64
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Available file attachment upload states. */
|
|
3
|
+
export declare const UPLOAD_STATES: readonly ["pending", "completed"];
|
|
4
|
+
/** Upload state of a file attachment. */
|
|
5
|
+
export type UploadState = (typeof UPLOAD_STATES)[number];
|
|
6
|
+
export declare const AttachmentSchema: z.ZodObject<{
|
|
7
|
+
resourceType: z.ZodString;
|
|
8
|
+
fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
10
|
+
fileType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
fileUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
fileDuration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
13
|
+
uploadState: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
14
|
+
pending: "pending";
|
|
15
|
+
completed: "completed";
|
|
16
|
+
}>>>;
|
|
17
|
+
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
19
|
+
imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
20
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
/**
|
|
24
|
+
* Represents a file attachment in a comment.
|
|
25
|
+
* @see https://developer.todoist.com/api/v1/#tag/Sync/Comments/File-Attachments
|
|
26
|
+
*/
|
|
27
|
+
export type Attachment = z.infer<typeof AttachmentSchema>;
|
|
28
|
+
export declare const RawCommentSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
content: z.ZodString;
|
|
33
|
+
postedAt: z.ZodCoercedDate<unknown>;
|
|
34
|
+
fileAttachment: z.ZodNullable<z.ZodObject<{
|
|
35
|
+
resourceType: z.ZodString;
|
|
36
|
+
fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
38
|
+
fileType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
fileUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
fileDuration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
41
|
+
uploadState: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
42
|
+
pending: "pending";
|
|
43
|
+
completed: "completed";
|
|
44
|
+
}>>>;
|
|
45
|
+
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
47
|
+
imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
48
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
postedUid: z.ZodString;
|
|
52
|
+
uidsToNotify: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
53
|
+
reactions: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
54
|
+
isDeleted: z.ZodBoolean;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
/**
|
|
57
|
+
* Represents a raw comment response from the API.
|
|
58
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments
|
|
59
|
+
*/
|
|
60
|
+
export type RawComment = z.infer<typeof RawCommentSchema>;
|
|
61
|
+
export declare const CommentSchema: z.ZodPipe<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
64
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
65
|
+
content: z.ZodString;
|
|
66
|
+
postedAt: z.ZodCoercedDate<unknown>;
|
|
67
|
+
fileAttachment: z.ZodNullable<z.ZodObject<{
|
|
68
|
+
resourceType: z.ZodString;
|
|
69
|
+
fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
71
|
+
fileType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
fileUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
fileDuration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
74
|
+
uploadState: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
75
|
+
pending: "pending";
|
|
76
|
+
completed: "completed";
|
|
77
|
+
}>>>;
|
|
78
|
+
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
80
|
+
imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
81
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
+
}, z.core.$strip>>;
|
|
84
|
+
postedUid: z.ZodString;
|
|
85
|
+
uidsToNotify: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
86
|
+
reactions: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
87
|
+
isDeleted: z.ZodBoolean;
|
|
88
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
89
|
+
taskId: string | undefined;
|
|
90
|
+
id: string;
|
|
91
|
+
content: string;
|
|
92
|
+
postedAt: Date;
|
|
93
|
+
fileAttachment: {
|
|
94
|
+
resourceType: string;
|
|
95
|
+
fileName?: string | null | undefined;
|
|
96
|
+
fileSize?: number | null | undefined;
|
|
97
|
+
fileType?: string | null | undefined;
|
|
98
|
+
fileUrl?: string | null | undefined;
|
|
99
|
+
fileDuration?: number | null | undefined;
|
|
100
|
+
uploadState?: "pending" | "completed" | null | undefined;
|
|
101
|
+
image?: string | null | undefined;
|
|
102
|
+
imageWidth?: number | null | undefined;
|
|
103
|
+
imageHeight?: number | null | undefined;
|
|
104
|
+
url?: string | null | undefined;
|
|
105
|
+
title?: string | null | undefined;
|
|
106
|
+
} | null;
|
|
107
|
+
postedUid: string;
|
|
108
|
+
uidsToNotify: string[] | null;
|
|
109
|
+
reactions: Record<string, string[]> | null;
|
|
110
|
+
isDeleted: boolean;
|
|
111
|
+
projectId?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
id: string;
|
|
114
|
+
content: string;
|
|
115
|
+
postedAt: Date;
|
|
116
|
+
fileAttachment: {
|
|
117
|
+
resourceType: string;
|
|
118
|
+
fileName?: string | null | undefined;
|
|
119
|
+
fileSize?: number | null | undefined;
|
|
120
|
+
fileType?: string | null | undefined;
|
|
121
|
+
fileUrl?: string | null | undefined;
|
|
122
|
+
fileDuration?: number | null | undefined;
|
|
123
|
+
uploadState?: "pending" | "completed" | null | undefined;
|
|
124
|
+
image?: string | null | undefined;
|
|
125
|
+
imageWidth?: number | null | undefined;
|
|
126
|
+
imageHeight?: number | null | undefined;
|
|
127
|
+
url?: string | null | undefined;
|
|
128
|
+
title?: string | null | undefined;
|
|
129
|
+
} | null;
|
|
130
|
+
postedUid: string;
|
|
131
|
+
uidsToNotify: string[] | null;
|
|
132
|
+
reactions: Record<string, string[]> | null;
|
|
133
|
+
isDeleted: boolean;
|
|
134
|
+
itemId?: string | undefined;
|
|
135
|
+
projectId?: string | undefined;
|
|
136
|
+
}>>;
|
|
137
|
+
/**
|
|
138
|
+
* Represents a comment in Todoist.
|
|
139
|
+
* @see https://developer.todoist.com/api/v1/#tag/Comments
|
|
140
|
+
*/
|
|
141
|
+
export type Comment = z.infer<typeof CommentSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
type SearchArgs = {
|
|
3
|
+
query: string;
|
|
4
|
+
cursor?: string | null;
|
|
5
|
+
limit?: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema that accepts both string and number values and coerces to string.
|
|
9
|
+
* The REST API returns numeric IDs while the Sync API returns string IDs.
|
|
10
|
+
*/
|
|
11
|
+
declare const StringOrNumberSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
12
|
+
export { StringOrNumberSchema };
|
|
13
|
+
export type { SearchArgs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Object types that support email forwarding. */
|
|
2
|
+
export declare const EMAIL_OBJECT_TYPES: readonly ["project", "project_comments", "task"];
|
|
3
|
+
/** Object type that supports email forwarding. */
|
|
4
|
+
export type EmailObjectType = (typeof EMAIL_OBJECT_TYPES)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Arguments for getting or creating an email forwarding address.
|
|
7
|
+
* @see https://developer.todoist.com/api/v1/#tag/Emails/operation/email_get_or_create_api_v1_emails_put
|
|
8
|
+
*/
|
|
9
|
+
export type GetOrCreateEmailArgs = {
|
|
10
|
+
/** The type of object to forward emails to. */
|
|
11
|
+
objType: EmailObjectType;
|
|
12
|
+
/** The ID of the object. */
|
|
13
|
+
objId: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Response from getting or creating an email forwarding address.
|
|
17
|
+
*/
|
|
18
|
+
export type GetOrCreateEmailResponse = {
|
|
19
|
+
email: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Arguments for disabling email forwarding.
|
|
23
|
+
* @see https://developer.todoist.com/api/v1/#tag/Emails/operation/email_disable_api_v1_emails_delete
|
|
24
|
+
*/
|
|
25
|
+
export type DisableEmailArgs = {
|
|
26
|
+
/** The type of object to disable forwarding for. */
|
|
27
|
+
objType: EmailObjectType;
|
|
28
|
+
/** The ID of the object. */
|
|
29
|
+
objId: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomError } from 'ts-custom-error';
|
|
2
|
+
import type { SyncError, SyncResponse } from './sync/response.js';
|
|
3
|
+
export declare class TodoistRequestError extends CustomError {
|
|
4
|
+
message: string;
|
|
5
|
+
httpStatusCode?: number | undefined;
|
|
6
|
+
responseData?: unknown | undefined;
|
|
7
|
+
constructor(message: string, httpStatusCode?: number | undefined, responseData?: unknown | undefined);
|
|
8
|
+
isAuthenticationError: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when the Sync API accepts a request but one or more of its commands fail.
|
|
12
|
+
*
|
|
13
|
+
* Sync commands are applied independently, so the commands that succeeded have
|
|
14
|
+
* already taken effect. `message`, `httpStatusCode` and `responseData` describe the
|
|
15
|
+
* first failed command, as on a plain {@link TodoistRequestError}, while
|
|
16
|
+
* `syncStatus` and `tempIdMapping` cover every command in the request, so callers
|
|
17
|
+
* can tell which ones were applied.
|
|
18
|
+
*/
|
|
19
|
+
export declare class TodoistSyncError extends TodoistRequestError {
|
|
20
|
+
/** Each command's outcome, keyed by the command's `uuid`: `'ok'` or the error it failed with. */
|
|
21
|
+
syncStatus: NonNullable<SyncResponse['syncStatus']>;
|
|
22
|
+
/** Server IDs assigned to the resources the request created, keyed by the command's `tempId`. */
|
|
23
|
+
tempIdMapping: NonNullable<SyncResponse['tempIdMapping']>;
|
|
24
|
+
constructor(firstFailure: SyncError, { syncStatus, tempIdMapping }: Pick<TodoistSyncError, 'syncStatus' | 'tempIdMapping'>);
|
|
25
|
+
}
|
|
26
|
+
export declare class TodoistArgumentError extends CustomError {
|
|
27
|
+
message: string;
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Folder } from '../sync/resources/folders.js';
|
|
2
|
+
export type GetFoldersArgs = {
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
cursor?: string | null;
|
|
5
|
+
limit?: number;
|
|
6
|
+
};
|
|
7
|
+
export type GetFoldersResponse = {
|
|
8
|
+
results: Folder[];
|
|
9
|
+
nextCursor: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type AddFolderArgs = {
|
|
12
|
+
name: string;
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
defaultOrder?: number | null;
|
|
15
|
+
childOrder?: number | null;
|
|
16
|
+
};
|
|
17
|
+
export type UpdateFolderArgs = {
|
|
18
|
+
name?: string | null;
|
|
19
|
+
defaultOrder?: number | null;
|
|
20
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export type HttpMethod = 'POST' | 'GET' | 'DELETE' | 'PUT' | 'PATCH';
|
|
2
|
+
/**
|
|
3
|
+
* HTTP response type that replaces AxiosResponse
|
|
4
|
+
*/
|
|
5
|
+
export type HttpResponse<T = unknown> = {
|
|
6
|
+
data: T;
|
|
7
|
+
status: number;
|
|
8
|
+
statusText: string;
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* HTTP request configuration
|
|
13
|
+
*/
|
|
14
|
+
export type HttpRequestConfig = {
|
|
15
|
+
method?: HttpMethod;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
timeout?: number;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Internal HTTP request options
|
|
22
|
+
*/
|
|
23
|
+
export type HttpRequestOptions = HttpRequestConfig & {
|
|
24
|
+
url: string;
|
|
25
|
+
params?: Record<string, unknown>;
|
|
26
|
+
data?: unknown;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for retry behavior
|
|
30
|
+
*/
|
|
31
|
+
export type RetryConfig = {
|
|
32
|
+
retries: number;
|
|
33
|
+
retryCondition: (error: Error) => boolean;
|
|
34
|
+
retryDelay: (retryNumber: number) => number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for the HTTP client
|
|
38
|
+
*/
|
|
39
|
+
export type HttpClientConfig = {
|
|
40
|
+
baseURL?: string;
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
timeout?: number;
|
|
43
|
+
retry?: RetryConfig;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Network error type for retry logic
|
|
47
|
+
*/
|
|
48
|
+
export type NetworkError = Error & {
|
|
49
|
+
code?: string;
|
|
50
|
+
isNetworkError: true;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* HTTP error with status code and response data
|
|
54
|
+
*/
|
|
55
|
+
export type HttpError = Error & {
|
|
56
|
+
status?: number;
|
|
57
|
+
statusText?: string;
|
|
58
|
+
response?: HttpResponse<unknown>;
|
|
59
|
+
data?: unknown;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Type guard to check if an error is a network error
|
|
63
|
+
*/
|
|
64
|
+
export declare function isNetworkError(error: Error): error is NetworkError;
|
|
65
|
+
/**
|
|
66
|
+
* Type guard to check if an error is an HTTP error
|
|
67
|
+
*/
|
|
68
|
+
export declare function isHttpError(error: Error): error is HttpError;
|
|
69
|
+
/**
|
|
70
|
+
* Custom fetch response interface that custom HTTP clients must implement.
|
|
71
|
+
*
|
|
72
|
+
* `arrayBuffer()` is optional for back-compat with existing implementations,
|
|
73
|
+
* but must be provided when the fetch is used with binary endpoints
|
|
74
|
+
* (`viewAttachment`, `downloadBackup`) — those endpoints throw at runtime if
|
|
75
|
+
* it is missing rather than fall back to a lossy `text()` round-trip.
|
|
76
|
+
*/
|
|
77
|
+
export type CustomFetchResponse = {
|
|
78
|
+
ok: boolean;
|
|
79
|
+
status: number;
|
|
80
|
+
statusText: string;
|
|
81
|
+
headers: Record<string, string>;
|
|
82
|
+
text(): Promise<string>;
|
|
83
|
+
json(): Promise<unknown>;
|
|
84
|
+
arrayBuffer?: () => Promise<ArrayBuffer>;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Extra headers sent with every API request: either a fixed record, or a function
|
|
88
|
+
* the SDK calls once per request (retries reuse its result) for values that change
|
|
89
|
+
* between requests, such as a per-request ID or the command currently running.
|
|
90
|
+
*/
|
|
91
|
+
export type CustomHeaders = Record<string, string> | (() => Record<string, string>);
|
|
92
|
+
/**
|
|
93
|
+
* Custom fetch function type for alternative HTTP clients
|
|
94
|
+
*/
|
|
95
|
+
export type CustomFetch = (url: string, options?: RequestInit & {
|
|
96
|
+
timeout?: number;
|
|
97
|
+
}) => Promise<CustomFetchResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Response from a binary file endpoint (e.g. attachment view, backup download),
|
|
100
|
+
* extending CustomFetchResponse with `arrayBuffer()` support for binary content.
|
|
101
|
+
*/
|
|
102
|
+
export type FileResponse = CustomFetchResponse & {
|
|
103
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
104
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Object types that support ID mappings. */
|
|
2
|
+
export declare const ID_MAPPING_OBJECT_TYPES: readonly ["sections", "tasks", "comments", "reminders", "location_reminders", "projects"];
|
|
3
|
+
/** Object type that supports ID mappings. */
|
|
4
|
+
export type IdMappingObjectType = (typeof ID_MAPPING_OBJECT_TYPES)[number];
|
|
5
|
+
/** Object types that support moved ID lookups. */
|
|
6
|
+
export declare const MOVED_ID_OBJECT_TYPES: readonly ["sections", "tasks", "comments", "reminders", "location_reminders"];
|
|
7
|
+
/** Object type that supports moved ID lookups. */
|
|
8
|
+
export type MovedIdObjectType = (typeof MOVED_ID_OBJECT_TYPES)[number];
|
|
9
|
+
/**
|
|
10
|
+
* Arguments for getting ID mappings between old and new IDs.
|
|
11
|
+
* @see https://developer.todoist.com/api/v1/#tag/Ids/operation/id_mappings_api_v1_id_mappings__obj_name___obj_ids__get
|
|
12
|
+
*/
|
|
13
|
+
export type GetIdMappingsArgs = {
|
|
14
|
+
/** The type of object to look up. */
|
|
15
|
+
objName: IdMappingObjectType;
|
|
16
|
+
/** Array of IDs to look up. */
|
|
17
|
+
objIds: [string, ...string[]];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Arguments for getting moved IDs.
|
|
21
|
+
* @see https://developer.todoist.com/api/v1/#tag/Ids/operation/moved_ids_api_v1_moved_ids__obj_name__get
|
|
22
|
+
*/
|
|
23
|
+
export type GetMovedIdsArgs = {
|
|
24
|
+
/** The type of object to look up. */
|
|
25
|
+
objName: MovedIdObjectType;
|
|
26
|
+
/** Array of old IDs to look up. */
|
|
27
|
+
oldIds?: string[];
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const IdMappingSchema: z.ZodObject<{
|
|
3
|
+
oldId: z.ZodNullable<z.ZodString>;
|
|
4
|
+
newId: z.ZodNullable<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
/** Mapping between old and new IDs after migration. */
|
|
7
|
+
export type IdMapping = z.infer<typeof IdMappingSchema>;
|
|
8
|
+
export declare const MovedIdSchema: z.ZodObject<{
|
|
9
|
+
oldId: z.ZodString;
|
|
10
|
+
newId: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
/** A moved ID pair (old to new). */
|
|
13
|
+
export type MovedId = z.infer<typeof MovedIdSchema>;
|