@doist/todoist-sdk 9.0.0 → 9.1.0-next.1

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 (36) hide show
  1. package/dist/cjs/consts/endpoints.js +6 -1
  2. package/dist/cjs/todoist-api.js +128 -0
  3. package/dist/cjs/types/goals/index.js +18 -0
  4. package/dist/cjs/types/goals/requests.js +2 -0
  5. package/dist/cjs/types/goals/types.js +29 -0
  6. package/dist/cjs/types/index.js +1 -0
  7. package/dist/cjs/types/sync/commands/goals.js +2 -0
  8. package/dist/cjs/types/sync/commands/index.js +1 -0
  9. package/dist/cjs/types/sync/resource-types.js +1 -0
  10. package/dist/cjs/types/sync/response.js +12 -10
  11. package/dist/cjs/utils/validators.js +48 -46
  12. package/dist/esm/consts/endpoints.js +5 -0
  13. package/dist/esm/todoist-api.js +130 -2
  14. package/dist/esm/types/goals/index.js +2 -0
  15. package/dist/esm/types/goals/requests.js +1 -0
  16. package/dist/esm/types/goals/types.js +26 -0
  17. package/dist/esm/types/index.js +1 -0
  18. package/dist/esm/types/sync/commands/goals.js +1 -0
  19. package/dist/esm/types/sync/commands/index.js +1 -0
  20. package/dist/esm/types/sync/resource-types.js +1 -0
  21. package/dist/esm/types/sync/response.js +2 -0
  22. package/dist/esm/utils/validators.js +2 -0
  23. package/dist/types/consts/endpoints.d.ts +5 -0
  24. package/dist/types/todoist-api.d.ts +11 -0
  25. package/dist/types/types/goals/index.d.ts +2 -0
  26. package/dist/types/types/goals/requests.d.ts +33 -0
  27. package/dist/types/types/goals/types.d.ts +41 -0
  28. package/dist/types/types/index.d.ts +1 -0
  29. package/dist/types/types/sync/commands/goals.d.ts +33 -0
  30. package/dist/types/types/sync/commands/index.d.ts +9 -0
  31. package/dist/types/types/sync/resource-types.d.ts +1 -1
  32. package/dist/types/types/sync/resources/view-options.d.ts +6 -6
  33. package/dist/types/types/sync/response.d.ts +29 -4
  34. package/dist/types/types/tasks/requests.d.ts +1 -0
  35. package/dist/types/utils/validators.d.ts +55 -8
  36. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ENDPOINT_REST_ID_MAPPINGS = exports.ENDPOINT_REST_EMAILS = exports.ENDPOINT_REST_BACKUPS_DOWNLOAD = exports.ENDPOINT_REST_BACKUPS = exports.ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_URL = exports.ENDPOINT_REST_TEMPLATES_FILE = exports.ENDPOINT_REST_TASKS_COMPLETED = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.SECTION_UNARCHIVE = exports.SECTION_ARCHIVE = exports.ENDPOINT_REST_PROJECT_JOIN = exports.ENDPOINT_REST_PROJECT_FULL = exports.ENDPOINT_REST_PROJECTS_PERMISSIONS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS_SEARCH = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_LOCATION_REMINDERS = exports.ENDPOINT_REST_REMINDERS = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS_SEARCH = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS_SEARCH = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
4
- exports.ENDPOINT_WORKSPACE_MEMBERS = exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REST_WORKSPACES = exports.ENDPOINT_REST_FOLDERS = exports.ENDPOINT_REGISTER = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
4
+ exports.ENDPOINT_WORKSPACE_MEMBERS = exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REST_WORKSPACES = exports.GOAL_TASKS = exports.GOAL_UNCOMPLETE = exports.GOAL_COMPLETE = exports.ENDPOINT_REST_GOALS_SEARCH = exports.ENDPOINT_REST_GOALS = exports.ENDPOINT_REST_FOLDERS = exports.ENDPOINT_REGISTER = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
5
5
  exports.getSyncBaseUri = getSyncBaseUri;
6
6
  exports.getAuthBaseUri = getAuthBaseUri;
7
7
  exports.getWorkspaceInvitationAcceptEndpoint = getWorkspaceInvitationAcceptEndpoint;
@@ -86,6 +86,11 @@ exports.ENDPOINT_GET_TOKEN = 'access_token';
86
86
  exports.ENDPOINT_REVOKE = 'revoke';
87
87
  exports.ENDPOINT_REGISTER = 'register';
88
88
  exports.ENDPOINT_REST_FOLDERS = 'folders';
89
+ exports.ENDPOINT_REST_GOALS = 'goals';
90
+ exports.ENDPOINT_REST_GOALS_SEARCH = exports.ENDPOINT_REST_GOALS + '/search';
91
+ exports.GOAL_COMPLETE = 'complete';
92
+ exports.GOAL_UNCOMPLETE = 'uncomplete';
93
+ exports.GOAL_TASKS = 'items';
89
94
  // Workspace endpoints
90
95
  exports.ENDPOINT_REST_WORKSPACES = 'workspaces';
91
96
  exports.ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
@@ -1919,6 +1919,134 @@ class TodoistApi {
1919
1919
  });
1920
1920
  return (0, http_client_1.isSuccess)(response);
1921
1921
  }
1922
+ // ── Goals ──
1923
+ async getGoals(args) {
1924
+ const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
1925
+ httpMethod: 'GET',
1926
+ baseUri: this.syncApiBase,
1927
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS,
1928
+ apiToken: this.authToken,
1929
+ customFetch: this.customFetch,
1930
+ payload: args,
1931
+ });
1932
+ return {
1933
+ results: (0, validators_1.validateGoalArray)(results),
1934
+ nextCursor,
1935
+ };
1936
+ }
1937
+ async searchGoals(args) {
1938
+ const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
1939
+ httpMethod: 'GET',
1940
+ baseUri: this.syncApiBase,
1941
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS_SEARCH,
1942
+ apiToken: this.authToken,
1943
+ customFetch: this.customFetch,
1944
+ payload: args,
1945
+ });
1946
+ return {
1947
+ results: (0, validators_1.validateGoalArray)(results),
1948
+ nextCursor,
1949
+ };
1950
+ }
1951
+ async getGoal(id) {
1952
+ zod_1.z.string().parse(id);
1953
+ const response = await (0, http_client_1.request)({
1954
+ httpMethod: 'GET',
1955
+ baseUri: this.syncApiBase,
1956
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1957
+ apiToken: this.authToken,
1958
+ customFetch: this.customFetch,
1959
+ });
1960
+ return (0, validators_1.validateGoal)(response.data);
1961
+ }
1962
+ async addGoal(args, requestId) {
1963
+ const response = await (0, http_client_1.request)({
1964
+ httpMethod: 'POST',
1965
+ baseUri: this.syncApiBase,
1966
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS,
1967
+ apiToken: this.authToken,
1968
+ customFetch: this.customFetch,
1969
+ payload: args,
1970
+ requestId: requestId,
1971
+ });
1972
+ return (0, validators_1.validateGoal)(response.data);
1973
+ }
1974
+ async updateGoal(id, args, requestId) {
1975
+ zod_1.z.string().parse(id);
1976
+ const response = await (0, http_client_1.request)({
1977
+ httpMethod: 'POST',
1978
+ baseUri: this.syncApiBase,
1979
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1980
+ apiToken: this.authToken,
1981
+ customFetch: this.customFetch,
1982
+ payload: args,
1983
+ requestId: requestId,
1984
+ });
1985
+ return (0, validators_1.validateGoal)(response.data);
1986
+ }
1987
+ async deleteGoal(id, requestId) {
1988
+ zod_1.z.string().parse(id);
1989
+ const response = await (0, http_client_1.request)({
1990
+ httpMethod: 'DELETE',
1991
+ baseUri: this.syncApiBase,
1992
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1993
+ apiToken: this.authToken,
1994
+ customFetch: this.customFetch,
1995
+ requestId: requestId,
1996
+ });
1997
+ return (0, http_client_1.isSuccess)(response);
1998
+ }
1999
+ async completeGoal(id, requestId) {
2000
+ zod_1.z.string().parse(id);
2001
+ const response = await (0, http_client_1.request)({
2002
+ httpMethod: 'POST',
2003
+ baseUri: this.syncApiBase,
2004
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id, endpoints_1.GOAL_COMPLETE),
2005
+ apiToken: this.authToken,
2006
+ customFetch: this.customFetch,
2007
+ requestId: requestId,
2008
+ });
2009
+ return (0, validators_1.validateGoal)(response.data);
2010
+ }
2011
+ async uncompleteGoal(id, requestId) {
2012
+ zod_1.z.string().parse(id);
2013
+ const response = await (0, http_client_1.request)({
2014
+ httpMethod: 'POST',
2015
+ baseUri: this.syncApiBase,
2016
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id, endpoints_1.GOAL_UNCOMPLETE),
2017
+ apiToken: this.authToken,
2018
+ customFetch: this.customFetch,
2019
+ requestId: requestId,
2020
+ });
2021
+ return (0, validators_1.validateGoal)(response.data);
2022
+ }
2023
+ async linkTaskToGoal({ goalId, taskId }, requestId) {
2024
+ zod_1.z.string().parse(goalId);
2025
+ zod_1.z.string().parse(taskId);
2026
+ const response = await (0, http_client_1.request)({
2027
+ httpMethod: 'POST',
2028
+ baseUri: this.syncApiBase,
2029
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, goalId, endpoints_1.GOAL_TASKS),
2030
+ apiToken: this.authToken,
2031
+ customFetch: this.customFetch,
2032
+ payload: { itemId: taskId },
2033
+ requestId: requestId,
2034
+ });
2035
+ return (0, validators_1.validateGoal)(response.data);
2036
+ }
2037
+ async unlinkTaskFromGoal({ goalId, taskId }, requestId) {
2038
+ zod_1.z.string().parse(goalId);
2039
+ zod_1.z.string().parse(taskId);
2040
+ const response = await (0, http_client_1.request)({
2041
+ httpMethod: 'DELETE',
2042
+ baseUri: this.syncApiBase,
2043
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, goalId, endpoints_1.GOAL_TASKS, taskId),
2044
+ apiToken: this.authToken,
2045
+ customFetch: this.customFetch,
2046
+ requestId: requestId,
2047
+ });
2048
+ return (0, http_client_1.isSuccess)(response);
2049
+ }
1922
2050
  // ── Backups ──
1923
2051
  /**
1924
2052
  * Retrieves a list of available backups.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoalSchema = exports.GoalProgressSchema = exports.GOAL_OWNER_TYPES = void 0;
4
+ const zod_1 = require("zod");
5
+ /** Available goal owner types. */
6
+ exports.GOAL_OWNER_TYPES = ['USER', 'WORKSPACE'];
7
+ exports.GoalProgressSchema = zod_1.z.looseObject({
8
+ totalTaskCount: zod_1.z.number().int(),
9
+ completedTaskCount: zod_1.z.number().int(),
10
+ percentage: zod_1.z.number(),
11
+ });
12
+ exports.GoalSchema = zod_1.z.looseObject({
13
+ id: zod_1.z.string(),
14
+ ownerType: zod_1.z.enum(exports.GOAL_OWNER_TYPES),
15
+ ownerId: zod_1.z.string(),
16
+ name: zod_1.z.string(),
17
+ description: zod_1.z.string().nullable(),
18
+ deadline: zod_1.z.string().nullable(),
19
+ parentGoalId: zod_1.z.string().nullable(),
20
+ childOrder: zod_1.z.number().int(),
21
+ isCompleted: zod_1.z.boolean(),
22
+ completedAt: zod_1.z.coerce.date().nullable(),
23
+ responsibleUid: zod_1.z.string().nullable(),
24
+ isDeleted: zod_1.z.boolean(),
25
+ progress: exports.GoalProgressSchema.optional(),
26
+ creatorUid: zod_1.z.string(),
27
+ createdAt: zod_1.z.coerce.date(),
28
+ updatedAt: zod_1.z.coerce.date(),
29
+ });
@@ -25,6 +25,7 @@ __exportStar(require("./productivity"), exports);
25
25
  __exportStar(require("./activity"), exports);
26
26
  __exportStar(require("./workspaces"), exports);
27
27
  __exportStar(require("./folders"), exports);
28
+ __exportStar(require("./goals"), exports);
28
29
  __exportStar(require("./insights"), exports);
29
30
  __exportStar(require("./backups"), exports);
30
31
  __exportStar(require("./id-mappings"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -27,6 +27,7 @@ __exportStar(require("./workspaces"), exports);
27
27
  __exportStar(require("./folders"), exports);
28
28
  __exportStar(require("./workspace-filters"), exports);
29
29
  __exportStar(require("./workspace-goals"), exports);
30
+ __exportStar(require("./goals"), exports);
30
31
  __exportStar(require("./notifications"), exports);
31
32
  __exportStar(require("./sharing"), exports);
32
33
  __exportStar(require("./view-options"), exports);
@@ -32,6 +32,7 @@ exports.SYNC_RESOURCE_TYPES = [
32
32
  'role_actions',
33
33
  'folders',
34
34
  'workspace_goals',
35
+ 'goals',
35
36
  'day_orders',
36
37
  'calendars',
37
38
  'calendar_accounts',
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SyncResponseSchema = exports.SyncErrorSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const types_1 = require("../labels/types");
6
- const types_2 = require("../projects/types");
7
- const types_3 = require("../sections/types");
8
- const types_4 = require("../tasks/types");
9
- const types_5 = require("../workspaces/types");
5
+ const types_1 = require("../goals/types");
6
+ const types_2 = require("../labels/types");
7
+ const types_3 = require("../projects/types");
8
+ const types_4 = require("../sections/types");
9
+ const types_5 = require("../tasks/types");
10
+ const types_6 = require("../workspaces/types");
10
11
  const resources_1 = require("./resources");
11
12
  exports.SyncErrorSchema = zod_1.z.object({
12
13
  error: zod_1.z.string(),
@@ -20,10 +21,10 @@ exports.SyncResponseSchema = zod_1.z.looseObject({
20
21
  fullSync: zod_1.z.boolean().optional(),
21
22
  syncStatus: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.literal('ok'), exports.SyncErrorSchema])).optional(),
22
23
  tempIdMapping: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
23
- items: zod_1.z.array(types_4.TaskSchema).optional(),
24
- projects: zod_1.z.array(types_2.ProjectSchema).optional(),
25
- sections: zod_1.z.array(types_3.SectionSchema).optional(),
26
- labels: zod_1.z.array(types_1.LabelSchema).optional(),
24
+ items: zod_1.z.array(types_5.TaskSchema).optional(),
25
+ projects: zod_1.z.array(types_3.ProjectSchema).optional(),
26
+ sections: zod_1.z.array(types_4.SectionSchema).optional(),
27
+ labels: zod_1.z.array(types_2.LabelSchema).optional(),
27
28
  notes: zod_1.z.array(resources_1.NoteSchema).optional(),
28
29
  projectNotes: zod_1.z.array(resources_1.NoteSchema).optional(),
29
30
  filters: zod_1.z.array(resources_1.FilterSchema).optional(),
@@ -40,12 +41,13 @@ exports.SyncResponseSchema = zod_1.z.looseObject({
40
41
  completedInfo: zod_1.z.array(resources_1.CompletedInfoSchema).optional(),
41
42
  stats: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
42
43
  workspaces: zod_1.z.array(resources_1.SyncWorkspaceSchema).optional(),
43
- workspaceUsers: zod_1.z.array(types_5.WorkspaceUserSchema).optional(),
44
+ workspaceUsers: zod_1.z.array(types_6.WorkspaceUserSchema).optional(),
44
45
  workspaceFilters: zod_1.z.array(resources_1.WorkspaceFilterSchema).optional(),
45
46
  viewOptions: zod_1.z.array(resources_1.ViewOptionsSchema).optional(),
46
47
  projectViewOptionsDefaults: zod_1.z.array(resources_1.ProjectViewOptionsDefaultsSchema).optional(),
47
48
  roleActions: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
48
49
  folders: zod_1.z.array(resources_1.FolderSchema).optional(),
50
+ goals: zod_1.z.array(types_1.GoalSchema).optional(),
49
51
  workspaceGoals: zod_1.z.array(resources_1.WorkspaceGoalSchema).optional(),
50
52
  dayOrders: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(),
51
53
  calendars: zod_1.z.array(resources_1.CalendarSchema).optional(),
@@ -1,23 +1,24 @@
1
1
  "use strict";
2
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
2
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.validateFolderArray = exports.validateFolder = exports.validateCollaboratorStateArray = exports.validateCollaboratorState = exports.validateCollaboratorArray = exports.validateCollaborator = exports.validateFilterArray = exports.validateFilter = exports.validateMovedIdArray = exports.validateMovedId = exports.validateIdMappingArray = exports.validateIdMapping = exports.validateBackupArray = exports.validateBackup = exports.validateWorkspaceInsights = exports.validateProjectProgress = exports.validateProjectHealthContext = exports.validateProjectHealth = exports.validateProjectActivityStats = exports.validateWorkspaceUserTaskArray = exports.validateWorkspaceUserTask = exports.validateMemberActivityInfoArray = exports.validateMemberActivityInfo = exports.validateWorkspaceArray = exports.validateWorkspace = exports.validateJoinWorkspaceResult = exports.validateWorkspacePlanDetails = exports.validateWorkspaceInvitationArray = exports.validateWorkspaceInvitation = exports.validateWorkspaceUserArray = exports.validateWorkspaceUser = exports.validateAttachment = exports.validateActivityEventArray = exports.validateActivityEvent = exports.validateCurrentUser = exports.validateProductivityStats = exports.validateUserArray = exports.validateUser = exports.validateCommentArray = exports.validateComment = exports.validateLabelArray = exports.validateLabel = exports.validateSectionArray = exports.validateSection = exports.validateWorkspaceProjectArray = exports.validateWorkspaceProject = exports.validateProjectArray = exports.validateProject = exports.validateTaskArray = exports.validateTask = void 0;
5
- exports.validateSuggestionArray = exports.validateSuggestion = exports.validateUserSettings = exports.validateSyncUser = exports.validateSyncWorkspaceArray = exports.validateSyncWorkspace = exports.validateLiveNotificationArray = exports.validateLiveNotification = exports.validateUserPlanLimits = exports.validateProjectViewOptionsDefaultsArray = exports.validateProjectViewOptionsDefaults = exports.validateViewOptionsArray = exports.validateViewOptions = exports.validateCompletedInfoArray = exports.validateCompletedInfo = exports.validateLocationReminderArray = exports.validateLocationReminder = exports.validateReminderArray = exports.validateReminder = exports.validateCalendarAccountArray = exports.validateCalendarAccount = exports.validateCalendarArray = exports.validateCalendar = exports.validateWorkspaceGoalArray = exports.validateWorkspaceGoal = exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = exports.validateTooltips = exports.validateNoteArray = exports.validateNote = void 0;
5
+ exports.validateSuggestionArray = exports.validateSuggestion = exports.validateUserSettings = exports.validateSyncUser = exports.validateSyncWorkspaceArray = exports.validateSyncWorkspace = exports.validateLiveNotificationArray = exports.validateLiveNotification = exports.validateUserPlanLimits = exports.validateProjectViewOptionsDefaultsArray = exports.validateProjectViewOptionsDefaults = exports.validateViewOptionsArray = exports.validateViewOptions = exports.validateCompletedInfoArray = exports.validateCompletedInfo = exports.validateLocationReminderArray = exports.validateLocationReminder = exports.validateReminderArray = exports.validateReminder = exports.validateCalendarAccountArray = exports.validateCalendarAccount = exports.validateCalendarArray = exports.validateCalendar = exports.validateWorkspaceGoalArray = exports.validateWorkspaceGoal = exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = exports.validateTooltips = exports.validateNoteArray = exports.validateNote = exports.validateGoalArray = exports.validateGoal = void 0;
6
6
  exports.parseSyncResponse = parseSyncResponse;
7
7
  const zod_1 = require("zod");
8
8
  const types_1 = require("../types/activity/types");
9
9
  const types_2 = require("../types/backups/types");
10
10
  const types_3 = require("../types/comments/types");
11
- const types_4 = require("../types/id-mappings/types");
12
- const types_5 = require("../types/insights/types");
13
- const types_6 = require("../types/labels/types");
14
- const types_7 = require("../types/productivity/types");
15
- const types_8 = require("../types/projects/types");
16
- const types_9 = require("../types/sections/types");
11
+ const types_4 = require("../types/goals/types");
12
+ const types_5 = require("../types/id-mappings/types");
13
+ const types_6 = require("../types/insights/types");
14
+ const types_7 = require("../types/labels/types");
15
+ const types_8 = require("../types/productivity/types");
16
+ const types_9 = require("../types/projects/types");
17
+ const types_10 = require("../types/sections/types");
17
18
  const response_1 = require("../types/sync/response");
18
- const types_10 = require("../types/tasks/types");
19
- const types_11 = require("../types/users/types");
20
- const types_12 = require("../types/workspaces/types");
19
+ const types_11 = require("../types/tasks/types");
20
+ const types_12 = require("../types/users/types");
21
+ const types_13 = require("../types/workspaces/types");
21
22
  const resources_1 = require("../types/sync/resources");
22
23
  function createValidator(schema) {
23
24
  return {
@@ -26,59 +27,60 @@ function createValidator(schema) {
26
27
  };
27
28
  }
28
29
  // Entity validators
29
- _a = createValidator(types_10.TaskSchema), exports.validateTask = _a.validate, exports.validateTaskArray = _a.validateArray;
30
+ _a = createValidator(types_11.TaskSchema), exports.validateTask = _a.validate, exports.validateTaskArray = _a.validateArray;
30
31
  /**
31
32
  * Validates and parses a project input.
32
33
  * @param input The input to validate
33
34
  * @returns A validated project (either PersonalProject or WorkspaceProject)
34
35
  */
35
- _b = createValidator(types_8.ProjectSchema), exports.validateProject = _b.validate, exports.validateProjectArray = _b.validateArray;
36
- _c = createValidator(types_8.WorkspaceProjectSchema), exports.validateWorkspaceProject = _c.validate, exports.validateWorkspaceProjectArray = _c.validateArray;
37
- _d = createValidator(types_9.SectionSchema), exports.validateSection = _d.validate, exports.validateSectionArray = _d.validateArray;
38
- _e = createValidator(types_6.LabelSchema), exports.validateLabel = _e.validate, exports.validateLabelArray = _e.validateArray;
36
+ _b = createValidator(types_9.ProjectSchema), exports.validateProject = _b.validate, exports.validateProjectArray = _b.validateArray;
37
+ _c = createValidator(types_9.WorkspaceProjectSchema), exports.validateWorkspaceProject = _c.validate, exports.validateWorkspaceProjectArray = _c.validateArray;
38
+ _d = createValidator(types_10.SectionSchema), exports.validateSection = _d.validate, exports.validateSectionArray = _d.validateArray;
39
+ _e = createValidator(types_7.LabelSchema), exports.validateLabel = _e.validate, exports.validateLabelArray = _e.validateArray;
39
40
  _f = createValidator(types_3.CommentSchema), exports.validateComment = _f.validate, exports.validateCommentArray = _f.validateArray;
40
- _g = createValidator(types_11.UserSchema), exports.validateUser = _g.validate, exports.validateUserArray = _g.validateArray;
41
- exports.validateProductivityStats = createValidator(types_7.ProductivityStatsSchema).validate;
42
- exports.validateCurrentUser = createValidator(types_11.CurrentUserSchema).validate;
41
+ _g = createValidator(types_12.UserSchema), exports.validateUser = _g.validate, exports.validateUserArray = _g.validateArray;
42
+ exports.validateProductivityStats = createValidator(types_8.ProductivityStatsSchema).validate;
43
+ exports.validateCurrentUser = createValidator(types_12.CurrentUserSchema).validate;
43
44
  _h = createValidator(types_1.ActivityEventSchema), exports.validateActivityEvent = _h.validate, exports.validateActivityEventArray = _h.validateArray;
44
45
  exports.validateAttachment = createValidator(types_3.AttachmentSchema).validate;
45
- _j = createValidator(types_12.WorkspaceUserSchema), exports.validateWorkspaceUser = _j.validate, exports.validateWorkspaceUserArray = _j.validateArray;
46
- _k = createValidator(types_12.WorkspaceInvitationSchema), exports.validateWorkspaceInvitation = _k.validate, exports.validateWorkspaceInvitationArray = _k.validateArray;
47
- exports.validateWorkspacePlanDetails = createValidator(types_12.WorkspacePlanDetailsSchema).validate;
48
- exports.validateJoinWorkspaceResult = createValidator(types_12.JoinWorkspaceResultSchema).validate;
49
- _l = createValidator(types_12.WorkspaceSchema), exports.validateWorkspace = _l.validate, exports.validateWorkspaceArray = _l.validateArray;
50
- _m = createValidator(types_12.MemberActivityInfoSchema), exports.validateMemberActivityInfo = _m.validate, exports.validateMemberActivityInfoArray = _m.validateArray;
51
- _o = createValidator(types_12.WorkspaceUserTaskSchema), exports.validateWorkspaceUserTask = _o.validate, exports.validateWorkspaceUserTaskArray = _o.validateArray;
52
- exports.validateProjectActivityStats = createValidator(types_5.ProjectActivityStatsSchema).validate;
53
- exports.validateProjectHealth = createValidator(types_5.ProjectHealthSchema).validate;
54
- exports.validateProjectHealthContext = createValidator(types_5.ProjectHealthContextSchema).validate;
55
- exports.validateProjectProgress = createValidator(types_5.ProjectProgressSchema).validate;
56
- exports.validateWorkspaceInsights = createValidator(types_5.WorkspaceInsightsSchema).validate;
46
+ _j = createValidator(types_13.WorkspaceUserSchema), exports.validateWorkspaceUser = _j.validate, exports.validateWorkspaceUserArray = _j.validateArray;
47
+ _k = createValidator(types_13.WorkspaceInvitationSchema), exports.validateWorkspaceInvitation = _k.validate, exports.validateWorkspaceInvitationArray = _k.validateArray;
48
+ exports.validateWorkspacePlanDetails = createValidator(types_13.WorkspacePlanDetailsSchema).validate;
49
+ exports.validateJoinWorkspaceResult = createValidator(types_13.JoinWorkspaceResultSchema).validate;
50
+ _l = createValidator(types_13.WorkspaceSchema), exports.validateWorkspace = _l.validate, exports.validateWorkspaceArray = _l.validateArray;
51
+ _m = createValidator(types_13.MemberActivityInfoSchema), exports.validateMemberActivityInfo = _m.validate, exports.validateMemberActivityInfoArray = _m.validateArray;
52
+ _o = createValidator(types_13.WorkspaceUserTaskSchema), exports.validateWorkspaceUserTask = _o.validate, exports.validateWorkspaceUserTaskArray = _o.validateArray;
53
+ exports.validateProjectActivityStats = createValidator(types_6.ProjectActivityStatsSchema).validate;
54
+ exports.validateProjectHealth = createValidator(types_6.ProjectHealthSchema).validate;
55
+ exports.validateProjectHealthContext = createValidator(types_6.ProjectHealthContextSchema).validate;
56
+ exports.validateProjectProgress = createValidator(types_6.ProjectProgressSchema).validate;
57
+ exports.validateWorkspaceInsights = createValidator(types_6.WorkspaceInsightsSchema).validate;
57
58
  _p = createValidator(types_2.BackupSchema), exports.validateBackup = _p.validate, exports.validateBackupArray = _p.validateArray;
58
- _q = createValidator(types_4.IdMappingSchema), exports.validateIdMapping = _q.validate, exports.validateIdMappingArray = _q.validateArray;
59
- _r = createValidator(types_4.MovedIdSchema), exports.validateMovedId = _r.validate, exports.validateMovedIdArray = _r.validateArray;
59
+ _q = createValidator(types_5.IdMappingSchema), exports.validateIdMapping = _q.validate, exports.validateIdMappingArray = _q.validateArray;
60
+ _r = createValidator(types_5.MovedIdSchema), exports.validateMovedId = _r.validate, exports.validateMovedIdArray = _r.validateArray;
60
61
  // Sync resource validators
61
62
  _s = createValidator(resources_1.FilterSchema), exports.validateFilter = _s.validate, exports.validateFilterArray = _s.validateArray;
62
63
  _t = createValidator(resources_1.CollaboratorSchema), exports.validateCollaborator = _t.validate, exports.validateCollaboratorArray = _t.validateArray;
63
64
  _u = createValidator(resources_1.CollaboratorStateSchema), exports.validateCollaboratorState = _u.validate, exports.validateCollaboratorStateArray = _u.validateArray;
64
65
  _v = createValidator(resources_1.FolderSchema), exports.validateFolder = _v.validate, exports.validateFolderArray = _v.validateArray;
65
- _w = createValidator(resources_1.NoteSchema), exports.validateNote = _w.validate, exports.validateNoteArray = _w.validateArray;
66
+ _w = createValidator(types_4.GoalSchema), exports.validateGoal = _w.validate, exports.validateGoalArray = _w.validateArray;
67
+ _x = createValidator(resources_1.NoteSchema), exports.validateNote = _x.validate, exports.validateNoteArray = _x.validateArray;
66
68
  exports.validateTooltips = createValidator(resources_1.TooltipsSchema).validate;
67
- _x = createValidator(resources_1.WorkspaceFilterSchema), exports.validateWorkspaceFilter = _x.validate, exports.validateWorkspaceFilterArray = _x.validateArray;
68
- _y = createValidator(resources_1.WorkspaceGoalSchema), exports.validateWorkspaceGoal = _y.validate, exports.validateWorkspaceGoalArray = _y.validateArray;
69
- _z = createValidator(resources_1.CalendarSchema), exports.validateCalendar = _z.validate, exports.validateCalendarArray = _z.validateArray;
70
- _0 = createValidator(resources_1.CalendarAccountSchema), exports.validateCalendarAccount = _0.validate, exports.validateCalendarAccountArray = _0.validateArray;
71
- _1 = createValidator(resources_1.ReminderSchema), exports.validateReminder = _1.validate, exports.validateReminderArray = _1.validateArray;
72
- _2 = createValidator(resources_1.LocationReminderSchema), exports.validateLocationReminder = _2.validate, exports.validateLocationReminderArray = _2.validateArray;
73
- _3 = createValidator(resources_1.CompletedInfoSchema), exports.validateCompletedInfo = _3.validate, exports.validateCompletedInfoArray = _3.validateArray;
74
- _4 = createValidator(resources_1.ViewOptionsSchema), exports.validateViewOptions = _4.validate, exports.validateViewOptionsArray = _4.validateArray;
75
- _5 = createValidator(resources_1.ProjectViewOptionsDefaultsSchema), exports.validateProjectViewOptionsDefaults = _5.validate, exports.validateProjectViewOptionsDefaultsArray = _5.validateArray;
69
+ _y = createValidator(resources_1.WorkspaceFilterSchema), exports.validateWorkspaceFilter = _y.validate, exports.validateWorkspaceFilterArray = _y.validateArray;
70
+ _z = createValidator(resources_1.WorkspaceGoalSchema), exports.validateWorkspaceGoal = _z.validate, exports.validateWorkspaceGoalArray = _z.validateArray;
71
+ _0 = createValidator(resources_1.CalendarSchema), exports.validateCalendar = _0.validate, exports.validateCalendarArray = _0.validateArray;
72
+ _1 = createValidator(resources_1.CalendarAccountSchema), exports.validateCalendarAccount = _1.validate, exports.validateCalendarAccountArray = _1.validateArray;
73
+ _2 = createValidator(resources_1.ReminderSchema), exports.validateReminder = _2.validate, exports.validateReminderArray = _2.validateArray;
74
+ _3 = createValidator(resources_1.LocationReminderSchema), exports.validateLocationReminder = _3.validate, exports.validateLocationReminderArray = _3.validateArray;
75
+ _4 = createValidator(resources_1.CompletedInfoSchema), exports.validateCompletedInfo = _4.validate, exports.validateCompletedInfoArray = _4.validateArray;
76
+ _5 = createValidator(resources_1.ViewOptionsSchema), exports.validateViewOptions = _5.validate, exports.validateViewOptionsArray = _5.validateArray;
77
+ _6 = createValidator(resources_1.ProjectViewOptionsDefaultsSchema), exports.validateProjectViewOptionsDefaults = _6.validate, exports.validateProjectViewOptionsDefaultsArray = _6.validateArray;
76
78
  exports.validateUserPlanLimits = createValidator(resources_1.UserPlanLimitsSchema).validate;
77
- _6 = createValidator(resources_1.LiveNotificationSchema), exports.validateLiveNotification = _6.validate, exports.validateLiveNotificationArray = _6.validateArray;
78
- _7 = createValidator(resources_1.SyncWorkspaceSchema), exports.validateSyncWorkspace = _7.validate, exports.validateSyncWorkspaceArray = _7.validateArray;
79
+ _7 = createValidator(resources_1.LiveNotificationSchema), exports.validateLiveNotification = _7.validate, exports.validateLiveNotificationArray = _7.validateArray;
80
+ _8 = createValidator(resources_1.SyncWorkspaceSchema), exports.validateSyncWorkspace = _8.validate, exports.validateSyncWorkspaceArray = _8.validateArray;
79
81
  exports.validateSyncUser = createValidator(resources_1.SyncUserSchema).validate;
80
82
  exports.validateUserSettings = createValidator(resources_1.UserSettingsSchema).validate;
81
- _8 = createValidator(resources_1.SuggestionSchema), exports.validateSuggestion = _8.validate, exports.validateSuggestionArray = _8.validateArray;
83
+ _9 = createValidator(resources_1.SuggestionSchema), exports.validateSuggestion = _9.validate, exports.validateSuggestionArray = _9.validateArray;
82
84
  function parseSyncResponse(raw) {
83
85
  return response_1.SyncResponseSchema.parse(raw);
84
86
  }
@@ -67,6 +67,11 @@ export const ENDPOINT_GET_TOKEN = 'access_token';
67
67
  export const ENDPOINT_REVOKE = 'revoke';
68
68
  export const ENDPOINT_REGISTER = 'register';
69
69
  export const ENDPOINT_REST_FOLDERS = 'folders';
70
+ export const ENDPOINT_REST_GOALS = 'goals';
71
+ export const ENDPOINT_REST_GOALS_SEARCH = ENDPOINT_REST_GOALS + '/search';
72
+ export const GOAL_COMPLETE = 'complete';
73
+ export const GOAL_UNCOMPLETE = 'uncomplete';
74
+ export const GOAL_TASKS = 'items';
70
75
  // Workspace endpoints
71
76
  export const ENDPOINT_REST_WORKSPACES = 'workspaces';
72
77
  export const ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { z } from 'zod';
13
- import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, ENDPOINT_REST_FOLDERS, } from './consts/endpoints.js';
13
+ import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, ENDPOINT_REST_FOLDERS, ENDPOINT_REST_GOALS, ENDPOINT_REST_GOALS_SEARCH, GOAL_COMPLETE, GOAL_UNCOMPLETE, GOAL_TASKS, } from './consts/endpoints.js';
14
14
  import { request, isSuccess } from './transport/http-client.js';
15
15
  import { UpdateReminderArgsSchema, UpdateLocationReminderArgsSchema, ReminderIdSchema, } from './types/reminders/index.js';
16
16
  import { normalizeObjectEventTypeForApi, denormalizeObjectTypeFromApi, } from './utils/activity-helpers.js';
@@ -18,7 +18,7 @@ import { camelCaseKeys } from './utils/case-conversion.js';
18
18
  import { uploadMultipartFile } from './utils/multipart-upload.js';
19
19
  import { processTaskContent } from './utils/uncompletable-helpers.js';
20
20
  import { formatDateToYYYYMMDD } from './utils/url-helpers.js';
21
- import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, validateFolder, validateFolderArray, validateCollaboratorArray, validateCollaboratorStateArray, validateNoteArray, validateWorkspaceProject, validateWorkspaceProjectArray, parseSyncResponse, } from './utils/validators.js';
21
+ import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, validateFolder, validateFolderArray, validateGoal, validateGoalArray, validateCollaboratorArray, validateCollaboratorStateArray, validateNoteArray, validateWorkspaceProject, validateWorkspaceProjectArray, parseSyncResponse, } from './utils/validators.js';
22
22
  import { v4 as uuidv4 } from 'uuid';
23
23
  import { TodoistArgumentError, TodoistRequestError } from './types/index.js';
24
24
  import { DATE_FORMAT_TO_API, TIME_FORMAT_TO_API, DAY_OF_WEEK_TO_API, } from './types/sync/index.js';
@@ -1916,6 +1916,134 @@ export class TodoistApi {
1916
1916
  });
1917
1917
  return isSuccess(response);
1918
1918
  }
1919
+ // ── Goals ──
1920
+ async getGoals(args) {
1921
+ const { data: { results, nextCursor }, } = await request({
1922
+ httpMethod: 'GET',
1923
+ baseUri: this.syncApiBase,
1924
+ relativePath: ENDPOINT_REST_GOALS,
1925
+ apiToken: this.authToken,
1926
+ customFetch: this.customFetch,
1927
+ payload: args,
1928
+ });
1929
+ return {
1930
+ results: validateGoalArray(results),
1931
+ nextCursor,
1932
+ };
1933
+ }
1934
+ async searchGoals(args) {
1935
+ const { data: { results, nextCursor }, } = await request({
1936
+ httpMethod: 'GET',
1937
+ baseUri: this.syncApiBase,
1938
+ relativePath: ENDPOINT_REST_GOALS_SEARCH,
1939
+ apiToken: this.authToken,
1940
+ customFetch: this.customFetch,
1941
+ payload: args,
1942
+ });
1943
+ return {
1944
+ results: validateGoalArray(results),
1945
+ nextCursor,
1946
+ };
1947
+ }
1948
+ async getGoal(id) {
1949
+ z.string().parse(id);
1950
+ const response = await request({
1951
+ httpMethod: 'GET',
1952
+ baseUri: this.syncApiBase,
1953
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id),
1954
+ apiToken: this.authToken,
1955
+ customFetch: this.customFetch,
1956
+ });
1957
+ return validateGoal(response.data);
1958
+ }
1959
+ async addGoal(args, requestId) {
1960
+ const response = await request({
1961
+ httpMethod: 'POST',
1962
+ baseUri: this.syncApiBase,
1963
+ relativePath: ENDPOINT_REST_GOALS,
1964
+ apiToken: this.authToken,
1965
+ customFetch: this.customFetch,
1966
+ payload: args,
1967
+ requestId: requestId,
1968
+ });
1969
+ return validateGoal(response.data);
1970
+ }
1971
+ async updateGoal(id, args, requestId) {
1972
+ z.string().parse(id);
1973
+ const response = await request({
1974
+ httpMethod: 'POST',
1975
+ baseUri: this.syncApiBase,
1976
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id),
1977
+ apiToken: this.authToken,
1978
+ customFetch: this.customFetch,
1979
+ payload: args,
1980
+ requestId: requestId,
1981
+ });
1982
+ return validateGoal(response.data);
1983
+ }
1984
+ async deleteGoal(id, requestId) {
1985
+ z.string().parse(id);
1986
+ const response = await request({
1987
+ httpMethod: 'DELETE',
1988
+ baseUri: this.syncApiBase,
1989
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id),
1990
+ apiToken: this.authToken,
1991
+ customFetch: this.customFetch,
1992
+ requestId: requestId,
1993
+ });
1994
+ return isSuccess(response);
1995
+ }
1996
+ async completeGoal(id, requestId) {
1997
+ z.string().parse(id);
1998
+ const response = await request({
1999
+ httpMethod: 'POST',
2000
+ baseUri: this.syncApiBase,
2001
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id, GOAL_COMPLETE),
2002
+ apiToken: this.authToken,
2003
+ customFetch: this.customFetch,
2004
+ requestId: requestId,
2005
+ });
2006
+ return validateGoal(response.data);
2007
+ }
2008
+ async uncompleteGoal(id, requestId) {
2009
+ z.string().parse(id);
2010
+ const response = await request({
2011
+ httpMethod: 'POST',
2012
+ baseUri: this.syncApiBase,
2013
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id, GOAL_UNCOMPLETE),
2014
+ apiToken: this.authToken,
2015
+ customFetch: this.customFetch,
2016
+ requestId: requestId,
2017
+ });
2018
+ return validateGoal(response.data);
2019
+ }
2020
+ async linkTaskToGoal({ goalId, taskId }, requestId) {
2021
+ z.string().parse(goalId);
2022
+ z.string().parse(taskId);
2023
+ const response = await request({
2024
+ httpMethod: 'POST',
2025
+ baseUri: this.syncApiBase,
2026
+ relativePath: generatePath(ENDPOINT_REST_GOALS, goalId, GOAL_TASKS),
2027
+ apiToken: this.authToken,
2028
+ customFetch: this.customFetch,
2029
+ payload: { itemId: taskId },
2030
+ requestId: requestId,
2031
+ });
2032
+ return validateGoal(response.data);
2033
+ }
2034
+ async unlinkTaskFromGoal({ goalId, taskId }, requestId) {
2035
+ z.string().parse(goalId);
2036
+ z.string().parse(taskId);
2037
+ const response = await request({
2038
+ httpMethod: 'DELETE',
2039
+ baseUri: this.syncApiBase,
2040
+ relativePath: generatePath(ENDPOINT_REST_GOALS, goalId, GOAL_TASKS, taskId),
2041
+ apiToken: this.authToken,
2042
+ customFetch: this.customFetch,
2043
+ requestId: requestId,
2044
+ });
2045
+ return isSuccess(response);
2046
+ }
1919
2047
  // ── Backups ──
1920
2048
  /**
1921
2049
  * Retrieves a list of available backups.
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ /** Available goal owner types. */
3
+ export const GOAL_OWNER_TYPES = ['USER', 'WORKSPACE'];
4
+ export const GoalProgressSchema = z.looseObject({
5
+ totalTaskCount: z.number().int(),
6
+ completedTaskCount: z.number().int(),
7
+ percentage: z.number(),
8
+ });
9
+ export const GoalSchema = z.looseObject({
10
+ id: z.string(),
11
+ ownerType: z.enum(GOAL_OWNER_TYPES),
12
+ ownerId: z.string(),
13
+ name: z.string(),
14
+ description: z.string().nullable(),
15
+ deadline: z.string().nullable(),
16
+ parentGoalId: z.string().nullable(),
17
+ childOrder: z.number().int(),
18
+ isCompleted: z.boolean(),
19
+ completedAt: z.coerce.date().nullable(),
20
+ responsibleUid: z.string().nullable(),
21
+ isDeleted: z.boolean(),
22
+ progress: GoalProgressSchema.optional(),
23
+ creatorUid: z.string(),
24
+ createdAt: z.coerce.date(),
25
+ updatedAt: z.coerce.date(),
26
+ });
@@ -9,6 +9,7 @@ export * from './productivity/index.js';
9
9
  export * from './activity/index.js';
10
10
  export * from './workspaces/index.js';
11
11
  export * from './folders/index.js';
12
+ export * from './goals/index.js';
12
13
  export * from './insights/index.js';
13
14
  export * from './backups/index.js';
14
15
  export * from './id-mappings/index.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -11,6 +11,7 @@ export * from './workspaces.js';
11
11
  export * from './folders.js';
12
12
  export * from './workspace-filters.js';
13
13
  export * from './workspace-goals.js';
14
+ export * from './goals.js';
14
15
  export * from './notifications.js';
15
16
  export * from './sharing.js';
16
17
  export * from './view-options.js';
@@ -29,6 +29,7 @@ export const SYNC_RESOURCE_TYPES = [
29
29
  'role_actions',
30
30
  'folders',
31
31
  'workspace_goals',
32
+ 'goals',
32
33
  'day_orders',
33
34
  'calendars',
34
35
  'calendar_accounts',
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { GoalSchema } from '../goals/types.js';
2
3
  import { LabelSchema } from '../labels/types.js';
3
4
  import { ProjectSchema } from '../projects/types.js';
4
5
  import { SectionSchema } from '../sections/types.js';
@@ -43,6 +44,7 @@ export const SyncResponseSchema = z.looseObject({
43
44
  projectViewOptionsDefaults: z.array(ProjectViewOptionsDefaultsSchema).optional(),
44
45
  roleActions: z.array(z.record(z.string(), z.unknown())).optional(),
45
46
  folders: z.array(FolderSchema).optional(),
47
+ goals: z.array(GoalSchema).optional(),
46
48
  workspaceGoals: z.array(WorkspaceGoalSchema).optional(),
47
49
  dayOrders: z.record(z.string(), z.number()).optional(),
48
50
  calendars: z.array(CalendarSchema).optional(),
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { ActivityEventSchema } from '../types/activity/types.js';
3
3
  import { BackupSchema } from '../types/backups/types.js';
4
4
  import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
5
+ import { GoalSchema } from '../types/goals/types.js';
5
6
  import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
6
7
  import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
7
8
  import { LabelSchema } from '../types/labels/types.js';
@@ -56,6 +57,7 @@ export const { validate: validateFilter, validateArray: validateFilterArray } =
56
57
  export const { validate: validateCollaborator, validateArray: validateCollaboratorArray } = createValidator(CollaboratorSchema);
57
58
  export const { validate: validateCollaboratorState, validateArray: validateCollaboratorStateArray, } = createValidator(CollaboratorStateSchema);
58
59
  export const { validate: validateFolder, validateArray: validateFolderArray } = createValidator(FolderSchema);
60
+ export const { validate: validateGoal, validateArray: validateGoalArray } = createValidator(GoalSchema);
59
61
  export const { validate: validateNote, validateArray: validateNoteArray } = createValidator(NoteSchema);
60
62
  export const { validate: validateTooltips } = createValidator(TooltipsSchema);
61
63
  export const { validate: validateWorkspaceFilter, validateArray: validateWorkspaceFilterArray } = createValidator(WorkspaceFilterSchema);
@@ -58,6 +58,11 @@ export declare const ENDPOINT_GET_TOKEN = "access_token";
58
58
  export declare const ENDPOINT_REVOKE = "revoke";
59
59
  export declare const ENDPOINT_REGISTER = "register";
60
60
  export declare const ENDPOINT_REST_FOLDERS = "folders";
61
+ export declare const ENDPOINT_REST_GOALS = "goals";
62
+ export declare const ENDPOINT_REST_GOALS_SEARCH: string;
63
+ export declare const GOAL_COMPLETE = "complete";
64
+ export declare const GOAL_UNCOMPLETE = "uncomplete";
65
+ export declare const GOAL_TASKS = "items";
61
66
  export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
62
67
  export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
63
68
  export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
@@ -4,6 +4,7 @@ import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/inde
4
4
  import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js';
5
5
  import { GetOrCreateEmailArgs, GetOrCreateEmailResponse, DisableEmailArgs } from './types/emails/index.js';
6
6
  import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
7
+ import type { Goal, GetGoalsArgs, GetGoalsResponse, SearchGoalsArgs, AddGoalArgs, UpdateGoalArgs, TaskLinkingArgs } from './types/goals/index.js';
7
8
  import { CustomFetch, CustomFetchResponse } from './types/http.js';
8
9
  import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
9
10
  import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
@@ -763,6 +764,16 @@ export declare class TodoistApi {
763
764
  * @returns A promise that resolves to `true` if successful.
764
765
  */
765
766
  deleteFolder(id: string, requestId?: string): Promise<boolean>;
767
+ getGoals(args?: GetGoalsArgs): Promise<GetGoalsResponse>;
768
+ searchGoals(args: SearchGoalsArgs): Promise<GetGoalsResponse>;
769
+ getGoal(id: string): Promise<Goal>;
770
+ addGoal(args: AddGoalArgs, requestId?: string): Promise<Goal>;
771
+ updateGoal(id: string, args: UpdateGoalArgs, requestId?: string): Promise<Goal>;
772
+ deleteGoal(id: string, requestId?: string): Promise<boolean>;
773
+ completeGoal(id: string, requestId?: string): Promise<Goal>;
774
+ uncompleteGoal(id: string, requestId?: string): Promise<Goal>;
775
+ linkTaskToGoal({ goalId, taskId }: TaskLinkingArgs, requestId?: string): Promise<Goal>;
776
+ unlinkTaskFromGoal({ goalId, taskId }: TaskLinkingArgs, requestId?: string): Promise<boolean>;
766
777
  /**
767
778
  * Retrieves a list of available backups.
768
779
  *
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1,33 @@
1
+ import type { SearchArgs } from '../common.js';
2
+ import type { Workspace } from '../workspaces/index.js';
3
+ import type { Goal, GoalOwnerType } from './types.js';
4
+ export type GetGoalsArgs = {
5
+ ownerType?: GoalOwnerType;
6
+ workspaceId?: Workspace['id'];
7
+ cursor?: string | null;
8
+ limit?: number;
9
+ };
10
+ export type SearchGoalsArgs = SearchArgs & {
11
+ ownerType?: GoalOwnerType;
12
+ };
13
+ export type GetGoalsResponse = {
14
+ results: Goal[];
15
+ nextCursor: string | null;
16
+ };
17
+ export type AddGoalArgs = {
18
+ name: string;
19
+ workspaceId?: string;
20
+ description?: string | null;
21
+ deadline?: string | null;
22
+ responsibleUid?: string | null;
23
+ };
24
+ export type UpdateGoalArgs = {
25
+ name?: string;
26
+ description?: string | null;
27
+ deadline?: string | null;
28
+ responsibleUid?: string | null;
29
+ };
30
+ export type TaskLinkingArgs = {
31
+ goalId: string;
32
+ taskId: string;
33
+ };
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ /** Available goal owner types. */
3
+ export declare const GOAL_OWNER_TYPES: readonly ["USER", "WORKSPACE"];
4
+ /** Goal owner type. */
5
+ export type GoalOwnerType = (typeof GOAL_OWNER_TYPES)[number];
6
+ export declare const GoalProgressSchema: z.ZodObject<{
7
+ totalTaskCount: z.ZodNumber;
8
+ completedTaskCount: z.ZodNumber;
9
+ percentage: z.ZodNumber;
10
+ }, z.core.$loose>;
11
+ export type GoalProgress = z.infer<typeof GoalProgressSchema>;
12
+ export declare const GoalSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ ownerType: z.ZodEnum<{
15
+ USER: "USER";
16
+ WORKSPACE: "WORKSPACE";
17
+ }>;
18
+ ownerId: z.ZodString;
19
+ name: z.ZodString;
20
+ description: z.ZodNullable<z.ZodString>;
21
+ deadline: z.ZodNullable<z.ZodString>;
22
+ parentGoalId: z.ZodNullable<z.ZodString>;
23
+ childOrder: z.ZodNumber;
24
+ isCompleted: z.ZodBoolean;
25
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
26
+ responsibleUid: z.ZodNullable<z.ZodString>;
27
+ isDeleted: z.ZodBoolean;
28
+ progress: z.ZodOptional<z.ZodObject<{
29
+ totalTaskCount: z.ZodNumber;
30
+ completedTaskCount: z.ZodNumber;
31
+ percentage: z.ZodNumber;
32
+ }, z.core.$loose>>;
33
+ creatorUid: z.ZodString;
34
+ createdAt: z.ZodCoercedDate<unknown>;
35
+ updatedAt: z.ZodCoercedDate<unknown>;
36
+ }, z.core.$loose>;
37
+ /**
38
+ * Represents a goal in Todoist.
39
+ * Goals support dual ownership: personal (ownerType=USER) and workspace (ownerType=WORKSPACE).
40
+ */
41
+ export type Goal = z.infer<typeof GoalSchema>;
@@ -9,6 +9,7 @@ export * from './productivity/index.js';
9
9
  export * from './activity/index.js';
10
10
  export * from './workspaces/index.js';
11
11
  export * from './folders/index.js';
12
+ export * from './goals/index.js';
12
13
  export * from './insights/index.js';
13
14
  export * from './backups/index.js';
14
15
  export * from './id-mappings/index.js';
@@ -0,0 +1,33 @@
1
+ import type { GoalOwnerType } from '../../goals/types.js';
2
+ export type GoalAddArgs = {
3
+ ownerType: GoalOwnerType;
4
+ ownerId: string;
5
+ name: string;
6
+ description?: string | null;
7
+ deadline?: string | null;
8
+ responsibleUid?: string | null;
9
+ };
10
+ export type GoalUpdateArgs = {
11
+ id: string;
12
+ name?: string;
13
+ description?: string | null;
14
+ deadline?: string | null;
15
+ responsibleUid?: string | null;
16
+ };
17
+ export type GoalCompleteArgs = {
18
+ id: string;
19
+ };
20
+ export type GoalUncompleteArgs = {
21
+ id: string;
22
+ };
23
+ export type GoalDeleteArgs = {
24
+ id: string;
25
+ };
26
+ export type GoalLinkItemArgs = {
27
+ goalId: string;
28
+ itemId: string;
29
+ };
30
+ export type GoalUnlinkItemArgs = {
31
+ goalId: string;
32
+ itemId: string;
33
+ };
@@ -1,6 +1,7 @@
1
1
  import type { CalendarUpdateArgs, CalendarAccountUpdateArgs, CalendarAccountRestoreTaskCalendarArgs } from './calendars.js';
2
2
  import type { FilterAddArgs, FilterUpdateArgs, FilterUpdateOrdersArgs, FilterDeleteArgs } from './filters.js';
3
3
  import type { FolderAddArgs, FolderUpdateArgs, FolderDeleteArgs } from './folders.js';
4
+ import type { GoalAddArgs, GoalUpdateArgs, GoalCompleteArgs, GoalUncompleteArgs, GoalDeleteArgs, GoalLinkItemArgs, GoalUnlinkItemArgs } from './goals.js';
4
5
  import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
5
6
  import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
6
7
  import type { LiveNotificationsMarkUnreadArgs, LiveNotificationsMarkReadArgs, LiveNotificationsMarkReadAllArgs, LiveNotificationsSetLastReadArgs } from './notifications.js';
@@ -96,6 +97,13 @@ export type SyncCommandsMap = {
96
97
  workspace_goal_delete: WorkspaceGoalDeleteArgs;
97
98
  workspace_goal_project_add: WorkspaceGoalProjectAddArgs;
98
99
  workspace_goal_project_remove: WorkspaceGoalProjectRemoveArgs;
100
+ goal_add: GoalAddArgs;
101
+ goal_update: GoalUpdateArgs;
102
+ goal_complete: GoalCompleteArgs;
103
+ goal_uncomplete: GoalUncompleteArgs;
104
+ goal_delete: GoalDeleteArgs;
105
+ goal_link_item: GoalLinkItemArgs;
106
+ goal_unlink_item: GoalUnlinkItemArgs;
99
107
  live_notifications_mark_unread: LiveNotificationsMarkUnreadArgs;
100
108
  live_notifications_mark_read: LiveNotificationsMarkReadArgs;
101
109
  live_notifications_mark_read_all: LiveNotificationsMarkReadAllArgs;
@@ -163,6 +171,7 @@ export * from './workspaces.js';
163
171
  export * from './folders.js';
164
172
  export * from './workspace-filters.js';
165
173
  export * from './workspace-goals.js';
174
+ export * from './goals.js';
166
175
  export * from './notifications.js';
167
176
  export * from './sharing.js';
168
177
  export * from './view-options.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * All available Sync API resource types.
3
3
  */
4
- export declare const SYNC_RESOURCE_TYPES: readonly ["labels", "projects", "items", "notes", "project_notes", "sections", "filters", "reminders", "reminders_location", "locations", "user", "live_notifications", "collaborators", "collaborator_states", "user_settings", "notification_settings", "user_plan_limits", "completed_info", "stats", "workspaces", "workspace_users", "workspace_filters", "view_options", "project_view_options_defaults", "role_actions", "folders", "workspace_goals", "day_orders", "calendars", "calendar_accounts", "suggestions", "tooltips"];
4
+ export declare const SYNC_RESOURCE_TYPES: readonly ["labels", "projects", "items", "notes", "project_notes", "sections", "filters", "reminders", "reminders_location", "locations", "user", "live_notifications", "collaborators", "collaborator_states", "user_settings", "notification_settings", "user_plan_limits", "completed_info", "stats", "workspaces", "workspace_users", "workspace_filters", "view_options", "project_view_options_defaults", "role_actions", "folders", "workspace_goals", "goals", "day_orders", "calendars", "calendar_accounts", "suggestions", "tooltips"];
5
5
  export type SyncResourceType = (typeof SYNC_RESOURCE_TYPES)[number];
@@ -32,6 +32,7 @@ export declare const GROUPED_BY_OPTIONS: readonly ["ASSIGNEE", "ADDED_DATE", "DU
32
32
  /** Field to group tasks by. */
33
33
  export type GroupedBy = (typeof GROUPED_BY_OPTIONS)[number];
34
34
  export declare const GroupedBySchema: z.ZodNullable<z.ZodEnum<{
35
+ WORKSPACE: "WORKSPACE";
35
36
  PROJECT: "PROJECT";
36
37
  LABEL: "LABEL";
37
38
  ASSIGNEE: "ASSIGNEE";
@@ -39,20 +40,19 @@ export declare const GroupedBySchema: z.ZodNullable<z.ZodEnum<{
39
40
  DUE_DATE: "DUE_DATE";
40
41
  DEADLINE: "DEADLINE";
41
42
  PRIORITY: "PRIORITY";
42
- WORKSPACE: "WORKSPACE";
43
43
  }>>;
44
44
  /** Available sorting options. */
45
45
  export declare const SORTED_BY_OPTIONS: readonly ["MANUAL", "ALPHABETICALLY", "ASSIGNEE", "DUE_DATE", "DEADLINE", "ADDED_DATE", "PRIORITY", "PROJECT", "WORKSPACE"];
46
46
  /** Field to sort tasks by. */
47
47
  export type SortedBy = (typeof SORTED_BY_OPTIONS)[number];
48
48
  export declare const SortedBySchema: z.ZodNullable<z.ZodEnum<{
49
+ WORKSPACE: "WORKSPACE";
49
50
  PROJECT: "PROJECT";
50
51
  ASSIGNEE: "ASSIGNEE";
51
52
  ADDED_DATE: "ADDED_DATE";
52
53
  DUE_DATE: "DUE_DATE";
53
54
  DEADLINE: "DEADLINE";
54
55
  PRIORITY: "PRIORITY";
55
- WORKSPACE: "WORKSPACE";
56
56
  MANUAL: "MANUAL";
57
57
  ALPHABETICALLY: "ALPHABETICALLY";
58
58
  }>>;
@@ -92,6 +92,7 @@ export declare const ViewOptionsSchema: z.ZodObject<{
92
92
  }>;
93
93
  objectId: z.ZodOptional<z.ZodString>;
94
94
  groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
95
+ WORKSPACE: "WORKSPACE";
95
96
  PROJECT: "PROJECT";
96
97
  LABEL: "LABEL";
97
98
  ASSIGNEE: "ASSIGNEE";
@@ -99,7 +100,6 @@ export declare const ViewOptionsSchema: z.ZodObject<{
99
100
  DUE_DATE: "DUE_DATE";
100
101
  DEADLINE: "DEADLINE";
101
102
  PRIORITY: "PRIORITY";
102
- WORKSPACE: "WORKSPACE";
103
103
  }>>>;
104
104
  filteredBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
105
  viewMode: z.ZodOptional<z.ZodEnum<{
@@ -109,13 +109,13 @@ export declare const ViewOptionsSchema: z.ZodObject<{
109
109
  }>>;
110
110
  showCompletedTasks: z.ZodOptional<z.ZodBoolean>;
111
111
  sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
112
+ WORKSPACE: "WORKSPACE";
112
113
  PROJECT: "PROJECT";
113
114
  ASSIGNEE: "ASSIGNEE";
114
115
  ADDED_DATE: "ADDED_DATE";
115
116
  DUE_DATE: "DUE_DATE";
116
117
  DEADLINE: "DEADLINE";
117
118
  PRIORITY: "PRIORITY";
118
- WORKSPACE: "WORKSPACE";
119
119
  MANUAL: "MANUAL";
120
120
  ALPHABETICALLY: "ALPHABETICALLY";
121
121
  }>>>;
@@ -133,6 +133,7 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
133
133
  CALENDAR: "CALENDAR";
134
134
  }>>>;
135
135
  groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
136
+ WORKSPACE: "WORKSPACE";
136
137
  PROJECT: "PROJECT";
137
138
  LABEL: "LABEL";
138
139
  ASSIGNEE: "ASSIGNEE";
@@ -140,16 +141,15 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
140
141
  DUE_DATE: "DUE_DATE";
141
142
  DEADLINE: "DEADLINE";
142
143
  PRIORITY: "PRIORITY";
143
- WORKSPACE: "WORKSPACE";
144
144
  }>>>;
145
145
  sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
146
+ WORKSPACE: "WORKSPACE";
146
147
  PROJECT: "PROJECT";
147
148
  ASSIGNEE: "ASSIGNEE";
148
149
  ADDED_DATE: "ADDED_DATE";
149
150
  DUE_DATE: "DUE_DATE";
150
151
  DEADLINE: "DEADLINE";
151
152
  PRIORITY: "PRIORITY";
152
- WORKSPACE: "WORKSPACE";
153
153
  MANUAL: "MANUAL";
154
154
  ALPHABETICALLY: "ALPHABETICALLY";
155
155
  }>>>;
@@ -750,6 +750,7 @@ export declare const SyncResponseSchema: z.ZodObject<{
750
750
  }>;
751
751
  objectId: z.ZodOptional<z.ZodString>;
752
752
  groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
753
+ WORKSPACE: "WORKSPACE";
753
754
  PROJECT: "PROJECT";
754
755
  LABEL: "LABEL";
755
756
  ASSIGNEE: "ASSIGNEE";
@@ -757,7 +758,6 @@ export declare const SyncResponseSchema: z.ZodObject<{
757
758
  DUE_DATE: "DUE_DATE";
758
759
  DEADLINE: "DEADLINE";
759
760
  PRIORITY: "PRIORITY";
760
- WORKSPACE: "WORKSPACE";
761
761
  }>>>;
762
762
  filteredBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
763
763
  viewMode: z.ZodOptional<z.ZodEnum<{
@@ -767,13 +767,13 @@ export declare const SyncResponseSchema: z.ZodObject<{
767
767
  }>>;
768
768
  showCompletedTasks: z.ZodOptional<z.ZodBoolean>;
769
769
  sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
770
+ WORKSPACE: "WORKSPACE";
770
771
  PROJECT: "PROJECT";
771
772
  ASSIGNEE: "ASSIGNEE";
772
773
  ADDED_DATE: "ADDED_DATE";
773
774
  DUE_DATE: "DUE_DATE";
774
775
  DEADLINE: "DEADLINE";
775
776
  PRIORITY: "PRIORITY";
776
- WORKSPACE: "WORKSPACE";
777
777
  MANUAL: "MANUAL";
778
778
  ALPHABETICALLY: "ALPHABETICALLY";
779
779
  }>>>;
@@ -790,6 +790,7 @@ export declare const SyncResponseSchema: z.ZodObject<{
790
790
  CALENDAR: "CALENDAR";
791
791
  }>>>;
792
792
  groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
793
+ WORKSPACE: "WORKSPACE";
793
794
  PROJECT: "PROJECT";
794
795
  LABEL: "LABEL";
795
796
  ASSIGNEE: "ASSIGNEE";
@@ -797,16 +798,15 @@ export declare const SyncResponseSchema: z.ZodObject<{
797
798
  DUE_DATE: "DUE_DATE";
798
799
  DEADLINE: "DEADLINE";
799
800
  PRIORITY: "PRIORITY";
800
- WORKSPACE: "WORKSPACE";
801
801
  }>>>;
802
802
  sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
803
+ WORKSPACE: "WORKSPACE";
803
804
  PROJECT: "PROJECT";
804
805
  ASSIGNEE: "ASSIGNEE";
805
806
  ADDED_DATE: "ADDED_DATE";
806
807
  DUE_DATE: "DUE_DATE";
807
808
  DEADLINE: "DEADLINE";
808
809
  PRIORITY: "PRIORITY";
809
- WORKSPACE: "WORKSPACE";
810
810
  MANUAL: "MANUAL";
811
811
  ALPHABETICALLY: "ALPHABETICALLY";
812
812
  }>>>;
@@ -832,6 +832,31 @@ export declare const SyncResponseSchema: z.ZodObject<{
832
832
  defaultOrder: z.ZodNumber;
833
833
  childOrder: z.ZodNumber;
834
834
  }, z.core.$loose>>>;
835
+ goals: z.ZodOptional<z.ZodArray<z.ZodObject<{
836
+ id: z.ZodString;
837
+ ownerType: z.ZodEnum<{
838
+ USER: "USER";
839
+ WORKSPACE: "WORKSPACE";
840
+ }>;
841
+ ownerId: z.ZodString;
842
+ name: z.ZodString;
843
+ description: z.ZodNullable<z.ZodString>;
844
+ deadline: z.ZodNullable<z.ZodString>;
845
+ parentGoalId: z.ZodNullable<z.ZodString>;
846
+ childOrder: z.ZodNumber;
847
+ isCompleted: z.ZodBoolean;
848
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
849
+ responsibleUid: z.ZodNullable<z.ZodString>;
850
+ isDeleted: z.ZodBoolean;
851
+ progress: z.ZodOptional<z.ZodObject<{
852
+ totalTaskCount: z.ZodNumber;
853
+ completedTaskCount: z.ZodNumber;
854
+ percentage: z.ZodNumber;
855
+ }, z.core.$loose>>;
856
+ creatorUid: z.ZodString;
857
+ createdAt: z.ZodCoercedDate<unknown>;
858
+ updatedAt: z.ZodCoercedDate<unknown>;
859
+ }, z.core.$loose>>>;
835
860
  workspaceGoals: z.ZodOptional<z.ZodArray<z.ZodObject<{
836
861
  id: z.ZodString;
837
862
  workspaceId: z.ZodString;
@@ -36,6 +36,7 @@ export type GetTasksArgs = {
36
36
  parentId?: string;
37
37
  label?: string;
38
38
  ids?: string[];
39
+ goalId?: string;
39
40
  cursor?: string | null;
40
41
  limit?: number;
41
42
  };
@@ -816,6 +816,53 @@ export declare const validateFolder: (input: unknown) => {
816
816
  defaultOrder: number;
817
817
  childOrder: number;
818
818
  }[];
819
+ export declare const validateGoal: (input: unknown) => {
820
+ [x: string]: unknown;
821
+ id: string;
822
+ ownerType: "USER" | "WORKSPACE";
823
+ ownerId: string;
824
+ name: string;
825
+ description: string | null;
826
+ deadline: string | null;
827
+ parentGoalId: string | null;
828
+ childOrder: number;
829
+ isCompleted: boolean;
830
+ completedAt: Date | null;
831
+ responsibleUid: string | null;
832
+ isDeleted: boolean;
833
+ creatorUid: string;
834
+ createdAt: Date;
835
+ updatedAt: Date;
836
+ progress?: {
837
+ [x: string]: unknown;
838
+ totalTaskCount: number;
839
+ completedTaskCount: number;
840
+ percentage: number;
841
+ } | undefined;
842
+ }, validateGoalArray: (input: unknown) => {
843
+ [x: string]: unknown;
844
+ id: string;
845
+ ownerType: "USER" | "WORKSPACE";
846
+ ownerId: string;
847
+ name: string;
848
+ description: string | null;
849
+ deadline: string | null;
850
+ parentGoalId: string | null;
851
+ childOrder: number;
852
+ isCompleted: boolean;
853
+ completedAt: Date | null;
854
+ responsibleUid: string | null;
855
+ isDeleted: boolean;
856
+ creatorUid: string;
857
+ createdAt: Date;
858
+ updatedAt: Date;
859
+ progress?: {
860
+ [x: string]: unknown;
861
+ totalTaskCount: number;
862
+ completedTaskCount: number;
863
+ percentage: number;
864
+ } | undefined;
865
+ }[];
819
866
  export declare const validateNote: (input: unknown) => {
820
867
  [x: string]: unknown;
821
868
  id: string;
@@ -1137,29 +1184,29 @@ export declare const validateViewOptions: (input: unknown) => {
1137
1184
  [x: string]: unknown;
1138
1185
  viewType: "PROJECT" | "TODAY" | "UPCOMING" | "LABEL" | "FILTER" | "WORKSPACE_FILTER" | "SEARCH" | "TEMPLATE_PREVIEW" | "TASK_DETAIL" | "AUTOMATION" | "ASSIGNED" | "OVERDUE" | "WORKSPACE_OVERVIEW";
1139
1186
  objectId?: string | undefined;
1140
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1187
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1141
1188
  filteredBy?: string | null | undefined;
1142
1189
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
1143
1190
  showCompletedTasks?: boolean | undefined;
1144
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1191
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1145
1192
  sortOrder?: "ASC" | "DESC" | null | undefined;
1146
1193
  }, validateViewOptionsArray: (input: unknown) => {
1147
1194
  [x: string]: unknown;
1148
1195
  viewType: "PROJECT" | "TODAY" | "UPCOMING" | "LABEL" | "FILTER" | "WORKSPACE_FILTER" | "SEARCH" | "TEMPLATE_PREVIEW" | "TASK_DETAIL" | "AUTOMATION" | "ASSIGNED" | "OVERDUE" | "WORKSPACE_OVERVIEW";
1149
1196
  objectId?: string | undefined;
1150
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1197
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1151
1198
  filteredBy?: string | null | undefined;
1152
1199
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
1153
1200
  showCompletedTasks?: boolean | undefined;
1154
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1201
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1155
1202
  sortOrder?: "ASC" | "DESC" | null | undefined;
1156
1203
  }[];
1157
1204
  export declare const validateProjectViewOptionsDefaults: (input: unknown) => {
1158
1205
  [x: string]: unknown;
1159
1206
  projectId: string;
1160
1207
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
1161
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1162
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1208
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1209
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1163
1210
  sortOrder?: "ASC" | "DESC" | null | undefined;
1164
1211
  showCompletedTasks?: boolean | undefined;
1165
1212
  filteredBy?: string | null | undefined;
@@ -1171,8 +1218,8 @@ export declare const validateProjectViewOptionsDefaults: (input: unknown) => {
1171
1218
  [x: string]: unknown;
1172
1219
  projectId: string;
1173
1220
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
1174
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1175
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1221
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1222
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1176
1223
  sortOrder?: "ASC" | "DESC" | null | undefined;
1177
1224
  showCompletedTasks?: boolean | undefined;
1178
1225
  filteredBy?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-sdk",
3
- "version": "9.0.0",
3
+ "version": "9.1.0-next.1",
4
4
  "description": "The official TypeScript SDK for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "https://github.com/Doist/todoist-sdk-typescript",