@paid-ai/paid-node 1.2.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/dist/cjs/Client.d.ts +9 -0
  2. package/dist/cjs/Client.js +33 -18
  3. package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
  4. package/dist/cjs/api/errors/ConflictError.js +50 -0
  5. package/dist/cjs/api/errors/index.d.ts +1 -0
  6. package/dist/cjs/api/errors/index.js +1 -0
  7. package/dist/cjs/api/resources/checkouts/client/Client.d.ts +1 -1
  8. package/dist/cjs/api/resources/cost/client/Client.d.ts +38 -0
  9. package/dist/cjs/api/resources/cost/client/Client.js +139 -0
  10. package/dist/cjs/api/resources/cost/client/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/cost/client/index.js +17 -0
  12. package/dist/cjs/api/resources/cost/client/requests/CostIngestRequest.d.ts +17 -0
  13. package/dist/cjs/api/resources/cost/client/requests/CostIngestRequest.js +3 -0
  14. package/dist/cjs/api/resources/cost/client/requests/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/cost/client/requests/index.js +2 -0
  16. package/dist/cjs/api/resources/cost/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/cost/index.js +17 -0
  18. package/dist/cjs/api/resources/customers/client/Client.d.ts +19 -0
  19. package/dist/cjs/api/resources/customers/client/Client.js +86 -0
  20. package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.ts +16 -0
  21. package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.js +3 -0
  22. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/index.d.ts +9 -0
  24. package/dist/cjs/api/resources/index.js +10 -1
  25. package/dist/cjs/api/resources/orders/client/Client.d.ts +60 -0
  26. package/dist/cjs/api/resources/orders/client/Client.js +242 -0
  27. package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.ts +22 -0
  28. package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.js +3 -0
  29. package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +1 -0
  30. package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.d.ts +14 -0
  31. package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.js +3 -0
  32. package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.ts +12 -0
  33. package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.js +3 -0
  34. package/dist/cjs/api/resources/orders/client/requests/index.d.ts +3 -0
  35. package/dist/cjs/api/resources/orders/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/orders/index.js +1 -0
  37. package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.d.ts +5 -0
  38. package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.js +8 -0
  39. package/dist/cjs/api/resources/orders/types/index.d.ts +1 -0
  40. package/dist/cjs/api/resources/orders/types/index.js +17 -0
  41. package/dist/cjs/api/resources/pricing/client/Client.d.ts +71 -0
  42. package/dist/cjs/api/resources/pricing/client/Client.js +284 -0
  43. package/dist/cjs/api/resources/pricing/client/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/pricing/client/index.js +17 -0
  45. package/dist/cjs/api/resources/pricing/client/requests/GetPricingRequest.d.ts +9 -0
  46. package/dist/cjs/api/resources/pricing/client/requests/GetPricingRequest.js +3 -0
  47. package/dist/cjs/api/resources/pricing/client/requests/ListPricingRequest.d.ts +10 -0
  48. package/dist/cjs/api/resources/pricing/client/requests/ListPricingRequest.js +3 -0
  49. package/dist/cjs/api/resources/pricing/client/requests/UpdatePricingRequest.d.ts +20 -0
  50. package/dist/cjs/api/resources/pricing/client/requests/UpdatePricingRequest.js +3 -0
  51. package/dist/cjs/api/resources/pricing/client/requests/index.d.ts +3 -0
  52. package/dist/cjs/api/resources/pricing/client/requests/index.js +2 -0
  53. package/dist/cjs/api/resources/pricing/index.d.ts +1 -0
  54. package/dist/cjs/api/resources/pricing/index.js +17 -0
  55. package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +85 -0
  56. package/dist/cjs/api/resources/valueReceipts/client/Client.js +362 -1
  57. package/dist/cjs/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.d.ts +9 -0
  58. package/dist/cjs/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.js +3 -0
  59. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +7 -0
  60. package/dist/cjs/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.d.ts +9 -0
  61. package/dist/cjs/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.js +3 -0
  62. package/dist/cjs/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.d.ts +9 -0
  63. package/dist/cjs/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.js +3 -0
  64. package/dist/cjs/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.d.ts +28 -0
  65. package/dist/cjs/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.js +3 -0
  66. package/dist/cjs/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.d.ts +9 -0
  67. package/dist/cjs/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.js +3 -0
  68. package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +5 -0
  69. package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
  70. package/dist/cjs/api/resources/valueReceipts/index.js +1 -0
  71. package/dist/cjs/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.d.ts +5 -0
  72. package/dist/cjs/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.js +8 -0
  73. package/dist/cjs/api/resources/valueReceipts/types/index.d.ts +1 -0
  74. package/dist/cjs/api/resources/valueReceipts/types/index.js +17 -0
  75. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +63 -0
  76. package/dist/cjs/api/resources/webhooks/client/Client.js +282 -0
  77. package/dist/cjs/api/resources/webhooks/client/index.d.ts +1 -0
  78. package/dist/cjs/api/resources/webhooks/client/index.js +17 -0
  79. package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.d.ts +10 -0
  80. package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.js +3 -0
  81. package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.ts +14 -0
  82. package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.js +3 -0
  83. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
  84. package/dist/cjs/api/resources/webhooks/client/requests/index.js +2 -0
  85. package/dist/cjs/api/resources/webhooks/index.d.ts +2 -0
  86. package/dist/cjs/api/resources/webhooks/index.js +18 -0
  87. package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.ts +12 -0
  88. package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.js +15 -0
  89. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.ts +12 -0
  90. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.js +15 -0
  91. package/dist/cjs/api/resources/webhooks/types/index.d.ts +2 -0
  92. package/dist/cjs/api/resources/webhooks/types/index.js +18 -0
  93. package/dist/cjs/api/types/BatchSeatAssignmentsResponse.d.ts +4 -0
  94. package/dist/cjs/api/types/BatchSeatAssignmentsResponse.js +3 -0
  95. package/dist/cjs/api/types/CheckoutDetails.d.ts +21 -0
  96. package/dist/cjs/api/types/CheckoutDetails.js +3 -0
  97. package/dist/cjs/api/types/Cost.d.ts +10 -0
  98. package/dist/cjs/api/types/Cost.js +3 -0
  99. package/dist/cjs/api/types/CostIngestResponse.d.ts +6 -0
  100. package/dist/cjs/api/types/CostIngestResponse.js +3 -0
  101. package/dist/cjs/api/types/CostOverride.d.ts +8 -0
  102. package/dist/cjs/api/types/CostOverride.js +3 -0
  103. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +1 -0
  104. package/dist/cjs/api/types/CreditBalance.d.ts +6 -0
  105. package/dist/cjs/api/types/CreditBenefitInput.d.ts +30 -0
  106. package/dist/cjs/api/types/CreditBenefitInput.js +20 -0
  107. package/dist/cjs/api/types/CreditBenefitOutput.d.ts +13 -0
  108. package/dist/cjs/api/types/CreditBenefitOutput.js +3 -0
  109. package/dist/cjs/api/types/CreditGrant.d.ts +11 -0
  110. package/dist/cjs/api/types/CreditGrant.js +3 -0
  111. package/dist/cjs/api/types/CustomerUser.d.ts +13 -0
  112. package/dist/cjs/api/types/CustomerUser.js +3 -0
  113. package/dist/cjs/api/types/CustomerUserStatus.d.ts +5 -0
  114. package/dist/cjs/api/types/CustomerUserStatus.js +8 -0
  115. package/dist/cjs/api/types/OneTimePerUnitInput.d.ts +21 -0
  116. package/dist/cjs/api/types/OneTimePerUnitInput.js +18 -0
  117. package/dist/cjs/api/types/Order.d.ts +2 -0
  118. package/dist/cjs/api/types/OrderBillingFrequencyOverride.d.ts +14 -0
  119. package/dist/cjs/api/types/OrderBillingFrequencyOverride.js +14 -0
  120. package/dist/cjs/api/types/OrderSeat.d.ts +10 -0
  121. package/dist/cjs/api/types/OrderSeat.js +3 -0
  122. package/dist/cjs/api/types/OrderSeatListResponse.d.ts +5 -0
  123. package/dist/cjs/api/types/OrderSeatListResponse.js +3 -0
  124. package/dist/cjs/api/types/PrecomputedCost.d.ts +17 -0
  125. package/dist/cjs/api/types/PrecomputedCost.js +3 -0
  126. package/dist/cjs/api/types/PricingInput.d.ts +46 -0
  127. package/dist/cjs/api/types/PricingInput.js +3 -0
  128. package/dist/cjs/api/types/PricingListResponse.d.ts +4 -0
  129. package/dist/cjs/api/types/PricingListResponse.js +3 -0
  130. package/dist/cjs/api/types/PricingOutput.d.ts +36 -0
  131. package/dist/cjs/api/types/PricingOutput.js +23 -0
  132. package/dist/cjs/api/types/PricingPricePointOutput.d.ts +29 -0
  133. package/dist/cjs/api/types/PricingPricePointOutput.js +17 -0
  134. package/dist/cjs/api/types/PricingResponse.d.ts +7 -0
  135. package/dist/cjs/api/types/PricingResponse.js +3 -0
  136. package/dist/cjs/api/types/ProductAttribution.d.ts +2 -0
  137. package/dist/cjs/api/types/ProductAttribution.js +3 -0
  138. package/dist/cjs/api/types/RecurringGraduatedInput.d.ts +22 -0
  139. package/dist/cjs/api/types/RecurringGraduatedInput.js +18 -0
  140. package/dist/cjs/api/types/RecurringPerUnitInput.d.ts +22 -0
  141. package/dist/cjs/api/types/RecurringPerUnitInput.js +18 -0
  142. package/dist/cjs/api/types/RecurringPercentOfTotalInput.d.ts +23 -0
  143. package/dist/cjs/api/types/RecurringPercentOfTotalInput.js +18 -0
  144. package/dist/cjs/api/types/RecurringVolumeInput.d.ts +22 -0
  145. package/dist/cjs/api/types/RecurringVolumeInput.js +18 -0
  146. package/dist/cjs/api/types/SeatAssignee.d.ts +5 -0
  147. package/dist/cjs/api/types/SeatAssignee.js +3 -0
  148. package/dist/cjs/api/types/SeatAssignmentStatus.d.ts +5 -0
  149. package/dist/cjs/api/types/SeatAssignmentStatus.js +8 -0
  150. package/dist/cjs/api/types/SeatBasedGraduatedInput.d.ts +22 -0
  151. package/dist/cjs/api/types/SeatBasedGraduatedInput.js +18 -0
  152. package/dist/cjs/api/types/SeatBasedPerUnitInput.d.ts +22 -0
  153. package/dist/cjs/api/types/SeatBasedPerUnitInput.js +18 -0
  154. package/dist/cjs/api/types/SeatBasedPrepaidCreditsInput.d.ts +25 -0
  155. package/dist/cjs/api/types/SeatBasedPrepaidCreditsInput.js +18 -0
  156. package/dist/cjs/api/types/SeatBasedVolumeInput.d.ts +22 -0
  157. package/dist/cjs/api/types/SeatBasedVolumeInput.js +18 -0
  158. package/dist/cjs/api/types/SimplePricePoint.d.ts +29 -0
  159. package/dist/cjs/api/types/SimplePricePoint.js +17 -0
  160. package/dist/cjs/api/types/SuccessResponse.d.ts +3 -0
  161. package/dist/cjs/api/types/SuccessResponse.js +3 -0
  162. package/dist/cjs/api/types/TieredPricePoint.d.ts +29 -0
  163. package/dist/cjs/api/types/TieredPricePoint.js +17 -0
  164. package/dist/cjs/api/types/TokenUsage.d.ts +12 -0
  165. package/dist/cjs/api/types/TokenUsage.js +3 -0
  166. package/dist/cjs/api/types/UsageCost.d.ts +15 -0
  167. package/dist/cjs/api/types/UsageCost.js +3 -0
  168. package/dist/cjs/api/types/UsageCostPlusInput.d.ts +23 -0
  169. package/dist/cjs/api/types/UsageCostPlusInput.js +18 -0
  170. package/dist/cjs/api/types/UsageGraduatedInput.d.ts +23 -0
  171. package/dist/cjs/api/types/UsageGraduatedInput.js +18 -0
  172. package/dist/cjs/api/types/UsagePerUnitInput.d.ts +23 -0
  173. package/dist/cjs/api/types/UsagePerUnitInput.js +18 -0
  174. package/dist/cjs/api/types/UsagePrepaidCreditsInput.d.ts +26 -0
  175. package/dist/cjs/api/types/UsagePrepaidCreditsInput.js +18 -0
  176. package/dist/cjs/api/types/UsageVolumeInput.d.ts +23 -0
  177. package/dist/cjs/api/types/UsageVolumeInput.js +18 -0
  178. package/dist/cjs/api/types/ValueReceiptDetail.d.ts +2 -0
  179. package/dist/cjs/api/types/ValueReceiptSummary.d.ts +2 -0
  180. package/dist/cjs/api/types/ValueReceiptSyncResponse.d.ts +6 -0
  181. package/dist/cjs/api/types/ValueReceiptSyncResponse.js +3 -0
  182. package/dist/cjs/api/types/Webhook.d.ts +24 -0
  183. package/dist/cjs/api/types/Webhook.js +18 -0
  184. package/dist/cjs/api/types/WebhookDeliveryStatus.d.ts +5 -0
  185. package/dist/cjs/api/types/WebhookDeliveryStatus.js +8 -0
  186. package/dist/cjs/api/types/WebhookListResponse.d.ts +4 -0
  187. package/dist/cjs/api/types/WebhookListResponse.js +3 -0
  188. package/dist/cjs/api/types/WebhookTestResponse.d.ts +3 -0
  189. package/dist/cjs/api/types/WebhookTestResponse.js +3 -0
  190. package/dist/cjs/api/types/index.d.ts +46 -0
  191. package/dist/cjs/api/types/index.js +46 -0
  192. package/dist/cjs/version.d.ts +1 -1
  193. package/dist/cjs/version.js +1 -1
  194. package/dist/esm/Client.d.mts +9 -0
  195. package/dist/esm/Client.mjs +17 -2
  196. package/dist/esm/api/errors/ConflictError.d.mts +6 -0
  197. package/dist/esm/api/errors/ConflictError.mjs +13 -0
  198. package/dist/esm/api/errors/index.d.mts +1 -0
  199. package/dist/esm/api/errors/index.mjs +1 -0
  200. package/dist/esm/api/resources/checkouts/client/Client.d.mts +1 -1
  201. package/dist/esm/api/resources/cost/client/Client.d.mts +38 -0
  202. package/dist/esm/api/resources/cost/client/Client.mjs +102 -0
  203. package/dist/esm/api/resources/cost/client/index.d.mts +1 -0
  204. package/dist/esm/api/resources/cost/client/index.mjs +1 -0
  205. package/dist/esm/api/resources/cost/client/requests/CostIngestRequest.d.mts +17 -0
  206. package/dist/esm/api/resources/cost/client/requests/CostIngestRequest.mjs +2 -0
  207. package/dist/esm/api/resources/cost/client/requests/index.d.mts +1 -0
  208. package/dist/esm/api/resources/cost/client/requests/index.mjs +1 -0
  209. package/dist/esm/api/resources/cost/index.d.mts +1 -0
  210. package/dist/esm/api/resources/cost/index.mjs +1 -0
  211. package/dist/esm/api/resources/customers/client/Client.d.mts +19 -0
  212. package/dist/esm/api/resources/customers/client/Client.mjs +86 -0
  213. package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.mts +16 -0
  214. package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.mjs +2 -0
  215. package/dist/esm/api/resources/customers/client/requests/index.d.mts +1 -0
  216. package/dist/esm/api/resources/index.d.mts +9 -0
  217. package/dist/esm/api/resources/index.mjs +9 -0
  218. package/dist/esm/api/resources/orders/client/Client.d.mts +60 -0
  219. package/dist/esm/api/resources/orders/client/Client.mjs +242 -0
  220. package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.mts +22 -0
  221. package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.mjs +2 -0
  222. package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +1 -0
  223. package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.d.mts +14 -0
  224. package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.mjs +2 -0
  225. package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.mts +12 -0
  226. package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.mjs +2 -0
  227. package/dist/esm/api/resources/orders/client/requests/index.d.mts +3 -0
  228. package/dist/esm/api/resources/orders/index.d.mts +1 -0
  229. package/dist/esm/api/resources/orders/index.mjs +1 -0
  230. package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.d.mts +5 -0
  231. package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.mjs +5 -0
  232. package/dist/esm/api/resources/orders/types/index.d.mts +1 -0
  233. package/dist/esm/api/resources/orders/types/index.mjs +1 -0
  234. package/dist/esm/api/resources/pricing/client/Client.d.mts +71 -0
  235. package/dist/esm/api/resources/pricing/client/Client.mjs +247 -0
  236. package/dist/esm/api/resources/pricing/client/index.d.mts +1 -0
  237. package/dist/esm/api/resources/pricing/client/index.mjs +1 -0
  238. package/dist/esm/api/resources/pricing/client/requests/GetPricingRequest.d.mts +9 -0
  239. package/dist/esm/api/resources/pricing/client/requests/GetPricingRequest.mjs +2 -0
  240. package/dist/esm/api/resources/pricing/client/requests/ListPricingRequest.d.mts +10 -0
  241. package/dist/esm/api/resources/pricing/client/requests/ListPricingRequest.mjs +2 -0
  242. package/dist/esm/api/resources/pricing/client/requests/UpdatePricingRequest.d.mts +20 -0
  243. package/dist/esm/api/resources/pricing/client/requests/UpdatePricingRequest.mjs +2 -0
  244. package/dist/esm/api/resources/pricing/client/requests/index.d.mts +3 -0
  245. package/dist/esm/api/resources/pricing/client/requests/index.mjs +1 -0
  246. package/dist/esm/api/resources/pricing/index.d.mts +1 -0
  247. package/dist/esm/api/resources/pricing/index.mjs +1 -0
  248. package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +85 -0
  249. package/dist/esm/api/resources/valueReceipts/client/Client.mjs +362 -1
  250. package/dist/esm/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.d.mts +9 -0
  251. package/dist/esm/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.mjs +2 -0
  252. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +7 -0
  253. package/dist/esm/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.d.mts +9 -0
  254. package/dist/esm/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.mjs +2 -0
  255. package/dist/esm/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.d.mts +9 -0
  256. package/dist/esm/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.mjs +2 -0
  257. package/dist/esm/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.d.mts +28 -0
  258. package/dist/esm/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.mjs +2 -0
  259. package/dist/esm/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.d.mts +9 -0
  260. package/dist/esm/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.mjs +2 -0
  261. package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +5 -0
  262. package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
  263. package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
  264. package/dist/esm/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.d.mts +5 -0
  265. package/dist/esm/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.mjs +5 -0
  266. package/dist/esm/api/resources/valueReceipts/types/index.d.mts +1 -0
  267. package/dist/esm/api/resources/valueReceipts/types/index.mjs +1 -0
  268. package/dist/esm/api/resources/webhooks/client/Client.d.mts +63 -0
  269. package/dist/esm/api/resources/webhooks/client/Client.mjs +245 -0
  270. package/dist/esm/api/resources/webhooks/client/index.d.mts +1 -0
  271. package/dist/esm/api/resources/webhooks/client/index.mjs +1 -0
  272. package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.d.mts +10 -0
  273. package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.mjs +2 -0
  274. package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.mts +14 -0
  275. package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.mjs +2 -0
  276. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
  277. package/dist/esm/api/resources/webhooks/client/requests/index.mjs +1 -0
  278. package/dist/esm/api/resources/webhooks/index.d.mts +2 -0
  279. package/dist/esm/api/resources/webhooks/index.mjs +2 -0
  280. package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.mts +12 -0
  281. package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.mjs +12 -0
  282. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.mts +12 -0
  283. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.mjs +12 -0
  284. package/dist/esm/api/resources/webhooks/types/index.d.mts +2 -0
  285. package/dist/esm/api/resources/webhooks/types/index.mjs +2 -0
  286. package/dist/esm/api/types/BatchSeatAssignmentsResponse.d.mts +4 -0
  287. package/dist/esm/api/types/BatchSeatAssignmentsResponse.mjs +2 -0
  288. package/dist/esm/api/types/CheckoutDetails.d.mts +21 -0
  289. package/dist/esm/api/types/CheckoutDetails.mjs +2 -0
  290. package/dist/esm/api/types/Cost.d.mts +10 -0
  291. package/dist/esm/api/types/Cost.mjs +2 -0
  292. package/dist/esm/api/types/CostIngestResponse.d.mts +6 -0
  293. package/dist/esm/api/types/CostIngestResponse.mjs +2 -0
  294. package/dist/esm/api/types/CostOverride.d.mts +8 -0
  295. package/dist/esm/api/types/CostOverride.mjs +2 -0
  296. package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +1 -0
  297. package/dist/esm/api/types/CreditBalance.d.mts +6 -0
  298. package/dist/esm/api/types/CreditBenefitInput.d.mts +30 -0
  299. package/dist/esm/api/types/CreditBenefitInput.mjs +17 -0
  300. package/dist/esm/api/types/CreditBenefitOutput.d.mts +13 -0
  301. package/dist/esm/api/types/CreditBenefitOutput.mjs +2 -0
  302. package/dist/esm/api/types/CreditGrant.d.mts +11 -0
  303. package/dist/esm/api/types/CreditGrant.mjs +2 -0
  304. package/dist/esm/api/types/CustomerUser.d.mts +13 -0
  305. package/dist/esm/api/types/CustomerUser.mjs +2 -0
  306. package/dist/esm/api/types/CustomerUserStatus.d.mts +5 -0
  307. package/dist/esm/api/types/CustomerUserStatus.mjs +5 -0
  308. package/dist/esm/api/types/OneTimePerUnitInput.d.mts +21 -0
  309. package/dist/esm/api/types/OneTimePerUnitInput.mjs +15 -0
  310. package/dist/esm/api/types/Order.d.mts +2 -0
  311. package/dist/esm/api/types/OrderBillingFrequencyOverride.d.mts +14 -0
  312. package/dist/esm/api/types/OrderBillingFrequencyOverride.mjs +11 -0
  313. package/dist/esm/api/types/OrderSeat.d.mts +10 -0
  314. package/dist/esm/api/types/OrderSeat.mjs +2 -0
  315. package/dist/esm/api/types/OrderSeatListResponse.d.mts +5 -0
  316. package/dist/esm/api/types/OrderSeatListResponse.mjs +2 -0
  317. package/dist/esm/api/types/PrecomputedCost.d.mts +17 -0
  318. package/dist/esm/api/types/PrecomputedCost.mjs +2 -0
  319. package/dist/esm/api/types/PricingInput.d.mts +46 -0
  320. package/dist/esm/api/types/PricingInput.mjs +2 -0
  321. package/dist/esm/api/types/PricingListResponse.d.mts +4 -0
  322. package/dist/esm/api/types/PricingListResponse.mjs +2 -0
  323. package/dist/esm/api/types/PricingOutput.d.mts +36 -0
  324. package/dist/esm/api/types/PricingOutput.mjs +20 -0
  325. package/dist/esm/api/types/PricingPricePointOutput.d.mts +29 -0
  326. package/dist/esm/api/types/PricingPricePointOutput.mjs +14 -0
  327. package/dist/esm/api/types/PricingResponse.d.mts +7 -0
  328. package/dist/esm/api/types/PricingResponse.mjs +2 -0
  329. package/dist/esm/api/types/ProductAttribution.d.mts +2 -0
  330. package/dist/esm/api/types/ProductAttribution.mjs +2 -0
  331. package/dist/esm/api/types/RecurringGraduatedInput.d.mts +22 -0
  332. package/dist/esm/api/types/RecurringGraduatedInput.mjs +15 -0
  333. package/dist/esm/api/types/RecurringPerUnitInput.d.mts +22 -0
  334. package/dist/esm/api/types/RecurringPerUnitInput.mjs +15 -0
  335. package/dist/esm/api/types/RecurringPercentOfTotalInput.d.mts +23 -0
  336. package/dist/esm/api/types/RecurringPercentOfTotalInput.mjs +15 -0
  337. package/dist/esm/api/types/RecurringVolumeInput.d.mts +22 -0
  338. package/dist/esm/api/types/RecurringVolumeInput.mjs +15 -0
  339. package/dist/esm/api/types/SeatAssignee.d.mts +5 -0
  340. package/dist/esm/api/types/SeatAssignee.mjs +2 -0
  341. package/dist/esm/api/types/SeatAssignmentStatus.d.mts +5 -0
  342. package/dist/esm/api/types/SeatAssignmentStatus.mjs +5 -0
  343. package/dist/esm/api/types/SeatBasedGraduatedInput.d.mts +22 -0
  344. package/dist/esm/api/types/SeatBasedGraduatedInput.mjs +15 -0
  345. package/dist/esm/api/types/SeatBasedPerUnitInput.d.mts +22 -0
  346. package/dist/esm/api/types/SeatBasedPerUnitInput.mjs +15 -0
  347. package/dist/esm/api/types/SeatBasedPrepaidCreditsInput.d.mts +25 -0
  348. package/dist/esm/api/types/SeatBasedPrepaidCreditsInput.mjs +15 -0
  349. package/dist/esm/api/types/SeatBasedVolumeInput.d.mts +22 -0
  350. package/dist/esm/api/types/SeatBasedVolumeInput.mjs +15 -0
  351. package/dist/esm/api/types/SimplePricePoint.d.mts +29 -0
  352. package/dist/esm/api/types/SimplePricePoint.mjs +14 -0
  353. package/dist/esm/api/types/SuccessResponse.d.mts +3 -0
  354. package/dist/esm/api/types/SuccessResponse.mjs +2 -0
  355. package/dist/esm/api/types/TieredPricePoint.d.mts +29 -0
  356. package/dist/esm/api/types/TieredPricePoint.mjs +14 -0
  357. package/dist/esm/api/types/TokenUsage.d.mts +12 -0
  358. package/dist/esm/api/types/TokenUsage.mjs +2 -0
  359. package/dist/esm/api/types/UsageCost.d.mts +15 -0
  360. package/dist/esm/api/types/UsageCost.mjs +2 -0
  361. package/dist/esm/api/types/UsageCostPlusInput.d.mts +23 -0
  362. package/dist/esm/api/types/UsageCostPlusInput.mjs +15 -0
  363. package/dist/esm/api/types/UsageGraduatedInput.d.mts +23 -0
  364. package/dist/esm/api/types/UsageGraduatedInput.mjs +15 -0
  365. package/dist/esm/api/types/UsagePerUnitInput.d.mts +23 -0
  366. package/dist/esm/api/types/UsagePerUnitInput.mjs +15 -0
  367. package/dist/esm/api/types/UsagePrepaidCreditsInput.d.mts +26 -0
  368. package/dist/esm/api/types/UsagePrepaidCreditsInput.mjs +15 -0
  369. package/dist/esm/api/types/UsageVolumeInput.d.mts +23 -0
  370. package/dist/esm/api/types/UsageVolumeInput.mjs +15 -0
  371. package/dist/esm/api/types/ValueReceiptDetail.d.mts +2 -0
  372. package/dist/esm/api/types/ValueReceiptSummary.d.mts +2 -0
  373. package/dist/esm/api/types/ValueReceiptSyncResponse.d.mts +6 -0
  374. package/dist/esm/api/types/ValueReceiptSyncResponse.mjs +2 -0
  375. package/dist/esm/api/types/Webhook.d.mts +24 -0
  376. package/dist/esm/api/types/Webhook.mjs +15 -0
  377. package/dist/esm/api/types/WebhookDeliveryStatus.d.mts +5 -0
  378. package/dist/esm/api/types/WebhookDeliveryStatus.mjs +5 -0
  379. package/dist/esm/api/types/WebhookListResponse.d.mts +4 -0
  380. package/dist/esm/api/types/WebhookListResponse.mjs +2 -0
  381. package/dist/esm/api/types/WebhookTestResponse.d.mts +3 -0
  382. package/dist/esm/api/types/WebhookTestResponse.mjs +2 -0
  383. package/dist/esm/api/types/index.d.mts +46 -0
  384. package/dist/esm/api/types/index.mjs +46 -0
  385. package/dist/esm/version.d.mts +1 -1
  386. package/dist/esm/version.mjs +1 -1
  387. package/package.json +1 -1
  388. package/reference.md +1159 -105
@@ -1,13 +1,16 @@
1
1
  import { Checkouts } from "./api/resources/checkouts/client/Client.js";
2
2
  import { Contacts } from "./api/resources/contacts/client/Client.js";
3
+ import { Cost } from "./api/resources/cost/client/Client.js";
3
4
  import { Credits } from "./api/resources/credits/client/Client.js";
4
5
  import { CustomerPortals } from "./api/resources/customerPortals/client/Client.js";
5
6
  import { Customers } from "./api/resources/customers/client/Client.js";
6
7
  import { Invoices } from "./api/resources/invoices/client/Client.js";
7
8
  import { Orders } from "./api/resources/orders/client/Client.js";
9
+ import { Pricing } from "./api/resources/pricing/client/Client.js";
8
10
  import { Products } from "./api/resources/products/client/Client.js";
9
11
  import { Signals } from "./api/resources/signals/client/Client.js";
10
12
  import { ValueReceipts } from "./api/resources/valueReceipts/client/Client.js";
13
+ import { Webhooks } from "./api/resources/webhooks/client/Client.js";
11
14
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
12
15
  export declare namespace PaidClient {
13
16
  interface Options extends BaseClientOptions {
@@ -27,6 +30,9 @@ export declare class PaidClient {
27
30
  protected _checkouts: Checkouts | undefined;
28
31
  protected _customerPortals: CustomerPortals | undefined;
29
32
  protected _valueReceipts: ValueReceipts | undefined;
33
+ protected _webhooks: Webhooks | undefined;
34
+ protected _pricing: Pricing | undefined;
35
+ protected _cost: Cost | undefined;
30
36
  constructor(_options: PaidClient.Options);
31
37
  get products(): Products;
32
38
  get customers(): Customers;
@@ -38,4 +44,7 @@ export declare class PaidClient {
38
44
  get checkouts(): Checkouts;
39
45
  get customerPortals(): CustomerPortals;
40
46
  get valueReceipts(): ValueReceipts;
47
+ get webhooks(): Webhooks;
48
+ get pricing(): Pricing;
49
+ get cost(): Cost;
41
50
  }
@@ -37,14 +37,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.PaidClient = void 0;
38
38
  const Client_js_1 = require("./api/resources/checkouts/client/Client.js");
39
39
  const Client_js_2 = require("./api/resources/contacts/client/Client.js");
40
- const Client_js_3 = require("./api/resources/credits/client/Client.js");
41
- const Client_js_4 = require("./api/resources/customerPortals/client/Client.js");
42
- const Client_js_5 = require("./api/resources/customers/client/Client.js");
43
- const Client_js_6 = require("./api/resources/invoices/client/Client.js");
44
- const Client_js_7 = require("./api/resources/orders/client/Client.js");
45
- const Client_js_8 = require("./api/resources/products/client/Client.js");
46
- const Client_js_9 = require("./api/resources/signals/client/Client.js");
47
- const Client_js_10 = require("./api/resources/valueReceipts/client/Client.js");
40
+ const Client_js_3 = require("./api/resources/cost/client/Client.js");
41
+ const Client_js_4 = require("./api/resources/credits/client/Client.js");
42
+ const Client_js_5 = require("./api/resources/customerPortals/client/Client.js");
43
+ const Client_js_6 = require("./api/resources/customers/client/Client.js");
44
+ const Client_js_7 = require("./api/resources/invoices/client/Client.js");
45
+ const Client_js_8 = require("./api/resources/orders/client/Client.js");
46
+ const Client_js_9 = require("./api/resources/pricing/client/Client.js");
47
+ const Client_js_10 = require("./api/resources/products/client/Client.js");
48
+ const Client_js_11 = require("./api/resources/signals/client/Client.js");
49
+ const Client_js_12 = require("./api/resources/valueReceipts/client/Client.js");
50
+ const Client_js_13 = require("./api/resources/webhooks/client/Client.js");
48
51
  const headers_js_1 = require("./core/headers.js");
49
52
  const core = __importStar(require("./core/index.js"));
50
53
  class PaidClient {
@@ -52,19 +55,19 @@ class PaidClient {
52
55
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
53
56
  "X-Fern-Language": "JavaScript",
54
57
  "X-Fern-SDK-Name": "@paid-ai/paid-node",
55
- "X-Fern-SDK-Version": "1.2.1",
56
- "User-Agent": "@paid-ai/paid-node/1.2.1",
58
+ "X-Fern-SDK-Version": "1.5.0",
59
+ "User-Agent": "@paid-ai/paid-node/1.5.0",
57
60
  "X-Fern-Runtime": core.RUNTIME.type,
58
61
  "X-Fern-Runtime-Version": core.RUNTIME.version,
59
62
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
60
63
  }
61
64
  get products() {
62
65
  var _a;
63
- return ((_a = this._products) !== null && _a !== void 0 ? _a : (this._products = new Client_js_8.Products(this._options)));
66
+ return ((_a = this._products) !== null && _a !== void 0 ? _a : (this._products = new Client_js_10.Products(this._options)));
64
67
  }
65
68
  get customers() {
66
69
  var _a;
67
- return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new Client_js_5.Customers(this._options)));
70
+ return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new Client_js_6.Customers(this._options)));
68
71
  }
69
72
  get contacts() {
70
73
  var _a;
@@ -72,19 +75,19 @@ class PaidClient {
72
75
  }
73
76
  get orders() {
74
77
  var _a;
75
- return ((_a = this._orders) !== null && _a !== void 0 ? _a : (this._orders = new Client_js_7.Orders(this._options)));
78
+ return ((_a = this._orders) !== null && _a !== void 0 ? _a : (this._orders = new Client_js_8.Orders(this._options)));
76
79
  }
77
80
  get invoices() {
78
81
  var _a;
79
- return ((_a = this._invoices) !== null && _a !== void 0 ? _a : (this._invoices = new Client_js_6.Invoices(this._options)));
82
+ return ((_a = this._invoices) !== null && _a !== void 0 ? _a : (this._invoices = new Client_js_7.Invoices(this._options)));
80
83
  }
81
84
  get signals() {
82
85
  var _a;
83
- return ((_a = this._signals) !== null && _a !== void 0 ? _a : (this._signals = new Client_js_9.Signals(this._options)));
86
+ return ((_a = this._signals) !== null && _a !== void 0 ? _a : (this._signals = new Client_js_11.Signals(this._options)));
84
87
  }
85
88
  get credits() {
86
89
  var _a;
87
- return ((_a = this._credits) !== null && _a !== void 0 ? _a : (this._credits = new Client_js_3.Credits(this._options)));
90
+ return ((_a = this._credits) !== null && _a !== void 0 ? _a : (this._credits = new Client_js_4.Credits(this._options)));
88
91
  }
89
92
  get checkouts() {
90
93
  var _a;
@@ -92,11 +95,23 @@ class PaidClient {
92
95
  }
93
96
  get customerPortals() {
94
97
  var _a;
95
- return ((_a = this._customerPortals) !== null && _a !== void 0 ? _a : (this._customerPortals = new Client_js_4.CustomerPortals(this._options)));
98
+ return ((_a = this._customerPortals) !== null && _a !== void 0 ? _a : (this._customerPortals = new Client_js_5.CustomerPortals(this._options)));
96
99
  }
97
100
  get valueReceipts() {
98
101
  var _a;
99
- return ((_a = this._valueReceipts) !== null && _a !== void 0 ? _a : (this._valueReceipts = new Client_js_10.ValueReceipts(this._options)));
102
+ return ((_a = this._valueReceipts) !== null && _a !== void 0 ? _a : (this._valueReceipts = new Client_js_12.ValueReceipts(this._options)));
103
+ }
104
+ get webhooks() {
105
+ var _a;
106
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_13.Webhooks(this._options)));
107
+ }
108
+ get pricing() {
109
+ var _a;
110
+ return ((_a = this._pricing) !== null && _a !== void 0 ? _a : (this._pricing = new Client_js_9.Pricing(this._options)));
111
+ }
112
+ get cost() {
113
+ var _a;
114
+ return ((_a = this._cost) !== null && _a !== void 0 ? _a : (this._cost = new Client_js_3.Cost(this._options)));
100
115
  }
101
116
  }
102
117
  exports.PaidClient = PaidClient;
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as Paid from "../index.js";
4
+ export declare class ConflictError extends errors.PaidError {
5
+ constructor(body: Paid.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ConflictError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class ConflictError extends errors.PaidError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "ConflictError",
43
+ statusCode: 409,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, ConflictError.prototype);
48
+ }
49
+ }
50
+ exports.ConflictError = ConflictError;
@@ -1,4 +1,5 @@
1
1
  export * from "./BadRequestError.js";
2
+ export * from "./ConflictError.js";
2
3
  export * from "./ForbiddenError.js";
3
4
  export * from "./InternalServerError.js";
4
5
  export * from "./NotFoundError.js";
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BadRequestError.js"), exports);
18
+ __exportStar(require("./ConflictError.js"), exports);
18
19
  __exportStar(require("./ForbiddenError.js"), exports);
19
20
  __exportStar(require("./InternalServerError.js"), exports);
20
21
  __exportStar(require("./NotFoundError.js"), exports);
@@ -61,7 +61,7 @@ export declare class Checkouts {
61
61
  * id: "id"
62
62
  * })
63
63
  */
64
- getCheckout(request: Paid.GetCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.Checkout>;
64
+ getCheckout(request: Paid.GetCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.CheckoutDetails>;
65
65
  private __getCheckout;
66
66
  /**
67
67
  * Archive a checkout by ID
@@ -0,0 +1,38 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import * as Paid from "../../../index.js";
4
+ export declare namespace Cost {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Cost {
11
+ protected readonly _options: Cost.Options;
12
+ constructor(_options: Cost.Options);
13
+ /**
14
+ * Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted. Records may carry an optional `idempotencyKey`; matches against previously ingested records are skipped and reported in the `duplicates` count.
15
+ *
16
+ * @param {Paid.CostIngestRequest} request
17
+ * @param {Cost.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Paid.BadRequestError}
20
+ * @throws {@link Paid.ForbiddenError}
21
+ * @throws {@link Paid.InternalServerError}
22
+ *
23
+ * @example
24
+ * await client.cost.ingestCost({
25
+ * costs: [{
26
+ * type: "cost",
27
+ * customer: {
28
+ * customerId: "customerId"
29
+ * },
30
+ * amount: 1.1,
31
+ * currency: "currency"
32
+ * }]
33
+ * })
34
+ */
35
+ ingestCost(request: Paid.CostIngestRequest, requestOptions?: Cost.RequestOptions): core.HttpResponsePromise<Paid.CostIngestResponse>;
36
+ private __ingestCost;
37
+ protected _getAuthorizationHeader(): Promise<string>;
38
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.Cost = void 0;
47
+ const headers_js_1 = require("../../../../core/headers.js");
48
+ const core = __importStar(require("../../../../core/index.js"));
49
+ const environments = __importStar(require("../../../../environments.js"));
50
+ const errors = __importStar(require("../../../../errors/index.js"));
51
+ const Paid = __importStar(require("../../../index.js"));
52
+ class Cost {
53
+ constructor(_options) {
54
+ this._options = _options;
55
+ }
56
+ /**
57
+ * Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted. Records may carry an optional `idempotencyKey`; matches against previously ingested records are skipped and reported in the `duplicates` count.
58
+ *
59
+ * @param {Paid.CostIngestRequest} request
60
+ * @param {Cost.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link Paid.BadRequestError}
63
+ * @throws {@link Paid.ForbiddenError}
64
+ * @throws {@link Paid.InternalServerError}
65
+ *
66
+ * @example
67
+ * await client.cost.ingestCost({
68
+ * costs: [{
69
+ * type: "cost",
70
+ * customer: {
71
+ * customerId: "customerId"
72
+ * },
73
+ * amount: 1.1,
74
+ * currency: "currency"
75
+ * }]
76
+ * })
77
+ */
78
+ ingestCost(request, requestOptions) {
79
+ return core.HttpResponsePromise.fromPromise(this.__ingestCost(request, requestOptions));
80
+ }
81
+ __ingestCost(request, requestOptions) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ var _a, _b, _c, _d, _e, _f, _g, _h;
84
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
85
+ const _response = yield core.fetcher({
86
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "cost/"),
87
+ method: "POST",
88
+ headers: _headers,
89
+ contentType: "application/json",
90
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
91
+ requestType: "json",
92
+ body: request,
93
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
94
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
95
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
96
+ });
97
+ if (_response.ok) {
98
+ return { data: _response.body, rawResponse: _response.rawResponse };
99
+ }
100
+ if (_response.error.reason === "status-code") {
101
+ switch (_response.error.statusCode) {
102
+ case 400:
103
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
104
+ case 403:
105
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
106
+ case 500:
107
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
108
+ default:
109
+ throw new errors.PaidError({
110
+ statusCode: _response.error.statusCode,
111
+ body: _response.error.body,
112
+ rawResponse: _response.rawResponse,
113
+ });
114
+ }
115
+ }
116
+ switch (_response.error.reason) {
117
+ case "non-json":
118
+ throw new errors.PaidError({
119
+ statusCode: _response.error.statusCode,
120
+ body: _response.error.rawBody,
121
+ rawResponse: _response.rawResponse,
122
+ });
123
+ case "timeout":
124
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /cost/.");
125
+ case "unknown":
126
+ throw new errors.PaidError({
127
+ message: _response.error.errorMessage,
128
+ rawResponse: _response.rawResponse,
129
+ });
130
+ }
131
+ });
132
+ }
133
+ _getAuthorizationHeader() {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
136
+ });
137
+ }
138
+ }
139
+ exports.Cost = Cost;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
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("./requests/index.js"), exports);
@@ -0,0 +1,17 @@
1
+ import type * as Paid from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * costs: [{
6
+ * type: "cost",
7
+ * customer: {
8
+ * customerId: "customerId"
9
+ * },
10
+ * amount: 1.1,
11
+ * currency: "currency"
12
+ * }]
13
+ * }
14
+ */
15
+ export interface CostIngestRequest {
16
+ costs: Paid.Cost[];
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { CostIngestRequest } from "./CostIngestRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
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("./client/index.js"), exports);
@@ -184,5 +184,24 @@ export declare class Customers {
184
184
  */
185
185
  getCustomerCreditBalancesByExternalId(request: Paid.GetCustomerCreditBalancesByExternalIdRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.CreditBalanceListResponse>;
186
186
  private __getCustomerCreditBalancesByExternalId;
187
+ /**
188
+ * Create or update a customer user using customer and user external IDs
189
+ *
190
+ * @param {Paid.UpsertCustomerUserRequest} request
191
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
192
+ *
193
+ * @throws {@link Paid.BadRequestError}
194
+ * @throws {@link Paid.ForbiddenError}
195
+ * @throws {@link Paid.NotFoundError}
196
+ * @throws {@link Paid.InternalServerError}
197
+ *
198
+ * @example
199
+ * await client.customers.upsertCustomerUserByExternalId({
200
+ * customerExternalId: "customerExternalId",
201
+ * userExternalId: "userExternalId"
202
+ * })
203
+ */
204
+ upsertCustomerUserByExternalId(request: Paid.UpsertCustomerUserRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.CustomerUser>;
205
+ private __upsertCustomerUserByExternalId;
187
206
  protected _getAuthorizationHeader(): Promise<string>;
188
207
  }
@@ -42,6 +42,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
43
43
  });
44
44
  };
45
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
45
56
  Object.defineProperty(exports, "__esModule", { value: true });
46
57
  exports.Customers = void 0;
47
58
  const headers_js_1 = require("../../../../core/headers.js");
@@ -760,6 +771,81 @@ class Customers {
760
771
  }
761
772
  });
762
773
  }
774
+ /**
775
+ * Create or update a customer user using customer and user external IDs
776
+ *
777
+ * @param {Paid.UpsertCustomerUserRequest} request
778
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
779
+ *
780
+ * @throws {@link Paid.BadRequestError}
781
+ * @throws {@link Paid.ForbiddenError}
782
+ * @throws {@link Paid.NotFoundError}
783
+ * @throws {@link Paid.InternalServerError}
784
+ *
785
+ * @example
786
+ * await client.customers.upsertCustomerUserByExternalId({
787
+ * customerExternalId: "customerExternalId",
788
+ * userExternalId: "userExternalId"
789
+ * })
790
+ */
791
+ upsertCustomerUserByExternalId(request, requestOptions) {
792
+ return core.HttpResponsePromise.fromPromise(this.__upsertCustomerUserByExternalId(request, requestOptions));
793
+ }
794
+ __upsertCustomerUserByExternalId(request, requestOptions) {
795
+ return __awaiter(this, void 0, void 0, function* () {
796
+ var _a, _b, _c, _d, _e, _f, _g, _h;
797
+ const { customerExternalId, userExternalId } = request, _body = __rest(request, ["customerExternalId", "userExternalId"]);
798
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
799
+ const _response = yield core.fetcher({
800
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(customerExternalId)}/users/${core.url.encodePathParam(userExternalId)}`),
801
+ method: "PUT",
802
+ headers: _headers,
803
+ contentType: "application/json",
804
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
805
+ requestType: "json",
806
+ body: _body,
807
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
808
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
809
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
810
+ });
811
+ if (_response.ok) {
812
+ return { data: _response.body, rawResponse: _response.rawResponse };
813
+ }
814
+ if (_response.error.reason === "status-code") {
815
+ switch (_response.error.statusCode) {
816
+ case 400:
817
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
818
+ case 403:
819
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
820
+ case 404:
821
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
822
+ case 500:
823
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
824
+ default:
825
+ throw new errors.PaidError({
826
+ statusCode: _response.error.statusCode,
827
+ body: _response.error.body,
828
+ rawResponse: _response.rawResponse,
829
+ });
830
+ }
831
+ }
832
+ switch (_response.error.reason) {
833
+ case "non-json":
834
+ throw new errors.PaidError({
835
+ statusCode: _response.error.statusCode,
836
+ body: _response.error.rawBody,
837
+ rawResponse: _response.rawResponse,
838
+ });
839
+ case "timeout":
840
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/{customerExternalId}/users/{userExternalId}.");
841
+ case "unknown":
842
+ throw new errors.PaidError({
843
+ message: _response.error.errorMessage,
844
+ rawResponse: _response.rawResponse,
845
+ });
846
+ }
847
+ });
848
+ }
763
849
  _getAuthorizationHeader() {
764
850
  return __awaiter(this, void 0, void 0, function* () {
765
851
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;
@@ -0,0 +1,16 @@
1
+ import type * as Paid from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * customerExternalId: "customerExternalId",
6
+ * userExternalId: "userExternalId"
7
+ * }
8
+ */
9
+ export interface UpsertCustomerUserRequest {
10
+ customerExternalId: string;
11
+ userExternalId: string;
12
+ name?: string;
13
+ email?: string | null;
14
+ metadata?: Record<string, unknown> | null;
15
+ status?: Paid.CustomerUserStatus;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,3 +8,4 @@ export type { GetCustomerCreditBalancesRequest } from "./GetCustomerCreditBalanc
8
8
  export type { ListCustomersRequest } from "./ListCustomersRequest.js";
9
9
  export type { UpdateCustomerByExternalIdRequest } from "./UpdateCustomerByExternalIdRequest.js";
10
10
  export type { UpdateCustomerByIdRequest } from "./UpdateCustomerByIdRequest.js";
11
+ export type { UpsertCustomerUserRequest } from "./UpsertCustomerUserRequest.js";