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
|
@@ -47,29 +47,28 @@ const errors = __importStar(require("../../../../errors"));
|
|
|
47
47
|
const Client_1 = require("../resources/executions/client/Client");
|
|
48
48
|
const Client_2 = require("../resources/schemas/client/Client");
|
|
49
49
|
class BulkSync {
|
|
50
|
-
constructor(_options
|
|
50
|
+
constructor(_options) {
|
|
51
51
|
this._options = _options;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
55
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
57
|
-
* await polytomic.bulkSync.
|
|
58
|
+
* await polytomic.bulkSync.list()
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
|
+
list(requestOptions) {
|
|
60
61
|
var _a;
|
|
61
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
63
|
const _response = yield core.fetcher({
|
|
63
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default,
|
|
64
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, "api/bulk/syncs"),
|
|
64
65
|
method: "GET",
|
|
65
66
|
headers: {
|
|
66
67
|
Authorization: yield this._getAuthorizationHeader(),
|
|
67
|
-
"X-Polytomic-Version":
|
|
68
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
69
|
-
: undefined,
|
|
68
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
70
69
|
"X-Fern-Language": "JavaScript",
|
|
71
70
|
"X-Fern-SDK-Name": "polytomic",
|
|
72
|
-
"X-Fern-SDK-Version": "0.
|
|
71
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
73
72
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
74
73
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
75
74
|
},
|
|
@@ -84,6 +83,8 @@ class BulkSync {
|
|
|
84
83
|
switch (_response.error.statusCode) {
|
|
85
84
|
case 401:
|
|
86
85
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
86
|
+
case 500:
|
|
87
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
87
88
|
default:
|
|
88
89
|
throw new errors.PolytomicError({
|
|
89
90
|
statusCode: _response.error.statusCode,
|
|
@@ -107,40 +108,44 @@ class BulkSync {
|
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
110
|
/**
|
|
111
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
110
112
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
113
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
114
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
111
115
|
*
|
|
112
116
|
* @example
|
|
113
|
-
* await polytomic.bulkSync.
|
|
114
|
-
*
|
|
117
|
+
* await polytomic.bulkSync.create({
|
|
118
|
+
* destination_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
119
|
+
* mode: "replicate",
|
|
120
|
+
* name: "My Bulk Sync",
|
|
121
|
+
* schedule: {
|
|
122
|
+
* day_of_month: "1",
|
|
123
|
+
* day_of_week: "monday",
|
|
124
|
+
* frequency: Polytomic.ScheduleFrequency.Manual,
|
|
125
|
+
* hour: "0",
|
|
126
|
+
* minute: "0",
|
|
127
|
+
* month: "1"
|
|
128
|
+
* },
|
|
129
|
+
* source_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
115
130
|
* })
|
|
116
131
|
*/
|
|
117
|
-
|
|
132
|
+
create(request, requestOptions) {
|
|
118
133
|
var _a;
|
|
119
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
-
const { refresh_schemas: refreshSchemas, include_fields: includeFields } = request;
|
|
121
|
-
const _queryParams = {};
|
|
122
|
-
if (refreshSchemas != null) {
|
|
123
|
-
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
124
|
-
}
|
|
125
|
-
if (includeFields != null) {
|
|
126
|
-
_queryParams["include_fields"] = includeFields.toString();
|
|
127
|
-
}
|
|
128
135
|
const _response = yield core.fetcher({
|
|
129
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default,
|
|
130
|
-
method: "
|
|
136
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, "api/bulk/syncs"),
|
|
137
|
+
method: "POST",
|
|
131
138
|
headers: {
|
|
132
139
|
Authorization: yield this._getAuthorizationHeader(),
|
|
133
|
-
"X-Polytomic-Version":
|
|
134
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
135
|
-
: undefined,
|
|
140
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
136
141
|
"X-Fern-Language": "JavaScript",
|
|
137
142
|
"X-Fern-SDK-Name": "polytomic",
|
|
138
|
-
"X-Fern-SDK-Version": "0.
|
|
143
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
139
144
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
140
145
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
141
146
|
},
|
|
142
147
|
contentType: "application/json",
|
|
143
|
-
|
|
148
|
+
body: request,
|
|
144
149
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
145
150
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
146
151
|
});
|
|
@@ -149,8 +154,14 @@ class BulkSync {
|
|
|
149
154
|
}
|
|
150
155
|
if (_response.error.reason === "status-code") {
|
|
151
156
|
switch (_response.error.statusCode) {
|
|
157
|
+
case 400:
|
|
158
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
152
159
|
case 401:
|
|
153
160
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
161
|
+
case 403:
|
|
162
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
163
|
+
case 500:
|
|
164
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
154
165
|
default:
|
|
155
166
|
throw new errors.PolytomicError({
|
|
156
167
|
statusCode: _response.error.statusCode,
|
|
@@ -175,28 +186,35 @@ class BulkSync {
|
|
|
175
186
|
}
|
|
176
187
|
/**
|
|
177
188
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
189
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
178
190
|
*
|
|
179
191
|
* @example
|
|
180
|
-
* await polytomic.bulkSync.
|
|
192
|
+
* await polytomic.bulkSync.get("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
193
|
+
* refresh_schemas: true
|
|
194
|
+
* })
|
|
181
195
|
*/
|
|
182
|
-
|
|
196
|
+
get(id, request = {}, requestOptions) {
|
|
183
197
|
var _a;
|
|
184
198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const { refresh_schemas: refreshSchemas } = request;
|
|
200
|
+
const _queryParams = {};
|
|
201
|
+
if (refreshSchemas != null) {
|
|
202
|
+
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
203
|
+
}
|
|
185
204
|
const _response = yield core.fetcher({
|
|
186
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/
|
|
205
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}`),
|
|
187
206
|
method: "GET",
|
|
188
207
|
headers: {
|
|
189
208
|
Authorization: yield this._getAuthorizationHeader(),
|
|
190
|
-
"X-Polytomic-Version":
|
|
191
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
192
|
-
: undefined,
|
|
209
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
193
210
|
"X-Fern-Language": "JavaScript",
|
|
194
211
|
"X-Fern-SDK-Name": "polytomic",
|
|
195
|
-
"X-Fern-SDK-Version": "0.
|
|
212
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
196
213
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
197
214
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
198
215
|
},
|
|
199
216
|
contentType: "application/json",
|
|
217
|
+
queryParameters: _queryParams,
|
|
200
218
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
201
219
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
202
220
|
});
|
|
@@ -207,6 +225,8 @@ class BulkSync {
|
|
|
207
225
|
switch (_response.error.statusCode) {
|
|
208
226
|
case 401:
|
|
209
227
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
228
|
+
case 404:
|
|
229
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
210
230
|
default:
|
|
211
231
|
throw new errors.PolytomicError({
|
|
212
232
|
statusCode: _response.error.statusCode,
|
|
@@ -230,29 +250,48 @@ class BulkSync {
|
|
|
230
250
|
});
|
|
231
251
|
}
|
|
232
252
|
/**
|
|
253
|
+
* > 📘 Updating schemas
|
|
254
|
+
* >
|
|
255
|
+
* > Schema updates can be performed using the [Update Bulk Sync Schemas](https://docs.polytomic.com/reference/apiv3updatebulksyncschemas) endpoint.
|
|
256
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
233
257
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
258
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
259
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
260
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
234
261
|
*
|
|
235
262
|
* @example
|
|
236
|
-
* await polytomic.bulkSync.
|
|
263
|
+
* await polytomic.bulkSync.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
264
|
+
* destination_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
265
|
+
* mode: "replicate",
|
|
266
|
+
* name: "My Bulk Sync",
|
|
267
|
+
* schedule: {
|
|
268
|
+
* day_of_month: "1",
|
|
269
|
+
* day_of_week: "monday",
|
|
270
|
+
* frequency: Polytomic.ScheduleFrequency.Manual,
|
|
271
|
+
* hour: "0",
|
|
272
|
+
* minute: "0",
|
|
273
|
+
* month: "1"
|
|
274
|
+
* },
|
|
275
|
+
* source_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
276
|
+
* })
|
|
237
277
|
*/
|
|
238
|
-
|
|
278
|
+
update(id, request, requestOptions) {
|
|
239
279
|
var _a;
|
|
240
280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
241
281
|
const _response = yield core.fetcher({
|
|
242
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/
|
|
243
|
-
method: "
|
|
282
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}`),
|
|
283
|
+
method: "PUT",
|
|
244
284
|
headers: {
|
|
245
285
|
Authorization: yield this._getAuthorizationHeader(),
|
|
246
|
-
"X-Polytomic-Version":
|
|
247
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
248
|
-
: undefined,
|
|
286
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
249
287
|
"X-Fern-Language": "JavaScript",
|
|
250
288
|
"X-Fern-SDK-Name": "polytomic",
|
|
251
|
-
"X-Fern-SDK-Version": "0.
|
|
289
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
252
290
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
253
291
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
254
292
|
},
|
|
255
293
|
contentType: "application/json",
|
|
294
|
+
body: request,
|
|
256
295
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
257
296
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
258
297
|
});
|
|
@@ -261,8 +300,16 @@ class BulkSync {
|
|
|
261
300
|
}
|
|
262
301
|
if (_response.error.reason === "status-code") {
|
|
263
302
|
switch (_response.error.statusCode) {
|
|
303
|
+
case 400:
|
|
304
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
264
305
|
case 401:
|
|
265
306
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
307
|
+
case 403:
|
|
308
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
309
|
+
case 404:
|
|
310
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
311
|
+
case 500:
|
|
312
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
266
313
|
default:
|
|
267
314
|
throw new errors.PolytomicError({
|
|
268
315
|
statusCode: _response.error.statusCode,
|
|
@@ -287,38 +334,53 @@ class BulkSync {
|
|
|
287
334
|
}
|
|
288
335
|
/**
|
|
289
336
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
337
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
338
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
339
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
290
340
|
*
|
|
291
341
|
* @example
|
|
292
|
-
* await polytomic.bulkSync.
|
|
342
|
+
* await polytomic.bulkSync.remove("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
343
|
+
* refresh_schemas: true
|
|
344
|
+
* })
|
|
293
345
|
*/
|
|
294
|
-
|
|
346
|
+
remove(id, request = {}, requestOptions) {
|
|
295
347
|
var _a;
|
|
296
348
|
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
+
const { refresh_schemas: refreshSchemas } = request;
|
|
350
|
+
const _queryParams = {};
|
|
351
|
+
if (refreshSchemas != null) {
|
|
352
|
+
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
353
|
+
}
|
|
297
354
|
const _response = yield core.fetcher({
|
|
298
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default,
|
|
299
|
-
method: "
|
|
355
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}`),
|
|
356
|
+
method: "DELETE",
|
|
300
357
|
headers: {
|
|
301
358
|
Authorization: yield this._getAuthorizationHeader(),
|
|
302
|
-
"X-Polytomic-Version":
|
|
303
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
304
|
-
: undefined,
|
|
359
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
305
360
|
"X-Fern-Language": "JavaScript",
|
|
306
361
|
"X-Fern-SDK-Name": "polytomic",
|
|
307
|
-
"X-Fern-SDK-Version": "0.
|
|
362
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
308
363
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
309
364
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
310
365
|
},
|
|
311
366
|
contentType: "application/json",
|
|
367
|
+
queryParameters: _queryParams,
|
|
312
368
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
313
369
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
314
370
|
});
|
|
315
371
|
if (_response.ok) {
|
|
316
|
-
return
|
|
372
|
+
return;
|
|
317
373
|
}
|
|
318
374
|
if (_response.error.reason === "status-code") {
|
|
319
375
|
switch (_response.error.statusCode) {
|
|
320
376
|
case 401:
|
|
321
377
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
378
|
+
case 403:
|
|
379
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
380
|
+
case 404:
|
|
381
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
382
|
+
case 500:
|
|
383
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
322
384
|
default:
|
|
323
385
|
throw new errors.PolytomicError({
|
|
324
386
|
statusCode: _response.error.statusCode,
|
|
@@ -343,31 +405,27 @@ class BulkSync {
|
|
|
343
405
|
}
|
|
344
406
|
/**
|
|
345
407
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
408
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
409
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
410
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
346
411
|
*
|
|
347
412
|
* @example
|
|
348
|
-
* await polytomic.bulkSync.
|
|
349
|
-
*
|
|
350
|
-
* name: "name",
|
|
351
|
-
* schedule: {
|
|
352
|
-
* frequency: Polytomic.ScheduleFrequency.Manual
|
|
353
|
-
* },
|
|
354
|
-
* source_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
413
|
+
* await polytomic.bulkSync.activate("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
414
|
+
* active: true
|
|
355
415
|
* })
|
|
356
416
|
*/
|
|
357
|
-
|
|
417
|
+
activate(id, request, requestOptions) {
|
|
358
418
|
var _a;
|
|
359
419
|
return __awaiter(this, void 0, void 0, function* () {
|
|
360
420
|
const _response = yield core.fetcher({
|
|
361
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default,
|
|
421
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}/activate`),
|
|
362
422
|
method: "POST",
|
|
363
423
|
headers: {
|
|
364
424
|
Authorization: yield this._getAuthorizationHeader(),
|
|
365
|
-
"X-Polytomic-Version":
|
|
366
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
367
|
-
: undefined,
|
|
425
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
368
426
|
"X-Fern-Language": "JavaScript",
|
|
369
427
|
"X-Fern-SDK-Name": "polytomic",
|
|
370
|
-
"X-Fern-SDK-Version": "0.
|
|
428
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
371
429
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
372
430
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
373
431
|
},
|
|
@@ -383,6 +441,12 @@ class BulkSync {
|
|
|
383
441
|
switch (_response.error.statusCode) {
|
|
384
442
|
case 401:
|
|
385
443
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
444
|
+
case 403:
|
|
445
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
446
|
+
case 404:
|
|
447
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
448
|
+
case 500:
|
|
449
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
386
450
|
default:
|
|
387
451
|
throw new errors.PolytomicError({
|
|
388
452
|
statusCode: _response.error.statusCode,
|
|
@@ -406,37 +470,32 @@ class BulkSync {
|
|
|
406
470
|
});
|
|
407
471
|
}
|
|
408
472
|
/**
|
|
473
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
409
474
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
410
475
|
*
|
|
411
476
|
* @example
|
|
412
|
-
* await polytomic.bulkSync.
|
|
413
|
-
*
|
|
477
|
+
* await polytomic.bulkSync.start("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
478
|
+
* resync: false,
|
|
479
|
+
* test: false
|
|
414
480
|
* })
|
|
415
481
|
*/
|
|
416
|
-
|
|
482
|
+
start(id, request = {}, requestOptions) {
|
|
417
483
|
var _a;
|
|
418
484
|
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
const { refresh_schemas: refreshSchemas } = request;
|
|
420
|
-
const _queryParams = {};
|
|
421
|
-
if (refreshSchemas != null) {
|
|
422
|
-
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
423
|
-
}
|
|
424
485
|
const _response = yield core.fetcher({
|
|
425
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}`),
|
|
426
|
-
method: "
|
|
486
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}/executions`),
|
|
487
|
+
method: "POST",
|
|
427
488
|
headers: {
|
|
428
489
|
Authorization: yield this._getAuthorizationHeader(),
|
|
429
|
-
"X-Polytomic-Version":
|
|
430
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
431
|
-
: undefined,
|
|
490
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
432
491
|
"X-Fern-Language": "JavaScript",
|
|
433
492
|
"X-Fern-SDK-Name": "polytomic",
|
|
434
|
-
"X-Fern-SDK-Version": "0.
|
|
493
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
435
494
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
436
495
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
437
496
|
},
|
|
438
497
|
contentType: "application/json",
|
|
439
|
-
|
|
498
|
+
body: request,
|
|
440
499
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
441
500
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
442
501
|
});
|
|
@@ -445,6 +504,8 @@ class BulkSync {
|
|
|
445
504
|
}
|
|
446
505
|
if (_response.error.reason === "status-code") {
|
|
447
506
|
switch (_response.error.statusCode) {
|
|
507
|
+
case 400:
|
|
508
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
448
509
|
case 401:
|
|
449
510
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
450
511
|
default:
|
|
@@ -471,103 +532,28 @@ class BulkSync {
|
|
|
471
532
|
}
|
|
472
533
|
/**
|
|
473
534
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
535
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
536
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
474
537
|
*
|
|
475
538
|
* @example
|
|
476
|
-
* await polytomic.bulkSync.
|
|
477
|
-
* refresh_schemas: true
|
|
478
|
-
* })
|
|
479
|
-
*/
|
|
480
|
-
remove(id, request = {}, requestOptions) {
|
|
481
|
-
var _a;
|
|
482
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
483
|
-
const { refresh_schemas: refreshSchemas } = request;
|
|
484
|
-
const _queryParams = {};
|
|
485
|
-
if (refreshSchemas != null) {
|
|
486
|
-
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
487
|
-
}
|
|
488
|
-
const _response = yield core.fetcher({
|
|
489
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}`),
|
|
490
|
-
method: "DELETE",
|
|
491
|
-
headers: {
|
|
492
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
493
|
-
"X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
|
|
494
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
495
|
-
: undefined,
|
|
496
|
-
"X-Fern-Language": "JavaScript",
|
|
497
|
-
"X-Fern-SDK-Name": "polytomic",
|
|
498
|
-
"X-Fern-SDK-Version": "0.1.2",
|
|
499
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
500
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
501
|
-
},
|
|
502
|
-
contentType: "application/json",
|
|
503
|
-
queryParameters: _queryParams,
|
|
504
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
505
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
506
|
-
});
|
|
507
|
-
if (_response.ok) {
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
if (_response.error.reason === "status-code") {
|
|
511
|
-
switch (_response.error.statusCode) {
|
|
512
|
-
case 401:
|
|
513
|
-
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
514
|
-
default:
|
|
515
|
-
throw new errors.PolytomicError({
|
|
516
|
-
statusCode: _response.error.statusCode,
|
|
517
|
-
body: _response.error.body,
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
switch (_response.error.reason) {
|
|
522
|
-
case "non-json":
|
|
523
|
-
throw new errors.PolytomicError({
|
|
524
|
-
statusCode: _response.error.statusCode,
|
|
525
|
-
body: _response.error.rawBody,
|
|
526
|
-
});
|
|
527
|
-
case "timeout":
|
|
528
|
-
throw new errors.PolytomicTimeoutError();
|
|
529
|
-
case "unknown":
|
|
530
|
-
throw new errors.PolytomicError({
|
|
531
|
-
message: _response.error.errorMessage,
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* > 📘 Updating schemas
|
|
538
|
-
* >
|
|
539
|
-
* > Schema updates can be performed using the [Update Bulk Sync Schemas](https://docs.polytomic.com/reference/apiv3updatebulksyncschemas) endpoint.
|
|
540
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
541
|
-
*
|
|
542
|
-
* @example
|
|
543
|
-
* await polytomic.bulkSync.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
544
|
-
* destination_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
545
|
-
* name: "name",
|
|
546
|
-
* schedule: {
|
|
547
|
-
* frequency: Polytomic.ScheduleFrequency.Manual
|
|
548
|
-
* },
|
|
549
|
-
* source_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
550
|
-
* })
|
|
539
|
+
* await polytomic.bulkSync.getStatus("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
551
540
|
*/
|
|
552
|
-
|
|
541
|
+
getStatus(id, requestOptions) {
|
|
553
542
|
var _a;
|
|
554
543
|
return __awaiter(this, void 0, void 0, function* () {
|
|
555
544
|
const _response = yield core.fetcher({
|
|
556
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}`),
|
|
557
|
-
method: "
|
|
545
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/bulk/syncs/${id}/status`),
|
|
546
|
+
method: "GET",
|
|
558
547
|
headers: {
|
|
559
548
|
Authorization: yield this._getAuthorizationHeader(),
|
|
560
|
-
"X-Polytomic-Version":
|
|
561
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
562
|
-
: undefined,
|
|
549
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
563
550
|
"X-Fern-Language": "JavaScript",
|
|
564
551
|
"X-Fern-SDK-Name": "polytomic",
|
|
565
|
-
"X-Fern-SDK-Version": "0.
|
|
552
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
566
553
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
567
554
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
568
555
|
},
|
|
569
556
|
contentType: "application/json",
|
|
570
|
-
body: request,
|
|
571
557
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
572
558
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
573
559
|
});
|
|
@@ -578,6 +564,10 @@ class BulkSync {
|
|
|
578
564
|
switch (_response.error.statusCode) {
|
|
579
565
|
case 401:
|
|
580
566
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
567
|
+
case 404:
|
|
568
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
569
|
+
case 500:
|
|
570
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
581
571
|
default:
|
|
582
572
|
throw new errors.PolytomicError({
|
|
583
573
|
statusCode: _response.error.statusCode,
|
|
@@ -601,32 +591,38 @@ class BulkSync {
|
|
|
601
591
|
});
|
|
602
592
|
}
|
|
603
593
|
/**
|
|
594
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
604
595
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
596
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
597
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
605
598
|
*
|
|
606
599
|
* @example
|
|
607
|
-
* await polytomic.bulkSync.
|
|
608
|
-
*
|
|
600
|
+
* await polytomic.bulkSync.getSource("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
601
|
+
* include_fields: true
|
|
609
602
|
* })
|
|
610
603
|
*/
|
|
611
|
-
|
|
604
|
+
getSource(id, request = {}, requestOptions) {
|
|
612
605
|
var _a;
|
|
613
606
|
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
+
const { include_fields: includeFields } = request;
|
|
608
|
+
const _queryParams = {};
|
|
609
|
+
if (includeFields != null) {
|
|
610
|
+
_queryParams["include_fields"] = includeFields.toString();
|
|
611
|
+
}
|
|
614
612
|
const _response = yield core.fetcher({
|
|
615
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/
|
|
616
|
-
method: "
|
|
613
|
+
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}/bulksync/source`),
|
|
614
|
+
method: "GET",
|
|
617
615
|
headers: {
|
|
618
616
|
Authorization: yield this._getAuthorizationHeader(),
|
|
619
|
-
"X-Polytomic-Version":
|
|
620
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
621
|
-
: undefined,
|
|
617
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
622
618
|
"X-Fern-Language": "JavaScript",
|
|
623
619
|
"X-Fern-SDK-Name": "polytomic",
|
|
624
|
-
"X-Fern-SDK-Version": "0.
|
|
620
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
625
621
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
626
622
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
627
623
|
},
|
|
628
624
|
contentType: "application/json",
|
|
629
|
-
|
|
625
|
+
queryParameters: _queryParams,
|
|
630
626
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
631
627
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
632
628
|
});
|
|
@@ -635,8 +631,14 @@ class BulkSync {
|
|
|
635
631
|
}
|
|
636
632
|
if (_response.error.reason === "status-code") {
|
|
637
633
|
switch (_response.error.statusCode) {
|
|
634
|
+
case 400:
|
|
635
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
638
636
|
case 401:
|
|
639
637
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
638
|
+
case 404:
|
|
639
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
640
|
+
case 500:
|
|
641
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
640
642
|
default:
|
|
641
643
|
throw new errors.PolytomicError({
|
|
642
644
|
statusCode: _response.error.statusCode,
|
|
@@ -660,25 +662,26 @@ class BulkSync {
|
|
|
660
662
|
});
|
|
661
663
|
}
|
|
662
664
|
/**
|
|
665
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
663
666
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
667
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
668
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
664
669
|
*
|
|
665
670
|
* @example
|
|
666
|
-
* await polytomic.bulkSync.
|
|
671
|
+
* await polytomic.bulkSync.getDestination("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
667
672
|
*/
|
|
668
|
-
|
|
673
|
+
getDestination(id, requestOptions) {
|
|
669
674
|
var _a;
|
|
670
675
|
return __awaiter(this, void 0, void 0, function* () {
|
|
671
676
|
const _response = yield core.fetcher({
|
|
672
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/
|
|
677
|
+
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}/bulksync/target`),
|
|
673
678
|
method: "GET",
|
|
674
679
|
headers: {
|
|
675
680
|
Authorization: yield this._getAuthorizationHeader(),
|
|
676
|
-
"X-Polytomic-Version":
|
|
677
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
678
|
-
: undefined,
|
|
681
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
679
682
|
"X-Fern-Language": "JavaScript",
|
|
680
683
|
"X-Fern-SDK-Name": "polytomic",
|
|
681
|
-
"X-Fern-SDK-Version": "0.
|
|
684
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
682
685
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
683
686
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
684
687
|
},
|
|
@@ -691,8 +694,14 @@ class BulkSync {
|
|
|
691
694
|
}
|
|
692
695
|
if (_response.error.reason === "status-code") {
|
|
693
696
|
switch (_response.error.statusCode) {
|
|
697
|
+
case 400:
|
|
698
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
694
699
|
case 401:
|
|
695
700
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
701
|
+
case 403:
|
|
702
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
703
|
+
case 500:
|
|
704
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
696
705
|
default:
|
|
697
706
|
throw new errors.PolytomicError({
|
|
698
707
|
statusCode: _response.error.statusCode,
|
|
@@ -725,11 +734,7 @@ class BulkSync {
|
|
|
725
734
|
}
|
|
726
735
|
_getAuthorizationHeader() {
|
|
727
736
|
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
-
|
|
729
|
-
if (bearer != null) {
|
|
730
|
-
return `Bearer ${bearer}`;
|
|
731
|
-
}
|
|
732
|
-
return undefined;
|
|
737
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
733
738
|
});
|
|
734
739
|
}
|
|
735
740
|
}
|