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
|
@@ -46,11 +46,299 @@ const url_join_1 = __importDefault(require("url-join"));
|
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
const Client_1 = require("../resources/executions/client/Client");
|
|
48
48
|
class ModelSync {
|
|
49
|
-
constructor(_options
|
|
49
|
+
constructor(_options) {
|
|
50
50
|
this._options = _options;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
53
54
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
55
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
56
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
57
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await polytomic.modelSync.getSource("248df4b7-aa70-47b8-a036-33ac447e668d", {})
|
|
61
|
+
*/
|
|
62
|
+
getSource(id, request = {}, requestOptions) {
|
|
63
|
+
var _a;
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const { params } = request;
|
|
66
|
+
const _queryParams = {};
|
|
67
|
+
if (params != null) {
|
|
68
|
+
_queryParams["params"] = params;
|
|
69
|
+
}
|
|
70
|
+
const _response = yield core.fetcher({
|
|
71
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/connections/${id}/modelsync/source`),
|
|
72
|
+
method: "GET",
|
|
73
|
+
headers: {
|
|
74
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
75
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
76
|
+
"X-Fern-Language": "JavaScript",
|
|
77
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
78
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
79
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
80
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
81
|
+
},
|
|
82
|
+
contentType: "application/json",
|
|
83
|
+
queryParameters: _queryParams,
|
|
84
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
85
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
86
|
+
});
|
|
87
|
+
if (_response.ok) {
|
|
88
|
+
return _response.body;
|
|
89
|
+
}
|
|
90
|
+
if (_response.error.reason === "status-code") {
|
|
91
|
+
switch (_response.error.statusCode) {
|
|
92
|
+
case 400:
|
|
93
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
94
|
+
case 401:
|
|
95
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
96
|
+
case 403:
|
|
97
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
98
|
+
case 404:
|
|
99
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
100
|
+
case 500:
|
|
101
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
102
|
+
default:
|
|
103
|
+
throw new errors.PolytomicError({
|
|
104
|
+
statusCode: _response.error.statusCode,
|
|
105
|
+
body: _response.error.body,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
switch (_response.error.reason) {
|
|
110
|
+
case "non-json":
|
|
111
|
+
throw new errors.PolytomicError({
|
|
112
|
+
statusCode: _response.error.statusCode,
|
|
113
|
+
body: _response.error.rawBody,
|
|
114
|
+
});
|
|
115
|
+
case "timeout":
|
|
116
|
+
throw new errors.PolytomicTimeoutError();
|
|
117
|
+
case "unknown":
|
|
118
|
+
throw new errors.PolytomicError({
|
|
119
|
+
message: _response.error.errorMessage,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
126
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
127
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
128
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
129
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* await polytomic.modelSync.getSourceFields("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
133
|
+
*/
|
|
134
|
+
getSourceFields(id, requestOptions) {
|
|
135
|
+
var _a;
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const _response = yield core.fetcher({
|
|
138
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/connections/${id}/modelsync/source/fields`),
|
|
139
|
+
method: "GET",
|
|
140
|
+
headers: {
|
|
141
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
142
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
143
|
+
"X-Fern-Language": "JavaScript",
|
|
144
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
145
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
146
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
147
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
148
|
+
},
|
|
149
|
+
contentType: "application/json",
|
|
150
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
151
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
152
|
+
});
|
|
153
|
+
if (_response.ok) {
|
|
154
|
+
return _response.body;
|
|
155
|
+
}
|
|
156
|
+
if (_response.error.reason === "status-code") {
|
|
157
|
+
switch (_response.error.statusCode) {
|
|
158
|
+
case 400:
|
|
159
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
160
|
+
case 401:
|
|
161
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
162
|
+
case 403:
|
|
163
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
164
|
+
case 404:
|
|
165
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
166
|
+
case 500:
|
|
167
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
168
|
+
default:
|
|
169
|
+
throw new errors.PolytomicError({
|
|
170
|
+
statusCode: _response.error.statusCode,
|
|
171
|
+
body: _response.error.body,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
switch (_response.error.reason) {
|
|
176
|
+
case "non-json":
|
|
177
|
+
throw new errors.PolytomicError({
|
|
178
|
+
statusCode: _response.error.statusCode,
|
|
179
|
+
body: _response.error.rawBody,
|
|
180
|
+
});
|
|
181
|
+
case "timeout":
|
|
182
|
+
throw new errors.PolytomicTimeoutError();
|
|
183
|
+
case "unknown":
|
|
184
|
+
throw new errors.PolytomicError({
|
|
185
|
+
message: _response.error.errorMessage,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
192
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
193
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
194
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
195
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* await polytomic.modelSync.getTarget("248df4b7-aa70-47b8-a036-33ac447e668d", {})
|
|
199
|
+
*/
|
|
200
|
+
getTarget(id, request = {}, requestOptions) {
|
|
201
|
+
var _a;
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
const { type: type_, search } = request;
|
|
204
|
+
const _queryParams = {};
|
|
205
|
+
if (type_ != null) {
|
|
206
|
+
_queryParams["type"] = type_;
|
|
207
|
+
}
|
|
208
|
+
if (search != null) {
|
|
209
|
+
_queryParams["search"] = search;
|
|
210
|
+
}
|
|
211
|
+
const _response = yield core.fetcher({
|
|
212
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/connections/${id}/modelsync/target`),
|
|
213
|
+
method: "GET",
|
|
214
|
+
headers: {
|
|
215
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
216
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
217
|
+
"X-Fern-Language": "JavaScript",
|
|
218
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
219
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
220
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
221
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
222
|
+
},
|
|
223
|
+
contentType: "application/json",
|
|
224
|
+
queryParameters: _queryParams,
|
|
225
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
226
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
227
|
+
});
|
|
228
|
+
if (_response.ok) {
|
|
229
|
+
return _response.body;
|
|
230
|
+
}
|
|
231
|
+
if (_response.error.reason === "status-code") {
|
|
232
|
+
switch (_response.error.statusCode) {
|
|
233
|
+
case 400:
|
|
234
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
235
|
+
case 401:
|
|
236
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
237
|
+
case 403:
|
|
238
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
239
|
+
case 404:
|
|
240
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
241
|
+
case 500:
|
|
242
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
243
|
+
default:
|
|
244
|
+
throw new errors.PolytomicError({
|
|
245
|
+
statusCode: _response.error.statusCode,
|
|
246
|
+
body: _response.error.body,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
switch (_response.error.reason) {
|
|
251
|
+
case "non-json":
|
|
252
|
+
throw new errors.PolytomicError({
|
|
253
|
+
statusCode: _response.error.statusCode,
|
|
254
|
+
body: _response.error.rawBody,
|
|
255
|
+
});
|
|
256
|
+
case "timeout":
|
|
257
|
+
throw new errors.PolytomicTimeoutError();
|
|
258
|
+
case "unknown":
|
|
259
|
+
throw new errors.PolytomicError({
|
|
260
|
+
message: _response.error.errorMessage,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
267
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
268
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
269
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* await polytomic.modelSync.getTargetFields("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
273
|
+
* target: "database.table",
|
|
274
|
+
* refresh: false
|
|
275
|
+
* })
|
|
276
|
+
*/
|
|
277
|
+
getTargetFields(id, request, requestOptions) {
|
|
278
|
+
var _a;
|
|
279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
const { target, refresh } = request;
|
|
281
|
+
const _queryParams = {};
|
|
282
|
+
_queryParams["target"] = target;
|
|
283
|
+
if (refresh != null) {
|
|
284
|
+
_queryParams["refresh"] = refresh.toString();
|
|
285
|
+
}
|
|
286
|
+
const _response = yield core.fetcher({
|
|
287
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/connections/${id}/modelsync/target/fields`),
|
|
288
|
+
method: "GET",
|
|
289
|
+
headers: {
|
|
290
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
291
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
292
|
+
"X-Fern-Language": "JavaScript",
|
|
293
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
294
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
295
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
296
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
297
|
+
},
|
|
298
|
+
contentType: "application/json",
|
|
299
|
+
queryParameters: _queryParams,
|
|
300
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
301
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
302
|
+
});
|
|
303
|
+
if (_response.ok) {
|
|
304
|
+
return _response.body;
|
|
305
|
+
}
|
|
306
|
+
if (_response.error.reason === "status-code") {
|
|
307
|
+
switch (_response.error.statusCode) {
|
|
308
|
+
case 401:
|
|
309
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
310
|
+
case 403:
|
|
311
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
312
|
+
case 404:
|
|
313
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
314
|
+
case 500:
|
|
315
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
316
|
+
default:
|
|
317
|
+
throw new errors.PolytomicError({
|
|
318
|
+
statusCode: _response.error.statusCode,
|
|
319
|
+
body: _response.error.body,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
switch (_response.error.reason) {
|
|
324
|
+
case "non-json":
|
|
325
|
+
throw new errors.PolytomicError({
|
|
326
|
+
statusCode: _response.error.statusCode,
|
|
327
|
+
body: _response.error.rawBody,
|
|
328
|
+
});
|
|
329
|
+
case "timeout":
|
|
330
|
+
throw new errors.PolytomicTimeoutError();
|
|
331
|
+
case "unknown":
|
|
332
|
+
throw new errors.PolytomicError({
|
|
333
|
+
message: _response.error.errorMessage,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
340
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
341
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
54
342
|
*
|
|
55
343
|
* @example
|
|
56
344
|
* await polytomic.modelSync.list()
|
|
@@ -63,12 +351,10 @@ class ModelSync {
|
|
|
63
351
|
method: "GET",
|
|
64
352
|
headers: {
|
|
65
353
|
Authorization: yield this._getAuthorizationHeader(),
|
|
66
|
-
"X-Polytomic-Version":
|
|
67
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
68
|
-
: undefined,
|
|
354
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
69
355
|
"X-Fern-Language": "JavaScript",
|
|
70
356
|
"X-Fern-SDK-Name": "polytomic",
|
|
71
|
-
"X-Fern-SDK-Version": "0.
|
|
357
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
72
358
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
73
359
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
74
360
|
},
|
|
@@ -83,6 +369,10 @@ class ModelSync {
|
|
|
83
369
|
switch (_response.error.statusCode) {
|
|
84
370
|
case 401:
|
|
85
371
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
372
|
+
case 404:
|
|
373
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
374
|
+
case 500:
|
|
375
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
86
376
|
default:
|
|
87
377
|
throw new errors.PolytomicError({
|
|
88
378
|
statusCode: _response.error.statusCode,
|
|
@@ -106,7 +396,11 @@ class ModelSync {
|
|
|
106
396
|
});
|
|
107
397
|
}
|
|
108
398
|
/**
|
|
399
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
109
400
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
401
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
402
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
403
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
110
404
|
*
|
|
111
405
|
* @example
|
|
112
406
|
* await polytomic.modelSync.create({
|
|
@@ -147,12 +441,10 @@ class ModelSync {
|
|
|
147
441
|
method: "POST",
|
|
148
442
|
headers: {
|
|
149
443
|
Authorization: yield this._getAuthorizationHeader(),
|
|
150
|
-
"X-Polytomic-Version":
|
|
151
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
152
|
-
: undefined,
|
|
444
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
153
445
|
"X-Fern-Language": "JavaScript",
|
|
154
446
|
"X-Fern-SDK-Name": "polytomic",
|
|
155
|
-
"X-Fern-SDK-Version": "0.
|
|
447
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
156
448
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
157
449
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
158
450
|
},
|
|
@@ -166,8 +458,16 @@ class ModelSync {
|
|
|
166
458
|
}
|
|
167
459
|
if (_response.error.reason === "status-code") {
|
|
168
460
|
switch (_response.error.statusCode) {
|
|
461
|
+
case 400:
|
|
462
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
169
463
|
case 401:
|
|
170
464
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
465
|
+
case 403:
|
|
466
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
467
|
+
case 422:
|
|
468
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
469
|
+
case 500:
|
|
470
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
171
471
|
default:
|
|
172
472
|
throw new errors.PolytomicError({
|
|
173
473
|
statusCode: _response.error.statusCode,
|
|
@@ -192,6 +492,7 @@ class ModelSync {
|
|
|
192
492
|
}
|
|
193
493
|
/**
|
|
194
494
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
495
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
195
496
|
*
|
|
196
497
|
* @example
|
|
197
498
|
* await polytomic.modelSync.getScheduleOptions()
|
|
@@ -204,12 +505,10 @@ class ModelSync {
|
|
|
204
505
|
method: "GET",
|
|
205
506
|
headers: {
|
|
206
507
|
Authorization: yield this._getAuthorizationHeader(),
|
|
207
|
-
"X-Polytomic-Version":
|
|
208
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
209
|
-
: undefined,
|
|
508
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
210
509
|
"X-Fern-Language": "JavaScript",
|
|
211
510
|
"X-Fern-SDK-Name": "polytomic",
|
|
212
|
-
"X-Fern-SDK-Version": "0.
|
|
511
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
213
512
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
214
513
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
215
514
|
},
|
|
@@ -224,6 +523,8 @@ class ModelSync {
|
|
|
224
523
|
switch (_response.error.statusCode) {
|
|
225
524
|
case 401:
|
|
226
525
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
526
|
+
case 500:
|
|
527
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
227
528
|
default:
|
|
228
529
|
throw new errors.PolytomicError({
|
|
229
530
|
statusCode: _response.error.statusCode,
|
|
@@ -248,6 +549,8 @@ class ModelSync {
|
|
|
248
549
|
}
|
|
249
550
|
/**
|
|
250
551
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
552
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
553
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
251
554
|
*
|
|
252
555
|
* @example
|
|
253
556
|
* await polytomic.modelSync.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -260,12 +563,10 @@ class ModelSync {
|
|
|
260
563
|
method: "GET",
|
|
261
564
|
headers: {
|
|
262
565
|
Authorization: yield this._getAuthorizationHeader(),
|
|
263
|
-
"X-Polytomic-Version":
|
|
264
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
265
|
-
: undefined,
|
|
566
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
266
567
|
"X-Fern-Language": "JavaScript",
|
|
267
568
|
"X-Fern-SDK-Name": "polytomic",
|
|
268
|
-
"X-Fern-SDK-Version": "0.
|
|
569
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
269
570
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
270
571
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
271
572
|
},
|
|
@@ -280,6 +581,10 @@ class ModelSync {
|
|
|
280
581
|
switch (_response.error.statusCode) {
|
|
281
582
|
case 401:
|
|
282
583
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
584
|
+
case 404:
|
|
585
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
586
|
+
case 500:
|
|
587
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
283
588
|
default:
|
|
284
589
|
throw new errors.PolytomicError({
|
|
285
590
|
statusCode: _response.error.statusCode,
|
|
@@ -303,39 +608,81 @@ class ModelSync {
|
|
|
303
608
|
});
|
|
304
609
|
}
|
|
305
610
|
/**
|
|
611
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
306
612
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
613
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
614
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
615
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
616
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
307
617
|
*
|
|
308
618
|
* @example
|
|
309
|
-
* await polytomic.modelSync.
|
|
619
|
+
* await polytomic.modelSync.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
620
|
+
* fields: [{
|
|
621
|
+
* source: {
|
|
622
|
+
* field: "id",
|
|
623
|
+
* model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
624
|
+
* },
|
|
625
|
+
* target: "name"
|
|
626
|
+
* }],
|
|
627
|
+
* filter_logic: "A and B or C",
|
|
628
|
+
* identity: {
|
|
629
|
+
* function: "Equality",
|
|
630
|
+
* source: {
|
|
631
|
+
* field: "id",
|
|
632
|
+
* model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
633
|
+
* },
|
|
634
|
+
* target: "name"
|
|
635
|
+
* },
|
|
636
|
+
* mode: "create",
|
|
637
|
+
* name: "Users Sync",
|
|
638
|
+
* schedule: {
|
|
639
|
+
* connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
640
|
+
* frequency: "daily"
|
|
641
|
+
* },
|
|
642
|
+
* sync_all_records: false,
|
|
643
|
+
* target: {
|
|
644
|
+
* connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
645
|
+
* object: "Users"
|
|
646
|
+
* }
|
|
647
|
+
* })
|
|
310
648
|
*/
|
|
311
|
-
|
|
649
|
+
update(id, request, requestOptions) {
|
|
312
650
|
var _a;
|
|
313
651
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
652
|
const _response = yield core.fetcher({
|
|
315
653
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${id}`),
|
|
316
|
-
method: "
|
|
654
|
+
method: "PUT",
|
|
317
655
|
headers: {
|
|
318
656
|
Authorization: yield this._getAuthorizationHeader(),
|
|
319
|
-
"X-Polytomic-Version":
|
|
320
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
321
|
-
: undefined,
|
|
657
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
322
658
|
"X-Fern-Language": "JavaScript",
|
|
323
659
|
"X-Fern-SDK-Name": "polytomic",
|
|
324
|
-
"X-Fern-SDK-Version": "0.
|
|
660
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
325
661
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
326
662
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
327
663
|
},
|
|
328
664
|
contentType: "application/json",
|
|
665
|
+
body: request,
|
|
329
666
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
330
667
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
331
668
|
});
|
|
332
669
|
if (_response.ok) {
|
|
333
|
-
return;
|
|
670
|
+
return _response.body;
|
|
334
671
|
}
|
|
335
672
|
if (_response.error.reason === "status-code") {
|
|
336
673
|
switch (_response.error.statusCode) {
|
|
674
|
+
case 400:
|
|
675
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
337
676
|
case 401:
|
|
338
677
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
678
|
+
case 403:
|
|
679
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
680
|
+
case 404:
|
|
681
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
682
|
+
case 422:
|
|
683
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
684
|
+
case 500:
|
|
685
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
339
686
|
default:
|
|
340
687
|
throw new errors.PolytomicError({
|
|
341
688
|
statusCode: _response.error.statusCode,
|
|
@@ -360,67 +707,45 @@ class ModelSync {
|
|
|
360
707
|
}
|
|
361
708
|
/**
|
|
362
709
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
710
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
711
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
712
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
363
713
|
*
|
|
364
714
|
* @example
|
|
365
|
-
* await polytomic.modelSync.
|
|
366
|
-
* fields: [{
|
|
367
|
-
* source: {
|
|
368
|
-
* field: "id",
|
|
369
|
-
* model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
370
|
-
* },
|
|
371
|
-
* target: "name"
|
|
372
|
-
* }],
|
|
373
|
-
* filter_logic: "A and B or C",
|
|
374
|
-
* identity: {
|
|
375
|
-
* function: "Equality",
|
|
376
|
-
* source: {
|
|
377
|
-
* field: "id",
|
|
378
|
-
* model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
379
|
-
* },
|
|
380
|
-
* target: "name"
|
|
381
|
-
* },
|
|
382
|
-
* mode: "create",
|
|
383
|
-
* name: "Users Sync",
|
|
384
|
-
* schedule: {
|
|
385
|
-
* connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
386
|
-
* frequency: "daily"
|
|
387
|
-
* },
|
|
388
|
-
* sync_all_records: false,
|
|
389
|
-
* target: {
|
|
390
|
-
* connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
391
|
-
* object: "Users"
|
|
392
|
-
* }
|
|
393
|
-
* })
|
|
715
|
+
* await polytomic.modelSync.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
394
716
|
*/
|
|
395
|
-
|
|
717
|
+
remove(id, requestOptions) {
|
|
396
718
|
var _a;
|
|
397
719
|
return __awaiter(this, void 0, void 0, function* () {
|
|
398
720
|
const _response = yield core.fetcher({
|
|
399
721
|
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${id}`),
|
|
400
|
-
method: "
|
|
722
|
+
method: "DELETE",
|
|
401
723
|
headers: {
|
|
402
724
|
Authorization: yield this._getAuthorizationHeader(),
|
|
403
|
-
"X-Polytomic-Version":
|
|
404
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
405
|
-
: undefined,
|
|
725
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
406
726
|
"X-Fern-Language": "JavaScript",
|
|
407
727
|
"X-Fern-SDK-Name": "polytomic",
|
|
408
|
-
"X-Fern-SDK-Version": "0.
|
|
728
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
409
729
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
410
730
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
411
731
|
},
|
|
412
732
|
contentType: "application/json",
|
|
413
|
-
body: request,
|
|
414
733
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
415
734
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
416
735
|
});
|
|
417
736
|
if (_response.ok) {
|
|
418
|
-
return
|
|
737
|
+
return;
|
|
419
738
|
}
|
|
420
739
|
if (_response.error.reason === "status-code") {
|
|
421
740
|
switch (_response.error.statusCode) {
|
|
422
741
|
case 401:
|
|
423
742
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
743
|
+
case 403:
|
|
744
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
745
|
+
case 404:
|
|
746
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
747
|
+
case 500:
|
|
748
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
424
749
|
default:
|
|
425
750
|
throw new errors.PolytomicError({
|
|
426
751
|
statusCode: _response.error.statusCode,
|
|
@@ -445,6 +770,9 @@ class ModelSync {
|
|
|
445
770
|
}
|
|
446
771
|
/**
|
|
447
772
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
773
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
774
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
775
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
448
776
|
*
|
|
449
777
|
* @example
|
|
450
778
|
* await polytomic.modelSync.activate("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
@@ -459,12 +787,10 @@ class ModelSync {
|
|
|
459
787
|
method: "POST",
|
|
460
788
|
headers: {
|
|
461
789
|
Authorization: yield this._getAuthorizationHeader(),
|
|
462
|
-
"X-Polytomic-Version":
|
|
463
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
464
|
-
: undefined,
|
|
790
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
465
791
|
"X-Fern-Language": "JavaScript",
|
|
466
792
|
"X-Fern-SDK-Name": "polytomic",
|
|
467
|
-
"X-Fern-SDK-Version": "0.
|
|
793
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
468
794
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
469
795
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
470
796
|
},
|
|
@@ -480,6 +806,12 @@ class ModelSync {
|
|
|
480
806
|
switch (_response.error.statusCode) {
|
|
481
807
|
case 401:
|
|
482
808
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
809
|
+
case 403:
|
|
810
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
811
|
+
case 404:
|
|
812
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
813
|
+
case 500:
|
|
814
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
483
815
|
default:
|
|
484
816
|
throw new errors.PolytomicError({
|
|
485
817
|
statusCode: _response.error.statusCode,
|
|
@@ -503,7 +835,11 @@ class ModelSync {
|
|
|
503
835
|
});
|
|
504
836
|
}
|
|
505
837
|
/**
|
|
838
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
506
839
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
840
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
841
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
842
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
507
843
|
*
|
|
508
844
|
* @example
|
|
509
845
|
* await polytomic.modelSync.start("248df4b7-aa70-47b8-a036-33ac447e668d", {})
|
|
@@ -516,12 +852,10 @@ class ModelSync {
|
|
|
516
852
|
method: "POST",
|
|
517
853
|
headers: {
|
|
518
854
|
Authorization: yield this._getAuthorizationHeader(),
|
|
519
|
-
"X-Polytomic-Version":
|
|
520
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
521
|
-
: undefined,
|
|
855
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
522
856
|
"X-Fern-Language": "JavaScript",
|
|
523
857
|
"X-Fern-SDK-Name": "polytomic",
|
|
524
|
-
"X-Fern-SDK-Version": "0.
|
|
858
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
525
859
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
526
860
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
527
861
|
},
|
|
@@ -535,8 +869,16 @@ class ModelSync {
|
|
|
535
869
|
}
|
|
536
870
|
if (_response.error.reason === "status-code") {
|
|
537
871
|
switch (_response.error.statusCode) {
|
|
872
|
+
case 400:
|
|
873
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
538
874
|
case 401:
|
|
539
875
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
876
|
+
case 403:
|
|
877
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
878
|
+
case 404:
|
|
879
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
880
|
+
case 500:
|
|
881
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
540
882
|
default:
|
|
541
883
|
throw new errors.PolytomicError({
|
|
542
884
|
statusCode: _response.error.statusCode,
|
|
@@ -561,6 +903,8 @@ class ModelSync {
|
|
|
561
903
|
}
|
|
562
904
|
/**
|
|
563
905
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
906
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
907
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
564
908
|
*
|
|
565
909
|
* @example
|
|
566
910
|
* await polytomic.modelSync.getStatus("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -573,12 +917,10 @@ class ModelSync {
|
|
|
573
917
|
method: "GET",
|
|
574
918
|
headers: {
|
|
575
919
|
Authorization: yield this._getAuthorizationHeader(),
|
|
576
|
-
"X-Polytomic-Version":
|
|
577
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
578
|
-
: undefined,
|
|
920
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
579
921
|
"X-Fern-Language": "JavaScript",
|
|
580
922
|
"X-Fern-SDK-Name": "polytomic",
|
|
581
|
-
"X-Fern-SDK-Version": "0.
|
|
923
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
582
924
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
583
925
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
584
926
|
},
|
|
@@ -593,6 +935,10 @@ class ModelSync {
|
|
|
593
935
|
switch (_response.error.statusCode) {
|
|
594
936
|
case 401:
|
|
595
937
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
938
|
+
case 404:
|
|
939
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
940
|
+
case 500:
|
|
941
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
596
942
|
default:
|
|
597
943
|
throw new errors.PolytomicError({
|
|
598
944
|
statusCode: _response.error.statusCode,
|
|
@@ -621,11 +967,7 @@ class ModelSync {
|
|
|
621
967
|
}
|
|
622
968
|
_getAuthorizationHeader() {
|
|
623
969
|
return __awaiter(this, void 0, void 0, function* () {
|
|
624
|
-
|
|
625
|
-
if (bearer != null) {
|
|
626
|
-
return `Bearer ${bearer}`;
|
|
627
|
-
}
|
|
628
|
-
return undefined;
|
|
970
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
629
971
|
});
|
|
630
972
|
}
|
|
631
973
|
}
|