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,8 +7,7 @@ import * as Polytomic from "../../..";
|
|
|
7
7
|
export declare namespace Models {
|
|
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,20 @@ export declare namespace Models {
|
|
|
17
16
|
}
|
|
18
17
|
export declare class Models {
|
|
19
18
|
protected readonly _options: Models.Options;
|
|
20
|
-
constructor(_options
|
|
19
|
+
constructor(_options: Models.Options);
|
|
21
20
|
/**
|
|
22
21
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
22
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* await polytomic.models.list()
|
|
26
26
|
*/
|
|
27
27
|
list(requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelListResponseEnvelope>;
|
|
28
28
|
/**
|
|
29
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
29
30
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
31
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
32
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
30
33
|
*
|
|
31
34
|
* @example
|
|
32
35
|
* await polytomic.models.create({
|
|
@@ -38,20 +41,18 @@ export declare class Models {
|
|
|
38
41
|
create(request: Polytomic.CreateModelRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
|
|
39
42
|
/**
|
|
40
43
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
44
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
45
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
41
46
|
*
|
|
42
47
|
* @example
|
|
43
48
|
* await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
44
49
|
*/
|
|
45
50
|
get(id: string, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
|
|
46
51
|
/**
|
|
52
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
47
53
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
48
|
-
*
|
|
49
|
-
* @
|
|
50
|
-
* await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
51
|
-
*/
|
|
52
|
-
remove(id: string, requestOptions?: Models.RequestOptions): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
54
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
55
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
57
58
|
* await polytomic.models.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
@@ -62,5 +63,15 @@ export declare class Models {
|
|
|
62
63
|
* })
|
|
63
64
|
*/
|
|
64
65
|
update(id: string, request: Polytomic.UpdateModelRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
|
|
65
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
68
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
69
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
70
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
74
|
+
*/
|
|
75
|
+
remove(id: string, requestOptions?: Models.RequestOptions): Promise<void>;
|
|
76
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
66
77
|
}
|
|
@@ -56,11 +56,12 @@ const Polytomic = __importStar(require("../../.."));
|
|
|
56
56
|
const url_join_1 = __importDefault(require("url-join"));
|
|
57
57
|
const errors = __importStar(require("../../../../errors"));
|
|
58
58
|
class Models {
|
|
59
|
-
constructor(_options
|
|
59
|
+
constructor(_options) {
|
|
60
60
|
this._options = _options;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
64
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
64
65
|
*
|
|
65
66
|
* @example
|
|
66
67
|
* await polytomic.models.list()
|
|
@@ -73,12 +74,10 @@ class Models {
|
|
|
73
74
|
method: "GET",
|
|
74
75
|
headers: {
|
|
75
76
|
Authorization: yield this._getAuthorizationHeader(),
|
|
76
|
-
"X-Polytomic-Version":
|
|
77
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
78
|
-
: undefined,
|
|
77
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
79
78
|
"X-Fern-Language": "JavaScript",
|
|
80
79
|
"X-Fern-SDK-Name": "polytomic",
|
|
81
|
-
"X-Fern-SDK-Version": "0.
|
|
80
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
82
81
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
83
82
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
84
83
|
},
|
|
@@ -93,6 +92,8 @@ class Models {
|
|
|
93
92
|
switch (_response.error.statusCode) {
|
|
94
93
|
case 401:
|
|
95
94
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
95
|
+
case 404:
|
|
96
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
96
97
|
default:
|
|
97
98
|
throw new errors.PolytomicError({
|
|
98
99
|
statusCode: _response.error.statusCode,
|
|
@@ -116,7 +117,10 @@ class Models {
|
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
/**
|
|
120
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
119
121
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
122
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
123
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
120
124
|
*
|
|
121
125
|
* @example
|
|
122
126
|
* await polytomic.models.create({
|
|
@@ -138,12 +142,10 @@ class Models {
|
|
|
138
142
|
method: "POST",
|
|
139
143
|
headers: {
|
|
140
144
|
Authorization: yield this._getAuthorizationHeader(),
|
|
141
|
-
"X-Polytomic-Version":
|
|
142
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
143
|
-
: undefined,
|
|
145
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
144
146
|
"X-Fern-Language": "JavaScript",
|
|
145
147
|
"X-Fern-SDK-Name": "polytomic",
|
|
146
|
-
"X-Fern-SDK-Version": "0.
|
|
148
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
147
149
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
148
150
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
149
151
|
},
|
|
@@ -158,8 +160,14 @@ class Models {
|
|
|
158
160
|
}
|
|
159
161
|
if (_response.error.reason === "status-code") {
|
|
160
162
|
switch (_response.error.statusCode) {
|
|
163
|
+
case 400:
|
|
164
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
161
165
|
case 401:
|
|
162
166
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
167
|
+
case 403:
|
|
168
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
169
|
+
case 500:
|
|
170
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
163
171
|
default:
|
|
164
172
|
throw new errors.PolytomicError({
|
|
165
173
|
statusCode: _response.error.statusCode,
|
|
@@ -184,6 +192,8 @@ class Models {
|
|
|
184
192
|
}
|
|
185
193
|
/**
|
|
186
194
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
195
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
196
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
187
197
|
*
|
|
188
198
|
* @example
|
|
189
199
|
* await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -196,12 +206,10 @@ class Models {
|
|
|
196
206
|
method: "GET",
|
|
197
207
|
headers: {
|
|
198
208
|
Authorization: yield this._getAuthorizationHeader(),
|
|
199
|
-
"X-Polytomic-Version":
|
|
200
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
201
|
-
: undefined,
|
|
209
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
202
210
|
"X-Fern-Language": "JavaScript",
|
|
203
211
|
"X-Fern-SDK-Name": "polytomic",
|
|
204
|
-
"X-Fern-SDK-Version": "0.
|
|
212
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
205
213
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
206
214
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
207
215
|
},
|
|
@@ -216,6 +224,10 @@ class Models {
|
|
|
216
224
|
switch (_response.error.statusCode) {
|
|
217
225
|
case 401:
|
|
218
226
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
227
|
+
case 404:
|
|
228
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
229
|
+
case 500:
|
|
230
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
219
231
|
default:
|
|
220
232
|
throw new errors.PolytomicError({
|
|
221
233
|
statusCode: _response.error.statusCode,
|
|
@@ -239,39 +251,58 @@ class Models {
|
|
|
239
251
|
});
|
|
240
252
|
}
|
|
241
253
|
/**
|
|
254
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
242
255
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
256
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
257
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
243
258
|
*
|
|
244
259
|
* @example
|
|
245
|
-
* await polytomic.models.
|
|
260
|
+
* await polytomic.models.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
261
|
+
* async: false,
|
|
262
|
+
* connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
263
|
+
* identifier: "id",
|
|
264
|
+
* name: "Users"
|
|
265
|
+
* })
|
|
246
266
|
*/
|
|
247
|
-
|
|
267
|
+
update(id, request, requestOptions) {
|
|
248
268
|
var _a;
|
|
249
269
|
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
const { async } = request, _body = __rest(request, ["async"]);
|
|
271
|
+
const _queryParams = {};
|
|
272
|
+
if (async != null) {
|
|
273
|
+
_queryParams["async"] = async.toString();
|
|
274
|
+
}
|
|
250
275
|
const _response = yield core.fetcher({
|
|
251
276
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/models/${id}`),
|
|
252
|
-
method: "
|
|
277
|
+
method: "PUT",
|
|
253
278
|
headers: {
|
|
254
279
|
Authorization: yield this._getAuthorizationHeader(),
|
|
255
|
-
"X-Polytomic-Version":
|
|
256
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
257
|
-
: undefined,
|
|
280
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
258
281
|
"X-Fern-Language": "JavaScript",
|
|
259
282
|
"X-Fern-SDK-Name": "polytomic",
|
|
260
|
-
"X-Fern-SDK-Version": "0.
|
|
283
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
261
284
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
262
285
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
263
286
|
},
|
|
264
287
|
contentType: "application/json",
|
|
288
|
+
queryParameters: _queryParams,
|
|
289
|
+
body: _body,
|
|
265
290
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
266
291
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
267
292
|
});
|
|
268
293
|
if (_response.ok) {
|
|
269
|
-
return;
|
|
294
|
+
return _response.body;
|
|
270
295
|
}
|
|
271
296
|
if (_response.error.reason === "status-code") {
|
|
272
297
|
switch (_response.error.statusCode) {
|
|
298
|
+
case 400:
|
|
299
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
273
300
|
case 401:
|
|
274
301
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
302
|
+
case 404:
|
|
303
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
304
|
+
case 500:
|
|
305
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
275
306
|
default:
|
|
276
307
|
throw new errors.PolytomicError({
|
|
277
308
|
statusCode: _response.error.statusCode,
|
|
@@ -296,50 +327,45 @@ class Models {
|
|
|
296
327
|
}
|
|
297
328
|
/**
|
|
298
329
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
330
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
331
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
332
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
299
333
|
*
|
|
300
334
|
* @example
|
|
301
|
-
* await polytomic.models.
|
|
302
|
-
* async: false,
|
|
303
|
-
* connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
304
|
-
* identifier: "id",
|
|
305
|
-
* name: "Users"
|
|
306
|
-
* })
|
|
335
|
+
* await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
307
336
|
*/
|
|
308
|
-
|
|
337
|
+
remove(id, requestOptions) {
|
|
309
338
|
var _a;
|
|
310
339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
311
|
-
const { async } = request, _body = __rest(request, ["async"]);
|
|
312
|
-
const _queryParams = {};
|
|
313
|
-
if (async != null) {
|
|
314
|
-
_queryParams["async"] = async.toString();
|
|
315
|
-
}
|
|
316
340
|
const _response = yield core.fetcher({
|
|
317
341
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/models/${id}`),
|
|
318
|
-
method: "
|
|
342
|
+
method: "DELETE",
|
|
319
343
|
headers: {
|
|
320
344
|
Authorization: yield this._getAuthorizationHeader(),
|
|
321
|
-
"X-Polytomic-Version":
|
|
322
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
323
|
-
: undefined,
|
|
345
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
324
346
|
"X-Fern-Language": "JavaScript",
|
|
325
347
|
"X-Fern-SDK-Name": "polytomic",
|
|
326
|
-
"X-Fern-SDK-Version": "0.
|
|
348
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
327
349
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
328
350
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
329
351
|
},
|
|
330
352
|
contentType: "application/json",
|
|
331
|
-
queryParameters: _queryParams,
|
|
332
|
-
body: _body,
|
|
333
353
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
334
354
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
335
355
|
});
|
|
336
356
|
if (_response.ok) {
|
|
337
|
-
return
|
|
357
|
+
return;
|
|
338
358
|
}
|
|
339
359
|
if (_response.error.reason === "status-code") {
|
|
340
360
|
switch (_response.error.statusCode) {
|
|
341
361
|
case 401:
|
|
342
362
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
363
|
+
case 403:
|
|
364
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
365
|
+
case 404:
|
|
366
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
367
|
+
case 500:
|
|
368
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
343
369
|
default:
|
|
344
370
|
throw new errors.PolytomicError({
|
|
345
371
|
statusCode: _response.error.statusCode,
|
|
@@ -364,11 +390,7 @@ class Models {
|
|
|
364
390
|
}
|
|
365
391
|
_getAuthorizationHeader() {
|
|
366
392
|
return __awaiter(this, void 0, void 0, function* () {
|
|
367
|
-
|
|
368
|
-
if (bearer != null) {
|
|
369
|
-
return `Bearer ${bearer}`;
|
|
370
|
-
}
|
|
371
|
-
return undefined;
|
|
393
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
372
394
|
});
|
|
373
395
|
}
|
|
374
396
|
}
|
|
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
|
|
|
7
7
|
export declare namespace Organization {
|
|
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,12 +16,13 @@ export declare namespace Organization {
|
|
|
17
16
|
}
|
|
18
17
|
export declare class Organization {
|
|
19
18
|
protected readonly _options: Organization.Options;
|
|
20
|
-
constructor(_options
|
|
19
|
+
constructor(_options: Organization.Options);
|
|
21
20
|
/**
|
|
22
21
|
* > 🚧 Requires partner key
|
|
23
22
|
* >
|
|
24
23
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
25
24
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
25
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* await polytomic.organization.list()
|
|
@@ -33,6 +33,8 @@ export declare class Organization {
|
|
|
33
33
|
* >
|
|
34
34
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
35
35
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
36
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
37
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
36
38
|
*
|
|
37
39
|
* @example
|
|
38
40
|
* await polytomic.organization.create({
|
|
@@ -50,6 +52,7 @@ export declare class Organization {
|
|
|
50
52
|
* >
|
|
51
53
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
52
54
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
55
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
53
56
|
*
|
|
54
57
|
* @example
|
|
55
58
|
* await polytomic.organization.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -60,16 +63,8 @@ export declare class Organization {
|
|
|
60
63
|
* >
|
|
61
64
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
62
65
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
63
|
-
*
|
|
64
|
-
* @
|
|
65
|
-
* await polytomic.organization.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
66
|
-
*/
|
|
67
|
-
remove(id: string, requestOptions?: Organization.RequestOptions): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* > 🚧 Requires partner key
|
|
70
|
-
* >
|
|
71
|
-
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
72
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
66
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
67
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
73
68
|
*
|
|
74
69
|
* @example
|
|
75
70
|
* await polytomic.organization.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
@@ -82,5 +77,17 @@ export declare class Organization {
|
|
|
82
77
|
* })
|
|
83
78
|
*/
|
|
84
79
|
update(id: string, request: Polytomic.UpdateOrganizationRequestSchema, requestOptions?: Organization.RequestOptions): Promise<Polytomic.OrganizationEnvelope>;
|
|
85
|
-
|
|
80
|
+
/**
|
|
81
|
+
* > 🚧 Requires partner key
|
|
82
|
+
* >
|
|
83
|
+
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
84
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
85
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
86
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* await polytomic.organization.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
90
|
+
*/
|
|
91
|
+
remove(id: string, requestOptions?: Organization.RequestOptions): Promise<void>;
|
|
92
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
86
93
|
}
|
|
@@ -45,7 +45,7 @@ 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
|
/**
|
|
@@ -53,6 +53,7 @@ class Organization {
|
|
|
53
53
|
* >
|
|
54
54
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#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": "0.2.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,
|
|
@@ -112,6 +113,8 @@ class Organization {
|
|
|
112
113
|
* >
|
|
113
114
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#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({
|
|
@@ -131,12 +134,10 @@ class Organization {
|
|
|
131
134
|
method: "POST",
|
|
132
135
|
headers: {
|
|
133
136
|
Authorization: yield this._getAuthorizationHeader(),
|
|
134
|
-
"X-Polytomic-Version":
|
|
135
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
136
|
-
: undefined,
|
|
137
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
137
138
|
"X-Fern-Language": "JavaScript",
|
|
138
139
|
"X-Fern-SDK-Name": "polytomic",
|
|
139
|
-
"X-Fern-SDK-Version": "0.
|
|
140
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
140
141
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
141
142
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
142
143
|
},
|
|
@@ -152,6 +153,10 @@ class Organization {
|
|
|
152
153
|
switch (_response.error.statusCode) {
|
|
153
154
|
case 401:
|
|
154
155
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
156
|
+
case 422:
|
|
157
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
158
|
+
case 500:
|
|
159
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
155
160
|
default:
|
|
156
161
|
throw new errors.PolytomicError({
|
|
157
162
|
statusCode: _response.error.statusCode,
|
|
@@ -179,6 +184,7 @@ class Organization {
|
|
|
179
184
|
* >
|
|
180
185
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
181
186
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
187
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
182
188
|
*
|
|
183
189
|
* @example
|
|
184
190
|
* await polytomic.organization.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -191,12 +197,10 @@ class Organization {
|
|
|
191
197
|
method: "GET",
|
|
192
198
|
headers: {
|
|
193
199
|
Authorization: yield this._getAuthorizationHeader(),
|
|
194
|
-
"X-Polytomic-Version":
|
|
195
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
196
|
-
: undefined,
|
|
200
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
197
201
|
"X-Fern-Language": "JavaScript",
|
|
198
202
|
"X-Fern-SDK-Name": "polytomic",
|
|
199
|
-
"X-Fern-SDK-Version": "0.
|
|
203
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
200
204
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
201
205
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
202
206
|
},
|
|
@@ -211,6 +215,8 @@ class Organization {
|
|
|
211
215
|
switch (_response.error.statusCode) {
|
|
212
216
|
case 401:
|
|
213
217
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
218
|
+
case 404:
|
|
219
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
214
220
|
default:
|
|
215
221
|
throw new errors.PolytomicError({
|
|
216
222
|
statusCode: _response.error.statusCode,
|
|
@@ -238,38 +244,50 @@ class Organization {
|
|
|
238
244
|
* >
|
|
239
245
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
240
246
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
247
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
248
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
241
249
|
*
|
|
242
250
|
* @example
|
|
243
|
-
* await polytomic.organization.
|
|
251
|
+
* await polytomic.organization.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
252
|
+
* client_id: "client_id",
|
|
253
|
+
* client_secret: "client_secret",
|
|
254
|
+
* issuer: "https://example.com",
|
|
255
|
+
* name: "My Organization",
|
|
256
|
+
* sso_domain: "example.com",
|
|
257
|
+
* sso_org_id: "123456"
|
|
258
|
+
* })
|
|
244
259
|
*/
|
|
245
|
-
|
|
260
|
+
update(id, request, requestOptions) {
|
|
246
261
|
var _a;
|
|
247
262
|
return __awaiter(this, void 0, void 0, function* () {
|
|
248
263
|
const _response = yield core.fetcher({
|
|
249
264
|
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: "
|
|
265
|
+
method: "PUT",
|
|
251
266
|
headers: {
|
|
252
267
|
Authorization: yield this._getAuthorizationHeader(),
|
|
253
|
-
"X-Polytomic-Version":
|
|
254
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
255
|
-
: undefined,
|
|
268
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
256
269
|
"X-Fern-Language": "JavaScript",
|
|
257
270
|
"X-Fern-SDK-Name": "polytomic",
|
|
258
|
-
"X-Fern-SDK-Version": "0.
|
|
271
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
259
272
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
260
273
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
261
274
|
},
|
|
262
275
|
contentType: "application/json",
|
|
276
|
+
body: request,
|
|
263
277
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
264
278
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
265
279
|
});
|
|
266
280
|
if (_response.ok) {
|
|
267
|
-
return;
|
|
281
|
+
return _response.body;
|
|
268
282
|
}
|
|
269
283
|
if (_response.error.reason === "status-code") {
|
|
270
284
|
switch (_response.error.statusCode) {
|
|
271
285
|
case 401:
|
|
272
286
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
287
|
+
case 422:
|
|
288
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
289
|
+
case 500:
|
|
290
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
273
291
|
default:
|
|
274
292
|
throw new errors.PolytomicError({
|
|
275
293
|
statusCode: _response.error.statusCode,
|
|
@@ -297,46 +315,42 @@ class Organization {
|
|
|
297
315
|
* >
|
|
298
316
|
* > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
299
317
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
318
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
319
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
300
320
|
*
|
|
301
321
|
* @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
|
-
* })
|
|
322
|
+
* await polytomic.organization.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
310
323
|
*/
|
|
311
|
-
|
|
324
|
+
remove(id, requestOptions) {
|
|
312
325
|
var _a;
|
|
313
326
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
327
|
const _response = yield core.fetcher({
|
|
315
328
|
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: "
|
|
329
|
+
method: "DELETE",
|
|
317
330
|
headers: {
|
|
318
331
|
Authorization: yield this._getAuthorizationHeader(),
|
|
319
|
-
"X-Polytomic-Version":
|
|
320
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
321
|
-
: undefined,
|
|
332
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
322
333
|
"X-Fern-Language": "JavaScript",
|
|
323
334
|
"X-Fern-SDK-Name": "polytomic",
|
|
324
|
-
"X-Fern-SDK-Version": "0.
|
|
335
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
325
336
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
326
337
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
327
338
|
},
|
|
328
339
|
contentType: "application/json",
|
|
329
|
-
body: request,
|
|
330
340
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
331
341
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
332
342
|
});
|
|
333
343
|
if (_response.ok) {
|
|
334
|
-
return
|
|
344
|
+
return;
|
|
335
345
|
}
|
|
336
346
|
if (_response.error.reason === "status-code") {
|
|
337
347
|
switch (_response.error.statusCode) {
|
|
338
348
|
case 401:
|
|
339
349
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
350
|
+
case 404:
|
|
351
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
352
|
+
case 500:
|
|
353
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
340
354
|
default:
|
|
341
355
|
throw new errors.PolytomicError({
|
|
342
356
|
statusCode: _response.error.statusCode,
|
|
@@ -361,11 +375,7 @@ class Organization {
|
|
|
361
375
|
}
|
|
362
376
|
_getAuthorizationHeader() {
|
|
363
377
|
return __awaiter(this, void 0, void 0, function* () {
|
|
364
|
-
|
|
365
|
-
if (bearer != null) {
|
|
366
|
-
return `Bearer ${bearer}`;
|
|
367
|
-
}
|
|
368
|
-
return undefined;
|
|
378
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
369
379
|
});
|
|
370
380
|
}
|
|
371
381
|
}
|
|
@@ -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;
|