polytomic 0.1.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) 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 +62 -46
  16. package/api/resources/bulkSync/client/Client.js +174 -184
  17. package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
  18. package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +1 -1
  19. package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +1 -4
  20. package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
  21. package/api/resources/bulkSync/client/requests/index.d.ts +3 -2
  22. package/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
  23. package/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
  24. package/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
  25. package/api/resources/bulkSync/resources/executions/client/index.js +0 -15
  26. package/api/resources/bulkSync/resources/index.d.ts +0 -1
  27. package/api/resources/bulkSync/resources/index.js +0 -1
  28. package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +20 -9
  29. package/api/resources/bulkSync/resources/schemas/client/Client.js +90 -24
  30. package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
  31. package/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +1 -4
  32. package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
  33. package/api/resources/connections/client/Client.d.ts +40 -49
  34. package/api/resources/connections/client/Client.js +113 -298
  35. package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +18 -0
  36. package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -4
  37. package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +1 -4
  38. package/api/resources/connections/client/requests/index.d.ts +2 -4
  39. package/api/resources/events/client/Client.d.ts +9 -8
  40. package/api/resources/events/client/Client.js +16 -18
  41. package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
  42. package/api/resources/events/client/requests/index.d.ts +1 -1
  43. package/api/resources/identity/client/Client.d.ts +29 -0
  44. package/api/resources/identity/client/Client.js +114 -0
  45. package/api/resources/identity/client/index.d.ts +1 -0
  46. package/api/resources/identity/index.d.ts +1 -0
  47. package/api/resources/identity/index.js +17 -0
  48. package/api/resources/index.d.ts +3 -2
  49. package/api/resources/index.js +4 -3
  50. package/api/resources/jobs/client/Client.d.ts +6 -4
  51. package/api/resources/jobs/client/Client.js +13 -10
  52. package/api/resources/modelSync/client/Client.d.ts +87 -53
  53. package/api/resources/modelSync/client/Client.js +405 -100
  54. package/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +1 -21
  55. package/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
  56. package/{dist/api/resources/connections/client/requests/TargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
  57. package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
  58. package/api/resources/modelSync/client/requests/StartModelSyncRequest.d.ts +1 -0
  59. package/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +1 -21
  60. package/api/resources/modelSync/client/requests/index.d.ts +3 -0
  61. package/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
  62. package/api/resources/modelSync/resources/executions/client/Client.js +43 -476
  63. package/api/resources/models/client/Client.d.ts +22 -13
  64. package/api/resources/models/client/Client.js +67 -47
  65. package/api/resources/models/client/requests/CreateModelRequest.d.ts +0 -1
  66. package/api/resources/models/client/requests/UpdateModelRequest.d.ts +0 -1
  67. package/api/resources/organization/client/Client.d.ts +23 -26
  68. package/api/resources/organization/client/Client.js +53 -53
  69. package/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts +1 -6
  70. package/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts +1 -6
  71. package/api/resources/permissions/client/Client.d.ts +2 -3
  72. package/api/resources/permissions/client/Client.js +1 -1
  73. package/api/resources/permissions/resources/policies/client/Client.d.ts +24 -19
  74. package/api/resources/permissions/resources/policies/client/Client.js +66 -46
  75. package/api/resources/permissions/resources/policies/client/requests/CreatePolicyRequest.d.ts +1 -5
  76. package/api/resources/permissions/resources/policies/client/requests/UpdatePolicyRequest.d.ts +1 -5
  77. package/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
  78. package/api/resources/permissions/resources/roles/client/Client.js +62 -37
  79. package/api/resources/schemas/client/Client.d.ts +39 -6
  80. package/api/resources/schemas/client/Client.js +208 -13
  81. package/api/resources/users/client/Client.d.ts +27 -19
  82. package/api/resources/users/client/Client.js +63 -48
  83. package/api/resources/users/client/requests/CreateUserRequestSchema.d.ts +1 -2
  84. package/api/resources/users/client/requests/UpdateUserRequestSchema.d.ts +1 -2
  85. package/api/resources/webhooks/client/Client.d.ts +22 -15
  86. package/api/resources/webhooks/client/Client.js +56 -46
  87. package/api/types/ApiError.d.ts +8 -0
  88. package/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
  89. package/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
  90. package/api/types/SourceMeta.d.ts +8 -0
  91. package/api/types/SourceMeta.js +5 -0
  92. package/api/types/index.d.ts +4 -0
  93. package/api/types/index.js +4 -0
  94. package/dist/Client.d.ts +8 -6
  95. package/dist/Client.js +27 -22
  96. package/dist/api/errors/BadRequestError.d.ts +8 -0
  97. package/dist/api/errors/BadRequestError.js +41 -0
  98. package/dist/api/errors/ForbiddenError.d.ts +8 -0
  99. package/dist/api/errors/ForbiddenError.js +41 -0
  100. package/dist/api/errors/InternalServerError.d.ts +8 -0
  101. package/dist/api/errors/InternalServerError.js +41 -0
  102. package/dist/api/errors/NotFoundError.d.ts +8 -0
  103. package/dist/api/errors/NotFoundError.js +41 -0
  104. package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
  105. package/dist/api/errors/UnprocessableEntityError.js +41 -0
  106. package/dist/api/errors/index.d.ts +5 -0
  107. package/dist/api/errors/index.js +5 -0
  108. package/dist/api/resources/bulkSync/client/Client.d.ts +62 -46
  109. package/dist/api/resources/bulkSync/client/Client.js +174 -184
  110. package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
  111. package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +1 -1
  112. package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +1 -4
  113. package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
  114. package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
  115. package/dist/api/resources/bulkSync/client/requests/index.d.ts +3 -2
  116. package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
  117. package/dist/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
  118. package/dist/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
  119. package/dist/api/resources/bulkSync/resources/executions/client/index.js +0 -15
  120. package/dist/api/resources/bulkSync/resources/index.d.ts +0 -1
  121. package/dist/api/resources/bulkSync/resources/index.js +0 -1
  122. package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +20 -9
  123. package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +90 -24
  124. package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
  125. package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js +5 -0
  126. package/dist/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +1 -4
  127. package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
  128. package/dist/api/resources/connections/client/Client.d.ts +40 -49
  129. package/dist/api/resources/connections/client/Client.js +113 -298
  130. package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +18 -0
  131. package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
  132. package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -4
  133. package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +1 -4
  134. package/dist/api/resources/connections/client/requests/index.d.ts +2 -4
  135. package/dist/api/resources/events/client/Client.d.ts +9 -8
  136. package/dist/api/resources/events/client/Client.js +16 -18
  137. package/{api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → dist/api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
  138. package/dist/api/resources/events/client/requests/EventsListRequest.js +5 -0
  139. package/dist/api/resources/events/client/requests/index.d.ts +1 -1
  140. package/dist/api/resources/identity/client/Client.d.ts +29 -0
  141. package/dist/api/resources/identity/client/Client.js +114 -0
  142. package/dist/api/resources/identity/client/index.d.ts +1 -0
  143. package/dist/api/resources/identity/index.d.ts +1 -0
  144. package/dist/api/resources/identity/index.js +17 -0
  145. package/dist/api/resources/index.d.ts +3 -2
  146. package/dist/api/resources/index.js +4 -3
  147. package/dist/api/resources/jobs/client/Client.d.ts +6 -4
  148. package/dist/api/resources/jobs/client/Client.js +13 -10
  149. package/dist/api/resources/modelSync/client/Client.d.ts +87 -53
  150. package/dist/api/resources/modelSync/client/Client.js +405 -100
  151. package/dist/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +1 -21
  152. package/dist/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
  153. package/dist/api/resources/modelSync/client/requests/ModelSyncGetSourceRequest.js +5 -0
  154. package/{api/resources/connections/client/requests/TargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
  155. package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js +5 -0
  156. package/{api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
  157. package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js +5 -0
  158. package/dist/api/resources/modelSync/client/requests/StartModelSyncRequest.d.ts +1 -0
  159. package/dist/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +1 -21
  160. package/dist/api/resources/modelSync/client/requests/index.d.ts +3 -0
  161. package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
  162. package/dist/api/resources/modelSync/resources/executions/client/Client.js +43 -476
  163. package/dist/api/resources/models/client/Client.d.ts +22 -13
  164. package/dist/api/resources/models/client/Client.js +67 -47
  165. package/dist/api/resources/models/client/requests/CreateModelRequest.d.ts +0 -1
  166. package/dist/api/resources/models/client/requests/UpdateModelRequest.d.ts +0 -1
  167. package/dist/api/resources/organization/client/Client.d.ts +23 -26
  168. package/dist/api/resources/organization/client/Client.js +53 -53
  169. package/dist/api/resources/organization/client/requests/CreateOrganizationRequestSchema.d.ts +1 -6
  170. package/dist/api/resources/organization/client/requests/UpdateOrganizationRequestSchema.d.ts +1 -6
  171. package/dist/api/resources/permissions/client/Client.d.ts +2 -3
  172. package/dist/api/resources/permissions/client/Client.js +1 -1
  173. package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +24 -19
  174. package/dist/api/resources/permissions/resources/policies/client/Client.js +66 -46
  175. package/dist/api/resources/permissions/resources/policies/client/requests/CreatePolicyRequest.d.ts +1 -5
  176. package/dist/api/resources/permissions/resources/policies/client/requests/UpdatePolicyRequest.d.ts +1 -5
  177. package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
  178. package/dist/api/resources/permissions/resources/roles/client/Client.js +62 -37
  179. package/dist/api/resources/schemas/client/Client.d.ts +39 -6
  180. package/dist/api/resources/schemas/client/Client.js +208 -13
  181. package/dist/api/resources/users/client/Client.d.ts +27 -19
  182. package/dist/api/resources/users/client/Client.js +63 -48
  183. package/dist/api/resources/users/client/requests/CreateUserRequestSchema.d.ts +1 -2
  184. package/dist/api/resources/users/client/requests/UpdateUserRequestSchema.d.ts +1 -2
  185. package/dist/api/resources/webhooks/client/Client.d.ts +22 -15
  186. package/dist/api/resources/webhooks/client/Client.js +56 -46
  187. package/dist/api/types/ApiError.d.ts +8 -0
  188. package/dist/api/types/ApiError.js +5 -0
  189. package/dist/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
  190. package/dist/api/types/GetModelSyncSourceMetaEnvelope.js +5 -0
  191. package/dist/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
  192. package/dist/api/types/ModelSyncSourceMetaResponse.js +5 -0
  193. package/dist/api/types/SourceMeta.d.ts +8 -0
  194. package/dist/api/types/SourceMeta.js +5 -0
  195. package/dist/api/types/index.d.ts +4 -0
  196. package/dist/api/types/index.js +4 -0
  197. package/package.json +2 -2
  198. package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
  199. package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
  200. /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.js +0 -0
  201. /package/api/resources/{connections/client/requests/ConnectionsGetTargetRequest.js → bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js} +0 -0
  202. /package/api/resources/connections/client/requests/{ModelFieldsRequest.js → ConnectCardRequest.js} +0 -0
  203. /package/api/resources/{connections/client/requests/TargetRequest.js → events/client/requests/EventsListRequest.js} +0 -0
  204. /package/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
  205. /package/api/resources/{events/client/requests/EventsApiV2GetEventsRequest.js → modelSync/client/requests/ModelSyncGetSourceRequest.js} +0 -0
  206. /package/{dist/api/resources/bulkSync/resources/executions/client/requests/StartBulkSyncRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js} +0 -0
  207. /package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js} +0 -0
  208. /package/{dist/api/resources/connections/client/requests/ModelFieldsRequest.js → api/types/ApiError.js} +0 -0
  209. /package/{dist/api/resources/connections/client/requests/TargetRequest.js → api/types/GetModelSyncSourceMetaEnvelope.js} +0 -0
  210. /package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.js → api/types/ModelSyncSourceMetaResponse.js} +0 -0
  211. /package/dist/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
@@ -46,11 +46,299 @@ const url_join_1 = __importDefault(require("url-join"));
46
46
  const errors = __importStar(require("../../../../errors"));
47
47
  const Client_1 = require("../resources/executions/client/Client");
48
48
  class ModelSync {
49
- constructor(_options = {}) {
49
+ constructor(_options) {
50
50
  this._options = _options;
51
51
  }
52
52
  /**
53
+ * @throws {@link Polytomic.BadRequestError}
53
54
  * @throws {@link Polytomic.UnauthorizedError}
55
+ * @throws {@link Polytomic.ForbiddenError}
56
+ * @throws {@link Polytomic.NotFoundError}
57
+ * @throws {@link Polytomic.InternalServerError}
58
+ *
59
+ * @example
60
+ * await polytomic.modelSync.getSource("248df4b7-aa70-47b8-a036-33ac447e668d", {})
61
+ */
62
+ getSource(id, request = {}, requestOptions) {
63
+ var _a;
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const { params } = request;
66
+ const _queryParams = {};
67
+ if (params != null) {
68
+ _queryParams["params"] = params;
69
+ }
70
+ const _response = yield core.fetcher({
71
+ 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}/modelsync/source`),
72
+ method: "GET",
73
+ headers: {
74
+ Authorization: yield this._getAuthorizationHeader(),
75
+ "X-Polytomic-Version": "2024-02-08",
76
+ "X-Fern-Language": "JavaScript",
77
+ "X-Fern-SDK-Name": "polytomic",
78
+ "X-Fern-SDK-Version": "1.0.0",
79
+ "X-Fern-Runtime": core.RUNTIME.type,
80
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
81
+ },
82
+ contentType: "application/json",
83
+ queryParameters: _queryParams,
84
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
85
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
86
+ });
87
+ if (_response.ok) {
88
+ return _response.body;
89
+ }
90
+ if (_response.error.reason === "status-code") {
91
+ switch (_response.error.statusCode) {
92
+ case 400:
93
+ throw new Polytomic.BadRequestError(_response.error.body);
94
+ case 401:
95
+ throw new Polytomic.UnauthorizedError(_response.error.body);
96
+ case 403:
97
+ throw new Polytomic.ForbiddenError(_response.error.body);
98
+ case 404:
99
+ throw new Polytomic.NotFoundError(_response.error.body);
100
+ case 500:
101
+ throw new Polytomic.InternalServerError(_response.error.body);
102
+ default:
103
+ throw new errors.PolytomicError({
104
+ statusCode: _response.error.statusCode,
105
+ body: _response.error.body,
106
+ });
107
+ }
108
+ }
109
+ switch (_response.error.reason) {
110
+ case "non-json":
111
+ throw new errors.PolytomicError({
112
+ statusCode: _response.error.statusCode,
113
+ body: _response.error.rawBody,
114
+ });
115
+ case "timeout":
116
+ throw new errors.PolytomicTimeoutError();
117
+ case "unknown":
118
+ throw new errors.PolytomicError({
119
+ message: _response.error.errorMessage,
120
+ });
121
+ }
122
+ });
123
+ }
124
+ /**
125
+ * @throws {@link Polytomic.BadRequestError}
126
+ * @throws {@link Polytomic.UnauthorizedError}
127
+ * @throws {@link Polytomic.ForbiddenError}
128
+ * @throws {@link Polytomic.NotFoundError}
129
+ * @throws {@link Polytomic.InternalServerError}
130
+ *
131
+ * @example
132
+ * await polytomic.modelSync.getSourceFields("248df4b7-aa70-47b8-a036-33ac447e668d")
133
+ */
134
+ getSourceFields(id, requestOptions) {
135
+ var _a;
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ const _response = yield core.fetcher({
138
+ 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}/modelsync/source/fields`),
139
+ method: "GET",
140
+ headers: {
141
+ Authorization: yield this._getAuthorizationHeader(),
142
+ "X-Polytomic-Version": "2024-02-08",
143
+ "X-Fern-Language": "JavaScript",
144
+ "X-Fern-SDK-Name": "polytomic",
145
+ "X-Fern-SDK-Version": "1.0.0",
146
+ "X-Fern-Runtime": core.RUNTIME.type,
147
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
148
+ },
149
+ contentType: "application/json",
150
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
151
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
152
+ });
153
+ if (_response.ok) {
154
+ return _response.body;
155
+ }
156
+ if (_response.error.reason === "status-code") {
157
+ switch (_response.error.statusCode) {
158
+ case 400:
159
+ throw new Polytomic.BadRequestError(_response.error.body);
160
+ case 401:
161
+ throw new Polytomic.UnauthorizedError(_response.error.body);
162
+ case 403:
163
+ throw new Polytomic.ForbiddenError(_response.error.body);
164
+ case 404:
165
+ throw new Polytomic.NotFoundError(_response.error.body);
166
+ case 500:
167
+ throw new Polytomic.InternalServerError(_response.error.body);
168
+ default:
169
+ throw new errors.PolytomicError({
170
+ statusCode: _response.error.statusCode,
171
+ body: _response.error.body,
172
+ });
173
+ }
174
+ }
175
+ switch (_response.error.reason) {
176
+ case "non-json":
177
+ throw new errors.PolytomicError({
178
+ statusCode: _response.error.statusCode,
179
+ body: _response.error.rawBody,
180
+ });
181
+ case "timeout":
182
+ throw new errors.PolytomicTimeoutError();
183
+ case "unknown":
184
+ throw new errors.PolytomicError({
185
+ message: _response.error.errorMessage,
186
+ });
187
+ }
188
+ });
189
+ }
190
+ /**
191
+ * @throws {@link Polytomic.BadRequestError}
192
+ * @throws {@link Polytomic.UnauthorizedError}
193
+ * @throws {@link Polytomic.ForbiddenError}
194
+ * @throws {@link Polytomic.NotFoundError}
195
+ * @throws {@link Polytomic.InternalServerError}
196
+ *
197
+ * @example
198
+ * await polytomic.modelSync.getTarget("248df4b7-aa70-47b8-a036-33ac447e668d", {})
199
+ */
200
+ getTarget(id, request = {}, requestOptions) {
201
+ var _a;
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ const { type: type_, search } = request;
204
+ const _queryParams = {};
205
+ if (type_ != null) {
206
+ _queryParams["type"] = type_;
207
+ }
208
+ if (search != null) {
209
+ _queryParams["search"] = search;
210
+ }
211
+ const _response = yield core.fetcher({
212
+ 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}/modelsync/target`),
213
+ method: "GET",
214
+ headers: {
215
+ Authorization: yield this._getAuthorizationHeader(),
216
+ "X-Polytomic-Version": "2024-02-08",
217
+ "X-Fern-Language": "JavaScript",
218
+ "X-Fern-SDK-Name": "polytomic",
219
+ "X-Fern-SDK-Version": "1.0.0",
220
+ "X-Fern-Runtime": core.RUNTIME.type,
221
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
222
+ },
223
+ contentType: "application/json",
224
+ queryParameters: _queryParams,
225
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
226
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
227
+ });
228
+ if (_response.ok) {
229
+ return _response.body;
230
+ }
231
+ if (_response.error.reason === "status-code") {
232
+ switch (_response.error.statusCode) {
233
+ case 400:
234
+ throw new Polytomic.BadRequestError(_response.error.body);
235
+ case 401:
236
+ throw new Polytomic.UnauthorizedError(_response.error.body);
237
+ case 403:
238
+ throw new Polytomic.ForbiddenError(_response.error.body);
239
+ case 404:
240
+ throw new Polytomic.NotFoundError(_response.error.body);
241
+ case 500:
242
+ throw new Polytomic.InternalServerError(_response.error.body);
243
+ default:
244
+ throw new errors.PolytomicError({
245
+ statusCode: _response.error.statusCode,
246
+ body: _response.error.body,
247
+ });
248
+ }
249
+ }
250
+ switch (_response.error.reason) {
251
+ case "non-json":
252
+ throw new errors.PolytomicError({
253
+ statusCode: _response.error.statusCode,
254
+ body: _response.error.rawBody,
255
+ });
256
+ case "timeout":
257
+ throw new errors.PolytomicTimeoutError();
258
+ case "unknown":
259
+ throw new errors.PolytomicError({
260
+ message: _response.error.errorMessage,
261
+ });
262
+ }
263
+ });
264
+ }
265
+ /**
266
+ * @throws {@link Polytomic.UnauthorizedError}
267
+ * @throws {@link Polytomic.ForbiddenError}
268
+ * @throws {@link Polytomic.NotFoundError}
269
+ * @throws {@link Polytomic.InternalServerError}
270
+ *
271
+ * @example
272
+ * await polytomic.modelSync.getTargetFields("248df4b7-aa70-47b8-a036-33ac447e668d", {
273
+ * target: "database.table",
274
+ * refresh: false
275
+ * })
276
+ */
277
+ getTargetFields(id, request, requestOptions) {
278
+ var _a;
279
+ return __awaiter(this, void 0, void 0, function* () {
280
+ const { target, refresh } = request;
281
+ const _queryParams = {};
282
+ _queryParams["target"] = target;
283
+ if (refresh != null) {
284
+ _queryParams["refresh"] = refresh.toString();
285
+ }
286
+ const _response = yield core.fetcher({
287
+ 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}/modelsync/target/fields`),
288
+ method: "GET",
289
+ headers: {
290
+ Authorization: yield this._getAuthorizationHeader(),
291
+ "X-Polytomic-Version": "2024-02-08",
292
+ "X-Fern-Language": "JavaScript",
293
+ "X-Fern-SDK-Name": "polytomic",
294
+ "X-Fern-SDK-Version": "1.0.0",
295
+ "X-Fern-Runtime": core.RUNTIME.type,
296
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
297
+ },
298
+ contentType: "application/json",
299
+ queryParameters: _queryParams,
300
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
301
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
302
+ });
303
+ if (_response.ok) {
304
+ return _response.body;
305
+ }
306
+ if (_response.error.reason === "status-code") {
307
+ switch (_response.error.statusCode) {
308
+ case 401:
309
+ throw new Polytomic.UnauthorizedError(_response.error.body);
310
+ case 403:
311
+ throw new Polytomic.ForbiddenError(_response.error.body);
312
+ case 404:
313
+ throw new Polytomic.NotFoundError(_response.error.body);
314
+ case 500:
315
+ throw new Polytomic.InternalServerError(_response.error.body);
316
+ default:
317
+ throw new errors.PolytomicError({
318
+ statusCode: _response.error.statusCode,
319
+ body: _response.error.body,
320
+ });
321
+ }
322
+ }
323
+ switch (_response.error.reason) {
324
+ case "non-json":
325
+ throw new errors.PolytomicError({
326
+ statusCode: _response.error.statusCode,
327
+ body: _response.error.rawBody,
328
+ });
329
+ case "timeout":
330
+ throw new errors.PolytomicTimeoutError();
331
+ case "unknown":
332
+ throw new errors.PolytomicError({
333
+ message: _response.error.errorMessage,
334
+ });
335
+ }
336
+ });
337
+ }
338
+ /**
339
+ * @throws {@link Polytomic.UnauthorizedError}
340
+ * @throws {@link Polytomic.NotFoundError}
341
+ * @throws {@link Polytomic.InternalServerError}
54
342
  *
55
343
  * @example
56
344
  * await polytomic.modelSync.list()
@@ -63,12 +351,10 @@ class ModelSync {
63
351
  method: "GET",
64
352
  headers: {
65
353
  Authorization: yield this._getAuthorizationHeader(),
66
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
67
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
68
- : undefined,
354
+ "X-Polytomic-Version": "2024-02-08",
69
355
  "X-Fern-Language": "JavaScript",
70
356
  "X-Fern-SDK-Name": "polytomic",
71
- "X-Fern-SDK-Version": "0.1.2",
357
+ "X-Fern-SDK-Version": "1.0.0",
72
358
  "X-Fern-Runtime": core.RUNTIME.type,
73
359
  "X-Fern-Runtime-Version": core.RUNTIME.version,
74
360
  },
@@ -83,6 +369,10 @@ class ModelSync {
83
369
  switch (_response.error.statusCode) {
84
370
  case 401:
85
371
  throw new Polytomic.UnauthorizedError(_response.error.body);
372
+ case 404:
373
+ throw new Polytomic.NotFoundError(_response.error.body);
374
+ case 500:
375
+ throw new Polytomic.InternalServerError(_response.error.body);
86
376
  default:
87
377
  throw new errors.PolytomicError({
88
378
  statusCode: _response.error.statusCode,
@@ -106,33 +396,17 @@ class ModelSync {
106
396
  });
107
397
  }
108
398
  /**
399
+ * @throws {@link Polytomic.BadRequestError}
109
400
  * @throws {@link Polytomic.UnauthorizedError}
401
+ * @throws {@link Polytomic.ForbiddenError}
402
+ * @throws {@link Polytomic.UnprocessableEntityError}
403
+ * @throws {@link Polytomic.InternalServerError}
110
404
  *
111
405
  * @example
112
406
  * await polytomic.modelSync.create({
113
- * fields: [{
114
- * source: {
115
- * field: "id",
116
- * model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
117
- * },
118
- * target: "name"
119
- * }],
120
- * filter_logic: "A and B or C",
121
- * identity: {
122
- * function: "Equality",
123
- * source: {
124
- * field: "id",
125
- * model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
126
- * },
127
- * target: "name"
128
- * },
129
407
  * mode: "create",
130
408
  * name: "Users Sync",
131
- * schedule: {
132
- * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
133
- * frequency: "daily"
134
- * },
135
- * sync_all_records: false,
409
+ * schedule: {},
136
410
  * target: {
137
411
  * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
138
412
  * object: "Users"
@@ -147,12 +421,10 @@ class ModelSync {
147
421
  method: "POST",
148
422
  headers: {
149
423
  Authorization: yield this._getAuthorizationHeader(),
150
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
151
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
152
- : undefined,
424
+ "X-Polytomic-Version": "2024-02-08",
153
425
  "X-Fern-Language": "JavaScript",
154
426
  "X-Fern-SDK-Name": "polytomic",
155
- "X-Fern-SDK-Version": "0.1.2",
427
+ "X-Fern-SDK-Version": "1.0.0",
156
428
  "X-Fern-Runtime": core.RUNTIME.type,
157
429
  "X-Fern-Runtime-Version": core.RUNTIME.version,
158
430
  },
@@ -166,8 +438,16 @@ class ModelSync {
166
438
  }
167
439
  if (_response.error.reason === "status-code") {
168
440
  switch (_response.error.statusCode) {
441
+ case 400:
442
+ throw new Polytomic.BadRequestError(_response.error.body);
169
443
  case 401:
170
444
  throw new Polytomic.UnauthorizedError(_response.error.body);
445
+ case 403:
446
+ throw new Polytomic.ForbiddenError(_response.error.body);
447
+ case 422:
448
+ throw new Polytomic.UnprocessableEntityError(_response.error.body);
449
+ case 500:
450
+ throw new Polytomic.InternalServerError(_response.error.body);
171
451
  default:
172
452
  throw new errors.PolytomicError({
173
453
  statusCode: _response.error.statusCode,
@@ -192,6 +472,7 @@ class ModelSync {
192
472
  }
193
473
  /**
194
474
  * @throws {@link Polytomic.UnauthorizedError}
475
+ * @throws {@link Polytomic.InternalServerError}
195
476
  *
196
477
  * @example
197
478
  * await polytomic.modelSync.getScheduleOptions()
@@ -204,12 +485,10 @@ class ModelSync {
204
485
  method: "GET",
205
486
  headers: {
206
487
  Authorization: yield this._getAuthorizationHeader(),
207
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
208
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
209
- : undefined,
488
+ "X-Polytomic-Version": "2024-02-08",
210
489
  "X-Fern-Language": "JavaScript",
211
490
  "X-Fern-SDK-Name": "polytomic",
212
- "X-Fern-SDK-Version": "0.1.2",
491
+ "X-Fern-SDK-Version": "1.0.0",
213
492
  "X-Fern-Runtime": core.RUNTIME.type,
214
493
  "X-Fern-Runtime-Version": core.RUNTIME.version,
215
494
  },
@@ -224,6 +503,8 @@ class ModelSync {
224
503
  switch (_response.error.statusCode) {
225
504
  case 401:
226
505
  throw new Polytomic.UnauthorizedError(_response.error.body);
506
+ case 500:
507
+ throw new Polytomic.InternalServerError(_response.error.body);
227
508
  default:
228
509
  throw new errors.PolytomicError({
229
510
  statusCode: _response.error.statusCode,
@@ -248,6 +529,8 @@ class ModelSync {
248
529
  }
249
530
  /**
250
531
  * @throws {@link Polytomic.UnauthorizedError}
532
+ * @throws {@link Polytomic.NotFoundError}
533
+ * @throws {@link Polytomic.InternalServerError}
251
534
  *
252
535
  * @example
253
536
  * await polytomic.modelSync.get("248df4b7-aa70-47b8-a036-33ac447e668d")
@@ -260,12 +543,10 @@ class ModelSync {
260
543
  method: "GET",
261
544
  headers: {
262
545
  Authorization: yield this._getAuthorizationHeader(),
263
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
264
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
265
- : undefined,
546
+ "X-Polytomic-Version": "2024-02-08",
266
547
  "X-Fern-Language": "JavaScript",
267
548
  "X-Fern-SDK-Name": "polytomic",
268
- "X-Fern-SDK-Version": "0.1.2",
549
+ "X-Fern-SDK-Version": "1.0.0",
269
550
  "X-Fern-Runtime": core.RUNTIME.type,
270
551
  "X-Fern-Runtime-Version": core.RUNTIME.version,
271
552
  },
@@ -280,6 +561,10 @@ class ModelSync {
280
561
  switch (_response.error.statusCode) {
281
562
  case 401:
282
563
  throw new Polytomic.UnauthorizedError(_response.error.body);
564
+ case 404:
565
+ throw new Polytomic.NotFoundError(_response.error.body);
566
+ case 500:
567
+ throw new Polytomic.InternalServerError(_response.error.body);
283
568
  default:
284
569
  throw new errors.PolytomicError({
285
570
  statusCode: _response.error.statusCode,
@@ -303,39 +588,61 @@ class ModelSync {
303
588
  });
304
589
  }
305
590
  /**
591
+ * @throws {@link Polytomic.BadRequestError}
306
592
  * @throws {@link Polytomic.UnauthorizedError}
593
+ * @throws {@link Polytomic.ForbiddenError}
594
+ * @throws {@link Polytomic.NotFoundError}
595
+ * @throws {@link Polytomic.UnprocessableEntityError}
596
+ * @throws {@link Polytomic.InternalServerError}
307
597
  *
308
598
  * @example
309
- * await polytomic.modelSync.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
599
+ * await polytomic.modelSync.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
600
+ * mode: "create",
601
+ * name: "Users Sync",
602
+ * schedule: {},
603
+ * target: {
604
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
605
+ * object: "Users"
606
+ * }
607
+ * })
310
608
  */
311
- remove(id, requestOptions) {
609
+ update(id, request, requestOptions) {
312
610
  var _a;
313
611
  return __awaiter(this, void 0, void 0, function* () {
314
612
  const _response = yield core.fetcher({
315
613
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${id}`),
316
- method: "DELETE",
614
+ method: "PUT",
317
615
  headers: {
318
616
  Authorization: yield this._getAuthorizationHeader(),
319
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
320
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
321
- : undefined,
617
+ "X-Polytomic-Version": "2024-02-08",
322
618
  "X-Fern-Language": "JavaScript",
323
619
  "X-Fern-SDK-Name": "polytomic",
324
- "X-Fern-SDK-Version": "0.1.2",
620
+ "X-Fern-SDK-Version": "1.0.0",
325
621
  "X-Fern-Runtime": core.RUNTIME.type,
326
622
  "X-Fern-Runtime-Version": core.RUNTIME.version,
327
623
  },
328
624
  contentType: "application/json",
625
+ body: request,
329
626
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
330
627
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
331
628
  });
332
629
  if (_response.ok) {
333
- return;
630
+ return _response.body;
334
631
  }
335
632
  if (_response.error.reason === "status-code") {
336
633
  switch (_response.error.statusCode) {
634
+ case 400:
635
+ throw new Polytomic.BadRequestError(_response.error.body);
337
636
  case 401:
338
637
  throw new Polytomic.UnauthorizedError(_response.error.body);
638
+ case 403:
639
+ throw new Polytomic.ForbiddenError(_response.error.body);
640
+ case 404:
641
+ throw new Polytomic.NotFoundError(_response.error.body);
642
+ case 422:
643
+ throw new Polytomic.UnprocessableEntityError(_response.error.body);
644
+ case 500:
645
+ throw new Polytomic.InternalServerError(_response.error.body);
339
646
  default:
340
647
  throw new errors.PolytomicError({
341
648
  statusCode: _response.error.statusCode,
@@ -360,67 +667,45 @@ class ModelSync {
360
667
  }
361
668
  /**
362
669
  * @throws {@link Polytomic.UnauthorizedError}
670
+ * @throws {@link Polytomic.ForbiddenError}
671
+ * @throws {@link Polytomic.NotFoundError}
672
+ * @throws {@link Polytomic.InternalServerError}
363
673
  *
364
674
  * @example
365
- * await polytomic.modelSync.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
366
- * fields: [{
367
- * source: {
368
- * field: "id",
369
- * model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
370
- * },
371
- * target: "name"
372
- * }],
373
- * filter_logic: "A and B or C",
374
- * identity: {
375
- * function: "Equality",
376
- * source: {
377
- * field: "id",
378
- * model_id: "248df4b7-aa70-47b8-a036-33ac447e668d"
379
- * },
380
- * target: "name"
381
- * },
382
- * mode: "create",
383
- * name: "Users Sync",
384
- * schedule: {
385
- * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
386
- * frequency: "daily"
387
- * },
388
- * sync_all_records: false,
389
- * target: {
390
- * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
391
- * object: "Users"
392
- * }
393
- * })
675
+ * await polytomic.modelSync.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
394
676
  */
395
- update(id, request, requestOptions) {
677
+ remove(id, requestOptions) {
396
678
  var _a;
397
679
  return __awaiter(this, void 0, void 0, function* () {
398
680
  const _response = yield core.fetcher({
399
681
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${id}`),
400
- method: "PATCH",
682
+ method: "DELETE",
401
683
  headers: {
402
684
  Authorization: yield this._getAuthorizationHeader(),
403
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
404
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
405
- : undefined,
685
+ "X-Polytomic-Version": "2024-02-08",
406
686
  "X-Fern-Language": "JavaScript",
407
687
  "X-Fern-SDK-Name": "polytomic",
408
- "X-Fern-SDK-Version": "0.1.2",
688
+ "X-Fern-SDK-Version": "1.0.0",
409
689
  "X-Fern-Runtime": core.RUNTIME.type,
410
690
  "X-Fern-Runtime-Version": core.RUNTIME.version,
411
691
  },
412
692
  contentType: "application/json",
413
- body: request,
414
693
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
415
694
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
416
695
  });
417
696
  if (_response.ok) {
418
- return _response.body;
697
+ return;
419
698
  }
420
699
  if (_response.error.reason === "status-code") {
421
700
  switch (_response.error.statusCode) {
422
701
  case 401:
423
702
  throw new Polytomic.UnauthorizedError(_response.error.body);
703
+ case 403:
704
+ throw new Polytomic.ForbiddenError(_response.error.body);
705
+ case 404:
706
+ throw new Polytomic.NotFoundError(_response.error.body);
707
+ case 500:
708
+ throw new Polytomic.InternalServerError(_response.error.body);
424
709
  default:
425
710
  throw new errors.PolytomicError({
426
711
  statusCode: _response.error.statusCode,
@@ -445,6 +730,9 @@ class ModelSync {
445
730
  }
446
731
  /**
447
732
  * @throws {@link Polytomic.UnauthorizedError}
733
+ * @throws {@link Polytomic.ForbiddenError}
734
+ * @throws {@link Polytomic.NotFoundError}
735
+ * @throws {@link Polytomic.InternalServerError}
448
736
  *
449
737
  * @example
450
738
  * await polytomic.modelSync.activate("248df4b7-aa70-47b8-a036-33ac447e668d", {
@@ -459,12 +747,10 @@ class ModelSync {
459
747
  method: "POST",
460
748
  headers: {
461
749
  Authorization: yield this._getAuthorizationHeader(),
462
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
463
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
464
- : undefined,
750
+ "X-Polytomic-Version": "2024-02-08",
465
751
  "X-Fern-Language": "JavaScript",
466
752
  "X-Fern-SDK-Name": "polytomic",
467
- "X-Fern-SDK-Version": "0.1.2",
753
+ "X-Fern-SDK-Version": "1.0.0",
468
754
  "X-Fern-Runtime": core.RUNTIME.type,
469
755
  "X-Fern-Runtime-Version": core.RUNTIME.version,
470
756
  },
@@ -480,6 +766,12 @@ class ModelSync {
480
766
  switch (_response.error.statusCode) {
481
767
  case 401:
482
768
  throw new Polytomic.UnauthorizedError(_response.error.body);
769
+ case 403:
770
+ throw new Polytomic.ForbiddenError(_response.error.body);
771
+ case 404:
772
+ throw new Polytomic.NotFoundError(_response.error.body);
773
+ case 500:
774
+ throw new Polytomic.InternalServerError(_response.error.body);
483
775
  default:
484
776
  throw new errors.PolytomicError({
485
777
  statusCode: _response.error.statusCode,
@@ -503,7 +795,14 @@ class ModelSync {
503
795
  });
504
796
  }
505
797
  /**
798
+ * > 🚧 Force full resync
799
+ * >
800
+ * > Use caution when setting the `resync` parameter to `true`. This will force a full resync of the data from the source system. This can be a time-consuming operation and may impact the performance of the source system. It is recommended to only use this option when necessary.
801
+ * @throws {@link Polytomic.BadRequestError}
506
802
  * @throws {@link Polytomic.UnauthorizedError}
803
+ * @throws {@link Polytomic.ForbiddenError}
804
+ * @throws {@link Polytomic.NotFoundError}
805
+ * @throws {@link Polytomic.InternalServerError}
507
806
  *
508
807
  * @example
509
808
  * await polytomic.modelSync.start("248df4b7-aa70-47b8-a036-33ac447e668d", {})
@@ -516,12 +815,10 @@ class ModelSync {
516
815
  method: "POST",
517
816
  headers: {
518
817
  Authorization: yield this._getAuthorizationHeader(),
519
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
520
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
521
- : undefined,
818
+ "X-Polytomic-Version": "2024-02-08",
522
819
  "X-Fern-Language": "JavaScript",
523
820
  "X-Fern-SDK-Name": "polytomic",
524
- "X-Fern-SDK-Version": "0.1.2",
821
+ "X-Fern-SDK-Version": "1.0.0",
525
822
  "X-Fern-Runtime": core.RUNTIME.type,
526
823
  "X-Fern-Runtime-Version": core.RUNTIME.version,
527
824
  },
@@ -535,8 +832,16 @@ class ModelSync {
535
832
  }
536
833
  if (_response.error.reason === "status-code") {
537
834
  switch (_response.error.statusCode) {
835
+ case 400:
836
+ throw new Polytomic.BadRequestError(_response.error.body);
538
837
  case 401:
539
838
  throw new Polytomic.UnauthorizedError(_response.error.body);
839
+ case 403:
840
+ throw new Polytomic.ForbiddenError(_response.error.body);
841
+ case 404:
842
+ throw new Polytomic.NotFoundError(_response.error.body);
843
+ case 500:
844
+ throw new Polytomic.InternalServerError(_response.error.body);
540
845
  default:
541
846
  throw new errors.PolytomicError({
542
847
  statusCode: _response.error.statusCode,
@@ -561,6 +866,8 @@ class ModelSync {
561
866
  }
562
867
  /**
563
868
  * @throws {@link Polytomic.UnauthorizedError}
869
+ * @throws {@link Polytomic.NotFoundError}
870
+ * @throws {@link Polytomic.InternalServerError}
564
871
  *
565
872
  * @example
566
873
  * await polytomic.modelSync.getStatus("248df4b7-aa70-47b8-a036-33ac447e668d")
@@ -573,12 +880,10 @@ class ModelSync {
573
880
  method: "GET",
574
881
  headers: {
575
882
  Authorization: yield this._getAuthorizationHeader(),
576
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
577
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
578
- : undefined,
883
+ "X-Polytomic-Version": "2024-02-08",
579
884
  "X-Fern-Language": "JavaScript",
580
885
  "X-Fern-SDK-Name": "polytomic",
581
- "X-Fern-SDK-Version": "0.1.2",
886
+ "X-Fern-SDK-Version": "1.0.0",
582
887
  "X-Fern-Runtime": core.RUNTIME.type,
583
888
  "X-Fern-Runtime-Version": core.RUNTIME.version,
584
889
  },
@@ -593,6 +898,10 @@ class ModelSync {
593
898
  switch (_response.error.statusCode) {
594
899
  case 401:
595
900
  throw new Polytomic.UnauthorizedError(_response.error.body);
901
+ case 404:
902
+ throw new Polytomic.NotFoundError(_response.error.body);
903
+ case 500:
904
+ throw new Polytomic.InternalServerError(_response.error.body);
596
905
  default:
597
906
  throw new errors.PolytomicError({
598
907
  statusCode: _response.error.statusCode,
@@ -621,11 +930,7 @@ class ModelSync {
621
930
  }
622
931
  _getAuthorizationHeader() {
623
932
  return __awaiter(this, void 0, void 0, function* () {
624
- const bearer = yield core.Supplier.get(this._options.token);
625
- if (bearer != null) {
626
- return `Bearer ${bearer}`;
627
- }
628
- return undefined;
933
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
629
934
  });
630
935
  }
631
936
  }