polytomic 0.1.2 → 1.0.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 +62 -46
- package/api/resources/bulkSync/client/Client.js +174 -184
- package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +1 -1
- package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +1 -4
- package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
- 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 +20 -9
- package/api/resources/bulkSync/resources/schemas/client/Client.js +90 -24
- package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +1 -4
- package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/api/resources/connections/client/Client.d.ts +40 -49
- package/api/resources/connections/client/Client.js +113 -298
- package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +18 -0
- package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -4
- package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +1 -4
- 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 +87 -53
- package/api/resources/modelSync/client/Client.js +405 -100
- package/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +1 -21
- 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/StartModelSyncRequest.d.ts +1 -0
- package/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +1 -21
- 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 -13
- package/api/resources/models/client/Client.js +67 -47
- package/api/resources/models/client/requests/CreateModelRequest.d.ts +0 -1
- package/api/resources/models/client/requests/UpdateModelRequest.d.ts +0 -1
- package/api/resources/organization/client/Client.d.ts +23 -26
- package/api/resources/organization/client/Client.js +53 -53
- package/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts +1 -6
- package/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts +1 -6
- 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 -19
- package/api/resources/permissions/resources/policies/client/Client.js +66 -46
- package/api/resources/permissions/resources/policies/client/requests/CreatePolicyRequest.d.ts +1 -5
- package/api/resources/permissions/resources/policies/client/requests/UpdatePolicyRequest.d.ts +1 -5
- 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 +27 -19
- package/api/resources/users/client/Client.js +63 -48
- package/api/resources/users/client/requests/CreateUserRequestSchema.d.ts +1 -2
- package/api/resources/users/client/requests/UpdateUserRequestSchema.d.ts +1 -2
- package/api/resources/webhooks/client/Client.d.ts +22 -15
- package/api/resources/webhooks/client/Client.js +56 -46
- 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 +62 -46
- package/dist/api/resources/bulkSync/client/Client.js +174 -184
- package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +1 -1
- package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +1 -4
- package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
- package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
- 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 +20 -9
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +90 -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/UpdateBulkSchema.d.ts +1 -4
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/dist/api/resources/connections/client/Client.d.ts +40 -49
- package/dist/api/resources/connections/client/Client.js +113 -298
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +18 -0
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
- package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -4
- package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +1 -4
- 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 +87 -53
- package/dist/api/resources/modelSync/client/Client.js +405 -100
- package/dist/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +1 -21
- 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/StartModelSyncRequest.d.ts +1 -0
- package/dist/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +1 -21
- 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 -13
- package/dist/api/resources/models/client/Client.js +67 -47
- package/dist/api/resources/models/client/requests/CreateModelRequest.d.ts +0 -1
- package/dist/api/resources/models/client/requests/UpdateModelRequest.d.ts +0 -1
- package/dist/api/resources/organization/client/Client.d.ts +23 -26
- package/dist/api/resources/organization/client/Client.js +53 -53
- package/dist/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts +1 -6
- package/dist/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts +1 -6
- 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 -19
- package/dist/api/resources/permissions/resources/policies/client/Client.js +66 -46
- package/dist/api/resources/permissions/resources/policies/client/requests/CreatePolicyRequest.d.ts +1 -5
- package/dist/api/resources/permissions/resources/policies/client/requests/UpdatePolicyRequest.d.ts +1 -5
- 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 +27 -19
- package/dist/api/resources/users/client/Client.js +63 -48
- package/dist/api/resources/users/client/requests/CreateUserRequestSchema.d.ts +1 -2
- package/dist/api/resources/users/client/requests/UpdateUserRequestSchema.d.ts +1 -2
- package/dist/api/resources/webhooks/client/Client.d.ts +22 -15
- package/dist/api/resources/webhooks/client/Client.js +56 -46
- 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 +2 -2
- 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.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/requests → identity/client}/index.js +0 -0
|
@@ -45,14 +45,15 @@ const Polytomic = __importStar(require("../../.."));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class Organization {
|
|
48
|
-
constructor(_options
|
|
48
|
+
constructor(_options) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* > 🚧 Requires partner key
|
|
53
53
|
* >
|
|
54
|
-
* > Organization endpoints are only accessible using [partner keys](https://
|
|
54
|
+
* > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
|
|
55
55
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
56
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
56
57
|
*
|
|
57
58
|
* @example
|
|
58
59
|
* await polytomic.organization.list()
|
|
@@ -65,12 +66,10 @@ class Organization {
|
|
|
65
66
|
method: "GET",
|
|
66
67
|
headers: {
|
|
67
68
|
Authorization: yield this._getAuthorizationHeader(),
|
|
68
|
-
"X-Polytomic-Version":
|
|
69
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
70
|
-
: undefined,
|
|
69
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
71
70
|
"X-Fern-Language": "JavaScript",
|
|
72
71
|
"X-Fern-SDK-Name": "polytomic",
|
|
73
|
-
"X-Fern-SDK-Version": "0.
|
|
72
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
74
73
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
75
74
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
76
75
|
},
|
|
@@ -85,6 +84,8 @@ class Organization {
|
|
|
85
84
|
switch (_response.error.statusCode) {
|
|
86
85
|
case 401:
|
|
87
86
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
87
|
+
case 500:
|
|
88
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
88
89
|
default:
|
|
89
90
|
throw new errors.PolytomicError({
|
|
90
91
|
statusCode: _response.error.statusCode,
|
|
@@ -110,17 +111,14 @@ class Organization {
|
|
|
110
111
|
/**
|
|
111
112
|
* > 🚧 Requires partner key
|
|
112
113
|
* >
|
|
113
|
-
* > Organization endpoints are only accessible using [partner keys](https://
|
|
114
|
+
* > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
|
|
114
115
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
116
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
117
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
115
118
|
*
|
|
116
119
|
* @example
|
|
117
120
|
* await polytomic.organization.create({
|
|
118
|
-
*
|
|
119
|
-
* client_secret: "client_secret",
|
|
120
|
-
* issuer: "https://example.com",
|
|
121
|
-
* name: "My Organization",
|
|
122
|
-
* sso_domain: "example.com",
|
|
123
|
-
* sso_org_id: "123456"
|
|
121
|
+
* name: "My Organization"
|
|
124
122
|
* })
|
|
125
123
|
*/
|
|
126
124
|
create(request, requestOptions) {
|
|
@@ -131,12 +129,10 @@ class Organization {
|
|
|
131
129
|
method: "POST",
|
|
132
130
|
headers: {
|
|
133
131
|
Authorization: yield this._getAuthorizationHeader(),
|
|
134
|
-
"X-Polytomic-Version":
|
|
135
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
136
|
-
: undefined,
|
|
132
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
137
133
|
"X-Fern-Language": "JavaScript",
|
|
138
134
|
"X-Fern-SDK-Name": "polytomic",
|
|
139
|
-
"X-Fern-SDK-Version": "0.
|
|
135
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
140
136
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
141
137
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
142
138
|
},
|
|
@@ -152,6 +148,10 @@ class Organization {
|
|
|
152
148
|
switch (_response.error.statusCode) {
|
|
153
149
|
case 401:
|
|
154
150
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
151
|
+
case 422:
|
|
152
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
153
|
+
case 500:
|
|
154
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
155
155
|
default:
|
|
156
156
|
throw new errors.PolytomicError({
|
|
157
157
|
statusCode: _response.error.statusCode,
|
|
@@ -177,8 +177,9 @@ class Organization {
|
|
|
177
177
|
/**
|
|
178
178
|
* > 🚧 Requires partner key
|
|
179
179
|
* >
|
|
180
|
-
* > Organization endpoints are only accessible using [partner keys](https://
|
|
180
|
+
* > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
|
|
181
181
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
182
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
182
183
|
*
|
|
183
184
|
* @example
|
|
184
185
|
* await polytomic.organization.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -191,12 +192,10 @@ class Organization {
|
|
|
191
192
|
method: "GET",
|
|
192
193
|
headers: {
|
|
193
194
|
Authorization: yield this._getAuthorizationHeader(),
|
|
194
|
-
"X-Polytomic-Version":
|
|
195
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
196
|
-
: undefined,
|
|
195
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
197
196
|
"X-Fern-Language": "JavaScript",
|
|
198
197
|
"X-Fern-SDK-Name": "polytomic",
|
|
199
|
-
"X-Fern-SDK-Version": "0.
|
|
198
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
200
199
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
201
200
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
202
201
|
},
|
|
@@ -211,6 +210,8 @@ class Organization {
|
|
|
211
210
|
switch (_response.error.statusCode) {
|
|
212
211
|
case 401:
|
|
213
212
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
213
|
+
case 404:
|
|
214
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
214
215
|
default:
|
|
215
216
|
throw new errors.PolytomicError({
|
|
216
217
|
statusCode: _response.error.statusCode,
|
|
@@ -236,40 +237,47 @@ class Organization {
|
|
|
236
237
|
/**
|
|
237
238
|
* > 🚧 Requires partner key
|
|
238
239
|
* >
|
|
239
|
-
* > Organization endpoints are only accessible using [partner keys](https://
|
|
240
|
+
* > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
|
|
240
241
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
242
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
243
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
241
244
|
*
|
|
242
245
|
* @example
|
|
243
|
-
* await polytomic.organization.
|
|
246
|
+
* await polytomic.organization.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
247
|
+
* name: "My Organization"
|
|
248
|
+
* })
|
|
244
249
|
*/
|
|
245
|
-
|
|
250
|
+
update(id, request, requestOptions) {
|
|
246
251
|
var _a;
|
|
247
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
248
253
|
const _response = yield core.fetcher({
|
|
249
254
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/organizations/${id}`),
|
|
250
|
-
method: "
|
|
255
|
+
method: "PUT",
|
|
251
256
|
headers: {
|
|
252
257
|
Authorization: yield this._getAuthorizationHeader(),
|
|
253
|
-
"X-Polytomic-Version":
|
|
254
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
255
|
-
: undefined,
|
|
258
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
256
259
|
"X-Fern-Language": "JavaScript",
|
|
257
260
|
"X-Fern-SDK-Name": "polytomic",
|
|
258
|
-
"X-Fern-SDK-Version": "0.
|
|
261
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
259
262
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
260
263
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
261
264
|
},
|
|
262
265
|
contentType: "application/json",
|
|
266
|
+
body: request,
|
|
263
267
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
264
268
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
265
269
|
});
|
|
266
270
|
if (_response.ok) {
|
|
267
|
-
return;
|
|
271
|
+
return _response.body;
|
|
268
272
|
}
|
|
269
273
|
if (_response.error.reason === "status-code") {
|
|
270
274
|
switch (_response.error.statusCode) {
|
|
271
275
|
case 401:
|
|
272
276
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
277
|
+
case 422:
|
|
278
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
279
|
+
case 500:
|
|
280
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
273
281
|
default:
|
|
274
282
|
throw new errors.PolytomicError({
|
|
275
283
|
statusCode: _response.error.statusCode,
|
|
@@ -295,48 +303,44 @@ class Organization {
|
|
|
295
303
|
/**
|
|
296
304
|
* > 🚧 Requires partner key
|
|
297
305
|
* >
|
|
298
|
-
* > Organization endpoints are only accessible using [partner keys](https://
|
|
306
|
+
* > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
|
|
299
307
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
308
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
309
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
300
310
|
*
|
|
301
311
|
* @example
|
|
302
|
-
* await polytomic.organization.
|
|
303
|
-
* client_id: "client_id",
|
|
304
|
-
* client_secret: "client_secret",
|
|
305
|
-
* issuer: "https://example.com",
|
|
306
|
-
* name: "My Organization",
|
|
307
|
-
* sso_domain: "example.com",
|
|
308
|
-
* sso_org_id: "123456"
|
|
309
|
-
* })
|
|
312
|
+
* await polytomic.organization.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
310
313
|
*/
|
|
311
|
-
|
|
314
|
+
remove(id, requestOptions) {
|
|
312
315
|
var _a;
|
|
313
316
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
317
|
const _response = yield core.fetcher({
|
|
315
318
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/organizations/${id}`),
|
|
316
|
-
method: "
|
|
319
|
+
method: "DELETE",
|
|
317
320
|
headers: {
|
|
318
321
|
Authorization: yield this._getAuthorizationHeader(),
|
|
319
|
-
"X-Polytomic-Version":
|
|
320
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
321
|
-
: undefined,
|
|
322
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
322
323
|
"X-Fern-Language": "JavaScript",
|
|
323
324
|
"X-Fern-SDK-Name": "polytomic",
|
|
324
|
-
"X-Fern-SDK-Version": "0.
|
|
325
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
325
326
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
326
327
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
327
328
|
},
|
|
328
329
|
contentType: "application/json",
|
|
329
|
-
body: request,
|
|
330
330
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
331
331
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
332
332
|
});
|
|
333
333
|
if (_response.ok) {
|
|
334
|
-
return
|
|
334
|
+
return;
|
|
335
335
|
}
|
|
336
336
|
if (_response.error.reason === "status-code") {
|
|
337
337
|
switch (_response.error.statusCode) {
|
|
338
338
|
case 401:
|
|
339
339
|
throw new Polytomic.UnauthorizedError(_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);
|
|
340
344
|
default:
|
|
341
345
|
throw new errors.PolytomicError({
|
|
342
346
|
statusCode: _response.error.statusCode,
|
|
@@ -361,11 +365,7 @@ class Organization {
|
|
|
361
365
|
}
|
|
362
366
|
_getAuthorizationHeader() {
|
|
363
367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
364
|
-
|
|
365
|
-
if (bearer != null) {
|
|
366
|
-
return `Bearer ${bearer}`;
|
|
367
|
-
}
|
|
368
|
-
return undefined;
|
|
368
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
371
|
}
|
package/dist/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts
CHANGED
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
*
|
|
8
|
-
* client_secret: "client_secret",
|
|
9
|
-
* issuer: "https://example.com",
|
|
10
|
-
* name: "My Organization",
|
|
11
|
-
* sso_domain: "example.com",
|
|
12
|
-
* sso_org_id: "123456"
|
|
7
|
+
* name: "My Organization"
|
|
13
8
|
* }
|
|
14
9
|
*/
|
|
15
10
|
export interface CreateOrganizationRequestSchema {
|
package/dist/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts
CHANGED
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
*
|
|
8
|
-
* client_secret: "client_secret",
|
|
9
|
-
* issuer: "https://example.com",
|
|
10
|
-
* name: "My Organization",
|
|
11
|
-
* sso_domain: "example.com",
|
|
12
|
-
* sso_org_id: "123456"
|
|
7
|
+
* name: "My Organization"
|
|
13
8
|
* }
|
|
14
9
|
*/
|
|
15
10
|
export interface UpdateOrganizationRequestSchema {
|
|
@@ -8,8 +8,7 @@ import { Roles } from "../resources/roles/client/Client";
|
|
|
8
8
|
export declare namespace Permissions {
|
|
9
9
|
interface Options {
|
|
10
10
|
environment?: core.Supplier<environments.PolytomicEnvironment | string>;
|
|
11
|
-
token
|
|
12
|
-
xPolytomicVersion?: core.Supplier<"2023-04-25" | undefined>;
|
|
11
|
+
token: core.Supplier<core.BearerToken>;
|
|
13
12
|
}
|
|
14
13
|
interface RequestOptions {
|
|
15
14
|
timeoutInSeconds?: number;
|
|
@@ -18,7 +17,7 @@ export declare namespace Permissions {
|
|
|
18
17
|
}
|
|
19
18
|
export declare class Permissions {
|
|
20
19
|
protected readonly _options: Permissions.Options;
|
|
21
|
-
constructor(_options
|
|
20
|
+
constructor(_options: Permissions.Options);
|
|
22
21
|
protected _policies: Policies | undefined;
|
|
23
22
|
get policies(): Policies;
|
|
24
23
|
protected _roles: Roles | undefined;
|
|
@@ -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,53 +16,59 @@ 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({
|
|
33
|
-
* name: "Custom"
|
|
34
|
-
* policy_actions: [{
|
|
35
|
-
* action: "read",
|
|
36
|
-
* role_ids: ["248df4b7-aa70-47b8-a036-33ac447e668d"]
|
|
37
|
-
* }]
|
|
37
|
+
* name: "Custom"
|
|
38
38
|
* })
|
|
39
39
|
*/
|
|
40
40
|
create(request: Polytomic.permissions.CreatePolicyRequest, requestOptions?: Policies.RequestOptions): Promise<Polytomic.PolicyResponseEnvelope>;
|
|
41
41
|
/**
|
|
42
42
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
43
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
44
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
43
45
|
*
|
|
44
46
|
* @example
|
|
45
47
|
* await polytomic.permissions.policies.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
46
48
|
*/
|
|
47
49
|
get(id: string, requestOptions?: Policies.RequestOptions): Promise<Polytomic.PolicyResponseEnvelope>;
|
|
48
50
|
/**
|
|
51
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
49
52
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
53
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
54
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
55
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
50
56
|
*
|
|
51
57
|
* @example
|
|
52
|
-
* await polytomic.permissions.policies.
|
|
58
|
+
* await polytomic.permissions.policies.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
59
|
+
* name: "Custom"
|
|
60
|
+
* })
|
|
53
61
|
*/
|
|
54
|
-
|
|
62
|
+
update(id: string, request: Polytomic.permissions.UpdatePolicyRequest, requestOptions?: Policies.RequestOptions): Promise<Polytomic.PolicyResponseEnvelope>;
|
|
55
63
|
/**
|
|
56
64
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
65
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
66
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
67
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
57
68
|
*
|
|
58
69
|
* @example
|
|
59
|
-
* await polytomic.permissions.policies.
|
|
60
|
-
* name: "Custom",
|
|
61
|
-
* policy_actions: [{
|
|
62
|
-
* action: "read",
|
|
63
|
-
* role_ids: ["248df4b7-aa70-47b8-a036-33ac447e668d"]
|
|
64
|
-
* }]
|
|
65
|
-
* })
|
|
70
|
+
* await polytomic.permissions.policies.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
66
71
|
*/
|
|
67
|
-
|
|
68
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
72
|
+
remove(id: string, requestOptions?: Policies.RequestOptions): Promise<void>;
|
|
73
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
69
74
|
}
|
|
@@ -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": "1.0.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,15 +106,15 @@ 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({
|
|
112
|
-
* name: "Custom"
|
|
113
|
-
* policy_actions: [{
|
|
114
|
-
* action: "read",
|
|
115
|
-
* role_ids: ["248df4b7-aa70-47b8-a036-33ac447e668d"]
|
|
116
|
-
* }]
|
|
117
|
+
* name: "Custom"
|
|
117
118
|
* })
|
|
118
119
|
*/
|
|
119
120
|
create(request, requestOptions) {
|
|
@@ -124,12 +125,10 @@ class Policies {
|
|
|
124
125
|
method: "POST",
|
|
125
126
|
headers: {
|
|
126
127
|
Authorization: yield this._getAuthorizationHeader(),
|
|
127
|
-
"X-Polytomic-Version":
|
|
128
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
129
|
-
: undefined,
|
|
128
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
130
129
|
"X-Fern-Language": "JavaScript",
|
|
131
130
|
"X-Fern-SDK-Name": "polytomic",
|
|
132
|
-
"X-Fern-SDK-Version": "0.
|
|
131
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
133
132
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
134
133
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
135
134
|
},
|
|
@@ -143,8 +142,16 @@ class Policies {
|
|
|
143
142
|
}
|
|
144
143
|
if (_response.error.reason === "status-code") {
|
|
145
144
|
switch (_response.error.statusCode) {
|
|
145
|
+
case 400:
|
|
146
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
146
147
|
case 401:
|
|
147
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);
|
|
148
155
|
default:
|
|
149
156
|
throw new errors.PolytomicError({
|
|
150
157
|
statusCode: _response.error.statusCode,
|
|
@@ -169,6 +176,8 @@ class Policies {
|
|
|
169
176
|
}
|
|
170
177
|
/**
|
|
171
178
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
179
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
180
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
172
181
|
*
|
|
173
182
|
* @example
|
|
174
183
|
* await polytomic.permissions.policies.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -181,12 +190,10 @@ class Policies {
|
|
|
181
190
|
method: "GET",
|
|
182
191
|
headers: {
|
|
183
192
|
Authorization: yield this._getAuthorizationHeader(),
|
|
184
|
-
"X-Polytomic-Version":
|
|
185
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
186
|
-
: undefined,
|
|
193
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
187
194
|
"X-Fern-Language": "JavaScript",
|
|
188
195
|
"X-Fern-SDK-Name": "polytomic",
|
|
189
|
-
"X-Fern-SDK-Version": "0.
|
|
196
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
190
197
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
191
198
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
192
199
|
},
|
|
@@ -201,6 +208,10 @@ class Policies {
|
|
|
201
208
|
switch (_response.error.statusCode) {
|
|
202
209
|
case 401:
|
|
203
210
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
211
|
+
case 404:
|
|
212
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
213
|
+
case 500:
|
|
214
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
204
215
|
default:
|
|
205
216
|
throw new errors.PolytomicError({
|
|
206
217
|
statusCode: _response.error.statusCode,
|
|
@@ -224,39 +235,52 @@ class Policies {
|
|
|
224
235
|
});
|
|
225
236
|
}
|
|
226
237
|
/**
|
|
238
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
227
239
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
240
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
241
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
242
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
228
243
|
*
|
|
229
244
|
* @example
|
|
230
|
-
* await polytomic.permissions.policies.
|
|
245
|
+
* await polytomic.permissions.policies.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
246
|
+
* name: "Custom"
|
|
247
|
+
* })
|
|
231
248
|
*/
|
|
232
|
-
|
|
249
|
+
update(id, request, requestOptions) {
|
|
233
250
|
var _a;
|
|
234
251
|
return __awaiter(this, void 0, void 0, function* () {
|
|
235
252
|
const _response = yield core.fetcher({
|
|
236
253
|
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: "
|
|
254
|
+
method: "PUT",
|
|
238
255
|
headers: {
|
|
239
256
|
Authorization: yield this._getAuthorizationHeader(),
|
|
240
|
-
"X-Polytomic-Version":
|
|
241
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
242
|
-
: undefined,
|
|
257
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
243
258
|
"X-Fern-Language": "JavaScript",
|
|
244
259
|
"X-Fern-SDK-Name": "polytomic",
|
|
245
|
-
"X-Fern-SDK-Version": "0.
|
|
260
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
246
261
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
247
262
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
248
263
|
},
|
|
249
264
|
contentType: "application/json",
|
|
265
|
+
body: request,
|
|
250
266
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
251
267
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
252
268
|
});
|
|
253
269
|
if (_response.ok) {
|
|
254
|
-
return;
|
|
270
|
+
return _response.body;
|
|
255
271
|
}
|
|
256
272
|
if (_response.error.reason === "status-code") {
|
|
257
273
|
switch (_response.error.statusCode) {
|
|
274
|
+
case 400:
|
|
275
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
258
276
|
case 401:
|
|
259
277
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
278
|
+
case 403:
|
|
279
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
280
|
+
case 404:
|
|
281
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
282
|
+
case 500:
|
|
283
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
260
284
|
default:
|
|
261
285
|
throw new errors.PolytomicError({
|
|
262
286
|
statusCode: _response.error.statusCode,
|
|
@@ -281,45 +305,45 @@ class Policies {
|
|
|
281
305
|
}
|
|
282
306
|
/**
|
|
283
307
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
308
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
309
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
310
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
284
311
|
*
|
|
285
312
|
* @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
|
-
* })
|
|
313
|
+
* await polytomic.permissions.policies.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
293
314
|
*/
|
|
294
|
-
|
|
315
|
+
remove(id, requestOptions) {
|
|
295
316
|
var _a;
|
|
296
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
297
318
|
const _response = yield core.fetcher({
|
|
298
319
|
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: "
|
|
320
|
+
method: "DELETE",
|
|
300
321
|
headers: {
|
|
301
322
|
Authorization: yield this._getAuthorizationHeader(),
|
|
302
|
-
"X-Polytomic-Version":
|
|
303
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
304
|
-
: undefined,
|
|
323
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
305
324
|
"X-Fern-Language": "JavaScript",
|
|
306
325
|
"X-Fern-SDK-Name": "polytomic",
|
|
307
|
-
"X-Fern-SDK-Version": "0.
|
|
326
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
308
327
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
309
328
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
310
329
|
},
|
|
311
330
|
contentType: "application/json",
|
|
312
|
-
body: request,
|
|
313
331
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
332
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
315
333
|
});
|
|
316
334
|
if (_response.ok) {
|
|
317
|
-
return
|
|
335
|
+
return;
|
|
318
336
|
}
|
|
319
337
|
if (_response.error.reason === "status-code") {
|
|
320
338
|
switch (_response.error.statusCode) {
|
|
321
339
|
case 401:
|
|
322
340
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
341
|
+
case 403:
|
|
342
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
343
|
+
case 404:
|
|
344
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
345
|
+
case 500:
|
|
346
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
323
347
|
default:
|
|
324
348
|
throw new errors.PolytomicError({
|
|
325
349
|
statusCode: _response.error.statusCode,
|
|
@@ -344,11 +368,7 @@ class Policies {
|
|
|
344
368
|
}
|
|
345
369
|
_getAuthorizationHeader() {
|
|
346
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
-
|
|
348
|
-
if (bearer != null) {
|
|
349
|
-
return `Bearer ${bearer}`;
|
|
350
|
-
}
|
|
351
|
-
return undefined;
|
|
371
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
352
372
|
});
|
|
353
373
|
}
|
|
354
374
|
}
|