@paid-ai/paid-node 0.5.0 → 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 (628) hide show
  1. package/README.md +11 -11
  2. package/dist/cjs/BaseClient.d.ts +39 -0
  3. package/dist/cjs/BaseClient.js +62 -0
  4. package/dist/cjs/Client.d.ts +30 -93
  5. package/dist/cjs/Client.js +19 -128
  6. package/dist/cjs/api/errors/BadRequestError.d.ts +2 -5
  7. package/dist/cjs/api/errors/BadRequestError.js +6 -4
  8. package/dist/cjs/api/errors/ForbiddenError.d.ts +2 -5
  9. package/dist/cjs/api/errors/ForbiddenError.js +6 -4
  10. package/dist/cjs/api/errors/InternalServerError.d.ts +2 -5
  11. package/dist/cjs/api/errors/InternalServerError.js +6 -4
  12. package/dist/cjs/api/errors/NotFoundError.d.ts +2 -5
  13. package/dist/cjs/api/errors/NotFoundError.js +6 -4
  14. package/dist/cjs/api/errors/index.d.ts +2 -2
  15. package/dist/cjs/api/errors/index.js +2 -2
  16. package/dist/cjs/api/index.d.ts +1 -1
  17. package/dist/cjs/api/index.js +1 -1
  18. package/dist/cjs/api/resources/agents/client/Client.d.ts +25 -43
  19. package/dist/cjs/api/resources/agents/client/Client.js +98 -191
  20. package/dist/cjs/api/resources/agents/client/requests/AgentCreate.d.ts +0 -3
  21. package/dist/cjs/api/resources/agents/client/requests/AgentCreate.js +1 -3
  22. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -1
  23. package/dist/cjs/api/resources/contacts/client/Client.d.ts +21 -39
  24. package/dist/cjs/api/resources/contacts/client/Client.js +76 -149
  25. package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +1 -4
  26. package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.js +1 -3
  27. package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +1 -1
  28. package/dist/cjs/api/resources/customers/client/Client.d.ts +111 -49
  29. package/dist/cjs/api/resources/customers/client/Client.js +374 -276
  30. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +17 -5
  31. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.js +1 -3
  32. package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.ts +14 -0
  33. package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.js +3 -0
  34. package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.ts +18 -0
  35. package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.js +3 -0
  36. package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.ts +4 -15
  37. package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.js +1 -3
  38. package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.ts +4 -15
  39. package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.js +1 -3
  40. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +5 -3
  41. package/dist/cjs/api/resources/customers/index.d.ts +1 -0
  42. package/dist/cjs/api/resources/customers/index.js +1 -0
  43. package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.ts +5 -0
  44. package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.js +8 -0
  45. package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.d.ts +4 -0
  46. package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.js +3 -0
  47. package/dist/cjs/api/resources/customers/types/index.d.ts +2 -0
  48. package/dist/cjs/api/resources/customers/types/index.js +18 -0
  49. package/dist/cjs/api/resources/index.d.ts +12 -11
  50. package/dist/cjs/api/resources/index.js +16 -15
  51. package/dist/cjs/api/resources/orders/client/Client.d.ts +100 -39
  52. package/dist/cjs/api/resources/orders/client/Client.js +300 -124
  53. package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.d.ts +13 -0
  54. package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.js +3 -0
  55. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +1 -4
  56. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.js +1 -3
  57. package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.ts +13 -0
  58. package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.js +3 -0
  59. package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.d.ts +24 -0
  60. package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.js +3 -0
  61. package/dist/cjs/api/resources/orders/client/requests/index.d.ts +4 -1
  62. package/dist/cjs/api/resources/orders/resources/index.d.ts +1 -1
  63. package/dist/cjs/api/resources/orders/resources/index.js +4 -4
  64. package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +11 -29
  65. package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +21 -44
  66. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +1 -4
  67. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.js +1 -3
  68. package/dist/cjs/api/resources/orders/resources/lines/client/requests/index.d.ts +1 -1
  69. package/dist/cjs/api/resources/plans/client/Client.d.ts +14 -32
  70. package/dist/cjs/api/resources/plans/client/Client.js +51 -102
  71. package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.d.ts +5 -18
  72. package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.js +1 -3
  73. package/dist/cjs/api/resources/plans/client/requests/index.d.ts +1 -1
  74. package/dist/cjs/api/resources/products/client/Client.d.ts +25 -43
  75. package/dist/cjs/api/resources/products/client/Client.js +98 -191
  76. package/dist/cjs/api/resources/products/client/requests/ProductCreate.d.ts +1 -4
  77. package/dist/cjs/api/resources/products/client/requests/ProductCreate.js +1 -3
  78. package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -1
  79. package/dist/cjs/api/resources/products/client/requests/index.js +3 -0
  80. package/dist/cjs/api/resources/traces/client/Client.d.ts +10 -28
  81. package/dist/cjs/api/resources/traces/client/Client.js +32 -71
  82. package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.d.ts +8 -27
  83. package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.js +1 -3
  84. package/dist/cjs/api/resources/traces/client/requests/index.d.ts +1 -1
  85. package/dist/cjs/api/resources/usage/client/Client.d.ts +14 -32
  86. package/dist/cjs/api/resources/usage/client/Client.js +44 -87
  87. package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.d.ts +0 -3
  88. package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.js +1 -3
  89. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +1 -4
  90. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.js +1 -3
  91. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +1 -4
  92. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.js +1 -3
  93. package/dist/cjs/api/resources/usage/client/requests/index.d.ts +3 -3
  94. package/dist/cjs/api/resources/usage/index.d.ts +1 -1
  95. package/dist/cjs/api/resources/usage/index.js +1 -1
  96. package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.d.ts +0 -3
  97. package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.js +1 -3
  98. package/dist/cjs/api/types/Address.d.ts +0 -3
  99. package/dist/cjs/api/types/Address.js +1 -3
  100. package/dist/cjs/api/types/Agent.d.ts +1 -4
  101. package/dist/cjs/api/types/Agent.js +1 -3
  102. package/dist/cjs/api/types/AgentAttribute.d.ts +1 -4
  103. package/dist/cjs/api/types/AgentAttribute.js +1 -3
  104. package/dist/cjs/api/types/AgentPricePoint.d.ts +1 -4
  105. package/dist/cjs/api/types/AgentPricePoint.js +1 -3
  106. package/dist/cjs/api/types/AgentPricePointTiers.d.ts +0 -3
  107. package/dist/cjs/api/types/AgentPricePointTiers.js +1 -3
  108. package/dist/cjs/api/types/AgentUpdate.d.ts +1 -4
  109. package/dist/cjs/api/types/AgentUpdate.js +1 -3
  110. package/dist/cjs/api/types/ApiError.d.ts +0 -3
  111. package/dist/cjs/api/types/ApiError.js +1 -3
  112. package/dist/cjs/api/types/BillingFrequency.d.ts +1 -4
  113. package/dist/cjs/api/types/BillingFrequency.js +1 -3
  114. package/dist/cjs/api/types/CancelRenewalResponse.d.ts +15 -0
  115. package/dist/cjs/api/types/CancelRenewalResponse.js +3 -0
  116. package/dist/cjs/api/types/ChargeType.d.ts +1 -4
  117. package/dist/cjs/api/types/ChargeType.js +1 -3
  118. package/dist/cjs/api/types/Contact.d.ts +1 -4
  119. package/dist/cjs/api/types/Contact.js +1 -3
  120. package/dist/cjs/api/types/ContactCreateForCustomer.d.ts +15 -0
  121. package/dist/cjs/api/types/ContactCreateForCustomer.js +3 -0
  122. package/dist/cjs/api/types/CostAmount.d.ts +0 -3
  123. package/dist/cjs/api/types/CostAmount.js +1 -3
  124. package/dist/cjs/api/types/CostTrace.d.ts +1 -4
  125. package/dist/cjs/api/types/CostTrace.js +1 -3
  126. package/dist/cjs/api/types/CostTracesResponse.d.ts +1 -4
  127. package/dist/cjs/api/types/CostTracesResponse.js +1 -3
  128. package/dist/cjs/api/types/CreationSource.d.ts +1 -4
  129. package/dist/cjs/api/types/CreationSource.js +1 -3
  130. package/dist/cjs/api/types/CreationState.d.ts +1 -4
  131. package/dist/cjs/api/types/CreationState.js +1 -3
  132. package/dist/cjs/api/types/Customer.d.ts +1 -4
  133. package/dist/cjs/api/types/Customer.js +1 -3
  134. package/dist/cjs/api/types/CustomerUpdate.d.ts +1 -4
  135. package/dist/cjs/api/types/CustomerUpdate.js +1 -3
  136. package/dist/cjs/api/types/EntitlementUsage.d.ts +0 -3
  137. package/dist/cjs/api/types/EntitlementUsage.js +1 -3
  138. package/dist/cjs/api/types/Error_.d.ts +1 -4
  139. package/dist/cjs/api/types/Error_.js +1 -3
  140. package/dist/cjs/api/types/Invoice.d.ts +40 -0
  141. package/dist/cjs/api/types/Invoice.js +14 -0
  142. package/dist/cjs/api/types/Order.d.ts +1 -4
  143. package/dist/cjs/api/types/Order.js +1 -3
  144. package/dist/cjs/api/types/OrderLine.d.ts +1 -4
  145. package/dist/cjs/api/types/OrderLine.js +1 -3
  146. package/dist/cjs/api/types/OrderLineAttribute.d.ts +1 -4
  147. package/dist/cjs/api/types/OrderLineAttribute.js +1 -3
  148. package/dist/cjs/api/types/OrderLineAttributeCreateOne.d.ts +0 -3
  149. package/dist/cjs/api/types/OrderLineAttributeCreateOne.js +1 -3
  150. package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +1 -4
  151. package/dist/cjs/api/types/OrderLineAttributePricing.js +1 -3
  152. package/dist/cjs/api/types/OrderLineCreate.d.ts +1 -4
  153. package/dist/cjs/api/types/OrderLineCreate.js +1 -3
  154. package/dist/cjs/api/types/PaginationMeta.d.ts +0 -3
  155. package/dist/cjs/api/types/PaginationMeta.js +1 -3
  156. package/dist/cjs/api/types/PaymentMethod.d.ts +54 -0
  157. package/dist/cjs/api/types/PaymentMethod.js +20 -0
  158. package/dist/cjs/api/types/Plan.d.ts +3 -3
  159. package/dist/cjs/api/types/Plan.js +1 -3
  160. package/dist/cjs/api/types/PlanGroup.d.ts +1 -4
  161. package/dist/cjs/api/types/PlanGroup.js +1 -3
  162. package/dist/cjs/api/types/PricePoint.d.ts +1 -4
  163. package/dist/cjs/api/types/PricePoint.js +1 -3
  164. package/dist/cjs/api/types/Pricing.d.ts +1 -4
  165. package/dist/cjs/api/types/Pricing.js +1 -3
  166. package/dist/cjs/api/types/PricingModelType.d.ts +1 -4
  167. package/dist/cjs/api/types/PricingModelType.js +1 -3
  168. package/dist/cjs/api/types/Product.d.ts +3 -8
  169. package/dist/cjs/api/types/Product.js +2 -3
  170. package/dist/cjs/api/types/ProductUpdate.d.ts +2 -5
  171. package/dist/cjs/api/types/ProductUpdate.js +1 -3
  172. package/dist/cjs/api/types/ProrationAttributeUpdate.d.ts +11 -0
  173. package/dist/cjs/api/types/ProrationAttributeUpdate.js +3 -0
  174. package/dist/cjs/api/types/ProrationDetail.d.ts +16 -0
  175. package/dist/cjs/api/types/ProrationDetail.js +3 -0
  176. package/dist/cjs/api/types/ProrationUpgradeResponse.d.ts +22 -0
  177. package/dist/cjs/api/types/ProrationUpgradeResponse.js +3 -0
  178. package/dist/cjs/api/types/Salutation.d.ts +1 -4
  179. package/dist/cjs/api/types/Salutation.js +1 -3
  180. package/dist/cjs/api/types/Signal.d.ts +0 -3
  181. package/dist/cjs/api/types/Signal.js +1 -3
  182. package/dist/cjs/api/types/SignalV2.d.ts +0 -3
  183. package/dist/cjs/api/types/SignalV2.js +1 -3
  184. package/dist/cjs/api/types/TaxExemptStatus.d.ts +1 -4
  185. package/dist/cjs/api/types/TaxExemptStatus.js +1 -3
  186. package/dist/cjs/api/types/Tier.d.ts +0 -3
  187. package/dist/cjs/api/types/Tier.js +1 -3
  188. package/dist/cjs/api/types/Trace.d.ts +1 -4
  189. package/dist/cjs/api/types/Trace.js +1 -3
  190. package/dist/cjs/api/types/TracesResponse.d.ts +1 -4
  191. package/dist/cjs/api/types/TracesResponse.js +1 -3
  192. package/dist/cjs/api/types/UsagePaginationMeta.d.ts +0 -3
  193. package/dist/cjs/api/types/UsagePaginationMeta.js +1 -3
  194. package/dist/cjs/api/types/UsageSummariesResponse.d.ts +1 -4
  195. package/dist/cjs/api/types/UsageSummariesResponse.js +1 -3
  196. package/dist/cjs/api/types/UsageSummary.d.ts +0 -3
  197. package/dist/cjs/api/types/UsageSummary.js +1 -3
  198. package/dist/cjs/api/types/index.d.ts +33 -26
  199. package/dist/cjs/api/types/index.js +33 -26
  200. package/dist/cjs/auth/BearerAuthProvider.d.ts +20 -0
  201. package/dist/cjs/{core/fetcher/stream-wrappers/chooseStreamWrapper.js → auth/BearerAuthProvider.js} +34 -14
  202. package/dist/cjs/auth/index.d.ts +1 -0
  203. package/dist/cjs/auth/index.js +5 -0
  204. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  205. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  206. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  207. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  208. package/dist/cjs/core/auth/BasicAuth.js +5 -4
  209. package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
  210. package/dist/cjs/core/auth/BearerToken.js +7 -6
  211. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  212. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  213. package/dist/cjs/core/auth/index.d.ts +3 -0
  214. package/dist/cjs/core/auth/index.js +3 -1
  215. package/dist/cjs/core/base64.d.ts +2 -0
  216. package/dist/cjs/core/base64.js +26 -0
  217. package/dist/cjs/core/exports.d.ts +1 -0
  218. package/dist/cjs/core/exports.js +17 -0
  219. package/dist/cjs/core/fetcher/APIResponse.d.ts +1 -1
  220. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
  221. package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
  222. package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
  223. package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
  224. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
  225. package/dist/{esm/core/fetcher/stream-wrappers/chooseStreamWrapper.mjs → cjs/core/fetcher/EndpointSupplier.js} +10 -11
  226. package/dist/cjs/core/fetcher/Fetcher.d.ts +15 -7
  227. package/dist/cjs/core/fetcher/Fetcher.js +210 -14
  228. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +1 -1
  229. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -1
  230. package/dist/cjs/core/fetcher/createRequestUrl.js +3 -7
  231. package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
  232. package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
  233. package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -4
  234. package/dist/cjs/core/fetcher/getFetchFn.js +1 -52
  235. package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
  236. package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
  237. package/dist/cjs/core/fetcher/getResponseBody.js +42 -27
  238. package/dist/cjs/core/fetcher/index.d.ts +7 -4
  239. package/dist/cjs/core/fetcher/index.js +7 -5
  240. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  241. package/dist/cjs/core/fetcher/makeRequest.js +2 -4
  242. package/dist/cjs/core/fetcher/requestWithRetries.js +35 -8
  243. package/dist/cjs/core/fetcher/signals.d.ts +1 -7
  244. package/dist/cjs/core/fetcher/signals.js +0 -12
  245. package/dist/cjs/core/headers.d.ts +2 -3
  246. package/dist/cjs/core/headers.js +6 -4
  247. package/dist/cjs/core/index.d.ts +4 -1
  248. package/dist/cjs/core/index.js +27 -1
  249. package/dist/cjs/core/logging/exports.d.ts +18 -0
  250. package/dist/cjs/{wrapper/BatchUsage.js → core/logging/exports.js} +10 -27
  251. package/dist/cjs/core/logging/index.d.ts +1 -0
  252. package/dist/cjs/core/logging/index.js +17 -0
  253. package/dist/cjs/core/logging/logger.d.ts +126 -0
  254. package/dist/cjs/core/logging/logger.js +144 -0
  255. package/dist/cjs/core/runtime/runtime.js +11 -11
  256. package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
  257. package/dist/cjs/core/url/encodePathParam.js +21 -0
  258. package/dist/cjs/core/url/index.d.ts +3 -0
  259. package/dist/cjs/core/url/index.js +9 -0
  260. package/dist/cjs/core/url/join.d.ts +1 -0
  261. package/dist/cjs/core/url/join.js +68 -0
  262. package/dist/cjs/core/url/qs.d.ts +6 -0
  263. package/dist/cjs/core/url/qs.js +64 -0
  264. package/dist/cjs/environments.d.ts +0 -3
  265. package/dist/cjs/environments.js +1 -3
  266. package/dist/cjs/errors/PaidError.d.ts +1 -4
  267. package/dist/cjs/errors/PaidError.js +7 -5
  268. package/dist/cjs/errors/PaidTimeoutError.d.ts +0 -3
  269. package/dist/cjs/errors/PaidTimeoutError.js +6 -4
  270. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  271. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  272. package/dist/cjs/exports.d.ts +1 -0
  273. package/dist/cjs/exports.js +17 -0
  274. package/dist/cjs/index.d.ts +2 -2
  275. package/dist/cjs/index.js +2 -3
  276. package/dist/cjs/integrations/adapters/expressjs/base-adapter.d.ts +8 -5
  277. package/dist/cjs/integrations/adapters/expressjs/base-adapter.js +6 -11
  278. package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +14 -12
  279. package/dist/cjs/integrations/adapters/expressjs/routes.js +18 -9
  280. package/dist/cjs/integrations/adapters/nextjs/base-adapter.d.ts +3 -2
  281. package/dist/cjs/integrations/adapters/nextjs/routes.d.ts +13 -11
  282. package/dist/cjs/integrations/adapters/nextjs/routes.js +18 -9
  283. package/dist/cjs/integrations/controllers/billing.d.ts +3 -17
  284. package/dist/cjs/integrations/controllers/contacts.d.ts +1 -1
  285. package/dist/cjs/integrations/controllers/customers.d.ts +2 -2
  286. package/dist/cjs/integrations/controllers/invoices.d.ts +2 -6
  287. package/dist/cjs/integrations/controllers/orders.d.ts +1 -5
  288. package/dist/cjs/integrations/controllers/provision-users.d.ts +1 -1
  289. package/dist/cjs/integrations/utils/create-adapter.d.ts +2 -1
  290. package/dist/cjs/integrations/utils/create-adapter.js +2 -1
  291. package/dist/cjs/tracing/autoInstrumentation.js +5 -5
  292. package/dist/cjs/tracing/spanProcessor.d.ts +2 -2
  293. package/dist/cjs/tracing/spanProcessor.js +0 -5
  294. package/dist/cjs/tracing/tracing.d.ts +1 -1
  295. package/dist/cjs/tracing/tracing.js +2 -0
  296. package/dist/cjs/tracing/wrappers/anthropicWrapper.d.ts +2 -2
  297. package/dist/cjs/tracing/wrappers/mistralWrapper.d.ts +3 -3
  298. package/dist/cjs/tracing/wrappers/openAiWrapper.d.ts +5 -5
  299. package/dist/cjs/tracing/wrappers/vercelAIWrapper.d.ts +2 -2
  300. package/dist/cjs/tracing/wrappers/vercelAIWrapper.js +8 -7
  301. package/dist/cjs/version.d.ts +1 -1
  302. package/dist/cjs/version.js +1 -1
  303. package/dist/esm/BaseClient.d.mts +39 -0
  304. package/dist/esm/BaseClient.mjs +25 -0
  305. package/dist/esm/Client.d.mts +30 -93
  306. package/dist/esm/Client.mjs +20 -96
  307. package/dist/esm/api/errors/BadRequestError.d.mts +2 -5
  308. package/dist/esm/api/errors/BadRequestError.mjs +6 -4
  309. package/dist/esm/api/errors/ForbiddenError.d.mts +2 -5
  310. package/dist/esm/api/errors/ForbiddenError.mjs +6 -4
  311. package/dist/esm/api/errors/InternalServerError.d.mts +2 -5
  312. package/dist/esm/api/errors/InternalServerError.mjs +6 -4
  313. package/dist/esm/api/errors/NotFoundError.d.mts +2 -5
  314. package/dist/esm/api/errors/NotFoundError.mjs +6 -4
  315. package/dist/esm/api/errors/index.d.mts +2 -2
  316. package/dist/esm/api/errors/index.mjs +2 -2
  317. package/dist/esm/api/index.d.mts +1 -1
  318. package/dist/esm/api/index.mjs +1 -1
  319. package/dist/esm/api/resources/agents/client/Client.d.mts +25 -43
  320. package/dist/esm/api/resources/agents/client/Client.mjs +96 -186
  321. package/dist/esm/api/resources/agents/client/requests/AgentCreate.d.mts +0 -3
  322. package/dist/esm/api/resources/agents/client/requests/AgentCreate.mjs +1 -3
  323. package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -1
  324. package/dist/esm/api/resources/contacts/client/Client.d.mts +21 -39
  325. package/dist/esm/api/resources/contacts/client/Client.mjs +74 -144
  326. package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +1 -4
  327. package/dist/esm/api/resources/contacts/client/requests/ContactCreate.mjs +1 -3
  328. package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -1
  329. package/dist/esm/api/resources/customers/client/Client.d.mts +111 -49
  330. package/dist/esm/api/resources/customers/client/Client.mjs +372 -271
  331. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +17 -5
  332. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.mjs +1 -3
  333. package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.mts +14 -0
  334. package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.mjs +2 -0
  335. package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.mts +18 -0
  336. package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.mjs +2 -0
  337. package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.mts +4 -15
  338. package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.mjs +1 -3
  339. package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.mts +4 -15
  340. package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.mjs +1 -3
  341. package/dist/esm/api/resources/customers/client/requests/index.d.mts +5 -3
  342. package/dist/esm/api/resources/customers/index.d.mts +1 -0
  343. package/dist/esm/api/resources/customers/index.mjs +1 -0
  344. package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.mts +5 -0
  345. package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.mjs +5 -0
  346. package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.d.mts +4 -0
  347. package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.mjs +2 -0
  348. package/dist/esm/api/resources/customers/types/index.d.mts +2 -0
  349. package/dist/esm/api/resources/customers/types/index.mjs +2 -0
  350. package/dist/esm/api/resources/index.d.mts +12 -11
  351. package/dist/esm/api/resources/index.mjs +12 -11
  352. package/dist/esm/api/resources/orders/client/Client.d.mts +100 -39
  353. package/dist/esm/api/resources/orders/client/Client.mjs +299 -120
  354. package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.d.mts +13 -0
  355. package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.mjs +2 -0
  356. package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +1 -4
  357. package/dist/esm/api/resources/orders/client/requests/OrderCreate.mjs +1 -3
  358. package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.mts +13 -0
  359. package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.mjs +2 -0
  360. package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.d.mts +24 -0
  361. package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.mjs +2 -0
  362. package/dist/esm/api/resources/orders/client/requests/index.d.mts +4 -1
  363. package/dist/esm/api/resources/orders/resources/index.d.mts +1 -1
  364. package/dist/esm/api/resources/orders/resources/index.mjs +1 -1
  365. package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +11 -29
  366. package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +19 -39
  367. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +1 -4
  368. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.mjs +1 -3
  369. package/dist/esm/api/resources/orders/resources/lines/client/requests/index.d.mts +1 -1
  370. package/dist/esm/api/resources/plans/client/Client.d.mts +14 -32
  371. package/dist/esm/api/resources/plans/client/Client.mjs +49 -97
  372. package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.d.mts +5 -18
  373. package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.mjs +1 -3
  374. package/dist/esm/api/resources/plans/client/requests/index.d.mts +1 -1
  375. package/dist/esm/api/resources/products/client/Client.d.mts +25 -43
  376. package/dist/esm/api/resources/products/client/Client.mjs +96 -186
  377. package/dist/esm/api/resources/products/client/requests/ProductCreate.d.mts +1 -4
  378. package/dist/esm/api/resources/products/client/requests/ProductCreate.mjs +1 -3
  379. package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -1
  380. package/dist/esm/api/resources/products/client/requests/index.mjs +1 -1
  381. package/dist/esm/api/resources/traces/client/Client.d.mts +10 -28
  382. package/dist/esm/api/resources/traces/client/Client.mjs +30 -66
  383. package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.d.mts +8 -27
  384. package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.mjs +1 -3
  385. package/dist/esm/api/resources/traces/client/requests/index.d.mts +1 -1
  386. package/dist/esm/api/resources/usage/client/Client.d.mts +14 -32
  387. package/dist/esm/api/resources/usage/client/Client.mjs +42 -82
  388. package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.d.mts +0 -3
  389. package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.mjs +1 -3
  390. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +1 -4
  391. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.mjs +1 -3
  392. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +1 -4
  393. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.mjs +1 -3
  394. package/dist/esm/api/resources/usage/client/requests/index.d.mts +3 -3
  395. package/dist/esm/api/resources/usage/index.d.mts +1 -1
  396. package/dist/esm/api/resources/usage/index.mjs +1 -1
  397. package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.d.mts +0 -3
  398. package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.mjs +1 -3
  399. package/dist/esm/api/types/Address.d.mts +0 -3
  400. package/dist/esm/api/types/Address.mjs +1 -3
  401. package/dist/esm/api/types/Agent.d.mts +1 -4
  402. package/dist/esm/api/types/Agent.mjs +1 -3
  403. package/dist/esm/api/types/AgentAttribute.d.mts +1 -4
  404. package/dist/esm/api/types/AgentAttribute.mjs +1 -3
  405. package/dist/esm/api/types/AgentPricePoint.d.mts +1 -4
  406. package/dist/esm/api/types/AgentPricePoint.mjs +1 -3
  407. package/dist/esm/api/types/AgentPricePointTiers.d.mts +0 -3
  408. package/dist/esm/api/types/AgentPricePointTiers.mjs +1 -3
  409. package/dist/esm/api/types/AgentUpdate.d.mts +1 -4
  410. package/dist/esm/api/types/AgentUpdate.mjs +1 -3
  411. package/dist/esm/api/types/ApiError.d.mts +0 -3
  412. package/dist/esm/api/types/ApiError.mjs +1 -3
  413. package/dist/esm/api/types/BillingFrequency.d.mts +1 -4
  414. package/dist/esm/api/types/BillingFrequency.mjs +1 -3
  415. package/dist/esm/api/types/CancelRenewalResponse.d.mts +15 -0
  416. package/dist/esm/api/types/CancelRenewalResponse.mjs +2 -0
  417. package/dist/esm/api/types/ChargeType.d.mts +1 -4
  418. package/dist/esm/api/types/ChargeType.mjs +1 -3
  419. package/dist/esm/api/types/Contact.d.mts +1 -4
  420. package/dist/esm/api/types/Contact.mjs +1 -3
  421. package/dist/esm/api/types/ContactCreateForCustomer.d.mts +15 -0
  422. package/dist/esm/api/types/ContactCreateForCustomer.mjs +2 -0
  423. package/dist/esm/api/types/CostAmount.d.mts +0 -3
  424. package/dist/esm/api/types/CostAmount.mjs +1 -3
  425. package/dist/esm/api/types/CostTrace.d.mts +1 -4
  426. package/dist/esm/api/types/CostTrace.mjs +1 -3
  427. package/dist/esm/api/types/CostTracesResponse.d.mts +1 -4
  428. package/dist/esm/api/types/CostTracesResponse.mjs +1 -3
  429. package/dist/esm/api/types/CreationSource.d.mts +1 -4
  430. package/dist/esm/api/types/CreationSource.mjs +1 -3
  431. package/dist/esm/api/types/CreationState.d.mts +1 -4
  432. package/dist/esm/api/types/CreationState.mjs +1 -3
  433. package/dist/esm/api/types/Customer.d.mts +1 -4
  434. package/dist/esm/api/types/Customer.mjs +1 -3
  435. package/dist/esm/api/types/CustomerUpdate.d.mts +1 -4
  436. package/dist/esm/api/types/CustomerUpdate.mjs +1 -3
  437. package/dist/esm/api/types/EntitlementUsage.d.mts +0 -3
  438. package/dist/esm/api/types/EntitlementUsage.mjs +1 -3
  439. package/dist/esm/api/types/Error_.d.mts +1 -4
  440. package/dist/esm/api/types/Error_.mjs +1 -3
  441. package/dist/esm/api/types/Invoice.d.mts +40 -0
  442. package/dist/esm/api/types/Invoice.mjs +11 -0
  443. package/dist/esm/api/types/Order.d.mts +1 -4
  444. package/dist/esm/api/types/Order.mjs +1 -3
  445. package/dist/esm/api/types/OrderLine.d.mts +1 -4
  446. package/dist/esm/api/types/OrderLine.mjs +1 -3
  447. package/dist/esm/api/types/OrderLineAttribute.d.mts +1 -4
  448. package/dist/esm/api/types/OrderLineAttribute.mjs +1 -3
  449. package/dist/esm/api/types/OrderLineAttributeCreateOne.d.mts +0 -3
  450. package/dist/esm/api/types/OrderLineAttributeCreateOne.mjs +1 -3
  451. package/dist/esm/api/types/OrderLineAttributePricing.d.mts +1 -4
  452. package/dist/esm/api/types/OrderLineAttributePricing.mjs +1 -3
  453. package/dist/esm/api/types/OrderLineCreate.d.mts +1 -4
  454. package/dist/esm/api/types/OrderLineCreate.mjs +1 -3
  455. package/dist/esm/api/types/PaginationMeta.d.mts +0 -3
  456. package/dist/esm/api/types/PaginationMeta.mjs +1 -3
  457. package/dist/esm/api/types/PaymentMethod.d.mts +54 -0
  458. package/dist/esm/api/types/PaymentMethod.mjs +17 -0
  459. package/dist/esm/api/types/Plan.d.mts +3 -3
  460. package/dist/esm/api/types/Plan.mjs +1 -3
  461. package/dist/esm/api/types/PlanGroup.d.mts +1 -4
  462. package/dist/esm/api/types/PlanGroup.mjs +1 -3
  463. package/dist/esm/api/types/PricePoint.d.mts +1 -4
  464. package/dist/esm/api/types/PricePoint.mjs +1 -3
  465. package/dist/esm/api/types/Pricing.d.mts +1 -4
  466. package/dist/esm/api/types/Pricing.mjs +1 -3
  467. package/dist/esm/api/types/PricingModelType.d.mts +1 -4
  468. package/dist/esm/api/types/PricingModelType.mjs +1 -3
  469. package/dist/esm/api/types/Product.d.mts +3 -8
  470. package/dist/esm/api/types/Product.mjs +2 -3
  471. package/dist/esm/api/types/ProductUpdate.d.mts +2 -5
  472. package/dist/esm/api/types/ProductUpdate.mjs +1 -3
  473. package/dist/esm/api/types/ProrationAttributeUpdate.d.mts +11 -0
  474. package/dist/esm/api/types/ProrationAttributeUpdate.mjs +2 -0
  475. package/dist/esm/api/types/ProrationDetail.d.mts +16 -0
  476. package/dist/esm/api/types/ProrationDetail.mjs +2 -0
  477. package/dist/esm/api/types/ProrationUpgradeResponse.d.mts +22 -0
  478. package/dist/esm/api/types/ProrationUpgradeResponse.mjs +2 -0
  479. package/dist/esm/api/types/Salutation.d.mts +1 -4
  480. package/dist/esm/api/types/Salutation.mjs +1 -3
  481. package/dist/esm/api/types/Signal.d.mts +0 -3
  482. package/dist/esm/api/types/Signal.mjs +1 -3
  483. package/dist/esm/api/types/SignalV2.d.mts +0 -3
  484. package/dist/esm/api/types/SignalV2.mjs +1 -3
  485. package/dist/esm/api/types/TaxExemptStatus.d.mts +1 -4
  486. package/dist/esm/api/types/TaxExemptStatus.mjs +1 -3
  487. package/dist/esm/api/types/Tier.d.mts +0 -3
  488. package/dist/esm/api/types/Tier.mjs +1 -3
  489. package/dist/esm/api/types/Trace.d.mts +1 -4
  490. package/dist/esm/api/types/Trace.mjs +1 -3
  491. package/dist/esm/api/types/TracesResponse.d.mts +1 -4
  492. package/dist/esm/api/types/TracesResponse.mjs +1 -3
  493. package/dist/esm/api/types/UsagePaginationMeta.d.mts +0 -3
  494. package/dist/esm/api/types/UsagePaginationMeta.mjs +1 -3
  495. package/dist/esm/api/types/UsageSummariesResponse.d.mts +1 -4
  496. package/dist/esm/api/types/UsageSummariesResponse.mjs +1 -3
  497. package/dist/esm/api/types/UsageSummary.d.mts +0 -3
  498. package/dist/esm/api/types/UsageSummary.mjs +1 -3
  499. package/dist/esm/api/types/index.d.mts +33 -26
  500. package/dist/esm/api/types/index.mjs +33 -26
  501. package/dist/esm/auth/BearerAuthProvider.d.mts +20 -0
  502. package/dist/esm/auth/BearerAuthProvider.mjs +42 -0
  503. package/dist/esm/auth/index.d.mts +1 -0
  504. package/dist/esm/auth/index.mjs +1 -0
  505. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  506. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  507. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  508. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  509. package/dist/esm/core/auth/BasicAuth.mjs +5 -4
  510. package/dist/esm/core/auth/BearerToken.d.mts +3 -1
  511. package/dist/esm/core/auth/BearerToken.mjs +7 -6
  512. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  513. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  514. package/dist/esm/core/auth/index.d.mts +3 -0
  515. package/dist/esm/core/auth/index.mjs +1 -0
  516. package/dist/esm/core/base64.d.mts +2 -0
  517. package/dist/esm/core/base64.mjs +22 -0
  518. package/dist/esm/core/exports.d.mts +1 -0
  519. package/dist/esm/core/exports.mjs +1 -0
  520. package/dist/esm/core/fetcher/APIResponse.d.mts +1 -1
  521. package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
  522. package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
  523. package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
  524. package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
  525. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
  526. package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
  527. package/dist/esm/core/fetcher/Fetcher.d.mts +15 -7
  528. package/dist/esm/core/fetcher/Fetcher.mjs +210 -14
  529. package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +1 -1
  530. package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -1
  531. package/dist/esm/core/fetcher/createRequestUrl.mjs +3 -4
  532. package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
  533. package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
  534. package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -4
  535. package/dist/esm/core/fetcher/getFetchFn.mjs +1 -19
  536. package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
  537. package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
  538. package/dist/esm/core/fetcher/getResponseBody.mjs +42 -27
  539. package/dist/esm/core/fetcher/index.d.mts +7 -4
  540. package/dist/esm/core/fetcher/index.mjs +3 -2
  541. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  542. package/dist/esm/core/fetcher/makeRequest.mjs +2 -4
  543. package/dist/esm/core/fetcher/requestWithRetries.mjs +35 -8
  544. package/dist/esm/core/fetcher/signals.d.mts +1 -7
  545. package/dist/esm/core/fetcher/signals.mjs +0 -12
  546. package/dist/esm/core/headers.d.mts +2 -3
  547. package/dist/esm/core/headers.mjs +6 -4
  548. package/dist/esm/core/index.d.mts +4 -1
  549. package/dist/esm/core/index.mjs +4 -1
  550. package/dist/esm/core/logging/exports.d.mts +18 -0
  551. package/dist/esm/core/logging/exports.mjs +9 -0
  552. package/dist/esm/core/logging/index.d.mts +1 -0
  553. package/dist/esm/core/logging/index.mjs +1 -0
  554. package/dist/esm/core/logging/logger.d.mts +126 -0
  555. package/dist/esm/core/logging/logger.mjs +138 -0
  556. package/dist/esm/core/runtime/runtime.mjs +11 -11
  557. package/dist/esm/core/url/encodePathParam.d.mts +1 -0
  558. package/dist/esm/core/url/encodePathParam.mjs +18 -0
  559. package/dist/esm/core/url/index.d.mts +3 -0
  560. package/dist/esm/core/url/index.mjs +3 -0
  561. package/dist/esm/core/url/join.d.mts +1 -0
  562. package/dist/esm/core/url/join.mjs +65 -0
  563. package/dist/esm/core/url/qs.d.mts +6 -0
  564. package/dist/esm/core/url/qs.mjs +61 -0
  565. package/dist/esm/environments.d.mts +0 -3
  566. package/dist/esm/environments.mjs +1 -3
  567. package/dist/esm/errors/PaidError.d.mts +1 -4
  568. package/dist/esm/errors/PaidError.mjs +7 -5
  569. package/dist/esm/errors/PaidTimeoutError.d.mts +0 -3
  570. package/dist/esm/errors/PaidTimeoutError.mjs +6 -4
  571. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  572. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  573. package/dist/esm/exports.d.mts +1 -0
  574. package/dist/esm/exports.mjs +1 -0
  575. package/dist/esm/index.d.mts +2 -2
  576. package/dist/esm/index.mjs +1 -2
  577. package/dist/esm/integrations/adapters/expressjs/base-adapter.d.mts +8 -5
  578. package/dist/esm/integrations/adapters/expressjs/base-adapter.mjs +6 -11
  579. package/dist/esm/integrations/adapters/expressjs/routes.d.mts +14 -12
  580. package/dist/esm/integrations/adapters/expressjs/routes.mjs +18 -9
  581. package/dist/esm/integrations/adapters/nextjs/base-adapter.d.mts +3 -2
  582. package/dist/esm/integrations/adapters/nextjs/base-adapter.mjs +1 -1
  583. package/dist/esm/integrations/adapters/nextjs/routes.d.mts +13 -11
  584. package/dist/esm/integrations/adapters/nextjs/routes.mjs +18 -9
  585. package/dist/esm/integrations/controllers/billing.d.mts +3 -17
  586. package/dist/esm/integrations/controllers/contacts.d.mts +1 -1
  587. package/dist/esm/integrations/controllers/contacts.mjs +1 -0
  588. package/dist/esm/integrations/controllers/customers.d.mts +2 -2
  589. package/dist/esm/integrations/controllers/customers.mjs +1 -0
  590. package/dist/esm/integrations/controllers/invoices.d.mts +2 -6
  591. package/dist/esm/integrations/controllers/orders.d.mts +1 -5
  592. package/dist/esm/integrations/controllers/provision-users.d.mts +1 -1
  593. package/dist/esm/integrations/utils/create-adapter.d.mts +2 -1
  594. package/dist/esm/integrations/utils/create-adapter.mjs +2 -1
  595. package/dist/esm/tracing/autoInstrumentation.mjs +1 -1
  596. package/dist/esm/tracing/spanProcessor.d.mts +2 -2
  597. package/dist/esm/tracing/spanProcessor.mjs +0 -5
  598. package/dist/esm/tracing/tracing.d.mts +1 -1
  599. package/dist/esm/tracing/tracing.mjs +3 -0
  600. package/dist/esm/tracing/wrappers/anthropicWrapper.d.mts +2 -2
  601. package/dist/esm/tracing/wrappers/anthropicWrapper.mjs +1 -0
  602. package/dist/esm/tracing/wrappers/mistralWrapper.d.mts +3 -3
  603. package/dist/esm/tracing/wrappers/mistralWrapper.mjs +1 -0
  604. package/dist/esm/tracing/wrappers/openAiWrapper.d.mts +5 -5
  605. package/dist/esm/tracing/wrappers/openAiWrapper.mjs +1 -0
  606. package/dist/esm/tracing/wrappers/vercelAIWrapper.d.mts +2 -2
  607. package/dist/esm/tracing/wrappers/vercelAIWrapper.mjs +8 -7
  608. package/dist/esm/version.d.mts +1 -1
  609. package/dist/esm/version.mjs +1 -1
  610. package/package.json +43 -28
  611. package/reference.md +985 -396
  612. package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
  613. package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
  614. package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
  615. package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
  616. package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
  617. package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
  618. package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
  619. package/dist/cjs/wrapper/BatchUsage.d.ts +0 -8
  620. package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.mts +0 -30
  621. package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.mjs +0 -243
  622. package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.mts +0 -21
  623. package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.mjs +0 -122
  624. package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.mts +0 -31
  625. package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.mjs +0 -225
  626. package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.d.mts +0 -18
  627. package/dist/esm/wrapper/BatchUsage.d.mts +0 -8
  628. package/dist/esm/wrapper/BatchUsage.mjs +0 -25
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
2
+ // This file was auto-generated by Fern from our API Definition.
5
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
4
  if (k2 === undefined) k2 = k;
7
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -44,24 +42,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
44
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
45
43
  });
46
44
  };
47
- var __importDefault = (this && this.__importDefault) || function (mod) {
48
- return (mod && mod.__esModule) ? mod : { "default": mod };
49
- };
50
45
  Object.defineProperty(exports, "__esModule", { value: true });
51
- exports.Agents = void 0;
52
- const environments = __importStar(require("../../../../environments.js"));
53
- const core = __importStar(require("../../../../core/index.js"));
46
+ exports.AgentsClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
54
48
  const headers_js_1 = require("../../../../core/headers.js");
55
- const url_join_1 = __importDefault(require("url-join"));
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
56
52
  const errors = __importStar(require("../../../../errors/index.js"));
57
- class Agents {
58
- constructor(_options = {}) {
59
- this._options = _options;
53
+ class AgentsClient {
54
+ constructor(options = {}) {
55
+ this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
60
56
  }
61
57
  /**
62
58
  * DEPRECATED: Use /products instead. Agents are now products with type='agent'.
63
59
  *
64
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
60
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
65
61
  *
66
62
  * @example
67
63
  * await client.agents.list()
@@ -71,14 +67,18 @@ class Agents {
71
67
  }
72
68
  __list(requestOptions) {
73
69
  return __awaiter(this, void 0, void 0, function* () {
74
- var _a, _b, _c;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
71
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
75
72
  const _response = yield core.fetcher({
76
- url: (0, url_join_1.default)((_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, "agents"),
73
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "agents"),
77
74
  method: "GET",
78
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
79
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
80
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
75
+ headers: _headers,
76
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
77
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
78
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
81
79
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
80
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
81
+ logging: this._options.logging,
82
82
  });
83
83
  if (_response.ok) {
84
84
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -90,28 +90,14 @@ class Agents {
90
90
  rawResponse: _response.rawResponse,
91
91
  });
92
92
  }
93
- switch (_response.error.reason) {
94
- case "non-json":
95
- throw new errors.PaidError({
96
- statusCode: _response.error.statusCode,
97
- body: _response.error.rawBody,
98
- rawResponse: _response.rawResponse,
99
- });
100
- case "timeout":
101
- throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents.");
102
- case "unknown":
103
- throw new errors.PaidError({
104
- message: _response.error.errorMessage,
105
- rawResponse: _response.rawResponse,
106
- });
107
- }
93
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/agents");
108
94
  });
109
95
  }
110
96
  /**
111
97
  * DEPRECATED: Use POST /products instead.
112
98
  *
113
99
  * @param {Paid.AgentCreate} request
114
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
100
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
115
101
  *
116
102
  * @example
117
103
  * await client.agents.create({
@@ -125,17 +111,21 @@ class Agents {
125
111
  }
126
112
  __create(request, requestOptions) {
127
113
  return __awaiter(this, void 0, void 0, function* () {
128
- var _a, _b, _c;
114
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
115
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
129
116
  const _response = yield core.fetcher({
130
- url: (0, url_join_1.default)((_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, "agents"),
117
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "agents"),
131
118
  method: "POST",
132
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
119
+ headers: _headers,
133
120
  contentType: "application/json",
121
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
134
122
  requestType: "json",
135
123
  body: request,
136
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
137
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
124
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
125
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
138
126
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
127
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
128
+ logging: this._options.logging,
139
129
  });
140
130
  if (_response.ok) {
141
131
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -147,28 +137,14 @@ class Agents {
147
137
  rawResponse: _response.rawResponse,
148
138
  });
149
139
  }
150
- switch (_response.error.reason) {
151
- case "non-json":
152
- throw new errors.PaidError({
153
- statusCode: _response.error.statusCode,
154
- body: _response.error.rawBody,
155
- rawResponse: _response.rawResponse,
156
- });
157
- case "timeout":
158
- throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /agents.");
159
- case "unknown":
160
- throw new errors.PaidError({
161
- message: _response.error.errorMessage,
162
- rawResponse: _response.rawResponse,
163
- });
164
- }
140
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/agents");
165
141
  });
166
142
  }
167
143
  /**
168
144
  * DEPRECATED: Use GET /products/{productId} instead.
169
145
  *
170
146
  * @param {string} agentId
171
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
147
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
172
148
  *
173
149
  * @example
174
150
  * await client.agents.get("agentId")
@@ -178,14 +154,18 @@ class Agents {
178
154
  }
179
155
  __get(agentId, requestOptions) {
180
156
  return __awaiter(this, void 0, void 0, function* () {
181
- var _a, _b, _c;
157
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
158
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
182
159
  const _response = yield core.fetcher({
183
- url: (0, url_join_1.default)((_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, `agents/${encodeURIComponent(agentId)}`),
160
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `agents/${core.url.encodePathParam(agentId)}`),
184
161
  method: "GET",
185
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
186
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
187
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
162
+ headers: _headers,
163
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
164
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
165
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
188
166
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
167
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
168
+ logging: this._options.logging,
189
169
  });
190
170
  if (_response.ok) {
191
171
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -197,21 +177,7 @@ class Agents {
197
177
  rawResponse: _response.rawResponse,
198
178
  });
199
179
  }
200
- switch (_response.error.reason) {
201
- case "non-json":
202
- throw new errors.PaidError({
203
- statusCode: _response.error.statusCode,
204
- body: _response.error.rawBody,
205
- rawResponse: _response.rawResponse,
206
- });
207
- case "timeout":
208
- throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents/{agentId}.");
209
- case "unknown":
210
- throw new errors.PaidError({
211
- message: _response.error.errorMessage,
212
- rawResponse: _response.rawResponse,
213
- });
214
- }
180
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/agents/{agentId}");
215
181
  });
216
182
  }
217
183
  /**
@@ -219,7 +185,7 @@ class Agents {
219
185
  *
220
186
  * @param {string} agentId
221
187
  * @param {Paid.AgentUpdate} request
222
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
188
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
223
189
  *
224
190
  * @example
225
191
  * await client.agents.update("agentId", {
@@ -258,17 +224,21 @@ class Agents {
258
224
  }
259
225
  __update(agentId, request, requestOptions) {
260
226
  return __awaiter(this, void 0, void 0, function* () {
261
- var _a, _b, _c;
227
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
228
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
262
229
  const _response = yield core.fetcher({
263
- url: (0, url_join_1.default)((_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, `agents/${encodeURIComponent(agentId)}`),
230
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `agents/${core.url.encodePathParam(agentId)}`),
264
231
  method: "PUT",
265
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
232
+ headers: _headers,
266
233
  contentType: "application/json",
234
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
267
235
  requestType: "json",
268
236
  body: request,
269
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
270
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
237
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
238
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
271
239
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
240
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
241
+ logging: this._options.logging,
272
242
  });
273
243
  if (_response.ok) {
274
244
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -280,28 +250,14 @@ class Agents {
280
250
  rawResponse: _response.rawResponse,
281
251
  });
282
252
  }
283
- switch (_response.error.reason) {
284
- case "non-json":
285
- throw new errors.PaidError({
286
- statusCode: _response.error.statusCode,
287
- body: _response.error.rawBody,
288
- rawResponse: _response.rawResponse,
289
- });
290
- case "timeout":
291
- throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /agents/{agentId}.");
292
- case "unknown":
293
- throw new errors.PaidError({
294
- message: _response.error.errorMessage,
295
- rawResponse: _response.rawResponse,
296
- });
297
- }
253
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/agents/{agentId}");
298
254
  });
299
255
  }
300
256
  /**
301
257
  * DEPRECATED: Use DELETE /products/{productId} instead.
302
258
  *
303
259
  * @param {string} agentId
304
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
260
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
305
261
  *
306
262
  * @example
307
263
  * await client.agents.delete("agentId")
@@ -311,14 +267,18 @@ class Agents {
311
267
  }
312
268
  __delete(agentId, requestOptions) {
313
269
  return __awaiter(this, void 0, void 0, function* () {
314
- var _a, _b, _c;
270
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
271
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
315
272
  const _response = yield core.fetcher({
316
- url: (0, url_join_1.default)((_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, `agents/${encodeURIComponent(agentId)}`),
273
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `agents/${core.url.encodePathParam(agentId)}`),
317
274
  method: "DELETE",
318
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
319
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
320
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
275
+ headers: _headers,
276
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
277
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
278
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
321
279
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
280
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
281
+ logging: this._options.logging,
322
282
  });
323
283
  if (_response.ok) {
324
284
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -330,28 +290,14 @@ class Agents {
330
290
  rawResponse: _response.rawResponse,
331
291
  });
332
292
  }
333
- switch (_response.error.reason) {
334
- case "non-json":
335
- throw new errors.PaidError({
336
- statusCode: _response.error.statusCode,
337
- body: _response.error.rawBody,
338
- rawResponse: _response.rawResponse,
339
- });
340
- case "timeout":
341
- throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /agents/{agentId}.");
342
- case "unknown":
343
- throw new errors.PaidError({
344
- message: _response.error.errorMessage,
345
- rawResponse: _response.rawResponse,
346
- });
347
- }
293
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/agents/{agentId}");
348
294
  });
349
295
  }
350
296
  /**
351
297
  * DEPRECATED: Use GET /products/external/{externalId} instead.
352
298
  *
353
299
  * @param {string} externalId
354
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
300
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
355
301
  *
356
302
  * @example
357
303
  * await client.agents.getByExternalId("externalId")
@@ -361,14 +307,18 @@ class Agents {
361
307
  }
362
308
  __getByExternalId(externalId, requestOptions) {
363
309
  return __awaiter(this, void 0, void 0, function* () {
364
- var _a, _b, _c;
310
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
311
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
365
312
  const _response = yield core.fetcher({
366
- url: (0, url_join_1.default)((_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, `agents/external/${encodeURIComponent(externalId)}`),
313
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `agents/external/${core.url.encodePathParam(externalId)}`),
367
314
  method: "GET",
368
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
369
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
370
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
315
+ headers: _headers,
316
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
317
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
318
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
371
319
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
320
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
321
+ logging: this._options.logging,
372
322
  });
373
323
  if (_response.ok) {
374
324
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -380,21 +330,7 @@ class Agents {
380
330
  rawResponse: _response.rawResponse,
381
331
  });
382
332
  }
383
- switch (_response.error.reason) {
384
- case "non-json":
385
- throw new errors.PaidError({
386
- statusCode: _response.error.statusCode,
387
- body: _response.error.rawBody,
388
- rawResponse: _response.rawResponse,
389
- });
390
- case "timeout":
391
- throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents/external/{externalId}.");
392
- case "unknown":
393
- throw new errors.PaidError({
394
- message: _response.error.errorMessage,
395
- rawResponse: _response.rawResponse,
396
- });
397
- }
333
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/agents/external/{externalId}");
398
334
  });
399
335
  }
400
336
  /**
@@ -402,7 +338,7 @@ class Agents {
402
338
  *
403
339
  * @param {string} externalId
404
340
  * @param {Paid.AgentUpdate} request
405
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
341
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
406
342
  *
407
343
  * @example
408
344
  * await client.agents.updateByExternalId("externalId", {
@@ -430,17 +366,21 @@ class Agents {
430
366
  }
431
367
  __updateByExternalId(externalId, request, requestOptions) {
432
368
  return __awaiter(this, void 0, void 0, function* () {
433
- var _a, _b, _c;
369
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
370
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
434
371
  const _response = yield core.fetcher({
435
- url: (0, url_join_1.default)((_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, `agents/external/${encodeURIComponent(externalId)}`),
372
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `agents/external/${core.url.encodePathParam(externalId)}`),
436
373
  method: "PUT",
437
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
374
+ headers: _headers,
438
375
  contentType: "application/json",
376
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
439
377
  requestType: "json",
440
378
  body: request,
441
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
442
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
379
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
380
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
443
381
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
382
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
383
+ logging: this._options.logging,
444
384
  });
445
385
  if (_response.ok) {
446
386
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -452,28 +392,14 @@ class Agents {
452
392
  rawResponse: _response.rawResponse,
453
393
  });
454
394
  }
455
- switch (_response.error.reason) {
456
- case "non-json":
457
- throw new errors.PaidError({
458
- statusCode: _response.error.statusCode,
459
- body: _response.error.rawBody,
460
- rawResponse: _response.rawResponse,
461
- });
462
- case "timeout":
463
- throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /agents/external/{externalId}.");
464
- case "unknown":
465
- throw new errors.PaidError({
466
- message: _response.error.errorMessage,
467
- rawResponse: _response.rawResponse,
468
- });
469
- }
395
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/agents/external/{externalId}");
470
396
  });
471
397
  }
472
398
  /**
473
399
  * DEPRECATED: Use DELETE /products/external/{externalId} instead.
474
400
  *
475
401
  * @param {string} externalId
476
- * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
402
+ * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
477
403
  *
478
404
  * @example
479
405
  * await client.agents.deleteByExternalId("externalId")
@@ -483,14 +409,18 @@ class Agents {
483
409
  }
484
410
  __deleteByExternalId(externalId, requestOptions) {
485
411
  return __awaiter(this, void 0, void 0, function* () {
486
- var _a, _b, _c;
412
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
413
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
487
414
  const _response = yield core.fetcher({
488
- url: (0, url_join_1.default)((_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, `agents/external/${encodeURIComponent(externalId)}`),
415
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `agents/external/${core.url.encodePathParam(externalId)}`),
489
416
  method: "DELETE",
490
- headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
491
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
492
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
417
+ headers: _headers,
418
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
419
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
420
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
493
421
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
422
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
423
+ logging: this._options.logging,
494
424
  });
495
425
  if (_response.ok) {
496
426
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -502,31 +432,8 @@ class Agents {
502
432
  rawResponse: _response.rawResponse,
503
433
  });
504
434
  }
505
- switch (_response.error.reason) {
506
- case "non-json":
507
- throw new errors.PaidError({
508
- statusCode: _response.error.statusCode,
509
- body: _response.error.rawBody,
510
- rawResponse: _response.rawResponse,
511
- });
512
- case "timeout":
513
- throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /agents/external/{externalId}.");
514
- case "unknown":
515
- throw new errors.PaidError({
516
- message: _response.error.errorMessage,
517
- rawResponse: _response.rawResponse,
518
- });
519
- }
520
- });
521
- }
522
- _getAuthorizationHeader() {
523
- return __awaiter(this, void 0, void 0, function* () {
524
- const bearer = yield core.Supplier.get(this._options.token);
525
- if (bearer != null) {
526
- return `Bearer ${bearer}`;
527
- }
528
- return undefined;
435
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/agents/external/{externalId}");
529
436
  });
530
437
  }
531
438
  }
532
- exports.Agents = Agents;
439
+ exports.AgentsClient = AgentsClient;
@@ -1,6 +1,3 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
1
  /**
5
2
  * @example
6
3
  * {
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
2
+ // This file was auto-generated by Fern from our API Definition.
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1 @@
1
- export { type AgentCreate } from "./AgentCreate.js";
1
+ export type { AgentCreate } from "./AgentCreate.js";
@@ -1,43 +1,26 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as environments from "../../../../environments.js";
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptions } from "../../../../BaseClient.js";
5
3
  import * as core from "../../../../core/index.js";
6
- import * as Paid from "../../../index.js";
7
- export declare namespace Contacts {
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>;
4
+ import type * as Paid from "../../../index.js";
5
+ export declare namespace ContactsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
25
8
  }
26
9
  }
27
- export declare class Contacts {
28
- protected readonly _options: Contacts.Options;
29
- constructor(_options?: Contacts.Options);
10
+ export declare class ContactsClient {
11
+ protected readonly _options: NormalizedClientOptions<ContactsClient.Options>;
12
+ constructor(options?: ContactsClient.Options);
30
13
  /**
31
- * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
14
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
32
15
  *
33
16
  * @example
34
17
  * await client.contacts.list()
35
18
  */
36
- list(requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact[]>;
19
+ list(requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Paid.Contact[]>;
37
20
  private __list;
38
21
  /**
39
22
  * @param {Paid.ContactCreate} request
40
- * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
23
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
41
24
  *
42
25
  * @example
43
26
  * await client.contacts.create({
@@ -48,43 +31,42 @@ export declare class Contacts {
48
31
  * email: "john.doe@example.com"
49
32
  * })
50
33
  */
51
- create(request: Paid.ContactCreate, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
34
+ create(request: Paid.ContactCreate, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
52
35
  private __create;
53
36
  /**
54
37
  * @param {string} contactId
55
- * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
38
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
56
39
  *
57
40
  * @example
58
41
  * await client.contacts.get("contactId")
59
42
  */
60
- get(contactId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
43
+ get(contactId: string, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
61
44
  private __get;
62
45
  /**
63
46
  * @param {string} contactId
64
- * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
47
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
65
48
  *
66
49
  * @example
67
50
  * await client.contacts.delete("contactId")
68
51
  */
69
- delete(contactId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<void>;
52
+ delete(contactId: string, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<void>;
70
53
  private __delete;
71
54
  /**
72
55
  * @param {string} externalId
73
- * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
56
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
74
57
  *
75
58
  * @example
76
59
  * await client.contacts.getByExternalId("externalId")
77
60
  */
78
- getByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
61
+ getByExternalId(externalId: string, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
79
62
  private __getByExternalId;
80
63
  /**
81
64
  * @param {string} externalId
82
- * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
65
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
83
66
  *
84
67
  * @example
85
68
  * await client.contacts.deleteByExternalId("externalId")
86
69
  */
87
- deleteByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<void>;
70
+ deleteByExternalId(externalId: string, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<void>;
88
71
  private __deleteByExternalId;
89
- protected _getAuthorizationHeader(): Promise<string | undefined>;
90
72
  }