polytomic 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +8 -6
- package/Client.js +27 -22
- package/api/errors/BadRequestError.d.ts +8 -0
- package/api/errors/BadRequestError.js +41 -0
- package/api/errors/ForbiddenError.d.ts +8 -0
- package/api/errors/ForbiddenError.js +41 -0
- package/api/errors/InternalServerError.d.ts +8 -0
- package/api/errors/InternalServerError.js +41 -0
- package/api/errors/NotFoundError.d.ts +8 -0
- package/api/errors/NotFoundError.js +41 -0
- package/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/api/errors/UnprocessableEntityError.js +41 -0
- package/api/errors/index.d.ts +5 -0
- package/api/errors/index.js +5 -0
- package/api/resources/bulkSync/client/Client.d.ts +78 -47
- package/api/resources/bulkSync/client/Client.js +188 -183
- package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
- package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
- package/api/resources/bulkSync/client/requests/index.d.ts +3 -2
- package/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
- package/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
- package/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
- package/api/resources/bulkSync/resources/executions/client/index.js +0 -15
- package/api/resources/bulkSync/resources/index.d.ts +0 -1
- package/api/resources/bulkSync/resources/index.js +0 -1
- package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
- package/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
- package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/api/resources/connections/client/Client.d.ts +43 -45
- package/api/resources/connections/client/Client.js +116 -294
- package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
- package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
- package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
- package/api/resources/connections/client/requests/index.d.ts +2 -4
- package/api/resources/events/client/Client.d.ts +9 -8
- package/api/resources/events/client/Client.js +16 -18
- package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
- package/api/resources/events/client/requests/index.d.ts +1 -1
- package/api/resources/identity/client/Client.d.ts +29 -0
- package/api/resources/identity/client/Client.js +114 -0
- package/api/resources/identity/client/index.d.ts +1 -0
- package/api/resources/identity/index.d.ts +1 -0
- package/api/resources/identity/index.js +17 -0
- package/api/resources/index.d.ts +3 -2
- package/api/resources/index.js +4 -3
- package/api/resources/jobs/client/Client.d.ts +6 -4
- package/api/resources/jobs/client/Client.js +13 -10
- package/api/resources/modelSync/client/Client.d.ts +82 -11
- package/api/resources/modelSync/client/Client.js +421 -79
- package/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
- package/{dist/api/resources/connections/client/requests/TargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
- package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
- package/api/resources/modelSync/client/requests/index.d.ts +3 -0
- package/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
- package/api/resources/modelSync/resources/executions/client/Client.js +43 -476
- package/api/resources/models/client/Client.d.ts +22 -11
- package/api/resources/models/client/Client.js +68 -46
- package/api/resources/organization/client/Client.d.ts +21 -14
- package/api/resources/organization/client/Client.js +52 -42
- package/api/resources/permissions/client/Client.d.ts +2 -3
- package/api/resources/permissions/client/Client.js +1 -1
- package/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
- package/api/resources/permissions/resources/policies/client/Client.js +69 -41
- package/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
- package/api/resources/permissions/resources/roles/client/Client.js +62 -37
- package/api/resources/schemas/client/Client.d.ts +39 -6
- package/api/resources/schemas/client/Client.js +208 -13
- package/api/resources/users/client/Client.d.ts +21 -11
- package/api/resources/users/client/Client.js +57 -40
- package/api/resources/webhooks/client/Client.d.ts +18 -11
- package/api/resources/webhooks/client/Client.js +53 -43
- package/api/types/ApiError.d.ts +8 -0
- package/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
- package/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
- package/api/types/SourceMeta.d.ts +8 -0
- package/api/types/SourceMeta.js +5 -0
- package/api/types/index.d.ts +4 -0
- package/api/types/index.js +4 -0
- package/dist/Client.d.ts +8 -6
- package/dist/Client.js +27 -22
- package/dist/api/errors/BadRequestError.d.ts +8 -0
- package/dist/api/errors/BadRequestError.js +41 -0
- package/dist/api/errors/ForbiddenError.d.ts +8 -0
- package/dist/api/errors/ForbiddenError.js +41 -0
- package/dist/api/errors/InternalServerError.d.ts +8 -0
- package/dist/api/errors/InternalServerError.js +41 -0
- package/dist/api/errors/NotFoundError.d.ts +8 -0
- package/dist/api/errors/NotFoundError.js +41 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
- package/dist/api/errors/UnprocessableEntityError.js +41 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +5 -0
- package/dist/api/resources/bulkSync/client/Client.d.ts +78 -47
- package/dist/api/resources/bulkSync/client/Client.js +188 -183
- package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
- package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
- package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
- package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
- package/dist/api/resources/bulkSync/client/requests/index.d.ts +3 -2
- package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
- package/dist/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
- package/dist/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
- package/dist/api/resources/bulkSync/resources/executions/client/index.js +0 -15
- package/dist/api/resources/bulkSync/resources/index.d.ts +0 -1
- package/dist/api/resources/bulkSync/resources/index.js +0 -1
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
- package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js +5 -0
- package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
- package/dist/api/resources/connections/client/Client.d.ts +43 -45
- package/dist/api/resources/connections/client/Client.js +116 -294
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
- package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
- package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
- package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
- package/dist/api/resources/connections/client/requests/index.d.ts +2 -4
- package/dist/api/resources/events/client/Client.d.ts +9 -8
- package/dist/api/resources/events/client/Client.js +16 -18
- package/{api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → dist/api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
- package/dist/api/resources/events/client/requests/EventsListRequest.js +5 -0
- package/dist/api/resources/events/client/requests/index.d.ts +1 -1
- package/dist/api/resources/identity/client/Client.d.ts +29 -0
- package/dist/api/resources/identity/client/Client.js +114 -0
- package/dist/api/resources/identity/client/index.d.ts +1 -0
- package/dist/api/resources/identity/index.d.ts +1 -0
- package/dist/api/resources/identity/index.js +17 -0
- package/dist/api/resources/index.d.ts +3 -2
- package/dist/api/resources/index.js +4 -3
- package/dist/api/resources/jobs/client/Client.d.ts +6 -4
- package/dist/api/resources/jobs/client/Client.js +13 -10
- package/dist/api/resources/modelSync/client/Client.d.ts +82 -11
- package/dist/api/resources/modelSync/client/Client.js +421 -79
- package/dist/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetSourceRequest.js +5 -0
- package/{api/resources/connections/client/requests/TargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js +5 -0
- package/{api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
- package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js +5 -0
- package/dist/api/resources/modelSync/client/requests/index.d.ts +3 -0
- package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
- package/dist/api/resources/modelSync/resources/executions/client/Client.js +43 -476
- package/dist/api/resources/models/client/Client.d.ts +22 -11
- package/dist/api/resources/models/client/Client.js +68 -46
- package/dist/api/resources/organization/client/Client.d.ts +21 -14
- package/dist/api/resources/organization/client/Client.js +52 -42
- package/dist/api/resources/permissions/client/Client.d.ts +2 -3
- package/dist/api/resources/permissions/client/Client.js +1 -1
- package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
- package/dist/api/resources/permissions/resources/policies/client/Client.js +69 -41
- package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
- package/dist/api/resources/permissions/resources/roles/client/Client.js +62 -37
- package/dist/api/resources/schemas/client/Client.d.ts +39 -6
- package/dist/api/resources/schemas/client/Client.js +208 -13
- package/dist/api/resources/users/client/Client.d.ts +21 -11
- package/dist/api/resources/users/client/Client.js +57 -40
- package/dist/api/resources/webhooks/client/Client.d.ts +18 -11
- package/dist/api/resources/webhooks/client/Client.js +53 -43
- package/dist/api/types/ApiError.d.ts +8 -0
- package/dist/api/types/ApiError.js +5 -0
- package/dist/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
- package/dist/api/types/GetModelSyncSourceMetaEnvelope.js +5 -0
- package/dist/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
- package/dist/api/types/ModelSyncSourceMetaResponse.js +5 -0
- package/dist/api/types/SourceMeta.d.ts +8 -0
- package/dist/api/types/SourceMeta.js +5 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/package.json +1 -1
- package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
- package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
- /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
- /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.js +0 -0
- /package/api/resources/{connections/client/requests/ConnectionsGetTargetRequest.js → bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js} +0 -0
- /package/api/resources/connections/client/requests/{ModelFieldsRequest.js → ConnectCardRequest.js} +0 -0
- /package/api/resources/{connections/client/requests/TargetRequest.js → events/client/requests/EventsListRequest.js} +0 -0
- /package/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
- /package/api/resources/{events/client/requests/EventsApiV2GetEventsRequest.js → modelSync/client/requests/ModelSyncGetSourceRequest.js} +0 -0
- /package/{dist/api/resources/bulkSync/resources/executions/client/requests/StartBulkSyncRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/ModelFieldsRequest.js → api/types/ApiError.js} +0 -0
- /package/{dist/api/resources/connections/client/requests/TargetRequest.js → api/types/GetModelSyncSourceMetaEnvelope.js} +0 -0
- /package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.js → api/types/ModelSyncSourceMetaResponse.js} +0 -0
- /package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
- /package/dist/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
|
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
|
|
|
7
7
|
export declare namespace Schemas {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.PolytomicEnvironment | string>;
|
|
10
|
-
token
|
|
11
|
-
xPolytomicVersion?: core.Supplier<"2023-04-25" | undefined>;
|
|
10
|
+
token: core.Supplier<core.BearerToken>;
|
|
12
11
|
}
|
|
13
12
|
interface RequestOptions {
|
|
14
13
|
timeoutInSeconds?: number;
|
|
@@ -17,13 +16,47 @@ export declare namespace Schemas {
|
|
|
17
16
|
}
|
|
18
17
|
export declare class Schemas {
|
|
19
18
|
protected readonly _options: Schemas.Options;
|
|
20
|
-
constructor(_options
|
|
19
|
+
constructor(_options: Schemas.Options);
|
|
21
20
|
/**
|
|
21
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
22
22
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
23
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
24
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
23
25
|
*
|
|
24
26
|
* @example
|
|
25
|
-
* await polytomic.schemas.
|
|
27
|
+
* await polytomic.schemas.refresh("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
26
28
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
refresh(id: string, requestOptions?: Schemas.RequestOptions): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
32
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
33
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
34
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* await polytomic.schemas.getStatus("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
38
|
+
*/
|
|
39
|
+
getStatus(id: string, requestOptions?: Schemas.RequestOptions): Promise<Polytomic.BulkSyncSourceStatusEnvelope>;
|
|
40
|
+
/**
|
|
41
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
42
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
43
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
44
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* await polytomic.schemas.get("248df4b7-aa70-47b8-a036-33ac447e668d", "public.users")
|
|
48
|
+
*/
|
|
49
|
+
get(id: string, schemaId: string, requestOptions?: Schemas.RequestOptions): Promise<Polytomic.BulkSyncSourceSchemaEnvelope>;
|
|
50
|
+
/**
|
|
51
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
52
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
53
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
54
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
55
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* await polytomic.schemas.getRecords("248df4b7-aa70-47b8-a036-33ac447e668d", "public.users")
|
|
59
|
+
*/
|
|
60
|
+
getRecords(id: string, schemaId: string, requestOptions?: Schemas.RequestOptions): Promise<Polytomic.SchemaRecordsResponseEnvelope>;
|
|
61
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
29
62
|
}
|
|
@@ -45,29 +45,93 @@ const Polytomic = __importStar(require("../../.."));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class Schemas {
|
|
48
|
-
constructor(_options
|
|
48
|
+
constructor(_options) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
52
53
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
54
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
55
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
53
56
|
*
|
|
54
57
|
* @example
|
|
55
|
-
* await polytomic.schemas.
|
|
58
|
+
* await polytomic.schemas.refresh("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
56
59
|
*/
|
|
57
|
-
|
|
60
|
+
refresh(id, requestOptions) {
|
|
58
61
|
var _a;
|
|
59
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
63
|
const _response = yield core.fetcher({
|
|
61
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/connections/${
|
|
64
|
+
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}/schemas/refresh`),
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
68
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
69
|
+
"X-Fern-Language": "JavaScript",
|
|
70
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
71
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
72
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
73
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
74
|
+
},
|
|
75
|
+
contentType: "application/json",
|
|
76
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
77
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
78
|
+
});
|
|
79
|
+
if (_response.ok) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (_response.error.reason === "status-code") {
|
|
83
|
+
switch (_response.error.statusCode) {
|
|
84
|
+
case 400:
|
|
85
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
86
|
+
case 401:
|
|
87
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
88
|
+
case 404:
|
|
89
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
90
|
+
case 500:
|
|
91
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
92
|
+
default:
|
|
93
|
+
throw new errors.PolytomicError({
|
|
94
|
+
statusCode: _response.error.statusCode,
|
|
95
|
+
body: _response.error.body,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
switch (_response.error.reason) {
|
|
100
|
+
case "non-json":
|
|
101
|
+
throw new errors.PolytomicError({
|
|
102
|
+
statusCode: _response.error.statusCode,
|
|
103
|
+
body: _response.error.rawBody,
|
|
104
|
+
});
|
|
105
|
+
case "timeout":
|
|
106
|
+
throw new errors.PolytomicTimeoutError();
|
|
107
|
+
case "unknown":
|
|
108
|
+
throw new errors.PolytomicError({
|
|
109
|
+
message: _response.error.errorMessage,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
116
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
117
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
118
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* await polytomic.schemas.getStatus("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
122
|
+
*/
|
|
123
|
+
getStatus(id, requestOptions) {
|
|
124
|
+
var _a;
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const _response = yield core.fetcher({
|
|
127
|
+
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}/schemas/status`),
|
|
62
128
|
method: "GET",
|
|
63
129
|
headers: {
|
|
64
130
|
Authorization: yield this._getAuthorizationHeader(),
|
|
65
|
-
"X-Polytomic-Version":
|
|
66
|
-
? yield core.Supplier.get(this._options.xPolytomicVersion)
|
|
67
|
-
: undefined,
|
|
131
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
68
132
|
"X-Fern-Language": "JavaScript",
|
|
69
133
|
"X-Fern-SDK-Name": "polytomic",
|
|
70
|
-
"X-Fern-SDK-Version": "0.
|
|
134
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
71
135
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
72
136
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
73
137
|
},
|
|
@@ -80,8 +144,14 @@ class Schemas {
|
|
|
80
144
|
}
|
|
81
145
|
if (_response.error.reason === "status-code") {
|
|
82
146
|
switch (_response.error.statusCode) {
|
|
147
|
+
case 400:
|
|
148
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
83
149
|
case 401:
|
|
84
150
|
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
151
|
+
case 404:
|
|
152
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
153
|
+
case 500:
|
|
154
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
85
155
|
default:
|
|
86
156
|
throw new errors.PolytomicError({
|
|
87
157
|
statusCode: _response.error.statusCode,
|
|
@@ -104,13 +174,138 @@ class Schemas {
|
|
|
104
174
|
}
|
|
105
175
|
});
|
|
106
176
|
}
|
|
107
|
-
|
|
177
|
+
/**
|
|
178
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
179
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
180
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
181
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* await polytomic.schemas.get("248df4b7-aa70-47b8-a036-33ac447e668d", "public.users")
|
|
185
|
+
*/
|
|
186
|
+
get(id, schemaId, requestOptions) {
|
|
187
|
+
var _a;
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
const _response = yield core.fetcher({
|
|
190
|
+
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}/schemas/${schemaId}`),
|
|
191
|
+
method: "GET",
|
|
192
|
+
headers: {
|
|
193
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
194
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
195
|
+
"X-Fern-Language": "JavaScript",
|
|
196
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
197
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
198
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
199
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
200
|
+
},
|
|
201
|
+
contentType: "application/json",
|
|
202
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
203
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
204
|
+
});
|
|
205
|
+
if (_response.ok) {
|
|
206
|
+
return _response.body;
|
|
207
|
+
}
|
|
208
|
+
if (_response.error.reason === "status-code") {
|
|
209
|
+
switch (_response.error.statusCode) {
|
|
210
|
+
case 400:
|
|
211
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
212
|
+
case 401:
|
|
213
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
214
|
+
case 404:
|
|
215
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
216
|
+
case 500:
|
|
217
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
218
|
+
default:
|
|
219
|
+
throw new errors.PolytomicError({
|
|
220
|
+
statusCode: _response.error.statusCode,
|
|
221
|
+
body: _response.error.body,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
switch (_response.error.reason) {
|
|
226
|
+
case "non-json":
|
|
227
|
+
throw new errors.PolytomicError({
|
|
228
|
+
statusCode: _response.error.statusCode,
|
|
229
|
+
body: _response.error.rawBody,
|
|
230
|
+
});
|
|
231
|
+
case "timeout":
|
|
232
|
+
throw new errors.PolytomicTimeoutError();
|
|
233
|
+
case "unknown":
|
|
234
|
+
throw new errors.PolytomicError({
|
|
235
|
+
message: _response.error.errorMessage,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
242
|
+
* @throws {@link Polytomic.UnauthorizedError}
|
|
243
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
244
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
245
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* await polytomic.schemas.getRecords("248df4b7-aa70-47b8-a036-33ac447e668d", "public.users")
|
|
249
|
+
*/
|
|
250
|
+
getRecords(id, schemaId, requestOptions) {
|
|
251
|
+
var _a;
|
|
108
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
253
|
+
const _response = yield core.fetcher({
|
|
254
|
+
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}/schemas/${schemaId}/records`),
|
|
255
|
+
method: "GET",
|
|
256
|
+
headers: {
|
|
257
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
258
|
+
"X-Polytomic-Version": "2024-02-08",
|
|
259
|
+
"X-Fern-Language": "JavaScript",
|
|
260
|
+
"X-Fern-SDK-Name": "polytomic",
|
|
261
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
262
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
263
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
264
|
+
},
|
|
265
|
+
contentType: "application/json",
|
|
266
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
267
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
268
|
+
});
|
|
269
|
+
if (_response.ok) {
|
|
270
|
+
return _response.body;
|
|
271
|
+
}
|
|
272
|
+
if (_response.error.reason === "status-code") {
|
|
273
|
+
switch (_response.error.statusCode) {
|
|
274
|
+
case 400:
|
|
275
|
+
throw new Polytomic.BadRequestError(_response.error.body);
|
|
276
|
+
case 401:
|
|
277
|
+
throw new Polytomic.UnauthorizedError(_response.error.body);
|
|
278
|
+
case 403:
|
|
279
|
+
throw new Polytomic.ForbiddenError(_response.error.body);
|
|
280
|
+
case 404:
|
|
281
|
+
throw new Polytomic.NotFoundError(_response.error.body);
|
|
282
|
+
case 500:
|
|
283
|
+
throw new Polytomic.InternalServerError(_response.error.body);
|
|
284
|
+
default:
|
|
285
|
+
throw new errors.PolytomicError({
|
|
286
|
+
statusCode: _response.error.statusCode,
|
|
287
|
+
body: _response.error.body,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
switch (_response.error.reason) {
|
|
292
|
+
case "non-json":
|
|
293
|
+
throw new errors.PolytomicError({
|
|
294
|
+
statusCode: _response.error.statusCode,
|
|
295
|
+
body: _response.error.rawBody,
|
|
296
|
+
});
|
|
297
|
+
case "timeout":
|
|
298
|
+
throw new errors.PolytomicTimeoutError();
|
|
299
|
+
case "unknown":
|
|
300
|
+
throw new errors.PolytomicError({
|
|
301
|
+
message: _response.error.errorMessage,
|
|
302
|
+
});
|
|
112
303
|
}
|
|
113
|
-
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
_getAuthorizationHeader() {
|
|
307
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
114
309
|
});
|
|
115
310
|
}
|
|
116
311
|
}
|
|
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
|
|
|
7
7
|
export declare namespace Users {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.PolytomicEnvironment | string>;
|
|
10
|
-
token
|
|
11
|
-
xPolytomicVersion?: core.Supplier<"2023-04-25" | undefined>;
|
|
10
|
+
token: core.Supplier<core.BearerToken>;
|
|
12
11
|
}
|
|
13
12
|
interface RequestOptions {
|
|
14
13
|
timeoutInSeconds?: number;
|
|
@@ -17,12 +16,13 @@ export declare namespace Users {
|
|
|
17
16
|
}
|
|
18
17
|
export declare class Users {
|
|
19
18
|
protected readonly _options: Users.Options;
|
|
20
|
-
constructor(_options
|
|
19
|
+
constructor(_options: Users.Options);
|
|
21
20
|
/**
|
|
22
21
|
* > 🚧 Requires partner key
|
|
23
22
|
* >
|
|
24
23
|
* > User endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
25
24
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
25
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* await polytomic.users.list("248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -33,6 +33,8 @@ export declare class Users {
|
|
|
33
33
|
* >
|
|
34
34
|
* > User endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
35
35
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
36
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
37
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
36
38
|
*
|
|
37
39
|
* @example
|
|
38
40
|
* await polytomic.users.create("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
@@ -46,6 +48,8 @@ export declare class Users {
|
|
|
46
48
|
* >
|
|
47
49
|
* > User endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
48
50
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
51
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
52
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
49
53
|
*
|
|
50
54
|
* @example
|
|
51
55
|
* await polytomic.users.get("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
@@ -56,29 +60,35 @@ export declare class Users {
|
|
|
56
60
|
* >
|
|
57
61
|
* > User endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
58
62
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
63
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
64
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
59
65
|
*
|
|
60
66
|
* @example
|
|
61
|
-
* await polytomic.users.
|
|
67
|
+
* await polytomic.users.update("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
68
|
+
* email: "mail@example.com",
|
|
69
|
+
* role: "admin"
|
|
70
|
+
* })
|
|
62
71
|
*/
|
|
63
|
-
|
|
72
|
+
update(id: string, orgId: string, request: Polytomic.UpdateUserRequestSchema, requestOptions?: Users.RequestOptions): Promise<Polytomic.UserEnvelope>;
|
|
64
73
|
/**
|
|
65
74
|
* > 🚧 Requires partner key
|
|
66
75
|
* >
|
|
67
76
|
* > User endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
68
77
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
78
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
79
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
69
80
|
*
|
|
70
81
|
* @example
|
|
71
|
-
* await polytomic.users.
|
|
72
|
-
* email: "mail@example.com",
|
|
73
|
-
* role: "admin"
|
|
74
|
-
* })
|
|
82
|
+
* await polytomic.users.remove("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
75
83
|
*/
|
|
76
|
-
|
|
84
|
+
remove(id: string, orgId: string, requestOptions?: Users.RequestOptions): Promise<Polytomic.UserEnvelope>;
|
|
77
85
|
/**
|
|
78
86
|
* > 🚧 Requires partner key
|
|
79
87
|
* >
|
|
80
88
|
* > User endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
|
|
81
89
|
* @throws {@link Polytomic.UnauthorizedError}
|
|
90
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
91
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
82
92
|
*
|
|
83
93
|
* @example
|
|
84
94
|
* await polytomic.users.createApiKey("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
@@ -86,5 +96,5 @@ export declare class Users {
|
|
|
86
96
|
* })
|
|
87
97
|
*/
|
|
88
98
|
createApiKey(orgId: string, id: string, request?: Polytomic.UsersCreateApiKeyRequest, requestOptions?: Users.RequestOptions): Promise<Polytomic.ApiKeyResponseEnvelope>;
|
|
89
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
99
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
90
100
|
}
|