polytomic 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +8 -6
- package/Client.js +27 -22
- package/api/errors/BadRequestError.d.ts +8 -0
- package/api/errors/BadRequestError.js +41 -0
- package/api/errors/ForbiddenError.d.ts +8 -0
- package/api/errors/ForbiddenError.js +41 -0
- package/api/errors/InternalServerError.d.ts +8 -0
- package/api/errors/InternalServerError.js +41 -0
- package/api/errors/NotFoundError.d.ts +8 -0
- package/api/errors/NotFoundError.js +41 -0
- package/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/api/errors/UnprocessableEntityError.js +41 -0
- package/api/errors/index.d.ts +5 -0
- package/api/errors/index.js +5 -0
- package/api/resources/bulkSync/client/Client.d.ts +78 -47
- package/api/resources/bulkSync/client/Client.js +188 -183
- package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
- package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
- package/api/resources/bulkSync/client/requests/index.d.ts +3 -2
- package/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
- package/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
- package/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
- package/api/resources/bulkSync/resources/executions/client/index.js +0 -15
- package/api/resources/bulkSync/resources/index.d.ts +0 -1
- package/api/resources/bulkSync/resources/index.js +0 -1
- package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
- package/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
- package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/api/resources/connections/client/Client.d.ts +43 -45
- package/api/resources/connections/client/Client.js +116 -294
- package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
- package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
- package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
- package/api/resources/connections/client/requests/index.d.ts +2 -4
- package/api/resources/events/client/Client.d.ts +9 -8
- package/api/resources/events/client/Client.js +16 -18
- package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
- package/api/resources/events/client/requests/index.d.ts +1 -1
- package/api/resources/identity/client/Client.d.ts +29 -0
- package/api/resources/identity/client/Client.js +114 -0
- package/api/resources/identity/client/index.d.ts +1 -0
- package/api/resources/identity/index.d.ts +1 -0
- package/api/resources/identity/index.js +17 -0
- package/api/resources/index.d.ts +3 -2
- package/api/resources/index.js +4 -3
- package/api/resources/jobs/client/Client.d.ts +6 -4
- package/api/resources/jobs/client/Client.js +13 -10
- package/api/resources/modelSync/client/Client.d.ts +82 -11
- package/api/resources/modelSync/client/Client.js +421 -79
- package/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
- package/{dist/api/resources/connections/client/requests/TargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
- package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
- package/api/resources/modelSync/client/requests/index.d.ts +3 -0
- package/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
- package/api/resources/modelSync/resources/executions/client/Client.js +43 -476
- package/api/resources/models/client/Client.d.ts +22 -11
- package/api/resources/models/client/Client.js +68 -46
- package/api/resources/organization/client/Client.d.ts +21 -14
- package/api/resources/organization/client/Client.js +52 -42
- package/api/resources/permissions/client/Client.d.ts +2 -3
- package/api/resources/permissions/client/Client.js +1 -1
- package/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
- package/api/resources/permissions/resources/policies/client/Client.js +69 -41
- package/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
- package/api/resources/permissions/resources/roles/client/Client.js +62 -37
- package/api/resources/schemas/client/Client.d.ts +39 -6
- package/api/resources/schemas/client/Client.js +208 -13
- package/api/resources/users/client/Client.d.ts +21 -11
- package/api/resources/users/client/Client.js +57 -40
- package/api/resources/webhooks/client/Client.d.ts +18 -11
- package/api/resources/webhooks/client/Client.js +53 -43
- package/api/types/ApiError.d.ts +8 -0
- package/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
- package/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
- package/api/types/SourceMeta.d.ts +8 -0
- package/api/types/SourceMeta.js +5 -0
- package/api/types/index.d.ts +4 -0
- package/api/types/index.js +4 -0
- package/dist/Client.d.ts +8 -6
- package/dist/Client.js +27 -22
- package/dist/api/errors/BadRequestError.d.ts +8 -0
- package/dist/api/errors/BadRequestError.js +41 -0
- package/dist/api/errors/ForbiddenError.d.ts +8 -0
- package/dist/api/errors/ForbiddenError.js +41 -0
- package/dist/api/errors/InternalServerError.d.ts +8 -0
- package/dist/api/errors/InternalServerError.js +41 -0
- package/dist/api/errors/NotFoundError.d.ts +8 -0
- package/dist/api/errors/NotFoundError.js +41 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/dist/api/errors/UnprocessableEntityError.js +41 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +5 -0
- package/dist/api/resources/bulkSync/client/Client.d.ts +78 -47
- package/dist/api/resources/bulkSync/client/Client.js +188 -183
- package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
- package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
- package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
- package/dist/api/resources/bulkSync/client/requests/index.d.ts +3 -2
- package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
- package/dist/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
- package/dist/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
- package/dist/api/resources/bulkSync/resources/executions/client/index.js +0 -15
- package/dist/api/resources/bulkSync/resources/index.d.ts +0 -1
- package/dist/api/resources/bulkSync/resources/index.js +0 -1
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js +5 -0
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/dist/api/resources/connections/client/Client.d.ts +43 -45
- package/dist/api/resources/connections/client/Client.js +116 -294
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
- package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
- package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
- package/dist/api/resources/connections/client/requests/index.d.ts +2 -4
- package/dist/api/resources/events/client/Client.d.ts +9 -8
- package/dist/api/resources/events/client/Client.js +16 -18
- package/{api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → dist/api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
- package/dist/api/resources/events/client/requests/EventsListRequest.js +5 -0
- package/dist/api/resources/events/client/requests/index.d.ts +1 -1
- package/dist/api/resources/identity/client/Client.d.ts +29 -0
- package/dist/api/resources/identity/client/Client.js +114 -0
- package/dist/api/resources/identity/client/index.d.ts +1 -0
- package/dist/api/resources/identity/index.d.ts +1 -0
- package/dist/api/resources/identity/index.js +17 -0
- package/dist/api/resources/index.d.ts +3 -2
- package/dist/api/resources/index.js +4 -3
- package/dist/api/resources/jobs/client/Client.d.ts +6 -4
- package/dist/api/resources/jobs/client/Client.js +13 -10
- package/dist/api/resources/modelSync/client/Client.d.ts +82 -11
- package/dist/api/resources/modelSync/client/Client.js +421 -79
- package/dist/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetSourceRequest.js +5 -0
- package/{api/resources/connections/client/requests/TargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js +5 -0
- package/{api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js +5 -0
- package/dist/api/resources/modelSync/client/requests/index.d.ts +3 -0
- package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
- package/dist/api/resources/modelSync/resources/executions/client/Client.js +43 -476
- package/dist/api/resources/models/client/Client.d.ts +22 -11
- package/dist/api/resources/models/client/Client.js +68 -46
- package/dist/api/resources/organization/client/Client.d.ts +21 -14
- package/dist/api/resources/organization/client/Client.js +52 -42
- package/dist/api/resources/permissions/client/Client.d.ts +2 -3
- package/dist/api/resources/permissions/client/Client.js +1 -1
- package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
- package/dist/api/resources/permissions/resources/policies/client/Client.js +69 -41
- package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
- package/dist/api/resources/permissions/resources/roles/client/Client.js +62 -37
- package/dist/api/resources/schemas/client/Client.d.ts +39 -6
- package/dist/api/resources/schemas/client/Client.js +208 -13
- package/dist/api/resources/users/client/Client.d.ts +21 -11
- package/dist/api/resources/users/client/Client.js +57 -40
- package/dist/api/resources/webhooks/client/Client.d.ts +18 -11
- package/dist/api/resources/webhooks/client/Client.js +53 -43
- package/dist/api/types/ApiError.d.ts +8 -0
- package/dist/api/types/ApiError.js +5 -0
- package/dist/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
- package/dist/api/types/GetModelSyncSourceMetaEnvelope.js +5 -0
- package/dist/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
- package/dist/api/types/ModelSyncSourceMetaResponse.js +5 -0
- package/dist/api/types/SourceMeta.d.ts +8 -0
- package/dist/api/types/SourceMeta.js +5 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/package.json +1 -1
- package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
- package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
- /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
- /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.js +0 -0
- /package/api/resources/{connections/client/requests/ConnectionsGetTargetRequest.js → bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js} +0 -0
- /package/api/resources/connections/client/requests/{ModelFieldsRequest.js → ConnectCardRequest.js} +0 -0
- /package/api/resources/{connections/client/requests/TargetRequest.js → events/client/requests/EventsListRequest.js} +0 -0
- /package/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
- /package/api/resources/{events/client/requests/EventsApiV2GetEventsRequest.js → modelSync/client/requests/ModelSyncGetSourceRequest.js} +0 -0
- /package/{dist/api/resources/bulkSync/resources/executions/client/requests/StartBulkSyncRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/ModelFieldsRequest.js → api/types/ApiError.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/TargetRequest.js → api/types/GetModelSyncSourceMetaEnvelope.js} +0 -0
- /package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.js → api/types/ModelSyncSourceMetaResponse.js} +0 -0
- /package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
- /package/dist/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
|
@@ -7,7 +7,7 @@ exports.Permissions = void 0;
|
|
|
7
7
|
const Client_1 = require("../resources/policies/client/Client");
|
|
8
8
|
const Client_2 = require("../resources/roles/client/Client");
|
|
9
9
|
class Permissions {
|
|
10
|
-
constructor(_options
|
|
10
|
+
constructor(_options) {
|
|
11
11
|
this._options = _options;
|
|
12
12
|
}
|
|
13
13
|
get policies() {
|
|
@@ -7,8 +7,7 @@ import * as Polytomic from "../../../../..";
|
|
|
7
7
|
export declare namespace Policies {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.PolytomicEnvironment | string>;
|
|
10
|
-
token
|
|
11
|
-
xPolytomicVersion?: core.Supplier<"2023-04-25" | undefined>;
|
|
10
|
+
token: core.Supplier<core.BearerToken>;
|
|
12
11
|
}
|
|
13
12
|
interface RequestOptions {
|
|
14
13
|
timeoutInSeconds?: number;
|
|
@@ -17,16 +16,21 @@ export declare namespace Policies {
|
|
|
17
16
|
}
|
|
18
17
|
export declare class Policies {
|
|
19
18
|
protected readonly _options: Policies.Options;
|
|
20
|
-
constructor(_options
|
|
19
|
+
constructor(_options: Policies.Options);
|
|
21
20
|
/**
|
|
22
21
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
22
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* await polytomic.permissions.policies.list()
|
|
26
26
|
*/
|
|
27
27
|
list(requestOptions?: Policies.RequestOptions): Promise<Polytomic.ListPoliciesResponseEnvelope>;
|
|
28
28
|
/**
|
|
29
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
29
30
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
31
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
32
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
33
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
30
34
|
*
|
|
31
35
|
* @example
|
|
32
36
|
* await polytomic.permissions.policies.create({
|
|
@@ -40,20 +44,19 @@ export declare class Policies {
|
|
|
40
44
|
create(request: Polytomic.permissions.CreatePolicyRequest, requestOptions?: Policies.RequestOptions): Promise<Polytomic.PolicyResponseEnvelope>;
|
|
41
45
|
/**
|
|
42
46
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
47
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
48
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
43
49
|
*
|
|
44
50
|
* @example
|
|
45
51
|
* await polytomic.permissions.policies.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
46
52
|
*/
|
|
47
53
|
get(id: string, requestOptions?: Policies.RequestOptions): Promise<Polytomic.PolicyResponseEnvelope>;
|
|
48
54
|
/**
|
|
55
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
49
56
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
50
|
-
*
|
|
51
|
-
* @
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
delete(id: string, requestOptions?: Policies.RequestOptions): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
57
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
58
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
59
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
57
60
|
*
|
|
58
61
|
* @example
|
|
59
62
|
* await polytomic.permissions.policies.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
@@ -65,5 +68,15 @@ export declare class Policies {
|
|
|
65
68
|
* })
|
|
66
69
|
*/
|
|
67
70
|
update(id: string, request: Polytomic.permissions.UpdatePolicyRequest, requestOptions?: Policies.RequestOptions): Promise<Polytomic.PolicyResponseEnvelope>;
|
|
68
|
-
|
|
71
|
+
/**
|
|
72
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
73
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
74
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
75
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* await polytomic.permissions.policies.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
79
|
+
*/
|
|
80
|
+
remove(id: string, requestOptions?: Policies.RequestOptions): Promise<void>;
|
|
81
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
69
82
|
}
|
|
@@ -45,11 +45,12 @@ const Polytomic = __importStar(require("../../../../.."));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../../../errors"));
|
|
47
47
|
class Policies {
|
|
48
|
-
constructor(_options
|
|
48
|
+
constructor(_options) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
53
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* await polytomic.permissions.policies.list()
|
|
@@ -62,12 +63,10 @@ class Policies {
|
|
|
62
63
|
method: "GET",
|
|
63
64
|
headers: {
|
|
64
65
|
Authorization: yield this._getAuthorizationHeader(),
|
|
65
|
-
"X-Polytomic-Version":
|
|
66
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
67
|
-
: undefined,
|
|
66
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
68
67
|
"X-Fern-Language": "JavaScript",
|
|
69
68
|
"X-Fern-SDK-Name": "polytomic",
|
|
70
|
-
"X-Fern-SDK-Version": "0.
|
|
69
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
71
70
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
72
71
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
73
72
|
},
|
|
@@ -82,6 +81,8 @@ class Policies {
|
|
|
82
81
|
switch (_response.error.statusCode) {
|
|
83
82
|
case 401:
|
|
84
83
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
84
|
+
case 500:
|
|
85
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
85
86
|
default:
|
|
86
87
|
throw new errors.PolytomicError({
|
|
87
88
|
statusCode: _response.error.statusCode,
|
|
@@ -105,7 +106,11 @@ class Policies {
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
109
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
108
110
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
111
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
112
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
113
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
109
114
|
*
|
|
110
115
|
* @example
|
|
111
116
|
* await polytomic.permissions.policies.create({
|
|
@@ -124,12 +129,10 @@ class Policies {
|
|
|
124
129
|
method: "POST",
|
|
125
130
|
headers: {
|
|
126
131
|
Authorization: yield this._getAuthorizationHeader(),
|
|
127
|
-
"X-Polytomic-Version":
|
|
128
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
129
|
-
: undefined,
|
|
132
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
130
133
|
"X-Fern-Language": "JavaScript",
|
|
131
134
|
"X-Fern-SDK-Name": "polytomic",
|
|
132
|
-
"X-Fern-SDK-Version": "0.
|
|
135
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
133
136
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
134
137
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
135
138
|
},
|
|
@@ -143,8 +146,16 @@ class Policies {
|
|
|
143
146
|
}
|
|
144
147
|
if (_response.error.reason === "status-code") {
|
|
145
148
|
switch (_response.error.statusCode) {
|
|
149
|
+
case 400:
|
|
150
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
146
151
|
case 401:
|
|
147
152
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
153
|
+
case 403:
|
|
154
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
155
|
+
case 404:
|
|
156
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
157
|
+
case 500:
|
|
158
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
148
159
|
default:
|
|
149
160
|
throw new errors.PolytomicError({
|
|
150
161
|
statusCode: _response.error.statusCode,
|
|
@@ -169,6 +180,8 @@ class Policies {
|
|
|
169
180
|
}
|
|
170
181
|
/**
|
|
171
182
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
183
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
184
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
172
185
|
*
|
|
173
186
|
* @example
|
|
174
187
|
* await polytomic.permissions.policies.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -181,12 +194,10 @@ class Policies {
|
|
|
181
194
|
method: "GET",
|
|
182
195
|
headers: {
|
|
183
196
|
Authorization: yield this._getAuthorizationHeader(),
|
|
184
|
-
"X-Polytomic-Version":
|
|
185
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
186
|
-
: undefined,
|
|
197
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
187
198
|
"X-Fern-Language": "JavaScript",
|
|
188
199
|
"X-Fern-SDK-Name": "polytomic",
|
|
189
|
-
"X-Fern-SDK-Version": "0.
|
|
200
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
190
201
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
191
202
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
192
203
|
},
|
|
@@ -201,6 +212,10 @@ class Policies {
|
|
|
201
212
|
switch (_response.error.statusCode) {
|
|
202
213
|
case 401:
|
|
203
214
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
215
|
+
case 404:
|
|
216
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
217
|
+
case 500:
|
|
218
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
204
219
|
default:
|
|
205
220
|
throw new errors.PolytomicError({
|
|
206
221
|
statusCode: _response.error.statusCode,
|
|
@@ -224,39 +239,56 @@ class Policies {
|
|
|
224
239
|
});
|
|
225
240
|
}
|
|
226
241
|
/**
|
|
242
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
227
243
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
244
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
245
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
246
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
228
247
|
*
|
|
229
248
|
* @example
|
|
230
|
-
* await polytomic.permissions.policies.
|
|
249
|
+
* await polytomic.permissions.policies.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
250
|
+
* name: "Custom",
|
|
251
|
+
* policy_actions: [{
|
|
252
|
+
* action: "read",
|
|
253
|
+
* role_ids: ["248df4b7-aa70-47b8-a036-33ac447e668d"]
|
|
254
|
+
* }]
|
|
255
|
+
* })
|
|
231
256
|
*/
|
|
232
|
-
|
|
257
|
+
update(id, request, requestOptions) {
|
|
233
258
|
var _a;
|
|
234
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
235
260
|
const _response = yield core.fetcher({
|
|
236
261
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/permissions/policies/${id}`),
|
|
237
|
-
method: "
|
|
262
|
+
method: "PUT",
|
|
238
263
|
headers: {
|
|
239
264
|
Authorization: yield this._getAuthorizationHeader(),
|
|
240
|
-
"X-Polytomic-Version":
|
|
241
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
242
|
-
: undefined,
|
|
265
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
243
266
|
"X-Fern-Language": "JavaScript",
|
|
244
267
|
"X-Fern-SDK-Name": "polytomic",
|
|
245
|
-
"X-Fern-SDK-Version": "0.
|
|
268
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
246
269
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
247
270
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
248
271
|
},
|
|
249
272
|
contentType: "application/json",
|
|
273
|
+
body: request,
|
|
250
274
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
251
275
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
252
276
|
});
|
|
253
277
|
if (_response.ok) {
|
|
254
|
-
return;
|
|
278
|
+
return _response.body;
|
|
255
279
|
}
|
|
256
280
|
if (_response.error.reason === "status-code") {
|
|
257
281
|
switch (_response.error.statusCode) {
|
|
282
|
+
case 400:
|
|
283
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
258
284
|
case 401:
|
|
259
285
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
286
|
+
case 403:
|
|
287
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
288
|
+
case 404:
|
|
289
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
290
|
+
case 500:
|
|
291
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
260
292
|
default:
|
|
261
293
|
throw new errors.PolytomicError({
|
|
262
294
|
statusCode: _response.error.statusCode,
|
|
@@ -281,45 +313,45 @@ class Policies {
|
|
|
281
313
|
}
|
|
282
314
|
/**
|
|
283
315
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
316
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
317
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
318
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
284
319
|
*
|
|
285
320
|
* @example
|
|
286
|
-
* await polytomic.permissions.policies.
|
|
287
|
-
* name: "Custom",
|
|
288
|
-
* policy_actions: [{
|
|
289
|
-
* action: "read",
|
|
290
|
-
* role_ids: ["248df4b7-aa70-47b8-a036-33ac447e668d"]
|
|
291
|
-
* }]
|
|
292
|
-
* })
|
|
321
|
+
* await polytomic.permissions.policies.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
293
322
|
*/
|
|
294
|
-
|
|
323
|
+
remove(id, requestOptions) {
|
|
295
324
|
var _a;
|
|
296
325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
297
326
|
const _response = yield core.fetcher({
|
|
298
327
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/permissions/policies/${id}`),
|
|
299
|
-
method: "
|
|
328
|
+
method: "DELETE",
|
|
300
329
|
headers: {
|
|
301
330
|
Authorization: yield this._getAuthorizationHeader(),
|
|
302
|
-
"X-Polytomic-Version":
|
|
303
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
304
|
-
: undefined,
|
|
331
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
305
332
|
"X-Fern-Language": "JavaScript",
|
|
306
333
|
"X-Fern-SDK-Name": "polytomic",
|
|
307
|
-
"X-Fern-SDK-Version": "0.
|
|
334
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
308
335
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
309
336
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
310
337
|
},
|
|
311
338
|
contentType: "application/json",
|
|
312
|
-
body: request,
|
|
313
339
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
340
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
315
341
|
});
|
|
316
342
|
if (_response.ok) {
|
|
317
|
-
return
|
|
343
|
+
return;
|
|
318
344
|
}
|
|
319
345
|
if (_response.error.reason === "status-code") {
|
|
320
346
|
switch (_response.error.statusCode) {
|
|
321
347
|
case 401:
|
|
322
348
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
349
|
+
case 403:
|
|
350
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
351
|
+
case 404:
|
|
352
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
353
|
+
case 500:
|
|
354
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
323
355
|
default:
|
|
324
356
|
throw new errors.PolytomicError({
|
|
325
357
|
statusCode: _response.error.statusCode,
|
|
@@ -344,11 +376,7 @@ class Policies {
|
|
|
344
376
|
}
|
|
345
377
|
_getAuthorizationHeader() {
|
|
346
378
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
-
|
|
348
|
-
if (bearer != null) {
|
|
349
|
-
return `Bearer ${bearer}`;
|
|
350
|
-
}
|
|
351
|
-
return undefined;
|
|
379
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
352
380
|
});
|
|
353
381
|
}
|
|
354
382
|
}
|
|
@@ -7,8 +7,7 @@ import * as Polytomic from "../../../../..";
|
|
|
7
7
|
export declare namespace Roles {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.PolytomicEnvironment | string>;
|
|
10
|
-
token
|
|
11
|
-
xPolytomicVersion?: core.Supplier<"2023-04-25" | undefined>;
|
|
10
|
+
token: core.Supplier<core.BearerToken>;
|
|
12
11
|
}
|
|
13
12
|
interface RequestOptions {
|
|
14
13
|
timeoutInSeconds?: number;
|
|
@@ -17,16 +16,21 @@ export declare namespace Roles {
|
|
|
17
16
|
}
|
|
18
17
|
export declare class Roles {
|
|
19
18
|
protected readonly _options: Roles.Options;
|
|
20
|
-
constructor(_options
|
|
19
|
+
constructor(_options: Roles.Options);
|
|
21
20
|
/**
|
|
22
21
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
22
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* await polytomic.permissions.roles.list()
|
|
26
26
|
*/
|
|
27
27
|
list(requestOptions?: Roles.RequestOptions): Promise<Polytomic.RoleListResponseEnvelope>;
|
|
28
28
|
/**
|
|
29
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
29
30
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
31
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
32
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
33
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
30
34
|
*
|
|
31
35
|
* @example
|
|
32
36
|
* await polytomic.permissions.roles.create({
|
|
@@ -36,26 +40,34 @@ export declare class Roles {
|
|
|
36
40
|
create(request: Polytomic.permissions.CreateRoleRequest, requestOptions?: Roles.RequestOptions): Promise<Polytomic.RoleResponseEnvelope>;
|
|
37
41
|
/**
|
|
38
42
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
43
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
39
44
|
*
|
|
40
45
|
* @example
|
|
41
46
|
* await polytomic.permissions.roles.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
42
47
|
*/
|
|
43
48
|
get(id: string, requestOptions?: Roles.RequestOptions): Promise<Polytomic.RoleResponseEnvelope>;
|
|
44
49
|
/**
|
|
50
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
45
51
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
52
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
53
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
54
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
46
55
|
*
|
|
47
56
|
* @example
|
|
48
|
-
* await polytomic.permissions.roles.
|
|
57
|
+
* await polytomic.permissions.roles.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
58
|
+
* name: "Custom"
|
|
59
|
+
* })
|
|
49
60
|
*/
|
|
50
|
-
|
|
61
|
+
update(id: string, request: Polytomic.permissions.UpdateRoleRequest, requestOptions?: Roles.RequestOptions): Promise<Polytomic.RoleResponseEnvelope>;
|
|
51
62
|
/**
|
|
52
63
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
64
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
65
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
66
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
53
67
|
*
|
|
54
68
|
* @example
|
|
55
|
-
* await polytomic.permissions.roles.
|
|
56
|
-
* name: "Custom"
|
|
57
|
-
* })
|
|
69
|
+
* await polytomic.permissions.roles.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
58
70
|
*/
|
|
59
|
-
|
|
60
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
71
|
+
remove(id: string, requestOptions?: Roles.RequestOptions): Promise<void>;
|
|
72
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
61
73
|
}
|
|
@@ -45,11 +45,12 @@ const Polytomic = __importStar(require("../../../../.."));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../../../errors"));
|
|
47
47
|
class Roles {
|
|
48
|
-
constructor(_options
|
|
48
|
+
constructor(_options) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
53
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* await polytomic.permissions.roles.list()
|
|
@@ -62,12 +63,10 @@ class Roles {
|
|
|
62
63
|
method: "GET",
|
|
63
64
|
headers: {
|
|
64
65
|
Authorization: yield this._getAuthorizationHeader(),
|
|
65
|
-
"X-Polytomic-Version":
|
|
66
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
67
|
-
: undefined,
|
|
66
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
68
67
|
"X-Fern-Language": "JavaScript",
|
|
69
68
|
"X-Fern-SDK-Name": "polytomic",
|
|
70
|
-
"X-Fern-SDK-Version": "0.
|
|
69
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
71
70
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
72
71
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
73
72
|
},
|
|
@@ -82,6 +81,8 @@ class Roles {
|
|
|
82
81
|
switch (_response.error.statusCode) {
|
|
83
82
|
case 401:
|
|
84
83
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
84
|
+
case 500:
|
|
85
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
85
86
|
default:
|
|
86
87
|
throw new errors.PolytomicError({
|
|
87
88
|
statusCode: _response.error.statusCode,
|
|
@@ -105,7 +106,11 @@ class Roles {
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
109
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
108
110
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
111
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
112
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
113
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
109
114
|
*
|
|
110
115
|
* @example
|
|
111
116
|
* await polytomic.permissions.roles.create({
|
|
@@ -120,12 +125,10 @@ class Roles {
|
|
|
120
125
|
method: "POST",
|
|
121
126
|
headers: {
|
|
122
127
|
Authorization: yield this._getAuthorizationHeader(),
|
|
123
|
-
"X-Polytomic-Version":
|
|
124
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
125
|
-
: undefined,
|
|
128
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
126
129
|
"X-Fern-Language": "JavaScript",
|
|
127
130
|
"X-Fern-SDK-Name": "polytomic",
|
|
128
|
-
"X-Fern-SDK-Version": "0.
|
|
131
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
129
132
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
130
133
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
131
134
|
},
|
|
@@ -139,8 +142,16 @@ class Roles {
|
|
|
139
142
|
}
|
|
140
143
|
if (_response.error.reason === "status-code") {
|
|
141
144
|
switch (_response.error.statusCode) {
|
|
145
|
+
case 400:
|
|
146
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
142
147
|
case 401:
|
|
143
148
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
149
|
+
case 403:
|
|
150
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
151
|
+
case 404:
|
|
152
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
153
|
+
case 500:
|
|
154
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
144
155
|
default:
|
|
145
156
|
throw new errors.PolytomicError({
|
|
146
157
|
statusCode: _response.error.statusCode,
|
|
@@ -165,6 +176,7 @@ class Roles {
|
|
|
165
176
|
}
|
|
166
177
|
/**
|
|
167
178
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
179
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
168
180
|
*
|
|
169
181
|
* @example
|
|
170
182
|
* await polytomic.permissions.roles.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -177,12 +189,10 @@ class Roles {
|
|
|
177
189
|
method: "GET",
|
|
178
190
|
headers: {
|
|
179
191
|
Authorization: yield this._getAuthorizationHeader(),
|
|
180
|
-
"X-Polytomic-Version":
|
|
181
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
182
|
-
: undefined,
|
|
192
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
183
193
|
"X-Fern-Language": "JavaScript",
|
|
184
194
|
"X-Fern-SDK-Name": "polytomic",
|
|
185
|
-
"X-Fern-SDK-Version": "0.
|
|
195
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
186
196
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
187
197
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
188
198
|
},
|
|
@@ -197,6 +207,8 @@ class Roles {
|
|
|
197
207
|
switch (_response.error.statusCode) {
|
|
198
208
|
case 401:
|
|
199
209
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
210
|
+
case 404:
|
|
211
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
200
212
|
default:
|
|
201
213
|
throw new errors.PolytomicError({
|
|
202
214
|
statusCode: _response.error.statusCode,
|
|
@@ -220,39 +232,52 @@ class Roles {
|
|
|
220
232
|
});
|
|
221
233
|
}
|
|
222
234
|
/**
|
|
235
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
223
236
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
237
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
238
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
239
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
224
240
|
*
|
|
225
241
|
* @example
|
|
226
|
-
* await polytomic.permissions.roles.
|
|
242
|
+
* await polytomic.permissions.roles.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
243
|
+
* name: "Custom"
|
|
244
|
+
* })
|
|
227
245
|
*/
|
|
228
|
-
|
|
246
|
+
update(id, request, requestOptions) {
|
|
229
247
|
var _a;
|
|
230
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
231
249
|
const _response = yield core.fetcher({
|
|
232
250
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/permissions/roles/${id}`),
|
|
233
|
-
method: "
|
|
251
|
+
method: "PUT",
|
|
234
252
|
headers: {
|
|
235
253
|
Authorization: yield this._getAuthorizationHeader(),
|
|
236
|
-
"X-Polytomic-Version":
|
|
237
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
238
|
-
: undefined,
|
|
254
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
239
255
|
"X-Fern-Language": "JavaScript",
|
|
240
256
|
"X-Fern-SDK-Name": "polytomic",
|
|
241
|
-
"X-Fern-SDK-Version": "0.
|
|
257
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
242
258
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
243
259
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
244
260
|
},
|
|
245
261
|
contentType: "application/json",
|
|
262
|
+
body: request,
|
|
246
263
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
247
264
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
248
265
|
});
|
|
249
266
|
if (_response.ok) {
|
|
250
|
-
return;
|
|
267
|
+
return _response.body;
|
|
251
268
|
}
|
|
252
269
|
if (_response.error.reason === "status-code") {
|
|
253
270
|
switch (_response.error.statusCode) {
|
|
271
|
+
case 400:
|
|
272
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
254
273
|
case 401:
|
|
255
274
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
275
|
+
case 403:
|
|
276
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
277
|
+
case 404:
|
|
278
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
279
|
+
case 500:
|
|
280
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
256
281
|
default:
|
|
257
282
|
throw new errors.PolytomicError({
|
|
258
283
|
statusCode: _response.error.statusCode,
|
|
@@ -277,41 +302,45 @@ class Roles {
|
|
|
277
302
|
}
|
|
278
303
|
/**
|
|
279
304
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
305
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
306
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
307
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
280
308
|
*
|
|
281
309
|
* @example
|
|
282
|
-
* await polytomic.permissions.roles.
|
|
283
|
-
* name: "Custom"
|
|
284
|
-
* })
|
|
310
|
+
* await polytomic.permissions.roles.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
285
311
|
*/
|
|
286
|
-
|
|
312
|
+
remove(id, requestOptions) {
|
|
287
313
|
var _a;
|
|
288
314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
289
315
|
const _response = yield core.fetcher({
|
|
290
316
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/permissions/roles/${id}`),
|
|
291
|
-
method: "
|
|
317
|
+
method: "DELETE",
|
|
292
318
|
headers: {
|
|
293
319
|
Authorization: yield this._getAuthorizationHeader(),
|
|
294
|
-
"X-Polytomic-Version":
|
|
295
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
296
|
-
: undefined,
|
|
320
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
297
321
|
"X-Fern-Language": "JavaScript",
|
|
298
322
|
"X-Fern-SDK-Name": "polytomic",
|
|
299
|
-
"X-Fern-SDK-Version": "0.
|
|
323
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
300
324
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
301
325
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
302
326
|
},
|
|
303
327
|
contentType: "application/json",
|
|
304
|
-
body: request,
|
|
305
328
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
306
329
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
307
330
|
});
|
|
308
331
|
if (_response.ok) {
|
|
309
|
-
return
|
|
332
|
+
return;
|
|
310
333
|
}
|
|
311
334
|
if (_response.error.reason === "status-code") {
|
|
312
335
|
switch (_response.error.statusCode) {
|
|
313
336
|
case 401:
|
|
314
337
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
338
|
+
case 403:
|
|
339
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
340
|
+
case 404:
|
|
341
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
342
|
+
case 500:
|
|
343
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
315
344
|
default:
|
|
316
345
|
throw new errors.PolytomicError({
|
|
317
346
|
statusCode: _response.error.statusCode,
|
|
@@ -336,11 +365,7 @@ class Roles {
|
|
|
336
365
|
}
|
|
337
366
|
_getAuthorizationHeader() {
|
|
338
367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
-
|
|
340
|
-
if (bearer != null) {
|
|
341
|
-
return `Bearer ${bearer}`;
|
|
342
|
-
}
|
|
343
|
-
return undefined;
|
|
368
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
344
369
|
});
|
|
345
370
|
}
|
|
346
371
|
}
|