@athenaintel/sdk 4.3.2319 → 4.3.2320

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 (92) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +13 -8
  4. package/dist/cjs/api/resources/index.d.ts +3 -0
  5. package/dist/cjs/api/resources/index.js +4 -1
  6. package/dist/cjs/api/resources/tasks/client/Client.d.ts +124 -0
  7. package/dist/cjs/api/resources/tasks/client/Client.js +535 -0
  8. package/dist/cjs/api/resources/tasks/client/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/tasks/client/index.js +17 -0
  10. package/dist/cjs/api/resources/tasks/client/requests/CreateTaskRequestIn.d.ts +52 -0
  11. package/dist/cjs/api/resources/tasks/client/requests/CreateTaskRequestIn.js +13 -0
  12. package/dist/cjs/api/resources/tasks/client/requests/GetTasksRequest.d.ts +10 -0
  13. package/dist/cjs/api/resources/tasks/client/requests/GetTasksRequest.js +3 -0
  14. package/dist/cjs/api/resources/tasks/client/requests/ListTasksRequest.d.ts +26 -0
  15. package/dist/cjs/api/resources/tasks/client/requests/ListTasksRequest.js +3 -0
  16. package/dist/cjs/api/resources/tasks/client/requests/SetTaskStatusRequestIn.d.ts +21 -0
  17. package/dist/cjs/api/resources/tasks/client/requests/SetTaskStatusRequestIn.js +12 -0
  18. package/dist/cjs/api/resources/tasks/client/requests/UpdateTaskRequestIn.d.ts +46 -0
  19. package/dist/cjs/api/resources/tasks/client/requests/UpdateTaskRequestIn.js +17 -0
  20. package/dist/cjs/api/resources/tasks/client/requests/index.d.ts +5 -0
  21. package/dist/cjs/api/resources/tasks/client/requests/index.js +2 -0
  22. package/dist/cjs/api/resources/tasks/index.d.ts +2 -0
  23. package/dist/cjs/api/resources/tasks/index.js +18 -0
  24. package/dist/cjs/api/resources/tasks/types/ListTasksRequestStatus.d.ts +7 -0
  25. package/dist/cjs/api/resources/tasks/types/ListTasksRequestStatus.js +10 -0
  26. package/dist/cjs/api/resources/tasks/types/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/tasks/types/index.js +17 -0
  28. package/dist/cjs/api/types/TaskAssigneeOut.d.ts +19 -0
  29. package/dist/cjs/api/types/TaskAssigneeOut.js +12 -0
  30. package/dist/cjs/api/types/TaskLabelIn.d.ts +9 -0
  31. package/dist/cjs/api/types/TaskLabelIn.js +3 -0
  32. package/dist/cjs/api/types/TaskLabelOut.d.ts +12 -0
  33. package/dist/cjs/api/types/TaskLabelOut.js +3 -0
  34. package/dist/cjs/api/types/TaskLinkIn.d.ts +22 -0
  35. package/dist/cjs/api/types/TaskLinkIn.js +13 -0
  36. package/dist/cjs/api/types/TaskLinkOut.d.ts +17 -0
  37. package/dist/cjs/api/types/TaskLinkOut.js +3 -0
  38. package/dist/cjs/api/types/TaskListOut.d.ts +8 -0
  39. package/dist/cjs/api/types/TaskListOut.js +3 -0
  40. package/dist/cjs/api/types/TaskOut.d.ts +51 -0
  41. package/dist/cjs/api/types/TaskOut.js +17 -0
  42. package/dist/cjs/api/types/index.d.ts +7 -0
  43. package/dist/cjs/api/types/index.js +7 -0
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +3 -0
  48. package/dist/esm/Client.mjs +5 -0
  49. package/dist/esm/api/resources/index.d.mts +3 -0
  50. package/dist/esm/api/resources/index.mjs +3 -0
  51. package/dist/esm/api/resources/tasks/client/Client.d.mts +124 -0
  52. package/dist/esm/api/resources/tasks/client/Client.mjs +498 -0
  53. package/dist/esm/api/resources/tasks/client/index.d.mts +1 -0
  54. package/dist/esm/api/resources/tasks/client/index.mjs +1 -0
  55. package/dist/esm/api/resources/tasks/client/requests/CreateTaskRequestIn.d.mts +52 -0
  56. package/dist/esm/api/resources/tasks/client/requests/CreateTaskRequestIn.mjs +10 -0
  57. package/dist/esm/api/resources/tasks/client/requests/GetTasksRequest.d.mts +10 -0
  58. package/dist/esm/api/resources/tasks/client/requests/GetTasksRequest.mjs +2 -0
  59. package/dist/esm/api/resources/tasks/client/requests/ListTasksRequest.d.mts +26 -0
  60. package/dist/esm/api/resources/tasks/client/requests/ListTasksRequest.mjs +2 -0
  61. package/dist/esm/api/resources/tasks/client/requests/SetTaskStatusRequestIn.d.mts +21 -0
  62. package/dist/esm/api/resources/tasks/client/requests/SetTaskStatusRequestIn.mjs +9 -0
  63. package/dist/esm/api/resources/tasks/client/requests/UpdateTaskRequestIn.d.mts +46 -0
  64. package/dist/esm/api/resources/tasks/client/requests/UpdateTaskRequestIn.mjs +14 -0
  65. package/dist/esm/api/resources/tasks/client/requests/index.d.mts +5 -0
  66. package/dist/esm/api/resources/tasks/client/requests/index.mjs +1 -0
  67. package/dist/esm/api/resources/tasks/index.d.mts +2 -0
  68. package/dist/esm/api/resources/tasks/index.mjs +2 -0
  69. package/dist/esm/api/resources/tasks/types/ListTasksRequestStatus.d.mts +7 -0
  70. package/dist/esm/api/resources/tasks/types/ListTasksRequestStatus.mjs +7 -0
  71. package/dist/esm/api/resources/tasks/types/index.d.mts +1 -0
  72. package/dist/esm/api/resources/tasks/types/index.mjs +1 -0
  73. package/dist/esm/api/types/TaskAssigneeOut.d.mts +19 -0
  74. package/dist/esm/api/types/TaskAssigneeOut.mjs +9 -0
  75. package/dist/esm/api/types/TaskLabelIn.d.mts +9 -0
  76. package/dist/esm/api/types/TaskLabelIn.mjs +2 -0
  77. package/dist/esm/api/types/TaskLabelOut.d.mts +12 -0
  78. package/dist/esm/api/types/TaskLabelOut.mjs +2 -0
  79. package/dist/esm/api/types/TaskLinkIn.d.mts +22 -0
  80. package/dist/esm/api/types/TaskLinkIn.mjs +10 -0
  81. package/dist/esm/api/types/TaskLinkOut.d.mts +17 -0
  82. package/dist/esm/api/types/TaskLinkOut.mjs +2 -0
  83. package/dist/esm/api/types/TaskListOut.d.mts +8 -0
  84. package/dist/esm/api/types/TaskListOut.mjs +2 -0
  85. package/dist/esm/api/types/TaskOut.d.mts +51 -0
  86. package/dist/esm/api/types/TaskOut.mjs +14 -0
  87. package/dist/esm/api/types/index.d.mts +7 -0
  88. package/dist/esm/api/types/index.mjs +7 -0
  89. package/dist/esm/version.d.mts +1 -1
  90. package/dist/esm/version.mjs +1 -1
  91. package/package.json +1 -1
  92. package/reference.md +341 -0
@@ -0,0 +1,535 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.TasksClient = void 0;
58
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
59
+ const headers_js_1 = require("../../../../core/headers.js");
60
+ const core = __importStar(require("../../../../core/index.js"));
61
+ const environments = __importStar(require("../../../../environments.js"));
62
+ const errors = __importStar(require("../../../../errors/index.js"));
63
+ const AthenaIntelligence = __importStar(require("../../../index.js"));
64
+ class TasksClient {
65
+ constructor(options = {}) {
66
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
67
+ }
68
+ /**
69
+ * The tasks of a workspace the caller belongs to that they can open, soonest due first (tasks with no due date last, newest first). Open tasks unless status says otherwise. Filter by assignee (me for the caller's own), due dates (calendar days, inclusive), a label's name or a record the task links. A listed task carries no links and a null can_edit: read one task for them.
70
+ *
71
+ * @param {AthenaIntelligence.ListTasksRequest} request
72
+ * @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
73
+ *
74
+ * @throws {@link AthenaIntelligence.BadRequestError}
75
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
76
+ * @throws {@link AthenaIntelligence.ForbiddenError}
77
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
78
+ *
79
+ * @example
80
+ * await client.tasks.list({
81
+ * workspace_id: "ws_abc123-def456",
82
+ * limit: 50
83
+ * })
84
+ */
85
+ list(request, requestOptions) {
86
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
87
+ }
88
+ __list(request, requestOptions) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
91
+ const { workspace_id: workspaceId, assignee_ref: assigneeRef, status, due_on_or_before: dueOnOrBefore, due_on_or_after: dueOnOrAfter, label, linked_id: linkedId, limit, } = request;
92
+ const _queryParams = {};
93
+ _queryParams.workspace_id = workspaceId;
94
+ if (assigneeRef !== undefined) {
95
+ _queryParams.assignee_ref = assigneeRef;
96
+ }
97
+ if (status != null) {
98
+ _queryParams.status = status;
99
+ }
100
+ if (dueOnOrBefore !== undefined) {
101
+ _queryParams.due_on_or_before = dueOnOrBefore;
102
+ }
103
+ if (dueOnOrAfter !== undefined) {
104
+ _queryParams.due_on_or_after = dueOnOrAfter;
105
+ }
106
+ if (label !== undefined) {
107
+ _queryParams.label = label;
108
+ }
109
+ if (linkedId !== undefined) {
110
+ _queryParams.linked_id = linkedId;
111
+ }
112
+ if (limit != null) {
113
+ _queryParams.limit = limit.toString();
114
+ }
115
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
116
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
117
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
118
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
119
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
120
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, "api/v0/tasks"),
121
+ method: "GET",
122
+ headers: _headers,
123
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
124
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
125
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
126
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
127
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
128
+ logging: this._options.logging,
129
+ });
130
+ if (_response.ok) {
131
+ return { data: _response.body, rawResponse: _response.rawResponse };
132
+ }
133
+ if (_response.error.reason === "status-code") {
134
+ switch (_response.error.statusCode) {
135
+ case 400:
136
+ throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
137
+ case 401:
138
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
139
+ case 403:
140
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
141
+ case 422:
142
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
143
+ default:
144
+ throw new errors.AthenaIntelligenceError({
145
+ statusCode: _response.error.statusCode,
146
+ body: _response.error.body,
147
+ rawResponse: _response.rawResponse,
148
+ });
149
+ }
150
+ }
151
+ switch (_response.error.reason) {
152
+ case "non-json":
153
+ throw new errors.AthenaIntelligenceError({
154
+ statusCode: _response.error.statusCode,
155
+ body: _response.error.rawBody,
156
+ rawResponse: _response.rawResponse,
157
+ });
158
+ case "body-is-null":
159
+ throw new errors.AthenaIntelligenceError({
160
+ statusCode: _response.error.statusCode,
161
+ rawResponse: _response.rawResponse,
162
+ });
163
+ case "timeout":
164
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tasks.");
165
+ case "unknown":
166
+ throw new errors.AthenaIntelligenceError({
167
+ message: _response.error.errorMessage,
168
+ rawResponse: _response.rawResponse,
169
+ });
170
+ }
171
+ });
172
+ }
173
+ /**
174
+ * Create a task (an assignable to-do) in a workspace the caller belongs to, with an optional due date and time, priority, assignee, labels, links to the records it is about and a folder or project to put it in. It is the caller's own unless assignee_ref names someone who can already open it (assigning never shares it) or is null. Each link must be a record the caller can open, and a parent folder needs edit access.
175
+ *
176
+ * @param {AthenaIntelligence.CreateTaskRequestIn} request
177
+ * @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
178
+ *
179
+ * @throws {@link AthenaIntelligence.BadRequestError}
180
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
181
+ * @throws {@link AthenaIntelligence.ForbiddenError}
182
+ * @throws {@link AthenaIntelligence.NotFoundError}
183
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
184
+ * @throws {@link AthenaIntelligence.ServiceUnavailableError}
185
+ *
186
+ * @example
187
+ * await client.tasks.create({
188
+ * due_date: "2026-11-13",
189
+ * due_time: "15:00",
190
+ * due_time_zone: "America/New_York",
191
+ * labels: [{
192
+ * name: "Investor"
193
+ * }],
194
+ * links: [{
195
+ * referenced: "external_url",
196
+ * url: "https://example.com"
197
+ * }],
198
+ * priority: "high",
199
+ * title: "Send the deck to Mayfield",
200
+ * workspace_id: "ws_abc123-def456"
201
+ * })
202
+ */
203
+ create(request, requestOptions) {
204
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
205
+ }
206
+ __create(request, requestOptions) {
207
+ return __awaiter(this, void 0, void 0, function* () {
208
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
209
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
210
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
211
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
212
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
213
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
214
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, "api/v0/tasks"),
215
+ method: "POST",
216
+ headers: _headers,
217
+ contentType: "application/json",
218
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
219
+ requestType: "json",
220
+ body: request,
221
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
222
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
223
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
224
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
225
+ logging: this._options.logging,
226
+ });
227
+ if (_response.ok) {
228
+ return { data: _response.body, rawResponse: _response.rawResponse };
229
+ }
230
+ if (_response.error.reason === "status-code") {
231
+ switch (_response.error.statusCode) {
232
+ case 400:
233
+ throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
234
+ case 401:
235
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
236
+ case 403:
237
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
238
+ case 404:
239
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
240
+ case 422:
241
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
242
+ case 503:
243
+ throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
244
+ default:
245
+ throw new errors.AthenaIntelligenceError({
246
+ statusCode: _response.error.statusCode,
247
+ body: _response.error.body,
248
+ rawResponse: _response.rawResponse,
249
+ });
250
+ }
251
+ }
252
+ switch (_response.error.reason) {
253
+ case "non-json":
254
+ throw new errors.AthenaIntelligenceError({
255
+ statusCode: _response.error.statusCode,
256
+ body: _response.error.rawBody,
257
+ rawResponse: _response.rawResponse,
258
+ });
259
+ case "body-is-null":
260
+ throw new errors.AthenaIntelligenceError({
261
+ statusCode: _response.error.statusCode,
262
+ rawResponse: _response.rawResponse,
263
+ });
264
+ case "timeout":
265
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/tasks.");
266
+ case "unknown":
267
+ throw new errors.AthenaIntelligenceError({
268
+ message: _response.error.errorMessage,
269
+ rawResponse: _response.rawResponse,
270
+ });
271
+ }
272
+ });
273
+ }
274
+ /**
275
+ * One task the caller can open: its status, due date, priority, assignee, labels, the records it links (each read with the caller's own access: one they can't open shows its kind only) and whether they may change it.
276
+ *
277
+ * @param {AthenaIntelligence.GetTasksRequest} request
278
+ * @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
279
+ *
280
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
281
+ * @throws {@link AthenaIntelligence.ForbiddenError}
282
+ * @throws {@link AthenaIntelligence.NotFoundError}
283
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
284
+ *
285
+ * @example
286
+ * await client.tasks.get({
287
+ * asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c"
288
+ * })
289
+ */
290
+ get(request, requestOptions) {
291
+ return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions));
292
+ }
293
+ __get(request, requestOptions) {
294
+ return __awaiter(this, void 0, void 0, function* () {
295
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
296
+ const { asset_id: assetId } = request;
297
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
298
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
299
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
300
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
301
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
302
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/tasks/${core.url.encodePathParam(assetId)}`),
303
+ method: "GET",
304
+ headers: _headers,
305
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
306
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
307
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
308
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
309
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
310
+ logging: this._options.logging,
311
+ });
312
+ if (_response.ok) {
313
+ return { data: _response.body, rawResponse: _response.rawResponse };
314
+ }
315
+ if (_response.error.reason === "status-code") {
316
+ switch (_response.error.statusCode) {
317
+ case 401:
318
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
319
+ case 403:
320
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
321
+ case 404:
322
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
323
+ case 422:
324
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
325
+ default:
326
+ throw new errors.AthenaIntelligenceError({
327
+ statusCode: _response.error.statusCode,
328
+ body: _response.error.body,
329
+ rawResponse: _response.rawResponse,
330
+ });
331
+ }
332
+ }
333
+ switch (_response.error.reason) {
334
+ case "non-json":
335
+ throw new errors.AthenaIntelligenceError({
336
+ statusCode: _response.error.statusCode,
337
+ body: _response.error.rawBody,
338
+ rawResponse: _response.rawResponse,
339
+ });
340
+ case "body-is-null":
341
+ throw new errors.AthenaIntelligenceError({
342
+ statusCode: _response.error.statusCode,
343
+ rawResponse: _response.rawResponse,
344
+ });
345
+ case "timeout":
346
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tasks/{asset_id}.");
347
+ case "unknown":
348
+ throw new errors.AthenaIntelligenceError({
349
+ message: _response.error.errorMessage,
350
+ rawResponse: _response.rawResponse,
351
+ });
352
+ }
353
+ });
354
+ }
355
+ /**
356
+ * Change a task: a field left out is kept, and an explicit null clears it (title and status cannot be cleared). Needs edit access, and the task must not be in the trash. Labels and links are replaced whole; links already on it that the caller cannot open are kept. Marking it done records who and when.
357
+ *
358
+ * @param {AthenaIntelligence.UpdateTaskRequestIn} request
359
+ * @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
360
+ *
361
+ * @throws {@link AthenaIntelligence.BadRequestError}
362
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
363
+ * @throws {@link AthenaIntelligence.ForbiddenError}
364
+ * @throws {@link AthenaIntelligence.NotFoundError}
365
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
366
+ * @throws {@link AthenaIntelligence.ServiceUnavailableError}
367
+ *
368
+ * @example
369
+ * await client.tasks.update({
370
+ * asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
371
+ * priority: "medium"
372
+ * })
373
+ */
374
+ update(request, requestOptions) {
375
+ return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
376
+ }
377
+ __update(request, requestOptions) {
378
+ return __awaiter(this, void 0, void 0, function* () {
379
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
380
+ const { asset_id: assetId } = request, _body = __rest(request, ["asset_id"]);
381
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
382
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
383
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
384
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
385
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
386
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/tasks/${core.url.encodePathParam(assetId)}`),
387
+ method: "PATCH",
388
+ headers: _headers,
389
+ contentType: "application/json",
390
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
391
+ requestType: "json",
392
+ body: _body,
393
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
394
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
395
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
396
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
397
+ logging: this._options.logging,
398
+ });
399
+ if (_response.ok) {
400
+ return { data: _response.body, rawResponse: _response.rawResponse };
401
+ }
402
+ if (_response.error.reason === "status-code") {
403
+ switch (_response.error.statusCode) {
404
+ case 400:
405
+ throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
406
+ case 401:
407
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
408
+ case 403:
409
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
410
+ case 404:
411
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
412
+ case 422:
413
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
414
+ case 503:
415
+ throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
416
+ default:
417
+ throw new errors.AthenaIntelligenceError({
418
+ statusCode: _response.error.statusCode,
419
+ body: _response.error.body,
420
+ rawResponse: _response.rawResponse,
421
+ });
422
+ }
423
+ }
424
+ switch (_response.error.reason) {
425
+ case "non-json":
426
+ throw new errors.AthenaIntelligenceError({
427
+ statusCode: _response.error.statusCode,
428
+ body: _response.error.rawBody,
429
+ rawResponse: _response.rawResponse,
430
+ });
431
+ case "body-is-null":
432
+ throw new errors.AthenaIntelligenceError({
433
+ statusCode: _response.error.statusCode,
434
+ rawResponse: _response.rawResponse,
435
+ });
436
+ case "timeout":
437
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling PATCH /api/v0/tasks/{asset_id}.");
438
+ case "unknown":
439
+ throw new errors.AthenaIntelligenceError({
440
+ message: _response.error.errorMessage,
441
+ rawResponse: _response.rawResponse,
442
+ });
443
+ }
444
+ });
445
+ }
446
+ /**
447
+ * Mark a task done, or open it again. Needs edit access, and the task must not be in the trash. Marking it done records who and when; reopening clears both.
448
+ *
449
+ * @param {AthenaIntelligence.SetTaskStatusRequestIn} request
450
+ * @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
451
+ *
452
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
453
+ * @throws {@link AthenaIntelligence.ForbiddenError}
454
+ * @throws {@link AthenaIntelligence.NotFoundError}
455
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
456
+ * @throws {@link AthenaIntelligence.ServiceUnavailableError}
457
+ *
458
+ * @example
459
+ * await client.tasks.setStatus({
460
+ * asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
461
+ * status: "done"
462
+ * })
463
+ */
464
+ setStatus(request, requestOptions) {
465
+ return core.HttpResponsePromise.fromPromise(this.__setStatus(request, requestOptions));
466
+ }
467
+ __setStatus(request, requestOptions) {
468
+ return __awaiter(this, void 0, void 0, function* () {
469
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
470
+ const { asset_id: assetId } = request, _body = __rest(request, ["asset_id"]);
471
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
472
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
473
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
474
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
475
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
476
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/tasks/${core.url.encodePathParam(assetId)}/status`),
477
+ method: "POST",
478
+ headers: _headers,
479
+ contentType: "application/json",
480
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
481
+ requestType: "json",
482
+ body: _body,
483
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
484
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
485
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
486
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
487
+ logging: this._options.logging,
488
+ });
489
+ if (_response.ok) {
490
+ return { data: _response.body, rawResponse: _response.rawResponse };
491
+ }
492
+ if (_response.error.reason === "status-code") {
493
+ switch (_response.error.statusCode) {
494
+ case 401:
495
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
496
+ case 403:
497
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
498
+ case 404:
499
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
500
+ case 422:
501
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
502
+ case 503:
503
+ throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
504
+ default:
505
+ throw new errors.AthenaIntelligenceError({
506
+ statusCode: _response.error.statusCode,
507
+ body: _response.error.body,
508
+ rawResponse: _response.rawResponse,
509
+ });
510
+ }
511
+ }
512
+ switch (_response.error.reason) {
513
+ case "non-json":
514
+ throw new errors.AthenaIntelligenceError({
515
+ statusCode: _response.error.statusCode,
516
+ body: _response.error.rawBody,
517
+ rawResponse: _response.rawResponse,
518
+ });
519
+ case "body-is-null":
520
+ throw new errors.AthenaIntelligenceError({
521
+ statusCode: _response.error.statusCode,
522
+ rawResponse: _response.rawResponse,
523
+ });
524
+ case "timeout":
525
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/tasks/{asset_id}/status.");
526
+ case "unknown":
527
+ throw new errors.AthenaIntelligenceError({
528
+ message: _response.error.errorMessage,
529
+ rawResponse: _response.rawResponse,
530
+ });
531
+ }
532
+ });
533
+ }
534
+ }
535
+ exports.TasksClient = TasksClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
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("./requests/index.js"), exports);
@@ -0,0 +1,52 @@
1
+ import type * as AthenaIntelligence from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * due_date: "2026-11-13",
6
+ * due_time: "15:00",
7
+ * due_time_zone: "America/New_York",
8
+ * labels: [{
9
+ * name: "Investor"
10
+ * }],
11
+ * links: [{
12
+ * referenced: "external_url",
13
+ * url: "https://example.com"
14
+ * }],
15
+ * priority: "high",
16
+ * title: "Send the deck to Mayfield",
17
+ * workspace_id: "ws_abc123-def456"
18
+ * }
19
+ */
20
+ export interface CreateTaskRequestIn {
21
+ /** Who it is for: user_… for a person, agent_asset_… for an agent, or me. Left out, the task is the caller's own; null, nobody's. Assigning never shares the task: the assignee must already be able to open it. */
22
+ assignee_ref?: string | null;
23
+ /** Details, in markdown. */
24
+ description?: string | null;
25
+ /** YYYY-MM-DD: a calendar day, with no time zone. */
26
+ due_date?: string | null;
27
+ /** HH:MM on a 24-hour clock; needs due_date and due_time_zone. */
28
+ due_time?: string | null;
29
+ /** The IANA time zone of due_time, such as America/New_York. */
30
+ due_time_zone?: string | null;
31
+ /** Labels to put on it. */
32
+ labels?: AthenaIntelligence.TaskLabelIn[] | null;
33
+ /** The records it is about (at most 10). Each must be one the caller can open. */
34
+ links?: AthenaIntelligence.TaskLinkIn[] | null;
35
+ /** A folder or project to put it in; needs edit access there. */
36
+ parent_folder_id?: string | null;
37
+ /** How much it matters; left out, none. */
38
+ priority?: CreateTaskRequestIn.Priority | null;
39
+ /** What to do, in a short line (at most 500 characters). */
40
+ title: string;
41
+ /** The workspace to create it in; the caller must be a member. */
42
+ workspace_id: string;
43
+ }
44
+ export declare namespace CreateTaskRequestIn {
45
+ const Priority: {
46
+ readonly None: "none";
47
+ readonly Low: "low";
48
+ readonly Medium: "medium";
49
+ readonly High: "high";
50
+ };
51
+ type Priority = (typeof Priority)[keyof typeof Priority];
52
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreateTaskRequestIn = void 0;
5
+ var CreateTaskRequestIn;
6
+ (function (CreateTaskRequestIn) {
7
+ CreateTaskRequestIn.Priority = {
8
+ None: "none",
9
+ Low: "low",
10
+ Medium: "medium",
11
+ High: "high",
12
+ };
13
+ })(CreateTaskRequestIn || (exports.CreateTaskRequestIn = CreateTaskRequestIn = {}));
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c"
5
+ * }
6
+ */
7
+ export interface GetTasksRequest {
8
+ /** The task's asset id. */
9
+ asset_id: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });