@athenaintel/sdk 4.3.2158 → 4.3.2159
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/api/errors/TooManyRequestsError.d.ts +1 -1
- 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/ListEventsCalendarRequest.js +3 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/requests/index.js +2 -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/EmailDraftRequestIn.js +3 -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/SearchEmailRequest.js +3 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/index.js +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/CalendarAttendeeOut.js +3 -0
- package/dist/cjs/api/types/CalendarEventOut.d.ts +28 -0
- package/dist/cjs/api/types/CalendarEventOut.js +3 -0
- package/dist/cjs/api/types/CalendarEventsResponseOut.d.ts +14 -0
- package/dist/cjs/api/types/CalendarEventsResponseOut.js +3 -0
- package/dist/cjs/api/types/EmailDraftResponseOut.d.ts +23 -0
- package/dist/cjs/api/types/EmailDraftResponseOut.js +3 -0
- package/dist/cjs/api/types/EmailSearchResponseOut.d.ts +22 -0
- package/dist/cjs/api/types/EmailSearchResponseOut.js +3 -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 -0
- package/dist/cjs/api/types/index.js +6 -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/api/errors/TooManyRequestsError.d.mts +1 -1
- 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/ListEventsCalendarRequest.mjs +2 -0
- package/dist/esm/api/resources/tools/resources/calendar/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tools/resources/calendar/client/requests/index.mjs +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/EmailDraftRequestIn.mjs +2 -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/SearchEmailRequest.mjs +2 -0
- package/dist/esm/api/resources/tools/resources/email/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/tools/resources/email/client/requests/index.mjs +1 -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/CalendarAttendeeOut.mjs +2 -0
- package/dist/esm/api/types/CalendarEventOut.d.mts +28 -0
- package/dist/esm/api/types/CalendarEventOut.mjs +2 -0
- package/dist/esm/api/types/CalendarEventsResponseOut.d.mts +14 -0
- package/dist/esm/api/types/CalendarEventsResponseOut.mjs +2 -0
- package/dist/esm/api/types/EmailDraftResponseOut.d.mts +23 -0
- package/dist/esm/api/types/EmailDraftResponseOut.mjs +2 -0
- package/dist/esm/api/types/EmailSearchResponseOut.d.mts +22 -0
- package/dist/esm/api/types/EmailSearchResponseOut.mjs +2 -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 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +44 -105
|
@@ -49,22 +49,41 @@ const headers_js_1 = require("../../../../../../core/headers.js");
|
|
|
49
49
|
const core = __importStar(require("../../../../../../core/index.js"));
|
|
50
50
|
const environments = __importStar(require("../../../../../../environments.js"));
|
|
51
51
|
const errors = __importStar(require("../../../../../../errors/index.js"));
|
|
52
|
+
const AthenaIntelligence = __importStar(require("../../../../../index.js"));
|
|
52
53
|
class EmailClient {
|
|
53
54
|
constructor(options = {}) {
|
|
54
55
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
+
* Save a draft in the caller's connected Gmail or Outlook account.
|
|
58
59
|
*
|
|
60
|
+
* Nothing is sent. The draft appears in the account's Drafts folder, where it
|
|
61
|
+
* is reviewed, edited and sent from the mail client — that review step is why
|
|
62
|
+
* drafting is available here while sending is not. Set `reply_to_message_id`
|
|
63
|
+
* to thread the draft as a reply.
|
|
64
|
+
*
|
|
65
|
+
* @param {AthenaIntelligence.tools.EmailDraftRequestIn} request
|
|
59
66
|
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
67
|
*
|
|
68
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
69
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
70
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
71
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
72
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
73
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
74
|
+
*
|
|
61
75
|
* @example
|
|
62
|
-
* await client.tools.email.createDraft(
|
|
76
|
+
* await client.tools.email.createDraft({
|
|
77
|
+
* body: "Hi Ada,<br><br>Attached below is the Q3 forecast summary.",
|
|
78
|
+
* cc: ["grace@example.com"],
|
|
79
|
+
* subject: "Q3 forecast",
|
|
80
|
+
* to: ["ada@example.com"]
|
|
81
|
+
* })
|
|
63
82
|
*/
|
|
64
|
-
createDraft(requestOptions) {
|
|
65
|
-
return core.HttpResponsePromise.fromPromise(this.__createDraft(requestOptions));
|
|
83
|
+
createDraft(request, requestOptions) {
|
|
84
|
+
return core.HttpResponsePromise.fromPromise(this.__createDraft(request, requestOptions));
|
|
66
85
|
}
|
|
67
|
-
__createDraft(requestOptions) {
|
|
86
|
+
__createDraft(request, requestOptions) {
|
|
68
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
88
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
70
89
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -73,7 +92,10 @@ class EmailClient {
|
|
|
73
92
|
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"),
|
|
74
93
|
method: "POST",
|
|
75
94
|
headers: _headers,
|
|
95
|
+
contentType: "application/json",
|
|
76
96
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
97
|
+
requestType: "json",
|
|
98
|
+
body: request,
|
|
77
99
|
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,
|
|
78
100
|
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,
|
|
79
101
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -81,14 +103,32 @@ class EmailClient {
|
|
|
81
103
|
logging: this._options.logging,
|
|
82
104
|
});
|
|
83
105
|
if (_response.ok) {
|
|
84
|
-
return {
|
|
106
|
+
return {
|
|
107
|
+
data: _response.body,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
109
|
+
};
|
|
85
110
|
}
|
|
86
111
|
if (_response.error.reason === "status-code") {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
112
|
+
switch (_response.error.statusCode) {
|
|
113
|
+
case 400:
|
|
114
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
115
|
+
case 403:
|
|
116
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
117
|
+
case 404:
|
|
118
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
119
|
+
case 422:
|
|
120
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
121
|
+
case 429:
|
|
122
|
+
throw new AthenaIntelligence.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
123
|
+
case 502:
|
|
124
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
125
|
+
default:
|
|
126
|
+
throw new errors.AthenaIntelligenceError({
|
|
127
|
+
statusCode: _response.error.statusCode,
|
|
128
|
+
body: _response.error.body,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
92
132
|
}
|
|
93
133
|
switch (_response.error.reason) {
|
|
94
134
|
case "non-json":
|
|
@@ -113,26 +153,50 @@ class EmailClient {
|
|
|
113
153
|
});
|
|
114
154
|
}
|
|
115
155
|
/**
|
|
116
|
-
*
|
|
156
|
+
* Search the caller's connected Gmail or Outlook mailbox.
|
|
117
157
|
*
|
|
158
|
+
* Results come from the connected account the caller can access in their
|
|
159
|
+
* current workspace (the default account unless `catalog_id` names another).
|
|
160
|
+
* Unsent drafts are included and flagged with `is_draft`.
|
|
161
|
+
*
|
|
162
|
+
* @param {AthenaIntelligence.tools.SearchEmailRequest} request
|
|
118
163
|
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
119
164
|
*
|
|
165
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
166
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
167
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
168
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
169
|
+
* @throws {@link AthenaIntelligence.TooManyRequestsError}
|
|
170
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
171
|
+
*
|
|
120
172
|
* @example
|
|
121
|
-
* await client.tools.email.search(
|
|
173
|
+
* await client.tools.email.search({
|
|
174
|
+
* query: "from:ada@example.com newer_than:7d",
|
|
175
|
+
* limit: 20
|
|
176
|
+
* })
|
|
122
177
|
*/
|
|
123
|
-
search(requestOptions) {
|
|
124
|
-
return core.HttpResponsePromise.fromPromise(this.__search(requestOptions));
|
|
178
|
+
search(request, requestOptions) {
|
|
179
|
+
return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
|
|
125
180
|
}
|
|
126
|
-
__search(requestOptions) {
|
|
181
|
+
__search(request, requestOptions) {
|
|
127
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
183
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
184
|
+
const { query, catalog_id: catalogId, limit } = request;
|
|
185
|
+
const _queryParams = {};
|
|
186
|
+
_queryParams.query = query;
|
|
187
|
+
if (catalogId !== undefined) {
|
|
188
|
+
_queryParams.catalog_id = catalogId;
|
|
189
|
+
}
|
|
190
|
+
if (limit != null) {
|
|
191
|
+
_queryParams.limit = limit.toString();
|
|
192
|
+
}
|
|
129
193
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
130
194
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
131
195
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
132
196
|
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"),
|
|
133
197
|
method: "GET",
|
|
134
198
|
headers: _headers,
|
|
135
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
199
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
136
200
|
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,
|
|
137
201
|
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,
|
|
138
202
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -140,73 +204,32 @@ class EmailClient {
|
|
|
140
204
|
logging: this._options.logging,
|
|
141
205
|
});
|
|
142
206
|
if (_response.ok) {
|
|
143
|
-
return {
|
|
144
|
-
|
|
145
|
-
if (_response.error.reason === "status-code") {
|
|
146
|
-
throw new errors.AthenaIntelligenceError({
|
|
147
|
-
statusCode: _response.error.statusCode,
|
|
148
|
-
body: _response.error.body,
|
|
207
|
+
return {
|
|
208
|
+
data: _response.body,
|
|
149
209
|
rawResponse: _response.rawResponse,
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
switch (_response.error.reason) {
|
|
153
|
-
case "non-json":
|
|
154
|
-
throw new errors.AthenaIntelligenceError({
|
|
155
|
-
statusCode: _response.error.statusCode,
|
|
156
|
-
body: _response.error.rawBody,
|
|
157
|
-
rawResponse: _response.rawResponse,
|
|
158
|
-
});
|
|
159
|
-
case "body-is-null":
|
|
160
|
-
throw new errors.AthenaIntelligenceError({
|
|
161
|
-
statusCode: _response.error.statusCode,
|
|
162
|
-
rawResponse: _response.rawResponse,
|
|
163
|
-
});
|
|
164
|
-
case "timeout":
|
|
165
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tools/email/search.");
|
|
166
|
-
case "unknown":
|
|
167
|
-
throw new errors.AthenaIntelligenceError({
|
|
168
|
-
message: _response.error.errorMessage,
|
|
169
|
-
rawResponse: _response.rawResponse,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Coming soon! Send emails to specified recipients.
|
|
176
|
-
*
|
|
177
|
-
* @param {EmailClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* await client.tools.email.send()
|
|
181
|
-
*/
|
|
182
|
-
send(requestOptions) {
|
|
183
|
-
return core.HttpResponsePromise.fromPromise(this.__send(requestOptions));
|
|
184
|
-
}
|
|
185
|
-
__send(requestOptions) {
|
|
186
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
188
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
189
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
190
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
191
|
-
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"),
|
|
192
|
-
method: "POST",
|
|
193
|
-
headers: _headers,
|
|
194
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
195
|
-
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,
|
|
196
|
-
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,
|
|
197
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
198
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
199
|
-
logging: this._options.logging,
|
|
200
|
-
});
|
|
201
|
-
if (_response.ok) {
|
|
202
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
210
|
+
};
|
|
203
211
|
}
|
|
204
212
|
if (_response.error.reason === "status-code") {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
213
|
+
switch (_response.error.statusCode) {
|
|
214
|
+
case 400:
|
|
215
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
216
|
+
case 403:
|
|
217
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
218
|
+
case 404:
|
|
219
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
220
|
+
case 422:
|
|
221
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
222
|
+
case 429:
|
|
223
|
+
throw new AthenaIntelligence.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
224
|
+
case 502:
|
|
225
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
226
|
+
default:
|
|
227
|
+
throw new errors.AthenaIntelligenceError({
|
|
228
|
+
statusCode: _response.error.statusCode,
|
|
229
|
+
body: _response.error.body,
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
210
233
|
}
|
|
211
234
|
switch (_response.error.reason) {
|
|
212
235
|
case "non-json":
|
|
@@ -221,7 +244,7 @@ class EmailClient {
|
|
|
221
244
|
rawResponse: _response.rawResponse,
|
|
222
245
|
});
|
|
223
246
|
case "timeout":
|
|
224
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling
|
|
247
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/tools/email/search.");
|
|
225
248
|
case "unknown":
|
|
226
249
|
throw new errors.AthenaIntelligenceError({
|
|
227
250
|
message: _response.error.errorMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* body: "Hi Ada,<br><br>Attached below is the Q3 forecast summary.",
|
|
5
|
+
* cc: ["grace@example.com"],
|
|
6
|
+
* subject: "Q3 forecast",
|
|
7
|
+
* to: ["ada@example.com"]
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface EmailDraftRequestIn {
|
|
11
|
+
/** BCC recipients. */
|
|
12
|
+
bcc?: string[] | null;
|
|
13
|
+
/** Body content. HTML is supported; plain-text newlines become line breaks. Do not write a signature into it — the account's signature is appended automatically (see `include_signature`). */
|
|
14
|
+
body: string;
|
|
15
|
+
/** 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. */
|
|
16
|
+
catalog_id?: string | null;
|
|
17
|
+
/** CC recipients. */
|
|
18
|
+
cc?: string[] | null;
|
|
19
|
+
/** Optional: Whether to append the sending account's own signature at the end of the body. Leave unset to follow the user's saved preference for this account (which distinguishes new messages from replies) — that is almost always the right choice. Set false only when the user asks for no signature. Never write a signature into the body yourself: the real one is read from the account and appended automatically. */
|
|
20
|
+
include_signature?: boolean | null;
|
|
21
|
+
/** Provider message id (from `GET /tools/email/search`) to reply to, so the draft is threaded under that message. Outlook rejects an id it cannot find (404). Gmail saves the draft *unthreaded* when the referenced message cannot be read, and `reply_to_message_id` in the response tells you which happened. */
|
|
22
|
+
reply_to_message_id?: string | null;
|
|
23
|
+
/** Subject line. */
|
|
24
|
+
subject: string;
|
|
25
|
+
/** Recipient email addresses. */
|
|
26
|
+
to: string[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* query: "from:ada@example.com newer_than:7d",
|
|
5
|
+
* limit: 20
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface SearchEmailRequest {
|
|
9
|
+
/** Search query. Gmail operators (`from:`, `to:`, `subject:`, `has:attachment`, `newer_than:7d`, `-term`, …) are accepted for both providers; operators with no Outlook equivalent are dropped and reported in `ignored_operators`. Use `in:drafts` to search only unsent drafts. */
|
|
10
|
+
query: string;
|
|
11
|
+
/** 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. */
|
|
12
|
+
catalog_id?: string | null;
|
|
13
|
+
/** Maximum number of results (1-50). */
|
|
14
|
+
limit?: number;
|
|
15
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./calendar/client/requests/index.js";
|
|
1
2
|
export * as calendar from "./calendar/index.js";
|
|
3
|
+
export * from "./email/client/requests/index.js";
|
|
2
4
|
export * as email from "./email/index.js";
|
|
3
5
|
export * from "./sheets/client/requests/index.js";
|
|
4
6
|
export * as sheets from "./sheets/index.js";
|
|
@@ -15,6 +15,9 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
18
21
|
var __importStar = (this && this.__importStar) || (function () {
|
|
19
22
|
var ownKeys = function(o) {
|
|
20
23
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -32,12 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
35
|
return result;
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.tasks = exports.structuredDataExtractor = exports.sheets = exports.email = exports.calendar = void 0;
|
|
40
|
+
__exportStar(require("./calendar/client/requests/index.js"), exports);
|
|
40
41
|
exports.calendar = __importStar(require("./calendar/index.js"));
|
|
42
|
+
__exportStar(require("./email/client/requests/index.js"), exports);
|
|
41
43
|
exports.email = __importStar(require("./email/index.js"));
|
|
42
44
|
__exportStar(require("./sheets/client/requests/index.js"), exports);
|
|
43
45
|
exports.sheets = __importStar(require("./sheets/index.js"));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One attendee of a calendar event.
|
|
3
|
+
*/
|
|
4
|
+
export interface CalendarAttendeeOut {
|
|
5
|
+
/** Attendee email address. */
|
|
6
|
+
email?: string;
|
|
7
|
+
/** Attendee display name, if known. */
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Attendee response, in the provider's vocabulary. */
|
|
10
|
+
response_status?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* One calendar event.
|
|
4
|
+
*/
|
|
5
|
+
export interface CalendarEventOut {
|
|
6
|
+
/** Attendees and their responses. */
|
|
7
|
+
attendees?: AthenaIntelligence.CalendarAttendeeOut[];
|
|
8
|
+
/** Meet / Teams / other conferencing join link, if any. */
|
|
9
|
+
conferencing_url?: string;
|
|
10
|
+
/** Description or body preview. */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** End time, ISO 8601. */
|
|
13
|
+
end?: string;
|
|
14
|
+
/** Link to the event in Google Calendar. Gmail accounts only. */
|
|
15
|
+
html_link?: string | null;
|
|
16
|
+
/** Provider event id. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Location, if set. */
|
|
19
|
+
location?: string;
|
|
20
|
+
/** Start time, ISO 8601. */
|
|
21
|
+
start?: string;
|
|
22
|
+
/** Event status. Gmail accounts only. */
|
|
23
|
+
status?: string | null;
|
|
24
|
+
/** Event title. */
|
|
25
|
+
title?: string;
|
|
26
|
+
/** Link to the event in Outlook. Outlook accounts only. */
|
|
27
|
+
web_link?: string | null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Result of `GET /tools/calendar/events`.
|
|
4
|
+
*/
|
|
5
|
+
export interface CalendarEventsResponseOut {
|
|
6
|
+
/** The connected account that was read. */
|
|
7
|
+
catalog_id: string;
|
|
8
|
+
/** Number of events returned. */
|
|
9
|
+
count: number;
|
|
10
|
+
/** Account provider as Athena reports it: `gmail` or `outlook` for accounts connected through the Integrations page; `google` or `microsoft365` for directly-connected accounts (read-only for drafts). */
|
|
11
|
+
provider: string;
|
|
12
|
+
/** Matching events in ascending start order. */
|
|
13
|
+
results?: AthenaIntelligence.CalendarEventOut[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of `POST /tools/email/draft`.
|
|
3
|
+
*/
|
|
4
|
+
export interface EmailDraftResponseOut {
|
|
5
|
+
/** The connected account the draft is in. */
|
|
6
|
+
catalog_id: string;
|
|
7
|
+
/** Provider draft id. Open, edit, or send it in the mail client. */
|
|
8
|
+
draft_id?: string | null;
|
|
9
|
+
/** The address the draft will be sent from. */
|
|
10
|
+
email_address?: string | null;
|
|
11
|
+
/** Human-readable outcome, when the provider reports one. */
|
|
12
|
+
message?: string | null;
|
|
13
|
+
/** Provider message id backing the draft. Gmail accounts only. */
|
|
14
|
+
message_id?: string | null;
|
|
15
|
+
/** Account provider as Athena reports it: `gmail` or `outlook` for accounts connected through the Integrations page; `google` or `microsoft365` for directly-connected accounts (read-only for drafts). */
|
|
16
|
+
provider: string;
|
|
17
|
+
/** The message this draft replies to, when it is a reply. */
|
|
18
|
+
reply_to_message_id?: string | null;
|
|
19
|
+
/** Whether the draft was saved. */
|
|
20
|
+
success: boolean;
|
|
21
|
+
/** Athena email-tracking id, when tracking is enabled on the account. */
|
|
22
|
+
tracking_id?: string | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Result of `GET /tools/email/search`.
|
|
4
|
+
*/
|
|
5
|
+
export interface EmailSearchResponseOut {
|
|
6
|
+
/** The connected account that was searched. */
|
|
7
|
+
catalog_id: string;
|
|
8
|
+
/** Number of results returned. */
|
|
9
|
+
count: number;
|
|
10
|
+
/** How many of the results are unsent drafts. */
|
|
11
|
+
draft_count?: number;
|
|
12
|
+
/** Gmail search operators that have no Outlook equivalent and were dropped from the query. Outlook accounts only. */
|
|
13
|
+
ignored_operators?: string[] | null;
|
|
14
|
+
/** Human-readable caveats about the results, when there are any. */
|
|
15
|
+
note?: string | null;
|
|
16
|
+
/** Account provider as Athena reports it: `gmail` or `outlook` for accounts connected through the Integrations page; `google` or `microsoft365` for directly-connected accounts (read-only for drafts). */
|
|
17
|
+
provider: string;
|
|
18
|
+
/** The query as executed. */
|
|
19
|
+
query: string;
|
|
20
|
+
/** Matching messages, newest first. */
|
|
21
|
+
results?: AthenaIntelligence.EmailSearchResultOut[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One message matched by an email search.
|
|
3
|
+
*/
|
|
4
|
+
export interface EmailSearchResultOut {
|
|
5
|
+
/** Microsoft Graph conversation id. Outlook accounts only. */
|
|
6
|
+
conversation_id?: string | null;
|
|
7
|
+
/** Sent or received timestamp, in the provider's format. */
|
|
8
|
+
date?: string;
|
|
9
|
+
/** Provider draft id, when the provider exposes one for a draft. */
|
|
10
|
+
draft_id?: string | null;
|
|
11
|
+
/** Sender, as the provider reports it. */
|
|
12
|
+
from?: string;
|
|
13
|
+
/** Provider message id (Gmail message id, or Microsoft Graph message id for Outlook). This — never an Athena asset id — is what `reply_to_message_id` accepts. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** True when the message is an unsent draft sitting in the mailbox. Drafts are never sent or received mail and cannot be replied to. */
|
|
16
|
+
is_draft?: boolean;
|
|
17
|
+
/** Short plain-text preview. */
|
|
18
|
+
snippet?: string;
|
|
19
|
+
/** Subject line. */
|
|
20
|
+
subject?: string;
|
|
21
|
+
/** Gmail thread id. Gmail accounts only. */
|
|
22
|
+
thread_id?: string | null;
|
|
23
|
+
/** Recipients, comma-separated as the provider reports them. */
|
|
24
|
+
to?: string;
|
|
25
|
+
}
|
|
@@ -23,6 +23,9 @@ export * from "./AssetScreenshotResponseOut.js";
|
|
|
23
23
|
export * from "./BorderModel.js";
|
|
24
24
|
export * from "./BorderStyle.js";
|
|
25
25
|
export * from "./BordersModel.js";
|
|
26
|
+
export * from "./CalendarAttendeeOut.js";
|
|
27
|
+
export * from "./CalendarEventOut.js";
|
|
28
|
+
export * from "./CalendarEventsResponseOut.js";
|
|
26
29
|
export * from "./CellFormat.js";
|
|
27
30
|
export * from "./Chunk.js";
|
|
28
31
|
export * from "./ChunkContentItem.js";
|
|
@@ -56,6 +59,9 @@ export * from "./DeployComputerResponseOut.js";
|
|
|
56
59
|
export * from "./DimensionProperties.js";
|
|
57
60
|
export * from "./DriveAgentResponse.js";
|
|
58
61
|
export * from "./DuplicateAssetResponseOut.js";
|
|
62
|
+
export * from "./EmailDraftResponseOut.js";
|
|
63
|
+
export * from "./EmailSearchResponseOut.js";
|
|
64
|
+
export * from "./EmailSearchResultOut.js";
|
|
59
65
|
export * from "./FileTooLargeError.js";
|
|
60
66
|
export * from "./FolderResponse.js";
|
|
61
67
|
export * from "./GeneralAgentConfig.js";
|
|
@@ -39,6 +39,9 @@ __exportStar(require("./AssetScreenshotResponseOut.js"), exports);
|
|
|
39
39
|
__exportStar(require("./BorderModel.js"), exports);
|
|
40
40
|
__exportStar(require("./BorderStyle.js"), exports);
|
|
41
41
|
__exportStar(require("./BordersModel.js"), exports);
|
|
42
|
+
__exportStar(require("./CalendarAttendeeOut.js"), exports);
|
|
43
|
+
__exportStar(require("./CalendarEventOut.js"), exports);
|
|
44
|
+
__exportStar(require("./CalendarEventsResponseOut.js"), exports);
|
|
42
45
|
__exportStar(require("./CellFormat.js"), exports);
|
|
43
46
|
__exportStar(require("./Chunk.js"), exports);
|
|
44
47
|
__exportStar(require("./ChunkContentItem.js"), exports);
|
|
@@ -72,6 +75,9 @@ __exportStar(require("./DeployComputerResponseOut.js"), exports);
|
|
|
72
75
|
__exportStar(require("./DimensionProperties.js"), exports);
|
|
73
76
|
__exportStar(require("./DriveAgentResponse.js"), exports);
|
|
74
77
|
__exportStar(require("./DuplicateAssetResponseOut.js"), exports);
|
|
78
|
+
__exportStar(require("./EmailDraftResponseOut.js"), exports);
|
|
79
|
+
__exportStar(require("./EmailSearchResponseOut.js"), exports);
|
|
80
|
+
__exportStar(require("./EmailSearchResultOut.js"), exports);
|
|
75
81
|
__exportStar(require("./FileTooLargeError.js"), exports);
|
|
76
82
|
__exportStar(require("./FolderResponse.js"), exports);
|
|
77
83
|
__exportStar(require("./GeneralAgentConfig.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.3.
|
|
1
|
+
export declare const SDK_VERSION = "4.3.2159";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@athenaintel/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "4.3.
|
|
10
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
9
|
+
"X-Fern-SDK-Version": "4.3.2159",
|
|
10
|
+
"User-Agent": "@athenaintel/sdk/4.3.2159",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.mjs";
|
|
2
2
|
import * as errors from "../../errors/index.mjs";
|
|
3
3
|
export declare class TooManyRequestsError extends errors.AthenaIntelligenceError {
|
|
4
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
5
5
|
}
|