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
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
7
7
  export declare namespace Models {
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,50 +16,60 @@ export declare namespace Models {
17
16
  }
18
17
  export declare class Models {
19
18
  protected readonly _options: Models.Options;
20
- constructor(_options?: Models.Options);
19
+ constructor(_options: Models.Options);
21
20
  /**
22
21
  * @throws {@link Polytomic.UnauthorizedError}
22
+ * @throws {@link Polytomic.NotFoundError}
23
23
  *
24
24
  * @example
25
25
  * await polytomic.models.list()
26
26
  */
27
27
  list(requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelListResponseEnvelope>;
28
28
  /**
29
+ * @throws {@link Polytomic.BadRequestError}
29
30
  * @throws {@link Polytomic.UnauthorizedError}
31
+ * @throws {@link Polytomic.ForbiddenError}
32
+ * @throws {@link Polytomic.InternalServerError}
30
33
  *
31
34
  * @example
32
35
  * await polytomic.models.create({
33
36
  * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
34
- * identifier: "id",
35
37
  * name: "Users"
36
38
  * })
37
39
  */
38
40
  create(request: Polytomic.CreateModelRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
39
41
  /**
40
42
  * @throws {@link Polytomic.UnauthorizedError}
43
+ * @throws {@link Polytomic.NotFoundError}
44
+ * @throws {@link Polytomic.InternalServerError}
41
45
  *
42
46
  * @example
43
47
  * await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d")
44
48
  */
45
49
  get(id: string, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
46
50
  /**
51
+ * @throws {@link Polytomic.BadRequestError}
47
52
  * @throws {@link Polytomic.UnauthorizedError}
48
- *
49
- * @example
50
- * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
51
- */
52
- remove(id: string, requestOptions?: Models.RequestOptions): Promise<void>;
53
- /**
54
- * @throws {@link Polytomic.UnauthorizedError}
53
+ * @throws {@link Polytomic.NotFoundError}
54
+ * @throws {@link Polytomic.InternalServerError}
55
55
  *
56
56
  * @example
57
57
  * await polytomic.models.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
58
58
  * async: false,
59
59
  * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
60
- * identifier: "id",
61
60
  * name: "Users"
62
61
  * })
63
62
  */
64
63
  update(id: string, request: Polytomic.UpdateModelRequest, requestOptions?: Models.RequestOptions): Promise<Polytomic.ModelResponseEnvelope>;
65
- protected _getAuthorizationHeader(): Promise<string | undefined>;
64
+ /**
65
+ * @throws {@link Polytomic.UnauthorizedError}
66
+ * @throws {@link Polytomic.ForbiddenError}
67
+ * @throws {@link Polytomic.NotFoundError}
68
+ * @throws {@link Polytomic.InternalServerError}
69
+ *
70
+ * @example
71
+ * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
72
+ */
73
+ remove(id: string, requestOptions?: Models.RequestOptions): Promise<void>;
74
+ protected _getAuthorizationHeader(): Promise<string>;
66
75
  }
@@ -56,11 +56,12 @@ const Polytomic = __importStar(require("../../.."));
56
56
  const url_join_1 = __importDefault(require("url-join"));
57
57
  const errors = __importStar(require("../../../../errors"));
58
58
  class Models {
59
- constructor(_options = {}) {
59
+ constructor(_options) {
60
60
  this._options = _options;
61
61
  }
62
62
  /**
63
63
  * @throws {@link Polytomic.UnauthorizedError}
64
+ * @throws {@link Polytomic.NotFoundError}
64
65
  *
65
66
  * @example
66
67
  * await polytomic.models.list()
@@ -73,12 +74,10 @@ class Models {
73
74
  method: "GET",
74
75
  headers: {
75
76
  Authorization: yield this._getAuthorizationHeader(),
76
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
77
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
78
- : undefined,
77
+ "X-Polytomic-Version": "2024-02-08",
79
78
  "X-Fern-Language": "JavaScript",
80
79
  "X-Fern-SDK-Name": "polytomic",
81
- "X-Fern-SDK-Version": "0.1.2",
80
+ "X-Fern-SDK-Version": "1.0.0",
82
81
  "X-Fern-Runtime": core.RUNTIME.type,
83
82
  "X-Fern-Runtime-Version": core.RUNTIME.version,
84
83
  },
@@ -93,6 +92,8 @@ class Models {
93
92
  switch (_response.error.statusCode) {
94
93
  case 401:
95
94
  throw new Polytomic.UnauthorizedError(_response.error.body);
95
+ case 404:
96
+ throw new Polytomic.NotFoundError(_response.error.body);
96
97
  default:
97
98
  throw new errors.PolytomicError({
98
99
  statusCode: _response.error.statusCode,
@@ -116,12 +117,14 @@ class Models {
116
117
  });
117
118
  }
118
119
  /**
120
+ * @throws {@link Polytomic.BadRequestError}
119
121
  * @throws {@link Polytomic.UnauthorizedError}
122
+ * @throws {@link Polytomic.ForbiddenError}
123
+ * @throws {@link Polytomic.InternalServerError}
120
124
  *
121
125
  * @example
122
126
  * await polytomic.models.create({
123
127
  * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
124
- * identifier: "id",
125
128
  * name: "Users"
126
129
  * })
127
130
  */
@@ -138,12 +141,10 @@ class Models {
138
141
  method: "POST",
139
142
  headers: {
140
143
  Authorization: yield this._getAuthorizationHeader(),
141
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
142
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
143
- : undefined,
144
+ "X-Polytomic-Version": "2024-02-08",
144
145
  "X-Fern-Language": "JavaScript",
145
146
  "X-Fern-SDK-Name": "polytomic",
146
- "X-Fern-SDK-Version": "0.1.2",
147
+ "X-Fern-SDK-Version": "1.0.0",
147
148
  "X-Fern-Runtime": core.RUNTIME.type,
148
149
  "X-Fern-Runtime-Version": core.RUNTIME.version,
149
150
  },
@@ -158,8 +159,14 @@ class Models {
158
159
  }
159
160
  if (_response.error.reason === "status-code") {
160
161
  switch (_response.error.statusCode) {
162
+ case 400:
163
+ throw new Polytomic.BadRequestError(_response.error.body);
161
164
  case 401:
162
165
  throw new Polytomic.UnauthorizedError(_response.error.body);
166
+ case 403:
167
+ throw new Polytomic.ForbiddenError(_response.error.body);
168
+ case 500:
169
+ throw new Polytomic.InternalServerError(_response.error.body);
163
170
  default:
164
171
  throw new errors.PolytomicError({
165
172
  statusCode: _response.error.statusCode,
@@ -184,6 +191,8 @@ class Models {
184
191
  }
185
192
  /**
186
193
  * @throws {@link Polytomic.UnauthorizedError}
194
+ * @throws {@link Polytomic.NotFoundError}
195
+ * @throws {@link Polytomic.InternalServerError}
187
196
  *
188
197
  * @example
189
198
  * await polytomic.models.get("248df4b7-aa70-47b8-a036-33ac447e668d")
@@ -196,12 +205,10 @@ class Models {
196
205
  method: "GET",
197
206
  headers: {
198
207
  Authorization: yield this._getAuthorizationHeader(),
199
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
200
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
201
- : undefined,
208
+ "X-Polytomic-Version": "2024-02-08",
202
209
  "X-Fern-Language": "JavaScript",
203
210
  "X-Fern-SDK-Name": "polytomic",
204
- "X-Fern-SDK-Version": "0.1.2",
211
+ "X-Fern-SDK-Version": "1.0.0",
205
212
  "X-Fern-Runtime": core.RUNTIME.type,
206
213
  "X-Fern-Runtime-Version": core.RUNTIME.version,
207
214
  },
@@ -216,6 +223,10 @@ class Models {
216
223
  switch (_response.error.statusCode) {
217
224
  case 401:
218
225
  throw new Polytomic.UnauthorizedError(_response.error.body);
226
+ case 404:
227
+ throw new Polytomic.NotFoundError(_response.error.body);
228
+ case 500:
229
+ throw new Polytomic.InternalServerError(_response.error.body);
219
230
  default:
220
231
  throw new errors.PolytomicError({
221
232
  statusCode: _response.error.statusCode,
@@ -239,39 +250,57 @@ class Models {
239
250
  });
240
251
  }
241
252
  /**
253
+ * @throws {@link Polytomic.BadRequestError}
242
254
  * @throws {@link Polytomic.UnauthorizedError}
255
+ * @throws {@link Polytomic.NotFoundError}
256
+ * @throws {@link Polytomic.InternalServerError}
243
257
  *
244
258
  * @example
245
- * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
259
+ * await polytomic.models.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
260
+ * async: false,
261
+ * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
262
+ * name: "Users"
263
+ * })
246
264
  */
247
- remove(id, requestOptions) {
265
+ update(id, request, requestOptions) {
248
266
  var _a;
249
267
  return __awaiter(this, void 0, void 0, function* () {
268
+ const { async } = request, _body = __rest(request, ["async"]);
269
+ const _queryParams = {};
270
+ if (async != null) {
271
+ _queryParams["async"] = async.toString();
272
+ }
250
273
  const _response = yield core.fetcher({
251
274
  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}`),
252
- method: "DELETE",
275
+ method: "PUT",
253
276
  headers: {
254
277
  Authorization: yield this._getAuthorizationHeader(),
255
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
256
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
257
- : undefined,
278
+ "X-Polytomic-Version": "2024-02-08",
258
279
  "X-Fern-Language": "JavaScript",
259
280
  "X-Fern-SDK-Name": "polytomic",
260
- "X-Fern-SDK-Version": "0.1.2",
281
+ "X-Fern-SDK-Version": "1.0.0",
261
282
  "X-Fern-Runtime": core.RUNTIME.type,
262
283
  "X-Fern-Runtime-Version": core.RUNTIME.version,
263
284
  },
264
285
  contentType: "application/json",
286
+ queryParameters: _queryParams,
287
+ body: _body,
265
288
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
266
289
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
267
290
  });
268
291
  if (_response.ok) {
269
- return;
292
+ return _response.body;
270
293
  }
271
294
  if (_response.error.reason === "status-code") {
272
295
  switch (_response.error.statusCode) {
296
+ case 400:
297
+ throw new Polytomic.BadRequestError(_response.error.body);
273
298
  case 401:
274
299
  throw new Polytomic.UnauthorizedError(_response.error.body);
300
+ case 404:
301
+ throw new Polytomic.NotFoundError(_response.error.body);
302
+ case 500:
303
+ throw new Polytomic.InternalServerError(_response.error.body);
275
304
  default:
276
305
  throw new errors.PolytomicError({
277
306
  statusCode: _response.error.statusCode,
@@ -296,50 +325,45 @@ class Models {
296
325
  }
297
326
  /**
298
327
  * @throws {@link Polytomic.UnauthorizedError}
328
+ * @throws {@link Polytomic.ForbiddenError}
329
+ * @throws {@link Polytomic.NotFoundError}
330
+ * @throws {@link Polytomic.InternalServerError}
299
331
  *
300
332
  * @example
301
- * await polytomic.models.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
302
- * async: false,
303
- * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
304
- * identifier: "id",
305
- * name: "Users"
306
- * })
333
+ * await polytomic.models.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
307
334
  */
308
- update(id, request, requestOptions) {
335
+ remove(id, requestOptions) {
309
336
  var _a;
310
337
  return __awaiter(this, void 0, void 0, function* () {
311
- const { async } = request, _body = __rest(request, ["async"]);
312
- const _queryParams = {};
313
- if (async != null) {
314
- _queryParams["async"] = async.toString();
315
- }
316
338
  const _response = yield core.fetcher({
317
339
  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}`),
318
- method: "PATCH",
340
+ method: "DELETE",
319
341
  headers: {
320
342
  Authorization: yield this._getAuthorizationHeader(),
321
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
322
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
323
- : undefined,
343
+ "X-Polytomic-Version": "2024-02-08",
324
344
  "X-Fern-Language": "JavaScript",
325
345
  "X-Fern-SDK-Name": "polytomic",
326
- "X-Fern-SDK-Version": "0.1.2",
346
+ "X-Fern-SDK-Version": "1.0.0",
327
347
  "X-Fern-Runtime": core.RUNTIME.type,
328
348
  "X-Fern-Runtime-Version": core.RUNTIME.version,
329
349
  },
330
350
  contentType: "application/json",
331
- queryParameters: _queryParams,
332
- body: _body,
333
351
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
334
352
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
335
353
  });
336
354
  if (_response.ok) {
337
- return _response.body;
355
+ return;
338
356
  }
339
357
  if (_response.error.reason === "status-code") {
340
358
  switch (_response.error.statusCode) {
341
359
  case 401:
342
360
  throw new Polytomic.UnauthorizedError(_response.error.body);
361
+ case 403:
362
+ throw new Polytomic.ForbiddenError(_response.error.body);
363
+ case 404:
364
+ throw new Polytomic.NotFoundError(_response.error.body);
365
+ case 500:
366
+ throw new Polytomic.InternalServerError(_response.error.body);
343
367
  default:
344
368
  throw new errors.PolytomicError({
345
369
  statusCode: _response.error.statusCode,
@@ -364,11 +388,7 @@ class Models {
364
388
  }
365
389
  _getAuthorizationHeader() {
366
390
  return __awaiter(this, void 0, void 0, function* () {
367
- const bearer = yield core.Supplier.get(this._options.token);
368
- if (bearer != null) {
369
- return `Bearer ${bearer}`;
370
- }
371
- return undefined;
391
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
372
392
  });
373
393
  }
374
394
  }
@@ -6,7 +6,6 @@ import * as Polytomic from "../../../..";
6
6
  * @example
7
7
  * {
8
8
  * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
9
- * identifier: "id",
10
9
  * name: "Users"
11
10
  * }
12
11
  */
@@ -7,7 +7,6 @@ import * as Polytomic from "../../../..";
7
7
  * {
8
8
  * async: false,
9
9
  * connection_id: "248df4b7-aa70-47b8-a036-33ac447e668d",
10
- * identifier: "id",
11
10
  * name: "Users"
12
11
  * }
13
12
  */
@@ -7,8 +7,7 @@ import * as Polytomic from "../../..";
7
7
  export declare namespace Organization {
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,12 +16,13 @@ export declare namespace Organization {
17
16
  }
18
17
  export declare class Organization {
19
18
  protected readonly _options: Organization.Options;
20
- constructor(_options?: Organization.Options);
19
+ constructor(_options: Organization.Options);
21
20
  /**
22
21
  * > 🚧 Requires partner key
23
22
  * >
24
- * > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
23
+ * > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
25
24
  * @throws {@link Polytomic.UnauthorizedError}
25
+ * @throws {@link Polytomic.InternalServerError}
26
26
  *
27
27
  * @example
28
28
  * await polytomic.organization.list()
@@ -31,25 +31,23 @@ export declare class Organization {
31
31
  /**
32
32
  * > 🚧 Requires partner key
33
33
  * >
34
- * > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
34
+ * > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
35
35
  * @throws {@link Polytomic.UnauthorizedError}
36
+ * @throws {@link Polytomic.UnprocessableEntityError}
37
+ * @throws {@link Polytomic.InternalServerError}
36
38
  *
37
39
  * @example
38
40
  * await polytomic.organization.create({
39
- * client_id: "client_id",
40
- * client_secret: "client_secret",
41
- * issuer: "https://example.com",
42
- * name: "My Organization",
43
- * sso_domain: "example.com",
44
- * sso_org_id: "123456"
41
+ * name: "My Organization"
45
42
  * })
46
43
  */
47
44
  create(request: Polytomic.CreateOrganizationRequestSchema, requestOptions?: Organization.RequestOptions): Promise<Polytomic.OrganizationEnvelope>;
48
45
  /**
49
46
  * > 🚧 Requires partner key
50
47
  * >
51
- * > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
48
+ * > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
52
49
  * @throws {@link Polytomic.UnauthorizedError}
50
+ * @throws {@link Polytomic.NotFoundError}
53
51
  *
54
52
  * @example
55
53
  * await polytomic.organization.get("248df4b7-aa70-47b8-a036-33ac447e668d")
@@ -58,29 +56,28 @@ export declare class Organization {
58
56
  /**
59
57
  * > 🚧 Requires partner key
60
58
  * >
61
- * > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
59
+ * > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
62
60
  * @throws {@link Polytomic.UnauthorizedError}
61
+ * @throws {@link Polytomic.UnprocessableEntityError}
62
+ * @throws {@link Polytomic.InternalServerError}
63
63
  *
64
64
  * @example
65
- * await polytomic.organization.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
65
+ * await polytomic.organization.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
66
+ * name: "My Organization"
67
+ * })
66
68
  */
67
- remove(id: string, requestOptions?: Organization.RequestOptions): Promise<void>;
69
+ update(id: string, request: Polytomic.UpdateOrganizationRequestSchema, requestOptions?: Organization.RequestOptions): Promise<Polytomic.OrganizationEnvelope>;
68
70
  /**
69
71
  * > 🚧 Requires partner key
70
72
  * >
71
- * > Organization endpoints are only accessible using [partner keys](https://docs.polytomic.com/reference/authentication#partner-keys)
73
+ * > Organization endpoints are only accessible using [partner keys](https://apidocs.polytomic.com/getting-started/obtaining-api-keys#partner-keys)
72
74
  * @throws {@link Polytomic.UnauthorizedError}
75
+ * @throws {@link Polytomic.NotFoundError}
76
+ * @throws {@link Polytomic.InternalServerError}
73
77
  *
74
78
  * @example
75
- * await polytomic.organization.update("248df4b7-aa70-47b8-a036-33ac447e668d", {
76
- * client_id: "client_id",
77
- * client_secret: "client_secret",
78
- * issuer: "https://example.com",
79
- * name: "My Organization",
80
- * sso_domain: "example.com",
81
- * sso_org_id: "123456"
82
- * })
79
+ * await polytomic.organization.remove("248df4b7-aa70-47b8-a036-33ac447e668d")
83
80
  */
84
- update(id: string, request: Polytomic.UpdateOrganizationRequestSchema, requestOptions?: Organization.RequestOptions): Promise<Polytomic.OrganizationEnvelope>;
85
- protected _getAuthorizationHeader(): Promise<string | undefined>;
81
+ remove(id: string, requestOptions?: Organization.RequestOptions): Promise<void>;
82
+ protected _getAuthorizationHeader(): Promise<string>;
86
83
  }