@paid-ai/paid-node 0.5.0-alpha2 → 0.5.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 (269) hide show
  1. package/README.md +118 -36
  2. package/dist/cjs/Client.d.ts +35 -3
  3. package/dist/cjs/Client.js +57 -19
  4. package/dist/cjs/api/errors/InternalServerError.d.ts +9 -0
  5. package/dist/cjs/api/errors/InternalServerError.js +52 -0
  6. package/dist/cjs/api/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/errors/index.js +1 -0
  8. package/dist/cjs/api/index.d.ts +1 -1
  9. package/dist/cjs/api/index.js +1 -1
  10. package/dist/cjs/api/resources/agents/client/Client.d.ts +16 -0
  11. package/dist/cjs/api/resources/agents/client/Client.js +16 -0
  12. package/dist/cjs/api/resources/customers/client/Client.d.ts +38 -0
  13. package/dist/cjs/api/resources/customers/client/Client.js +164 -0
  14. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +2 -0
  15. package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.ts +30 -0
  16. package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.ts +30 -0
  17. package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.js +5 -0
  18. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/index.d.ts +8 -1
  20. package/dist/cjs/api/resources/index.js +9 -2
  21. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +2 -0
  22. package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +0 -2
  23. package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +0 -2
  24. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +0 -2
  25. package/dist/cjs/api/resources/plans/client/Client.d.ts +75 -0
  26. package/dist/cjs/api/resources/plans/client/Client.js +272 -0
  27. package/dist/cjs/api/resources/plans/client/index.d.ts +1 -0
  28. package/dist/cjs/api/resources/plans/client/index.js +17 -0
  29. package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.d.ts +35 -0
  30. package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.js +5 -0
  31. package/dist/cjs/api/resources/plans/client/requests/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/plans/client/requests/index.js +2 -0
  33. package/dist/cjs/api/resources/plans/index.d.ts +1 -0
  34. package/dist/cjs/api/resources/plans/index.js +17 -0
  35. package/dist/cjs/api/resources/products/client/Client.d.ts +109 -0
  36. package/dist/cjs/api/resources/products/client/Client.js +470 -0
  37. package/dist/cjs/api/resources/products/client/index.d.ts +1 -0
  38. package/dist/cjs/api/resources/products/client/index.js +17 -0
  39. package/dist/cjs/api/resources/products/client/requests/ProductCreate.d.ts +29 -0
  40. package/dist/cjs/api/resources/products/client/requests/ProductCreate.js +14 -0
  41. package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -0
  42. package/dist/cjs/api/resources/products/client/requests/index.js +2 -0
  43. package/dist/cjs/api/resources/products/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/products/index.js +17 -0
  45. package/dist/cjs/api/resources/traces/client/Client.d.ts +52 -0
  46. package/dist/cjs/api/resources/traces/client/Client.js +166 -0
  47. package/dist/cjs/api/resources/traces/client/index.d.ts +1 -0
  48. package/dist/cjs/api/resources/traces/client/index.js +17 -0
  49. package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.d.ts +50 -0
  50. package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.js +5 -0
  51. package/dist/cjs/api/resources/traces/client/requests/index.d.ts +1 -0
  52. package/dist/cjs/api/resources/traces/client/requests/index.js +2 -0
  53. package/dist/cjs/api/resources/traces/index.d.ts +1 -0
  54. package/dist/cjs/api/resources/traces/index.js +17 -0
  55. package/dist/cjs/api/resources/usage/client/Client.d.ts +47 -0
  56. package/dist/cjs/api/resources/usage/client/Client.js +146 -0
  57. package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.d.ts +28 -0
  58. package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.js +5 -0
  59. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +29 -0
  60. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.js +5 -0
  61. package/dist/cjs/api/resources/usage/client/requests/index.d.ts +2 -0
  62. package/dist/cjs/api/resources/usage/index.d.ts +1 -0
  63. package/dist/cjs/api/resources/usage/index.js +1 -0
  64. package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.d.ts +17 -0
  65. package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.js +5 -0
  66. package/dist/cjs/api/resources/usage/types/index.d.ts +1 -0
  67. package/dist/cjs/api/resources/usage/types/index.js +17 -0
  68. package/dist/cjs/api/types/CostAmount.d.ts +12 -0
  69. package/dist/cjs/api/types/CostAmount.js +5 -0
  70. package/dist/cjs/api/types/CostTrace.d.ts +22 -0
  71. package/dist/cjs/api/types/CostTrace.js +5 -0
  72. package/dist/cjs/api/types/CostTracesResponse.d.ts +11 -0
  73. package/dist/cjs/api/types/CostTracesResponse.js +5 -0
  74. package/dist/cjs/api/types/Customer.d.ts +2 -0
  75. package/dist/cjs/api/types/CustomerUpdate.d.ts +2 -0
  76. package/dist/cjs/api/types/OrderLineAttributeCreateOne.d.ts +4 -0
  77. package/dist/cjs/api/types/OrderLineAttributeCreateOne.js +5 -0
  78. package/dist/cjs/api/types/OrderLineCreate.d.ts +10 -4
  79. package/dist/cjs/api/types/PaginationMeta.d.ts +28 -0
  80. package/dist/cjs/api/types/PaginationMeta.js +5 -0
  81. package/dist/cjs/api/types/Plan.d.ts +58 -0
  82. package/dist/cjs/api/types/Plan.js +5 -0
  83. package/dist/cjs/api/types/PlanGroup.d.ts +23 -0
  84. package/dist/cjs/api/types/PlanGroup.js +5 -0
  85. package/dist/cjs/api/types/Product.d.ts +36 -0
  86. package/dist/cjs/api/types/Product.js +14 -0
  87. package/dist/cjs/api/types/ProductUpdate.d.ts +23 -0
  88. package/dist/cjs/api/types/ProductUpdate.js +14 -0
  89. package/dist/cjs/api/types/Signal.d.ts +7 -2
  90. package/dist/cjs/api/types/SignalV2.d.ts +22 -0
  91. package/dist/cjs/api/types/SignalV2.js +5 -0
  92. package/dist/cjs/api/types/Trace.d.ts +26 -0
  93. package/dist/cjs/api/types/Trace.js +5 -0
  94. package/dist/cjs/api/types/TracesResponse.d.ts +11 -0
  95. package/dist/cjs/api/types/TracesResponse.js +5 -0
  96. package/dist/cjs/api/types/UsagePaginationMeta.d.ts +16 -0
  97. package/dist/cjs/api/types/UsagePaginationMeta.js +5 -0
  98. package/dist/cjs/api/types/UsageSummariesResponse.d.ts +11 -0
  99. package/dist/cjs/api/types/UsageSummariesResponse.js +5 -0
  100. package/dist/cjs/api/types/UsageSummary.d.ts +58 -0
  101. package/dist/cjs/api/types/UsageSummary.js +5 -0
  102. package/dist/cjs/api/types/index.d.ts +15 -1
  103. package/dist/cjs/api/types/index.js +15 -1
  104. package/dist/cjs/index.d.ts +1 -0
  105. package/dist/cjs/index.js +4 -0
  106. package/dist/cjs/integrations/adapters/expressjs/base-adapter.d.ts +17 -0
  107. package/dist/cjs/integrations/adapters/expressjs/base-adapter.js +71 -0
  108. package/dist/cjs/integrations/adapters/expressjs/index.d.ts +6 -0
  109. package/dist/cjs/integrations/adapters/expressjs/index.js +20 -0
  110. package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +162 -0
  111. package/dist/cjs/integrations/adapters/expressjs/routes.js +269 -0
  112. package/dist/cjs/integrations/adapters/nestjs/index.d.ts +7 -0
  113. package/dist/cjs/integrations/adapters/nestjs/index.js +23 -0
  114. package/dist/cjs/tracing/autoInstrumentation.d.ts +10 -0
  115. package/dist/cjs/tracing/autoInstrumentation.js +57 -0
  116. package/dist/cjs/tracing/index.d.ts +4 -0
  117. package/dist/cjs/tracing/index.js +12 -0
  118. package/dist/cjs/tracing/signal.d.ts +18 -1
  119. package/dist/cjs/tracing/signal.js +29 -13
  120. package/dist/cjs/tracing/spanProcessor.d.ts +10 -0
  121. package/dist/cjs/tracing/spanProcessor.js +82 -0
  122. package/dist/cjs/tracing/tracing.d.ts +12 -6
  123. package/dist/cjs/tracing/tracing.js +65 -58
  124. package/dist/cjs/tracing/tracingContext.d.ts +8 -0
  125. package/dist/cjs/tracing/tracingContext.js +28 -0
  126. package/dist/cjs/tracing/wrappers/anthropicWrapper.js +11 -7
  127. package/dist/cjs/tracing/wrappers/langchainCallback.js +11 -7
  128. package/dist/cjs/tracing/wrappers/mistralWrapper.js +11 -7
  129. package/dist/cjs/tracing/wrappers/openAiWrapper.js +24 -23
  130. package/dist/cjs/tracing/wrappers/vercelAIWrapper.js +68 -43
  131. package/dist/cjs/version.d.ts +1 -1
  132. package/dist/cjs/version.js +1 -1
  133. package/dist/esm/Client.d.mts +35 -3
  134. package/dist/esm/Client.mjs +54 -16
  135. package/dist/esm/api/errors/InternalServerError.d.mts +9 -0
  136. package/dist/esm/api/errors/InternalServerError.mjs +15 -0
  137. package/dist/esm/api/errors/index.d.mts +1 -0
  138. package/dist/esm/api/errors/index.mjs +1 -0
  139. package/dist/esm/api/index.d.mts +1 -1
  140. package/dist/esm/api/index.mjs +1 -1
  141. package/dist/esm/api/resources/agents/client/Client.d.mts +16 -0
  142. package/dist/esm/api/resources/agents/client/Client.mjs +16 -0
  143. package/dist/esm/api/resources/customers/client/Client.d.mts +38 -0
  144. package/dist/esm/api/resources/customers/client/Client.mjs +164 -0
  145. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +2 -0
  146. package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.mts +30 -0
  147. package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.mts +30 -0
  148. package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.mjs +4 -0
  149. package/dist/esm/api/resources/customers/client/requests/index.d.mts +2 -0
  150. package/dist/esm/api/resources/index.d.mts +8 -1
  151. package/dist/esm/api/resources/index.mjs +8 -1
  152. package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +2 -0
  153. package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +0 -2
  154. package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +0 -2
  155. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +0 -2
  156. package/dist/esm/api/resources/plans/client/Client.d.mts +75 -0
  157. package/dist/esm/api/resources/plans/client/Client.mjs +232 -0
  158. package/dist/esm/api/resources/plans/client/index.d.mts +1 -0
  159. package/dist/esm/api/resources/plans/client/index.mjs +1 -0
  160. package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.d.mts +35 -0
  161. package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.mjs +4 -0
  162. package/dist/esm/api/resources/plans/client/requests/index.d.mts +1 -0
  163. package/dist/esm/api/resources/plans/client/requests/index.mjs +1 -0
  164. package/dist/esm/api/resources/plans/index.d.mts +1 -0
  165. package/dist/esm/api/resources/plans/index.mjs +1 -0
  166. package/dist/esm/api/resources/products/client/Client.d.mts +109 -0
  167. package/dist/esm/api/resources/products/client/Client.mjs +430 -0
  168. package/dist/esm/api/resources/products/client/index.d.mts +1 -0
  169. package/dist/esm/api/resources/products/client/index.mjs +1 -0
  170. package/dist/esm/api/resources/products/client/requests/ProductCreate.d.mts +29 -0
  171. package/dist/esm/api/resources/products/client/requests/ProductCreate.mjs +11 -0
  172. package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -0
  173. package/dist/esm/api/resources/products/client/requests/index.mjs +1 -0
  174. package/dist/esm/api/resources/products/index.d.mts +1 -0
  175. package/dist/esm/api/resources/products/index.mjs +1 -0
  176. package/dist/esm/api/resources/traces/client/Client.d.mts +52 -0
  177. package/dist/esm/api/resources/traces/client/Client.mjs +126 -0
  178. package/dist/esm/api/resources/traces/client/index.d.mts +1 -0
  179. package/dist/esm/api/resources/traces/client/index.mjs +1 -0
  180. package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.d.mts +50 -0
  181. package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.mjs +4 -0
  182. package/dist/esm/api/resources/traces/client/requests/index.d.mts +1 -0
  183. package/dist/esm/api/resources/traces/client/requests/index.mjs +1 -0
  184. package/dist/esm/api/resources/traces/index.d.mts +1 -0
  185. package/dist/esm/api/resources/traces/index.mjs +1 -0
  186. package/dist/esm/api/resources/usage/client/Client.d.mts +47 -0
  187. package/dist/esm/api/resources/usage/client/Client.mjs +146 -0
  188. package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.d.mts +28 -0
  189. package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.mjs +4 -0
  190. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +29 -0
  191. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.mjs +4 -0
  192. package/dist/esm/api/resources/usage/client/requests/index.d.mts +2 -0
  193. package/dist/esm/api/resources/usage/index.d.mts +1 -0
  194. package/dist/esm/api/resources/usage/index.mjs +1 -0
  195. package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.d.mts +17 -0
  196. package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.mjs +4 -0
  197. package/dist/esm/api/resources/usage/types/index.d.mts +1 -0
  198. package/dist/esm/api/resources/usage/types/index.mjs +1 -0
  199. package/dist/esm/api/types/CostAmount.d.mts +12 -0
  200. package/dist/esm/api/types/CostAmount.mjs +4 -0
  201. package/dist/esm/api/types/CostTrace.d.mts +22 -0
  202. package/dist/esm/api/types/CostTrace.mjs +4 -0
  203. package/dist/esm/api/types/CostTracesResponse.d.mts +11 -0
  204. package/dist/esm/api/types/CostTracesResponse.mjs +4 -0
  205. package/dist/esm/api/types/Customer.d.mts +2 -0
  206. package/dist/esm/api/types/CustomerUpdate.d.mts +2 -0
  207. package/dist/esm/api/types/OrderLineAttributeCreateOne.d.mts +4 -0
  208. package/dist/esm/api/types/OrderLineAttributeCreateOne.mjs +4 -0
  209. package/dist/esm/api/types/OrderLineCreate.d.mts +10 -4
  210. package/dist/esm/api/types/PaginationMeta.d.mts +28 -0
  211. package/dist/esm/api/types/PaginationMeta.mjs +4 -0
  212. package/dist/esm/api/types/Plan.d.mts +58 -0
  213. package/dist/esm/api/types/Plan.mjs +4 -0
  214. package/dist/esm/api/types/PlanGroup.d.mts +23 -0
  215. package/dist/esm/api/types/PlanGroup.mjs +4 -0
  216. package/dist/esm/api/types/Product.d.mts +36 -0
  217. package/dist/esm/api/types/Product.mjs +11 -0
  218. package/dist/esm/api/types/ProductUpdate.d.mts +23 -0
  219. package/dist/esm/api/types/ProductUpdate.mjs +11 -0
  220. package/dist/esm/api/types/Signal.d.mts +7 -2
  221. package/dist/esm/api/types/SignalV2.d.mts +22 -0
  222. package/dist/esm/api/types/SignalV2.mjs +4 -0
  223. package/dist/esm/api/types/Trace.d.mts +26 -0
  224. package/dist/esm/api/types/Trace.mjs +4 -0
  225. package/dist/esm/api/types/TracesResponse.d.mts +11 -0
  226. package/dist/esm/api/types/TracesResponse.mjs +4 -0
  227. package/dist/esm/api/types/UsagePaginationMeta.d.mts +16 -0
  228. package/dist/esm/api/types/UsagePaginationMeta.mjs +4 -0
  229. package/dist/esm/api/types/UsageSummariesResponse.d.mts +11 -0
  230. package/dist/esm/api/types/UsageSummariesResponse.mjs +4 -0
  231. package/dist/esm/api/types/UsageSummary.d.mts +58 -0
  232. package/dist/esm/api/types/UsageSummary.mjs +4 -0
  233. package/dist/esm/api/types/index.d.mts +15 -1
  234. package/dist/esm/api/types/index.mjs +15 -1
  235. package/dist/esm/index.d.mts +1 -0
  236. package/dist/esm/index.mjs +1 -0
  237. package/dist/esm/integrations/adapters/expressjs/base-adapter.d.mts +17 -0
  238. package/dist/esm/integrations/adapters/expressjs/base-adapter.mjs +67 -0
  239. package/dist/esm/integrations/adapters/expressjs/index.d.mts +6 -0
  240. package/dist/esm/integrations/adapters/expressjs/index.mjs +6 -0
  241. package/dist/esm/integrations/adapters/expressjs/routes.d.mts +162 -0
  242. package/dist/esm/integrations/adapters/expressjs/routes.mjs +258 -0
  243. package/dist/esm/integrations/adapters/nestjs/index.d.mts +7 -0
  244. package/dist/esm/integrations/adapters/nestjs/index.mjs +7 -0
  245. package/dist/esm/tracing/autoInstrumentation.d.mts +10 -0
  246. package/dist/esm/tracing/autoInstrumentation.mjs +54 -0
  247. package/dist/esm/tracing/index.d.mts +4 -0
  248. package/dist/esm/tracing/index.mjs +4 -0
  249. package/dist/esm/tracing/signal.d.mts +18 -1
  250. package/dist/esm/tracing/signal.mjs +28 -12
  251. package/dist/esm/tracing/spanProcessor.d.mts +10 -0
  252. package/dist/esm/tracing/spanProcessor.mjs +78 -0
  253. package/dist/esm/tracing/tracing.d.mts +12 -6
  254. package/dist/esm/tracing/tracing.mjs +59 -52
  255. package/dist/esm/tracing/tracingContext.d.mts +8 -0
  256. package/dist/esm/tracing/tracingContext.mjs +23 -0
  257. package/dist/esm/tracing/wrappers/anthropicWrapper.mjs +11 -7
  258. package/dist/esm/tracing/wrappers/langchainCallback.mjs +11 -7
  259. package/dist/esm/tracing/wrappers/mistralWrapper.mjs +11 -7
  260. package/dist/esm/tracing/wrappers/openAiWrapper.mjs +24 -23
  261. package/dist/esm/tracing/wrappers/vercelAIWrapper.mjs +68 -43
  262. package/dist/esm/version.d.mts +1 -1
  263. package/dist/esm/version.mjs +1 -1
  264. package/package.json +41 -4
  265. package/reference.md +1147 -153
  266. package/dist/cjs/api/types/OrderLineAttributeCreate.d.ts +0 -12
  267. package/dist/esm/api/types/OrderLineAttributeCreate.d.mts +0 -12
  268. /package/dist/cjs/api/{types/OrderLineAttributeCreate.js → resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.js} +0 -0
  269. /package/dist/esm/api/{types/OrderLineAttributeCreate.mjs → resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.mjs} +0 -0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * externalId: "externalId",
8
+ * limit: 1,
9
+ * offset: 1,
10
+ * startTime: "2024-01-15T09:30:00Z",
11
+ * endTime: "2024-01-15T09:30:00Z"
12
+ * }
13
+ */
14
+ export interface PlansGetUsageRequest {
15
+ /**
16
+ * The external ID of the customer
17
+ */
18
+ externalId: string;
19
+ /**
20
+ * Maximum number of usage summaries to return (1-1000)
21
+ */
22
+ limit?: number;
23
+ /**
24
+ * Number of usage summaries to skip for pagination
25
+ */
26
+ offset?: number;
27
+ /**
28
+ * Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
29
+ */
30
+ startTime?: string;
31
+ /**
32
+ * Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
33
+ */
34
+ endTime?: string;
35
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1 @@
1
+ export { type PlansGetUsageRequest } from "./PlansGetUsageRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,109 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments.mjs";
5
+ import * as core from "../../../../core/index.mjs";
6
+ import * as Paid from "../../../index.mjs";
7
+ export declare namespace Products {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.PaidEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ }
16
+ interface RequestOptions {
17
+ /** The maximum time to wait for a response in seconds. */
18
+ timeoutInSeconds?: number;
19
+ /** The number of times to retry the request. Defaults to 2. */
20
+ maxRetries?: number;
21
+ /** A hook to abort the request. */
22
+ abortSignal?: AbortSignal;
23
+ /** Additional headers to include in the request. */
24
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
25
+ }
26
+ }
27
+ export declare class Products {
28
+ protected readonly _options: Products.Options;
29
+ constructor(_options?: Products.Options);
30
+ /**
31
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @example
34
+ * await client.products.list()
35
+ */
36
+ list(requestOptions?: Products.RequestOptions): core.HttpResponsePromise<Paid.Product[]>;
37
+ private __list;
38
+ /**
39
+ * @param {Paid.ProductCreate} request
40
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
41
+ *
42
+ * @example
43
+ * await client.products.create({
44
+ * name: "Acme Product",
45
+ * description: "Acme Product does amazing things.",
46
+ * externalId: "acme-product",
47
+ * type: "product"
48
+ * })
49
+ */
50
+ create(request: Paid.ProductCreate, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<Paid.Product>;
51
+ private __create;
52
+ /**
53
+ * @param {string} productId
54
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
55
+ *
56
+ * @example
57
+ * await client.products.get("productId")
58
+ */
59
+ get(productId: string, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<Paid.Product>;
60
+ private __get;
61
+ /**
62
+ * @param {string} productId
63
+ * @param {Paid.ProductUpdate} request
64
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
65
+ *
66
+ * @example
67
+ * await client.products.update("productId", {})
68
+ */
69
+ update(productId: string, request: Paid.ProductUpdate, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<Paid.Product>;
70
+ private __update;
71
+ /**
72
+ * @param {string} productId
73
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @example
76
+ * await client.products.delete("productId")
77
+ */
78
+ delete(productId: string, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<void>;
79
+ private __delete;
80
+ /**
81
+ * @param {string} externalId
82
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
83
+ *
84
+ * @example
85
+ * await client.products.getByExternalId("externalId")
86
+ */
87
+ getByExternalId(externalId: string, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<Paid.Product>;
88
+ private __getByExternalId;
89
+ /**
90
+ * @param {string} externalId
91
+ * @param {Paid.ProductUpdate} request
92
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
93
+ *
94
+ * @example
95
+ * await client.products.updateByExternalId("externalId", {})
96
+ */
97
+ updateByExternalId(externalId: string, request: Paid.ProductUpdate, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<Paid.Product>;
98
+ private __updateByExternalId;
99
+ /**
100
+ * @param {string} externalId
101
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
102
+ *
103
+ * @example
104
+ * await client.products.deleteByExternalId("externalId")
105
+ */
106
+ deleteByExternalId(externalId: string, requestOptions?: Products.RequestOptions): core.HttpResponsePromise<void>;
107
+ private __deleteByExternalId;
108
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
109
+ }
@@ -0,0 +1,430 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ import * as environments from "../../../../environments.mjs";
14
+ import * as core from "../../../../core/index.mjs";
15
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
16
+ import urlJoin from "url-join";
17
+ import * as errors from "../../../../errors/index.mjs";
18
+ export class Products {
19
+ constructor(_options = {}) {
20
+ this._options = _options;
21
+ }
22
+ /**
23
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
24
+ *
25
+ * @example
26
+ * await client.products.list()
27
+ */
28
+ list(requestOptions) {
29
+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
30
+ }
31
+ __list(requestOptions) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ var _a, _b, _c;
34
+ const _response = yield core.fetcher({
35
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "products"),
36
+ method: "GET",
37
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
38
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
39
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
40
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
41
+ });
42
+ if (_response.ok) {
43
+ return { data: _response.body, rawResponse: _response.rawResponse };
44
+ }
45
+ if (_response.error.reason === "status-code") {
46
+ throw new errors.PaidError({
47
+ statusCode: _response.error.statusCode,
48
+ body: _response.error.body,
49
+ rawResponse: _response.rawResponse,
50
+ });
51
+ }
52
+ switch (_response.error.reason) {
53
+ case "non-json":
54
+ throw new errors.PaidError({
55
+ statusCode: _response.error.statusCode,
56
+ body: _response.error.rawBody,
57
+ rawResponse: _response.rawResponse,
58
+ });
59
+ case "timeout":
60
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products.");
61
+ case "unknown":
62
+ throw new errors.PaidError({
63
+ message: _response.error.errorMessage,
64
+ rawResponse: _response.rawResponse,
65
+ });
66
+ }
67
+ });
68
+ }
69
+ /**
70
+ * @param {Paid.ProductCreate} request
71
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @example
74
+ * await client.products.create({
75
+ * name: "Acme Product",
76
+ * description: "Acme Product does amazing things.",
77
+ * externalId: "acme-product",
78
+ * type: "product"
79
+ * })
80
+ */
81
+ create(request, requestOptions) {
82
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
83
+ }
84
+ __create(request, requestOptions) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ var _a, _b, _c;
87
+ const _response = yield core.fetcher({
88
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "products"),
89
+ method: "POST",
90
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
91
+ contentType: "application/json",
92
+ requestType: "json",
93
+ body: request,
94
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
95
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
96
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
97
+ });
98
+ if (_response.ok) {
99
+ return { data: _response.body, rawResponse: _response.rawResponse };
100
+ }
101
+ if (_response.error.reason === "status-code") {
102
+ throw new errors.PaidError({
103
+ statusCode: _response.error.statusCode,
104
+ body: _response.error.body,
105
+ rawResponse: _response.rawResponse,
106
+ });
107
+ }
108
+ switch (_response.error.reason) {
109
+ case "non-json":
110
+ throw new errors.PaidError({
111
+ statusCode: _response.error.statusCode,
112
+ body: _response.error.rawBody,
113
+ rawResponse: _response.rawResponse,
114
+ });
115
+ case "timeout":
116
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /products.");
117
+ case "unknown":
118
+ throw new errors.PaidError({
119
+ message: _response.error.errorMessage,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ });
124
+ }
125
+ /**
126
+ * @param {string} productId
127
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
128
+ *
129
+ * @example
130
+ * await client.products.get("productId")
131
+ */
132
+ get(productId, requestOptions) {
133
+ return core.HttpResponsePromise.fromPromise(this.__get(productId, requestOptions));
134
+ }
135
+ __get(productId, requestOptions) {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ var _a, _b, _c;
138
+ const _response = yield core.fetcher({
139
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `products/${encodeURIComponent(productId)}`),
140
+ method: "GET",
141
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
142
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
143
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
144
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
145
+ });
146
+ if (_response.ok) {
147
+ return { data: _response.body, rawResponse: _response.rawResponse };
148
+ }
149
+ if (_response.error.reason === "status-code") {
150
+ throw new errors.PaidError({
151
+ statusCode: _response.error.statusCode,
152
+ body: _response.error.body,
153
+ rawResponse: _response.rawResponse,
154
+ });
155
+ }
156
+ switch (_response.error.reason) {
157
+ case "non-json":
158
+ throw new errors.PaidError({
159
+ statusCode: _response.error.statusCode,
160
+ body: _response.error.rawBody,
161
+ rawResponse: _response.rawResponse,
162
+ });
163
+ case "timeout":
164
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products/{productId}.");
165
+ case "unknown":
166
+ throw new errors.PaidError({
167
+ message: _response.error.errorMessage,
168
+ rawResponse: _response.rawResponse,
169
+ });
170
+ }
171
+ });
172
+ }
173
+ /**
174
+ * @param {string} productId
175
+ * @param {Paid.ProductUpdate} request
176
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
177
+ *
178
+ * @example
179
+ * await client.products.update("productId", {})
180
+ */
181
+ update(productId, request, requestOptions) {
182
+ return core.HttpResponsePromise.fromPromise(this.__update(productId, request, requestOptions));
183
+ }
184
+ __update(productId, request, requestOptions) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ var _a, _b, _c;
187
+ const _response = yield core.fetcher({
188
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `products/${encodeURIComponent(productId)}`),
189
+ method: "PUT",
190
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
191
+ contentType: "application/json",
192
+ requestType: "json",
193
+ body: request,
194
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
195
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
196
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
197
+ });
198
+ if (_response.ok) {
199
+ return { data: _response.body, rawResponse: _response.rawResponse };
200
+ }
201
+ if (_response.error.reason === "status-code") {
202
+ throw new errors.PaidError({
203
+ statusCode: _response.error.statusCode,
204
+ body: _response.error.body,
205
+ rawResponse: _response.rawResponse,
206
+ });
207
+ }
208
+ switch (_response.error.reason) {
209
+ case "non-json":
210
+ throw new errors.PaidError({
211
+ statusCode: _response.error.statusCode,
212
+ body: _response.error.rawBody,
213
+ rawResponse: _response.rawResponse,
214
+ });
215
+ case "timeout":
216
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /products/{productId}.");
217
+ case "unknown":
218
+ throw new errors.PaidError({
219
+ message: _response.error.errorMessage,
220
+ rawResponse: _response.rawResponse,
221
+ });
222
+ }
223
+ });
224
+ }
225
+ /**
226
+ * @param {string} productId
227
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
228
+ *
229
+ * @example
230
+ * await client.products.delete("productId")
231
+ */
232
+ delete(productId, requestOptions) {
233
+ return core.HttpResponsePromise.fromPromise(this.__delete(productId, requestOptions));
234
+ }
235
+ __delete(productId, requestOptions) {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ var _a, _b, _c;
238
+ const _response = yield core.fetcher({
239
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `products/${encodeURIComponent(productId)}`),
240
+ method: "DELETE",
241
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
242
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
243
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
244
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
245
+ });
246
+ if (_response.ok) {
247
+ return { data: undefined, rawResponse: _response.rawResponse };
248
+ }
249
+ if (_response.error.reason === "status-code") {
250
+ throw new errors.PaidError({
251
+ statusCode: _response.error.statusCode,
252
+ body: _response.error.body,
253
+ rawResponse: _response.rawResponse,
254
+ });
255
+ }
256
+ switch (_response.error.reason) {
257
+ case "non-json":
258
+ throw new errors.PaidError({
259
+ statusCode: _response.error.statusCode,
260
+ body: _response.error.rawBody,
261
+ rawResponse: _response.rawResponse,
262
+ });
263
+ case "timeout":
264
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /products/{productId}.");
265
+ case "unknown":
266
+ throw new errors.PaidError({
267
+ message: _response.error.errorMessage,
268
+ rawResponse: _response.rawResponse,
269
+ });
270
+ }
271
+ });
272
+ }
273
+ /**
274
+ * @param {string} externalId
275
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
276
+ *
277
+ * @example
278
+ * await client.products.getByExternalId("externalId")
279
+ */
280
+ getByExternalId(externalId, requestOptions) {
281
+ return core.HttpResponsePromise.fromPromise(this.__getByExternalId(externalId, requestOptions));
282
+ }
283
+ __getByExternalId(externalId, requestOptions) {
284
+ return __awaiter(this, void 0, void 0, function* () {
285
+ var _a, _b, _c;
286
+ const _response = yield core.fetcher({
287
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `products/external/${encodeURIComponent(externalId)}`),
288
+ method: "GET",
289
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
290
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
291
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
292
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
293
+ });
294
+ if (_response.ok) {
295
+ return { data: _response.body, rawResponse: _response.rawResponse };
296
+ }
297
+ if (_response.error.reason === "status-code") {
298
+ throw new errors.PaidError({
299
+ statusCode: _response.error.statusCode,
300
+ body: _response.error.body,
301
+ rawResponse: _response.rawResponse,
302
+ });
303
+ }
304
+ switch (_response.error.reason) {
305
+ case "non-json":
306
+ throw new errors.PaidError({
307
+ statusCode: _response.error.statusCode,
308
+ body: _response.error.rawBody,
309
+ rawResponse: _response.rawResponse,
310
+ });
311
+ case "timeout":
312
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products/external/{externalId}.");
313
+ case "unknown":
314
+ throw new errors.PaidError({
315
+ message: _response.error.errorMessage,
316
+ rawResponse: _response.rawResponse,
317
+ });
318
+ }
319
+ });
320
+ }
321
+ /**
322
+ * @param {string} externalId
323
+ * @param {Paid.ProductUpdate} request
324
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
325
+ *
326
+ * @example
327
+ * await client.products.updateByExternalId("externalId", {})
328
+ */
329
+ updateByExternalId(externalId, request, requestOptions) {
330
+ return core.HttpResponsePromise.fromPromise(this.__updateByExternalId(externalId, request, requestOptions));
331
+ }
332
+ __updateByExternalId(externalId, request, requestOptions) {
333
+ return __awaiter(this, void 0, void 0, function* () {
334
+ var _a, _b, _c;
335
+ const _response = yield core.fetcher({
336
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `products/external/${encodeURIComponent(externalId)}`),
337
+ method: "PUT",
338
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
339
+ contentType: "application/json",
340
+ requestType: "json",
341
+ body: request,
342
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
343
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
344
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
345
+ });
346
+ if (_response.ok) {
347
+ return { data: _response.body, rawResponse: _response.rawResponse };
348
+ }
349
+ if (_response.error.reason === "status-code") {
350
+ throw new errors.PaidError({
351
+ statusCode: _response.error.statusCode,
352
+ body: _response.error.body,
353
+ rawResponse: _response.rawResponse,
354
+ });
355
+ }
356
+ switch (_response.error.reason) {
357
+ case "non-json":
358
+ throw new errors.PaidError({
359
+ statusCode: _response.error.statusCode,
360
+ body: _response.error.rawBody,
361
+ rawResponse: _response.rawResponse,
362
+ });
363
+ case "timeout":
364
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /products/external/{externalId}.");
365
+ case "unknown":
366
+ throw new errors.PaidError({
367
+ message: _response.error.errorMessage,
368
+ rawResponse: _response.rawResponse,
369
+ });
370
+ }
371
+ });
372
+ }
373
+ /**
374
+ * @param {string} externalId
375
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
376
+ *
377
+ * @example
378
+ * await client.products.deleteByExternalId("externalId")
379
+ */
380
+ deleteByExternalId(externalId, requestOptions) {
381
+ return core.HttpResponsePromise.fromPromise(this.__deleteByExternalId(externalId, requestOptions));
382
+ }
383
+ __deleteByExternalId(externalId, requestOptions) {
384
+ return __awaiter(this, void 0, void 0, function* () {
385
+ var _a, _b, _c;
386
+ const _response = yield core.fetcher({
387
+ url: urlJoin((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `products/external/${encodeURIComponent(externalId)}`),
388
+ method: "DELETE",
389
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
390
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
391
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
392
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
393
+ });
394
+ if (_response.ok) {
395
+ return { data: undefined, rawResponse: _response.rawResponse };
396
+ }
397
+ if (_response.error.reason === "status-code") {
398
+ throw new errors.PaidError({
399
+ statusCode: _response.error.statusCode,
400
+ body: _response.error.body,
401
+ rawResponse: _response.rawResponse,
402
+ });
403
+ }
404
+ switch (_response.error.reason) {
405
+ case "non-json":
406
+ throw new errors.PaidError({
407
+ statusCode: _response.error.statusCode,
408
+ body: _response.error.rawBody,
409
+ rawResponse: _response.rawResponse,
410
+ });
411
+ case "timeout":
412
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /products/external/{externalId}.");
413
+ case "unknown":
414
+ throw new errors.PaidError({
415
+ message: _response.error.errorMessage,
416
+ rawResponse: _response.rawResponse,
417
+ });
418
+ }
419
+ });
420
+ }
421
+ _getAuthorizationHeader() {
422
+ return __awaiter(this, void 0, void 0, function* () {
423
+ const bearer = yield core.Supplier.get(this._options.token);
424
+ if (bearer != null) {
425
+ return `Bearer ${bearer}`;
426
+ }
427
+ return undefined;
428
+ });
429
+ }
430
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * name: "Acme Product",
8
+ * description: "Acme Product does amazing things.",
9
+ * externalId: "acme-product",
10
+ * type: "product"
11
+ * }
12
+ */
13
+ export interface ProductCreate {
14
+ name: string;
15
+ description?: string;
16
+ externalId?: string;
17
+ type?: ProductCreate.Type;
18
+ active?: boolean;
19
+ productCode?: string;
20
+ metadata?: Record<string, unknown>;
21
+ }
22
+ export declare namespace ProductCreate {
23
+ type Type = "agent" | "product" | "prepaidCreditBundle";
24
+ const Type: {
25
+ readonly Agent: "agent";
26
+ readonly Product: "product";
27
+ readonly PrepaidCreditBundle: "prepaidCreditBundle";
28
+ };
29
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export var ProductCreate;
5
+ (function (ProductCreate) {
6
+ ProductCreate.Type = {
7
+ Agent: "agent",
8
+ Product: "product",
9
+ PrepaidCreditBundle: "prepaidCreditBundle",
10
+ };
11
+ })(ProductCreate || (ProductCreate = {}));
@@ -0,0 +1 @@
1
+ export { type ProductCreate } from "./ProductCreate.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";