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
|
@@ -45,11 +45,12 @@ const Polytomic = __importStar(require("../../.."));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class Connections {
|
|
48
|
-
constructor(_options
|
|
48
|
+
constructor(_options) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
53
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* await polytomic.connections.getTypes()
|
|
@@ -62,12 +63,10 @@ class Connections {
|
|
|
62
63
|
method: "GET",
|
|
63
64
|
headers: {
|
|
64
65
|
Authorization: yield this._getAuthorizationHeader(),
|
|
65
|
-
"X-Polytomic-Version":
|
|
66
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
67
|
-
: undefined,
|
|
66
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
68
67
|
"X-Fern-Language": "JavaScript",
|
|
69
68
|
"X-Fern-SDK-Name": "polytomic",
|
|
70
|
-
"X-Fern-SDK-Version": "0.
|
|
69
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
71
70
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
72
71
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
73
72
|
},
|
|
@@ -82,6 +81,8 @@ class Connections {
|
|
|
82
81
|
switch (_response.error.statusCode) {
|
|
83
82
|
case 401:
|
|
84
83
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
84
|
+
case 500:
|
|
85
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
85
86
|
default:
|
|
86
87
|
throw new errors.PolytomicError({
|
|
87
88
|
statusCode: _response.error.statusCode,
|
|
@@ -106,6 +107,7 @@ class Connections {
|
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
108
109
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
110
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
109
111
|
*
|
|
110
112
|
* @example
|
|
111
113
|
* await polytomic.connections.list()
|
|
@@ -118,12 +120,10 @@ class Connections {
|
|
|
118
120
|
method: "GET",
|
|
119
121
|
headers: {
|
|
120
122
|
Authorization: yield this._getAuthorizationHeader(),
|
|
121
|
-
"X-Polytomic-Version":
|
|
122
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
123
|
-
: undefined,
|
|
123
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
124
124
|
"X-Fern-Language": "JavaScript",
|
|
125
125
|
"X-Fern-SDK-Name": "polytomic",
|
|
126
|
-
"X-Fern-SDK-Version": "0.
|
|
126
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
127
127
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
128
128
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
129
129
|
},
|
|
@@ -138,6 +138,8 @@ class Connections {
|
|
|
138
138
|
switch (_response.error.statusCode) {
|
|
139
139
|
case 401:
|
|
140
140
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
141
|
+
case 500:
|
|
142
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
141
143
|
default:
|
|
142
144
|
throw new errors.PolytomicError({
|
|
143
145
|
statusCode: _response.error.statusCode,
|
|
@@ -161,13 +163,17 @@ class Connections {
|
|
|
161
163
|
});
|
|
162
164
|
}
|
|
163
165
|
/**
|
|
166
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
164
167
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
168
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
169
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
170
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
165
171
|
*
|
|
166
172
|
* @example
|
|
167
173
|
* await polytomic.connections.create({
|
|
168
|
-
* name: "My Connection",
|
|
174
|
+
* name: "My Postgres Connection",
|
|
169
175
|
* redirect_url: "https://example.com/oauth_redirect",
|
|
170
|
-
* type: "
|
|
176
|
+
* type: "postgresql",
|
|
171
177
|
* validate: true
|
|
172
178
|
* })
|
|
173
179
|
*/
|
|
@@ -179,12 +185,10 @@ class Connections {
|
|
|
179
185
|
method: "POST",
|
|
180
186
|
headers: {
|
|
181
187
|
Authorization: yield this._getAuthorizationHeader(),
|
|
182
|
-
"X-Polytomic-Version":
|
|
183
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
184
|
-
: undefined,
|
|
188
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
185
189
|
"X-Fern-Language": "JavaScript",
|
|
186
190
|
"X-Fern-SDK-Name": "polytomic",
|
|
187
|
-
"X-Fern-SDK-Version": "0.
|
|
191
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
188
192
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
189
193
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
190
194
|
},
|
|
@@ -198,8 +202,16 @@ class Connections {
|
|
|
198
202
|
}
|
|
199
203
|
if (_response.error.reason === "status-code") {
|
|
200
204
|
switch (_response.error.statusCode) {
|
|
205
|
+
case 400:
|
|
206
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
201
207
|
case 401:
|
|
202
208
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
209
|
+
case 403:
|
|
210
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
211
|
+
case 422:
|
|
212
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
213
|
+
case 500:
|
|
214
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
203
215
|
default:
|
|
204
216
|
throw new errors.PolytomicError({
|
|
205
217
|
statusCode: _response.error.statusCode,
|
|
@@ -222,75 +234,37 @@ class Connections {
|
|
|
222
234
|
}
|
|
223
235
|
});
|
|
224
236
|
}
|
|
225
|
-
connect(requestOptions) {
|
|
226
|
-
var _a;
|
|
227
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
-
const _response = yield core.fetcher({
|
|
229
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, "api/connections/connect"),
|
|
230
|
-
method: "POST",
|
|
231
|
-
headers: {
|
|
232
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
233
|
-
"X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
|
|
234
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
235
|
-
: undefined,
|
|
236
|
-
"X-Fern-Language": "JavaScript",
|
|
237
|
-
"X-Fern-SDK-Name": "polytomic",
|
|
238
|
-
"X-Fern-SDK-Version": "0.1.2",
|
|
239
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
240
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
241
|
-
},
|
|
242
|
-
contentType: "application/json",
|
|
243
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
244
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
245
|
-
});
|
|
246
|
-
if (_response.ok) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (_response.error.reason === "status-code") {
|
|
250
|
-
throw new errors.PolytomicError({
|
|
251
|
-
statusCode: _response.error.statusCode,
|
|
252
|
-
body: _response.error.body,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
switch (_response.error.reason) {
|
|
256
|
-
case "non-json":
|
|
257
|
-
throw new errors.PolytomicError({
|
|
258
|
-
statusCode: _response.error.statusCode,
|
|
259
|
-
body: _response.error.rawBody,
|
|
260
|
-
});
|
|
261
|
-
case "timeout":
|
|
262
|
-
throw new errors.PolytomicTimeoutError();
|
|
263
|
-
case "unknown":
|
|
264
|
-
throw new errors.PolytomicError({
|
|
265
|
-
message: _response.error.errorMessage,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
237
|
/**
|
|
271
238
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
239
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
240
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
241
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
272
242
|
*
|
|
273
243
|
* @example
|
|
274
|
-
* await polytomic.connections.
|
|
244
|
+
* await polytomic.connections.connect({
|
|
245
|
+
* connection: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
246
|
+
* name: "Salesforce Connection",
|
|
247
|
+
* redirect_url: "redirect_url",
|
|
248
|
+
* type: "salesforce"
|
|
249
|
+
* })
|
|
275
250
|
*/
|
|
276
|
-
|
|
251
|
+
connect(request, requestOptions) {
|
|
277
252
|
var _a;
|
|
278
253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
254
|
const _response = yield core.fetcher({
|
|
280
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default,
|
|
281
|
-
method: "
|
|
255
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, "api/connections/connect"),
|
|
256
|
+
method: "POST",
|
|
282
257
|
headers: {
|
|
283
258
|
Authorization: yield this._getAuthorizationHeader(),
|
|
284
|
-
"X-Polytomic-Version":
|
|
285
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
286
|
-
: undefined,
|
|
259
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
287
260
|
"X-Fern-Language": "JavaScript",
|
|
288
261
|
"X-Fern-SDK-Name": "polytomic",
|
|
289
|
-
"X-Fern-SDK-Version": "0.
|
|
262
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
290
263
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
291
264
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
292
265
|
},
|
|
293
266
|
contentType: "application/json",
|
|
267
|
+
body: request,
|
|
294
268
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
295
269
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
296
270
|
});
|
|
@@ -301,6 +275,12 @@ class Connections {
|
|
|
301
275
|
switch (_response.error.statusCode) {
|
|
302
276
|
case 401:
|
|
303
277
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
278
|
+
case 403:
|
|
279
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
280
|
+
case 422:
|
|
281
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
282
|
+
case 500:
|
|
283
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
304
284
|
default:
|
|
305
285
|
throw new errors.PolytomicError({
|
|
306
286
|
statusCode: _response.error.statusCode,
|
|
@@ -325,46 +305,42 @@ class Connections {
|
|
|
325
305
|
}
|
|
326
306
|
/**
|
|
327
307
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
308
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
309
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
328
310
|
*
|
|
329
311
|
* @example
|
|
330
|
-
* await polytomic.connections.
|
|
331
|
-
* force: true
|
|
332
|
-
* })
|
|
312
|
+
* await polytomic.connections.get("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
333
313
|
*/
|
|
334
|
-
|
|
314
|
+
get(id, requestOptions) {
|
|
335
315
|
var _a;
|
|
336
316
|
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
-
const { force } = request;
|
|
338
|
-
const _queryParams = {};
|
|
339
|
-
if (force != null) {
|
|
340
|
-
_queryParams["force"] = force.toString();
|
|
341
|
-
}
|
|
342
317
|
const _response = yield core.fetcher({
|
|
343
318
|
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}`),
|
|
344
|
-
method: "
|
|
319
|
+
method: "GET",
|
|
345
320
|
headers: {
|
|
346
321
|
Authorization: yield this._getAuthorizationHeader(),
|
|
347
|
-
"X-Polytomic-Version":
|
|
348
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
349
|
-
: undefined,
|
|
322
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
350
323
|
"X-Fern-Language": "JavaScript",
|
|
351
324
|
"X-Fern-SDK-Name": "polytomic",
|
|
352
|
-
"X-Fern-SDK-Version": "0.
|
|
325
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
353
326
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
354
327
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
355
328
|
},
|
|
356
329
|
contentType: "application/json",
|
|
357
|
-
queryParameters: _queryParams,
|
|
358
330
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
359
331
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
360
332
|
});
|
|
361
333
|
if (_response.ok) {
|
|
362
|
-
return;
|
|
334
|
+
return _response.body;
|
|
363
335
|
}
|
|
364
336
|
if (_response.error.reason === "status-code") {
|
|
365
337
|
switch (_response.error.statusCode) {
|
|
366
338
|
case 401:
|
|
367
339
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
340
|
+
case 404:
|
|
341
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
342
|
+
case 500:
|
|
343
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
368
344
|
default:
|
|
369
345
|
throw new errors.PolytomicError({
|
|
370
346
|
statusCode: _response.error.statusCode,
|
|
@@ -388,13 +364,18 @@ class Connections {
|
|
|
388
364
|
});
|
|
389
365
|
}
|
|
390
366
|
/**
|
|
367
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
391
368
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
369
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
370
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
371
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
372
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
392
373
|
*
|
|
393
374
|
* @example
|
|
394
375
|
* await polytomic.connections.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
395
|
-
* name: "My Connection",
|
|
376
|
+
* name: "My Postgres Connection",
|
|
396
377
|
* reconnect: false,
|
|
397
|
-
* type: "
|
|
378
|
+
* type: "postgresql",
|
|
398
379
|
* validate: true
|
|
399
380
|
* })
|
|
400
381
|
*/
|
|
@@ -403,15 +384,13 @@ class Connections {
|
|
|
403
384
|
return __awaiter(this, void 0, void 0, function* () {
|
|
404
385
|
const _response = yield core.fetcher({
|
|
405
386
|
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}`),
|
|
406
|
-
method: "
|
|
387
|
+
method: "PUT",
|
|
407
388
|
headers: {
|
|
408
389
|
Authorization: yield this._getAuthorizationHeader(),
|
|
409
|
-
"X-Polytomic-Version":
|
|
410
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
411
|
-
: undefined,
|
|
390
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
412
391
|
"X-Fern-Language": "JavaScript",
|
|
413
392
|
"X-Fern-SDK-Name": "polytomic",
|
|
414
|
-
"X-Fern-SDK-Version": "0.
|
|
393
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
415
394
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
416
395
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
417
396
|
},
|
|
@@ -425,8 +404,18 @@ class Connections {
|
|
|
425
404
|
}
|
|
426
405
|
if (_response.error.reason === "status-code") {
|
|
427
406
|
switch (_response.error.statusCode) {
|
|
407
|
+
case 400:
|
|
408
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
428
409
|
case 401:
|
|
429
410
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
411
|
+
case 403:
|
|
412
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
413
|
+
case 404:
|
|
414
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
415
|
+
case 422:
|
|
416
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
417
|
+
case 500:
|
|
418
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
430
419
|
default:
|
|
431
420
|
throw new errors.PolytomicError({
|
|
432
421
|
statusCode: _response.error.statusCode,
|
|
@@ -451,204 +440,33 @@ class Connections {
|
|
|
451
440
|
}
|
|
452
441
|
/**
|
|
453
442
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
443
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
444
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
445
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
446
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
454
447
|
*
|
|
455
448
|
* @example
|
|
456
|
-
* await polytomic.connections.
|
|
457
|
-
|
|
458
|
-
getParameterValues(id, requestOptions) {
|
|
459
|
-
var _a;
|
|
460
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
461
|
-
const _response = yield core.fetcher({
|
|
462
|
-
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}/parameter_values`),
|
|
463
|
-
method: "GET",
|
|
464
|
-
headers: {
|
|
465
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
466
|
-
"X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
|
|
467
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
468
|
-
: undefined,
|
|
469
|
-
"X-Fern-Language": "JavaScript",
|
|
470
|
-
"X-Fern-SDK-Name": "polytomic",
|
|
471
|
-
"X-Fern-SDK-Version": "0.1.2",
|
|
472
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
473
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
474
|
-
},
|
|
475
|
-
contentType: "application/json",
|
|
476
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
477
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
478
|
-
});
|
|
479
|
-
if (_response.ok) {
|
|
480
|
-
return _response.body;
|
|
481
|
-
}
|
|
482
|
-
if (_response.error.reason === "status-code") {
|
|
483
|
-
switch (_response.error.statusCode) {
|
|
484
|
-
case 401:
|
|
485
|
-
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
486
|
-
default:
|
|
487
|
-
throw new errors.PolytomicError({
|
|
488
|
-
statusCode: _response.error.statusCode,
|
|
489
|
-
body: _response.error.body,
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
switch (_response.error.reason) {
|
|
494
|
-
case "non-json":
|
|
495
|
-
throw new errors.PolytomicError({
|
|
496
|
-
statusCode: _response.error.statusCode,
|
|
497
|
-
body: _response.error.rawBody,
|
|
498
|
-
});
|
|
499
|
-
case "timeout":
|
|
500
|
-
throw new errors.PolytomicTimeoutError();
|
|
501
|
-
case "unknown":
|
|
502
|
-
throw new errors.PolytomicError({
|
|
503
|
-
message: _response.error.errorMessage,
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
510
|
-
*
|
|
511
|
-
* @example
|
|
512
|
-
* await polytomic.connections.getSource("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
513
|
-
*/
|
|
514
|
-
getSource(id, requestOptions) {
|
|
515
|
-
var _a;
|
|
516
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
517
|
-
const _response = yield core.fetcher({
|
|
518
|
-
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}/source`),
|
|
519
|
-
method: "GET",
|
|
520
|
-
headers: {
|
|
521
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
522
|
-
"X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
|
|
523
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
524
|
-
: undefined,
|
|
525
|
-
"X-Fern-Language": "JavaScript",
|
|
526
|
-
"X-Fern-SDK-Name": "polytomic",
|
|
527
|
-
"X-Fern-SDK-Version": "0.1.2",
|
|
528
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
529
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
530
|
-
},
|
|
531
|
-
contentType: "application/json",
|
|
532
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
533
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
534
|
-
});
|
|
535
|
-
if (_response.ok) {
|
|
536
|
-
return _response.body;
|
|
537
|
-
}
|
|
538
|
-
if (_response.error.reason === "status-code") {
|
|
539
|
-
switch (_response.error.statusCode) {
|
|
540
|
-
case 401:
|
|
541
|
-
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
542
|
-
default:
|
|
543
|
-
throw new errors.PolytomicError({
|
|
544
|
-
statusCode: _response.error.statusCode,
|
|
545
|
-
body: _response.error.body,
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
switch (_response.error.reason) {
|
|
550
|
-
case "non-json":
|
|
551
|
-
throw new errors.PolytomicError({
|
|
552
|
-
statusCode: _response.error.statusCode,
|
|
553
|
-
body: _response.error.rawBody,
|
|
554
|
-
});
|
|
555
|
-
case "timeout":
|
|
556
|
-
throw new errors.PolytomicTimeoutError();
|
|
557
|
-
case "unknown":
|
|
558
|
-
throw new errors.PolytomicError({
|
|
559
|
-
message: _response.error.errorMessage,
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* await polytomic.connections.getSourceFields("248df4b7-aa70-47b8-a036-33ac447e668d", {})
|
|
569
|
-
*/
|
|
570
|
-
getSourceFields(id, request = {}, requestOptions) {
|
|
571
|
-
var _a;
|
|
572
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
573
|
-
const _response = yield core.fetcher({
|
|
574
|
-
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}/source/fields`),
|
|
575
|
-
method: "POST",
|
|
576
|
-
headers: {
|
|
577
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
578
|
-
"X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
|
|
579
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
580
|
-
: undefined,
|
|
581
|
-
"X-Fern-Language": "JavaScript",
|
|
582
|
-
"X-Fern-SDK-Name": "polytomic",
|
|
583
|
-
"X-Fern-SDK-Version": "0.1.2",
|
|
584
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
585
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
586
|
-
},
|
|
587
|
-
contentType: "application/json",
|
|
588
|
-
body: request,
|
|
589
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
590
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
591
|
-
});
|
|
592
|
-
if (_response.ok) {
|
|
593
|
-
return _response.body;
|
|
594
|
-
}
|
|
595
|
-
if (_response.error.reason === "status-code") {
|
|
596
|
-
switch (_response.error.statusCode) {
|
|
597
|
-
case 401:
|
|
598
|
-
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
599
|
-
default:
|
|
600
|
-
throw new errors.PolytomicError({
|
|
601
|
-
statusCode: _response.error.statusCode,
|
|
602
|
-
body: _response.error.body,
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
switch (_response.error.reason) {
|
|
607
|
-
case "non-json":
|
|
608
|
-
throw new errors.PolytomicError({
|
|
609
|
-
statusCode: _response.error.statusCode,
|
|
610
|
-
body: _response.error.rawBody,
|
|
611
|
-
});
|
|
612
|
-
case "timeout":
|
|
613
|
-
throw new errors.PolytomicTimeoutError();
|
|
614
|
-
case "unknown":
|
|
615
|
-
throw new errors.PolytomicError({
|
|
616
|
-
message: _response.error.errorMessage,
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* @throws {@link Polytomic.UnauthorizedError}
|
|
623
|
-
*
|
|
624
|
-
* @example
|
|
625
|
-
* await polytomic.connections.getTarget("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
626
|
-
* type: "table",
|
|
627
|
-
* search: "public.users"
|
|
449
|
+
* await polytomic.connections.remove("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
450
|
+
* force: true
|
|
628
451
|
* })
|
|
629
452
|
*/
|
|
630
|
-
|
|
453
|
+
remove(id, request = {}, requestOptions) {
|
|
631
454
|
var _a;
|
|
632
455
|
return __awaiter(this, void 0, void 0, function* () {
|
|
633
|
-
const {
|
|
456
|
+
const { force } = request;
|
|
634
457
|
const _queryParams = {};
|
|
635
|
-
if (
|
|
636
|
-
_queryParams["
|
|
637
|
-
}
|
|
638
|
-
if (search != null) {
|
|
639
|
-
_queryParams["search"] = search;
|
|
458
|
+
if (force != null) {
|
|
459
|
+
_queryParams["force"] = force.toString();
|
|
640
460
|
}
|
|
641
461
|
const _response = yield core.fetcher({
|
|
642
|
-
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}
|
|
643
|
-
method: "
|
|
462
|
+
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}`),
|
|
463
|
+
method: "DELETE",
|
|
644
464
|
headers: {
|
|
645
465
|
Authorization: yield this._getAuthorizationHeader(),
|
|
646
|
-
"X-Polytomic-Version":
|
|
647
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
648
|
-
: undefined,
|
|
466
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
649
467
|
"X-Fern-Language": "JavaScript",
|
|
650
468
|
"X-Fern-SDK-Name": "polytomic",
|
|
651
|
-
"X-Fern-SDK-Version": "0.
|
|
469
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
652
470
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
653
471
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
654
472
|
},
|
|
@@ -658,12 +476,20 @@ class Connections {
|
|
|
658
476
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
659
477
|
});
|
|
660
478
|
if (_response.ok) {
|
|
661
|
-
return
|
|
479
|
+
return;
|
|
662
480
|
}
|
|
663
481
|
if (_response.error.reason === "status-code") {
|
|
664
482
|
switch (_response.error.statusCode) {
|
|
665
483
|
case 401:
|
|
666
484
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
485
|
+
case 403:
|
|
486
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
487
|
+
case 404:
|
|
488
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
489
|
+
case 422:
|
|
490
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body);
|
|
491
|
+
case 500:
|
|
492
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
667
493
|
default:
|
|
668
494
|
throw new errors.PolytomicError({
|
|
669
495
|
statusCode: _response.error.statusCode,
|
|
@@ -688,32 +514,28 @@ class Connections {
|
|
|
688
514
|
}
|
|
689
515
|
/**
|
|
690
516
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
517
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
518
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
691
519
|
*
|
|
692
520
|
* @example
|
|
693
|
-
* await polytomic.connections.
|
|
694
|
-
* refresh: false,
|
|
695
|
-
* target: "database.table"
|
|
696
|
-
* })
|
|
521
|
+
* await polytomic.connections.getParameterValues("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
697
522
|
*/
|
|
698
|
-
|
|
523
|
+
getParameterValues(id, requestOptions) {
|
|
699
524
|
var _a;
|
|
700
525
|
return __awaiter(this, void 0, void 0, function* () {
|
|
701
526
|
const _response = yield core.fetcher({
|
|
702
|
-
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}/
|
|
703
|
-
method: "
|
|
527
|
+
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}/parameter_values`),
|
|
528
|
+
method: "GET",
|
|
704
529
|
headers: {
|
|
705
530
|
Authorization: yield this._getAuthorizationHeader(),
|
|
706
|
-
"X-Polytomic-Version":
|
|
707
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
708
|
-
: undefined,
|
|
531
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
709
532
|
"X-Fern-Language": "JavaScript",
|
|
710
533
|
"X-Fern-SDK-Name": "polytomic",
|
|
711
|
-
"X-Fern-SDK-Version": "0.
|
|
534
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
712
535
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
713
536
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
714
537
|
},
|
|
715
538
|
contentType: "application/json",
|
|
716
|
-
body: request,
|
|
717
539
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
718
540
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
719
541
|
});
|
|
@@ -724,6 +546,10 @@ class Connections {
|
|
|
724
546
|
switch (_response.error.statusCode) {
|
|
725
547
|
case 401:
|
|
726
548
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
549
|
+
case 404:
|
|
550
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
551
|
+
case 500:
|
|
552
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
727
553
|
default:
|
|
728
554
|
throw new errors.PolytomicError({
|
|
729
555
|
statusCode: _response.error.statusCode,
|
|
@@ -748,11 +574,7 @@ class Connections {
|
|
|
748
574
|
}
|
|
749
575
|
_getAuthorizationHeader() {
|
|
750
576
|
return __awaiter(this, void 0, void 0, function* () {
|
|
751
|
-
|
|
752
|
-
if (bearer != null) {
|
|
753
|
-
return `Bearer ${bearer}`;
|
|
754
|
-
}
|
|
755
|
-
return undefined;
|
|
577
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
756
578
|
});
|
|
757
579
|
}
|
|
758
580
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* connection: "248df4b7-aa70-47b8-a036-33ac447e668d",
|
|
8
|
+
* name: "Salesforce Connection",
|
|
9
|
+
* redirect_url: "redirect_url",
|
|
10
|
+
* type: "salesforce"
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface ConnectCardRequest {
|
|
14
|
+
connection?: string;
|
|
15
|
+
name: string;
|
|
16
|
+
organization_id?: string;
|
|
17
|
+
redirect_url: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
whitelist?: string[];
|
|
20
|
+
}
|