@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
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # Paid TypeScript Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FAgentPaid%2Fpaid-node)
4
+ [![npm shield](https://img.shields.io/npm/v/@paid-ai/paid-node)](https://www.npmjs.com/package/@paid-ai/paid-node)
5
+
6
+ The Paid TypeScript library provides convenient access to the Paid API from TypeScript.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ npm i -s @paid-ai/paid-node
12
+ ```
13
+
14
+ ## Reference
15
+
16
+ A full reference for this library is available [here](https://github.com/AgentPaid/paid-node/blob/HEAD/./reference.md).
17
+
18
+ ## Usage
19
+
20
+ Instantiate and use the client with the following:
21
+
22
+ ```typescript
23
+ import { PaidApiClient } from "@paid-ai/paid-node";
24
+
25
+ const client = new PaidApiClient({ token: "YOUR_TOKEN" });
26
+ await client.customers.create({
27
+ name: "name",
28
+ });
29
+ ```
30
+
31
+ ## Request And Response Types
32
+
33
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
34
+ following namespace:
35
+
36
+ ```typescript
37
+ import { PaidApi } from "@paid-ai/paid-node";
38
+
39
+ const request: PaidApi.CustomerCreate = {
40
+ ...
41
+ };
42
+ ```
43
+
44
+ ## Exception Handling
45
+
46
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
47
+ will be thrown.
48
+
49
+ ```typescript
50
+ import { PaidApiError } from "@paid-ai/paid-node";
51
+
52
+ try {
53
+ await client.customers.create(...);
54
+ } catch (err) {
55
+ if (err instanceof PaidApiError) {
56
+ console.log(err.statusCode);
57
+ console.log(err.message);
58
+ console.log(err.body);
59
+ console.log(err.rawResponse);
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## Advanced
65
+
66
+ ### Additional Headers
67
+
68
+ If you would like to send additional headers as part of the request, use the `headers` request option.
69
+
70
+ ```typescript
71
+ const response = await client.customers.create(..., {
72
+ headers: {
73
+ 'X-Custom-Header': 'custom value'
74
+ }
75
+ });
76
+ ```
77
+
78
+ ### Retries
79
+
80
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
81
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
82
+ retry limit (default: 2).
83
+
84
+ A request is deemed retryable when any of the following HTTP status codes is returned:
85
+
86
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
87
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
88
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
89
+
90
+ Use the `maxRetries` request option to configure this behavior.
91
+
92
+ ```typescript
93
+ const response = await client.customers.create(..., {
94
+ maxRetries: 0 // override maxRetries at the request level
95
+ });
96
+ ```
97
+
98
+ ### Timeouts
99
+
100
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
101
+
102
+ ```typescript
103
+ const response = await client.customers.create(..., {
104
+ timeoutInSeconds: 30 // override timeout to 30s
105
+ });
106
+ ```
107
+
108
+ ### Aborting Requests
109
+
110
+ The SDK allows users to abort requests at any point by passing in an abort signal.
111
+
112
+ ```typescript
113
+ const controller = new AbortController();
114
+ const response = await client.customers.create(..., {
115
+ abortSignal: controller.signal
116
+ });
117
+ controller.abort(); // aborts the request
118
+ ```
119
+
120
+ ### Access Raw Response Data
121
+
122
+ The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
123
+ The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
124
+
125
+ ```typescript
126
+ const { data, rawResponse } = await client.customers.create(...).withRawResponse();
127
+
128
+ console.log(data);
129
+ console.log(rawResponse.headers['X-My-Header']);
130
+ ```
131
+
132
+ ### Runtime Compatibility
133
+
134
+ The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
135
+ runtimes:
136
+
137
+ - Node.js 18+
138
+ - Vercel
139
+ - Cloudflare Workers
140
+ - Deno v1.25+
141
+ - Bun 1.0+
142
+ - React Native
143
+
144
+ ### Customizing Fetch Client
145
+
146
+ The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
147
+ unsupported environment, this provides a way for you to break glass and ensure the SDK works.
148
+
149
+ ```typescript
150
+ import { PaidApiClient } from "@paid-ai/paid-node";
151
+
152
+ const client = new PaidApiClient({
153
+ ...
154
+ fetcher: // provide your implementation here
155
+ });
156
+ ```
157
+
158
+ ## Contributing
159
+
160
+ While we value open-source contributions to this SDK, this library is generated programmatically.
161
+ Additions made directly to this library would have to be moved over to our generation code,
162
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
163
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
164
+ an issue first to discuss with us!
165
+
166
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "./environments.js";
5
+ import * as core from "./core/index.js";
6
+ import { Customers } from "./api/resources/customers/client/Client.js";
7
+ import { Agents } from "./api/resources/agents/client/Client.js";
8
+ import { Contacts } from "./api/resources/contacts/client/Client.js";
9
+ import { Orders } from "./api/resources/orders/client/Client.js";
10
+ import { Usage } from "./api/resources/usage/client/Client.js";
11
+ export declare namespace PaidApiClient {
12
+ interface Options {
13
+ environment?: core.Supplier<environments.PaidApiEnvironment | string>;
14
+ /** Specify a custom URL to connect the client to. */
15
+ baseUrl?: core.Supplier<string>;
16
+ token: core.Supplier<core.BearerToken>;
17
+ /** Additional headers to include in requests. */
18
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
19
+ }
20
+ interface RequestOptions {
21
+ /** The maximum time to wait for a response in seconds. */
22
+ timeoutInSeconds?: number;
23
+ /** The number of times to retry the request. Defaults to 2. */
24
+ maxRetries?: number;
25
+ /** A hook to abort the request. */
26
+ abortSignal?: AbortSignal;
27
+ /** Additional headers to include in the request. */
28
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
29
+ }
30
+ }
31
+ export declare class PaidApiClient {
32
+ protected readonly _options: PaidApiClient.Options;
33
+ protected _customers: Customers | undefined;
34
+ protected _agents: Agents | undefined;
35
+ protected _contacts: Contacts | undefined;
36
+ protected _orders: Orders | undefined;
37
+ protected _usage: Usage | undefined;
38
+ constructor(_options: PaidApiClient.Options);
39
+ get customers(): Customers;
40
+ get agents(): Agents;
41
+ get contacts(): Contacts;
42
+ get orders(): Orders;
43
+ get usage(): Usage;
44
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.PaidApiClient = void 0;
40
+ const core = __importStar(require("./core/index.js"));
41
+ const headers_js_1 = require("./core/headers.js");
42
+ const Client_js_1 = require("./api/resources/customers/client/Client.js");
43
+ const Client_js_2 = require("./api/resources/agents/client/Client.js");
44
+ const Client_js_3 = require("./api/resources/contacts/client/Client.js");
45
+ const Client_js_4 = require("./api/resources/orders/client/Client.js");
46
+ const Client_js_5 = require("./api/resources/usage/client/Client.js");
47
+ class PaidApiClient {
48
+ constructor(_options) {
49
+ this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
50
+ "X-Fern-Language": "JavaScript",
51
+ "X-Fern-SDK-Name": "@paid-ai/paid-node",
52
+ "X-Fern-SDK-Version": "0.0.5",
53
+ "User-Agent": "@paid-ai/paid-node/0.0.5",
54
+ "X-Fern-Runtime": core.RUNTIME.type,
55
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
56
+ }, _options === null || _options === void 0 ? void 0 : _options.headers) });
57
+ }
58
+ get customers() {
59
+ var _a;
60
+ return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new Client_js_1.Customers(this._options)));
61
+ }
62
+ get agents() {
63
+ var _a;
64
+ return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Client_js_2.Agents(this._options)));
65
+ }
66
+ get contacts() {
67
+ var _a;
68
+ return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_js_3.Contacts(this._options)));
69
+ }
70
+ get orders() {
71
+ var _a;
72
+ return ((_a = this._orders) !== null && _a !== void 0 ? _a : (this._orders = new Client_js_4.Orders(this._options)));
73
+ }
74
+ get usage() {
75
+ var _a;
76
+ return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_5.Usage(this._options)));
77
+ }
78
+ }
79
+ exports.PaidApiClient = PaidApiClient;
@@ -0,0 +1,2 @@
1
+ export * from "./types/index.js";
2
+ export * from "./resources/index.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/index.js"), exports);
18
+ __exportStar(require("./resources/index.js"), exports);
@@ -0,0 +1,107 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments.js";
5
+ import * as core from "../../../../core/index.js";
6
+ import * as PaidApi from "../../../index.js";
7
+ export declare namespace Agents {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.PaidApiEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token: core.Supplier<core.BearerToken>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ }
16
+ interface RequestOptions {
17
+ /** The maximum time to wait for a response in seconds. */
18
+ timeoutInSeconds?: number;
19
+ /** The number of times to retry the request. Defaults to 2. */
20
+ maxRetries?: number;
21
+ /** A hook to abort the request. */
22
+ abortSignal?: AbortSignal;
23
+ /** Additional headers to include in the request. */
24
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
25
+ }
26
+ }
27
+ export declare class Agents {
28
+ protected readonly _options: Agents.Options;
29
+ constructor(_options: Agents.Options);
30
+ /**
31
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @example
34
+ * await client.agents.list()
35
+ */
36
+ list(requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent[]>;
37
+ private __list;
38
+ /**
39
+ * @param {PaidApi.AgentCreate} request
40
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
41
+ *
42
+ * @example
43
+ * await client.agents.create({
44
+ * name: "name",
45
+ * description: "description"
46
+ * })
47
+ */
48
+ create(request: PaidApi.AgentCreate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
49
+ private __create;
50
+ /**
51
+ * @param {string} agentId
52
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
53
+ *
54
+ * @example
55
+ * await client.agents.get("agentId")
56
+ */
57
+ get(agentId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
58
+ private __get;
59
+ /**
60
+ * @param {string} agentId
61
+ * @param {PaidApi.AgentUpdate} request
62
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @example
65
+ * await client.agents.update("agentId", {})
66
+ */
67
+ update(agentId: string, request: PaidApi.AgentUpdate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
68
+ private __update;
69
+ /**
70
+ * @param {string} agentId
71
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @example
74
+ * await client.agents.delete("agentId")
75
+ */
76
+ delete(agentId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<void>;
77
+ private __delete;
78
+ /**
79
+ * @param {string} externalId
80
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
81
+ *
82
+ * @example
83
+ * await client.agents.getByExternalId("externalId")
84
+ */
85
+ getByExternalId(externalId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
86
+ private __getByExternalId;
87
+ /**
88
+ * @param {string} externalId
89
+ * @param {PaidApi.AgentUpdate} request
90
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
91
+ *
92
+ * @example
93
+ * await client.agents.updateByExternalId("externalId", {})
94
+ */
95
+ updateByExternalId(externalId: string, request: PaidApi.AgentUpdate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
96
+ private __updateByExternalId;
97
+ /**
98
+ * @param {string} externalId
99
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
100
+ *
101
+ * @example
102
+ * await client.agents.deleteByExternalId("externalId")
103
+ */
104
+ deleteByExternalId(externalId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<void>;
105
+ private __deleteByExternalId;
106
+ protected _getAuthorizationHeader(): Promise<string>;
107
+ }