@athenaintel/sdk 4.3.2297 → 4.3.2299
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/resources/assets/client/Client.d.ts +42 -1
- package/dist/cjs/api/resources/assets/client/Client.js +194 -1
- package/dist/cjs/api/resources/assets/client/requests/BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost.d.ts +1 -1
- package/dist/cjs/api/resources/assets/client/requests/CreateUploadLinkRequestIn.d.ts +18 -0
- package/dist/cjs/api/resources/assets/client/requests/CreateUploadLinkRequestIn.js +3 -0
- package/dist/cjs/api/resources/assets/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/UploadLinkResponseOut.d.ts +30 -0
- package/dist/cjs/api/types/UploadLinkResponseOut.js +11 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -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/resources/assets/client/Client.d.mts +42 -1
- package/dist/esm/api/resources/assets/client/Client.mjs +194 -1
- package/dist/esm/api/resources/assets/client/requests/BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost.d.mts +1 -1
- package/dist/esm/api/resources/assets/client/requests/CreateUploadLinkRequestIn.d.mts +18 -0
- package/dist/esm/api/resources/assets/client/requests/CreateUploadLinkRequestIn.mjs +2 -0
- package/dist/esm/api/resources/assets/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/UploadLinkResponseOut.d.mts +30 -0
- package/dist/esm/api/types/UploadLinkResponseOut.mjs +8 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +68 -1
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@athenaintel/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "4.3.
|
|
47
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
46
|
+
"X-Fern-SDK-Version": "4.3.2299",
|
|
47
|
+
"User-Agent": "@athenaintel/sdk/4.3.2299",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
"X-Athena-Session-Credential": options === null || options === void 0 ? void 0 : options.sessionCredential,
|
|
@@ -74,7 +74,7 @@ export declare class AssetsClient {
|
|
|
74
74
|
create(request: AthenaIntelligence.CreateAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.CreateAssetResponseOut>;
|
|
75
75
|
private __create;
|
|
76
76
|
/**
|
|
77
|
-
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). Nothing is left behind when the import fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run,
|
|
77
|
+
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). A Markdown (.md, .markdown) or plain-text (.txt, .text) file becomes an Athena document, its Markdown rendered (headings, lists, tables, links) and plain text one paragraph per line, and an HTML (.html, .htm) file becomes a user interface: Athena stores the file and converts it in place in the request, as the app's Convert to does, so the original upload stays downloadable from the new asset's Versions pane. A Markdown or text file may be up to 2 MiB and an HTML file up to 5 MiB. Nothing is left behind when the import or conversion fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run, a presentation takes the create_presentation_pptx_studio tool policy and a user interface the create_new_user_interface tool policy.
|
|
78
78
|
*
|
|
79
79
|
* @param {AthenaIntelligence.BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost} request
|
|
80
80
|
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -82,9 +82,11 @@ export declare class AssetsClient {
|
|
|
82
82
|
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
83
83
|
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
84
84
|
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
85
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
85
86
|
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
86
87
|
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
87
88
|
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
89
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
88
90
|
*
|
|
89
91
|
* @example
|
|
90
92
|
* import { createReadStream } from "fs";
|
|
@@ -155,6 +157,45 @@ export declare class AssetsClient {
|
|
|
155
157
|
*/
|
|
156
158
|
duplicate(request: AthenaIntelligence.DuplicateAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DuplicateAssetResponseOut>;
|
|
157
159
|
private __duplicate;
|
|
160
|
+
/**
|
|
161
|
+
* Mint a one-time link that takes one file without an API key, for a caller that can run a shell command but holds no key, such as an agent connected through an Athena MCP server. The file's name decides what it becomes, as with POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation. The gates of create-from-file run now (membership in the workspace, EDIT on parent_folder_id, the deployment's offering, an agent run's tool policy) and again when the file arrives. Send the file's bytes as the body of one PUT to upload_url with the X-Athena-Upload-Token header (the curl field is that command); its answer is the new asset. A link works once, for 15 minutes.
|
|
162
|
+
*
|
|
163
|
+
* @param {AthenaIntelligence.CreateUploadLinkRequestIn} request
|
|
164
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
165
|
+
*
|
|
166
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
167
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
168
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
169
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* await client.assets.createUploadLink({
|
|
173
|
+
* file_name: "notes.md",
|
|
174
|
+
* parent_folder_id: "asset_folder_12345",
|
|
175
|
+
* title: "Quarterly notes"
|
|
176
|
+
* })
|
|
177
|
+
*/
|
|
178
|
+
createUploadLink(request: AthenaIntelligence.CreateUploadLinkRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.UploadLinkResponseOut>;
|
|
179
|
+
private __createUploadLink;
|
|
180
|
+
/**
|
|
181
|
+
* Send one file through a link from POST /api/v0/assets/upload-links: the body is the file's bytes and X-Athena-Upload-Token the link's credential; no API key is needed. Athena runs POST /api/v0/assets/create-from-file as the person who asked for the link, with every gate again (an agent run's tool policy included), and answers with the new asset. A link works once: the first upload spends it, whatever its answer.
|
|
182
|
+
*
|
|
183
|
+
* @param {core.file.Uploadable} uploadable
|
|
184
|
+
* @param {string} link_id
|
|
185
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
186
|
+
*
|
|
187
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
188
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
189
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
190
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
191
|
+
* @throws {@link AthenaIntelligence.GoneError}
|
|
192
|
+
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
193
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
194
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
195
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
196
|
+
*/
|
|
197
|
+
uploadThroughLink(uploadable: core.file.Uploadable, link_id: string, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.CreateAssetResponseOut>;
|
|
198
|
+
private __uploadThroughLink;
|
|
158
199
|
/**
|
|
159
200
|
* Retrieve a single asset by its ID. Returns comprehensive metadata including creation info, tags, timestamps, media type, and AI-generated summary.
|
|
160
201
|
*
|
|
@@ -357,7 +357,7 @@ class AssetsClient {
|
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
360
|
-
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). Nothing is left behind when the import fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run,
|
|
360
|
+
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). A Markdown (.md, .markdown) or plain-text (.txt, .text) file becomes an Athena document, its Markdown rendered (headings, lists, tables, links) and plain text one paragraph per line, and an HTML (.html, .htm) file becomes a user interface: Athena stores the file and converts it in place in the request, as the app's Convert to does, so the original upload stays downloadable from the new asset's Versions pane. A Markdown or text file may be up to 2 MiB and an HTML file up to 5 MiB. Nothing is left behind when the import or conversion fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run, a presentation takes the create_presentation_pptx_studio tool policy and a user interface the create_new_user_interface tool policy.
|
|
361
361
|
*
|
|
362
362
|
* @param {AthenaIntelligence.BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost} request
|
|
363
363
|
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -365,9 +365,11 @@ class AssetsClient {
|
|
|
365
365
|
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
366
366
|
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
367
367
|
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
368
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
368
369
|
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
369
370
|
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
370
371
|
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
372
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
371
373
|
*
|
|
372
374
|
* @example
|
|
373
375
|
* import { createReadStream } from "fs";
|
|
@@ -427,12 +429,16 @@ class AssetsClient {
|
|
|
427
429
|
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
428
430
|
case 404:
|
|
429
431
|
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
432
|
+
case 409:
|
|
433
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
430
434
|
case 413:
|
|
431
435
|
throw new AthenaIntelligence.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
432
436
|
case 422:
|
|
433
437
|
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
434
438
|
case 502:
|
|
435
439
|
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
440
|
+
case 503:
|
|
441
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
436
442
|
default:
|
|
437
443
|
throw new errors.AthenaIntelligenceError({
|
|
438
444
|
statusCode: _response.error.statusCode,
|
|
@@ -718,6 +724,193 @@ class AssetsClient {
|
|
|
718
724
|
}
|
|
719
725
|
});
|
|
720
726
|
}
|
|
727
|
+
/**
|
|
728
|
+
* Mint a one-time link that takes one file without an API key, for a caller that can run a shell command but holds no key, such as an agent connected through an Athena MCP server. The file's name decides what it becomes, as with POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation. The gates of create-from-file run now (membership in the workspace, EDIT on parent_folder_id, the deployment's offering, an agent run's tool policy) and again when the file arrives. Send the file's bytes as the body of one PUT to upload_url with the X-Athena-Upload-Token header (the curl field is that command); its answer is the new asset. A link works once, for 15 minutes.
|
|
729
|
+
*
|
|
730
|
+
* @param {AthenaIntelligence.CreateUploadLinkRequestIn} request
|
|
731
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
732
|
+
*
|
|
733
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
734
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
735
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
736
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* await client.assets.createUploadLink({
|
|
740
|
+
* file_name: "notes.md",
|
|
741
|
+
* parent_folder_id: "asset_folder_12345",
|
|
742
|
+
* title: "Quarterly notes"
|
|
743
|
+
* })
|
|
744
|
+
*/
|
|
745
|
+
createUploadLink(request, requestOptions) {
|
|
746
|
+
return core.HttpResponsePromise.fromPromise(this.__createUploadLink(request, requestOptions));
|
|
747
|
+
}
|
|
748
|
+
__createUploadLink(request, requestOptions) {
|
|
749
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
750
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
751
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
752
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
753
|
+
"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,
|
|
754
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
755
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
756
|
+
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/assets/upload-links"),
|
|
757
|
+
method: "POST",
|
|
758
|
+
headers: _headers,
|
|
759
|
+
contentType: "application/json",
|
|
760
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
761
|
+
requestType: "json",
|
|
762
|
+
body: request,
|
|
763
|
+
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,
|
|
764
|
+
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,
|
|
765
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
766
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
767
|
+
logging: this._options.logging,
|
|
768
|
+
});
|
|
769
|
+
if (_response.ok) {
|
|
770
|
+
return {
|
|
771
|
+
data: _response.body,
|
|
772
|
+
rawResponse: _response.rawResponse,
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
if (_response.error.reason === "status-code") {
|
|
776
|
+
switch (_response.error.statusCode) {
|
|
777
|
+
case 403:
|
|
778
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
779
|
+
case 404:
|
|
780
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
781
|
+
case 422:
|
|
782
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
783
|
+
case 503:
|
|
784
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
785
|
+
default:
|
|
786
|
+
throw new errors.AthenaIntelligenceError({
|
|
787
|
+
statusCode: _response.error.statusCode,
|
|
788
|
+
body: _response.error.body,
|
|
789
|
+
rawResponse: _response.rawResponse,
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
switch (_response.error.reason) {
|
|
794
|
+
case "non-json":
|
|
795
|
+
throw new errors.AthenaIntelligenceError({
|
|
796
|
+
statusCode: _response.error.statusCode,
|
|
797
|
+
body: _response.error.rawBody,
|
|
798
|
+
rawResponse: _response.rawResponse,
|
|
799
|
+
});
|
|
800
|
+
case "body-is-null":
|
|
801
|
+
throw new errors.AthenaIntelligenceError({
|
|
802
|
+
statusCode: _response.error.statusCode,
|
|
803
|
+
rawResponse: _response.rawResponse,
|
|
804
|
+
});
|
|
805
|
+
case "timeout":
|
|
806
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/assets/upload-links.");
|
|
807
|
+
case "unknown":
|
|
808
|
+
throw new errors.AthenaIntelligenceError({
|
|
809
|
+
message: _response.error.errorMessage,
|
|
810
|
+
rawResponse: _response.rawResponse,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Send one file through a link from POST /api/v0/assets/upload-links: the body is the file's bytes and X-Athena-Upload-Token the link's credential; no API key is needed. Athena runs POST /api/v0/assets/create-from-file as the person who asked for the link, with every gate again (an agent run's tool policy included), and answers with the new asset. A link works once: the first upload spends it, whatever its answer.
|
|
817
|
+
*
|
|
818
|
+
* @param {core.file.Uploadable} uploadable
|
|
819
|
+
* @param {string} link_id
|
|
820
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
821
|
+
*
|
|
822
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
823
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
824
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
825
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
826
|
+
* @throws {@link AthenaIntelligence.GoneError}
|
|
827
|
+
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
828
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
829
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
830
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
831
|
+
*/
|
|
832
|
+
uploadThroughLink(uploadable, link_id, requestOptions) {
|
|
833
|
+
return core.HttpResponsePromise.fromPromise(this.__uploadThroughLink(uploadable, link_id, requestOptions));
|
|
834
|
+
}
|
|
835
|
+
__uploadThroughLink(uploadable, link_id, requestOptions) {
|
|
836
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
837
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
838
|
+
const _binaryUploadRequest = yield core.file.toBinaryUploadRequest(uploadable);
|
|
839
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
840
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
841
|
+
"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,
|
|
842
|
+
}), _binaryUploadRequest.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
843
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
844
|
+
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/assets/upload-links/${core.url.encodePathParam(link_id)}`),
|
|
845
|
+
method: "PUT",
|
|
846
|
+
headers: _headers,
|
|
847
|
+
contentType: "application/octet-stream",
|
|
848
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
849
|
+
requestType: "bytes",
|
|
850
|
+
duplex: "half",
|
|
851
|
+
body: _binaryUploadRequest.body,
|
|
852
|
+
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,
|
|
853
|
+
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,
|
|
854
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
855
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
856
|
+
logging: this._options.logging,
|
|
857
|
+
});
|
|
858
|
+
if (_response.ok) {
|
|
859
|
+
return {
|
|
860
|
+
data: _response.body,
|
|
861
|
+
rawResponse: _response.rawResponse,
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
if (_response.error.reason === "status-code") {
|
|
865
|
+
switch (_response.error.statusCode) {
|
|
866
|
+
case 400:
|
|
867
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
868
|
+
case 401:
|
|
869
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
870
|
+
case 403:
|
|
871
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
872
|
+
case 404:
|
|
873
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
874
|
+
case 410:
|
|
875
|
+
throw new AthenaIntelligence.GoneError(_response.error.body, _response.rawResponse);
|
|
876
|
+
case 413:
|
|
877
|
+
throw new AthenaIntelligence.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
878
|
+
case 422:
|
|
879
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
880
|
+
case 502:
|
|
881
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
882
|
+
case 503:
|
|
883
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
884
|
+
default:
|
|
885
|
+
throw new errors.AthenaIntelligenceError({
|
|
886
|
+
statusCode: _response.error.statusCode,
|
|
887
|
+
body: _response.error.body,
|
|
888
|
+
rawResponse: _response.rawResponse,
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
switch (_response.error.reason) {
|
|
893
|
+
case "non-json":
|
|
894
|
+
throw new errors.AthenaIntelligenceError({
|
|
895
|
+
statusCode: _response.error.statusCode,
|
|
896
|
+
body: _response.error.rawBody,
|
|
897
|
+
rawResponse: _response.rawResponse,
|
|
898
|
+
});
|
|
899
|
+
case "body-is-null":
|
|
900
|
+
throw new errors.AthenaIntelligenceError({
|
|
901
|
+
statusCode: _response.error.statusCode,
|
|
902
|
+
rawResponse: _response.rawResponse,
|
|
903
|
+
});
|
|
904
|
+
case "timeout":
|
|
905
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling PUT /api/v0/assets/upload-links/{link_id}.");
|
|
906
|
+
case "unknown":
|
|
907
|
+
throw new errors.AthenaIntelligenceError({
|
|
908
|
+
message: _response.error.errorMessage,
|
|
909
|
+
rawResponse: _response.rawResponse,
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
}
|
|
721
914
|
/**
|
|
722
915
|
* Retrieve a single asset by its ID. Returns comprehensive metadata including creation info, tags, timestamps, media type, and AI-generated summary.
|
|
723
916
|
*
|
|
@@ -14,6 +14,6 @@ export interface BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost {
|
|
|
14
14
|
workspace_id?: string | null;
|
|
15
15
|
/** An asset you can read that the file came from; without parent_folder_id the new asset goes next to it when you may create there */
|
|
16
16
|
source_asset_id?: string | null;
|
|
17
|
-
/** The .docx, .pptx or .
|
|
17
|
+
/** The .docx, .pptx, .potx, .md, .markdown, .txt, .text, .html or .htm file to create the asset from */
|
|
18
18
|
file: core.file.Uploadable;
|
|
19
19
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* file_name: "notes.md",
|
|
5
|
+
* parent_folder_id: "asset_folder_12345",
|
|
6
|
+
* title: "Quarterly notes"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface CreateUploadLinkRequestIn {
|
|
10
|
+
/** The name of the file you will send, which decides what it becomes, as in POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation */
|
|
11
|
+
file_name: string;
|
|
12
|
+
/** Folder to put the new asset in; you need EDIT on it */
|
|
13
|
+
parent_folder_id?: string | null;
|
|
14
|
+
/** Title for the new asset; defaults to the file's name */
|
|
15
|
+
title?: string | null;
|
|
16
|
+
/** Workspace to create the asset in; defaults to parent_folder_id's, else your current one */
|
|
17
|
+
workspace_id?: string | null;
|
|
18
|
+
}
|
|
@@ -7,6 +7,7 @@ export type { ConvertToUserInterfaceAssetsRequest } from "./ConvertToUserInterfa
|
|
|
7
7
|
export type { CreateAssetRequestIn } from "./CreateAssetRequestIn.js";
|
|
8
8
|
export type { CreateProjectRequestIn } from "./CreateProjectRequestIn.js";
|
|
9
9
|
export type { CreateStudioTokenAssetsRequest } from "./CreateStudioTokenAssetsRequest.js";
|
|
10
|
+
export type { CreateUploadLinkRequestIn } from "./CreateUploadLinkRequestIn.js";
|
|
10
11
|
export type { DownloadAssetsRequest } from "./DownloadAssetsRequest.js";
|
|
11
12
|
export type { DuplicateAssetRequestIn } from "./DuplicateAssetRequestIn.js";
|
|
12
13
|
export type { GetAccessAssetsRequest } from "./GetAccessAssetsRequest.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A one-time link that takes one file, sent without an API key.
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadLinkResponseOut {
|
|
5
|
+
/** What the file becomes */
|
|
6
|
+
asset_type: string;
|
|
7
|
+
/** A curl command that sends the file, every argument shell-quoted; replace the path placeholder with your file's path. It prints the new asset as JSON */
|
|
8
|
+
curl: string;
|
|
9
|
+
/** When the link stops working (UTC) */
|
|
10
|
+
expires_at: string;
|
|
11
|
+
/** The file the link takes */
|
|
12
|
+
file_name: string;
|
|
13
|
+
/** Headers the upload must carry: X-Athena-Upload-Token, the link's one-time credential. It works once, until expires_at */
|
|
14
|
+
headers: Record<string, string>;
|
|
15
|
+
/** ID of the link */
|
|
16
|
+
link_id: string;
|
|
17
|
+
/** The largest file the link takes */
|
|
18
|
+
max_bytes: number;
|
|
19
|
+
/** The HTTP method the upload uses */
|
|
20
|
+
method?: UploadLinkResponseOut.Method;
|
|
21
|
+
/** Where to send the file: one PUT, its body the file's bytes */
|
|
22
|
+
upload_url: string;
|
|
23
|
+
}
|
|
24
|
+
export declare namespace UploadLinkResponseOut {
|
|
25
|
+
/** The HTTP method the upload uses */
|
|
26
|
+
const Method: {
|
|
27
|
+
readonly Put: "PUT";
|
|
28
|
+
};
|
|
29
|
+
type Method = (typeof Method)[keyof typeof Method];
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.UploadLinkResponseOut = void 0;
|
|
5
|
+
var UploadLinkResponseOut;
|
|
6
|
+
(function (UploadLinkResponseOut) {
|
|
7
|
+
/** The HTTP method the upload uses */
|
|
8
|
+
UploadLinkResponseOut.Method = {
|
|
9
|
+
Put: "PUT",
|
|
10
|
+
};
|
|
11
|
+
})(UploadLinkResponseOut || (exports.UploadLinkResponseOut = UploadLinkResponseOut = {}));
|
|
@@ -169,6 +169,7 @@ export * from "./ToolUseContent.js";
|
|
|
169
169
|
export * from "./UpdateAssetConfigResponseOut.js";
|
|
170
170
|
export * from "./UpdateWorkspaceDisclaimerIn.js";
|
|
171
171
|
export * from "./UpdateWorkspaceToolRegistryToolIn.js";
|
|
172
|
+
export * from "./UploadLinkResponseOut.js";
|
|
172
173
|
export * from "./UserInfoOut.js";
|
|
173
174
|
export * from "./WorkspaceAccessResponseOut.js";
|
|
174
175
|
export * from "./WorkspaceConfigurationResponseOut.js";
|
|
@@ -185,6 +185,7 @@ __exportStar(require("./ToolUseContent.js"), exports);
|
|
|
185
185
|
__exportStar(require("./UpdateAssetConfigResponseOut.js"), exports);
|
|
186
186
|
__exportStar(require("./UpdateWorkspaceDisclaimerIn.js"), exports);
|
|
187
187
|
__exportStar(require("./UpdateWorkspaceToolRegistryToolIn.js"), exports);
|
|
188
|
+
__exportStar(require("./UploadLinkResponseOut.js"), exports);
|
|
188
189
|
__exportStar(require("./UserInfoOut.js"), exports);
|
|
189
190
|
__exportStar(require("./WorkspaceAccessResponseOut.js"), exports);
|
|
190
191
|
__exportStar(require("./WorkspaceConfigurationResponseOut.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.2299";
|
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.2299",
|
|
10
|
+
"User-Agent": "@athenaintel/sdk/4.3.2299",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
"X-Athena-Session-Credential": options === null || options === void 0 ? void 0 : options.sessionCredential,
|
|
@@ -74,7 +74,7 @@ export declare class AssetsClient {
|
|
|
74
74
|
create(request: AthenaIntelligence.CreateAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.CreateAssetResponseOut>;
|
|
75
75
|
private __create;
|
|
76
76
|
/**
|
|
77
|
-
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). Nothing is left behind when the import fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run,
|
|
77
|
+
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). A Markdown (.md, .markdown) or plain-text (.txt, .text) file becomes an Athena document, its Markdown rendered (headings, lists, tables, links) and plain text one paragraph per line, and an HTML (.html, .htm) file becomes a user interface: Athena stores the file and converts it in place in the request, as the app's Convert to does, so the original upload stays downloadable from the new asset's Versions pane. A Markdown or text file may be up to 2 MiB and an HTML file up to 5 MiB. Nothing is left behind when the import or conversion fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run, a presentation takes the create_presentation_pptx_studio tool policy and a user interface the create_new_user_interface tool policy.
|
|
78
78
|
*
|
|
79
79
|
* @param {AthenaIntelligence.BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost} request
|
|
80
80
|
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -82,9 +82,11 @@ export declare class AssetsClient {
|
|
|
82
82
|
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
83
83
|
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
84
84
|
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
85
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
85
86
|
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
86
87
|
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
87
88
|
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
89
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
88
90
|
*
|
|
89
91
|
* @example
|
|
90
92
|
* import { createReadStream } from "fs";
|
|
@@ -155,6 +157,45 @@ export declare class AssetsClient {
|
|
|
155
157
|
*/
|
|
156
158
|
duplicate(request: AthenaIntelligence.DuplicateAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DuplicateAssetResponseOut>;
|
|
157
159
|
private __duplicate;
|
|
160
|
+
/**
|
|
161
|
+
* Mint a one-time link that takes one file without an API key, for a caller that can run a shell command but holds no key, such as an agent connected through an Athena MCP server. The file's name decides what it becomes, as with POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation. The gates of create-from-file run now (membership in the workspace, EDIT on parent_folder_id, the deployment's offering, an agent run's tool policy) and again when the file arrives. Send the file's bytes as the body of one PUT to upload_url with the X-Athena-Upload-Token header (the curl field is that command); its answer is the new asset. A link works once, for 15 minutes.
|
|
162
|
+
*
|
|
163
|
+
* @param {AthenaIntelligence.CreateUploadLinkRequestIn} request
|
|
164
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
165
|
+
*
|
|
166
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
167
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
168
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
169
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* await client.assets.createUploadLink({
|
|
173
|
+
* file_name: "notes.md",
|
|
174
|
+
* parent_folder_id: "asset_folder_12345",
|
|
175
|
+
* title: "Quarterly notes"
|
|
176
|
+
* })
|
|
177
|
+
*/
|
|
178
|
+
createUploadLink(request: AthenaIntelligence.CreateUploadLinkRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.UploadLinkResponseOut>;
|
|
179
|
+
private __createUploadLink;
|
|
180
|
+
/**
|
|
181
|
+
* Send one file through a link from POST /api/v0/assets/upload-links: the body is the file's bytes and X-Athena-Upload-Token the link's credential; no API key is needed. Athena runs POST /api/v0/assets/create-from-file as the person who asked for the link, with every gate again (an agent run's tool policy included), and answers with the new asset. A link works once: the first upload spends it, whatever its answer.
|
|
182
|
+
*
|
|
183
|
+
* @param {core.file.Uploadable} uploadable
|
|
184
|
+
* @param {string} link_id
|
|
185
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
186
|
+
*
|
|
187
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
188
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
189
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
190
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
191
|
+
* @throws {@link AthenaIntelligence.GoneError}
|
|
192
|
+
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
193
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
194
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
195
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
196
|
+
*/
|
|
197
|
+
uploadThroughLink(uploadable: core.file.Uploadable, link_id: string, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.CreateAssetResponseOut>;
|
|
198
|
+
private __uploadThroughLink;
|
|
158
199
|
/**
|
|
159
200
|
* Retrieve a single asset by its ID. Returns comprehensive metadata including creation info, tags, timestamps, media type, and AI-generated summary.
|
|
160
201
|
*
|
|
@@ -321,7 +321,7 @@ export class AssetsClient {
|
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
|
-
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). Nothing is left behind when the import fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run,
|
|
324
|
+
* Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). A Markdown (.md, .markdown) or plain-text (.txt, .text) file becomes an Athena document, its Markdown rendered (headings, lists, tables, links) and plain text one paragraph per line, and an HTML (.html, .htm) file becomes a user interface: Athena stores the file and converts it in place in the request, as the app's Convert to does, so the original upload stays downloadable from the new asset's Versions pane. A Markdown or text file may be up to 2 MiB and an HTML file up to 5 MiB. Nothing is left behind when the import or conversion fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run, a presentation takes the create_presentation_pptx_studio tool policy and a user interface the create_new_user_interface tool policy.
|
|
325
325
|
*
|
|
326
326
|
* @param {AthenaIntelligence.BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost} request
|
|
327
327
|
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -329,9 +329,11 @@ export class AssetsClient {
|
|
|
329
329
|
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
330
330
|
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
331
331
|
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
332
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
332
333
|
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
333
334
|
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
334
335
|
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
336
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
335
337
|
*
|
|
336
338
|
* @example
|
|
337
339
|
* import { createReadStream } from "fs";
|
|
@@ -391,12 +393,16 @@ export class AssetsClient {
|
|
|
391
393
|
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
392
394
|
case 404:
|
|
393
395
|
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
396
|
+
case 409:
|
|
397
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
394
398
|
case 413:
|
|
395
399
|
throw new AthenaIntelligence.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
396
400
|
case 422:
|
|
397
401
|
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
398
402
|
case 502:
|
|
399
403
|
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
404
|
+
case 503:
|
|
405
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
400
406
|
default:
|
|
401
407
|
throw new errors.AthenaIntelligenceError({
|
|
402
408
|
statusCode: _response.error.statusCode,
|
|
@@ -682,6 +688,193 @@ export class AssetsClient {
|
|
|
682
688
|
}
|
|
683
689
|
});
|
|
684
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Mint a one-time link that takes one file without an API key, for a caller that can run a shell command but holds no key, such as an agent connected through an Athena MCP server. The file's name decides what it becomes, as with POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation. The gates of create-from-file run now (membership in the workspace, EDIT on parent_folder_id, the deployment's offering, an agent run's tool policy) and again when the file arrives. Send the file's bytes as the body of one PUT to upload_url with the X-Athena-Upload-Token header (the curl field is that command); its answer is the new asset. A link works once, for 15 minutes.
|
|
693
|
+
*
|
|
694
|
+
* @param {AthenaIntelligence.CreateUploadLinkRequestIn} request
|
|
695
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
696
|
+
*
|
|
697
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
698
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
699
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
700
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
701
|
+
*
|
|
702
|
+
* @example
|
|
703
|
+
* await client.assets.createUploadLink({
|
|
704
|
+
* file_name: "notes.md",
|
|
705
|
+
* parent_folder_id: "asset_folder_12345",
|
|
706
|
+
* title: "Quarterly notes"
|
|
707
|
+
* })
|
|
708
|
+
*/
|
|
709
|
+
createUploadLink(request, requestOptions) {
|
|
710
|
+
return core.HttpResponsePromise.fromPromise(this.__createUploadLink(request, requestOptions));
|
|
711
|
+
}
|
|
712
|
+
__createUploadLink(request, requestOptions) {
|
|
713
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
714
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
715
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
716
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
717
|
+
"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,
|
|
718
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
719
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
720
|
+
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/assets/upload-links"),
|
|
721
|
+
method: "POST",
|
|
722
|
+
headers: _headers,
|
|
723
|
+
contentType: "application/json",
|
|
724
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
725
|
+
requestType: "json",
|
|
726
|
+
body: request,
|
|
727
|
+
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,
|
|
728
|
+
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,
|
|
729
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
730
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
731
|
+
logging: this._options.logging,
|
|
732
|
+
});
|
|
733
|
+
if (_response.ok) {
|
|
734
|
+
return {
|
|
735
|
+
data: _response.body,
|
|
736
|
+
rawResponse: _response.rawResponse,
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
if (_response.error.reason === "status-code") {
|
|
740
|
+
switch (_response.error.statusCode) {
|
|
741
|
+
case 403:
|
|
742
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
743
|
+
case 404:
|
|
744
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
745
|
+
case 422:
|
|
746
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
747
|
+
case 503:
|
|
748
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
749
|
+
default:
|
|
750
|
+
throw new errors.AthenaIntelligenceError({
|
|
751
|
+
statusCode: _response.error.statusCode,
|
|
752
|
+
body: _response.error.body,
|
|
753
|
+
rawResponse: _response.rawResponse,
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
switch (_response.error.reason) {
|
|
758
|
+
case "non-json":
|
|
759
|
+
throw new errors.AthenaIntelligenceError({
|
|
760
|
+
statusCode: _response.error.statusCode,
|
|
761
|
+
body: _response.error.rawBody,
|
|
762
|
+
rawResponse: _response.rawResponse,
|
|
763
|
+
});
|
|
764
|
+
case "body-is-null":
|
|
765
|
+
throw new errors.AthenaIntelligenceError({
|
|
766
|
+
statusCode: _response.error.statusCode,
|
|
767
|
+
rawResponse: _response.rawResponse,
|
|
768
|
+
});
|
|
769
|
+
case "timeout":
|
|
770
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/assets/upload-links.");
|
|
771
|
+
case "unknown":
|
|
772
|
+
throw new errors.AthenaIntelligenceError({
|
|
773
|
+
message: _response.error.errorMessage,
|
|
774
|
+
rawResponse: _response.rawResponse,
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Send one file through a link from POST /api/v0/assets/upload-links: the body is the file's bytes and X-Athena-Upload-Token the link's credential; no API key is needed. Athena runs POST /api/v0/assets/create-from-file as the person who asked for the link, with every gate again (an agent run's tool policy included), and answers with the new asset. A link works once: the first upload spends it, whatever its answer.
|
|
781
|
+
*
|
|
782
|
+
* @param {core.file.Uploadable} uploadable
|
|
783
|
+
* @param {string} link_id
|
|
784
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
785
|
+
*
|
|
786
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
787
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
788
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
789
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
790
|
+
* @throws {@link AthenaIntelligence.GoneError}
|
|
791
|
+
* @throws {@link AthenaIntelligence.ContentTooLargeError}
|
|
792
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
793
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
794
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
795
|
+
*/
|
|
796
|
+
uploadThroughLink(uploadable, link_id, requestOptions) {
|
|
797
|
+
return core.HttpResponsePromise.fromPromise(this.__uploadThroughLink(uploadable, link_id, requestOptions));
|
|
798
|
+
}
|
|
799
|
+
__uploadThroughLink(uploadable, link_id, requestOptions) {
|
|
800
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
801
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
802
|
+
const _binaryUploadRequest = yield core.file.toBinaryUploadRequest(uploadable);
|
|
803
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
804
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
805
|
+
"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,
|
|
806
|
+
}), _binaryUploadRequest.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
807
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
808
|
+
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/assets/upload-links/${core.url.encodePathParam(link_id)}`),
|
|
809
|
+
method: "PUT",
|
|
810
|
+
headers: _headers,
|
|
811
|
+
contentType: "application/octet-stream",
|
|
812
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
813
|
+
requestType: "bytes",
|
|
814
|
+
duplex: "half",
|
|
815
|
+
body: _binaryUploadRequest.body,
|
|
816
|
+
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,
|
|
817
|
+
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,
|
|
818
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
819
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
820
|
+
logging: this._options.logging,
|
|
821
|
+
});
|
|
822
|
+
if (_response.ok) {
|
|
823
|
+
return {
|
|
824
|
+
data: _response.body,
|
|
825
|
+
rawResponse: _response.rawResponse,
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
if (_response.error.reason === "status-code") {
|
|
829
|
+
switch (_response.error.statusCode) {
|
|
830
|
+
case 400:
|
|
831
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
832
|
+
case 401:
|
|
833
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
834
|
+
case 403:
|
|
835
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
836
|
+
case 404:
|
|
837
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
838
|
+
case 410:
|
|
839
|
+
throw new AthenaIntelligence.GoneError(_response.error.body, _response.rawResponse);
|
|
840
|
+
case 413:
|
|
841
|
+
throw new AthenaIntelligence.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
842
|
+
case 422:
|
|
843
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
844
|
+
case 502:
|
|
845
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
846
|
+
case 503:
|
|
847
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
848
|
+
default:
|
|
849
|
+
throw new errors.AthenaIntelligenceError({
|
|
850
|
+
statusCode: _response.error.statusCode,
|
|
851
|
+
body: _response.error.body,
|
|
852
|
+
rawResponse: _response.rawResponse,
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
switch (_response.error.reason) {
|
|
857
|
+
case "non-json":
|
|
858
|
+
throw new errors.AthenaIntelligenceError({
|
|
859
|
+
statusCode: _response.error.statusCode,
|
|
860
|
+
body: _response.error.rawBody,
|
|
861
|
+
rawResponse: _response.rawResponse,
|
|
862
|
+
});
|
|
863
|
+
case "body-is-null":
|
|
864
|
+
throw new errors.AthenaIntelligenceError({
|
|
865
|
+
statusCode: _response.error.statusCode,
|
|
866
|
+
rawResponse: _response.rawResponse,
|
|
867
|
+
});
|
|
868
|
+
case "timeout":
|
|
869
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling PUT /api/v0/assets/upload-links/{link_id}.");
|
|
870
|
+
case "unknown":
|
|
871
|
+
throw new errors.AthenaIntelligenceError({
|
|
872
|
+
message: _response.error.errorMessage,
|
|
873
|
+
rawResponse: _response.rawResponse,
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
}
|
|
685
878
|
/**
|
|
686
879
|
* Retrieve a single asset by its ID. Returns comprehensive metadata including creation info, tags, timestamps, media type, and AI-generated summary.
|
|
687
880
|
*
|
|
@@ -14,6 +14,6 @@ export interface BodyCreateAssetFromFilePublicApiV0AssetsCreateFromFilePost {
|
|
|
14
14
|
workspace_id?: string | null;
|
|
15
15
|
/** An asset you can read that the file came from; without parent_folder_id the new asset goes next to it when you may create there */
|
|
16
16
|
source_asset_id?: string | null;
|
|
17
|
-
/** The .docx, .pptx or .
|
|
17
|
+
/** The .docx, .pptx, .potx, .md, .markdown, .txt, .text, .html or .htm file to create the asset from */
|
|
18
18
|
file: core.file.Uploadable;
|
|
19
19
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* file_name: "notes.md",
|
|
5
|
+
* parent_folder_id: "asset_folder_12345",
|
|
6
|
+
* title: "Quarterly notes"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface CreateUploadLinkRequestIn {
|
|
10
|
+
/** The name of the file you will send, which decides what it becomes, as in POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation */
|
|
11
|
+
file_name: string;
|
|
12
|
+
/** Folder to put the new asset in; you need EDIT on it */
|
|
13
|
+
parent_folder_id?: string | null;
|
|
14
|
+
/** Title for the new asset; defaults to the file's name */
|
|
15
|
+
title?: string | null;
|
|
16
|
+
/** Workspace to create the asset in; defaults to parent_folder_id's, else your current one */
|
|
17
|
+
workspace_id?: string | null;
|
|
18
|
+
}
|
|
@@ -7,6 +7,7 @@ export type { ConvertToUserInterfaceAssetsRequest } from "./ConvertToUserInterfa
|
|
|
7
7
|
export type { CreateAssetRequestIn } from "./CreateAssetRequestIn.mjs";
|
|
8
8
|
export type { CreateProjectRequestIn } from "./CreateProjectRequestIn.mjs";
|
|
9
9
|
export type { CreateStudioTokenAssetsRequest } from "./CreateStudioTokenAssetsRequest.mjs";
|
|
10
|
+
export type { CreateUploadLinkRequestIn } from "./CreateUploadLinkRequestIn.mjs";
|
|
10
11
|
export type { DownloadAssetsRequest } from "./DownloadAssetsRequest.mjs";
|
|
11
12
|
export type { DuplicateAssetRequestIn } from "./DuplicateAssetRequestIn.mjs";
|
|
12
13
|
export type { GetAccessAssetsRequest } from "./GetAccessAssetsRequest.mjs";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A one-time link that takes one file, sent without an API key.
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadLinkResponseOut {
|
|
5
|
+
/** What the file becomes */
|
|
6
|
+
asset_type: string;
|
|
7
|
+
/** A curl command that sends the file, every argument shell-quoted; replace the path placeholder with your file's path. It prints the new asset as JSON */
|
|
8
|
+
curl: string;
|
|
9
|
+
/** When the link stops working (UTC) */
|
|
10
|
+
expires_at: string;
|
|
11
|
+
/** The file the link takes */
|
|
12
|
+
file_name: string;
|
|
13
|
+
/** Headers the upload must carry: X-Athena-Upload-Token, the link's one-time credential. It works once, until expires_at */
|
|
14
|
+
headers: Record<string, string>;
|
|
15
|
+
/** ID of the link */
|
|
16
|
+
link_id: string;
|
|
17
|
+
/** The largest file the link takes */
|
|
18
|
+
max_bytes: number;
|
|
19
|
+
/** The HTTP method the upload uses */
|
|
20
|
+
method?: UploadLinkResponseOut.Method;
|
|
21
|
+
/** Where to send the file: one PUT, its body the file's bytes */
|
|
22
|
+
upload_url: string;
|
|
23
|
+
}
|
|
24
|
+
export declare namespace UploadLinkResponseOut {
|
|
25
|
+
/** The HTTP method the upload uses */
|
|
26
|
+
const Method: {
|
|
27
|
+
readonly Put: "PUT";
|
|
28
|
+
};
|
|
29
|
+
type Method = (typeof Method)[keyof typeof Method];
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var UploadLinkResponseOut;
|
|
3
|
+
(function (UploadLinkResponseOut) {
|
|
4
|
+
/** The HTTP method the upload uses */
|
|
5
|
+
UploadLinkResponseOut.Method = {
|
|
6
|
+
Put: "PUT",
|
|
7
|
+
};
|
|
8
|
+
})(UploadLinkResponseOut || (UploadLinkResponseOut = {}));
|
|
@@ -169,6 +169,7 @@ export * from "./ToolUseContent.mjs";
|
|
|
169
169
|
export * from "./UpdateAssetConfigResponseOut.mjs";
|
|
170
170
|
export * from "./UpdateWorkspaceDisclaimerIn.mjs";
|
|
171
171
|
export * from "./UpdateWorkspaceToolRegistryToolIn.mjs";
|
|
172
|
+
export * from "./UploadLinkResponseOut.mjs";
|
|
172
173
|
export * from "./UserInfoOut.mjs";
|
|
173
174
|
export * from "./WorkspaceAccessResponseOut.mjs";
|
|
174
175
|
export * from "./WorkspaceConfigurationResponseOut.mjs";
|
|
@@ -169,6 +169,7 @@ export * from "./ToolUseContent.mjs";
|
|
|
169
169
|
export * from "./UpdateAssetConfigResponseOut.mjs";
|
|
170
170
|
export * from "./UpdateWorkspaceDisclaimerIn.mjs";
|
|
171
171
|
export * from "./UpdateWorkspaceToolRegistryToolIn.mjs";
|
|
172
|
+
export * from "./UploadLinkResponseOut.mjs";
|
|
172
173
|
export * from "./UserInfoOut.mjs";
|
|
173
174
|
export * from "./WorkspaceAccessResponseOut.mjs";
|
|
174
175
|
export * from "./WorkspaceConfigurationResponseOut.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.3.
|
|
1
|
+
export declare const SDK_VERSION = "4.3.2299";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "4.3.
|
|
1
|
+
export const SDK_VERSION = "4.3.2299";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -715,7 +715,7 @@ await client.assets.create({
|
|
|
715
715
|
<dl>
|
|
716
716
|
<dd>
|
|
717
717
|
|
|
718
|
-
Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). Nothing is left behind when the import fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run,
|
|
718
|
+
Create a Word document from a .docx file, or a presentation from a .pptx or .potx file, holding that file's content: the asset Athena makes when you create one from a file in the app. Athena imports the file through DOCX Studio or PPTX Studio with its own studio credential, as your write, and answers once the asset is ready (a large deck can take a few minutes). A Markdown (.md, .markdown) or plain-text (.txt, .text) file becomes an Athena document, its Markdown rendered (headings, lists, tables, links) and plain text one paragraph per line, and an HTML (.html, .htm) file becomes a user interface: Athena stores the file and converts it in place in the request, as the app's Convert to does, so the original upload stays downloadable from the new asset's Versions pane. A Markdown or text file may be up to 2 MiB and an HTML file up to 5 MiB. Nothing is left behind when the import or conversion fails. The file's name decides the type; the title defaults to the name without its extension. Gates are those of POST /api/v0/assets/create: membership in the workspace (workspace_id, else parent_folder_id's, else your current one) and EDIT on parent_folder_id. With source_asset_id (an asset you can read, for example the document the file was exported from) and no parent_folder_id, the new asset goes into the source's folder when you may create there, otherwise at your root. Unlike POST /api/v0/tools/file/save, which stores the file itself and turns an Office upload into its editable type in the background, this makes the editable asset in the request and keeps no file asset. A Word file may be up to 100 MB, Word for the web's limit, a PowerPoint file up to 100 MiB. A Word file gets the app's upload checks before anything is created, and one it refuses answers 422 with detail {code, message}: code is password_protected, rights_managed, damaged (unreadable content, which File > Import in the app can recover), format_mismatch (a template or macro-enabled file named .docx), not_ooxml, too_large or uncompressed_too_large, and message says why in Word's words. From an agent run (a verified X-Athena-Session-Credential), a Word document's first write also records the run, a presentation takes the create_presentation_pptx_studio tool policy and a user interface the create_new_user_interface tool policy.
|
|
719
719
|
</dd>
|
|
720
720
|
</dl>
|
|
721
721
|
</dd>
|
|
@@ -962,6 +962,73 @@ await client.assets.duplicate({
|
|
|
962
962
|
</dl>
|
|
963
963
|
|
|
964
964
|
|
|
965
|
+
</dd>
|
|
966
|
+
</dl>
|
|
967
|
+
</details>
|
|
968
|
+
|
|
969
|
+
<details><summary><code>client.assets.<a href="/src/api/resources/assets/client/Client.ts">createUploadLink</a>({ ...params }) -> AthenaIntelligence.UploadLinkResponseOut</code></summary>
|
|
970
|
+
<dl>
|
|
971
|
+
<dd>
|
|
972
|
+
|
|
973
|
+
#### 📝 Description
|
|
974
|
+
|
|
975
|
+
<dl>
|
|
976
|
+
<dd>
|
|
977
|
+
|
|
978
|
+
<dl>
|
|
979
|
+
<dd>
|
|
980
|
+
|
|
981
|
+
Mint a one-time link that takes one file without an API key, for a caller that can run a shell command but holds no key, such as an agent connected through an Athena MCP server. The file's name decides what it becomes, as with POST /api/v0/assets/create-from-file: a .md, .markdown, .txt or .text file an Athena document, a .html or .htm file a user interface, a .docx file a Word document and a .pptx or .potx file a presentation. The gates of create-from-file run now (membership in the workspace, EDIT on parent_folder_id, the deployment's offering, an agent run's tool policy) and again when the file arrives. Send the file's bytes as the body of one PUT to upload_url with the X-Athena-Upload-Token header (the curl field is that command); its answer is the new asset. A link works once, for 15 minutes.
|
|
982
|
+
</dd>
|
|
983
|
+
</dl>
|
|
984
|
+
</dd>
|
|
985
|
+
</dl>
|
|
986
|
+
|
|
987
|
+
#### 🔌 Usage
|
|
988
|
+
|
|
989
|
+
<dl>
|
|
990
|
+
<dd>
|
|
991
|
+
|
|
992
|
+
<dl>
|
|
993
|
+
<dd>
|
|
994
|
+
|
|
995
|
+
```typescript
|
|
996
|
+
await client.assets.createUploadLink({
|
|
997
|
+
file_name: "notes.md",
|
|
998
|
+
parent_folder_id: "asset_folder_12345",
|
|
999
|
+
title: "Quarterly notes"
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
```
|
|
1003
|
+
</dd>
|
|
1004
|
+
</dl>
|
|
1005
|
+
</dd>
|
|
1006
|
+
</dl>
|
|
1007
|
+
|
|
1008
|
+
#### ⚙️ Parameters
|
|
1009
|
+
|
|
1010
|
+
<dl>
|
|
1011
|
+
<dd>
|
|
1012
|
+
|
|
1013
|
+
<dl>
|
|
1014
|
+
<dd>
|
|
1015
|
+
|
|
1016
|
+
**request:** `AthenaIntelligence.CreateUploadLinkRequestIn`
|
|
1017
|
+
|
|
1018
|
+
</dd>
|
|
1019
|
+
</dl>
|
|
1020
|
+
|
|
1021
|
+
<dl>
|
|
1022
|
+
<dd>
|
|
1023
|
+
|
|
1024
|
+
**requestOptions:** `AssetsClient.RequestOptions`
|
|
1025
|
+
|
|
1026
|
+
</dd>
|
|
1027
|
+
</dl>
|
|
1028
|
+
</dd>
|
|
1029
|
+
</dl>
|
|
1030
|
+
|
|
1031
|
+
|
|
965
1032
|
</dd>
|
|
966
1033
|
</dl>
|
|
967
1034
|
</details>
|