@athenaintel/sdk 4.3.2158 → 4.3.2160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -16
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +2 -2
- package/dist/cjs/Client.js +4 -4
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -41
- package/dist/cjs/api/resources/agents/client/Client.js +2 -163
- package/dist/cjs/api/resources/agents/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/index.js +0 -15
- package/dist/cjs/api/resources/agents/resources/general/client/Client.d.ts +2 -44
- package/dist/cjs/api/resources/agents/resources/general/client/Client.js +1 -163
- package/dist/cjs/api/resources/agents/resources/general/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/resources/general/client/index.js +15 -0
- package/dist/cjs/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.d.ts +11 -2
- package/dist/cjs/api/resources/agents/resources/general/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/agents/resources/index.d.ts +1 -6
- package/dist/cjs/api/resources/agents/resources/index.js +2 -7
- package/dist/cjs/api/resources/index.d.ts +0 -1
- package/dist/cjs/api/resources/index.js +3 -4
- package/dist/cjs/api/resources/tools/client/Client.d.ts +11 -0
- package/dist/cjs/api/resources/tools/client/Client.js +11 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/Client.d.ts +20 -13
- package/dist/cjs/api/resources/tools/resources/calendar/client/Client.js +70 -71
- package/dist/cjs/api/resources/tools/resources/calendar/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/calendar/client/index.js +15 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/requests/ListEventsCalendarRequest.d.ts +22 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tools/resources/email/client/Client.d.ts +40 -16
- package/dist/cjs/api/resources/tools/resources/email/client/Client.js +105 -82
- package/dist/cjs/api/resources/tools/resources/email/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/email/client/index.js +15 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/EmailDraftRequestIn.d.ts +27 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/SearchEmailRequest.d.ts +15 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/tools/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/tools/resources/index.js +5 -3
- package/dist/cjs/api/types/CalendarAttendeeOut.d.ts +11 -0
- package/dist/cjs/api/types/CalendarEventOut.d.ts +28 -0
- package/dist/cjs/api/types/CalendarEventsResponseOut.d.ts +14 -0
- package/dist/cjs/api/types/EmailDraftResponseOut.d.ts +23 -0
- package/dist/cjs/api/types/EmailSearchResponseOut.d.ts +22 -0
- package/dist/cjs/api/types/EmailSearchResultOut.d.ts +25 -0
- package/dist/cjs/api/types/EmailSearchResultOut.js +3 -0
- package/dist/cjs/api/types/index.d.ts +6 -5
- package/dist/cjs/api/types/index.js +6 -5
- 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 +2 -2
- package/dist/esm/Client.mjs +4 -4
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +1 -41
- package/dist/esm/api/resources/agents/client/Client.mjs +0 -128
- package/dist/esm/api/resources/agents/client/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/index.mjs +1 -1
- package/dist/esm/api/resources/agents/resources/general/client/Client.d.mts +2 -44
- package/dist/esm/api/resources/agents/resources/general/client/Client.mjs +1 -163
- package/dist/esm/api/resources/agents/resources/general/client/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/resources/general/client/index.mjs +1 -1
- package/dist/esm/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.d.mts +11 -2
- package/dist/esm/api/resources/agents/resources/general/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/agents/resources/index.d.mts +1 -6
- package/dist/esm/api/resources/agents/resources/index.mjs +1 -6
- package/dist/esm/api/resources/index.d.mts +0 -1
- package/dist/esm/api/resources/index.mjs +0 -1
- package/dist/esm/api/resources/tools/client/Client.d.mts +11 -0
- package/dist/esm/api/resources/tools/client/Client.mjs +11 -0
- package/dist/esm/api/resources/tools/resources/calendar/client/Client.d.mts +20 -13
- package/dist/esm/api/resources/tools/resources/calendar/client/Client.mjs +70 -71
- package/dist/esm/api/resources/tools/resources/calendar/client/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/calendar/client/index.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/calendar/client/requests/ListEventsCalendarRequest.d.mts +22 -0
- package/dist/esm/api/resources/tools/resources/calendar/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tools/resources/email/client/Client.d.mts +40 -16
- package/dist/esm/api/resources/tools/resources/email/client/Client.mjs +105 -82
- package/dist/esm/api/resources/tools/resources/email/client/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/email/client/index.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/email/client/requests/EmailDraftRequestIn.d.mts +27 -0
- package/dist/esm/api/resources/tools/resources/email/client/requests/SearchEmailRequest.d.mts +15 -0
- package/dist/esm/api/resources/tools/resources/email/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/tools/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/tools/resources/index.mjs +2 -0
- package/dist/esm/api/types/CalendarAttendeeOut.d.mts +11 -0
- package/dist/esm/api/types/CalendarEventOut.d.mts +28 -0
- package/dist/esm/api/types/CalendarEventsResponseOut.d.mts +14 -0
- package/dist/esm/api/types/EmailDraftResponseOut.d.mts +23 -0
- package/dist/esm/api/types/EmailSearchResponseOut.d.mts +22 -0
- package/dist/esm/api/types/EmailSearchResultOut.d.mts +25 -0
- package/dist/esm/api/types/EmailSearchResultOut.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +6 -5
- package/dist/esm/api/types/index.mjs +6 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +61 -532
- package/dist/cjs/api/resources/agents/client/requests/CustomAgentRequest.d.ts +0 -20
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/client/Client.d.ts +0 -34
- package/dist/cjs/api/resources/agents/resources/drive/client/Client.js +0 -138
- package/dist/cjs/api/resources/agents/resources/drive/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/client/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/drive/client/requests/DriveAgentRequest.d.ts +0 -17
- package/dist/cjs/api/resources/agents/resources/drive/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/research/client/Client.d.ts +0 -34
- package/dist/cjs/api/resources/agents/resources/research/client/Client.js +0 -138
- package/dist/cjs/api/resources/agents/resources/research/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/client/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/research/client/requests/ResearchAgentRequest.d.ts +0 -17
- package/dist/cjs/api/resources/agents/resources/research/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/Client.d.ts +0 -34
- package/dist/cjs/api/resources/agents/resources/sql/client/Client.js +0 -135
- package/dist/cjs/api/resources/agents/resources/sql/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/client/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/SqlAgentRequest.d.ts +0 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/agents/resources/sql/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/index.js +0 -17
- package/dist/cjs/api/types/CustomAgentResponse.d.ts +0 -4
- package/dist/cjs/api/types/DriveAgentResponse.d.ts +0 -4
- package/dist/cjs/api/types/ResearchAgentResponse.d.ts +0 -4
- package/dist/cjs/api/types/SqlAgentResponse.d.ts +0 -6
- package/dist/esm/api/resources/agents/client/requests/CustomAgentRequest.d.mts +0 -20
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/Client.d.mts +0 -34
- package/dist/esm/api/resources/agents/resources/drive/client/Client.mjs +0 -101
- package/dist/esm/api/resources/agents/resources/drive/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/requests/DriveAgentRequest.d.mts +0 -17
- package/dist/esm/api/resources/agents/resources/drive/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/Client.d.mts +0 -34
- package/dist/esm/api/resources/agents/resources/research/client/Client.mjs +0 -101
- package/dist/esm/api/resources/agents/resources/research/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/requests/ResearchAgentRequest.d.mts +0 -17
- package/dist/esm/api/resources/agents/resources/research/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/Client.d.mts +0 -34
- package/dist/esm/api/resources/agents/resources/sql/client/Client.mjs +0 -98
- package/dist/esm/api/resources/agents/resources/sql/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/requests/SqlAgentRequest.d.mts +0 -17
- package/dist/esm/api/resources/agents/resources/sql/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/index.mjs +0 -1
- package/dist/esm/api/types/CustomAgentResponse.d.mts +0 -4
- package/dist/esm/api/types/DriveAgentResponse.d.mts +0 -4
- package/dist/esm/api/types/ResearchAgentResponse.d.mts +0 -4
- package/dist/esm/api/types/SqlAgentResponse.d.mts +0 -6
- /package/dist/cjs/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.js +0 -0
- /package/dist/cjs/api/resources/agents/{client → resources/general/client}/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{agents/client/requests/CustomAgentRequest.js → tools/resources/calendar/client/requests/ListEventsCalendarRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agents/resources/drive → tools/resources/calendar}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{agents/resources/drive/client/requests/DriveAgentRequest.js → tools/resources/email/client/requests/EmailDraftRequestIn.js} +0 -0
- /package/dist/cjs/api/resources/{agents/resources/research/client/requests/ResearchAgentRequest.js → tools/resources/email/client/requests/SearchEmailRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agents/resources/research → tools/resources/email}/client/requests/index.js +0 -0
- /package/dist/cjs/api/{resources/agents/resources/sql/client/requests/SqlAgentRequest.js → types/CalendarAttendeeOut.js} +0 -0
- /package/dist/cjs/api/types/{CustomAgentResponse.js → CalendarEventOut.js} +0 -0
- /package/dist/cjs/api/types/{DriveAgentResponse.js → CalendarEventsResponseOut.js} +0 -0
- /package/dist/cjs/api/types/{ResearchAgentResponse.js → EmailDraftResponseOut.js} +0 -0
- /package/dist/cjs/api/types/{SqlAgentResponse.js → EmailSearchResponseOut.js} +0 -0
- /package/dist/esm/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.mjs +0 -0
- /package/dist/esm/api/resources/agents/{client → resources/general/client}/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{agents/client/requests/CustomAgentRequest.mjs → tools/resources/calendar/client/requests/ListEventsCalendarRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agents/resources/drive → tools/resources/calendar}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{agents/resources/drive/client/requests/DriveAgentRequest.mjs → tools/resources/email/client/requests/EmailDraftRequestIn.mjs} +0 -0
- /package/dist/esm/api/resources/{agents/resources/research/client/requests/ResearchAgentRequest.mjs → tools/resources/email/client/requests/SearchEmailRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agents/resources/research → tools/resources/email}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/{resources/agents/resources/sql/client/requests/SqlAgentRequest.mjs → types/CalendarAttendeeOut.mjs} +0 -0
- /package/dist/esm/api/types/{CustomAgentResponse.mjs → CalendarEventOut.mjs} +0 -0
- /package/dist/esm/api/types/{DriveAgentResponse.mjs → CalendarEventsResponseOut.mjs} +0 -0
- /package/dist/esm/api/types/{ResearchAgentResponse.mjs → EmailDraftResponseOut.mjs} +0 -0
- /package/dist/esm/api/types/{SqlAgentResponse.mjs → EmailSearchResponseOut.mjs} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
3
|
import * as core from "../../../../../../core/index.mjs";
|
|
4
|
+
import * as AthenaIntelligence from "../../../../../index.mjs";
|
|
4
5
|
export declare namespace CalendarClient {
|
|
5
6
|
interface Options extends BaseClientOptions {
|
|
6
7
|
}
|
|
@@ -11,23 +12,29 @@ export declare class CalendarClient {
|
|
|
11
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<CalendarClient.Options>;
|
|
12
13
|
constructor(options?: CalendarClient.Options);
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* List events on the calendar of the caller's connected account.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
listEvents(requestOptions?: CalendarClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
22
|
-
private __listEvents;
|
|
23
|
-
/**
|
|
24
|
-
* Coming soon! Create new calendar events.
|
|
17
|
+
* Reads the primary Google Calendar of a Gmail account or the default calendar
|
|
18
|
+
* of an Outlook account. `start`/`end` select the events overlapping that
|
|
19
|
+
* window; without them, Outlook returns recurring series as single entries, so
|
|
20
|
+
* supply a window to expand them. `title`, `location` and `attendees` filter the
|
|
21
|
+
* events that were read.
|
|
25
22
|
*
|
|
23
|
+
* @param {AthenaIntelligence.tools.ListEventsCalendarRequest} request
|
|
26
24
|
* @param {CalendarClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
25
|
*
|
|
26
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
27
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
28
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
29
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
30
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
31
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
32
|
+
*
|
|
28
33
|
* @example
|
|
29
|
-
* await client.tools.calendar.
|
|
34
|
+
* await client.tools.calendar.listEvents({
|
|
35
|
+
* limit: 50
|
|
36
|
+
* })
|
|
30
37
|
*/
|
|
31
|
-
|
|
32
|
-
private
|
|
38
|
+
listEvents(request?: AthenaIntelligence.tools.ListEventsCalendarRequest, requestOptions?: CalendarClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.CalendarEventsResponseOut>;
|
|
39
|
+
private __listEvents;
|
|
33
40
|
}
|
|
@@ -13,90 +13,71 @@ import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
|
13
13
|
import * as core from "../../../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../../../errors/index.mjs";
|
|
16
|
+
import * as AthenaIntelligence from "../../../../../index.mjs";
|
|
16
17
|
export class CalendarClient {
|
|
17
18
|
constructor(options = {}) {
|
|
18
19
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* List events on the calendar of the caller's connected account.
|
|
22
23
|
*
|
|
24
|
+
* Reads the primary Google Calendar of a Gmail account or the default calendar
|
|
25
|
+
* of an Outlook account. `start`/`end` select the events overlapping that
|
|
26
|
+
* window; without them, Outlook returns recurring series as single entries, so
|
|
27
|
+
* supply a window to expand them. `title`, `location` and `attendees` filter the
|
|
28
|
+
* events that were read.
|
|
29
|
+
*
|
|
30
|
+
* @param {AthenaIntelligence.tools.ListEventsCalendarRequest} request
|
|
23
31
|
* @param {CalendarClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
32
|
*
|
|
33
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
34
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
35
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
36
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
37
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
38
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
39
|
+
*
|
|
25
40
|
* @example
|
|
26
|
-
* await client.tools.calendar.listEvents(
|
|
41
|
+
* await client.tools.calendar.listEvents({
|
|
42
|
+
* limit: 50
|
|
43
|
+
* })
|
|
27
44
|
*/
|
|
28
|
-
listEvents(requestOptions) {
|
|
29
|
-
return core.HttpResponsePromise.fromPromise(this.__listEvents(requestOptions));
|
|
45
|
+
listEvents(request = {}, requestOptions) {
|
|
46
|
+
return core.HttpResponsePromise.fromPromise(this.__listEvents(request, requestOptions));
|
|
30
47
|
}
|
|
31
|
-
__listEvents(
|
|
32
|
-
return __awaiter(this,
|
|
48
|
+
__listEvents() {
|
|
49
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
33
50
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
method: "GET",
|
|
39
|
-
headers: _headers,
|
|
40
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
41
|
-
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
42
|
-
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
43
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
44
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
45
|
-
logging: this._options.logging,
|
|
46
|
-
});
|
|
47
|
-
if (_response.ok) {
|
|
48
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
51
|
+
const { title, start, end, location, attendees, limit, catalog_id: catalogId } = request;
|
|
52
|
+
const _queryParams = {};
|
|
53
|
+
if (title !== undefined) {
|
|
54
|
+
_queryParams.title = title;
|
|
49
55
|
}
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
statusCode: _response.error.statusCode,
|
|
53
|
-
body: _response.error.body,
|
|
54
|
-
rawResponse: _response.rawResponse,
|
|
55
|
-
});
|
|
56
|
+
if (start !== undefined) {
|
|
57
|
+
_queryParams.start = start;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
case "unknown":
|
|
72
|
-
throw new errors.AthenaIntelligenceError({
|
|
73
|
-
message: _response.error.errorMessage,
|
|
74
|
-
rawResponse: _response.rawResponse,
|
|
75
|
-
});
|
|
59
|
+
if (end !== undefined) {
|
|
60
|
+
_queryParams.end = end;
|
|
61
|
+
}
|
|
62
|
+
if (location !== undefined) {
|
|
63
|
+
_queryParams.location = location;
|
|
64
|
+
}
|
|
65
|
+
if (attendees !== undefined) {
|
|
66
|
+
_queryParams.attendees = attendees;
|
|
67
|
+
}
|
|
68
|
+
if (limit != null) {
|
|
69
|
+
_queryParams.limit = limit.toString();
|
|
70
|
+
}
|
|
71
|
+
if (catalogId !== undefined) {
|
|
72
|
+
_queryParams.catalog_id = catalogId;
|
|
76
73
|
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Coming soon! Create new calendar events.
|
|
81
|
-
*
|
|
82
|
-
* @param {CalendarClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* await client.tools.calendar.createEvent()
|
|
86
|
-
*/
|
|
87
|
-
createEvent(requestOptions) {
|
|
88
|
-
return core.HttpResponsePromise.fromPromise(this.__createEvent(requestOptions));
|
|
89
|
-
}
|
|
90
|
-
__createEvent(requestOptions) {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
93
74
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
94
75
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
95
76
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
96
77
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/tools/calendar/events"),
|
|
97
|
-
method: "
|
|
78
|
+
method: "GET",
|
|
98
79
|
headers: _headers,
|
|
99
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
80
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
100
81
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
101
82
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
102
83
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -104,14 +85,32 @@ export class CalendarClient {
|
|
|
104
85
|
logging: this._options.logging,
|
|
105
86
|
});
|
|
106
87
|
if (_response.ok) {
|
|
107
|
-
return {
|
|
88
|
+
return {
|
|
89
|
+
data: _response.body,
|
|
90
|
+
rawResponse: _response.rawResponse,
|
|
91
|
+
};
|
|
108
92
|
}
|
|
109
93
|
if (_response.error.reason === "status-code") {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
switch (_response.error.statusCode) {
|
|
95
|
+
case 400:
|
|
96
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
97
|
+
case 403:
|
|
98
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
99
|
+
case 404:
|
|
100
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
101
|
+
case 422:
|
|
102
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
103
|
+
case 429:
|
|
104
|
+
throw new AthenaIntelligence.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
105
|
+
case 502:
|
|
106
|
+
throw new AthenaIntelligence.BadGatewayError(_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
|
+
}
|
|
115
114
|
}
|
|
116
115
|
switch (_response.error.reason) {
|
|
117
116
|
case "non-json":
|
|
@@ -126,7 +125,7 @@ export class CalendarClient {
|
|
|
126
125
|
rawResponse: _response.rawResponse,
|
|
127
126
|
});
|
|
128
127
|
case "timeout":
|
|
129
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling
|
|
128
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tools/calendar/events.");
|
|
130
129
|
case "unknown":
|
|
131
130
|
throw new errors.AthenaIntelligenceError({
|
|
132
131
|
message: _response.error.errorMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* limit: 50
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface ListEventsCalendarRequest {
|
|
8
|
+
/** Text filter. On Outlook this matches the event title only (`contains(subject, …)`); on Google Calendar it is Google's free-text event search (`q`), which also matches the description, location and attendee names. */
|
|
9
|
+
title?: string | null;
|
|
10
|
+
/** Window start. `start` and `end` select events that overlap the window: an event that begins before `start` but is still running at `start` is included. ISO 8601 with an explicit UTC offset or Z (e.g. `2026-10-01T00:00:00-04:00`); the instant is forwarded in RFC 3339 form. Recurring series are expanded into their instances inside the window. Given only one bound, Google leaves the other side open while Outlook derives it 60 days away. */
|
|
11
|
+
start?: string | null;
|
|
12
|
+
/** Window end (see `start`); must be later than `start` when both are given. ISO 8601 with an explicit UTC offset or Z. */
|
|
13
|
+
end?: string | null;
|
|
14
|
+
/** Only events whose location contains this text. Applied after up to `limit` events have been read from the provider, so narrow the window with `start`/`end` when looking for a specific event. */
|
|
15
|
+
location?: string | null;
|
|
16
|
+
/** Only events with at least one of these attendee emails (comma-separated). Applied after up to `limit` events have been read from the provider, so narrow the window with `start`/`end` when looking for a specific event. */
|
|
17
|
+
attendees?: string | null;
|
|
18
|
+
/** Maximum number of events (1-200). */
|
|
19
|
+
limit?: number;
|
|
20
|
+
/** Connected email account to use, as the catalog asset id returned by the Athena UI or the assets API. Defaults to the caller's default email account. An id that is not one of the caller's own connected accounts in the current workspace is a 404. */
|
|
21
|
+
catalog_id?: string | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ListEventsCalendarRequest } from "./ListEventsCalendarRequest.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
3
|
import * as core from "../../../../../../core/index.mjs";
|
|
4
|
+
import * as AthenaIntelligence from "../../../../../index.mjs";
|
|
4
5
|
export declare namespace EmailClient {
|
|
5
6
|
interface Options extends BaseClientOptions {
|
|
6
7
|
}
|
|
@@ -11,33 +12,56 @@ export declare class EmailClient {
|
|
|
11
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<EmailClient.Options>;
|
|
12
13
|
constructor(options?: EmailClient.Options);
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Save a draft in the caller's connected Gmail or Outlook account.
|
|
15
16
|
*
|
|
17
|
+
* Nothing is sent. The draft appears in the account's Drafts folder, where it
|
|
18
|
+
* is reviewed, edited and sent from the mail client — that review step is why
|
|
19
|
+
* drafting is available here while sending is not. Set `reply_to_message_id`
|
|
20
|
+
* to thread the draft as a reply.
|
|
21
|
+
*
|
|
22
|
+
* @param {AthenaIntelligence.tools.EmailDraftRequestIn} request
|
|
16
23
|
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
24
|
*
|
|
25
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
26
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
27
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
28
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
29
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
30
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
31
|
+
*
|
|
18
32
|
* @example
|
|
19
|
-
* await client.tools.email.createDraft(
|
|
33
|
+
* await client.tools.email.createDraft({
|
|
34
|
+
* body: "Hi Ada,<br><br>Attached below is the Q3 forecast summary.",
|
|
35
|
+
* cc: ["grace@example.com"],
|
|
36
|
+
* subject: "Q3 forecast",
|
|
37
|
+
* to: ["ada@example.com"]
|
|
38
|
+
* })
|
|
20
39
|
*/
|
|
21
|
-
createDraft(requestOptions?: EmailClient.RequestOptions): core.HttpResponsePromise<
|
|
40
|
+
createDraft(request: AthenaIntelligence.tools.EmailDraftRequestIn, requestOptions?: EmailClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.EmailDraftResponseOut>;
|
|
22
41
|
private __createDraft;
|
|
23
42
|
/**
|
|
24
|
-
*
|
|
43
|
+
* Search the caller's connected Gmail or Outlook mailbox.
|
|
25
44
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* await client.tools.email.search()
|
|
30
|
-
*/
|
|
31
|
-
search(requestOptions?: EmailClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
32
|
-
private __search;
|
|
33
|
-
/**
|
|
34
|
-
* Coming soon! Send emails to specified recipients.
|
|
45
|
+
* Results come from the connected account the caller can access in their
|
|
46
|
+
* current workspace (the default account unless `catalog_id` names another).
|
|
47
|
+
* Unsent drafts are included and flagged with `is_draft`.
|
|
35
48
|
*
|
|
49
|
+
* @param {AthenaIntelligence.tools.SearchEmailRequest} request
|
|
36
50
|
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
51
|
*
|
|
52
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
53
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
54
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
55
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
56
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
57
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
58
|
+
*
|
|
38
59
|
* @example
|
|
39
|
-
* await client.tools.email.
|
|
60
|
+
* await client.tools.email.search({
|
|
61
|
+
* query: "from:ada@example.com newer_than:7d",
|
|
62
|
+
* limit: 20
|
|
63
|
+
* })
|
|
40
64
|
*/
|
|
41
|
-
|
|
42
|
-
private
|
|
65
|
+
search(request: AthenaIntelligence.tools.SearchEmailRequest, requestOptions?: EmailClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.EmailSearchResponseOut>;
|
|
66
|
+
private __search;
|
|
43
67
|
}
|
|
@@ -13,22 +13,41 @@ import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
|
13
13
|
import * as core from "../../../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../../../errors/index.mjs";
|
|
16
|
+
import * as AthenaIntelligence from "../../../../../index.mjs";
|
|
16
17
|
export class EmailClient {
|
|
17
18
|
constructor(options = {}) {
|
|
18
19
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* Save a draft in the caller's connected Gmail or Outlook account.
|
|
22
23
|
*
|
|
24
|
+
* Nothing is sent. The draft appears in the account's Drafts folder, where it
|
|
25
|
+
* is reviewed, edited and sent from the mail client — that review step is why
|
|
26
|
+
* drafting is available here while sending is not. Set `reply_to_message_id`
|
|
27
|
+
* to thread the draft as a reply.
|
|
28
|
+
*
|
|
29
|
+
* @param {AthenaIntelligence.tools.EmailDraftRequestIn} request
|
|
23
30
|
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
31
|
*
|
|
32
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
33
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
34
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
35
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
36
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
37
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
38
|
+
*
|
|
25
39
|
* @example
|
|
26
|
-
* await client.tools.email.createDraft(
|
|
40
|
+
* await client.tools.email.createDraft({
|
|
41
|
+
* body: "Hi Ada,<br><br>Attached below is the Q3 forecast summary.",
|
|
42
|
+
* cc: ["grace@example.com"],
|
|
43
|
+
* subject: "Q3 forecast",
|
|
44
|
+
* to: ["ada@example.com"]
|
|
45
|
+
* })
|
|
27
46
|
*/
|
|
28
|
-
createDraft(requestOptions) {
|
|
29
|
-
return core.HttpResponsePromise.fromPromise(this.__createDraft(requestOptions));
|
|
47
|
+
createDraft(request, requestOptions) {
|
|
48
|
+
return core.HttpResponsePromise.fromPromise(this.__createDraft(request, requestOptions));
|
|
30
49
|
}
|
|
31
|
-
__createDraft(requestOptions) {
|
|
50
|
+
__createDraft(request, requestOptions) {
|
|
32
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
52
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
34
53
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -37,7 +56,10 @@ export class EmailClient {
|
|
|
37
56
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/tools/email/draft"),
|
|
38
57
|
method: "POST",
|
|
39
58
|
headers: _headers,
|
|
59
|
+
contentType: "application/json",
|
|
40
60
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
61
|
+
requestType: "json",
|
|
62
|
+
body: request,
|
|
41
63
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
42
64
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
43
65
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -45,14 +67,32 @@ export class EmailClient {
|
|
|
45
67
|
logging: this._options.logging,
|
|
46
68
|
});
|
|
47
69
|
if (_response.ok) {
|
|
48
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
data: _response.body,
|
|
72
|
+
rawResponse: _response.rawResponse,
|
|
73
|
+
};
|
|
49
74
|
}
|
|
50
75
|
if (_response.error.reason === "status-code") {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
76
|
+
switch (_response.error.statusCode) {
|
|
77
|
+
case 400:
|
|
78
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
79
|
+
case 403:
|
|
80
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
81
|
+
case 404:
|
|
82
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
83
|
+
case 422:
|
|
84
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
85
|
+
case 429:
|
|
86
|
+
throw new AthenaIntelligence.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
87
|
+
case 502:
|
|
88
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
89
|
+
default:
|
|
90
|
+
throw new errors.AthenaIntelligenceError({
|
|
91
|
+
statusCode: _response.error.statusCode,
|
|
92
|
+
body: _response.error.body,
|
|
93
|
+
rawResponse: _response.rawResponse,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
56
96
|
}
|
|
57
97
|
switch (_response.error.reason) {
|
|
58
98
|
case "non-json":
|
|
@@ -77,26 +117,50 @@ export class EmailClient {
|
|
|
77
117
|
});
|
|
78
118
|
}
|
|
79
119
|
/**
|
|
80
|
-
*
|
|
120
|
+
* Search the caller's connected Gmail or Outlook mailbox.
|
|
81
121
|
*
|
|
122
|
+
* Results come from the connected account the caller can access in their
|
|
123
|
+
* current workspace (the default account unless `catalog_id` names another).
|
|
124
|
+
* Unsent drafts are included and flagged with `is_draft`.
|
|
125
|
+
*
|
|
126
|
+
* @param {AthenaIntelligence.tools.SearchEmailRequest} request
|
|
82
127
|
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
83
128
|
*
|
|
129
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
130
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
131
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
132
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
133
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
134
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
135
|
+
*
|
|
84
136
|
* @example
|
|
85
|
-
* await client.tools.email.search(
|
|
137
|
+
* await client.tools.email.search({
|
|
138
|
+
* query: "from:ada@example.com newer_than:7d",
|
|
139
|
+
* limit: 20
|
|
140
|
+
* })
|
|
86
141
|
*/
|
|
87
|
-
search(requestOptions) {
|
|
88
|
-
return core.HttpResponsePromise.fromPromise(this.__search(requestOptions));
|
|
142
|
+
search(request, requestOptions) {
|
|
143
|
+
return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
|
|
89
144
|
}
|
|
90
|
-
__search(requestOptions) {
|
|
145
|
+
__search(request, requestOptions) {
|
|
91
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
147
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
148
|
+
const { query, catalog_id: catalogId, limit } = request;
|
|
149
|
+
const _queryParams = {};
|
|
150
|
+
_queryParams.query = query;
|
|
151
|
+
if (catalogId !== undefined) {
|
|
152
|
+
_queryParams.catalog_id = catalogId;
|
|
153
|
+
}
|
|
154
|
+
if (limit != null) {
|
|
155
|
+
_queryParams.limit = limit.toString();
|
|
156
|
+
}
|
|
93
157
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
94
158
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
95
159
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
96
160
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/tools/email/search"),
|
|
97
161
|
method: "GET",
|
|
98
162
|
headers: _headers,
|
|
99
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
163
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
100
164
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
101
165
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
102
166
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -104,73 +168,32 @@ export class EmailClient {
|
|
|
104
168
|
logging: this._options.logging,
|
|
105
169
|
});
|
|
106
170
|
if (_response.ok) {
|
|
107
|
-
return {
|
|
108
|
-
|
|
109
|
-
if (_response.error.reason === "status-code") {
|
|
110
|
-
throw new errors.AthenaIntelligenceError({
|
|
111
|
-
statusCode: _response.error.statusCode,
|
|
112
|
-
body: _response.error.body,
|
|
171
|
+
return {
|
|
172
|
+
data: _response.body,
|
|
113
173
|
rawResponse: _response.rawResponse,
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
switch (_response.error.reason) {
|
|
117
|
-
case "non-json":
|
|
118
|
-
throw new errors.AthenaIntelligenceError({
|
|
119
|
-
statusCode: _response.error.statusCode,
|
|
120
|
-
body: _response.error.rawBody,
|
|
121
|
-
rawResponse: _response.rawResponse,
|
|
122
|
-
});
|
|
123
|
-
case "body-is-null":
|
|
124
|
-
throw new errors.AthenaIntelligenceError({
|
|
125
|
-
statusCode: _response.error.statusCode,
|
|
126
|
-
rawResponse: _response.rawResponse,
|
|
127
|
-
});
|
|
128
|
-
case "timeout":
|
|
129
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tools/email/search.");
|
|
130
|
-
case "unknown":
|
|
131
|
-
throw new errors.AthenaIntelligenceError({
|
|
132
|
-
message: _response.error.errorMessage,
|
|
133
|
-
rawResponse: _response.rawResponse,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Coming soon! Send emails to specified recipients.
|
|
140
|
-
*
|
|
141
|
-
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* await client.tools.email.send()
|
|
145
|
-
*/
|
|
146
|
-
send(requestOptions) {
|
|
147
|
-
return core.HttpResponsePromise.fromPromise(this.__send(requestOptions));
|
|
148
|
-
}
|
|
149
|
-
__send(requestOptions) {
|
|
150
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
152
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
153
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
154
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
155
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/tools/email/send"),
|
|
156
|
-
method: "POST",
|
|
157
|
-
headers: _headers,
|
|
158
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
159
|
-
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
160
|
-
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
161
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
162
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
163
|
-
logging: this._options.logging,
|
|
164
|
-
});
|
|
165
|
-
if (_response.ok) {
|
|
166
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
174
|
+
};
|
|
167
175
|
}
|
|
168
176
|
if (_response.error.reason === "status-code") {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
switch (_response.error.statusCode) {
|
|
178
|
+
case 400:
|
|
179
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
180
|
+
case 403:
|
|
181
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
182
|
+
case 404:
|
|
183
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
184
|
+
case 422:
|
|
185
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
186
|
+
case 429:
|
|
187
|
+
throw new AthenaIntelligence.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
188
|
+
case 502:
|
|
189
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
190
|
+
default:
|
|
191
|
+
throw new errors.AthenaIntelligenceError({
|
|
192
|
+
statusCode: _response.error.statusCode,
|
|
193
|
+
body: _response.error.body,
|
|
194
|
+
rawResponse: _response.rawResponse,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
174
197
|
}
|
|
175
198
|
switch (_response.error.reason) {
|
|
176
199
|
case "non-json":
|
|
@@ -185,7 +208,7 @@ export class EmailClient {
|
|
|
185
208
|
rawResponse: _response.rawResponse,
|
|
186
209
|
});
|
|
187
210
|
case "timeout":
|
|
188
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling
|
|
211
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tools/email/search.");
|
|
189
212
|
case "unknown":
|
|
190
213
|
throw new errors.AthenaIntelligenceError({
|
|
191
214
|
message: _response.error.errorMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|