@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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +13 -8
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/resources/tasks/client/Client.d.ts +124 -0
- package/dist/cjs/api/resources/tasks/client/Client.js +535 -0
- package/dist/cjs/api/resources/tasks/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/tasks/client/index.js +17 -0
- package/dist/cjs/api/resources/tasks/client/requests/CreateTaskRequestIn.d.ts +52 -0
- package/dist/cjs/api/resources/tasks/client/requests/CreateTaskRequestIn.js +13 -0
- package/dist/cjs/api/resources/tasks/client/requests/GetTasksRequest.d.ts +10 -0
- package/dist/cjs/api/resources/tasks/client/requests/GetTasksRequest.js +3 -0
- package/dist/cjs/api/resources/tasks/client/requests/ListTasksRequest.d.ts +26 -0
- package/dist/cjs/api/resources/tasks/client/requests/ListTasksRequest.js +3 -0
- package/dist/cjs/api/resources/tasks/client/requests/SetTaskStatusRequestIn.d.ts +21 -0
- package/dist/cjs/api/resources/tasks/client/requests/SetTaskStatusRequestIn.js +12 -0
- package/dist/cjs/api/resources/tasks/client/requests/UpdateTaskRequestIn.d.ts +46 -0
- package/dist/cjs/api/resources/tasks/client/requests/UpdateTaskRequestIn.js +17 -0
- package/dist/cjs/api/resources/tasks/client/requests/index.d.ts +5 -0
- package/dist/cjs/api/resources/tasks/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/tasks/index.d.ts +2 -0
- package/dist/cjs/api/resources/tasks/index.js +18 -0
- package/dist/cjs/api/resources/tasks/types/ListTasksRequestStatus.d.ts +7 -0
- package/dist/cjs/api/resources/tasks/types/ListTasksRequestStatus.js +10 -0
- package/dist/cjs/api/resources/tasks/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/tasks/types/index.js +17 -0
- package/dist/cjs/api/types/TaskAssigneeOut.d.ts +19 -0
- package/dist/cjs/api/types/TaskAssigneeOut.js +12 -0
- package/dist/cjs/api/types/TaskLabelIn.d.ts +9 -0
- package/dist/cjs/api/types/TaskLabelIn.js +3 -0
- package/dist/cjs/api/types/TaskLabelOut.d.ts +12 -0
- package/dist/cjs/api/types/TaskLabelOut.js +3 -0
- package/dist/cjs/api/types/TaskLinkIn.d.ts +22 -0
- package/dist/cjs/api/types/TaskLinkIn.js +13 -0
- package/dist/cjs/api/types/TaskLinkOut.d.ts +17 -0
- package/dist/cjs/api/types/TaskLinkOut.js +3 -0
- package/dist/cjs/api/types/TaskListOut.d.ts +8 -0
- package/dist/cjs/api/types/TaskListOut.js +3 -0
- package/dist/cjs/api/types/TaskOut.d.ts +51 -0
- package/dist/cjs/api/types/TaskOut.js +17 -0
- package/dist/cjs/api/types/index.d.ts +7 -0
- package/dist/cjs/api/types/index.js +7 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/tasks/client/Client.d.mts +124 -0
- package/dist/esm/api/resources/tasks/client/Client.mjs +498 -0
- package/dist/esm/api/resources/tasks/client/index.d.mts +1 -0
- package/dist/esm/api/resources/tasks/client/index.mjs +1 -0
- package/dist/esm/api/resources/tasks/client/requests/CreateTaskRequestIn.d.mts +52 -0
- package/dist/esm/api/resources/tasks/client/requests/CreateTaskRequestIn.mjs +10 -0
- package/dist/esm/api/resources/tasks/client/requests/GetTasksRequest.d.mts +10 -0
- package/dist/esm/api/resources/tasks/client/requests/GetTasksRequest.mjs +2 -0
- package/dist/esm/api/resources/tasks/client/requests/ListTasksRequest.d.mts +26 -0
- package/dist/esm/api/resources/tasks/client/requests/ListTasksRequest.mjs +2 -0
- package/dist/esm/api/resources/tasks/client/requests/SetTaskStatusRequestIn.d.mts +21 -0
- package/dist/esm/api/resources/tasks/client/requests/SetTaskStatusRequestIn.mjs +9 -0
- package/dist/esm/api/resources/tasks/client/requests/UpdateTaskRequestIn.d.mts +46 -0
- package/dist/esm/api/resources/tasks/client/requests/UpdateTaskRequestIn.mjs +14 -0
- package/dist/esm/api/resources/tasks/client/requests/index.d.mts +5 -0
- package/dist/esm/api/resources/tasks/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tasks/index.d.mts +2 -0
- package/dist/esm/api/resources/tasks/index.mjs +2 -0
- package/dist/esm/api/resources/tasks/types/ListTasksRequestStatus.d.mts +7 -0
- package/dist/esm/api/resources/tasks/types/ListTasksRequestStatus.mjs +7 -0
- package/dist/esm/api/resources/tasks/types/index.d.mts +1 -0
- package/dist/esm/api/resources/tasks/types/index.mjs +1 -0
- package/dist/esm/api/types/TaskAssigneeOut.d.mts +19 -0
- package/dist/esm/api/types/TaskAssigneeOut.mjs +9 -0
- package/dist/esm/api/types/TaskLabelIn.d.mts +9 -0
- package/dist/esm/api/types/TaskLabelIn.mjs +2 -0
- package/dist/esm/api/types/TaskLabelOut.d.mts +12 -0
- package/dist/esm/api/types/TaskLabelOut.mjs +2 -0
- package/dist/esm/api/types/TaskLinkIn.d.mts +22 -0
- package/dist/esm/api/types/TaskLinkIn.mjs +10 -0
- package/dist/esm/api/types/TaskLinkOut.d.mts +17 -0
- package/dist/esm/api/types/TaskLinkOut.mjs +2 -0
- package/dist/esm/api/types/TaskListOut.d.mts +8 -0
- package/dist/esm/api/types/TaskListOut.mjs +2 -0
- package/dist/esm/api/types/TaskOut.d.mts +51 -0
- package/dist/esm/api/types/TaskOut.mjs +14 -0
- package/dist/esm/api/types/index.d.mts +7 -0
- package/dist/esm/api/types/index.mjs +7 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +341 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as AthenaIntelligence from "../../../index.mjs";
|
|
5
|
+
export declare namespace TasksClient {
|
|
6
|
+
interface Options extends BaseClientOptions {
|
|
7
|
+
}
|
|
8
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare class TasksClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<TasksClient.Options>;
|
|
13
|
+
constructor(options?: TasksClient.Options);
|
|
14
|
+
/**
|
|
15
|
+
* 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.
|
|
16
|
+
*
|
|
17
|
+
* @param {AthenaIntelligence.ListTasksRequest} request
|
|
18
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
|
+
*
|
|
20
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
21
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
22
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
23
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* await client.tasks.list({
|
|
27
|
+
* workspace_id: "ws_abc123-def456",
|
|
28
|
+
* limit: 50
|
|
29
|
+
* })
|
|
30
|
+
*/
|
|
31
|
+
list(request: AthenaIntelligence.ListTasksRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.TaskListOut>;
|
|
32
|
+
private __list;
|
|
33
|
+
/**
|
|
34
|
+
* 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.
|
|
35
|
+
*
|
|
36
|
+
* @param {AthenaIntelligence.CreateTaskRequestIn} request
|
|
37
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
38
|
+
*
|
|
39
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
40
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
41
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
42
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
43
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
44
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* await client.tasks.create({
|
|
48
|
+
* due_date: "2026-11-13",
|
|
49
|
+
* due_time: "15:00",
|
|
50
|
+
* due_time_zone: "America/New_York",
|
|
51
|
+
* labels: [{
|
|
52
|
+
* name: "Investor"
|
|
53
|
+
* }],
|
|
54
|
+
* links: [{
|
|
55
|
+
* referenced: "external_url",
|
|
56
|
+
* url: "https://example.com"
|
|
57
|
+
* }],
|
|
58
|
+
* priority: "high",
|
|
59
|
+
* title: "Send the deck to Mayfield",
|
|
60
|
+
* workspace_id: "ws_abc123-def456"
|
|
61
|
+
* })
|
|
62
|
+
*/
|
|
63
|
+
create(request: AthenaIntelligence.CreateTaskRequestIn, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.TaskOut>;
|
|
64
|
+
private __create;
|
|
65
|
+
/**
|
|
66
|
+
* 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.
|
|
67
|
+
*
|
|
68
|
+
* @param {AthenaIntelligence.GetTasksRequest} request
|
|
69
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
70
|
+
*
|
|
71
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
72
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
73
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
74
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await client.tasks.get({
|
|
78
|
+
* asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c"
|
|
79
|
+
* })
|
|
80
|
+
*/
|
|
81
|
+
get(request: AthenaIntelligence.GetTasksRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.TaskOut>;
|
|
82
|
+
private __get;
|
|
83
|
+
/**
|
|
84
|
+
* 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.
|
|
85
|
+
*
|
|
86
|
+
* @param {AthenaIntelligence.UpdateTaskRequestIn} request
|
|
87
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
88
|
+
*
|
|
89
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
90
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
91
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
92
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
93
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
94
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* await client.tasks.update({
|
|
98
|
+
* asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
|
|
99
|
+
* priority: "medium"
|
|
100
|
+
* })
|
|
101
|
+
*/
|
|
102
|
+
update(request: AthenaIntelligence.UpdateTaskRequestIn, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.TaskOut>;
|
|
103
|
+
private __update;
|
|
104
|
+
/**
|
|
105
|
+
* 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.
|
|
106
|
+
*
|
|
107
|
+
* @param {AthenaIntelligence.SetTaskStatusRequestIn} request
|
|
108
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
|
+
*
|
|
110
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
111
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
112
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
113
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
114
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* await client.tasks.setStatus({
|
|
118
|
+
* asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
|
|
119
|
+
* status: "done"
|
|
120
|
+
* })
|
|
121
|
+
*/
|
|
122
|
+
setStatus(request: AthenaIntelligence.SetTaskStatusRequestIn, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.TaskOut>;
|
|
123
|
+
private __setStatus;
|
|
124
|
+
}
|
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
23
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
24
|
+
import * as core from "../../../../core/index.mjs";
|
|
25
|
+
import * as environments from "../../../../environments.mjs";
|
|
26
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
27
|
+
import * as AthenaIntelligence from "../../../index.mjs";
|
|
28
|
+
export class TasksClient {
|
|
29
|
+
constructor(options = {}) {
|
|
30
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 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.
|
|
34
|
+
*
|
|
35
|
+
* @param {AthenaIntelligence.ListTasksRequest} request
|
|
36
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
+
*
|
|
38
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
39
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
40
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
41
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* await client.tasks.list({
|
|
45
|
+
* workspace_id: "ws_abc123-def456",
|
|
46
|
+
* limit: 50
|
|
47
|
+
* })
|
|
48
|
+
*/
|
|
49
|
+
list(request, requestOptions) {
|
|
50
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
51
|
+
}
|
|
52
|
+
__list(request, requestOptions) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
55
|
+
const { workspace_id: workspaceId, assignee_ref: assigneeRef, status, due_on_or_before: dueOnOrBefore, due_on_or_after: dueOnOrAfter, label, linked_id: linkedId, limit, } = request;
|
|
56
|
+
const _queryParams = {};
|
|
57
|
+
_queryParams.workspace_id = workspaceId;
|
|
58
|
+
if (assigneeRef !== undefined) {
|
|
59
|
+
_queryParams.assignee_ref = assigneeRef;
|
|
60
|
+
}
|
|
61
|
+
if (status != null) {
|
|
62
|
+
_queryParams.status = status;
|
|
63
|
+
}
|
|
64
|
+
if (dueOnOrBefore !== undefined) {
|
|
65
|
+
_queryParams.due_on_or_before = dueOnOrBefore;
|
|
66
|
+
}
|
|
67
|
+
if (dueOnOrAfter !== undefined) {
|
|
68
|
+
_queryParams.due_on_or_after = dueOnOrAfter;
|
|
69
|
+
}
|
|
70
|
+
if (label !== undefined) {
|
|
71
|
+
_queryParams.label = label;
|
|
72
|
+
}
|
|
73
|
+
if (linkedId !== undefined) {
|
|
74
|
+
_queryParams.linked_id = linkedId;
|
|
75
|
+
}
|
|
76
|
+
if (limit != null) {
|
|
77
|
+
_queryParams.limit = limit.toString();
|
|
78
|
+
}
|
|
79
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
80
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
81
|
+
"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,
|
|
82
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
83
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
84
|
+
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"),
|
|
85
|
+
method: "GET",
|
|
86
|
+
headers: _headers,
|
|
87
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
88
|
+
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,
|
|
89
|
+
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,
|
|
90
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
92
|
+
logging: this._options.logging,
|
|
93
|
+
});
|
|
94
|
+
if (_response.ok) {
|
|
95
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
96
|
+
}
|
|
97
|
+
if (_response.error.reason === "status-code") {
|
|
98
|
+
switch (_response.error.statusCode) {
|
|
99
|
+
case 400:
|
|
100
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
101
|
+
case 401:
|
|
102
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
103
|
+
case 403:
|
|
104
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
105
|
+
case 422:
|
|
106
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
107
|
+
default:
|
|
108
|
+
throw new errors.AthenaIntelligenceError({
|
|
109
|
+
statusCode: _response.error.statusCode,
|
|
110
|
+
body: _response.error.body,
|
|
111
|
+
rawResponse: _response.rawResponse,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
switch (_response.error.reason) {
|
|
116
|
+
case "non-json":
|
|
117
|
+
throw new errors.AthenaIntelligenceError({
|
|
118
|
+
statusCode: _response.error.statusCode,
|
|
119
|
+
body: _response.error.rawBody,
|
|
120
|
+
rawResponse: _response.rawResponse,
|
|
121
|
+
});
|
|
122
|
+
case "body-is-null":
|
|
123
|
+
throw new errors.AthenaIntelligenceError({
|
|
124
|
+
statusCode: _response.error.statusCode,
|
|
125
|
+
rawResponse: _response.rawResponse,
|
|
126
|
+
});
|
|
127
|
+
case "timeout":
|
|
128
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tasks.");
|
|
129
|
+
case "unknown":
|
|
130
|
+
throw new errors.AthenaIntelligenceError({
|
|
131
|
+
message: _response.error.errorMessage,
|
|
132
|
+
rawResponse: _response.rawResponse,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 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.
|
|
139
|
+
*
|
|
140
|
+
* @param {AthenaIntelligence.CreateTaskRequestIn} request
|
|
141
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
142
|
+
*
|
|
143
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
144
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
145
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
146
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
147
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
148
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* await client.tasks.create({
|
|
152
|
+
* due_date: "2026-11-13",
|
|
153
|
+
* due_time: "15:00",
|
|
154
|
+
* due_time_zone: "America/New_York",
|
|
155
|
+
* labels: [{
|
|
156
|
+
* name: "Investor"
|
|
157
|
+
* }],
|
|
158
|
+
* links: [{
|
|
159
|
+
* referenced: "external_url",
|
|
160
|
+
* url: "https://example.com"
|
|
161
|
+
* }],
|
|
162
|
+
* priority: "high",
|
|
163
|
+
* title: "Send the deck to Mayfield",
|
|
164
|
+
* workspace_id: "ws_abc123-def456"
|
|
165
|
+
* })
|
|
166
|
+
*/
|
|
167
|
+
create(request, requestOptions) {
|
|
168
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
169
|
+
}
|
|
170
|
+
__create(request, requestOptions) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
173
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
174
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
175
|
+
"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,
|
|
176
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
177
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
178
|
+
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"),
|
|
179
|
+
method: "POST",
|
|
180
|
+
headers: _headers,
|
|
181
|
+
contentType: "application/json",
|
|
182
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
183
|
+
requestType: "json",
|
|
184
|
+
body: request,
|
|
185
|
+
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,
|
|
186
|
+
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,
|
|
187
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
188
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
189
|
+
logging: this._options.logging,
|
|
190
|
+
});
|
|
191
|
+
if (_response.ok) {
|
|
192
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
193
|
+
}
|
|
194
|
+
if (_response.error.reason === "status-code") {
|
|
195
|
+
switch (_response.error.statusCode) {
|
|
196
|
+
case 400:
|
|
197
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
198
|
+
case 401:
|
|
199
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
200
|
+
case 403:
|
|
201
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
202
|
+
case 404:
|
|
203
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
204
|
+
case 422:
|
|
205
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
206
|
+
case 503:
|
|
207
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
208
|
+
default:
|
|
209
|
+
throw new errors.AthenaIntelligenceError({
|
|
210
|
+
statusCode: _response.error.statusCode,
|
|
211
|
+
body: _response.error.body,
|
|
212
|
+
rawResponse: _response.rawResponse,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
switch (_response.error.reason) {
|
|
217
|
+
case "non-json":
|
|
218
|
+
throw new errors.AthenaIntelligenceError({
|
|
219
|
+
statusCode: _response.error.statusCode,
|
|
220
|
+
body: _response.error.rawBody,
|
|
221
|
+
rawResponse: _response.rawResponse,
|
|
222
|
+
});
|
|
223
|
+
case "body-is-null":
|
|
224
|
+
throw new errors.AthenaIntelligenceError({
|
|
225
|
+
statusCode: _response.error.statusCode,
|
|
226
|
+
rawResponse: _response.rawResponse,
|
|
227
|
+
});
|
|
228
|
+
case "timeout":
|
|
229
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/tasks.");
|
|
230
|
+
case "unknown":
|
|
231
|
+
throw new errors.AthenaIntelligenceError({
|
|
232
|
+
message: _response.error.errorMessage,
|
|
233
|
+
rawResponse: _response.rawResponse,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 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.
|
|
240
|
+
*
|
|
241
|
+
* @param {AthenaIntelligence.GetTasksRequest} request
|
|
242
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
243
|
+
*
|
|
244
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
245
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
246
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
247
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* await client.tasks.get({
|
|
251
|
+
* asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c"
|
|
252
|
+
* })
|
|
253
|
+
*/
|
|
254
|
+
get(request, requestOptions) {
|
|
255
|
+
return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions));
|
|
256
|
+
}
|
|
257
|
+
__get(request, requestOptions) {
|
|
258
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
260
|
+
const { asset_id: assetId } = request;
|
|
261
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
262
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
263
|
+
"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,
|
|
264
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
265
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
266
|
+
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)}`),
|
|
267
|
+
method: "GET",
|
|
268
|
+
headers: _headers,
|
|
269
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
270
|
+
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,
|
|
271
|
+
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,
|
|
272
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
273
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
274
|
+
logging: this._options.logging,
|
|
275
|
+
});
|
|
276
|
+
if (_response.ok) {
|
|
277
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
278
|
+
}
|
|
279
|
+
if (_response.error.reason === "status-code") {
|
|
280
|
+
switch (_response.error.statusCode) {
|
|
281
|
+
case 401:
|
|
282
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
283
|
+
case 403:
|
|
284
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
285
|
+
case 404:
|
|
286
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
287
|
+
case 422:
|
|
288
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
289
|
+
default:
|
|
290
|
+
throw new errors.AthenaIntelligenceError({
|
|
291
|
+
statusCode: _response.error.statusCode,
|
|
292
|
+
body: _response.error.body,
|
|
293
|
+
rawResponse: _response.rawResponse,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
switch (_response.error.reason) {
|
|
298
|
+
case "non-json":
|
|
299
|
+
throw new errors.AthenaIntelligenceError({
|
|
300
|
+
statusCode: _response.error.statusCode,
|
|
301
|
+
body: _response.error.rawBody,
|
|
302
|
+
rawResponse: _response.rawResponse,
|
|
303
|
+
});
|
|
304
|
+
case "body-is-null":
|
|
305
|
+
throw new errors.AthenaIntelligenceError({
|
|
306
|
+
statusCode: _response.error.statusCode,
|
|
307
|
+
rawResponse: _response.rawResponse,
|
|
308
|
+
});
|
|
309
|
+
case "timeout":
|
|
310
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tasks/{asset_id}.");
|
|
311
|
+
case "unknown":
|
|
312
|
+
throw new errors.AthenaIntelligenceError({
|
|
313
|
+
message: _response.error.errorMessage,
|
|
314
|
+
rawResponse: _response.rawResponse,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* 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.
|
|
321
|
+
*
|
|
322
|
+
* @param {AthenaIntelligence.UpdateTaskRequestIn} request
|
|
323
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
324
|
+
*
|
|
325
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
326
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
327
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
328
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
329
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
330
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* await client.tasks.update({
|
|
334
|
+
* asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
|
|
335
|
+
* priority: "medium"
|
|
336
|
+
* })
|
|
337
|
+
*/
|
|
338
|
+
update(request, requestOptions) {
|
|
339
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
340
|
+
}
|
|
341
|
+
__update(request, requestOptions) {
|
|
342
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
343
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
344
|
+
const { asset_id: assetId } = request, _body = __rest(request, ["asset_id"]);
|
|
345
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
346
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
347
|
+
"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,
|
|
348
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
349
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
350
|
+
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)}`),
|
|
351
|
+
method: "PATCH",
|
|
352
|
+
headers: _headers,
|
|
353
|
+
contentType: "application/json",
|
|
354
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
355
|
+
requestType: "json",
|
|
356
|
+
body: _body,
|
|
357
|
+
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,
|
|
358
|
+
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,
|
|
359
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
360
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
361
|
+
logging: this._options.logging,
|
|
362
|
+
});
|
|
363
|
+
if (_response.ok) {
|
|
364
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
365
|
+
}
|
|
366
|
+
if (_response.error.reason === "status-code") {
|
|
367
|
+
switch (_response.error.statusCode) {
|
|
368
|
+
case 400:
|
|
369
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
370
|
+
case 401:
|
|
371
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
372
|
+
case 403:
|
|
373
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
374
|
+
case 404:
|
|
375
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
376
|
+
case 422:
|
|
377
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
378
|
+
case 503:
|
|
379
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
380
|
+
default:
|
|
381
|
+
throw new errors.AthenaIntelligenceError({
|
|
382
|
+
statusCode: _response.error.statusCode,
|
|
383
|
+
body: _response.error.body,
|
|
384
|
+
rawResponse: _response.rawResponse,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
switch (_response.error.reason) {
|
|
389
|
+
case "non-json":
|
|
390
|
+
throw new errors.AthenaIntelligenceError({
|
|
391
|
+
statusCode: _response.error.statusCode,
|
|
392
|
+
body: _response.error.rawBody,
|
|
393
|
+
rawResponse: _response.rawResponse,
|
|
394
|
+
});
|
|
395
|
+
case "body-is-null":
|
|
396
|
+
throw new errors.AthenaIntelligenceError({
|
|
397
|
+
statusCode: _response.error.statusCode,
|
|
398
|
+
rawResponse: _response.rawResponse,
|
|
399
|
+
});
|
|
400
|
+
case "timeout":
|
|
401
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling PATCH /api/v0/tasks/{asset_id}.");
|
|
402
|
+
case "unknown":
|
|
403
|
+
throw new errors.AthenaIntelligenceError({
|
|
404
|
+
message: _response.error.errorMessage,
|
|
405
|
+
rawResponse: _response.rawResponse,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* 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.
|
|
412
|
+
*
|
|
413
|
+
* @param {AthenaIntelligence.SetTaskStatusRequestIn} request
|
|
414
|
+
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
415
|
+
*
|
|
416
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
417
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
418
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
419
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
420
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* await client.tasks.setStatus({
|
|
424
|
+
* asset_id: "asset_7c1e5b2a-4f3d-4e8a-9b6c-1d2e3f4a5b6c",
|
|
425
|
+
* status: "done"
|
|
426
|
+
* })
|
|
427
|
+
*/
|
|
428
|
+
setStatus(request, requestOptions) {
|
|
429
|
+
return core.HttpResponsePromise.fromPromise(this.__setStatus(request, requestOptions));
|
|
430
|
+
}
|
|
431
|
+
__setStatus(request, requestOptions) {
|
|
432
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
434
|
+
const { asset_id: assetId } = request, _body = __rest(request, ["asset_id"]);
|
|
435
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
436
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
437
|
+
"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,
|
|
438
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
439
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
440
|
+
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`),
|
|
441
|
+
method: "POST",
|
|
442
|
+
headers: _headers,
|
|
443
|
+
contentType: "application/json",
|
|
444
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
445
|
+
requestType: "json",
|
|
446
|
+
body: _body,
|
|
447
|
+
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,
|
|
448
|
+
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,
|
|
449
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
450
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
451
|
+
logging: this._options.logging,
|
|
452
|
+
});
|
|
453
|
+
if (_response.ok) {
|
|
454
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
455
|
+
}
|
|
456
|
+
if (_response.error.reason === "status-code") {
|
|
457
|
+
switch (_response.error.statusCode) {
|
|
458
|
+
case 401:
|
|
459
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
460
|
+
case 403:
|
|
461
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
462
|
+
case 404:
|
|
463
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
464
|
+
case 422:
|
|
465
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
466
|
+
case 503:
|
|
467
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
468
|
+
default:
|
|
469
|
+
throw new errors.AthenaIntelligenceError({
|
|
470
|
+
statusCode: _response.error.statusCode,
|
|
471
|
+
body: _response.error.body,
|
|
472
|
+
rawResponse: _response.rawResponse,
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
switch (_response.error.reason) {
|
|
477
|
+
case "non-json":
|
|
478
|
+
throw new errors.AthenaIntelligenceError({
|
|
479
|
+
statusCode: _response.error.statusCode,
|
|
480
|
+
body: _response.error.rawBody,
|
|
481
|
+
rawResponse: _response.rawResponse,
|
|
482
|
+
});
|
|
483
|
+
case "body-is-null":
|
|
484
|
+
throw new errors.AthenaIntelligenceError({
|
|
485
|
+
statusCode: _response.error.statusCode,
|
|
486
|
+
rawResponse: _response.rawResponse,
|
|
487
|
+
});
|
|
488
|
+
case "timeout":
|
|
489
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/tasks/{asset_id}/status.");
|
|
490
|
+
case "unknown":
|
|
491
|
+
throw new errors.AthenaIntelligenceError({
|
|
492
|
+
message: _response.error.errorMessage,
|
|
493
|
+
rawResponse: _response.rawResponse,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|