@credal/sdk 0.1.2 → 0.1.5

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 (121) hide show
  1. package/dist/cjs/Client.d.ts +0 -3
  2. package/dist/cjs/Client.js +6 -11
  3. package/dist/cjs/api/resources/{permissionsService/types/Group.d.ts → common/types/CustomMetadataValue.d.ts} +1 -4
  4. package/dist/cjs/api/resources/common/types/index.d.ts +1 -0
  5. package/dist/cjs/api/resources/common/types/index.js +1 -0
  6. package/dist/cjs/api/resources/copilots/client/Client.js +36 -27
  7. package/dist/cjs/api/resources/documentCatalog/client/Client.js +12 -9
  8. package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +5 -2
  9. package/dist/cjs/api/resources/documentCatalog/types/DocumentMetadataPatch.d.ts +1 -1
  10. package/dist/cjs/api/resources/documentCollections/client/Client.js +28 -21
  11. package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.ts +1 -3
  12. package/dist/cjs/api/resources/index.d.ts +0 -3
  13. package/dist/cjs/api/resources/index.js +1 -4
  14. package/dist/cjs/api/resources/search/client/Client.js +4 -3
  15. package/dist/cjs/api/resources/users/client/Client.js +4 -3
  16. package/dist/cjs/api/resources/users/types/UserMetadataPatch.d.ts +1 -1
  17. package/dist/cjs/core/auth/AuthProvider.d.ts +4 -0
  18. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  19. package/dist/cjs/{api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.js → core/auth/AuthRequest.js} +0 -3
  20. package/dist/cjs/core/auth/index.d.ts +2 -0
  21. package/dist/cjs/core/fetcher/Fetcher.js +2 -2
  22. package/dist/cjs/core/fetcher/index.d.ts +5 -5
  23. package/dist/cjs/core/fetcher/index.js +5 -5
  24. package/dist/cjs/version.d.ts +1 -1
  25. package/dist/cjs/version.js +1 -1
  26. package/dist/esm/Client.d.mts +0 -3
  27. package/dist/esm/Client.mjs +2 -7
  28. package/dist/esm/api/resources/{permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.d.mts} +1 -1
  29. package/dist/esm/api/resources/common/types/index.d.mts +1 -0
  30. package/dist/esm/api/resources/common/types/index.mjs +1 -0
  31. package/dist/esm/api/resources/copilots/client/Client.mjs +36 -27
  32. package/dist/esm/api/resources/documentCatalog/client/Client.mjs +12 -9
  33. package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts +5 -2
  34. package/dist/esm/api/resources/documentCatalog/types/DocumentMetadataPatch.d.mts +1 -1
  35. package/dist/esm/api/resources/documentCollections/client/Client.mjs +28 -21
  36. package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.mts +1 -3
  37. package/dist/esm/api/resources/index.d.mts +0 -3
  38. package/dist/esm/api/resources/index.mjs +0 -3
  39. package/dist/esm/api/resources/search/client/Client.mjs +4 -3
  40. package/dist/esm/api/resources/users/client/Client.mjs +4 -3
  41. package/dist/esm/api/resources/users/types/UserMetadataPatch.d.mts +1 -1
  42. package/dist/esm/core/auth/AuthProvider.d.mts +4 -0
  43. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  44. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  45. package/dist/esm/core/auth/index.d.mts +2 -0
  46. package/dist/esm/core/fetcher/Fetcher.mjs +2 -2
  47. package/dist/esm/core/fetcher/index.d.mts +5 -5
  48. package/dist/esm/core/fetcher/index.mjs +2 -2
  49. package/dist/esm/version.d.mts +1 -1
  50. package/dist/esm/version.mjs +1 -1
  51. package/package.json +1 -1
  52. package/reference.md +0 -213
  53. package/dist/cjs/api/resources/permissionsService/client/Client.d.ts +0 -86
  54. package/dist/cjs/api/resources/permissionsService/client/Client.js +0 -257
  55. package/dist/cjs/api/resources/permissionsService/client/index.d.ts +0 -2
  56. package/dist/cjs/api/resources/permissionsService/client/index.js +0 -17
  57. package/dist/cjs/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +0 -26
  58. package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +0 -23
  59. package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.ts +0 -20
  60. package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.js +0 -5
  61. package/dist/cjs/api/resources/permissionsService/client/requests/index.d.ts +0 -3
  62. package/dist/cjs/api/resources/permissionsService/index.d.ts +0 -2
  63. package/dist/cjs/api/resources/permissionsService/index.js +0 -18
  64. package/dist/cjs/api/resources/permissionsService/types/Action.d.ts +0 -7
  65. package/dist/cjs/api/resources/permissionsService/types/Action.js +0 -9
  66. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.d.ts +0 -8
  67. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.js +0 -5
  68. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.d.ts +0 -5
  69. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.js +0 -5
  70. package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.ts +0 -5
  71. package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.js +0 -5
  72. package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.ts +0 -6
  73. package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.js +0 -5
  74. package/dist/cjs/api/resources/permissionsService/types/Group.js +0 -5
  75. package/dist/cjs/api/resources/permissionsService/types/Principal.d.ts +0 -13
  76. package/dist/cjs/api/resources/permissionsService/types/Principal.js +0 -5
  77. package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.d.ts +0 -8
  78. package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.js +0 -5
  79. package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.d.ts +0 -9
  80. package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.js +0 -5
  81. package/dist/cjs/api/resources/permissionsService/types/User.d.ts +0 -8
  82. package/dist/cjs/api/resources/permissionsService/types/User.js +0 -5
  83. package/dist/cjs/api/resources/permissionsService/types/index.d.ts +0 -10
  84. package/dist/cjs/api/resources/permissionsService/types/index.js +0 -26
  85. package/dist/esm/api/resources/permissionsService/client/Client.d.mts +0 -86
  86. package/dist/esm/api/resources/permissionsService/client/Client.mjs +0 -220
  87. package/dist/esm/api/resources/permissionsService/client/index.d.mts +0 -2
  88. package/dist/esm/api/resources/permissionsService/client/index.mjs +0 -1
  89. package/dist/esm/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.mts +0 -26
  90. package/dist/esm/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.mts +0 -23
  91. package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.mts +0 -20
  92. package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.mjs +0 -4
  93. package/dist/esm/api/resources/permissionsService/client/requests/index.d.mts +0 -3
  94. package/dist/esm/api/resources/permissionsService/index.d.mts +0 -2
  95. package/dist/esm/api/resources/permissionsService/index.mjs +0 -2
  96. package/dist/esm/api/resources/permissionsService/types/Action.d.mts +0 -7
  97. package/dist/esm/api/resources/permissionsService/types/Action.mjs +0 -6
  98. package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.d.mts +0 -8
  99. package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.mjs +0 -4
  100. package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.d.mts +0 -5
  101. package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.mjs +0 -4
  102. package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.mts +0 -5
  103. package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.mjs +0 -4
  104. package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.mts +0 -6
  105. package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.mjs +0 -4
  106. package/dist/esm/api/resources/permissionsService/types/Group.d.mts +0 -7
  107. package/dist/esm/api/resources/permissionsService/types/Group.mjs +0 -4
  108. package/dist/esm/api/resources/permissionsService/types/Principal.d.mts +0 -13
  109. package/dist/esm/api/resources/permissionsService/types/Principal.mjs +0 -4
  110. package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.d.mts +0 -8
  111. package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.mjs +0 -4
  112. package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.d.mts +0 -9
  113. package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.mjs +0 -4
  114. package/dist/esm/api/resources/permissionsService/types/User.d.mts +0 -8
  115. package/dist/esm/api/resources/permissionsService/types/User.mjs +0 -4
  116. package/dist/esm/api/resources/permissionsService/types/index.d.mts +0 -10
  117. package/dist/esm/api/resources/permissionsService/types/index.mjs +0 -10
  118. /package/dist/cjs/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.js → common/types/CustomMetadataValue.js} +0 -0
  119. /package/dist/cjs/{api/resources/permissionsService/client/requests/index.js → core/auth/AuthProvider.js} +0 -0
  120. /package/dist/esm/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.mjs} +0 -0
  121. /package/dist/esm/{api/resources/permissionsService/client/requests/index.mjs → core/auth/AuthProvider.mjs} +0 -0
@@ -1,23 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../../index.js";
5
- /**
6
- * @example
7
- * {
8
- * resourceIdentifier: {
9
- * type: "external-resource-id",
10
- * externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
11
- * resourceType: "GOOGLE_DRIVE_ITEM"
12
- * },
13
- * userEmail: "john.smith@foo.com"
14
- * }
15
- */
16
- export interface CheckResourceAuthorizationForUserRequest {
17
- /** The resource identifier for which you want to check authorization. */
18
- resourceIdentifier: Credal.ResourceIdentifier;
19
- /** The user email to check authorization for. */
20
- userEmail: string;
21
- /** If specified, Credal will bypass the permissions cache and check current permissions for this resource */
22
- disableCache?: boolean;
23
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../../index.js";
5
- /**
6
- * @example
7
- * {
8
- * userEmail: "john.smith@foo.com"
9
- * }
10
- */
11
- export interface ListCachedAuthorizedResourcesForUserRequest {
12
- /** The user email to list authorized resources for. */
13
- userEmail: string;
14
- /** The type of resource you want to list. If not specified, all resource types will be listed. */
15
- resourceType?: Credal.ResourceType;
16
- /** The maximum number of resources to return. Defaults to 100. */
17
- limit?: number;
18
- /** The offset to use for pagination. If not specified, the first page of results will be returned. */
19
- offset?: number;
20
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export { type CheckResourceAuthorizationForUserRequest } from "./CheckResourceAuthorizationForUserRequest.js";
2
- export { type CheckBulkResourcesAuthorizationForUserRequest } from "./CheckBulkResourcesAuthorizationForUserRequest.js";
3
- export { type ListCachedAuthorizedResourcesForUserRequest } from "./ListCachedAuthorizedResourcesForUserRequest.js";
@@ -1,2 +0,0 @@
1
- export * from "./types/index.js";
2
- export * from "./client/index.js";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types/index.js"), exports);
18
- __exportStar(require("./client/index.js"), exports);
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export type Action = "READ";
5
- export declare const Action: {
6
- readonly Read: "READ";
7
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Action = void 0;
7
- exports.Action = {
8
- Read: "READ",
9
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../index.js";
5
- export interface AuthorizedResource {
6
- credalId: string;
7
- externalId: Credal.ExternalResourceId;
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../index.js";
5
- export type AuthorizedResourceListPage = Credal.AuthorizedResource[];
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../index.js";
5
- export type CheckBulkResourcesAuthorizationResponse = Credal.ResourceAuthorizationResult[];
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface CheckResourceAuthorizationResponse {
5
- authorized: boolean;
6
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../index.js";
5
- export type Principal = Credal.Principal.Group | Credal.Principal.User;
6
- export declare namespace Principal {
7
- interface Group extends Credal.Group {
8
- type: "group";
9
- }
10
- interface User extends Credal.User {
11
- type: "user";
12
- }
13
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../index.js";
5
- export interface PrincipalListPage {
6
- principals: Credal.Principal[];
7
- nextPageToken?: string;
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../index.js";
5
- export interface ResourceAuthorizationResult {
6
- externalResourceId: Credal.ExternalResourceId;
7
- inputUrl?: string;
8
- authorized: boolean;
9
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface User {
5
- email: string;
6
- name?: string;
7
- id?: string;
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- export * from "./Group.js";
2
- export * from "./User.js";
3
- export * from "./Principal.js";
4
- export * from "./AuthorizedResource.js";
5
- export * from "./AuthorizedResourceListPage.js";
6
- export * from "./PrincipalListPage.js";
7
- export * from "./CheckResourceAuthorizationResponse.js";
8
- export * from "./ResourceAuthorizationResult.js";
9
- export * from "./CheckBulkResourcesAuthorizationResponse.js";
10
- export * from "./Action.js";
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Group.js"), exports);
18
- __exportStar(require("./User.js"), exports);
19
- __exportStar(require("./Principal.js"), exports);
20
- __exportStar(require("./AuthorizedResource.js"), exports);
21
- __exportStar(require("./AuthorizedResourceListPage.js"), exports);
22
- __exportStar(require("./PrincipalListPage.js"), exports);
23
- __exportStar(require("./CheckResourceAuthorizationResponse.js"), exports);
24
- __exportStar(require("./ResourceAuthorizationResult.js"), exports);
25
- __exportStar(require("./CheckBulkResourcesAuthorizationResponse.js"), exports);
26
- __exportStar(require("./Action.js"), exports);
@@ -1,86 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as environments from "../../../../environments.mjs";
5
- import * as core from "../../../../core/index.mjs";
6
- import * as Credal from "../../../index.mjs";
7
- export declare namespace PermissionsService {
8
- interface Options {
9
- environment?: core.Supplier<environments.CredalEnvironment | string>;
10
- /** Specify a custom URL to connect the client to. */
11
- baseUrl?: core.Supplier<string>;
12
- apiKey?: core.Supplier<core.BearerToken | undefined>;
13
- /** Additional headers to include in requests. */
14
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
- fetcher?: core.FetchFunction;
16
- }
17
- interface RequestOptions {
18
- /** The maximum time to wait for a response in seconds. */
19
- timeoutInSeconds?: number;
20
- /** The number of times to retry the request. Defaults to 2. */
21
- maxRetries?: number;
22
- /** A hook to abort the request. */
23
- abortSignal?: AbortSignal;
24
- /** Additional query string parameters to include in the request. */
25
- queryParams?: Record<string, unknown>;
26
- /** Additional headers to include in the request. */
27
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
28
- }
29
- }
30
- export declare class PermissionsService {
31
- protected readonly _options: PermissionsService.Options;
32
- constructor(_options?: PermissionsService.Options);
33
- /**
34
- * Admin endpoint to check whether the specified user is authorized to read the specified resource.
35
- *
36
- * @param {Credal.CheckResourceAuthorizationForUserRequest} request
37
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
38
- *
39
- * @example
40
- * await client.permissionsService.checkResourceAuthorizationForUser({
41
- * resourceIdentifier: {
42
- * type: "external-resource-id",
43
- * externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
44
- * resourceType: "GOOGLE_DRIVE_ITEM"
45
- * },
46
- * userEmail: "john.smith@foo.com"
47
- * })
48
- */
49
- checkResourceAuthorizationForUser(request: Credal.CheckResourceAuthorizationForUserRequest, requestOptions?: PermissionsService.RequestOptions): core.HttpResponsePromise<Credal.CheckResourceAuthorizationResponse>;
50
- private __checkResourceAuthorizationForUser;
51
- /**
52
- * Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
53
- *
54
- * @param {Credal.CheckBulkResourcesAuthorizationForUserRequest} request
55
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
56
- *
57
- * @example
58
- * await client.permissionsService.checkBulkResourcesAuthorizationForUser({
59
- * resourceIdentifiers: [{
60
- * type: "url",
61
- * url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
62
- * }, {
63
- * type: "external-resource-id",
64
- * externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
65
- * resourceType: "ZENDESK_TICKET"
66
- * }],
67
- * userEmail: "john.smith@foo.com"
68
- * })
69
- */
70
- checkBulkResourcesAuthorizationForUser(request: Credal.CheckBulkResourcesAuthorizationForUserRequest, requestOptions?: PermissionsService.RequestOptions): core.HttpResponsePromise<Credal.CheckBulkResourcesAuthorizationResponse>;
71
- private __checkBulkResourcesAuthorizationForUser;
72
- /**
73
- * Admin endpoint to list all resources that the specified user is authorized to read. Note this endpoint returns cached results and may not be up-to-date. You can use the checkResourceAuthorizationForUser endpoint with disableCache set to true to get the most up-to-date results.
74
- *
75
- * @param {Credal.ListCachedAuthorizedResourcesForUserRequest} request
76
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
77
- *
78
- * @example
79
- * await client.permissionsService.listCachedAuthorizedResourcesForUser({
80
- * userEmail: "john.smith@foo.com"
81
- * })
82
- */
83
- listCachedAuthorizedResourcesForUser(request: Credal.ListCachedAuthorizedResourcesForUserRequest, requestOptions?: PermissionsService.RequestOptions): core.HttpResponsePromise<Credal.AuthorizedResourceListPage>;
84
- private __listCachedAuthorizedResourcesForUser;
85
- protected _getAuthorizationHeader(): Promise<string>;
86
- }
@@ -1,220 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
- return new (P || (P = Promise))(function (resolve, reject) {
7
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
- step((generator = generator.apply(thisArg, _arguments || [])).next());
11
- });
12
- };
13
- import * as environments from "../../../../environments.mjs";
14
- import * as core from "../../../../core/index.mjs";
15
- import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
16
- import * as errors from "../../../../errors/index.mjs";
17
- export class PermissionsService {
18
- constructor(_options = {}) {
19
- this._options = _options;
20
- }
21
- /**
22
- * Admin endpoint to check whether the specified user is authorized to read the specified resource.
23
- *
24
- * @param {Credal.CheckResourceAuthorizationForUserRequest} request
25
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
26
- *
27
- * @example
28
- * await client.permissionsService.checkResourceAuthorizationForUser({
29
- * resourceIdentifier: {
30
- * type: "external-resource-id",
31
- * externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
32
- * resourceType: "GOOGLE_DRIVE_ITEM"
33
- * },
34
- * userEmail: "john.smith@foo.com"
35
- * })
36
- */
37
- checkResourceAuthorizationForUser(request, requestOptions) {
38
- return core.HttpResponsePromise.fromPromise(this.__checkResourceAuthorizationForUser(request, requestOptions));
39
- }
40
- __checkResourceAuthorizationForUser(request, requestOptions) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- var _a, _b, _c, _d;
43
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
44
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/permissions/checkResourceAuthorizationForUser"),
45
- method: "POST",
46
- headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
47
- contentType: "application/json",
48
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
49
- requestType: "json",
50
- body: request,
51
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
52
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
53
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
54
- });
55
- if (_response.ok) {
56
- return {
57
- data: _response.body,
58
- rawResponse: _response.rawResponse,
59
- };
60
- }
61
- if (_response.error.reason === "status-code") {
62
- throw new errors.CredalError({
63
- statusCode: _response.error.statusCode,
64
- body: _response.error.body,
65
- rawResponse: _response.rawResponse,
66
- });
67
- }
68
- switch (_response.error.reason) {
69
- case "non-json":
70
- throw new errors.CredalError({
71
- statusCode: _response.error.statusCode,
72
- body: _response.error.rawBody,
73
- rawResponse: _response.rawResponse,
74
- });
75
- case "timeout":
76
- throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/checkResourceAuthorizationForUser.");
77
- case "unknown":
78
- throw new errors.CredalError({
79
- message: _response.error.errorMessage,
80
- rawResponse: _response.rawResponse,
81
- });
82
- }
83
- });
84
- }
85
- /**
86
- * Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
87
- *
88
- * @param {Credal.CheckBulkResourcesAuthorizationForUserRequest} request
89
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
90
- *
91
- * @example
92
- * await client.permissionsService.checkBulkResourcesAuthorizationForUser({
93
- * resourceIdentifiers: [{
94
- * type: "url",
95
- * url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
96
- * }, {
97
- * type: "external-resource-id",
98
- * externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
99
- * resourceType: "ZENDESK_TICKET"
100
- * }],
101
- * userEmail: "john.smith@foo.com"
102
- * })
103
- */
104
- checkBulkResourcesAuthorizationForUser(request, requestOptions) {
105
- return core.HttpResponsePromise.fromPromise(this.__checkBulkResourcesAuthorizationForUser(request, requestOptions));
106
- }
107
- __checkBulkResourcesAuthorizationForUser(request, requestOptions) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- var _a, _b, _c, _d;
110
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
111
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/permissions/checkBulkResourcesAuthorizationForUser"),
112
- method: "POST",
113
- headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
114
- contentType: "application/json",
115
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
116
- requestType: "json",
117
- body: request,
118
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
119
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
120
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
121
- });
122
- if (_response.ok) {
123
- return {
124
- data: _response.body,
125
- rawResponse: _response.rawResponse,
126
- };
127
- }
128
- if (_response.error.reason === "status-code") {
129
- throw new errors.CredalError({
130
- statusCode: _response.error.statusCode,
131
- body: _response.error.body,
132
- rawResponse: _response.rawResponse,
133
- });
134
- }
135
- switch (_response.error.reason) {
136
- case "non-json":
137
- throw new errors.CredalError({
138
- statusCode: _response.error.statusCode,
139
- body: _response.error.rawBody,
140
- rawResponse: _response.rawResponse,
141
- });
142
- case "timeout":
143
- throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/checkBulkResourcesAuthorizationForUser.");
144
- case "unknown":
145
- throw new errors.CredalError({
146
- message: _response.error.errorMessage,
147
- rawResponse: _response.rawResponse,
148
- });
149
- }
150
- });
151
- }
152
- /**
153
- * Admin endpoint to list all resources that the specified user is authorized to read. Note this endpoint returns cached results and may not be up-to-date. You can use the checkResourceAuthorizationForUser endpoint with disableCache set to true to get the most up-to-date results.
154
- *
155
- * @param {Credal.ListCachedAuthorizedResourcesForUserRequest} request
156
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
157
- *
158
- * @example
159
- * await client.permissionsService.listCachedAuthorizedResourcesForUser({
160
- * userEmail: "john.smith@foo.com"
161
- * })
162
- */
163
- listCachedAuthorizedResourcesForUser(request, requestOptions) {
164
- return core.HttpResponsePromise.fromPromise(this.__listCachedAuthorizedResourcesForUser(request, requestOptions));
165
- }
166
- __listCachedAuthorizedResourcesForUser(request, requestOptions) {
167
- return __awaiter(this, void 0, void 0, function* () {
168
- var _a, _b, _c, _d;
169
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
170
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/permissions/listCachedAuthorizedResourcesForUser"),
171
- method: "POST",
172
- headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
173
- contentType: "application/json",
174
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
175
- requestType: "json",
176
- body: request,
177
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
178
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
179
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
180
- });
181
- if (_response.ok) {
182
- return { data: _response.body, rawResponse: _response.rawResponse };
183
- }
184
- if (_response.error.reason === "status-code") {
185
- throw new errors.CredalError({
186
- statusCode: _response.error.statusCode,
187
- body: _response.error.body,
188
- rawResponse: _response.rawResponse,
189
- });
190
- }
191
- switch (_response.error.reason) {
192
- case "non-json":
193
- throw new errors.CredalError({
194
- statusCode: _response.error.statusCode,
195
- body: _response.error.rawBody,
196
- rawResponse: _response.rawResponse,
197
- });
198
- case "timeout":
199
- throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/listCachedAuthorizedResourcesForUser.");
200
- case "unknown":
201
- throw new errors.CredalError({
202
- message: _response.error.errorMessage,
203
- rawResponse: _response.rawResponse,
204
- });
205
- }
206
- });
207
- }
208
- _getAuthorizationHeader() {
209
- return __awaiter(this, void 0, void 0, function* () {
210
- var _a;
211
- const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["CREDAL_API_KEY"];
212
- if (bearer == null) {
213
- throw new errors.CredalError({
214
- message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
215
- });
216
- }
217
- return `Bearer ${bearer}`;
218
- });
219
- }
220
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- export * from "./requests/index.mjs";
@@ -1 +0,0 @@
1
- export * from "./requests/index.mjs";
@@ -1,26 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Credal from "../../../../index.mjs";
5
- /**
6
- * @example
7
- * {
8
- * resourceIdentifiers: [{
9
- * type: "url",
10
- * url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
11
- * }, {
12
- * type: "external-resource-id",
13
- * externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
14
- * resourceType: "ZENDESK_TICKET"
15
- * }],
16
- * userEmail: "john.smith@foo.com"
17
- * }
18
- */
19
- export interface CheckBulkResourcesAuthorizationForUserRequest {
20
- /** The set of resource identifier for which you want to check authorization. Currently limited to 20 resources. */
21
- resourceIdentifiers: Credal.ResourceIdentifier[];
22
- /** The user email to check authorization for. */
23
- userEmail: string;
24
- /** If specified, Credal will bypass the permissions cache and check current permissions for all resources specified. */
25
- disableCache?: boolean;
26
- }