@athenaintel/sdk 4.3.2245 → 4.3.2246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/assets/client/Client.d.ts +18 -0
  3. package/dist/cjs/api/resources/assets/client/Client.js +85 -0
  4. package/dist/cjs/api/resources/assets/client/requests/GetAccessAssetsRequest.d.ts +12 -0
  5. package/dist/cjs/api/resources/assets/client/requests/GetAccessAssetsRequest.js +3 -0
  6. package/dist/cjs/api/resources/assets/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/types/AssetAccessOut.d.ts +28 -0
  8. package/dist/cjs/api/types/AssetAccessOut.js +14 -0
  9. package/dist/cjs/api/types/AssetAccessSourceOut.d.ts +32 -0
  10. package/dist/cjs/api/types/AssetAccessSourceOut.js +22 -0
  11. package/dist/cjs/api/types/index.d.ts +2 -0
  12. package/dist/cjs/api/types/index.js +2 -0
  13. package/dist/cjs/version.d.ts +1 -1
  14. package/dist/cjs/version.js +1 -1
  15. package/dist/esm/BaseClient.mjs +2 -2
  16. package/dist/esm/api/resources/assets/client/Client.d.mts +18 -0
  17. package/dist/esm/api/resources/assets/client/Client.mjs +85 -0
  18. package/dist/esm/api/resources/assets/client/requests/GetAccessAssetsRequest.d.mts +12 -0
  19. package/dist/esm/api/resources/assets/client/requests/GetAccessAssetsRequest.mjs +2 -0
  20. package/dist/esm/api/resources/assets/client/requests/index.d.mts +1 -0
  21. package/dist/esm/api/types/AssetAccessOut.d.mts +28 -0
  22. package/dist/esm/api/types/AssetAccessOut.mjs +11 -0
  23. package/dist/esm/api/types/AssetAccessSourceOut.d.mts +32 -0
  24. package/dist/esm/api/types/AssetAccessSourceOut.mjs +19 -0
  25. package/dist/esm/api/types/index.d.mts +2 -0
  26. package/dist/esm/api/types/index.mjs +2 -0
  27. package/dist/esm/version.d.mts +1 -1
  28. package/dist/esm/version.mjs +1 -1
  29. package/package.json +1 -1
  30. package/reference.md +65 -0
@@ -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.2245",
47
- "User-Agent": "@athenaintel/sdk/4.3.2245",
46
+ "X-Fern-SDK-Version": "4.3.2246",
47
+ "User-Agent": "@athenaintel/sdk/4.3.2246",
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,
@@ -157,6 +157,24 @@ export declare class AssetsClient {
157
157
  */
158
158
  rename(request: AthenaIntelligence.RenameAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.RenameAssetResponseOut>;
159
159
  private __rename;
160
+ /**
161
+ * Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
162
+ *
163
+ * @param {AthenaIntelligence.GetAccessAssetsRequest} 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.getAccess({
173
+ * asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
174
+ * })
175
+ */
176
+ getAccess(request: AthenaIntelligence.GetAccessAssetsRequest, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AssetAccessOut>;
177
+ private __getAccess;
160
178
  /**
161
179
  * Admin only. List the edit history of a collaborative asset, newest first: who edited it, when, and under which agent/session attribution. Works for every collaborative asset type. Each item's from_clock/to_clock identify the edit for the companion delta endpoint, which reports what actually changed.
162
180
  *
@@ -699,6 +699,91 @@ class AssetsClient {
699
699
  }
700
700
  });
701
701
  }
702
+ /**
703
+ * Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
704
+ *
705
+ * @param {AthenaIntelligence.GetAccessAssetsRequest} request
706
+ * @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
707
+ *
708
+ * @throws {@link AthenaIntelligence.ForbiddenError}
709
+ * @throws {@link AthenaIntelligence.NotFoundError}
710
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
711
+ * @throws {@link AthenaIntelligence.ServiceUnavailableError}
712
+ *
713
+ * @example
714
+ * await client.assets.getAccess({
715
+ * asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
716
+ * })
717
+ */
718
+ getAccess(request, requestOptions) {
719
+ return core.HttpResponsePromise.fromPromise(this.__getAccess(request, requestOptions));
720
+ }
721
+ __getAccess(request, requestOptions) {
722
+ return __awaiter(this, void 0, void 0, function* () {
723
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
724
+ const { asset_id: assetId, user_id: userId } = request;
725
+ const _queryParams = {};
726
+ if (userId !== undefined) {
727
+ _queryParams.user_id = userId;
728
+ }
729
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
730
+ 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)({
731
+ "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,
732
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
733
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
734
+ 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/${core.url.encodePathParam(assetId)}/access`),
735
+ method: "GET",
736
+ headers: _headers,
737
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
738
+ 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,
739
+ 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,
740
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
741
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
742
+ logging: this._options.logging,
743
+ });
744
+ if (_response.ok) {
745
+ return { data: _response.body, rawResponse: _response.rawResponse };
746
+ }
747
+ if (_response.error.reason === "status-code") {
748
+ switch (_response.error.statusCode) {
749
+ case 403:
750
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
751
+ case 404:
752
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
753
+ case 422:
754
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
755
+ case 503:
756
+ throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
757
+ default:
758
+ throw new errors.AthenaIntelligenceError({
759
+ statusCode: _response.error.statusCode,
760
+ body: _response.error.body,
761
+ rawResponse: _response.rawResponse,
762
+ });
763
+ }
764
+ }
765
+ switch (_response.error.reason) {
766
+ case "non-json":
767
+ throw new errors.AthenaIntelligenceError({
768
+ statusCode: _response.error.statusCode,
769
+ body: _response.error.rawBody,
770
+ rawResponse: _response.rawResponse,
771
+ });
772
+ case "body-is-null":
773
+ throw new errors.AthenaIntelligenceError({
774
+ statusCode: _response.error.statusCode,
775
+ rawResponse: _response.rawResponse,
776
+ });
777
+ case "timeout":
778
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/assets/{asset_id}/access.");
779
+ case "unknown":
780
+ throw new errors.AthenaIntelligenceError({
781
+ message: _response.error.errorMessage,
782
+ rawResponse: _response.rawResponse,
783
+ });
784
+ }
785
+ });
786
+ }
702
787
  /**
703
788
  * Admin only. List the edit history of a collaborative asset, newest first: who edited it, when, and under which agent/session attribution. Works for every collaborative asset type. Each item's from_clock/to_clock identify the edit for the companion delta endpoint, which reports what actually changed.
704
789
  *
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
5
+ * }
6
+ */
7
+ export interface GetAccessAssetsRequest {
8
+ /** Unique identifier of the asset */
9
+ asset_id: string;
10
+ /** The user whose access to read. Leave it out to read your own. Reading another user's access needs edit access to the asset. */
11
+ user_id?: string | null;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,7 @@ export type { CreateAssetRequestIn } from "./CreateAssetRequestIn.js";
7
7
  export type { CreateProjectRequestIn } from "./CreateProjectRequestIn.js";
8
8
  export type { DownloadAssetsRequest } from "./DownloadAssetsRequest.js";
9
9
  export type { DuplicateAssetRequestIn } from "./DuplicateAssetRequestIn.js";
10
+ export type { GetAccessAssetsRequest } from "./GetAccessAssetsRequest.js";
10
11
  export type { GetActivityDeltaAssetsRequest } from "./GetActivityDeltaAssetsRequest.js";
11
12
  export type { GetAssetsRequest } from "./GetAssetsRequest.js";
12
13
  export type { ListActivityAssetsRequest } from "./ListActivityAssetsRequest.js";
@@ -0,0 +1,28 @@
1
+ import type * as AthenaIntelligence from "../index.js";
2
+ /**
3
+ * Response model for reading a user's effective access on an asset.
4
+ */
5
+ export interface AssetAccessOut {
6
+ /** ID of the asset */
7
+ asset_id: string;
8
+ /** Whether the user has an active membership in the asset's workspace. A user who is not a member reads as 'none'; the one exception is the workspace's own external viewer, who can still open what is shared with them. A suspended member reads as 'none' with no sources, and this field still reports their membership. */
9
+ is_member: boolean;
10
+ /** The access the user has, as Athena's permission checks decide it: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, 'none' cannot open it. When a check refuses what a listed source grants, the level is lower than that source, and the level is what holds. */
11
+ level: AssetAccessOut.Level;
12
+ /** Every grant that contributes to the level */
13
+ sources: AthenaIntelligence.AssetAccessSourceOut[];
14
+ /** The user whose access was read */
15
+ user_id: string;
16
+ /** The workspace the asset belongs to */
17
+ workspace_id: string | null;
18
+ }
19
+ export declare namespace AssetAccessOut {
20
+ /** The access the user has, as Athena's permission checks decide it: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, 'none' cannot open it. When a check refuses what a listed source grants, the level is lower than that source, and the level is what holds. */
21
+ const Level: {
22
+ readonly Owner: "owner";
23
+ readonly Edit: "edit";
24
+ readonly View: "view";
25
+ readonly None: "none";
26
+ };
27
+ type Level = (typeof Level)[keyof typeof Level];
28
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AssetAccessOut = void 0;
5
+ var AssetAccessOut;
6
+ (function (AssetAccessOut) {
7
+ /** The access the user has, as Athena's permission checks decide it: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, 'none' cannot open it. When a check refuses what a listed source grants, the level is lower than that source, and the level is what holds. */
8
+ AssetAccessOut.Level = {
9
+ Owner: "owner",
10
+ Edit: "edit",
11
+ View: "view",
12
+ None: "none",
13
+ };
14
+ })(AssetAccessOut || (exports.AssetAccessOut = AssetAccessOut = {}));
@@ -0,0 +1,32 @@
1
+ /**
2
+ * One grant that contributes to a user's access on an asset.
3
+ */
4
+ export interface AssetAccessSourceOut {
5
+ /** The workspace group, when kind is 'group' */
6
+ group_id?: string | null;
7
+ /** The workspace group's name, when kind is 'group' */
8
+ group_name?: string | null;
9
+ /** Where the grant comes from: 'owner' (the user created the asset), 'direct' (the asset is shared with the user), 'group' (it is shared with a workspace group the user belongs to), 'workspace' (it is shared with the whole workspace), 'drive' (a role on the drive the asset is in) or 'other' (access the share list does not hold, for example an environment admin, also on an asset in a drive, or the view of a folder that holds an asset the user can open). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. */
10
+ kind: AssetAccessSourceOut.Kind;
11
+ /** The level this grant gives */
12
+ level: AssetAccessSourceOut.Level;
13
+ }
14
+ export declare namespace AssetAccessSourceOut {
15
+ /** Where the grant comes from: 'owner' (the user created the asset), 'direct' (the asset is shared with the user), 'group' (it is shared with a workspace group the user belongs to), 'workspace' (it is shared with the whole workspace), 'drive' (a role on the drive the asset is in) or 'other' (access the share list does not hold, for example an environment admin, also on an asset in a drive, or the view of a folder that holds an asset the user can open). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. */
16
+ const Kind: {
17
+ readonly Owner: "owner";
18
+ readonly Direct: "direct";
19
+ readonly Group: "group";
20
+ readonly Workspace: "workspace";
21
+ readonly Drive: "drive";
22
+ readonly Other: "other";
23
+ };
24
+ type Kind = (typeof Kind)[keyof typeof Kind];
25
+ /** The level this grant gives */
26
+ const Level: {
27
+ readonly Owner: "owner";
28
+ readonly Edit: "edit";
29
+ readonly View: "view";
30
+ };
31
+ type Level = (typeof Level)[keyof typeof Level];
32
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AssetAccessSourceOut = void 0;
5
+ var AssetAccessSourceOut;
6
+ (function (AssetAccessSourceOut) {
7
+ /** Where the grant comes from: 'owner' (the user created the asset), 'direct' (the asset is shared with the user), 'group' (it is shared with a workspace group the user belongs to), 'workspace' (it is shared with the whole workspace), 'drive' (a role on the drive the asset is in) or 'other' (access the share list does not hold, for example an environment admin, also on an asset in a drive, or the view of a folder that holds an asset the user can open). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. */
8
+ AssetAccessSourceOut.Kind = {
9
+ Owner: "owner",
10
+ Direct: "direct",
11
+ Group: "group",
12
+ Workspace: "workspace",
13
+ Drive: "drive",
14
+ Other: "other",
15
+ };
16
+ /** The level this grant gives */
17
+ AssetAccessSourceOut.Level = {
18
+ Owner: "owner",
19
+ Edit: "edit",
20
+ View: "view",
21
+ };
22
+ })(AssetAccessSourceOut || (exports.AssetAccessSourceOut = AssetAccessSourceOut = {}));
@@ -15,6 +15,8 @@ export * from "./AopExecuteRequestIn.js";
15
15
  export * from "./AopExecuteResponseOut.js";
16
16
  export * from "./ApprovalMode.js";
17
17
  export * from "./ArchiveAssetResponseOut.js";
18
+ export * from "./AssetAccessOut.js";
19
+ export * from "./AssetAccessSourceOut.js";
18
20
  export * from "./AssetActivityDeltaResponseOut.js";
19
21
  export * from "./AssetActivityResponseOut.js";
20
22
  export * from "./AssetCapabilitiesResponseOut.js";
@@ -31,6 +31,8 @@ __exportStar(require("./AopExecuteRequestIn.js"), exports);
31
31
  __exportStar(require("./AopExecuteResponseOut.js"), exports);
32
32
  __exportStar(require("./ApprovalMode.js"), exports);
33
33
  __exportStar(require("./ArchiveAssetResponseOut.js"), exports);
34
+ __exportStar(require("./AssetAccessOut.js"), exports);
35
+ __exportStar(require("./AssetAccessSourceOut.js"), exports);
34
36
  __exportStar(require("./AssetActivityDeltaResponseOut.js"), exports);
35
37
  __exportStar(require("./AssetActivityResponseOut.js"), exports);
36
38
  __exportStar(require("./AssetCapabilitiesResponseOut.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.3.2245";
1
+ export declare const SDK_VERSION = "4.3.2246";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "4.3.2245";
4
+ exports.SDK_VERSION = "4.3.2246";
@@ -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.2245",
10
- "User-Agent": "@athenaintel/sdk/4.3.2245",
9
+ "X-Fern-SDK-Version": "4.3.2246",
10
+ "User-Agent": "@athenaintel/sdk/4.3.2246",
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,
@@ -157,6 +157,24 @@ export declare class AssetsClient {
157
157
  */
158
158
  rename(request: AthenaIntelligence.RenameAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.RenameAssetResponseOut>;
159
159
  private __rename;
160
+ /**
161
+ * Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
162
+ *
163
+ * @param {AthenaIntelligence.GetAccessAssetsRequest} 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.getAccess({
173
+ * asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
174
+ * })
175
+ */
176
+ getAccess(request: AthenaIntelligence.GetAccessAssetsRequest, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AssetAccessOut>;
177
+ private __getAccess;
160
178
  /**
161
179
  * Admin only. List the edit history of a collaborative asset, newest first: who edited it, when, and under which agent/session attribution. Works for every collaborative asset type. Each item's from_clock/to_clock identify the edit for the companion delta endpoint, which reports what actually changed.
162
180
  *
@@ -663,6 +663,91 @@ export class AssetsClient {
663
663
  }
664
664
  });
665
665
  }
666
+ /**
667
+ * Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
668
+ *
669
+ * @param {AthenaIntelligence.GetAccessAssetsRequest} request
670
+ * @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
671
+ *
672
+ * @throws {@link AthenaIntelligence.ForbiddenError}
673
+ * @throws {@link AthenaIntelligence.NotFoundError}
674
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
675
+ * @throws {@link AthenaIntelligence.ServiceUnavailableError}
676
+ *
677
+ * @example
678
+ * await client.assets.getAccess({
679
+ * asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
680
+ * })
681
+ */
682
+ getAccess(request, requestOptions) {
683
+ return core.HttpResponsePromise.fromPromise(this.__getAccess(request, requestOptions));
684
+ }
685
+ __getAccess(request, requestOptions) {
686
+ return __awaiter(this, void 0, void 0, function* () {
687
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
688
+ const { asset_id: assetId, user_id: userId } = request;
689
+ const _queryParams = {};
690
+ if (userId !== undefined) {
691
+ _queryParams.user_id = userId;
692
+ }
693
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
694
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
695
+ "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,
696
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
697
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
698
+ 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/${core.url.encodePathParam(assetId)}/access`),
699
+ method: "GET",
700
+ headers: _headers,
701
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
702
+ 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,
703
+ 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,
704
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
705
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
706
+ logging: this._options.logging,
707
+ });
708
+ if (_response.ok) {
709
+ return { data: _response.body, rawResponse: _response.rawResponse };
710
+ }
711
+ if (_response.error.reason === "status-code") {
712
+ switch (_response.error.statusCode) {
713
+ case 403:
714
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
715
+ case 404:
716
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
717
+ case 422:
718
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
719
+ case 503:
720
+ throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
721
+ default:
722
+ throw new errors.AthenaIntelligenceError({
723
+ statusCode: _response.error.statusCode,
724
+ body: _response.error.body,
725
+ rawResponse: _response.rawResponse,
726
+ });
727
+ }
728
+ }
729
+ switch (_response.error.reason) {
730
+ case "non-json":
731
+ throw new errors.AthenaIntelligenceError({
732
+ statusCode: _response.error.statusCode,
733
+ body: _response.error.rawBody,
734
+ rawResponse: _response.rawResponse,
735
+ });
736
+ case "body-is-null":
737
+ throw new errors.AthenaIntelligenceError({
738
+ statusCode: _response.error.statusCode,
739
+ rawResponse: _response.rawResponse,
740
+ });
741
+ case "timeout":
742
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/assets/{asset_id}/access.");
743
+ case "unknown":
744
+ throw new errors.AthenaIntelligenceError({
745
+ message: _response.error.errorMessage,
746
+ rawResponse: _response.rawResponse,
747
+ });
748
+ }
749
+ });
750
+ }
666
751
  /**
667
752
  * Admin only. List the edit history of a collaborative asset, newest first: who edited it, when, and under which agent/session attribution. Works for every collaborative asset type. Each item's from_clock/to_clock identify the edit for the companion delta endpoint, which reports what actually changed.
668
753
  *
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
5
+ * }
6
+ */
7
+ export interface GetAccessAssetsRequest {
8
+ /** Unique identifier of the asset */
9
+ asset_id: string;
10
+ /** The user whose access to read. Leave it out to read your own. Reading another user's access needs edit access to the asset. */
11
+ user_id?: string | null;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -7,6 +7,7 @@ export type { CreateAssetRequestIn } from "./CreateAssetRequestIn.mjs";
7
7
  export type { CreateProjectRequestIn } from "./CreateProjectRequestIn.mjs";
8
8
  export type { DownloadAssetsRequest } from "./DownloadAssetsRequest.mjs";
9
9
  export type { DuplicateAssetRequestIn } from "./DuplicateAssetRequestIn.mjs";
10
+ export type { GetAccessAssetsRequest } from "./GetAccessAssetsRequest.mjs";
10
11
  export type { GetActivityDeltaAssetsRequest } from "./GetActivityDeltaAssetsRequest.mjs";
11
12
  export type { GetAssetsRequest } from "./GetAssetsRequest.mjs";
12
13
  export type { ListActivityAssetsRequest } from "./ListActivityAssetsRequest.mjs";
@@ -0,0 +1,28 @@
1
+ import type * as AthenaIntelligence from "../index.mjs";
2
+ /**
3
+ * Response model for reading a user's effective access on an asset.
4
+ */
5
+ export interface AssetAccessOut {
6
+ /** ID of the asset */
7
+ asset_id: string;
8
+ /** Whether the user has an active membership in the asset's workspace. A user who is not a member reads as 'none'; the one exception is the workspace's own external viewer, who can still open what is shared with them. A suspended member reads as 'none' with no sources, and this field still reports their membership. */
9
+ is_member: boolean;
10
+ /** The access the user has, as Athena's permission checks decide it: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, 'none' cannot open it. When a check refuses what a listed source grants, the level is lower than that source, and the level is what holds. */
11
+ level: AssetAccessOut.Level;
12
+ /** Every grant that contributes to the level */
13
+ sources: AthenaIntelligence.AssetAccessSourceOut[];
14
+ /** The user whose access was read */
15
+ user_id: string;
16
+ /** The workspace the asset belongs to */
17
+ workspace_id: string | null;
18
+ }
19
+ export declare namespace AssetAccessOut {
20
+ /** The access the user has, as Athena's permission checks decide it: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, 'none' cannot open it. When a check refuses what a listed source grants, the level is lower than that source, and the level is what holds. */
21
+ const Level: {
22
+ readonly Owner: "owner";
23
+ readonly Edit: "edit";
24
+ readonly View: "view";
25
+ readonly None: "none";
26
+ };
27
+ type Level = (typeof Level)[keyof typeof Level];
28
+ }
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var AssetAccessOut;
3
+ (function (AssetAccessOut) {
4
+ /** The access the user has, as Athena's permission checks decide it: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, 'none' cannot open it. When a check refuses what a listed source grants, the level is lower than that source, and the level is what holds. */
5
+ AssetAccessOut.Level = {
6
+ Owner: "owner",
7
+ Edit: "edit",
8
+ View: "view",
9
+ None: "none",
10
+ };
11
+ })(AssetAccessOut || (AssetAccessOut = {}));
@@ -0,0 +1,32 @@
1
+ /**
2
+ * One grant that contributes to a user's access on an asset.
3
+ */
4
+ export interface AssetAccessSourceOut {
5
+ /** The workspace group, when kind is 'group' */
6
+ group_id?: string | null;
7
+ /** The workspace group's name, when kind is 'group' */
8
+ group_name?: string | null;
9
+ /** Where the grant comes from: 'owner' (the user created the asset), 'direct' (the asset is shared with the user), 'group' (it is shared with a workspace group the user belongs to), 'workspace' (it is shared with the whole workspace), 'drive' (a role on the drive the asset is in) or 'other' (access the share list does not hold, for example an environment admin, also on an asset in a drive, or the view of a folder that holds an asset the user can open). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. */
10
+ kind: AssetAccessSourceOut.Kind;
11
+ /** The level this grant gives */
12
+ level: AssetAccessSourceOut.Level;
13
+ }
14
+ export declare namespace AssetAccessSourceOut {
15
+ /** Where the grant comes from: 'owner' (the user created the asset), 'direct' (the asset is shared with the user), 'group' (it is shared with a workspace group the user belongs to), 'workspace' (it is shared with the whole workspace), 'drive' (a role on the drive the asset is in) or 'other' (access the share list does not hold, for example an environment admin, also on an asset in a drive, or the view of a folder that holds an asset the user can open). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. */
16
+ const Kind: {
17
+ readonly Owner: "owner";
18
+ readonly Direct: "direct";
19
+ readonly Group: "group";
20
+ readonly Workspace: "workspace";
21
+ readonly Drive: "drive";
22
+ readonly Other: "other";
23
+ };
24
+ type Kind = (typeof Kind)[keyof typeof Kind];
25
+ /** The level this grant gives */
26
+ const Level: {
27
+ readonly Owner: "owner";
28
+ readonly Edit: "edit";
29
+ readonly View: "view";
30
+ };
31
+ type Level = (typeof Level)[keyof typeof Level];
32
+ }
@@ -0,0 +1,19 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var AssetAccessSourceOut;
3
+ (function (AssetAccessSourceOut) {
4
+ /** Where the grant comes from: 'owner' (the user created the asset), 'direct' (the asset is shared with the user), 'group' (it is shared with a workspace group the user belongs to), 'workspace' (it is shared with the whole workspace), 'drive' (a role on the drive the asset is in) or 'other' (access the share list does not hold, for example an environment admin, also on an asset in a drive, or the view of a folder that holds an asset the user can open). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. */
5
+ AssetAccessSourceOut.Kind = {
6
+ Owner: "owner",
7
+ Direct: "direct",
8
+ Group: "group",
9
+ Workspace: "workspace",
10
+ Drive: "drive",
11
+ Other: "other",
12
+ };
13
+ /** The level this grant gives */
14
+ AssetAccessSourceOut.Level = {
15
+ Owner: "owner",
16
+ Edit: "edit",
17
+ View: "view",
18
+ };
19
+ })(AssetAccessSourceOut || (AssetAccessSourceOut = {}));
@@ -15,6 +15,8 @@ export * from "./AopExecuteRequestIn.mjs";
15
15
  export * from "./AopExecuteResponseOut.mjs";
16
16
  export * from "./ApprovalMode.mjs";
17
17
  export * from "./ArchiveAssetResponseOut.mjs";
18
+ export * from "./AssetAccessOut.mjs";
19
+ export * from "./AssetAccessSourceOut.mjs";
18
20
  export * from "./AssetActivityDeltaResponseOut.mjs";
19
21
  export * from "./AssetActivityResponseOut.mjs";
20
22
  export * from "./AssetCapabilitiesResponseOut.mjs";
@@ -15,6 +15,8 @@ export * from "./AopExecuteRequestIn.mjs";
15
15
  export * from "./AopExecuteResponseOut.mjs";
16
16
  export * from "./ApprovalMode.mjs";
17
17
  export * from "./ArchiveAssetResponseOut.mjs";
18
+ export * from "./AssetAccessOut.mjs";
19
+ export * from "./AssetAccessSourceOut.mjs";
18
20
  export * from "./AssetActivityDeltaResponseOut.mjs";
19
21
  export * from "./AssetActivityResponseOut.mjs";
20
22
  export * from "./AssetCapabilitiesResponseOut.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.3.2245";
1
+ export declare const SDK_VERSION = "4.3.2246";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.3.2245";
1
+ export const SDK_VERSION = "4.3.2246";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenaintel/sdk",
3
- "version": "4.3.2245",
3
+ "version": "4.3.2246",
4
4
  "private": false,
5
5
  "repository": "github:Athena-Intel/athena-typescript",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -973,6 +973,71 @@ await client.assets.rename({
973
973
  </dl>
974
974
 
975
975
 
976
+ </dd>
977
+ </dl>
978
+ </details>
979
+
980
+ <details><summary><code>client.assets.<a href="/src/api/resources/assets/client/Client.ts">getAccess</a>({ ...params }) -> AthenaIntelligence.AssetAccessOut</code></summary>
981
+ <dl>
982
+ <dd>
983
+
984
+ #### 📝 Description
985
+
986
+ <dl>
987
+ <dd>
988
+
989
+ <dl>
990
+ <dd>
991
+
992
+ Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
993
+ </dd>
994
+ </dl>
995
+ </dd>
996
+ </dl>
997
+
998
+ #### 🔌 Usage
999
+
1000
+ <dl>
1001
+ <dd>
1002
+
1003
+ <dl>
1004
+ <dd>
1005
+
1006
+ ```typescript
1007
+ await client.assets.getAccess({
1008
+ asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
1009
+ });
1010
+
1011
+ ```
1012
+ </dd>
1013
+ </dl>
1014
+ </dd>
1015
+ </dl>
1016
+
1017
+ #### ⚙️ Parameters
1018
+
1019
+ <dl>
1020
+ <dd>
1021
+
1022
+ <dl>
1023
+ <dd>
1024
+
1025
+ **request:** `AthenaIntelligence.GetAccessAssetsRequest`
1026
+
1027
+ </dd>
1028
+ </dl>
1029
+
1030
+ <dl>
1031
+ <dd>
1032
+
1033
+ **requestOptions:** `AssetsClient.RequestOptions`
1034
+
1035
+ </dd>
1036
+ </dl>
1037
+ </dd>
1038
+ </dl>
1039
+
1040
+
976
1041
  </dd>
977
1042
  </dl>
978
1043
  </details>