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.
Files changed (187) hide show
  1. package/Client.d.ts +8 -6
  2. package/Client.js +27 -22
  3. package/api/errors/BadRequestError.d.ts +8 -0
  4. package/api/errors/BadRequestError.js +41 -0
  5. package/api/errors/ForbiddenError.d.ts +8 -0
  6. package/api/errors/ForbiddenError.js +41 -0
  7. package/api/errors/InternalServerError.d.ts +8 -0
  8. package/api/errors/InternalServerError.js +41 -0
  9. package/api/errors/NotFoundError.d.ts +8 -0
  10. package/api/errors/NotFoundError.js +41 -0
  11. package/api/errors/UnprocessableEntityError.d.ts +8 -0
  12. package/api/errors/UnprocessableEntityError.js +41 -0
  13. package/api/errors/index.d.ts +5 -0
  14. package/api/errors/index.js +5 -0
  15. package/api/resources/bulkSync/client/Client.d.ts +78 -47
  16. package/api/resources/bulkSync/client/Client.js +188 -183
  17. package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
  18. package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
  19. package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
  20. package/api/resources/bulkSync/client/requests/index.d.ts +3 -2
  21. package/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
  22. package/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
  23. package/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
  24. package/api/resources/bulkSync/resources/executions/client/index.js +0 -15
  25. package/api/resources/bulkSync/resources/index.d.ts +0 -1
  26. package/api/resources/bulkSync/resources/index.js +0 -1
  27. package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
  28. package/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
  29. package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
  30. package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
  31. package/api/resources/connections/client/Client.d.ts +43 -45
  32. package/api/resources/connections/client/Client.js +116 -294
  33. package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
  34. package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
  35. package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
  36. package/api/resources/connections/client/requests/index.d.ts +2 -4
  37. package/api/resources/events/client/Client.d.ts +9 -8
  38. package/api/resources/events/client/Client.js +16 -18
  39. package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
  40. package/api/resources/events/client/requests/index.d.ts +1 -1
  41. package/api/resources/identity/client/Client.d.ts +29 -0
  42. package/api/resources/identity/client/Client.js +114 -0
  43. package/api/resources/identity/client/index.d.ts +1 -0
  44. package/api/resources/identity/index.d.ts +1 -0
  45. package/api/resources/identity/index.js +17 -0
  46. package/api/resources/index.d.ts +3 -2
  47. package/api/resources/index.js +4 -3
  48. package/api/resources/jobs/client/Client.d.ts +6 -4
  49. package/api/resources/jobs/client/Client.js +13 -10
  50. package/api/resources/modelSync/client/Client.d.ts +82 -11
  51. package/api/resources/modelSync/client/Client.js +421 -79
  52. package/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
  53. package/{dist/api/resources/connections/client/requests/TargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
  54. package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
  55. package/api/resources/modelSync/client/requests/index.d.ts +3 -0
  56. package/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
  57. package/api/resources/modelSync/resources/executions/client/Client.js +43 -476
  58. package/api/resources/models/client/Client.d.ts +22 -11
  59. package/api/resources/models/client/Client.js +68 -46
  60. package/api/resources/organization/client/Client.d.ts +21 -14
  61. package/api/resources/organization/client/Client.js +52 -42
  62. package/api/resources/permissions/client/Client.d.ts +2 -3
  63. package/api/resources/permissions/client/Client.js +1 -1
  64. package/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
  65. package/api/resources/permissions/resources/policies/client/Client.js +69 -41
  66. package/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
  67. package/api/resources/permissions/resources/roles/client/Client.js +62 -37
  68. package/api/resources/schemas/client/Client.d.ts +39 -6
  69. package/api/resources/schemas/client/Client.js +208 -13
  70. package/api/resources/users/client/Client.d.ts +21 -11
  71. package/api/resources/users/client/Client.js +57 -40
  72. package/api/resources/webhooks/client/Client.d.ts +18 -11
  73. package/api/resources/webhooks/client/Client.js +53 -43
  74. package/api/types/ApiError.d.ts +8 -0
  75. package/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
  76. package/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
  77. package/api/types/SourceMeta.d.ts +8 -0
  78. package/api/types/SourceMeta.js +5 -0
  79. package/api/types/index.d.ts +4 -0
  80. package/api/types/index.js +4 -0
  81. package/dist/Client.d.ts +8 -6
  82. package/dist/Client.js +27 -22
  83. package/dist/api/errors/BadRequestError.d.ts +8 -0
  84. package/dist/api/errors/BadRequestError.js +41 -0
  85. package/dist/api/errors/ForbiddenError.d.ts +8 -0
  86. package/dist/api/errors/ForbiddenError.js +41 -0
  87. package/dist/api/errors/InternalServerError.d.ts +8 -0
  88. package/dist/api/errors/InternalServerError.js +41 -0
  89. package/dist/api/errors/NotFoundError.d.ts +8 -0
  90. package/dist/api/errors/NotFoundError.js +41 -0
  91. package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
  92. package/dist/api/errors/UnprocessableEntityError.js +41 -0
  93. package/dist/api/errors/index.d.ts +5 -0
  94. package/dist/api/errors/index.js +5 -0
  95. package/dist/api/resources/bulkSync/client/Client.d.ts +78 -47
  96. package/dist/api/resources/bulkSync/client/Client.js +188 -183
  97. package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
  98. package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
  99. package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
  100. package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
  101. package/dist/api/resources/bulkSync/client/requests/index.d.ts +3 -2
  102. package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
  103. package/dist/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
  104. package/dist/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
  105. package/dist/api/resources/bulkSync/resources/executions/client/index.js +0 -15
  106. package/dist/api/resources/bulkSync/resources/index.d.ts +0 -1
  107. package/dist/api/resources/bulkSync/resources/index.js +0 -1
  108. package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
  109. package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
  110. package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
  111. package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js +5 -0
  112. package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
  113. package/dist/api/resources/connections/client/Client.d.ts +43 -45
  114. package/dist/api/resources/connections/client/Client.js +116 -294
  115. package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
  116. package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
  117. package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
  118. package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
  119. package/dist/api/resources/connections/client/requests/index.d.ts +2 -4
  120. package/dist/api/resources/events/client/Client.d.ts +9 -8
  121. package/dist/api/resources/events/client/Client.js +16 -18
  122. package/{api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → dist/api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
  123. package/dist/api/resources/events/client/requests/EventsListRequest.js +5 -0
  124. package/dist/api/resources/events/client/requests/index.d.ts +1 -1
  125. package/dist/api/resources/identity/client/Client.d.ts +29 -0
  126. package/dist/api/resources/identity/client/Client.js +114 -0
  127. package/dist/api/resources/identity/client/index.d.ts +1 -0
  128. package/dist/api/resources/identity/index.d.ts +1 -0
  129. package/dist/api/resources/identity/index.js +17 -0
  130. package/dist/api/resources/index.d.ts +3 -2
  131. package/dist/api/resources/index.js +4 -3
  132. package/dist/api/resources/jobs/client/Client.d.ts +6 -4
  133. package/dist/api/resources/jobs/client/Client.js +13 -10
  134. package/dist/api/resources/modelSync/client/Client.d.ts +82 -11
  135. package/dist/api/resources/modelSync/client/Client.js +421 -79
  136. package/dist/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
  137. package/dist/api/resources/modelSync/client/requests/ModelSyncGetSourceRequest.js +5 -0
  138. package/{api/resources/connections/client/requests/TargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
  139. package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js +5 -0
  140. package/{api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
  141. package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js +5 -0
  142. package/dist/api/resources/modelSync/client/requests/index.d.ts +3 -0
  143. package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
  144. package/dist/api/resources/modelSync/resources/executions/client/Client.js +43 -476
  145. package/dist/api/resources/models/client/Client.d.ts +22 -11
  146. package/dist/api/resources/models/client/Client.js +68 -46
  147. package/dist/api/resources/organization/client/Client.d.ts +21 -14
  148. package/dist/api/resources/organization/client/Client.js +52 -42
  149. package/dist/api/resources/permissions/client/Client.d.ts +2 -3
  150. package/dist/api/resources/permissions/client/Client.js +1 -1
  151. package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
  152. package/dist/api/resources/permissions/resources/policies/client/Client.js +69 -41
  153. package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
  154. package/dist/api/resources/permissions/resources/roles/client/Client.js +62 -37
  155. package/dist/api/resources/schemas/client/Client.d.ts +39 -6
  156. package/dist/api/resources/schemas/client/Client.js +208 -13
  157. package/dist/api/resources/users/client/Client.d.ts +21 -11
  158. package/dist/api/resources/users/client/Client.js +57 -40
  159. package/dist/api/resources/webhooks/client/Client.d.ts +18 -11
  160. package/dist/api/resources/webhooks/client/Client.js +53 -43
  161. package/dist/api/types/ApiError.d.ts +8 -0
  162. package/dist/api/types/ApiError.js +5 -0
  163. package/dist/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
  164. package/dist/api/types/GetModelSyncSourceMetaEnvelope.js +5 -0
  165. package/dist/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
  166. package/dist/api/types/ModelSyncSourceMetaResponse.js +5 -0
  167. package/dist/api/types/SourceMeta.d.ts +8 -0
  168. package/dist/api/types/SourceMeta.js +5 -0
  169. package/dist/api/types/index.d.ts +4 -0
  170. package/dist/api/types/index.js +4 -0
  171. package/package.json +1 -1
  172. package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
  173. package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
  174. /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
  175. /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.js +0 -0
  176. /package/api/resources/{connections/client/requests/ConnectionsGetTargetRequest.js → bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js} +0 -0
  177. /package/api/resources/connections/client/requests/{ModelFieldsRequest.js → ConnectCardRequest.js} +0 -0
  178. /package/api/resources/{connections/client/requests/TargetRequest.js → events/client/requests/EventsListRequest.js} +0 -0
  179. /package/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
  180. /package/api/resources/{events/client/requests/EventsApiV2GetEventsRequest.js → modelSync/client/requests/ModelSyncGetSourceRequest.js} +0 -0
  181. /package/{dist/api/resources/bulkSync/resources/executions/client/requests/StartBulkSyncRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js} +0 -0
  182. /package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js} +0 -0
  183. /package/{dist/api/resources/connections/client/requests/ModelFieldsRequest.js → api/types/ApiError.js} +0 -0
  184. /package/{dist/api/resources/connections/client/requests/TargetRequest.js → api/types/GetModelSyncSourceMetaEnvelope.js} +0 -0
  185. /package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.js → api/types/ModelSyncSourceMetaResponse.js} +0 -0
  186. /package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
  187. /package/dist/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
@@ -4,9 +4,9 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * name: "My Connection",
7
+ * name: "My Postgres Connection",
8
8
  * redirect_url: "https://example.com/oauth_redirect",
9
- * type: "s3",
9
+ * type: "postgresql",
10
10
  * validate: true
11
11
  * }
12
12
  */
@@ -4,9 +4,9 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * name: "My Connection",
7
+ * name: "My Postgres Connection",
8
8
  * reconnect: false,
9
- * type: "s3",
9
+ * type: "postgresql",
10
10
  * validate: true
11
11
  * }
12
12
  */
@@ -1,6 +1,4 @@
1
1
  export { CreateConnectionRequestSchema } from "./CreateConnectionRequestSchema";
2
- export { ConnectionsRemoveRequest } from "./ConnectionsRemoveRequest";
2
+ export { ConnectCardRequest } from "./ConnectCardRequest";
3
3
  export { UpdateConnectionRequestSchema } from "./UpdateConnectionRequestSchema";
4
- export { ModelFieldsRequest } from "./ModelFieldsRequest";
5
- export { ConnectionsGetTargetRequest } from "./ConnectionsGetTargetRequest";
6
- export { TargetRequest } from "./TargetRequest";
4
+ export { ConnectionsRemoveRequest } from "./ConnectionsRemoveRequest";
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
7
7
  export declare namespace Events {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.PolytomicEnvironment | string>;
10
- token?: core.Supplier<core.BearerToken | undefined>;
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,24 +16,26 @@ export declare namespace Events {
17
16
  }
18
17
  export declare class Events {
19
18
  protected readonly _options: Events.Options;
20
- constructor(_options?: Events.Options);
19
+ constructor(_options: Events.Options);
21
20
  /**
22
21
  * @throws {@link Polytomic.UnauthorizedError}
22
+ * @throws {@link Polytomic.UnprocessableEntityError}
23
+ * @throws {@link Polytomic.InternalServerError}
23
24
  *
24
25
  * @example
25
- * await polytomic.events.apiV2GetEvents({
26
+ * await polytomic.events.list({
26
27
  * organization_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
27
28
  * starting_after: new Date("2020-01-01T00:00:00.000Z"),
28
29
  * ending_before: new Date("2020-01-01T00:00:00.000Z")
29
30
  * })
30
31
  */
31
- apiV2GetEvents(request?: Polytomic.EventsApiV2GetEventsRequest, requestOptions?: Events.RequestOptions): Promise<Polytomic.EventsEnvelope>;
32
+ list(request?: Polytomic.EventsListRequest, requestOptions?: Events.RequestOptions): Promise<Polytomic.EventsEnvelope>;
32
33
  /**
33
34
  * @throws {@link Polytomic.UnauthorizedError}
34
35
  *
35
36
  * @example
36
- * await polytomic.events.apiV2GetEventTypes()
37
+ * await polytomic.events.getTypes()
37
38
  */
38
- apiV2GetEventTypes(requestOptions?: Events.RequestOptions): Promise<Polytomic.EventTypesEnvelope>;
39
- protected _getAuthorizationHeader(): Promise<string | undefined>;
39
+ getTypes(requestOptions?: Events.RequestOptions): Promise<Polytomic.EventTypesEnvelope>;
40
+ protected _getAuthorizationHeader(): Promise<string>;
40
41
  }
@@ -45,20 +45,22 @@ const Polytomic = __importStar(require("../../.."));
45
45
  const url_join_1 = __importDefault(require("url-join"));
46
46
  const errors = __importStar(require("../../../../errors"));
47
47
  class Events {
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.UnprocessableEntityError}
54
+ * @throws {@link Polytomic.InternalServerError}
53
55
  *
54
56
  * @example
55
- * await polytomic.events.apiV2GetEvents({
57
+ * await polytomic.events.list({
56
58
  * organization_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
57
59
  * starting_after: new Date("2020-01-01T00:00:00.000Z"),
58
60
  * ending_before: new Date("2020-01-01T00:00:00.000Z")
59
61
  * })
60
62
  */
61
- apiV2GetEvents(request = {}, requestOptions) {
63
+ list(request = {}, requestOptions) {
62
64
  var _a;
63
65
  return __awaiter(this, void 0, void 0, function* () {
64
66
  const { organization_id: organizationId, type: type_, starting_after: startingAfter, ending_before: endingBefore, limit, } = request;
@@ -83,12 +85,10 @@ class Events {
83
85
  method: "GET",
84
86
  headers: {
85
87
  Authorization: yield this._getAuthorizationHeader(),
86
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
87
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
88
- : undefined,
88
+ "X-Polytomic-Version": "2024-02-08",
89
89
  "X-Fern-Language": "JavaScript",
90
90
  "X-Fern-SDK-Name": "polytomic",
91
- "X-Fern-SDK-Version": "0.1.2",
91
+ "X-Fern-SDK-Version": "0.2.0",
92
92
  "X-Fern-Runtime": core.RUNTIME.type,
93
93
  "X-Fern-Runtime-Version": core.RUNTIME.version,
94
94
  },
@@ -104,6 +104,10 @@ class Events {
104
104
  switch (_response.error.statusCode) {
105
105
  case 401:
106
106
  throw new Polytomic.UnauthorizedError(_response.error.body);
107
+ case 422:
108
+ throw new Polytomic.UnprocessableEntityError(_response.error.body);
109
+ case 500:
110
+ throw new Polytomic.InternalServerError(_response.error.body);
107
111
  default:
108
112
  throw new errors.PolytomicError({
109
113
  statusCode: _response.error.statusCode,
@@ -130,9 +134,9 @@ class Events {
130
134
  * @throws {@link Polytomic.UnauthorizedError}
131
135
  *
132
136
  * @example
133
- * await polytomic.events.apiV2GetEventTypes()
137
+ * await polytomic.events.getTypes()
134
138
  */
135
- apiV2GetEventTypes(requestOptions) {
139
+ getTypes(requestOptions) {
136
140
  var _a;
137
141
  return __awaiter(this, void 0, void 0, function* () {
138
142
  const _response = yield core.fetcher({
@@ -140,12 +144,10 @@ class Events {
140
144
  method: "GET",
141
145
  headers: {
142
146
  Authorization: yield this._getAuthorizationHeader(),
143
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
144
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
145
- : undefined,
147
+ "X-Polytomic-Version": "2024-02-08",
146
148
  "X-Fern-Language": "JavaScript",
147
149
  "X-Fern-SDK-Name": "polytomic",
148
- "X-Fern-SDK-Version": "0.1.2",
150
+ "X-Fern-SDK-Version": "0.2.0",
149
151
  "X-Fern-Runtime": core.RUNTIME.type,
150
152
  "X-Fern-Runtime-Version": core.RUNTIME.version,
151
153
  },
@@ -184,11 +186,7 @@ class Events {
184
186
  }
185
187
  _getAuthorizationHeader() {
186
188
  return __awaiter(this, void 0, void 0, function* () {
187
- const bearer = yield core.Supplier.get(this._options.token);
188
- if (bearer != null) {
189
- return `Bearer ${bearer}`;
190
- }
191
- return undefined;
189
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
192
190
  });
193
191
  }
194
192
  }
@@ -9,7 +9,7 @@
9
9
  * ending_before: new Date("2020-01-01T00:00:00.000Z")
10
10
  * }
11
11
  */
12
- export interface EventsApiV2GetEventsRequest {
12
+ export interface EventsListRequest {
13
13
  organization_id?: string;
14
14
  type?: string;
15
15
  starting_after?: string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1 @@
1
- export { EventsApiV2GetEventsRequest } from "./EventsApiV2GetEventsRequest";
1
+ export { EventsListRequest } from "./EventsListRequest";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments";
5
+ import * as core from "../../../../core";
6
+ import * as Polytomic from "../../..";
7
+ export declare namespace Identity {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.PolytomicEnvironment | string>;
10
+ token: core.Supplier<core.BearerToken>;
11
+ }
12
+ interface RequestOptions {
13
+ timeoutInSeconds?: number;
14
+ maxRetries?: number;
15
+ }
16
+ }
17
+ export declare class Identity {
18
+ protected readonly _options: Identity.Options;
19
+ constructor(_options: Identity.Options);
20
+ /**
21
+ * @throws {@link Polytomic.UnauthorizedError}
22
+ * @throws {@link Polytomic.InternalServerError}
23
+ *
24
+ * @example
25
+ * await polytomic.identity.get()
26
+ */
27
+ get(requestOptions?: Identity.RequestOptions): Promise<Polytomic.GetIdentityResponseEnvelope>;
28
+ protected _getAuthorizationHeader(): Promise<string>;
29
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.Identity = void 0;
42
+ const environments = __importStar(require("../../../../environments"));
43
+ const core = __importStar(require("../../../../core"));
44
+ const Polytomic = __importStar(require("../../.."));
45
+ const url_join_1 = __importDefault(require("url-join"));
46
+ const errors = __importStar(require("../../../../errors"));
47
+ class Identity {
48
+ constructor(_options) {
49
+ this._options = _options;
50
+ }
51
+ /**
52
+ * @throws {@link Polytomic.UnauthorizedError}
53
+ * @throws {@link Polytomic.InternalServerError}
54
+ *
55
+ * @example
56
+ * await polytomic.identity.get()
57
+ */
58
+ get(requestOptions) {
59
+ var _a;
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const _response = yield core.fetcher({
62
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, "api/me"),
63
+ method: "GET",
64
+ headers: {
65
+ Authorization: yield this._getAuthorizationHeader(),
66
+ "X-Polytomic-Version": "2024-02-08",
67
+ "X-Fern-Language": "JavaScript",
68
+ "X-Fern-SDK-Name": "polytomic",
69
+ "X-Fern-SDK-Version": "0.2.0",
70
+ "X-Fern-Runtime": core.RUNTIME.type,
71
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
72
+ },
73
+ contentType: "application/json",
74
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
75
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
76
+ });
77
+ if (_response.ok) {
78
+ return _response.body;
79
+ }
80
+ if (_response.error.reason === "status-code") {
81
+ switch (_response.error.statusCode) {
82
+ case 401:
83
+ throw new Polytomic.UnauthorizedError(_response.error.body);
84
+ case 500:
85
+ throw new Polytomic.InternalServerError(_response.error.body);
86
+ default:
87
+ throw new errors.PolytomicError({
88
+ statusCode: _response.error.statusCode,
89
+ body: _response.error.body,
90
+ });
91
+ }
92
+ }
93
+ switch (_response.error.reason) {
94
+ case "non-json":
95
+ throw new errors.PolytomicError({
96
+ statusCode: _response.error.statusCode,
97
+ body: _response.error.rawBody,
98
+ });
99
+ case "timeout":
100
+ throw new errors.PolytomicTimeoutError();
101
+ case "unknown":
102
+ throw new errors.PolytomicError({
103
+ message: _response.error.errorMessage,
104
+ });
105
+ }
106
+ });
107
+ }
108
+ _getAuthorizationHeader() {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
111
+ });
112
+ }
113
+ }
114
+ exports.Identity = Identity;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./client";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
@@ -1,19 +1,20 @@
1
1
  export * as bulkSync from "./bulkSync";
2
2
  export * as connections from "./connections";
3
+ export * as modelSync from "./modelSync";
3
4
  export * as schemas from "./schemas";
4
5
  export * as events from "./events";
5
6
  export * as jobs from "./jobs";
7
+ export * as identity from "./identity";
6
8
  export * as models from "./models";
7
9
  export * as organization from "./organization";
8
10
  export * as users from "./users";
9
11
  export * as permissions from "./permissions";
10
- export * as modelSync from "./modelSync";
11
12
  export * as webhooks from "./webhooks";
12
13
  export * from "./bulkSync/client/requests";
13
14
  export * from "./connections/client/requests";
15
+ export * from "./modelSync/client/requests";
14
16
  export * from "./events/client/requests";
15
17
  export * from "./models/client/requests";
16
18
  export * from "./organization/client/requests";
17
19
  export * from "./users/client/requests";
18
- export * from "./modelSync/client/requests";
19
20
  export * from "./webhooks/client/requests";
@@ -26,23 +26,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.webhooks = exports.modelSync = exports.permissions = exports.users = exports.organization = exports.models = exports.jobs = exports.events = exports.schemas = exports.connections = exports.bulkSync = void 0;
29
+ exports.webhooks = exports.permissions = exports.users = exports.organization = exports.models = exports.identity = exports.jobs = exports.events = exports.schemas = exports.modelSync = exports.connections = exports.bulkSync = void 0;
30
30
  exports.bulkSync = __importStar(require("./bulkSync"));
31
31
  exports.connections = __importStar(require("./connections"));
32
+ exports.modelSync = __importStar(require("./modelSync"));
32
33
  exports.schemas = __importStar(require("./schemas"));
33
34
  exports.events = __importStar(require("./events"));
34
35
  exports.jobs = __importStar(require("./jobs"));
36
+ exports.identity = __importStar(require("./identity"));
35
37
  exports.models = __importStar(require("./models"));
36
38
  exports.organization = __importStar(require("./organization"));
37
39
  exports.users = __importStar(require("./users"));
38
40
  exports.permissions = __importStar(require("./permissions"));
39
- exports.modelSync = __importStar(require("./modelSync"));
40
41
  exports.webhooks = __importStar(require("./webhooks"));
41
42
  __exportStar(require("./bulkSync/client/requests"), exports);
42
43
  __exportStar(require("./connections/client/requests"), exports);
44
+ __exportStar(require("./modelSync/client/requests"), exports);
43
45
  __exportStar(require("./events/client/requests"), exports);
44
46
  __exportStar(require("./models/client/requests"), exports);
45
47
  __exportStar(require("./organization/client/requests"), exports);
46
48
  __exportStar(require("./users/client/requests"), exports);
47
- __exportStar(require("./modelSync/client/requests"), exports);
48
49
  __exportStar(require("./webhooks/client/requests"), exports);
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
7
7
  export declare namespace Jobs {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.PolytomicEnvironment | string>;
10
- token?: core.Supplier<core.BearerToken | undefined>;
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,16 @@ export declare namespace Jobs {
17
16
  }
18
17
  export declare class Jobs {
19
18
  protected readonly _options: Jobs.Options;
20
- constructor(_options?: Jobs.Options);
19
+ constructor(_options: Jobs.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
27
  * await polytomic.jobs.get("248df4b7-aa70-47b8-a036-33ac447e668d", "createmodel")
26
28
  */
27
29
  get(id: string, type: string, requestOptions?: Jobs.RequestOptions): Promise<Polytomic.JobResponseEnvelope>;
28
- protected _getAuthorizationHeader(): Promise<string | undefined>;
30
+ protected _getAuthorizationHeader(): Promise<string>;
29
31
  }
@@ -45,11 +45,14 @@ const Polytomic = __importStar(require("../../.."));
45
45
  const url_join_1 = __importDefault(require("url-join"));
46
46
  const errors = __importStar(require("../../../../errors"));
47
47
  class Jobs {
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
58
  * await polytomic.jobs.get("248df4b7-aa70-47b8-a036-33ac447e668d", "createmodel")
@@ -62,12 +65,10 @@ class Jobs {
62
65
  method: "GET",
63
66
  headers: {
64
67
  Authorization: yield this._getAuthorizationHeader(),
65
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
66
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
67
- : undefined,
68
+ "X-Polytomic-Version": "2024-02-08",
68
69
  "X-Fern-Language": "JavaScript",
69
70
  "X-Fern-SDK-Name": "polytomic",
70
- "X-Fern-SDK-Version": "0.1.2",
71
+ "X-Fern-SDK-Version": "0.2.0",
71
72
  "X-Fern-Runtime": core.RUNTIME.type,
72
73
  "X-Fern-Runtime-Version": core.RUNTIME.version,
73
74
  },
@@ -80,8 +81,14 @@ class Jobs {
80
81
  }
81
82
  if (_response.error.reason === "status-code") {
82
83
  switch (_response.error.statusCode) {
84
+ case 400:
85
+ throw new Polytomic.BadRequestError(_response.error.body);
83
86
  case 401:
84
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);
85
92
  default:
86
93
  throw new errors.PolytomicError({
87
94
  statusCode: _response.error.statusCode,
@@ -106,11 +113,7 @@ class Jobs {
106
113
  }
107
114
  _getAuthorizationHeader() {
108
115
  return __awaiter(this, void 0, void 0, function* () {
109
- const bearer = yield core.Supplier.get(this._options.token);
110
- if (bearer != null) {
111
- return `Bearer ${bearer}`;
112
- }
113
- return undefined;
116
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
114
117
  });
115
118
  }
116
119
  }