@paid-ai/paid-node 0.0.5

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 (383) hide show
  1. package/README.md +166 -0
  2. package/dist/cjs/Client.d.ts +44 -0
  3. package/dist/cjs/Client.js +79 -0
  4. package/dist/cjs/api/index.d.ts +2 -0
  5. package/dist/cjs/api/index.js +18 -0
  6. package/dist/cjs/api/resources/agents/client/Client.d.ts +107 -0
  7. package/dist/cjs/api/resources/agents/client/Client.js +464 -0
  8. package/dist/cjs/api/resources/agents/client/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/agents/client/index.js +17 -0
  10. package/dist/cjs/api/resources/agents/client/requests/AgentCreate.d.ts +16 -0
  11. package/dist/cjs/api/resources/agents/client/requests/AgentCreate.js +5 -0
  12. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/agents/client/requests/index.js +2 -0
  14. package/dist/cjs/api/resources/agents/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/agents/index.js +17 -0
  16. package/dist/cjs/api/resources/contacts/client/Client.d.ts +93 -0
  17. package/dist/cjs/api/resources/contacts/client/Client.js +366 -0
  18. package/dist/cjs/api/resources/contacts/client/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/contacts/client/index.js +17 -0
  20. package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +32 -0
  21. package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.js +5 -0
  22. package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/contacts/client/requests/index.js +2 -0
  24. package/dist/cjs/api/resources/contacts/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/contacts/index.js +17 -0
  26. package/dist/cjs/api/resources/customers/client/Client.d.ts +106 -0
  27. package/dist/cjs/api/resources/customers/client/Client.js +463 -0
  28. package/dist/cjs/api/resources/customers/client/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/customers/client/index.js +17 -0
  30. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +21 -0
  31. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.js +5 -0
  32. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/customers/client/requests/index.js +2 -0
  34. package/dist/cjs/api/resources/customers/index.d.ts +1 -0
  35. package/dist/cjs/api/resources/customers/index.js +17 -0
  36. package/dist/cjs/api/resources/index.d.ts +10 -0
  37. package/dist/cjs/api/resources/index.js +49 -0
  38. package/dist/cjs/api/resources/orders/client/Client.d.ts +84 -0
  39. package/dist/cjs/api/resources/orders/client/Client.js +320 -0
  40. package/dist/cjs/api/resources/orders/client/index.d.ts +1 -0
  41. package/dist/cjs/api/resources/orders/client/index.js +17 -0
  42. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +25 -0
  43. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.js +5 -0
  44. package/dist/cjs/api/resources/orders/client/requests/index.d.ts +1 -0
  45. package/dist/cjs/api/resources/orders/client/requests/index.js +2 -0
  46. package/dist/cjs/api/resources/orders/index.d.ts +2 -0
  47. package/dist/cjs/api/resources/orders/index.js +18 -0
  48. package/dist/cjs/api/resources/orders/resources/index.d.ts +2 -0
  49. package/dist/cjs/api/resources/orders/resources/index.js +41 -0
  50. package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +41 -0
  51. package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +119 -0
  52. package/dist/cjs/api/resources/orders/resources/lines/client/index.d.ts +1 -0
  53. package/dist/cjs/api/resources/orders/resources/lines/client/index.js +17 -0
  54. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +11 -0
  55. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.js +5 -0
  56. package/dist/cjs/api/resources/orders/resources/lines/client/requests/index.d.ts +1 -0
  57. package/dist/cjs/api/resources/orders/resources/lines/client/requests/index.js +2 -0
  58. package/dist/cjs/api/resources/orders/resources/lines/index.d.ts +1 -0
  59. package/dist/cjs/api/resources/orders/resources/lines/index.js +17 -0
  60. package/dist/cjs/api/resources/usage/client/Client.d.ts +40 -0
  61. package/dist/cjs/api/resources/usage/client/Client.js +118 -0
  62. package/dist/cjs/api/resources/usage/client/index.d.ts +1 -0
  63. package/dist/cjs/api/resources/usage/client/index.js +17 -0
  64. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +11 -0
  65. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.js +5 -0
  66. package/dist/cjs/api/resources/usage/client/requests/index.d.ts +1 -0
  67. package/dist/cjs/api/resources/usage/client/requests/index.js +2 -0
  68. package/dist/cjs/api/resources/usage/index.d.ts +1 -0
  69. package/dist/cjs/api/resources/usage/index.js +17 -0
  70. package/dist/cjs/api/types/Address.d.ts +11 -0
  71. package/dist/cjs/api/types/Address.js +5 -0
  72. package/dist/cjs/api/types/Agent.d.ts +14 -0
  73. package/dist/cjs/api/types/Agent.js +5 -0
  74. package/dist/cjs/api/types/AgentAttribute.d.ts +9 -0
  75. package/dist/cjs/api/types/AgentAttribute.js +5 -0
  76. package/dist/cjs/api/types/AgentPricePoint.d.ts +10 -0
  77. package/dist/cjs/api/types/AgentPricePoint.js +5 -0
  78. package/dist/cjs/api/types/AgentPricePointTiers.d.ts +8 -0
  79. package/dist/cjs/api/types/AgentPricePointTiers.js +5 -0
  80. package/dist/cjs/api/types/AgentUpdate.d.ts +12 -0
  81. package/dist/cjs/api/types/AgentUpdate.js +5 -0
  82. package/dist/cjs/api/types/ApiError.d.ts +12 -0
  83. package/dist/cjs/api/types/ApiError.js +5 -0
  84. package/dist/cjs/api/types/BillingFrequency.d.ts +9 -0
  85. package/dist/cjs/api/types/BillingFrequency.js +11 -0
  86. package/dist/cjs/api/types/ChargeType.d.ts +10 -0
  87. package/dist/cjs/api/types/ChargeType.js +12 -0
  88. package/dist/cjs/api/types/Contact.d.ts +21 -0
  89. package/dist/cjs/api/types/Contact.js +5 -0
  90. package/dist/cjs/api/types/CreationSource.d.ts +10 -0
  91. package/dist/cjs/api/types/CreationSource.js +12 -0
  92. package/dist/cjs/api/types/CreationState.d.ts +8 -0
  93. package/dist/cjs/api/types/CreationState.js +10 -0
  94. package/dist/cjs/api/types/Customer.d.ts +18 -0
  95. package/dist/cjs/api/types/Customer.js +5 -0
  96. package/dist/cjs/api/types/CustomerUpdate.d.ts +15 -0
  97. package/dist/cjs/api/types/CustomerUpdate.js +5 -0
  98. package/dist/cjs/api/types/Error_.d.ts +10 -0
  99. package/dist/cjs/api/types/Error_.js +5 -0
  100. package/dist/cjs/api/types/Order.d.ts +22 -0
  101. package/dist/cjs/api/types/Order.js +5 -0
  102. package/dist/cjs/api/types/OrderLine.d.ts +20 -0
  103. package/dist/cjs/api/types/OrderLine.js +5 -0
  104. package/dist/cjs/api/types/OrderLineAttribute.d.ts +10 -0
  105. package/dist/cjs/api/types/OrderLineAttribute.js +5 -0
  106. package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +11 -0
  107. package/dist/cjs/api/types/OrderLineAttributePricing.js +5 -0
  108. package/dist/cjs/api/types/OrderLineCreate.d.ts +9 -0
  109. package/dist/cjs/api/types/OrderLineCreate.js +5 -0
  110. package/dist/cjs/api/types/PricePoint.d.ts +10 -0
  111. package/dist/cjs/api/types/PricePoint.js +5 -0
  112. package/dist/cjs/api/types/Pricing.d.ts +12 -0
  113. package/dist/cjs/api/types/Pricing.js +5 -0
  114. package/dist/cjs/api/types/PricingModelType.d.ts +9 -0
  115. package/dist/cjs/api/types/PricingModelType.js +11 -0
  116. package/dist/cjs/api/types/Salutation.d.ts +12 -0
  117. package/dist/cjs/api/types/Salutation.js +14 -0
  118. package/dist/cjs/api/types/Signal.d.ts +9 -0
  119. package/dist/cjs/api/types/Signal.js +5 -0
  120. package/dist/cjs/api/types/TaxExemptStatus.d.ts +9 -0
  121. package/dist/cjs/api/types/TaxExemptStatus.js +11 -0
  122. package/dist/cjs/api/types/Tier.d.ts +8 -0
  123. package/dist/cjs/api/types/Tier.js +5 -0
  124. package/dist/cjs/api/types/index.d.ts +27 -0
  125. package/dist/cjs/api/types/index.js +43 -0
  126. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  127. package/dist/cjs/core/auth/BasicAuth.js +26 -0
  128. package/dist/cjs/core/auth/BearerToken.d.ts +5 -0
  129. package/dist/cjs/core/auth/BearerToken.js +15 -0
  130. package/dist/cjs/core/auth/index.d.ts +2 -0
  131. package/dist/cjs/core/auth/index.js +7 -0
  132. package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
  133. package/dist/cjs/core/fetcher/APIResponse.js +2 -0
  134. package/dist/cjs/core/fetcher/Fetcher.d.ts +40 -0
  135. package/dist/cjs/core/fetcher/Fetcher.js +120 -0
  136. package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
  137. package/dist/cjs/core/fetcher/Headers.js +84 -0
  138. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
  139. package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
  140. package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
  141. package/dist/cjs/core/fetcher/RawResponse.js +44 -0
  142. package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
  143. package/dist/cjs/core/fetcher/Supplier.js +22 -0
  144. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
  145. package/dist/cjs/core/fetcher/createRequestUrl.js +12 -0
  146. package/dist/cjs/core/fetcher/getFetchFn.d.ts +4 -0
  147. package/dist/cjs/core/fetcher/getFetchFn.js +68 -0
  148. package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
  149. package/dist/cjs/core/fetcher/getHeader.js +11 -0
  150. package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
  151. package/dist/cjs/core/fetcher/getRequestBody.js +23 -0
  152. package/dist/cjs/core/fetcher/getResponseBody.d.ts +1 -0
  153. package/dist/cjs/core/fetcher/getResponseBody.js +54 -0
  154. package/dist/cjs/core/fetcher/index.d.ts +8 -0
  155. package/dist/cjs/core/fetcher/index.js +15 -0
  156. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -0
  157. package/dist/cjs/core/fetcher/makeRequest.js +42 -0
  158. package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
  159. package/dist/cjs/core/fetcher/requestWithRetries.js +40 -0
  160. package/dist/cjs/core/fetcher/signals.d.ts +11 -0
  161. package/dist/cjs/core/fetcher/signals.js +36 -0
  162. package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  163. package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  164. package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  165. package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  166. package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  167. package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  168. package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  169. package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  170. package/dist/cjs/core/headers.d.ts +3 -0
  171. package/dist/cjs/core/headers.js +29 -0
  172. package/dist/cjs/core/index.d.ts +3 -0
  173. package/dist/cjs/core/index.js +19 -0
  174. package/dist/cjs/core/json.d.ts +15 -0
  175. package/dist/cjs/core/json.js +24 -0
  176. package/dist/cjs/core/runtime/index.d.ts +1 -0
  177. package/dist/cjs/core/runtime/index.js +5 -0
  178. package/dist/cjs/core/runtime/runtime.d.ts +9 -0
  179. package/dist/cjs/core/runtime/runtime.js +103 -0
  180. package/dist/cjs/environments.d.ts +7 -0
  181. package/dist/cjs/environments.js +9 -0
  182. package/dist/cjs/errors/PaidApiError.d.ts +15 -0
  183. package/dist/cjs/errors/PaidApiError.js +30 -0
  184. package/dist/cjs/errors/PaidApiTimeoutError.d.ts +6 -0
  185. package/dist/cjs/errors/PaidApiTimeoutError.js +13 -0
  186. package/dist/cjs/errors/index.d.ts +2 -0
  187. package/dist/cjs/errors/index.js +7 -0
  188. package/dist/cjs/index.d.ts +4 -0
  189. package/dist/cjs/index.js +44 -0
  190. package/dist/cjs/version.d.ts +1 -0
  191. package/dist/cjs/version.js +4 -0
  192. package/dist/esm/Client.d.mts +44 -0
  193. package/dist/esm/Client.mjs +42 -0
  194. package/dist/esm/api/index.d.mts +2 -0
  195. package/dist/esm/api/index.mjs +2 -0
  196. package/dist/esm/api/resources/agents/client/Client.d.mts +107 -0
  197. package/dist/esm/api/resources/agents/client/Client.mjs +424 -0
  198. package/dist/esm/api/resources/agents/client/index.d.mts +1 -0
  199. package/dist/esm/api/resources/agents/client/index.mjs +1 -0
  200. package/dist/esm/api/resources/agents/client/requests/AgentCreate.d.mts +16 -0
  201. package/dist/esm/api/resources/agents/client/requests/AgentCreate.mjs +4 -0
  202. package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -0
  203. package/dist/esm/api/resources/agents/client/requests/index.mjs +1 -0
  204. package/dist/esm/api/resources/agents/index.d.mts +1 -0
  205. package/dist/esm/api/resources/agents/index.mjs +1 -0
  206. package/dist/esm/api/resources/contacts/client/Client.d.mts +93 -0
  207. package/dist/esm/api/resources/contacts/client/Client.mjs +326 -0
  208. package/dist/esm/api/resources/contacts/client/index.d.mts +1 -0
  209. package/dist/esm/api/resources/contacts/client/index.mjs +1 -0
  210. package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +32 -0
  211. package/dist/esm/api/resources/contacts/client/requests/ContactCreate.mjs +4 -0
  212. package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -0
  213. package/dist/esm/api/resources/contacts/client/requests/index.mjs +1 -0
  214. package/dist/esm/api/resources/contacts/index.d.mts +1 -0
  215. package/dist/esm/api/resources/contacts/index.mjs +1 -0
  216. package/dist/esm/api/resources/customers/client/Client.d.mts +106 -0
  217. package/dist/esm/api/resources/customers/client/Client.mjs +423 -0
  218. package/dist/esm/api/resources/customers/client/index.d.mts +1 -0
  219. package/dist/esm/api/resources/customers/client/index.mjs +1 -0
  220. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +21 -0
  221. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.mjs +4 -0
  222. package/dist/esm/api/resources/customers/client/requests/index.d.mts +1 -0
  223. package/dist/esm/api/resources/customers/client/requests/index.mjs +1 -0
  224. package/dist/esm/api/resources/customers/index.d.mts +1 -0
  225. package/dist/esm/api/resources/customers/index.mjs +1 -0
  226. package/dist/esm/api/resources/index.d.mts +10 -0
  227. package/dist/esm/api/resources/index.mjs +10 -0
  228. package/dist/esm/api/resources/orders/client/Client.d.mts +84 -0
  229. package/dist/esm/api/resources/orders/client/Client.mjs +280 -0
  230. package/dist/esm/api/resources/orders/client/index.d.mts +1 -0
  231. package/dist/esm/api/resources/orders/client/index.mjs +1 -0
  232. package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +25 -0
  233. package/dist/esm/api/resources/orders/client/requests/OrderCreate.mjs +4 -0
  234. package/dist/esm/api/resources/orders/client/requests/index.d.mts +1 -0
  235. package/dist/esm/api/resources/orders/client/requests/index.mjs +1 -0
  236. package/dist/esm/api/resources/orders/index.d.mts +2 -0
  237. package/dist/esm/api/resources/orders/index.mjs +2 -0
  238. package/dist/esm/api/resources/orders/resources/index.d.mts +2 -0
  239. package/dist/esm/api/resources/orders/resources/index.mjs +2 -0
  240. package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +41 -0
  241. package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +79 -0
  242. package/dist/esm/api/resources/orders/resources/lines/client/index.d.mts +1 -0
  243. package/dist/esm/api/resources/orders/resources/lines/client/index.mjs +1 -0
  244. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +11 -0
  245. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.mjs +4 -0
  246. package/dist/esm/api/resources/orders/resources/lines/client/requests/index.d.mts +1 -0
  247. package/dist/esm/api/resources/orders/resources/lines/client/requests/index.mjs +1 -0
  248. package/dist/esm/api/resources/orders/resources/lines/index.d.mts +1 -0
  249. package/dist/esm/api/resources/orders/resources/lines/index.mjs +1 -0
  250. package/dist/esm/api/resources/usage/client/Client.d.mts +40 -0
  251. package/dist/esm/api/resources/usage/client/Client.mjs +78 -0
  252. package/dist/esm/api/resources/usage/client/index.d.mts +1 -0
  253. package/dist/esm/api/resources/usage/client/index.mjs +1 -0
  254. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +11 -0
  255. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.mjs +4 -0
  256. package/dist/esm/api/resources/usage/client/requests/index.d.mts +1 -0
  257. package/dist/esm/api/resources/usage/client/requests/index.mjs +1 -0
  258. package/dist/esm/api/resources/usage/index.d.mts +1 -0
  259. package/dist/esm/api/resources/usage/index.mjs +1 -0
  260. package/dist/esm/api/types/Address.d.mts +11 -0
  261. package/dist/esm/api/types/Address.mjs +4 -0
  262. package/dist/esm/api/types/Agent.d.mts +14 -0
  263. package/dist/esm/api/types/Agent.mjs +4 -0
  264. package/dist/esm/api/types/AgentAttribute.d.mts +9 -0
  265. package/dist/esm/api/types/AgentAttribute.mjs +4 -0
  266. package/dist/esm/api/types/AgentPricePoint.d.mts +10 -0
  267. package/dist/esm/api/types/AgentPricePoint.mjs +4 -0
  268. package/dist/esm/api/types/AgentPricePointTiers.d.mts +8 -0
  269. package/dist/esm/api/types/AgentPricePointTiers.mjs +4 -0
  270. package/dist/esm/api/types/AgentUpdate.d.mts +12 -0
  271. package/dist/esm/api/types/AgentUpdate.mjs +4 -0
  272. package/dist/esm/api/types/ApiError.d.mts +12 -0
  273. package/dist/esm/api/types/ApiError.mjs +4 -0
  274. package/dist/esm/api/types/BillingFrequency.d.mts +9 -0
  275. package/dist/esm/api/types/BillingFrequency.mjs +8 -0
  276. package/dist/esm/api/types/ChargeType.d.mts +10 -0
  277. package/dist/esm/api/types/ChargeType.mjs +9 -0
  278. package/dist/esm/api/types/Contact.d.mts +21 -0
  279. package/dist/esm/api/types/Contact.mjs +4 -0
  280. package/dist/esm/api/types/CreationSource.d.mts +10 -0
  281. package/dist/esm/api/types/CreationSource.mjs +9 -0
  282. package/dist/esm/api/types/CreationState.d.mts +8 -0
  283. package/dist/esm/api/types/CreationState.mjs +7 -0
  284. package/dist/esm/api/types/Customer.d.mts +18 -0
  285. package/dist/esm/api/types/Customer.mjs +4 -0
  286. package/dist/esm/api/types/CustomerUpdate.d.mts +15 -0
  287. package/dist/esm/api/types/CustomerUpdate.mjs +4 -0
  288. package/dist/esm/api/types/Error_.d.mts +10 -0
  289. package/dist/esm/api/types/Error_.mjs +4 -0
  290. package/dist/esm/api/types/Order.d.mts +22 -0
  291. package/dist/esm/api/types/Order.mjs +4 -0
  292. package/dist/esm/api/types/OrderLine.d.mts +20 -0
  293. package/dist/esm/api/types/OrderLine.mjs +4 -0
  294. package/dist/esm/api/types/OrderLineAttribute.d.mts +10 -0
  295. package/dist/esm/api/types/OrderLineAttribute.mjs +4 -0
  296. package/dist/esm/api/types/OrderLineAttributePricing.d.mts +11 -0
  297. package/dist/esm/api/types/OrderLineAttributePricing.mjs +4 -0
  298. package/dist/esm/api/types/OrderLineCreate.d.mts +9 -0
  299. package/dist/esm/api/types/OrderLineCreate.mjs +4 -0
  300. package/dist/esm/api/types/PricePoint.d.mts +10 -0
  301. package/dist/esm/api/types/PricePoint.mjs +4 -0
  302. package/dist/esm/api/types/Pricing.d.mts +12 -0
  303. package/dist/esm/api/types/Pricing.mjs +4 -0
  304. package/dist/esm/api/types/PricingModelType.d.mts +9 -0
  305. package/dist/esm/api/types/PricingModelType.mjs +8 -0
  306. package/dist/esm/api/types/Salutation.d.mts +12 -0
  307. package/dist/esm/api/types/Salutation.mjs +11 -0
  308. package/dist/esm/api/types/Signal.d.mts +9 -0
  309. package/dist/esm/api/types/Signal.mjs +4 -0
  310. package/dist/esm/api/types/TaxExemptStatus.d.mts +9 -0
  311. package/dist/esm/api/types/TaxExemptStatus.mjs +8 -0
  312. package/dist/esm/api/types/Tier.d.mts +8 -0
  313. package/dist/esm/api/types/Tier.mjs +4 -0
  314. package/dist/esm/api/types/index.d.mts +27 -0
  315. package/dist/esm/api/types/index.mjs +27 -0
  316. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  317. package/dist/esm/core/auth/BasicAuth.mjs +23 -0
  318. package/dist/esm/core/auth/BearerToken.d.mts +5 -0
  319. package/dist/esm/core/auth/BearerToken.mjs +12 -0
  320. package/dist/esm/core/auth/index.d.mts +2 -0
  321. package/dist/esm/core/auth/index.mjs +2 -0
  322. package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
  323. package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
  324. package/dist/esm/core/fetcher/Fetcher.d.mts +40 -0
  325. package/dist/esm/core/fetcher/Fetcher.mjs +116 -0
  326. package/dist/esm/core/fetcher/Headers.d.mts +2 -0
  327. package/dist/esm/core/fetcher/Headers.mjs +82 -0
  328. package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
  329. package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
  330. package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
  331. package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
  332. package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
  333. package/dist/esm/core/fetcher/Supplier.mjs +19 -0
  334. package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
  335. package/dist/esm/core/fetcher/createRequestUrl.mjs +6 -0
  336. package/dist/esm/core/fetcher/getFetchFn.d.mts +4 -0
  337. package/dist/esm/core/fetcher/getFetchFn.mjs +32 -0
  338. package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
  339. package/dist/esm/core/fetcher/getHeader.mjs +8 -0
  340. package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
  341. package/dist/esm/core/fetcher/getRequestBody.mjs +20 -0
  342. package/dist/esm/core/fetcher/getResponseBody.d.mts +1 -0
  343. package/dist/esm/core/fetcher/getResponseBody.mjs +51 -0
  344. package/dist/esm/core/fetcher/index.d.mts +8 -0
  345. package/dist/esm/core/fetcher/index.mjs +5 -0
  346. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -0
  347. package/dist/esm/core/fetcher/makeRequest.mjs +38 -0
  348. package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
  349. package/dist/esm/core/fetcher/requestWithRetries.mjs +37 -0
  350. package/dist/esm/core/fetcher/signals.d.mts +11 -0
  351. package/dist/esm/core/fetcher/signals.mjs +32 -0
  352. package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.mts +30 -0
  353. package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.mjs +243 -0
  354. package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.mts +21 -0
  355. package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.mjs +122 -0
  356. package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.mts +31 -0
  357. package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.mjs +225 -0
  358. package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.d.mts +18 -0
  359. package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.mjs +23 -0
  360. package/dist/esm/core/headers.d.mts +3 -0
  361. package/dist/esm/core/headers.mjs +25 -0
  362. package/dist/esm/core/index.d.mts +3 -0
  363. package/dist/esm/core/index.mjs +3 -0
  364. package/dist/esm/core/json.d.mts +15 -0
  365. package/dist/esm/core/json.mjs +19 -0
  366. package/dist/esm/core/runtime/index.d.mts +1 -0
  367. package/dist/esm/core/runtime/index.mjs +1 -0
  368. package/dist/esm/core/runtime/runtime.d.mts +9 -0
  369. package/dist/esm/core/runtime/runtime.mjs +100 -0
  370. package/dist/esm/environments.d.mts +7 -0
  371. package/dist/esm/environments.mjs +6 -0
  372. package/dist/esm/errors/PaidApiError.d.mts +15 -0
  373. package/dist/esm/errors/PaidApiError.mjs +26 -0
  374. package/dist/esm/errors/PaidApiTimeoutError.d.mts +6 -0
  375. package/dist/esm/errors/PaidApiTimeoutError.mjs +9 -0
  376. package/dist/esm/errors/index.d.mts +2 -0
  377. package/dist/esm/errors/index.mjs +2 -0
  378. package/dist/esm/index.d.mts +4 -0
  379. package/dist/esm/index.mjs +4 -0
  380. package/dist/esm/version.d.mts +1 -0
  381. package/dist/esm/version.mjs +1 -0
  382. package/package.json +70 -0
  383. package/reference.md +1433 -0
@@ -0,0 +1,423 @@
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 Customers {
19
+ constructor(_options) {
20
+ this._options = _options;
21
+ }
22
+ /**
23
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
24
+ *
25
+ * @example
26
+ * await client.customers.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.PaidApiEnvironment.Production, "customers"),
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.PaidApiError({
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.PaidApiError({
55
+ statusCode: _response.error.statusCode,
56
+ body: _response.error.rawBody,
57
+ rawResponse: _response.rawResponse,
58
+ });
59
+ case "timeout":
60
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling GET /customers.");
61
+ case "unknown":
62
+ throw new errors.PaidApiError({
63
+ message: _response.error.errorMessage,
64
+ rawResponse: _response.rawResponse,
65
+ });
66
+ }
67
+ });
68
+ }
69
+ /**
70
+ * @param {PaidApi.CustomerCreate} request
71
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @example
74
+ * await client.customers.create({
75
+ * name: "name"
76
+ * })
77
+ */
78
+ create(request, requestOptions) {
79
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
80
+ }
81
+ __create(request, requestOptions) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ var _a, _b, _c;
84
+ const _response = yield core.fetcher({
85
+ 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.PaidApiEnvironment.Production, "customers"),
86
+ method: "POST",
87
+ 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),
88
+ contentType: "application/json",
89
+ requestType: "json",
90
+ body: request,
91
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
92
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
93
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
94
+ });
95
+ if (_response.ok) {
96
+ return { data: _response.body, rawResponse: _response.rawResponse };
97
+ }
98
+ if (_response.error.reason === "status-code") {
99
+ throw new errors.PaidApiError({
100
+ statusCode: _response.error.statusCode,
101
+ body: _response.error.body,
102
+ rawResponse: _response.rawResponse,
103
+ });
104
+ }
105
+ switch (_response.error.reason) {
106
+ case "non-json":
107
+ throw new errors.PaidApiError({
108
+ statusCode: _response.error.statusCode,
109
+ body: _response.error.rawBody,
110
+ rawResponse: _response.rawResponse,
111
+ });
112
+ case "timeout":
113
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling POST /customers.");
114
+ case "unknown":
115
+ throw new errors.PaidApiError({
116
+ message: _response.error.errorMessage,
117
+ rawResponse: _response.rawResponse,
118
+ });
119
+ }
120
+ });
121
+ }
122
+ /**
123
+ * @param {string} customerId
124
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
125
+ *
126
+ * @example
127
+ * await client.customers.get("customerId")
128
+ */
129
+ get(customerId, requestOptions) {
130
+ return core.HttpResponsePromise.fromPromise(this.__get(customerId, requestOptions));
131
+ }
132
+ __get(customerId, requestOptions) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ var _a, _b, _c;
135
+ const _response = yield core.fetcher({
136
+ 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.PaidApiEnvironment.Production, `customers/${encodeURIComponent(customerId)}`),
137
+ method: "GET",
138
+ 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),
139
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
140
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
141
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
142
+ });
143
+ if (_response.ok) {
144
+ return { data: _response.body, rawResponse: _response.rawResponse };
145
+ }
146
+ if (_response.error.reason === "status-code") {
147
+ throw new errors.PaidApiError({
148
+ statusCode: _response.error.statusCode,
149
+ body: _response.error.body,
150
+ rawResponse: _response.rawResponse,
151
+ });
152
+ }
153
+ switch (_response.error.reason) {
154
+ case "non-json":
155
+ throw new errors.PaidApiError({
156
+ statusCode: _response.error.statusCode,
157
+ body: _response.error.rawBody,
158
+ rawResponse: _response.rawResponse,
159
+ });
160
+ case "timeout":
161
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling GET /customers/{customerId}.");
162
+ case "unknown":
163
+ throw new errors.PaidApiError({
164
+ message: _response.error.errorMessage,
165
+ rawResponse: _response.rawResponse,
166
+ });
167
+ }
168
+ });
169
+ }
170
+ /**
171
+ * @param {string} customerId
172
+ * @param {PaidApi.CustomerUpdate} request
173
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
174
+ *
175
+ * @example
176
+ * await client.customers.update("customerId", {})
177
+ */
178
+ update(customerId, request, requestOptions) {
179
+ return core.HttpResponsePromise.fromPromise(this.__update(customerId, request, requestOptions));
180
+ }
181
+ __update(customerId, request, requestOptions) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ var _a, _b, _c;
184
+ const _response = yield core.fetcher({
185
+ 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.PaidApiEnvironment.Production, `customers/${encodeURIComponent(customerId)}`),
186
+ method: "PUT",
187
+ 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),
188
+ contentType: "application/json",
189
+ requestType: "json",
190
+ body: request,
191
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
192
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
193
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
194
+ });
195
+ if (_response.ok) {
196
+ return { data: _response.body, rawResponse: _response.rawResponse };
197
+ }
198
+ if (_response.error.reason === "status-code") {
199
+ throw new errors.PaidApiError({
200
+ statusCode: _response.error.statusCode,
201
+ body: _response.error.body,
202
+ rawResponse: _response.rawResponse,
203
+ });
204
+ }
205
+ switch (_response.error.reason) {
206
+ case "non-json":
207
+ throw new errors.PaidApiError({
208
+ statusCode: _response.error.statusCode,
209
+ body: _response.error.rawBody,
210
+ rawResponse: _response.rawResponse,
211
+ });
212
+ case "timeout":
213
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling PUT /customers/{customerId}.");
214
+ case "unknown":
215
+ throw new errors.PaidApiError({
216
+ message: _response.error.errorMessage,
217
+ rawResponse: _response.rawResponse,
218
+ });
219
+ }
220
+ });
221
+ }
222
+ /**
223
+ * @param {string} customerId
224
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
225
+ *
226
+ * @example
227
+ * await client.customers.delete("customerId")
228
+ */
229
+ delete(customerId, requestOptions) {
230
+ return core.HttpResponsePromise.fromPromise(this.__delete(customerId, requestOptions));
231
+ }
232
+ __delete(customerId, requestOptions) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ var _a, _b, _c;
235
+ const _response = yield core.fetcher({
236
+ 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.PaidApiEnvironment.Production, `customers/${encodeURIComponent(customerId)}`),
237
+ method: "DELETE",
238
+ 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),
239
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
240
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
241
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
242
+ });
243
+ if (_response.ok) {
244
+ return { data: undefined, rawResponse: _response.rawResponse };
245
+ }
246
+ if (_response.error.reason === "status-code") {
247
+ throw new errors.PaidApiError({
248
+ statusCode: _response.error.statusCode,
249
+ body: _response.error.body,
250
+ rawResponse: _response.rawResponse,
251
+ });
252
+ }
253
+ switch (_response.error.reason) {
254
+ case "non-json":
255
+ throw new errors.PaidApiError({
256
+ statusCode: _response.error.statusCode,
257
+ body: _response.error.rawBody,
258
+ rawResponse: _response.rawResponse,
259
+ });
260
+ case "timeout":
261
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling DELETE /customers/{customerId}.");
262
+ case "unknown":
263
+ throw new errors.PaidApiError({
264
+ message: _response.error.errorMessage,
265
+ rawResponse: _response.rawResponse,
266
+ });
267
+ }
268
+ });
269
+ }
270
+ /**
271
+ * @param {string} externalId
272
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
273
+ *
274
+ * @example
275
+ * await client.customers.getByExternalId("externalId")
276
+ */
277
+ getByExternalId(externalId, requestOptions) {
278
+ return core.HttpResponsePromise.fromPromise(this.__getByExternalId(externalId, requestOptions));
279
+ }
280
+ __getByExternalId(externalId, requestOptions) {
281
+ return __awaiter(this, void 0, void 0, function* () {
282
+ var _a, _b, _c;
283
+ const _response = yield core.fetcher({
284
+ 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.PaidApiEnvironment.Production, `customers/external/${encodeURIComponent(externalId)}`),
285
+ method: "GET",
286
+ 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),
287
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
288
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
289
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
290
+ });
291
+ if (_response.ok) {
292
+ return { data: _response.body, rawResponse: _response.rawResponse };
293
+ }
294
+ if (_response.error.reason === "status-code") {
295
+ throw new errors.PaidApiError({
296
+ statusCode: _response.error.statusCode,
297
+ body: _response.error.body,
298
+ rawResponse: _response.rawResponse,
299
+ });
300
+ }
301
+ switch (_response.error.reason) {
302
+ case "non-json":
303
+ throw new errors.PaidApiError({
304
+ statusCode: _response.error.statusCode,
305
+ body: _response.error.rawBody,
306
+ rawResponse: _response.rawResponse,
307
+ });
308
+ case "timeout":
309
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}.");
310
+ case "unknown":
311
+ throw new errors.PaidApiError({
312
+ message: _response.error.errorMessage,
313
+ rawResponse: _response.rawResponse,
314
+ });
315
+ }
316
+ });
317
+ }
318
+ /**
319
+ * @param {string} externalId
320
+ * @param {PaidApi.CustomerUpdate} request
321
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
322
+ *
323
+ * @example
324
+ * await client.customers.updateByExternalId("externalId", {})
325
+ */
326
+ updateByExternalId(externalId, request, requestOptions) {
327
+ return core.HttpResponsePromise.fromPromise(this.__updateByExternalId(externalId, request, requestOptions));
328
+ }
329
+ __updateByExternalId(externalId, request, requestOptions) {
330
+ return __awaiter(this, void 0, void 0, function* () {
331
+ var _a, _b, _c;
332
+ const _response = yield core.fetcher({
333
+ 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.PaidApiEnvironment.Production, `customers/external/${encodeURIComponent(externalId)}`),
334
+ method: "PUT",
335
+ 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),
336
+ contentType: "application/json",
337
+ requestType: "json",
338
+ body: request,
339
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
340
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
341
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
342
+ });
343
+ if (_response.ok) {
344
+ return { data: _response.body, rawResponse: _response.rawResponse };
345
+ }
346
+ if (_response.error.reason === "status-code") {
347
+ throw new errors.PaidApiError({
348
+ statusCode: _response.error.statusCode,
349
+ body: _response.error.body,
350
+ rawResponse: _response.rawResponse,
351
+ });
352
+ }
353
+ switch (_response.error.reason) {
354
+ case "non-json":
355
+ throw new errors.PaidApiError({
356
+ statusCode: _response.error.statusCode,
357
+ body: _response.error.rawBody,
358
+ rawResponse: _response.rawResponse,
359
+ });
360
+ case "timeout":
361
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling PUT /customers/external/{externalId}.");
362
+ case "unknown":
363
+ throw new errors.PaidApiError({
364
+ message: _response.error.errorMessage,
365
+ rawResponse: _response.rawResponse,
366
+ });
367
+ }
368
+ });
369
+ }
370
+ /**
371
+ * @param {string} externalId
372
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
373
+ *
374
+ * @example
375
+ * await client.customers.deleteByExternalId("externalId")
376
+ */
377
+ deleteByExternalId(externalId, requestOptions) {
378
+ return core.HttpResponsePromise.fromPromise(this.__deleteByExternalId(externalId, requestOptions));
379
+ }
380
+ __deleteByExternalId(externalId, requestOptions) {
381
+ return __awaiter(this, void 0, void 0, function* () {
382
+ var _a, _b, _c;
383
+ const _response = yield core.fetcher({
384
+ 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.PaidApiEnvironment.Production, `customers/external/${encodeURIComponent(externalId)}`),
385
+ method: "DELETE",
386
+ 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),
387
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
388
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
389
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
390
+ });
391
+ if (_response.ok) {
392
+ return { data: undefined, rawResponse: _response.rawResponse };
393
+ }
394
+ if (_response.error.reason === "status-code") {
395
+ throw new errors.PaidApiError({
396
+ statusCode: _response.error.statusCode,
397
+ body: _response.error.body,
398
+ rawResponse: _response.rawResponse,
399
+ });
400
+ }
401
+ switch (_response.error.reason) {
402
+ case "non-json":
403
+ throw new errors.PaidApiError({
404
+ statusCode: _response.error.statusCode,
405
+ body: _response.error.rawBody,
406
+ rawResponse: _response.rawResponse,
407
+ });
408
+ case "timeout":
409
+ throw new errors.PaidApiTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}.");
410
+ case "unknown":
411
+ throw new errors.PaidApiError({
412
+ message: _response.error.errorMessage,
413
+ rawResponse: _response.rawResponse,
414
+ });
415
+ }
416
+ });
417
+ }
418
+ _getAuthorizationHeader() {
419
+ return __awaiter(this, void 0, void 0, function* () {
420
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
421
+ });
422
+ }
423
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as PaidApi from "../../../../index.mjs";
5
+ /**
6
+ * @example
7
+ * {
8
+ * name: "name"
9
+ * }
10
+ */
11
+ export interface CustomerCreate {
12
+ name: string;
13
+ externalId?: string;
14
+ phone?: string;
15
+ employeeCount?: number;
16
+ annualRevenue?: number;
17
+ taxExemptStatus?: PaidApi.TaxExemptStatus;
18
+ creationSource?: PaidApi.CreationSource;
19
+ website?: string;
20
+ billingAddress?: PaidApi.Address;
21
+ }
@@ -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 CustomerCreate } from "./CustomerCreate.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,10 @@
1
+ export * as customers from "./customers/index.mjs";
2
+ export * as agents from "./agents/index.mjs";
3
+ export * as contacts from "./contacts/index.mjs";
4
+ export * as orders from "./orders/index.mjs";
5
+ export * as usage from "./usage/index.mjs";
6
+ export * from "./customers/client/requests/index.mjs";
7
+ export * from "./agents/client/requests/index.mjs";
8
+ export * from "./contacts/client/requests/index.mjs";
9
+ export * from "./orders/client/requests/index.mjs";
10
+ export * from "./usage/client/requests/index.mjs";
@@ -0,0 +1,10 @@
1
+ export * as customers from "./customers/index.mjs";
2
+ export * as agents from "./agents/index.mjs";
3
+ export * as contacts from "./contacts/index.mjs";
4
+ export * as orders from "./orders/index.mjs";
5
+ export * as usage from "./usage/index.mjs";
6
+ export * from "./customers/client/requests/index.mjs";
7
+ export * from "./agents/client/requests/index.mjs";
8
+ export * from "./contacts/client/requests/index.mjs";
9
+ export * from "./orders/client/requests/index.mjs";
10
+ export * from "./usage/client/requests/index.mjs";
@@ -0,0 +1,84 @@
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 PaidApi from "../../../index.mjs";
7
+ import { Lines } from "../resources/lines/client/Client.mjs";
8
+ export declare namespace Orders {
9
+ interface Options {
10
+ environment?: core.Supplier<environments.PaidApiEnvironment | string>;
11
+ /** Specify a custom URL to connect the client to. */
12
+ baseUrl?: core.Supplier<string>;
13
+ token: core.Supplier<core.BearerToken>;
14
+ /** Additional headers to include in requests. */
15
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
16
+ }
17
+ interface RequestOptions {
18
+ /** The maximum time to wait for a response in seconds. */
19
+ timeoutInSeconds?: number;
20
+ /** The number of times to retry the request. Defaults to 2. */
21
+ maxRetries?: number;
22
+ /** A hook to abort the request. */
23
+ abortSignal?: AbortSignal;
24
+ /** Additional headers to include in the request. */
25
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
+ }
27
+ }
28
+ export declare class Orders {
29
+ protected readonly _options: Orders.Options;
30
+ protected _lines: Lines | undefined;
31
+ constructor(_options: Orders.Options);
32
+ get lines(): Lines;
33
+ /**
34
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.orders.list()
38
+ */
39
+ list(requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<PaidApi.Order[]>;
40
+ private __list;
41
+ /**
42
+ * @param {PaidApi.OrderCreate} request
43
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
44
+ *
45
+ * @example
46
+ * await client.orders.create({
47
+ * customerId: "customerId",
48
+ * billingContactId: "billingContactId",
49
+ * name: "name",
50
+ * startDate: "startDate",
51
+ * currency: "currency"
52
+ * })
53
+ */
54
+ create(request: PaidApi.OrderCreate, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<PaidApi.Order>;
55
+ private __create;
56
+ /**
57
+ * @param {string} orderId
58
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
59
+ *
60
+ * @example
61
+ * await client.orders.get("orderId")
62
+ */
63
+ get(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<PaidApi.Order>;
64
+ private __get;
65
+ /**
66
+ * @param {string} orderId
67
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
68
+ *
69
+ * @example
70
+ * await client.orders.delete("orderId")
71
+ */
72
+ delete(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<void>;
73
+ private __delete;
74
+ /**
75
+ * @param {string} orderId
76
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
77
+ *
78
+ * @example
79
+ * await client.orders.activate("orderId")
80
+ */
81
+ activate(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<PaidApi.Order>;
82
+ private __activate;
83
+ protected _getAuthorizationHeader(): Promise<string>;
84
+ }