@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
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { toJson } from "../json.mjs";
11
- import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
12
- import { Supplier } from "./Supplier.mjs";
13
11
  import { createRequestUrl } from "./createRequestUrl.mjs";
14
12
  import { getErrorResponseBody } from "./getErrorResponseBody.mjs";
15
13
  import { getFetchFn } from "./getFetchFn.mjs";
16
14
  import { getRequestBody } from "./getRequestBody.mjs";
17
15
  import { getResponseBody } from "./getResponseBody.mjs";
18
16
  import { makeRequest } from "./makeRequest.mjs";
17
+ import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
19
18
  import { requestWithRetries } from "./requestWithRetries.mjs";
19
+ import { Supplier } from "./Supplier.mjs";
20
20
  function getHeaders(args) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const newHeaders = {};
@@ -1,9 +1,9 @@
1
1
  export type { APIResponse } from "./APIResponse.mjs";
2
- export { fetcher } from "./Fetcher.mjs";
2
+ export type { BinaryResponse } from "./BinaryResponse.mjs";
3
3
  export type { Fetcher, FetchFunction } from "./Fetcher.mjs";
4
+ export { fetcher } from "./Fetcher.mjs";
4
5
  export { getHeader } from "./getHeader.mjs";
5
- export { Supplier } from "./Supplier.mjs";
6
- export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
7
- export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
8
6
  export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
9
- export type { BinaryResponse } from "./BinaryResponse.mjs";
7
+ export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
8
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
9
+ export { Supplier } from "./Supplier.mjs";
@@ -1,5 +1,5 @@
1
1
  export { fetcher } from "./Fetcher.mjs";
2
2
  export { getHeader } from "./getHeader.mjs";
3
- export { Supplier } from "./Supplier.mjs";
4
- export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
5
3
  export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
4
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
5
+ export { Supplier } from "./Supplier.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.2";
1
+ export declare const SDK_VERSION = "0.1.5";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.1.2";
1
+ export const SDK_VERSION = "0.1.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "repository": "github:credal-ai/credal-typescript-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -1326,219 +1326,6 @@ await client.documentCollections.updateMongoCollectionSync({
1326
1326
  </dl>
1327
1327
  </details>
1328
1328
 
1329
- ## PermissionsService
1330
-
1331
- <details><summary><code>client.permissionsService.<a href="/src/api/resources/permissionsService/client/Client.ts">checkResourceAuthorizationForUser</a>({ ...params }) -> Credal.CheckResourceAuthorizationResponse</code></summary>
1332
- <dl>
1333
- <dd>
1334
-
1335
- #### 📝 Description
1336
-
1337
- <dl>
1338
- <dd>
1339
-
1340
- <dl>
1341
- <dd>
1342
-
1343
- Admin endpoint to check whether the specified user is authorized to read the specified resource.
1344
-
1345
- </dd>
1346
- </dl>
1347
- </dd>
1348
- </dl>
1349
-
1350
- #### 🔌 Usage
1351
-
1352
- <dl>
1353
- <dd>
1354
-
1355
- <dl>
1356
- <dd>
1357
-
1358
- ```typescript
1359
- await client.permissionsService.checkResourceAuthorizationForUser({
1360
- resourceIdentifier: {
1361
- type: "external-resource-id",
1362
- externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
1363
- resourceType: "GOOGLE_DRIVE_ITEM",
1364
- },
1365
- userEmail: "john.smith@foo.com",
1366
- });
1367
- ```
1368
-
1369
- </dd>
1370
- </dl>
1371
- </dd>
1372
- </dl>
1373
-
1374
- #### ⚙️ Parameters
1375
-
1376
- <dl>
1377
- <dd>
1378
-
1379
- <dl>
1380
- <dd>
1381
-
1382
- **request:** `Credal.CheckResourceAuthorizationForUserRequest`
1383
-
1384
- </dd>
1385
- </dl>
1386
-
1387
- <dl>
1388
- <dd>
1389
-
1390
- **requestOptions:** `PermissionsService.RequestOptions`
1391
-
1392
- </dd>
1393
- </dl>
1394
- </dd>
1395
- </dl>
1396
-
1397
- </dd>
1398
- </dl>
1399
- </details>
1400
-
1401
- <details><summary><code>client.permissionsService.<a href="/src/api/resources/permissionsService/client/Client.ts">checkBulkResourcesAuthorizationForUser</a>({ ...params }) -> Credal.CheckBulkResourcesAuthorizationResponse</code></summary>
1402
- <dl>
1403
- <dd>
1404
-
1405
- #### 📝 Description
1406
-
1407
- <dl>
1408
- <dd>
1409
-
1410
- <dl>
1411
- <dd>
1412
-
1413
- Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
1414
-
1415
- </dd>
1416
- </dl>
1417
- </dd>
1418
- </dl>
1419
-
1420
- #### 🔌 Usage
1421
-
1422
- <dl>
1423
- <dd>
1424
-
1425
- <dl>
1426
- <dd>
1427
-
1428
- ```typescript
1429
- await client.permissionsService.checkBulkResourcesAuthorizationForUser({
1430
- resourceIdentifiers: [
1431
- {
1432
- type: "url",
1433
- url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit",
1434
- },
1435
- {
1436
- type: "external-resource-id",
1437
- externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
1438
- resourceType: "ZENDESK_TICKET",
1439
- },
1440
- ],
1441
- userEmail: "john.smith@foo.com",
1442
- });
1443
- ```
1444
-
1445
- </dd>
1446
- </dl>
1447
- </dd>
1448
- </dl>
1449
-
1450
- #### ⚙️ Parameters
1451
-
1452
- <dl>
1453
- <dd>
1454
-
1455
- <dl>
1456
- <dd>
1457
-
1458
- **request:** `Credal.CheckBulkResourcesAuthorizationForUserRequest`
1459
-
1460
- </dd>
1461
- </dl>
1462
-
1463
- <dl>
1464
- <dd>
1465
-
1466
- **requestOptions:** `PermissionsService.RequestOptions`
1467
-
1468
- </dd>
1469
- </dl>
1470
- </dd>
1471
- </dl>
1472
-
1473
- </dd>
1474
- </dl>
1475
- </details>
1476
-
1477
- <details><summary><code>client.permissionsService.<a href="/src/api/resources/permissionsService/client/Client.ts">listCachedAuthorizedResourcesForUser</a>({ ...params }) -> Credal.AuthorizedResourceListPage</code></summary>
1478
- <dl>
1479
- <dd>
1480
-
1481
- #### 📝 Description
1482
-
1483
- <dl>
1484
- <dd>
1485
-
1486
- <dl>
1487
- <dd>
1488
-
1489
- 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.
1490
-
1491
- </dd>
1492
- </dl>
1493
- </dd>
1494
- </dl>
1495
-
1496
- #### 🔌 Usage
1497
-
1498
- <dl>
1499
- <dd>
1500
-
1501
- <dl>
1502
- <dd>
1503
-
1504
- ```typescript
1505
- await client.permissionsService.listCachedAuthorizedResourcesForUser({
1506
- userEmail: "john.smith@foo.com",
1507
- });
1508
- ```
1509
-
1510
- </dd>
1511
- </dl>
1512
- </dd>
1513
- </dl>
1514
-
1515
- #### ⚙️ Parameters
1516
-
1517
- <dl>
1518
- <dd>
1519
-
1520
- <dl>
1521
- <dd>
1522
-
1523
- **request:** `Credal.ListCachedAuthorizedResourcesForUserRequest`
1524
-
1525
- </dd>
1526
- </dl>
1527
-
1528
- <dl>
1529
- <dd>
1530
-
1531
- **requestOptions:** `PermissionsService.RequestOptions`
1532
-
1533
- </dd>
1534
- </dl>
1535
- </dd>
1536
- </dl>
1537
-
1538
- </dd>
1539
- </dl>
1540
- </details>
1541
-
1542
1329
  ## Search
1543
1330
 
1544
1331
  <details><summary><code>client.search.<a href="/src/api/resources/search/client/Client.ts">searchDocumentCollection</a>({ ...params }) -> Credal.SearchDocumentCollectionResponse</code></summary>
@@ -1,86 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as environments from "../../../../environments.js";
5
- import * as core from "../../../../core/index.js";
6
- import * as Credal from "../../../index.js";
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,257 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
- return new (P || (P = Promise))(function (resolve, reject) {
41
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
- step((generator = generator.apply(thisArg, _arguments || [])).next());
45
- });
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.PermissionsService = void 0;
49
- const environments = __importStar(require("../../../../environments.js"));
50
- const core = __importStar(require("../../../../core/index.js"));
51
- const headers_js_1 = require("../../../../core/headers.js");
52
- const errors = __importStar(require("../../../../errors/index.js"));
53
- class PermissionsService {
54
- constructor(_options = {}) {
55
- this._options = _options;
56
- }
57
- /**
58
- * Admin endpoint to check whether the specified user is authorized to read the specified resource.
59
- *
60
- * @param {Credal.CheckResourceAuthorizationForUserRequest} request
61
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
62
- *
63
- * @example
64
- * await client.permissionsService.checkResourceAuthorizationForUser({
65
- * resourceIdentifier: {
66
- * type: "external-resource-id",
67
- * externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
68
- * resourceType: "GOOGLE_DRIVE_ITEM"
69
- * },
70
- * userEmail: "john.smith@foo.com"
71
- * })
72
- */
73
- checkResourceAuthorizationForUser(request, requestOptions) {
74
- return core.HttpResponsePromise.fromPromise(this.__checkResourceAuthorizationForUser(request, requestOptions));
75
- }
76
- __checkResourceAuthorizationForUser(request, requestOptions) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- var _a, _b, _c, _d;
79
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
80
- 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"),
81
- method: "POST",
82
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
83
- contentType: "application/json",
84
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
85
- requestType: "json",
86
- body: request,
87
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
88
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
89
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
90
- });
91
- if (_response.ok) {
92
- return {
93
- data: _response.body,
94
- rawResponse: _response.rawResponse,
95
- };
96
- }
97
- if (_response.error.reason === "status-code") {
98
- throw new errors.CredalError({
99
- statusCode: _response.error.statusCode,
100
- body: _response.error.body,
101
- rawResponse: _response.rawResponse,
102
- });
103
- }
104
- switch (_response.error.reason) {
105
- case "non-json":
106
- throw new errors.CredalError({
107
- statusCode: _response.error.statusCode,
108
- body: _response.error.rawBody,
109
- rawResponse: _response.rawResponse,
110
- });
111
- case "timeout":
112
- throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/checkResourceAuthorizationForUser.");
113
- case "unknown":
114
- throw new errors.CredalError({
115
- message: _response.error.errorMessage,
116
- rawResponse: _response.rawResponse,
117
- });
118
- }
119
- });
120
- }
121
- /**
122
- * Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
123
- *
124
- * @param {Credal.CheckBulkResourcesAuthorizationForUserRequest} request
125
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
126
- *
127
- * @example
128
- * await client.permissionsService.checkBulkResourcesAuthorizationForUser({
129
- * resourceIdentifiers: [{
130
- * type: "url",
131
- * url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
132
- * }, {
133
- * type: "external-resource-id",
134
- * externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
135
- * resourceType: "ZENDESK_TICKET"
136
- * }],
137
- * userEmail: "john.smith@foo.com"
138
- * })
139
- */
140
- checkBulkResourcesAuthorizationForUser(request, requestOptions) {
141
- return core.HttpResponsePromise.fromPromise(this.__checkBulkResourcesAuthorizationForUser(request, requestOptions));
142
- }
143
- __checkBulkResourcesAuthorizationForUser(request, requestOptions) {
144
- return __awaiter(this, void 0, void 0, function* () {
145
- var _a, _b, _c, _d;
146
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
147
- 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"),
148
- method: "POST",
149
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
150
- contentType: "application/json",
151
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
152
- requestType: "json",
153
- body: request,
154
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
155
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
156
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
157
- });
158
- if (_response.ok) {
159
- return {
160
- data: _response.body,
161
- rawResponse: _response.rawResponse,
162
- };
163
- }
164
- if (_response.error.reason === "status-code") {
165
- throw new errors.CredalError({
166
- statusCode: _response.error.statusCode,
167
- body: _response.error.body,
168
- rawResponse: _response.rawResponse,
169
- });
170
- }
171
- switch (_response.error.reason) {
172
- case "non-json":
173
- throw new errors.CredalError({
174
- statusCode: _response.error.statusCode,
175
- body: _response.error.rawBody,
176
- rawResponse: _response.rawResponse,
177
- });
178
- case "timeout":
179
- throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/checkBulkResourcesAuthorizationForUser.");
180
- case "unknown":
181
- throw new errors.CredalError({
182
- message: _response.error.errorMessage,
183
- rawResponse: _response.rawResponse,
184
- });
185
- }
186
- });
187
- }
188
- /**
189
- * 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.
190
- *
191
- * @param {Credal.ListCachedAuthorizedResourcesForUserRequest} request
192
- * @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
193
- *
194
- * @example
195
- * await client.permissionsService.listCachedAuthorizedResourcesForUser({
196
- * userEmail: "john.smith@foo.com"
197
- * })
198
- */
199
- listCachedAuthorizedResourcesForUser(request, requestOptions) {
200
- return core.HttpResponsePromise.fromPromise(this.__listCachedAuthorizedResourcesForUser(request, requestOptions));
201
- }
202
- __listCachedAuthorizedResourcesForUser(request, requestOptions) {
203
- return __awaiter(this, void 0, void 0, function* () {
204
- var _a, _b, _c, _d;
205
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
206
- 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"),
207
- method: "POST",
208
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
209
- contentType: "application/json",
210
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
211
- requestType: "json",
212
- body: request,
213
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
214
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
215
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
216
- });
217
- if (_response.ok) {
218
- return { data: _response.body, rawResponse: _response.rawResponse };
219
- }
220
- if (_response.error.reason === "status-code") {
221
- throw new errors.CredalError({
222
- statusCode: _response.error.statusCode,
223
- body: _response.error.body,
224
- rawResponse: _response.rawResponse,
225
- });
226
- }
227
- switch (_response.error.reason) {
228
- case "non-json":
229
- throw new errors.CredalError({
230
- statusCode: _response.error.statusCode,
231
- body: _response.error.rawBody,
232
- rawResponse: _response.rawResponse,
233
- });
234
- case "timeout":
235
- throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/listCachedAuthorizedResourcesForUser.");
236
- case "unknown":
237
- throw new errors.CredalError({
238
- message: _response.error.errorMessage,
239
- rawResponse: _response.rawResponse,
240
- });
241
- }
242
- });
243
- }
244
- _getAuthorizationHeader() {
245
- return __awaiter(this, void 0, void 0, function* () {
246
- var _a;
247
- 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"];
248
- if (bearer == null) {
249
- throw new errors.CredalError({
250
- message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
251
- });
252
- }
253
- return `Bearer ${bearer}`;
254
- });
255
- }
256
- }
257
- exports.PermissionsService = PermissionsService;
@@ -1,2 +0,0 @@
1
- export {};
2
- export * from "./requests/index.js";
@@ -1,17 +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("./requests/index.js"), exports);
@@ -1,26 +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
- * 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
- }