polytomic 1.0.0 → 1.3.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 (141) hide show
  1. package/Client.d.ts +3 -3
  2. package/Client.js +11 -11
  3. package/api/errors/index.d.ts +2 -2
  4. package/api/errors/index.js +2 -2
  5. package/api/resources/bulkSync/client/Client.js +10 -10
  6. package/api/resources/bulkSync/resources/executions/client/Client.js +2 -2
  7. package/api/resources/bulkSync/resources/schemas/client/Client.js +4 -4
  8. package/api/resources/connections/client/Client.js +8 -8
  9. package/api/resources/events/client/Client.js +2 -2
  10. package/api/resources/identity/client/Client.js +1 -1
  11. package/api/resources/index.d.ts +2 -2
  12. package/api/resources/index.js +3 -3
  13. package/api/resources/jobs/client/Client.js +1 -1
  14. package/api/resources/modelSync/client/Client.js +13 -13
  15. package/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +3 -0
  16. package/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +3 -0
  17. package/api/resources/modelSync/resources/executions/client/Client.js +4 -4
  18. package/api/resources/models/client/Client.d.ts +46 -7
  19. package/api/resources/models/client/Client.js +236 -12
  20. package/api/resources/models/client/requests/GetEnrichmentInputFieldsRequest.d.ts +11 -0
  21. package/api/resources/models/client/requests/ModelsCreateRequest.d.ts +17 -0
  22. package/api/resources/models/client/requests/ModelsGetRequest.d.ts +10 -0
  23. package/api/resources/models/client/requests/ModelsGetRequest.js +5 -0
  24. package/api/resources/models/client/requests/ModelsPreviewRequest.d.ts +17 -0
  25. package/api/resources/models/client/requests/ModelsPreviewRequest.js +5 -0
  26. package/api/resources/models/client/requests/ModelsRemoveRequest.d.ts +10 -0
  27. package/api/resources/models/client/requests/ModelsRemoveRequest.js +5 -0
  28. package/api/resources/models/client/requests/ModelsSampleRequest.d.ts +10 -0
  29. package/api/resources/models/client/requests/ModelsSampleRequest.js +5 -0
  30. package/api/resources/models/client/requests/UpdateModelRequest.d.ts +1 -0
  31. package/api/resources/models/client/requests/index.d.ts +6 -1
  32. package/api/resources/organization/client/Client.js +5 -5
  33. package/api/resources/permissions/resources/policies/client/Client.js +5 -5
  34. package/api/resources/permissions/resources/roles/client/Client.js +5 -5
  35. package/api/resources/schemas/client/Client.js +4 -4
  36. package/api/resources/users/client/Client.js +6 -6
  37. package/api/resources/webhooks/client/Client.js +5 -5
  38. package/api/types/ConnectionResponseSchema.d.ts +2 -0
  39. package/api/{resources/models/client/requests → types}/CreateModelRequest.d.ts +2 -9
  40. package/api/types/CreateModelRequest.js +5 -0
  41. package/api/types/Enrichment.d.ts +13 -0
  42. package/api/types/Enrichment.js +5 -0
  43. package/api/types/Filter.d.ts +9 -3
  44. package/api/types/FilterFieldReferenceType.d.ts +8 -0
  45. package/api/types/FilterFieldReferenceType.js +10 -0
  46. package/api/types/FilterFunction.d.ts +31 -0
  47. package/api/types/FilterFunction.js +33 -0
  48. package/api/types/Identity.d.ts +1 -1
  49. package/api/types/ModelField.d.ts +1 -0
  50. package/api/types/ModelResponse.d.ts +1 -0
  51. package/api/types/ModelSample.d.ts +8 -0
  52. package/api/types/ModelSample.js +5 -0
  53. package/api/types/ModelSampleResponseEnvelope.d.ts +8 -0
  54. package/api/types/ModelSampleResponseEnvelope.js +5 -0
  55. package/api/types/Override.d.ts +7 -1
  56. package/api/types/Schedule.d.ts +1 -1
  57. package/api/types/SchemaIdentityFunction.d.ts +9 -0
  58. package/api/types/SchemaIdentityFunction.js +11 -0
  59. package/api/types/V2EnricherConfiguration.d.ts +7 -0
  60. package/api/types/V2EnricherConfiguration.js +5 -0
  61. package/api/types/V2EnricherMapping.d.ts +7 -0
  62. package/api/types/V2EnricherMapping.js +5 -0
  63. package/api/types/V2GetEnrichmentInputFieldsResponseEnvelope.d.ts +6 -0
  64. package/api/types/V2GetEnrichmentInputFieldsResponseEnvelope.js +5 -0
  65. package/api/types/V2SampleRecord.d.ts +7 -0
  66. package/api/types/V2SampleRecord.js +5 -0
  67. package/api/types/index.d.ts +11 -0
  68. package/api/types/index.js +11 -0
  69. package/dist/Client.d.ts +3 -3
  70. package/dist/Client.js +11 -11
  71. package/dist/api/errors/index.d.ts +2 -2
  72. package/dist/api/errors/index.js +2 -2
  73. package/dist/api/resources/bulkSync/client/Client.js +10 -10
  74. package/dist/api/resources/bulkSync/resources/executions/client/Client.js +2 -2
  75. package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +4 -4
  76. package/dist/api/resources/connections/client/Client.js +8 -8
  77. package/dist/api/resources/events/client/Client.js +2 -2
  78. package/dist/api/resources/identity/client/Client.js +1 -1
  79. package/dist/api/resources/index.d.ts +2 -2
  80. package/dist/api/resources/index.js +3 -3
  81. package/dist/api/resources/jobs/client/Client.js +1 -1
  82. package/dist/api/resources/modelSync/client/Client.js +13 -13
  83. package/dist/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +3 -0
  84. package/dist/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +3 -0
  85. package/dist/api/resources/modelSync/resources/executions/client/Client.js +4 -4
  86. package/dist/api/resources/models/client/Client.d.ts +46 -7
  87. package/dist/api/resources/models/client/Client.js +236 -12
  88. package/dist/api/resources/models/client/requests/GetEnrichmentInputFieldsRequest.d.ts +11 -0
  89. package/dist/api/resources/models/client/requests/GetEnrichmentInputFieldsRequest.js +5 -0
  90. package/dist/api/resources/models/client/requests/ModelsCreateRequest.d.ts +17 -0
  91. package/dist/api/resources/models/client/requests/ModelsCreateRequest.js +5 -0
  92. package/dist/api/resources/models/client/requests/ModelsGetRequest.d.ts +10 -0
  93. package/dist/api/resources/models/client/requests/ModelsGetRequest.js +5 -0
  94. package/dist/api/resources/models/client/requests/ModelsPreviewRequest.d.ts +17 -0
  95. package/dist/api/resources/models/client/requests/ModelsPreviewRequest.js +5 -0
  96. package/dist/api/resources/models/client/requests/ModelsRemoveRequest.d.ts +10 -0
  97. package/dist/api/resources/models/client/requests/ModelsRemoveRequest.js +5 -0
  98. package/dist/api/resources/models/client/requests/ModelsSampleRequest.d.ts +10 -0
  99. package/dist/api/resources/models/client/requests/ModelsSampleRequest.js +5 -0
  100. package/dist/api/resources/models/client/requests/UpdateModelRequest.d.ts +1 -0
  101. package/dist/api/resources/models/client/requests/index.d.ts +6 -1
  102. package/dist/api/resources/organization/client/Client.js +5 -5
  103. package/dist/api/resources/permissions/resources/policies/client/Client.js +5 -5
  104. package/dist/api/resources/permissions/resources/roles/client/Client.js +5 -5
  105. package/dist/api/resources/schemas/client/Client.js +4 -4
  106. package/dist/api/resources/users/client/Client.js +6 -6
  107. package/dist/api/resources/webhooks/client/Client.js +5 -5
  108. package/dist/api/types/ConnectionResponseSchema.d.ts +2 -0
  109. package/dist/api/{resources/models/client/requests → types}/CreateModelRequest.d.ts +2 -9
  110. package/dist/api/types/CreateModelRequest.js +5 -0
  111. package/dist/api/types/Enrichment.d.ts +13 -0
  112. package/dist/api/types/Enrichment.js +5 -0
  113. package/dist/api/types/Filter.d.ts +9 -3
  114. package/dist/api/types/FilterFieldReferenceType.d.ts +8 -0
  115. package/dist/api/types/FilterFieldReferenceType.js +10 -0
  116. package/dist/api/types/FilterFunction.d.ts +31 -0
  117. package/dist/api/types/FilterFunction.js +33 -0
  118. package/dist/api/types/Identity.d.ts +1 -1
  119. package/dist/api/types/ModelField.d.ts +1 -0
  120. package/dist/api/types/ModelResponse.d.ts +1 -0
  121. package/dist/api/types/ModelSample.d.ts +8 -0
  122. package/dist/api/types/ModelSample.js +5 -0
  123. package/dist/api/types/ModelSampleResponseEnvelope.d.ts +8 -0
  124. package/dist/api/types/ModelSampleResponseEnvelope.js +5 -0
  125. package/dist/api/types/Override.d.ts +7 -1
  126. package/dist/api/types/Schedule.d.ts +1 -1
  127. package/dist/api/types/SchemaIdentityFunction.d.ts +9 -0
  128. package/dist/api/types/SchemaIdentityFunction.js +11 -0
  129. package/dist/api/types/V2EnricherConfiguration.d.ts +7 -0
  130. package/dist/api/types/V2EnricherConfiguration.js +5 -0
  131. package/dist/api/types/V2EnricherMapping.d.ts +7 -0
  132. package/dist/api/types/V2EnricherMapping.js +5 -0
  133. package/dist/api/types/V2GetEnrichmentInputFieldsResponseEnvelope.d.ts +6 -0
  134. package/dist/api/types/V2GetEnrichmentInputFieldsResponseEnvelope.js +5 -0
  135. package/dist/api/types/V2SampleRecord.d.ts +7 -0
  136. package/dist/api/types/V2SampleRecord.js +5 -0
  137. package/dist/api/types/index.d.ts +11 -0
  138. package/dist/api/types/index.js +11 -0
  139. package/package.json +1 -1
  140. /package/api/resources/models/client/requests/{CreateModelRequest.js → GetEnrichmentInputFieldsRequest.js} +0 -0
  141. /package/{dist/api/resources/models/client/requests/CreateModelRequest.js → api/resources/models/client/requests/ModelsCreateRequest.js} +0 -0
@@ -17,6 +17,32 @@ export declare namespace Models {
17
17
  export declare class Models {
18
18
  protected readonly _options: Models.Options;
19
19
  constructor(_options: Models.Options);
20
+ /**
21
+ * For a given connection and enrichment configuration, provides the valid sets of input fields.
22
+ * @throws {@link Polytomic.UnauthorizedError}
23
+ * @throws {@link Polytomic.ForbiddenError}
24
+ * @throws {@link Polytomic.NotFoundError}
25
+ * @throws {@link Polytomic.InternalServerError}
26
+ *
27
+ * @example
28
+ * await polytomic.models.post("248df4b7-aa70-47b8-a036-33ac447e668d", {})
29
+ */
30
+ post(connectionId: string, request?: Polytomic.GetEnrichmentInputFieldsRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.V2GetEnrichmentInputFieldsResponseEnvelope>;
31
+ /**
32
+ * @throws {@link Polytomic.BadRequestError}
33
+ * @throws {@link Polytomic.UnauthorizedError}
34
+ * @throws {@link Polytomic.NotFoundError}
35
+ * @throws {@link Polytomic.InternalServerError}
36
+ *
37
+ * @example
38
+ * await polytomic.models.preview({
39
+ * body: {
40
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
41
+ * name: "Users"
42
+ * }
43
+ * })
44
+ */
45
+ preview(request: Polytomic.ModelsPreviewRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
20
46
  /**
21
47
  * @throws {@link Polytomic.UnauthorizedError}
22
48
  * @throws {@link Polytomic.NotFoundError}
@@ -33,20 +59,22 @@ export declare class Models {
33
59
  *
34
60
  * @example
35
61
  * await polytomic.models.create({
36
- * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
37
- * name: "Users"
62
+ * body: {
63
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
64
+ * name: "Users"
65
+ * }
38
66
  * })
39
67
  */
40
- create(request: Polytomic.CreateModelRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
68
+ create(request: Polytomic.ModelsCreateRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
41
69
  /**
42
70
  * @throws {@link Polytomic.UnauthorizedError}
43
71
  * @throws {@link Polytomic.NotFoundError}
44
72
  * @throws {@link Polytomic.InternalServerError}
45
73
  *
46
74
  * @example
47
- * await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d")
75
+ * await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d", {})
48
76
  */
49
- get(id: string, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
77
+ get(id: string, request?: Polytomic.ModelsGetRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
50
78
  /**
51
79
  * @throws {@link Polytomic.BadRequestError}
52
80
  * @throws {@link Polytomic.UnauthorizedError}
@@ -68,8 +96,19 @@ export declare class Models {
68
96
  * @throws {@link Polytomic.InternalServerError}
69
97
  *
70
98
  * @example
71
- * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
99
+ * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d", {})
100
+ */
101
+ remove(id: string, request?: Polytomic.ModelsRemoveRequest, requestOptions?: Models.RequestOptions): Promise<void>;
102
+ /**
103
+ * Returns sample records from the model. The first ten records that the source provides will be returned after being enriched (if applicable). Synchronous requests must complete within 10s. If either querying or enrichment exceeds 10s, please use the async option.
104
+ * @throws {@link Polytomic.BadRequestError}
105
+ * @throws {@link Polytomic.UnauthorizedError}
106
+ * @throws {@link Polytomic.NotFoundError}
107
+ * @throws {@link Polytomic.InternalServerError}
108
+ *
109
+ * @example
110
+ * await polytomic.models.sample("248df4b7-aa70-47b8-a036-33ac447e668d", {})
72
111
  */
73
- remove(id: string, requestOptions?: Models.RequestOptions): Promise<void>;
112
+ sample(id: string, request?: Polytomic.ModelsSampleRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelSampleResponseEnvelope>;
74
113
  protected _getAuthorizationHeader(): Promise<string>;
75
114
  }
@@ -59,6 +59,146 @@ class Models {
59
59
  constructor(_options) {
60
60
  this._options = _options;
61
61
  }
62
+ /**
63
+ * For a given connection and enrichment configuration, provides the valid sets of input fields.
64
+ * @throws {@link Polytomic.UnauthorizedError}
65
+ * @throws {@link Polytomic.ForbiddenError}
66
+ * @throws {@link Polytomic.NotFoundError}
67
+ * @throws {@link Polytomic.InternalServerError}
68
+ *
69
+ * @example
70
+ * await polytomic.models.post("248df4b7-aa70-47b8-a036-33ac447e668d", {})
71
+ */
72
+ post(connectionId, request = {}, requestOptions) {
73
+ var _a;
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const _response = yield core.fetcher({
76
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/enrichment/${connectionId}/inputfields`),
77
+ method: "POST",
78
+ headers: {
79
+ Authorization: yield this._getAuthorizationHeader(),
80
+ "X-Polytomic-Version": "2024-02-08",
81
+ "X-Fern-Language": "JavaScript",
82
+ "X-Fern-SDK-Name": "polytomic",
83
+ "X-Fern-SDK-Version": "1.3.0",
84
+ "X-Fern-Runtime": core.RUNTIME.type,
85
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
86
+ },
87
+ contentType: "application/json",
88
+ body: request,
89
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
90
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
91
+ });
92
+ if (_response.ok) {
93
+ return _response.body;
94
+ }
95
+ if (_response.error.reason === "status-code") {
96
+ switch (_response.error.statusCode) {
97
+ case 401:
98
+ throw new Polytomic.UnauthorizedError(_response.error.body);
99
+ case 403:
100
+ throw new Polytomic.ForbiddenError(_response.error.body);
101
+ case 404:
102
+ throw new Polytomic.NotFoundError(_response.error.body);
103
+ case 500:
104
+ throw new Polytomic.InternalServerError(_response.error.body);
105
+ default:
106
+ throw new errors.PolytomicError({
107
+ statusCode: _response.error.statusCode,
108
+ body: _response.error.body,
109
+ });
110
+ }
111
+ }
112
+ switch (_response.error.reason) {
113
+ case "non-json":
114
+ throw new errors.PolytomicError({
115
+ statusCode: _response.error.statusCode,
116
+ body: _response.error.rawBody,
117
+ });
118
+ case "timeout":
119
+ throw new errors.PolytomicTimeoutError();
120
+ case "unknown":
121
+ throw new errors.PolytomicError({
122
+ message: _response.error.errorMessage,
123
+ });
124
+ }
125
+ });
126
+ }
127
+ /**
128
+ * @throws {@link Polytomic.BadRequestError}
129
+ * @throws {@link Polytomic.UnauthorizedError}
130
+ * @throws {@link Polytomic.NotFoundError}
131
+ * @throws {@link Polytomic.InternalServerError}
132
+ *
133
+ * @example
134
+ * await polytomic.models.preview({
135
+ * body: {
136
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
137
+ * name: "Users"
138
+ * }
139
+ * })
140
+ */
141
+ preview(request, requestOptions) {
142
+ var _a;
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ const { async, body: _body } = request;
145
+ const _queryParams = {};
146
+ if (async != null) {
147
+ _queryParams["async"] = async.toString();
148
+ }
149
+ const _response = yield core.fetcher({
150
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, "api/model-preview"),
151
+ method: "POST",
152
+ headers: {
153
+ Authorization: yield this._getAuthorizationHeader(),
154
+ "X-Polytomic-Version": "2024-02-08",
155
+ "X-Fern-Language": "JavaScript",
156
+ "X-Fern-SDK-Name": "polytomic",
157
+ "X-Fern-SDK-Version": "1.3.0",
158
+ "X-Fern-Runtime": core.RUNTIME.type,
159
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
160
+ },
161
+ contentType: "application/json",
162
+ queryParameters: _queryParams,
163
+ body: _body,
164
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
165
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
166
+ });
167
+ if (_response.ok) {
168
+ return _response.body;
169
+ }
170
+ if (_response.error.reason === "status-code") {
171
+ switch (_response.error.statusCode) {
172
+ case 400:
173
+ throw new Polytomic.BadRequestError(_response.error.body);
174
+ case 401:
175
+ throw new Polytomic.UnauthorizedError(_response.error.body);
176
+ case 404:
177
+ throw new Polytomic.NotFoundError(_response.error.body);
178
+ case 500:
179
+ throw new Polytomic.InternalServerError(_response.error.body);
180
+ default:
181
+ throw new errors.PolytomicError({
182
+ statusCode: _response.error.statusCode,
183
+ body: _response.error.body,
184
+ });
185
+ }
186
+ }
187
+ switch (_response.error.reason) {
188
+ case "non-json":
189
+ throw new errors.PolytomicError({
190
+ statusCode: _response.error.statusCode,
191
+ body: _response.error.rawBody,
192
+ });
193
+ case "timeout":
194
+ throw new errors.PolytomicTimeoutError();
195
+ case "unknown":
196
+ throw new errors.PolytomicError({
197
+ message: _response.error.errorMessage,
198
+ });
199
+ }
200
+ });
201
+ }
62
202
  /**
63
203
  * @throws {@link Polytomic.UnauthorizedError}
64
204
  * @throws {@link Polytomic.NotFoundError}
@@ -77,7 +217,7 @@ class Models {
77
217
  "X-Polytomic-Version": "2024-02-08",
78
218
  "X-Fern-Language": "JavaScript",
79
219
  "X-Fern-SDK-Name": "polytomic",
80
- "X-Fern-SDK-Version": "1.0.0",
220
+ "X-Fern-SDK-Version": "1.3.0",
81
221
  "X-Fern-Runtime": core.RUNTIME.type,
82
222
  "X-Fern-Runtime-Version": core.RUNTIME.version,
83
223
  },
@@ -124,14 +264,16 @@ class Models {
124
264
  *
125
265
  * @example
126
266
  * await polytomic.models.create({
127
- * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
128
- * name: "Users"
267
+ * body: {
268
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
269
+ * name: "Users"
270
+ * }
129
271
  * })
130
272
  */
131
273
  create(request, requestOptions) {
132
274
  var _a;
133
275
  return __awaiter(this, void 0, void 0, function* () {
134
- const { async } = request, _body = __rest(request, ["async"]);
276
+ const { async, body: _body } = request;
135
277
  const _queryParams = {};
136
278
  if (async != null) {
137
279
  _queryParams["async"] = async.toString();
@@ -144,7 +286,7 @@ class Models {
144
286
  "X-Polytomic-Version": "2024-02-08",
145
287
  "X-Fern-Language": "JavaScript",
146
288
  "X-Fern-SDK-Name": "polytomic",
147
- "X-Fern-SDK-Version": "1.0.0",
289
+ "X-Fern-SDK-Version": "1.3.0",
148
290
  "X-Fern-Runtime": core.RUNTIME.type,
149
291
  "X-Fern-Runtime-Version": core.RUNTIME.version,
150
292
  },
@@ -195,11 +337,16 @@ class Models {
195
337
  * @throws {@link Polytomic.InternalServerError}
196
338
  *
197
339
  * @example
198
- * await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d")
340
+ * await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d", {})
199
341
  */
200
- get(id, requestOptions) {
342
+ get(id, request = {}, requestOptions) {
201
343
  var _a;
202
344
  return __awaiter(this, void 0, void 0, function* () {
345
+ const { async } = request;
346
+ const _queryParams = {};
347
+ if (async != null) {
348
+ _queryParams["async"] = async.toString();
349
+ }
203
350
  const _response = yield core.fetcher({
204
351
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/models/${id}`),
205
352
  method: "GET",
@@ -208,11 +355,12 @@ class Models {
208
355
  "X-Polytomic-Version": "2024-02-08",
209
356
  "X-Fern-Language": "JavaScript",
210
357
  "X-Fern-SDK-Name": "polytomic",
211
- "X-Fern-SDK-Version": "1.0.0",
358
+ "X-Fern-SDK-Version": "1.3.0",
212
359
  "X-Fern-Runtime": core.RUNTIME.type,
213
360
  "X-Fern-Runtime-Version": core.RUNTIME.version,
214
361
  },
215
362
  contentType: "application/json",
363
+ queryParameters: _queryParams,
216
364
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
217
365
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
218
366
  });
@@ -278,7 +426,7 @@ class Models {
278
426
  "X-Polytomic-Version": "2024-02-08",
279
427
  "X-Fern-Language": "JavaScript",
280
428
  "X-Fern-SDK-Name": "polytomic",
281
- "X-Fern-SDK-Version": "1.0.0",
429
+ "X-Fern-SDK-Version": "1.3.0",
282
430
  "X-Fern-Runtime": core.RUNTIME.type,
283
431
  "X-Fern-Runtime-Version": core.RUNTIME.version,
284
432
  },
@@ -330,11 +478,16 @@ class Models {
330
478
  * @throws {@link Polytomic.InternalServerError}
331
479
  *
332
480
  * @example
333
- * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
481
+ * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d", {})
334
482
  */
335
- remove(id, requestOptions) {
483
+ remove(id, request = {}, requestOptions) {
336
484
  var _a;
337
485
  return __awaiter(this, void 0, void 0, function* () {
486
+ const { async } = request;
487
+ const _queryParams = {};
488
+ if (async != null) {
489
+ _queryParams["async"] = async.toString();
490
+ }
338
491
  const _response = yield core.fetcher({
339
492
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/models/${id}`),
340
493
  method: "DELETE",
@@ -343,11 +496,12 @@ class Models {
343
496
  "X-Polytomic-Version": "2024-02-08",
344
497
  "X-Fern-Language": "JavaScript",
345
498
  "X-Fern-SDK-Name": "polytomic",
346
- "X-Fern-SDK-Version": "1.0.0",
499
+ "X-Fern-SDK-Version": "1.3.0",
347
500
  "X-Fern-Runtime": core.RUNTIME.type,
348
501
  "X-Fern-Runtime-Version": core.RUNTIME.version,
349
502
  },
350
503
  contentType: "application/json",
504
+ queryParameters: _queryParams,
351
505
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
352
506
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
353
507
  });
@@ -386,6 +540,76 @@ class Models {
386
540
  }
387
541
  });
388
542
  }
543
+ /**
544
+ * Returns sample records from the model. The first ten records that the source provides will be returned after being enriched (if applicable). Synchronous requests must complete within 10s. If either querying or enrichment exceeds 10s, please use the async option.
545
+ * @throws {@link Polytomic.BadRequestError}
546
+ * @throws {@link Polytomic.UnauthorizedError}
547
+ * @throws {@link Polytomic.NotFoundError}
548
+ * @throws {@link Polytomic.InternalServerError}
549
+ *
550
+ * @example
551
+ * await polytomic.models.sample("248df4b7-aa70-47b8-a036-33ac447e668d", {})
552
+ */
553
+ sample(id, request = {}, requestOptions) {
554
+ var _a;
555
+ return __awaiter(this, void 0, void 0, function* () {
556
+ const { async } = request;
557
+ const _queryParams = {};
558
+ if (async != null) {
559
+ _queryParams["async"] = async.toString();
560
+ }
561
+ const _response = yield core.fetcher({
562
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/models/${id}/sample`),
563
+ method: "GET",
564
+ headers: {
565
+ Authorization: yield this._getAuthorizationHeader(),
566
+ "X-Polytomic-Version": "2024-02-08",
567
+ "X-Fern-Language": "JavaScript",
568
+ "X-Fern-SDK-Name": "polytomic",
569
+ "X-Fern-SDK-Version": "1.3.0",
570
+ "X-Fern-Runtime": core.RUNTIME.type,
571
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
572
+ },
573
+ contentType: "application/json",
574
+ queryParameters: _queryParams,
575
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
576
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
577
+ });
578
+ if (_response.ok) {
579
+ return _response.body;
580
+ }
581
+ if (_response.error.reason === "status-code") {
582
+ switch (_response.error.statusCode) {
583
+ case 400:
584
+ throw new Polytomic.BadRequestError(_response.error.body);
585
+ case 401:
586
+ throw new Polytomic.UnauthorizedError(_response.error.body);
587
+ case 404:
588
+ throw new Polytomic.NotFoundError(_response.error.body);
589
+ case 500:
590
+ throw new Polytomic.InternalServerError(_response.error.body);
591
+ default:
592
+ throw new errors.PolytomicError({
593
+ statusCode: _response.error.statusCode,
594
+ body: _response.error.body,
595
+ });
596
+ }
597
+ }
598
+ switch (_response.error.reason) {
599
+ case "non-json":
600
+ throw new errors.PolytomicError({
601
+ statusCode: _response.error.statusCode,
602
+ body: _response.error.rawBody,
603
+ });
604
+ case "timeout":
605
+ throw new errors.PolytomicTimeoutError();
606
+ case "unknown":
607
+ throw new errors.PolytomicError({
608
+ message: _response.error.errorMessage,
609
+ });
610
+ }
611
+ });
612
+ }
389
613
  _getAuthorizationHeader() {
390
614
  return __awaiter(this, void 0, void 0, function* () {
391
615
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ import * as Polytomic from "../../../..";
5
+ /**
6
+ * @example
7
+ * {}
8
+ */
9
+ export interface GetEnrichmentInputFieldsRequest {
10
+ configuration?: Polytomic.V2EnricherConfiguration;
11
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ import * as Polytomic from "../../../..";
5
+ /**
6
+ * @example
7
+ * {
8
+ * body: {
9
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
10
+ * name: "Users"
11
+ * }
12
+ * }
13
+ */
14
+ export interface ModelsCreateRequest {
15
+ async?: boolean;
16
+ body: Polytomic.CreateModelRequest;
17
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {}
7
+ */
8
+ export interface ModelsGetRequest {
9
+ async?: boolean;
10
+ }
@@ -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 });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ import * as Polytomic from "../../../..";
5
+ /**
6
+ * @example
7
+ * {
8
+ * body: {
9
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
10
+ * name: "Users"
11
+ * }
12
+ * }
13
+ */
14
+ export interface ModelsPreviewRequest {
15
+ async?: boolean;
16
+ body: Polytomic.CreateModelRequest;
17
+ }
@@ -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 });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {}
7
+ */
8
+ export interface ModelsRemoveRequest {
9
+ async?: boolean;
10
+ }
@@ -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 });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {}
7
+ */
8
+ export interface ModelsSampleRequest {
9
+ async?: boolean;
10
+ }
@@ -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 });
@@ -15,6 +15,7 @@ export interface UpdateModelRequest {
15
15
  additional_fields?: Polytomic.ModelModelFieldRequest[];
16
16
  configuration?: Record<string, unknown>;
17
17
  connection_id: string;
18
+ enricher?: Polytomic.Enrichment;
18
19
  fields?: string[];
19
20
  identifier?: string;
20
21
  labels?: string[];
@@ -1,2 +1,7 @@
1
- export { CreateModelRequest } from "./CreateModelRequest";
1
+ export { GetEnrichmentInputFieldsRequest } from "./GetEnrichmentInputFieldsRequest";
2
+ export { ModelsPreviewRequest } from "./ModelsPreviewRequest";
3
+ export { ModelsCreateRequest } from "./ModelsCreateRequest";
4
+ export { ModelsGetRequest } from "./ModelsGetRequest";
2
5
  export { UpdateModelRequest } from "./UpdateModelRequest";
6
+ export { ModelsRemoveRequest } from "./ModelsRemoveRequest";
7
+ export { ModelsSampleRequest } from "./ModelsSampleRequest";
@@ -69,7 +69,7 @@ class Organization {
69
69
  "X-Polytomic-Version": "2024-02-08",
70
70
  "X-Fern-Language": "JavaScript",
71
71
  "X-Fern-SDK-Name": "polytomic",
72
- "X-Fern-SDK-Version": "1.0.0",
72
+ "X-Fern-SDK-Version": "1.3.0",
73
73
  "X-Fern-Runtime": core.RUNTIME.type,
74
74
  "X-Fern-Runtime-Version": core.RUNTIME.version,
75
75
  },
@@ -132,7 +132,7 @@ class Organization {
132
132
  "X-Polytomic-Version": "2024-02-08",
133
133
  "X-Fern-Language": "JavaScript",
134
134
  "X-Fern-SDK-Name": "polytomic",
135
- "X-Fern-SDK-Version": "1.0.0",
135
+ "X-Fern-SDK-Version": "1.3.0",
136
136
  "X-Fern-Runtime": core.RUNTIME.type,
137
137
  "X-Fern-Runtime-Version": core.RUNTIME.version,
138
138
  },
@@ -195,7 +195,7 @@ class Organization {
195
195
  "X-Polytomic-Version": "2024-02-08",
196
196
  "X-Fern-Language": "JavaScript",
197
197
  "X-Fern-SDK-Name": "polytomic",
198
- "X-Fern-SDK-Version": "1.0.0",
198
+ "X-Fern-SDK-Version": "1.3.0",
199
199
  "X-Fern-Runtime": core.RUNTIME.type,
200
200
  "X-Fern-Runtime-Version": core.RUNTIME.version,
201
201
  },
@@ -258,7 +258,7 @@ class Organization {
258
258
  "X-Polytomic-Version": "2024-02-08",
259
259
  "X-Fern-Language": "JavaScript",
260
260
  "X-Fern-SDK-Name": "polytomic",
261
- "X-Fern-SDK-Version": "1.0.0",
261
+ "X-Fern-SDK-Version": "1.3.0",
262
262
  "X-Fern-Runtime": core.RUNTIME.type,
263
263
  "X-Fern-Runtime-Version": core.RUNTIME.version,
264
264
  },
@@ -322,7 +322,7 @@ class Organization {
322
322
  "X-Polytomic-Version": "2024-02-08",
323
323
  "X-Fern-Language": "JavaScript",
324
324
  "X-Fern-SDK-Name": "polytomic",
325
- "X-Fern-SDK-Version": "1.0.0",
325
+ "X-Fern-SDK-Version": "1.3.0",
326
326
  "X-Fern-Runtime": core.RUNTIME.type,
327
327
  "X-Fern-Runtime-Version": core.RUNTIME.version,
328
328
  },
@@ -66,7 +66,7 @@ class Policies {
66
66
  "X-Polytomic-Version": "2024-02-08",
67
67
  "X-Fern-Language": "JavaScript",
68
68
  "X-Fern-SDK-Name": "polytomic",
69
- "X-Fern-SDK-Version": "1.0.0",
69
+ "X-Fern-SDK-Version": "1.3.0",
70
70
  "X-Fern-Runtime": core.RUNTIME.type,
71
71
  "X-Fern-Runtime-Version": core.RUNTIME.version,
72
72
  },
@@ -128,7 +128,7 @@ class Policies {
128
128
  "X-Polytomic-Version": "2024-02-08",
129
129
  "X-Fern-Language": "JavaScript",
130
130
  "X-Fern-SDK-Name": "polytomic",
131
- "X-Fern-SDK-Version": "1.0.0",
131
+ "X-Fern-SDK-Version": "1.3.0",
132
132
  "X-Fern-Runtime": core.RUNTIME.type,
133
133
  "X-Fern-Runtime-Version": core.RUNTIME.version,
134
134
  },
@@ -193,7 +193,7 @@ class Policies {
193
193
  "X-Polytomic-Version": "2024-02-08",
194
194
  "X-Fern-Language": "JavaScript",
195
195
  "X-Fern-SDK-Name": "polytomic",
196
- "X-Fern-SDK-Version": "1.0.0",
196
+ "X-Fern-SDK-Version": "1.3.0",
197
197
  "X-Fern-Runtime": core.RUNTIME.type,
198
198
  "X-Fern-Runtime-Version": core.RUNTIME.version,
199
199
  },
@@ -257,7 +257,7 @@ class Policies {
257
257
  "X-Polytomic-Version": "2024-02-08",
258
258
  "X-Fern-Language": "JavaScript",
259
259
  "X-Fern-SDK-Name": "polytomic",
260
- "X-Fern-SDK-Version": "1.0.0",
260
+ "X-Fern-SDK-Version": "1.3.0",
261
261
  "X-Fern-Runtime": core.RUNTIME.type,
262
262
  "X-Fern-Runtime-Version": core.RUNTIME.version,
263
263
  },
@@ -323,7 +323,7 @@ class Policies {
323
323
  "X-Polytomic-Version": "2024-02-08",
324
324
  "X-Fern-Language": "JavaScript",
325
325
  "X-Fern-SDK-Name": "polytomic",
326
- "X-Fern-SDK-Version": "1.0.0",
326
+ "X-Fern-SDK-Version": "1.3.0",
327
327
  "X-Fern-Runtime": core.RUNTIME.type,
328
328
  "X-Fern-Runtime-Version": core.RUNTIME.version,
329
329
  },