polytomic 0.1.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +8 -6
- package/Client.js +27 -22
- package/api/errors/BadRequestError.d.ts +8 -0
- package/api/errors/BadRequestError.js +41 -0
- package/api/errors/ForbiddenError.d.ts +8 -0
- package/api/errors/ForbiddenError.js +41 -0
- package/api/errors/InternalServerError.d.ts +8 -0
- package/api/errors/InternalServerError.js +41 -0
- package/api/errors/NotFoundError.d.ts +8 -0
- package/api/errors/NotFoundError.js +41 -0
- package/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/api/errors/UnprocessableEntityError.js +41 -0
- package/api/errors/index.d.ts +5 -0
- package/api/errors/index.js +5 -0
- package/api/resources/bulkSync/client/Client.d.ts +62 -46
- package/api/resources/bulkSync/client/Client.js +174 -184
- package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +1 -1
- package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +1 -4
- package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
- package/api/resources/bulkSync/client/requests/index.d.ts +3 -2
- package/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
- package/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
- package/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
- package/api/resources/bulkSync/resources/executions/client/index.js +0 -15
- package/api/resources/bulkSync/resources/index.d.ts +0 -1
- package/api/resources/bulkSync/resources/index.js +0 -1
- package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +20 -9
- package/api/resources/bulkSync/resources/schemas/client/Client.js +90 -24
- package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +1 -4
- package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/api/resources/connections/client/Client.d.ts +40 -49
- package/api/resources/connections/client/Client.js +113 -298
- package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +18 -0
- package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -4
- package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +1 -4
- package/api/resources/connections/client/requests/index.d.ts +2 -4
- package/api/resources/events/client/Client.d.ts +9 -8
- package/api/resources/events/client/Client.js +16 -18
- package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
- package/api/resources/events/client/requests/index.d.ts +1 -1
- package/api/resources/identity/client/Client.d.ts +29 -0
- package/api/resources/identity/client/Client.js +114 -0
- package/api/resources/identity/client/index.d.ts +1 -0
- package/api/resources/identity/index.d.ts +1 -0
- package/api/resources/identity/index.js +17 -0
- package/api/resources/index.d.ts +3 -2
- package/api/resources/index.js +4 -3
- package/api/resources/jobs/client/Client.d.ts +6 -4
- package/api/resources/jobs/client/Client.js +13 -10
- package/api/resources/modelSync/client/Client.d.ts +87 -53
- package/api/resources/modelSync/client/Client.js +405 -100
- package/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +1 -21
- package/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
- package/{dist/api/resources/connections/client/requests/TargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
- package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
- package/api/resources/modelSync/client/requests/StartModelSyncRequest.d.ts +1 -0
- package/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +1 -21
- package/api/resources/modelSync/client/requests/index.d.ts +3 -0
- package/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
- package/api/resources/modelSync/resources/executions/client/Client.js +43 -476
- package/api/resources/models/client/Client.d.ts +22 -13
- package/api/resources/models/client/Client.js +67 -47
- package/api/resources/models/client/requests/CreateModelRequest.d.ts +0 -1
- package/api/resources/models/client/requests/UpdateModelRequest.d.ts +0 -1
- package/api/resources/organization/client/Client.d.ts +23 -26
- package/api/resources/organization/client/Client.js +53 -53
- package/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts +1 -6
- package/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts +1 -6
- package/api/resources/permissions/client/Client.d.ts +2 -3
- package/api/resources/permissions/client/Client.js +1 -1
- package/api/resources/permissions/resources/policies/client/Client.d.ts +24 -19
- package/api/resources/permissions/resources/policies/client/Client.js +66 -46
- package/api/resources/permissions/resources/policies/client/requests/CreatePolicyRequest.d.ts +1 -5
- package/api/resources/permissions/resources/policies/client/requests/UpdatePolicyRequest.d.ts +1 -5
- package/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
- package/api/resources/permissions/resources/roles/client/Client.js +62 -37
- package/api/resources/schemas/client/Client.d.ts +39 -6
- package/api/resources/schemas/client/Client.js +208 -13
- package/api/resources/users/client/Client.d.ts +27 -19
- package/api/resources/users/client/Client.js +63 -48
- package/api/resources/users/client/requests/CreateUserRequestSchema.d.ts +1 -2
- package/api/resources/users/client/requests/UpdateUserRequestSchema.d.ts +1 -2
- package/api/resources/webhooks/client/Client.d.ts +22 -15
- package/api/resources/webhooks/client/Client.js +56 -46
- package/api/types/ApiError.d.ts +8 -0
- package/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
- package/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
- package/api/types/SourceMeta.d.ts +8 -0
- package/api/types/SourceMeta.js +5 -0
- package/api/types/index.d.ts +4 -0
- package/api/types/index.js +4 -0
- package/dist/Client.d.ts +8 -6
- package/dist/Client.js +27 -22
- package/dist/api/errors/BadRequestError.d.ts +8 -0
- package/dist/api/errors/BadRequestError.js +41 -0
- package/dist/api/errors/ForbiddenError.d.ts +8 -0
- package/dist/api/errors/ForbiddenError.js +41 -0
- package/dist/api/errors/InternalServerError.d.ts +8 -0
- package/dist/api/errors/InternalServerError.js +41 -0
- package/dist/api/errors/NotFoundError.d.ts +8 -0
- package/dist/api/errors/NotFoundError.js +41 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/dist/api/errors/UnprocessableEntityError.js +41 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +5 -0
- package/dist/api/resources/bulkSync/client/Client.d.ts +62 -46
- package/dist/api/resources/bulkSync/client/Client.js +174 -184
- package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +1 -1
- package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +1 -4
- package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
- package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
- package/dist/api/resources/bulkSync/client/requests/index.d.ts +3 -2
- package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
- package/dist/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
- package/dist/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
- package/dist/api/resources/bulkSync/resources/executions/client/index.js +0 -15
- package/dist/api/resources/bulkSync/resources/index.d.ts +0 -1
- package/dist/api/resources/bulkSync/resources/index.js +0 -1
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +20 -9
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +90 -24
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js +5 -0
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +1 -4
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/dist/api/resources/connections/client/Client.d.ts +40 -49
- package/dist/api/resources/connections/client/Client.js +113 -298
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +18 -0
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
- package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -4
- package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +1 -4
- package/dist/api/resources/connections/client/requests/index.d.ts +2 -4
- package/dist/api/resources/events/client/Client.d.ts +9 -8
- package/dist/api/resources/events/client/Client.js +16 -18
- package/{api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → dist/api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
- package/dist/api/resources/events/client/requests/EventsListRequest.js +5 -0
- package/dist/api/resources/events/client/requests/index.d.ts +1 -1
- package/dist/api/resources/identity/client/Client.d.ts +29 -0
- package/dist/api/resources/identity/client/Client.js +114 -0
- package/dist/api/resources/identity/client/index.d.ts +1 -0
- package/dist/api/resources/identity/index.d.ts +1 -0
- package/dist/api/resources/identity/index.js +17 -0
- package/dist/api/resources/index.d.ts +3 -2
- package/dist/api/resources/index.js +4 -3
- package/dist/api/resources/jobs/client/Client.d.ts +6 -4
- package/dist/api/resources/jobs/client/Client.js +13 -10
- package/dist/api/resources/modelSync/client/Client.d.ts +87 -53
- package/dist/api/resources/modelSync/client/Client.js +405 -100
- package/dist/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +1 -21
- package/dist/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetSourceRequest.js +5 -0
- package/{api/resources/connections/client/requests/TargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js +5 -0
- package/{api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js +5 -0
- package/dist/api/resources/modelSync/client/requests/StartModelSyncRequest.d.ts +1 -0
- package/dist/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +1 -21
- package/dist/api/resources/modelSync/client/requests/index.d.ts +3 -0
- package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
- package/dist/api/resources/modelSync/resources/executions/client/Client.js +43 -476
- package/dist/api/resources/models/client/Client.d.ts +22 -13
- package/dist/api/resources/models/client/Client.js +67 -47
- package/dist/api/resources/models/client/requests/CreateModelRequest.d.ts +0 -1
- package/dist/api/resources/models/client/requests/UpdateModelRequest.d.ts +0 -1
- package/dist/api/resources/organization/client/Client.d.ts +23 -26
- package/dist/api/resources/organization/client/Client.js +53 -53
- package/dist/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts +1 -6
- package/dist/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts +1 -6
- package/dist/api/resources/permissions/client/Client.d.ts +2 -3
- package/dist/api/resources/permissions/client/Client.js +1 -1
- package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +24 -19
- package/dist/api/resources/permissions/resources/policies/client/Client.js +66 -46
- package/dist/api/resources/permissions/resources/policies/client/requests/CreatePolicyRequest.d.ts +1 -5
- package/dist/api/resources/permissions/resources/policies/client/requests/UpdatePolicyRequest.d.ts +1 -5
- package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
- package/dist/api/resources/permissions/resources/roles/client/Client.js +62 -37
- package/dist/api/resources/schemas/client/Client.d.ts +39 -6
- package/dist/api/resources/schemas/client/Client.js +208 -13
- package/dist/api/resources/users/client/Client.d.ts +27 -19
- package/dist/api/resources/users/client/Client.js +63 -48
- package/dist/api/resources/users/client/requests/CreateUserRequestSchema.d.ts +1 -2
- package/dist/api/resources/users/client/requests/UpdateUserRequestSchema.d.ts +1 -2
- package/dist/api/resources/webhooks/client/Client.d.ts +22 -15
- package/dist/api/resources/webhooks/client/Client.js +56 -46
- package/dist/api/types/ApiError.d.ts +8 -0
- package/dist/api/types/ApiError.js +5 -0
- package/dist/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
- package/dist/api/types/GetModelSyncSourceMetaEnvelope.js +5 -0
- package/dist/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
- package/dist/api/types/ModelSyncSourceMetaResponse.js +5 -0
- package/dist/api/types/SourceMeta.d.ts +8 -0
- package/dist/api/types/SourceMeta.js +5 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/package.json +2 -2
- package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
- package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
- /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.js +0 -0
- /package/api/resources/{connections/client/requests/ConnectionsGetTargetRequest.js → bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js} +0 -0
- /package/api/resources/connections/client/requests/{ModelFieldsRequest.js → ConnectCardRequest.js} +0 -0
- /package/api/resources/{connections/client/requests/TargetRequest.js → events/client/requests/EventsListRequest.js} +0 -0
- /package/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
- /package/api/resources/{events/client/requests/EventsApiV2GetEventsRequest.js → modelSync/client/requests/ModelSyncGetSourceRequest.js} +0 -0
- /package/{dist/api/resources/bulkSync/resources/executions/client/requests/StartBulkSyncRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/ModelFieldsRequest.js → api/types/ApiError.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/TargetRequest.js → api/types/GetModelSyncSourceMetaEnvelope.js} +0 -0
- /package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.js → api/types/ModelSyncSourceMetaResponse.js} +0 -0
- /package/dist/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
|
@@ -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": "1.0.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,38 @@ 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
|
+
* name: "My Bulk Sync",
|
|
120
|
+
* schedule: {
|
|
121
|
+
* frequency: Polytomic.ScheduleFrequency.Manual
|
|
122
|
+
* },
|
|
123
|
+
* source_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
115
124
|
* })
|
|
116
125
|
*/
|
|
117
|
-
|
|
126
|
+
create(request, requestOptions) {
|
|
118
127
|
var _a;
|
|
119
128
|
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
129
|
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: "
|
|
130
|
+
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"),
|
|
131
|
+
method: "POST",
|
|
131
132
|
headers: {
|
|
132
133
|
Authorization: yield this._getAuthorizationHeader(),
|
|
133
|
-
"X-Polytomic-Version":
|
|
134
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
135
|
-
: undefined,
|
|
134
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
136
135
|
"X-Fern-Language": "JavaScript",
|
|
137
136
|
"X-Fern-SDK-Name": "polytomic",
|
|
138
|
-
"X-Fern-SDK-Version": "0.
|
|
137
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
139
138
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
140
139
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
141
140
|
},
|
|
142
141
|
contentType: "application/json",
|
|
143
|
-
|
|
142
|
+
body: request,
|
|
144
143
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
145
144
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
146
145
|
});
|
|
@@ -149,8 +148,14 @@ class BulkSync {
|
|
|
149
148
|
}
|
|
150
149
|
if (_response.error.reason === "status-code") {
|
|
151
150
|
switch (_response.error.statusCode) {
|
|
151
|
+
case 400:
|
|
152
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
152
153
|
case 401:
|
|
153
154
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
155
|
+
case 403:
|
|
156
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
157
|
+
case 500:
|
|
158
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
154
159
|
default:
|
|
155
160
|
throw new errors.PolytomicError({
|
|
156
161
|
statusCode: _response.error.statusCode,
|
|
@@ -175,28 +180,35 @@ class BulkSync {
|
|
|
175
180
|
}
|
|
176
181
|
/**
|
|
177
182
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
183
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
178
184
|
*
|
|
179
185
|
* @example
|
|
180
|
-
* await polytomic.bulkSync.
|
|
186
|
+
* await polytomic.bulkSync.get("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
187
|
+
* refresh_schemas: true
|
|
188
|
+
* })
|
|
181
189
|
*/
|
|
182
|
-
|
|
190
|
+
get(id, request = {}, requestOptions) {
|
|
183
191
|
var _a;
|
|
184
192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const { refresh_schemas: refreshSchemas } = request;
|
|
194
|
+
const _queryParams = {};
|
|
195
|
+
if (refreshSchemas != null) {
|
|
196
|
+
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
197
|
+
}
|
|
185
198
|
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/
|
|
199
|
+
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
200
|
method: "GET",
|
|
188
201
|
headers: {
|
|
189
202
|
Authorization: yield this._getAuthorizationHeader(),
|
|
190
|
-
"X-Polytomic-Version":
|
|
191
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
192
|
-
: undefined,
|
|
203
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
193
204
|
"X-Fern-Language": "JavaScript",
|
|
194
205
|
"X-Fern-SDK-Name": "polytomic",
|
|
195
|
-
"X-Fern-SDK-Version": "0.
|
|
206
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
196
207
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
197
208
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
198
209
|
},
|
|
199
210
|
contentType: "application/json",
|
|
211
|
+
queryParameters: _queryParams,
|
|
200
212
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
201
213
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
202
214
|
});
|
|
@@ -207,6 +219,8 @@ class BulkSync {
|
|
|
207
219
|
switch (_response.error.statusCode) {
|
|
208
220
|
case 401:
|
|
209
221
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
222
|
+
case 404:
|
|
223
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
210
224
|
default:
|
|
211
225
|
throw new errors.PolytomicError({
|
|
212
226
|
statusCode: _response.error.statusCode,
|
|
@@ -230,29 +244,42 @@ class BulkSync {
|
|
|
230
244
|
});
|
|
231
245
|
}
|
|
232
246
|
/**
|
|
247
|
+
* > 📘 Updating schemas
|
|
248
|
+
* >
|
|
249
|
+
* > Schema updates can be performed using the [Update Bulk Sync Schemas](https://apidocs.polytomic.com/api-reference/bulk-sync/schemas/patch) endpoint.
|
|
250
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
233
251
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
252
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
253
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
254
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
234
255
|
*
|
|
235
256
|
* @example
|
|
236
|
-
* await polytomic.bulkSync.
|
|
257
|
+
* await polytomic.bulkSync.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
258
|
+
* destination_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
259
|
+
* name: "My Bulk Sync",
|
|
260
|
+
* schedule: {
|
|
261
|
+
* frequency: Polytomic.ScheduleFrequency.Manual
|
|
262
|
+
* },
|
|
263
|
+
* source_connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
|
|
264
|
+
* })
|
|
237
265
|
*/
|
|
238
|
-
|
|
266
|
+
update(id, request, requestOptions) {
|
|
239
267
|
var _a;
|
|
240
268
|
return __awaiter(this, void 0, void 0, function* () {
|
|
241
269
|
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: "
|
|
270
|
+
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}`),
|
|
271
|
+
method: "PUT",
|
|
244
272
|
headers: {
|
|
245
273
|
Authorization: yield this._getAuthorizationHeader(),
|
|
246
|
-
"X-Polytomic-Version":
|
|
247
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
248
|
-
: undefined,
|
|
274
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
249
275
|
"X-Fern-Language": "JavaScript",
|
|
250
276
|
"X-Fern-SDK-Name": "polytomic",
|
|
251
|
-
"X-Fern-SDK-Version": "0.
|
|
277
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
252
278
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
253
279
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
254
280
|
},
|
|
255
281
|
contentType: "application/json",
|
|
282
|
+
body: request,
|
|
256
283
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
257
284
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
258
285
|
});
|
|
@@ -261,8 +288,16 @@ class BulkSync {
|
|
|
261
288
|
}
|
|
262
289
|
if (_response.error.reason === "status-code") {
|
|
263
290
|
switch (_response.error.statusCode) {
|
|
291
|
+
case 400:
|
|
292
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
264
293
|
case 401:
|
|
265
294
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
295
|
+
case 403:
|
|
296
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
297
|
+
case 404:
|
|
298
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
299
|
+
case 500:
|
|
300
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
266
301
|
default:
|
|
267
302
|
throw new errors.PolytomicError({
|
|
268
303
|
statusCode: _response.error.statusCode,
|
|
@@ -287,38 +322,53 @@ class BulkSync {
|
|
|
287
322
|
}
|
|
288
323
|
/**
|
|
289
324
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
325
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
326
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
327
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
290
328
|
*
|
|
291
329
|
* @example
|
|
292
|
-
* await polytomic.bulkSync.
|
|
330
|
+
* await polytomic.bulkSync.remove("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
331
|
+
* refresh_schemas: true
|
|
332
|
+
* })
|
|
293
333
|
*/
|
|
294
|
-
|
|
334
|
+
remove(id, request = {}, requestOptions) {
|
|
295
335
|
var _a;
|
|
296
336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
+
const { refresh_schemas: refreshSchemas } = request;
|
|
338
|
+
const _queryParams = {};
|
|
339
|
+
if (refreshSchemas != null) {
|
|
340
|
+
_queryParams["refresh_schemas"] = refreshSchemas.toString();
|
|
341
|
+
}
|
|
297
342
|
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: "
|
|
343
|
+
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}`),
|
|
344
|
+
method: "DELETE",
|
|
300
345
|
headers: {
|
|
301
346
|
Authorization: yield this._getAuthorizationHeader(),
|
|
302
|
-
"X-Polytomic-Version":
|
|
303
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
304
|
-
: undefined,
|
|
347
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
305
348
|
"X-Fern-Language": "JavaScript",
|
|
306
349
|
"X-Fern-SDK-Name": "polytomic",
|
|
307
|
-
"X-Fern-SDK-Version": "0.
|
|
350
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
308
351
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
309
352
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
310
353
|
},
|
|
311
354
|
contentType: "application/json",
|
|
355
|
+
queryParameters: _queryParams,
|
|
312
356
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
313
357
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
314
358
|
});
|
|
315
359
|
if (_response.ok) {
|
|
316
|
-
return
|
|
360
|
+
return;
|
|
317
361
|
}
|
|
318
362
|
if (_response.error.reason === "status-code") {
|
|
319
363
|
switch (_response.error.statusCode) {
|
|
320
364
|
case 401:
|
|
321
365
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
366
|
+
case 403:
|
|
367
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
368
|
+
case 404:
|
|
369
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
370
|
+
case 500:
|
|
371
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
322
372
|
default:
|
|
323
373
|
throw new errors.PolytomicError({
|
|
324
374
|
statusCode: _response.error.statusCode,
|
|
@@ -343,31 +393,27 @@ class BulkSync {
|
|
|
343
393
|
}
|
|
344
394
|
/**
|
|
345
395
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
396
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
397
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
398
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
346
399
|
*
|
|
347
400
|
* @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"
|
|
401
|
+
* await polytomic.bulkSync.activate("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
402
|
+
* active: true
|
|
355
403
|
* })
|
|
356
404
|
*/
|
|
357
|
-
|
|
405
|
+
activate(id, request, requestOptions) {
|
|
358
406
|
var _a;
|
|
359
407
|
return __awaiter(this, void 0, void 0, function* () {
|
|
360
408
|
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,
|
|
409
|
+
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
410
|
method: "POST",
|
|
363
411
|
headers: {
|
|
364
412
|
Authorization: yield this._getAuthorizationHeader(),
|
|
365
|
-
"X-Polytomic-Version":
|
|
366
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
367
|
-
: undefined,
|
|
413
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
368
414
|
"X-Fern-Language": "JavaScript",
|
|
369
415
|
"X-Fern-SDK-Name": "polytomic",
|
|
370
|
-
"X-Fern-SDK-Version": "0.
|
|
416
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
371
417
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
372
418
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
373
419
|
},
|
|
@@ -383,6 +429,12 @@ class BulkSync {
|
|
|
383
429
|
switch (_response.error.statusCode) {
|
|
384
430
|
case 401:
|
|
385
431
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
432
|
+
case 403:
|
|
433
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
434
|
+
case 404:
|
|
435
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
436
|
+
case 500:
|
|
437
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
386
438
|
default:
|
|
387
439
|
throw new errors.PolytomicError({
|
|
388
440
|
statusCode: _response.error.statusCode,
|
|
@@ -406,37 +458,29 @@ class BulkSync {
|
|
|
406
458
|
});
|
|
407
459
|
}
|
|
408
460
|
/**
|
|
461
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
409
462
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
410
463
|
*
|
|
411
464
|
* @example
|
|
412
|
-
* await polytomic.bulkSync.
|
|
413
|
-
* refresh_schemas: true
|
|
414
|
-
* })
|
|
465
|
+
* await polytomic.bulkSync.start("248df4b7-aa70-47b8-a036-33ac447e668d", {})
|
|
415
466
|
*/
|
|
416
|
-
|
|
467
|
+
start(id, request = {}, requestOptions) {
|
|
417
468
|
var _a;
|
|
418
469
|
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
470
|
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: "
|
|
471
|
+
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`),
|
|
472
|
+
method: "POST",
|
|
427
473
|
headers: {
|
|
428
474
|
Authorization: yield this._getAuthorizationHeader(),
|
|
429
|
-
"X-Polytomic-Version":
|
|
430
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
431
|
-
: undefined,
|
|
475
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
432
476
|
"X-Fern-Language": "JavaScript",
|
|
433
477
|
"X-Fern-SDK-Name": "polytomic",
|
|
434
|
-
"X-Fern-SDK-Version": "0.
|
|
478
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
435
479
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
436
480
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
437
481
|
},
|
|
438
482
|
contentType: "application/json",
|
|
439
|
-
|
|
483
|
+
body: request,
|
|
440
484
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
441
485
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
442
486
|
});
|
|
@@ -445,6 +489,8 @@ class BulkSync {
|
|
|
445
489
|
}
|
|
446
490
|
if (_response.error.reason === "status-code") {
|
|
447
491
|
switch (_response.error.statusCode) {
|
|
492
|
+
case 400:
|
|
493
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
448
494
|
case 401:
|
|
449
495
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
450
496
|
default:
|
|
@@ -471,103 +517,28 @@ class BulkSync {
|
|
|
471
517
|
}
|
|
472
518
|
/**
|
|
473
519
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
520
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
521
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
474
522
|
*
|
|
475
523
|
* @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
|
-
* })
|
|
524
|
+
* await polytomic.bulkSync.getStatus("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
551
525
|
*/
|
|
552
|
-
|
|
526
|
+
getStatus(id, requestOptions) {
|
|
553
527
|
var _a;
|
|
554
528
|
return __awaiter(this, void 0, void 0, function* () {
|
|
555
529
|
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: "
|
|
530
|
+
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`),
|
|
531
|
+
method: "GET",
|
|
558
532
|
headers: {
|
|
559
533
|
Authorization: yield this._getAuthorizationHeader(),
|
|
560
|
-
"X-Polytomic-Version":
|
|
561
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
562
|
-
: undefined,
|
|
534
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
563
535
|
"X-Fern-Language": "JavaScript",
|
|
564
536
|
"X-Fern-SDK-Name": "polytomic",
|
|
565
|
-
"X-Fern-SDK-Version": "0.
|
|
537
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
566
538
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
567
539
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
568
540
|
},
|
|
569
541
|
contentType: "application/json",
|
|
570
|
-
body: request,
|
|
571
542
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
572
543
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
573
544
|
});
|
|
@@ -578,6 +549,10 @@ class BulkSync {
|
|
|
578
549
|
switch (_response.error.statusCode) {
|
|
579
550
|
case 401:
|
|
580
551
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
552
|
+
case 404:
|
|
553
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
554
|
+
case 500:
|
|
555
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
581
556
|
default:
|
|
582
557
|
throw new errors.PolytomicError({
|
|
583
558
|
statusCode: _response.error.statusCode,
|
|
@@ -601,32 +576,38 @@ class BulkSync {
|
|
|
601
576
|
});
|
|
602
577
|
}
|
|
603
578
|
/**
|
|
579
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
604
580
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
581
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
582
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
605
583
|
*
|
|
606
584
|
* @example
|
|
607
|
-
* await polytomic.bulkSync.
|
|
608
|
-
*
|
|
585
|
+
* await polytomic.bulkSync.getSource("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
586
|
+
* include_fields: true
|
|
609
587
|
* })
|
|
610
588
|
*/
|
|
611
|
-
|
|
589
|
+
getSource(id, request = {}, requestOptions) {
|
|
612
590
|
var _a;
|
|
613
591
|
return __awaiter(this, void 0, void 0, function* () {
|
|
592
|
+
const { include_fields: includeFields } = request;
|
|
593
|
+
const _queryParams = {};
|
|
594
|
+
if (includeFields != null) {
|
|
595
|
+
_queryParams["include_fields"] = includeFields.toString();
|
|
596
|
+
}
|
|
614
597
|
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: "
|
|
598
|
+
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`),
|
|
599
|
+
method: "GET",
|
|
617
600
|
headers: {
|
|
618
601
|
Authorization: yield this._getAuthorizationHeader(),
|
|
619
|
-
"X-Polytomic-Version":
|
|
620
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
621
|
-
: undefined,
|
|
602
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
622
603
|
"X-Fern-Language": "JavaScript",
|
|
623
604
|
"X-Fern-SDK-Name": "polytomic",
|
|
624
|
-
"X-Fern-SDK-Version": "0.
|
|
605
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
625
606
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
626
607
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
627
608
|
},
|
|
628
609
|
contentType: "application/json",
|
|
629
|
-
|
|
610
|
+
queryParameters: _queryParams,
|
|
630
611
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
631
612
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
632
613
|
});
|
|
@@ -635,8 +616,14 @@ class BulkSync {
|
|
|
635
616
|
}
|
|
636
617
|
if (_response.error.reason === "status-code") {
|
|
637
618
|
switch (_response.error.statusCode) {
|
|
619
|
+
case 400:
|
|
620
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
638
621
|
case 401:
|
|
639
622
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
623
|
+
case 404:
|
|
624
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
625
|
+
case 500:
|
|
626
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
640
627
|
default:
|
|
641
628
|
throw new errors.PolytomicError({
|
|
642
629
|
statusCode: _response.error.statusCode,
|
|
@@ -660,25 +647,26 @@ class BulkSync {
|
|
|
660
647
|
});
|
|
661
648
|
}
|
|
662
649
|
/**
|
|
650
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
663
651
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
652
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
653
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
664
654
|
*
|
|
665
655
|
* @example
|
|
666
|
-
* await polytomic.bulkSync.
|
|
656
|
+
* await polytomic.bulkSync.getDestination("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
667
657
|
*/
|
|
668
|
-
|
|
658
|
+
getDestination(id, requestOptions) {
|
|
669
659
|
var _a;
|
|
670
660
|
return __awaiter(this, void 0, void 0, function* () {
|
|
671
661
|
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/
|
|
662
|
+
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
663
|
method: "GET",
|
|
674
664
|
headers: {
|
|
675
665
|
Authorization: yield this._getAuthorizationHeader(),
|
|
676
|
-
"X-Polytomic-Version":
|
|
677
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
678
|
-
: undefined,
|
|
666
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
679
667
|
"X-Fern-Language": "JavaScript",
|
|
680
668
|
"X-Fern-SDK-Name": "polytomic",
|
|
681
|
-
"X-Fern-SDK-Version": "0.
|
|
669
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
682
670
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
683
671
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
684
672
|
},
|
|
@@ -691,8 +679,14 @@ class BulkSync {
|
|
|
691
679
|
}
|
|
692
680
|
if (_response.error.reason === "status-code") {
|
|
693
681
|
switch (_response.error.statusCode) {
|
|
682
|
+
case 400:
|
|
683
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
694
684
|
case 401:
|
|
695
685
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
686
|
+
case 403:
|
|
687
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
688
|
+
case 500:
|
|
689
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
696
690
|
default:
|
|
697
691
|
throw new errors.PolytomicError({
|
|
698
692
|
statusCode: _response.error.statusCode,
|
|
@@ -725,11 +719,7 @@ class BulkSync {
|
|
|
725
719
|
}
|
|
726
720
|
_getAuthorizationHeader() {
|
|
727
721
|
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
-
|
|
729
|
-
if (bearer != null) {
|
|
730
|
-
return `Bearer ${bearer}`;
|
|
731
|
-
}
|
|
732
|
-
return undefined;
|
|
722
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
733
723
|
});
|
|
734
724
|
}
|
|
735
725
|
}
|