@paid-ai/paid-node 1.3.0 → 1.6.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 (254) hide show
  1. package/dist/cjs/Client.d.ts +6 -0
  2. package/dist/cjs/Client.js +30 -20
  3. package/dist/cjs/api/resources/costs/client/Client.d.ts +38 -0
  4. package/dist/cjs/api/resources/costs/client/Client.js +139 -0
  5. package/dist/cjs/api/resources/costs/client/index.d.ts +1 -0
  6. package/dist/cjs/api/resources/costs/client/index.js +17 -0
  7. package/dist/cjs/api/resources/costs/client/requests/CostIngestRequest.d.ts +17 -0
  8. package/dist/cjs/api/resources/costs/client/requests/CostIngestRequest.js +3 -0
  9. package/dist/cjs/api/resources/costs/client/requests/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/costs/client/requests/index.js +2 -0
  11. package/dist/cjs/api/resources/costs/index.d.ts +1 -0
  12. package/dist/cjs/api/resources/costs/index.js +17 -0
  13. package/dist/cjs/api/resources/index.d.ts +5 -0
  14. package/dist/cjs/api/resources/index.js +6 -1
  15. package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +1 -0
  16. package/dist/cjs/api/resources/pricing/client/Client.d.ts +71 -0
  17. package/dist/cjs/api/resources/pricing/client/Client.js +284 -0
  18. package/dist/cjs/api/resources/pricing/client/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/pricing/client/index.js +17 -0
  20. package/dist/cjs/api/resources/pricing/client/requests/GetPricingRequest.d.ts +9 -0
  21. package/dist/cjs/api/resources/pricing/client/requests/GetPricingRequest.js +3 -0
  22. package/dist/cjs/api/resources/pricing/client/requests/ListPricingRequest.d.ts +10 -0
  23. package/dist/cjs/api/resources/pricing/client/requests/ListPricingRequest.js +3 -0
  24. package/dist/cjs/api/resources/pricing/client/requests/UpdatePricingRequest.d.ts +20 -0
  25. package/dist/cjs/api/resources/pricing/client/requests/UpdatePricingRequest.js +3 -0
  26. package/dist/cjs/api/resources/pricing/client/requests/index.d.ts +3 -0
  27. package/dist/cjs/api/resources/pricing/client/requests/index.js +2 -0
  28. package/dist/cjs/api/resources/pricing/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/pricing/index.js +17 -0
  30. package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +85 -0
  31. package/dist/cjs/api/resources/valueReceipts/client/Client.js +362 -1
  32. package/dist/cjs/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.d.ts +9 -0
  33. package/dist/cjs/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.js +3 -0
  34. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +7 -0
  35. package/dist/cjs/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.d.ts +9 -0
  36. package/dist/cjs/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.js +3 -0
  37. package/dist/cjs/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.d.ts +9 -0
  38. package/dist/cjs/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.js +3 -0
  39. package/dist/cjs/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.d.ts +28 -0
  40. package/dist/cjs/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.js +3 -0
  41. package/dist/cjs/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.d.ts +9 -0
  42. package/dist/cjs/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.js +3 -0
  43. package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +5 -0
  44. package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
  45. package/dist/cjs/api/resources/valueReceipts/index.js +1 -0
  46. package/dist/cjs/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.d.ts +5 -0
  47. package/dist/cjs/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.js +8 -0
  48. package/dist/cjs/api/resources/valueReceipts/types/index.d.ts +1 -0
  49. package/dist/cjs/api/resources/valueReceipts/types/index.js +17 -0
  50. package/dist/cjs/api/types/Cost.d.ts +10 -0
  51. package/dist/cjs/api/types/Cost.js +3 -0
  52. package/dist/cjs/api/types/CostIngestResponse.d.ts +6 -0
  53. package/dist/cjs/api/types/CostIngestResponse.js +3 -0
  54. package/dist/cjs/api/types/CostOverride.d.ts +8 -0
  55. package/dist/cjs/api/types/CostOverride.js +3 -0
  56. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +1 -0
  57. package/dist/cjs/api/types/CreditBalance.d.ts +6 -0
  58. package/dist/cjs/api/types/CreditBenefitInput.d.ts +30 -0
  59. package/dist/cjs/api/types/CreditBenefitInput.js +20 -0
  60. package/dist/cjs/api/types/CreditBenefitOutput.d.ts +13 -0
  61. package/dist/cjs/api/types/CreditBenefitOutput.js +3 -0
  62. package/dist/cjs/api/types/CreditGrant.d.ts +11 -0
  63. package/dist/cjs/api/types/CreditGrant.js +3 -0
  64. package/dist/cjs/api/types/OneTimePerUnitInput.d.ts +21 -0
  65. package/dist/cjs/api/types/OneTimePerUnitInput.js +18 -0
  66. package/dist/cjs/api/types/Order.d.ts +2 -0
  67. package/dist/cjs/api/types/OrderBillingFrequencyOverride.d.ts +14 -0
  68. package/dist/cjs/api/types/OrderBillingFrequencyOverride.js +14 -0
  69. package/dist/cjs/api/types/PrecomputedCost.d.ts +17 -0
  70. package/dist/cjs/api/types/PrecomputedCost.js +3 -0
  71. package/dist/cjs/api/types/PricingInput.d.ts +46 -0
  72. package/dist/cjs/api/types/PricingInput.js +3 -0
  73. package/dist/cjs/api/types/PricingListResponse.d.ts +4 -0
  74. package/dist/cjs/api/types/PricingListResponse.js +3 -0
  75. package/dist/cjs/api/types/PricingOutput.d.ts +36 -0
  76. package/dist/cjs/api/types/PricingOutput.js +23 -0
  77. package/dist/cjs/api/types/PricingPricePointOutput.d.ts +29 -0
  78. package/dist/cjs/api/types/PricingPricePointOutput.js +17 -0
  79. package/dist/cjs/api/types/PricingResponse.d.ts +7 -0
  80. package/dist/cjs/api/types/PricingResponse.js +3 -0
  81. package/dist/cjs/api/types/ProductAttribution.d.ts +2 -0
  82. package/dist/cjs/api/types/ProductAttribution.js +3 -0
  83. package/dist/cjs/api/types/RecurringGraduatedInput.d.ts +22 -0
  84. package/dist/cjs/api/types/RecurringGraduatedInput.js +18 -0
  85. package/dist/cjs/api/types/RecurringPerUnitInput.d.ts +22 -0
  86. package/dist/cjs/api/types/RecurringPerUnitInput.js +18 -0
  87. package/dist/cjs/api/types/RecurringPercentOfTotalInput.d.ts +23 -0
  88. package/dist/cjs/api/types/RecurringPercentOfTotalInput.js +18 -0
  89. package/dist/cjs/api/types/RecurringVolumeInput.d.ts +22 -0
  90. package/dist/cjs/api/types/RecurringVolumeInput.js +18 -0
  91. package/dist/cjs/api/types/SeatBasedGraduatedInput.d.ts +22 -0
  92. package/dist/cjs/api/types/SeatBasedGraduatedInput.js +18 -0
  93. package/dist/cjs/api/types/SeatBasedPerUnitInput.d.ts +22 -0
  94. package/dist/cjs/api/types/SeatBasedPerUnitInput.js +18 -0
  95. package/dist/cjs/api/types/SeatBasedPrepaidCreditsInput.d.ts +25 -0
  96. package/dist/cjs/api/types/SeatBasedPrepaidCreditsInput.js +18 -0
  97. package/dist/cjs/api/types/SeatBasedVolumeInput.d.ts +22 -0
  98. package/dist/cjs/api/types/SeatBasedVolumeInput.js +18 -0
  99. package/dist/cjs/api/types/SimplePricePoint.d.ts +29 -0
  100. package/dist/cjs/api/types/SimplePricePoint.js +17 -0
  101. package/dist/cjs/api/types/SuccessResponse.d.ts +3 -0
  102. package/dist/cjs/api/types/SuccessResponse.js +3 -0
  103. package/dist/cjs/api/types/TieredPricePoint.d.ts +29 -0
  104. package/dist/cjs/api/types/TieredPricePoint.js +17 -0
  105. package/dist/cjs/api/types/TokenUsage.d.ts +12 -0
  106. package/dist/cjs/api/types/TokenUsage.js +3 -0
  107. package/dist/cjs/api/types/UsageCost.d.ts +15 -0
  108. package/dist/cjs/api/types/UsageCost.js +3 -0
  109. package/dist/cjs/api/types/UsageCostPlusInput.d.ts +23 -0
  110. package/dist/cjs/api/types/UsageCostPlusInput.js +18 -0
  111. package/dist/cjs/api/types/UsageGraduatedInput.d.ts +23 -0
  112. package/dist/cjs/api/types/UsageGraduatedInput.js +18 -0
  113. package/dist/cjs/api/types/UsagePerUnitInput.d.ts +23 -0
  114. package/dist/cjs/api/types/UsagePerUnitInput.js +18 -0
  115. package/dist/cjs/api/types/UsagePrepaidCreditsInput.d.ts +26 -0
  116. package/dist/cjs/api/types/UsagePrepaidCreditsInput.js +18 -0
  117. package/dist/cjs/api/types/UsageVolumeInput.d.ts +23 -0
  118. package/dist/cjs/api/types/UsageVolumeInput.js +18 -0
  119. package/dist/cjs/api/types/ValueReceiptDetail.d.ts +2 -0
  120. package/dist/cjs/api/types/ValueReceiptSummary.d.ts +2 -0
  121. package/dist/cjs/api/types/ValueReceiptSyncResponse.d.ts +6 -0
  122. package/dist/cjs/api/types/ValueReceiptSyncResponse.js +3 -0
  123. package/dist/cjs/api/types/index.d.ts +34 -0
  124. package/dist/cjs/api/types/index.js +34 -0
  125. package/dist/cjs/version.d.ts +1 -1
  126. package/dist/cjs/version.js +1 -1
  127. package/dist/esm/Client.d.mts +6 -0
  128. package/dist/esm/Client.mjs +12 -2
  129. package/dist/esm/api/resources/costs/client/Client.d.mts +38 -0
  130. package/dist/esm/api/resources/costs/client/Client.mjs +102 -0
  131. package/dist/esm/api/resources/costs/client/index.d.mts +1 -0
  132. package/dist/esm/api/resources/costs/client/index.mjs +1 -0
  133. package/dist/esm/api/resources/costs/client/requests/CostIngestRequest.d.mts +17 -0
  134. package/dist/esm/api/resources/costs/client/requests/CostIngestRequest.mjs +2 -0
  135. package/dist/esm/api/resources/costs/client/requests/index.d.mts +1 -0
  136. package/dist/esm/api/resources/costs/client/requests/index.mjs +1 -0
  137. package/dist/esm/api/resources/costs/index.d.mts +1 -0
  138. package/dist/esm/api/resources/costs/index.mjs +1 -0
  139. package/dist/esm/api/resources/index.d.mts +5 -0
  140. package/dist/esm/api/resources/index.mjs +5 -0
  141. package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +1 -0
  142. package/dist/esm/api/resources/pricing/client/Client.d.mts +71 -0
  143. package/dist/esm/api/resources/pricing/client/Client.mjs +247 -0
  144. package/dist/esm/api/resources/pricing/client/index.d.mts +1 -0
  145. package/dist/esm/api/resources/pricing/client/index.mjs +1 -0
  146. package/dist/esm/api/resources/pricing/client/requests/GetPricingRequest.d.mts +9 -0
  147. package/dist/esm/api/resources/pricing/client/requests/GetPricingRequest.mjs +2 -0
  148. package/dist/esm/api/resources/pricing/client/requests/ListPricingRequest.d.mts +10 -0
  149. package/dist/esm/api/resources/pricing/client/requests/ListPricingRequest.mjs +2 -0
  150. package/dist/esm/api/resources/pricing/client/requests/UpdatePricingRequest.d.mts +20 -0
  151. package/dist/esm/api/resources/pricing/client/requests/UpdatePricingRequest.mjs +2 -0
  152. package/dist/esm/api/resources/pricing/client/requests/index.d.mts +3 -0
  153. package/dist/esm/api/resources/pricing/client/requests/index.mjs +1 -0
  154. package/dist/esm/api/resources/pricing/index.d.mts +1 -0
  155. package/dist/esm/api/resources/pricing/index.mjs +1 -0
  156. package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +85 -0
  157. package/dist/esm/api/resources/valueReceipts/client/Client.mjs +362 -1
  158. package/dist/esm/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.d.mts +9 -0
  159. package/dist/esm/api/resources/valueReceipts/client/requests/ArchiveValueReceiptRequest.mjs +2 -0
  160. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +7 -0
  161. package/dist/esm/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.d.mts +9 -0
  162. package/dist/esm/api/resources/valueReceipts/client/requests/RefreshValueReceiptRequest.mjs +2 -0
  163. package/dist/esm/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.d.mts +9 -0
  164. package/dist/esm/api/resources/valueReceipts/client/requests/SealValueReceiptRequest.mjs +2 -0
  165. package/dist/esm/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.d.mts +28 -0
  166. package/dist/esm/api/resources/valueReceipts/client/requests/SyncValueReceiptRequest.mjs +2 -0
  167. package/dist/esm/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.d.mts +9 -0
  168. package/dist/esm/api/resources/valueReceipts/client/requests/UnarchiveValueReceiptRequest.mjs +2 -0
  169. package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +5 -0
  170. package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
  171. package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
  172. package/dist/esm/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.d.mts +5 -0
  173. package/dist/esm/api/resources/valueReceipts/types/ListValueReceiptsRequestArchived.mjs +5 -0
  174. package/dist/esm/api/resources/valueReceipts/types/index.d.mts +1 -0
  175. package/dist/esm/api/resources/valueReceipts/types/index.mjs +1 -0
  176. package/dist/esm/api/types/Cost.d.mts +10 -0
  177. package/dist/esm/api/types/Cost.mjs +2 -0
  178. package/dist/esm/api/types/CostIngestResponse.d.mts +6 -0
  179. package/dist/esm/api/types/CostIngestResponse.mjs +2 -0
  180. package/dist/esm/api/types/CostOverride.d.mts +8 -0
  181. package/dist/esm/api/types/CostOverride.mjs +2 -0
  182. package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +1 -0
  183. package/dist/esm/api/types/CreditBalance.d.mts +6 -0
  184. package/dist/esm/api/types/CreditBenefitInput.d.mts +30 -0
  185. package/dist/esm/api/types/CreditBenefitInput.mjs +17 -0
  186. package/dist/esm/api/types/CreditBenefitOutput.d.mts +13 -0
  187. package/dist/esm/api/types/CreditBenefitOutput.mjs +2 -0
  188. package/dist/esm/api/types/CreditGrant.d.mts +11 -0
  189. package/dist/esm/api/types/CreditGrant.mjs +2 -0
  190. package/dist/esm/api/types/OneTimePerUnitInput.d.mts +21 -0
  191. package/dist/esm/api/types/OneTimePerUnitInput.mjs +15 -0
  192. package/dist/esm/api/types/Order.d.mts +2 -0
  193. package/dist/esm/api/types/OrderBillingFrequencyOverride.d.mts +14 -0
  194. package/dist/esm/api/types/OrderBillingFrequencyOverride.mjs +11 -0
  195. package/dist/esm/api/types/PrecomputedCost.d.mts +17 -0
  196. package/dist/esm/api/types/PrecomputedCost.mjs +2 -0
  197. package/dist/esm/api/types/PricingInput.d.mts +46 -0
  198. package/dist/esm/api/types/PricingInput.mjs +2 -0
  199. package/dist/esm/api/types/PricingListResponse.d.mts +4 -0
  200. package/dist/esm/api/types/PricingListResponse.mjs +2 -0
  201. package/dist/esm/api/types/PricingOutput.d.mts +36 -0
  202. package/dist/esm/api/types/PricingOutput.mjs +20 -0
  203. package/dist/esm/api/types/PricingPricePointOutput.d.mts +29 -0
  204. package/dist/esm/api/types/PricingPricePointOutput.mjs +14 -0
  205. package/dist/esm/api/types/PricingResponse.d.mts +7 -0
  206. package/dist/esm/api/types/PricingResponse.mjs +2 -0
  207. package/dist/esm/api/types/ProductAttribution.d.mts +2 -0
  208. package/dist/esm/api/types/ProductAttribution.mjs +2 -0
  209. package/dist/esm/api/types/RecurringGraduatedInput.d.mts +22 -0
  210. package/dist/esm/api/types/RecurringGraduatedInput.mjs +15 -0
  211. package/dist/esm/api/types/RecurringPerUnitInput.d.mts +22 -0
  212. package/dist/esm/api/types/RecurringPerUnitInput.mjs +15 -0
  213. package/dist/esm/api/types/RecurringPercentOfTotalInput.d.mts +23 -0
  214. package/dist/esm/api/types/RecurringPercentOfTotalInput.mjs +15 -0
  215. package/dist/esm/api/types/RecurringVolumeInput.d.mts +22 -0
  216. package/dist/esm/api/types/RecurringVolumeInput.mjs +15 -0
  217. package/dist/esm/api/types/SeatBasedGraduatedInput.d.mts +22 -0
  218. package/dist/esm/api/types/SeatBasedGraduatedInput.mjs +15 -0
  219. package/dist/esm/api/types/SeatBasedPerUnitInput.d.mts +22 -0
  220. package/dist/esm/api/types/SeatBasedPerUnitInput.mjs +15 -0
  221. package/dist/esm/api/types/SeatBasedPrepaidCreditsInput.d.mts +25 -0
  222. package/dist/esm/api/types/SeatBasedPrepaidCreditsInput.mjs +15 -0
  223. package/dist/esm/api/types/SeatBasedVolumeInput.d.mts +22 -0
  224. package/dist/esm/api/types/SeatBasedVolumeInput.mjs +15 -0
  225. package/dist/esm/api/types/SimplePricePoint.d.mts +29 -0
  226. package/dist/esm/api/types/SimplePricePoint.mjs +14 -0
  227. package/dist/esm/api/types/SuccessResponse.d.mts +3 -0
  228. package/dist/esm/api/types/SuccessResponse.mjs +2 -0
  229. package/dist/esm/api/types/TieredPricePoint.d.mts +29 -0
  230. package/dist/esm/api/types/TieredPricePoint.mjs +14 -0
  231. package/dist/esm/api/types/TokenUsage.d.mts +12 -0
  232. package/dist/esm/api/types/TokenUsage.mjs +2 -0
  233. package/dist/esm/api/types/UsageCost.d.mts +15 -0
  234. package/dist/esm/api/types/UsageCost.mjs +2 -0
  235. package/dist/esm/api/types/UsageCostPlusInput.d.mts +23 -0
  236. package/dist/esm/api/types/UsageCostPlusInput.mjs +15 -0
  237. package/dist/esm/api/types/UsageGraduatedInput.d.mts +23 -0
  238. package/dist/esm/api/types/UsageGraduatedInput.mjs +15 -0
  239. package/dist/esm/api/types/UsagePerUnitInput.d.mts +23 -0
  240. package/dist/esm/api/types/UsagePerUnitInput.mjs +15 -0
  241. package/dist/esm/api/types/UsagePrepaidCreditsInput.d.mts +26 -0
  242. package/dist/esm/api/types/UsagePrepaidCreditsInput.mjs +15 -0
  243. package/dist/esm/api/types/UsageVolumeInput.d.mts +23 -0
  244. package/dist/esm/api/types/UsageVolumeInput.mjs +15 -0
  245. package/dist/esm/api/types/ValueReceiptDetail.d.mts +2 -0
  246. package/dist/esm/api/types/ValueReceiptSummary.d.mts +2 -0
  247. package/dist/esm/api/types/ValueReceiptSyncResponse.d.mts +6 -0
  248. package/dist/esm/api/types/ValueReceiptSyncResponse.mjs +2 -0
  249. package/dist/esm/api/types/index.d.mts +34 -0
  250. package/dist/esm/api/types/index.mjs +34 -0
  251. package/dist/esm/version.d.mts +1 -1
  252. package/dist/esm/version.mjs +1 -1
  253. package/package.json +1 -1
  254. package/reference.md +610 -7
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.3.0";
4
+ exports.SDK_VERSION = "1.6.0";
@@ -1,10 +1,12 @@
1
1
  import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
2
2
  import { Contacts } from "./api/resources/contacts/client/Client.mjs";
3
+ import { Costs } from "./api/resources/costs/client/Client.mjs";
3
4
  import { Credits } from "./api/resources/credits/client/Client.mjs";
4
5
  import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
5
6
  import { Customers } from "./api/resources/customers/client/Client.mjs";
6
7
  import { Invoices } from "./api/resources/invoices/client/Client.mjs";
7
8
  import { Orders } from "./api/resources/orders/client/Client.mjs";
9
+ import { Pricing } from "./api/resources/pricing/client/Client.mjs";
8
10
  import { Products } from "./api/resources/products/client/Client.mjs";
9
11
  import { Signals } from "./api/resources/signals/client/Client.mjs";
10
12
  import { ValueReceipts } from "./api/resources/valueReceipts/client/Client.mjs";
@@ -29,6 +31,8 @@ export declare class PaidClient {
29
31
  protected _customerPortals: CustomerPortals | undefined;
30
32
  protected _valueReceipts: ValueReceipts | undefined;
31
33
  protected _webhooks: Webhooks | undefined;
34
+ protected _pricing: Pricing | undefined;
35
+ protected _costs: Costs | undefined;
32
36
  constructor(_options: PaidClient.Options);
33
37
  get products(): Products;
34
38
  get customers(): Customers;
@@ -41,4 +45,6 @@ export declare class PaidClient {
41
45
  get customerPortals(): CustomerPortals;
42
46
  get valueReceipts(): ValueReceipts;
43
47
  get webhooks(): Webhooks;
48
+ get pricing(): Pricing;
49
+ get costs(): Costs;
44
50
  }
@@ -1,11 +1,13 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
3
3
  import { Contacts } from "./api/resources/contacts/client/Client.mjs";
4
+ import { Costs } from "./api/resources/costs/client/Client.mjs";
4
5
  import { Credits } from "./api/resources/credits/client/Client.mjs";
5
6
  import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
6
7
  import { Customers } from "./api/resources/customers/client/Client.mjs";
7
8
  import { Invoices } from "./api/resources/invoices/client/Client.mjs";
8
9
  import { Orders } from "./api/resources/orders/client/Client.mjs";
10
+ import { Pricing } from "./api/resources/pricing/client/Client.mjs";
9
11
  import { Products } from "./api/resources/products/client/Client.mjs";
10
12
  import { Signals } from "./api/resources/signals/client/Client.mjs";
11
13
  import { ValueReceipts } from "./api/resources/valueReceipts/client/Client.mjs";
@@ -17,8 +19,8 @@ export class PaidClient {
17
19
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
18
20
  "X-Fern-Language": "JavaScript",
19
21
  "X-Fern-SDK-Name": "@paid-ai/paid-node",
20
- "X-Fern-SDK-Version": "1.3.0",
21
- "User-Agent": "@paid-ai/paid-node/1.3.0",
22
+ "X-Fern-SDK-Version": "1.6.0",
23
+ "User-Agent": "@paid-ai/paid-node/1.6.0",
22
24
  "X-Fern-Runtime": core.RUNTIME.type,
23
25
  "X-Fern-Runtime-Version": core.RUNTIME.version,
24
26
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -67,4 +69,12 @@ export class PaidClient {
67
69
  var _a;
68
70
  return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Webhooks(this._options)));
69
71
  }
72
+ get pricing() {
73
+ var _a;
74
+ return ((_a = this._pricing) !== null && _a !== void 0 ? _a : (this._pricing = new Pricing(this._options)));
75
+ }
76
+ get costs() {
77
+ var _a;
78
+ return ((_a = this._costs) !== null && _a !== void 0 ? _a : (this._costs = new Costs(this._options)));
79
+ }
70
80
  }
@@ -0,0 +1,38 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import * as Paid from "../../../index.mjs";
4
+ export declare namespace Costs {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Costs {
11
+ protected readonly _options: Costs.Options;
12
+ constructor(_options: Costs.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.
15
+ *
16
+ * @param {Paid.CostIngestRequest} request
17
+ * @param {Costs.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.costs.createCosts({
25
+ * costs: [{
26
+ * type: "cost",
27
+ * customer: {
28
+ * customerId: "customerId"
29
+ * },
30
+ * amount: 1.1,
31
+ * currency: "currency"
32
+ * }]
33
+ * })
34
+ */
35
+ createCosts(request: Paid.CostIngestRequest, requestOptions?: Costs.RequestOptions): core.HttpResponsePromise<Paid.CostIngestResponse>;
36
+ private __createCosts;
37
+ protected _getAuthorizationHeader(): Promise<string>;
38
+ }
@@ -0,0 +1,102 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
+ import * as core from "../../../../core/index.mjs";
13
+ import * as environments from "../../../../environments.mjs";
14
+ import * as errors from "../../../../errors/index.mjs";
15
+ import * as Paid from "../../../index.mjs";
16
+ export class Costs {
17
+ constructor(_options) {
18
+ this._options = _options;
19
+ }
20
+ /**
21
+ * 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.
22
+ *
23
+ * @param {Paid.CostIngestRequest} request
24
+ * @param {Costs.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Paid.BadRequestError}
27
+ * @throws {@link Paid.ForbiddenError}
28
+ * @throws {@link Paid.InternalServerError}
29
+ *
30
+ * @example
31
+ * await client.costs.createCosts({
32
+ * costs: [{
33
+ * type: "cost",
34
+ * customer: {
35
+ * customerId: "customerId"
36
+ * },
37
+ * amount: 1.1,
38
+ * currency: "currency"
39
+ * }]
40
+ * })
41
+ */
42
+ createCosts(request, requestOptions) {
43
+ return core.HttpResponsePromise.fromPromise(this.__createCosts(request, requestOptions));
44
+ }
45
+ __createCosts(request, requestOptions) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ var _a, _b, _c, _d, _e, _f, _g, _h;
48
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
49
+ const _response = yield core.fetcher({
50
+ 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/bulk"),
51
+ method: "POST",
52
+ headers: _headers,
53
+ contentType: "application/json",
54
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
55
+ requestType: "json",
56
+ body: request,
57
+ 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,
58
+ 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,
59
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
60
+ });
61
+ if (_response.ok) {
62
+ return { data: _response.body, rawResponse: _response.rawResponse };
63
+ }
64
+ if (_response.error.reason === "status-code") {
65
+ switch (_response.error.statusCode) {
66
+ case 400:
67
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
68
+ case 403:
69
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
70
+ case 500:
71
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
72
+ default:
73
+ throw new errors.PaidError({
74
+ statusCode: _response.error.statusCode,
75
+ body: _response.error.body,
76
+ rawResponse: _response.rawResponse,
77
+ });
78
+ }
79
+ }
80
+ switch (_response.error.reason) {
81
+ case "non-json":
82
+ throw new errors.PaidError({
83
+ statusCode: _response.error.statusCode,
84
+ body: _response.error.rawBody,
85
+ rawResponse: _response.rawResponse,
86
+ });
87
+ case "timeout":
88
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /cost/bulk.");
89
+ case "unknown":
90
+ throw new errors.PaidError({
91
+ message: _response.error.errorMessage,
92
+ rawResponse: _response.rawResponse,
93
+ });
94
+ }
95
+ });
96
+ }
97
+ _getAuthorizationHeader() {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
100
+ });
101
+ }
102
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,17 @@
1
+ import type * as Paid from "../../../../index.mjs";
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,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { CostIngestRequest } from "./CostIngestRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -3,6 +3,8 @@ export * as checkouts from "./checkouts/index.mjs";
3
3
  export * from "./checkouts/types/index.mjs";
4
4
  export * from "./contacts/client/requests/index.mjs";
5
5
  export * as contacts from "./contacts/index.mjs";
6
+ export * from "./costs/client/requests/index.mjs";
7
+ export * as costs from "./costs/index.mjs";
6
8
  export * as credits from "./credits/index.mjs";
7
9
  export * from "./customerPortals/client/requests/index.mjs";
8
10
  export * as customerPortals from "./customerPortals/index.mjs";
@@ -13,12 +15,15 @@ export * as invoices from "./invoices/index.mjs";
13
15
  export * from "./orders/client/requests/index.mjs";
14
16
  export * as orders from "./orders/index.mjs";
15
17
  export * from "./orders/types/index.mjs";
18
+ export * from "./pricing/client/requests/index.mjs";
19
+ export * as pricing from "./pricing/index.mjs";
16
20
  export * from "./products/client/requests/index.mjs";
17
21
  export * as products from "./products/index.mjs";
18
22
  export * from "./signals/client/requests/index.mjs";
19
23
  export * as signals from "./signals/index.mjs";
20
24
  export * from "./valueReceipts/client/requests/index.mjs";
21
25
  export * as valueReceipts from "./valueReceipts/index.mjs";
26
+ export * from "./valueReceipts/types/index.mjs";
22
27
  export * from "./webhooks/client/requests/index.mjs";
23
28
  export * as webhooks from "./webhooks/index.mjs";
24
29
  export * from "./webhooks/types/index.mjs";
@@ -3,6 +3,8 @@ export * as checkouts from "./checkouts/index.mjs";
3
3
  export * from "./checkouts/types/index.mjs";
4
4
  export * from "./contacts/client/requests/index.mjs";
5
5
  export * as contacts from "./contacts/index.mjs";
6
+ export * from "./costs/client/requests/index.mjs";
7
+ export * as costs from "./costs/index.mjs";
6
8
  export * as credits from "./credits/index.mjs";
7
9
  export * from "./customerPortals/client/requests/index.mjs";
8
10
  export * as customerPortals from "./customerPortals/index.mjs";
@@ -13,12 +15,15 @@ export * as invoices from "./invoices/index.mjs";
13
15
  export * from "./orders/client/requests/index.mjs";
14
16
  export * as orders from "./orders/index.mjs";
15
17
  export * from "./orders/types/index.mjs";
18
+ export * from "./pricing/client/requests/index.mjs";
19
+ export * as pricing from "./pricing/index.mjs";
16
20
  export * from "./products/client/requests/index.mjs";
17
21
  export * as products from "./products/index.mjs";
18
22
  export * from "./signals/client/requests/index.mjs";
19
23
  export * as signals from "./signals/index.mjs";
20
24
  export * from "./valueReceipts/client/requests/index.mjs";
21
25
  export * as valueReceipts from "./valueReceipts/index.mjs";
26
+ export * from "./valueReceipts/types/index.mjs";
22
27
  export * from "./webhooks/client/requests/index.mjs";
23
28
  export * as webhooks from "./webhooks/index.mjs";
24
29
  export * from "./webhooks/types/index.mjs";
@@ -24,4 +24,5 @@ export interface CreateOrderRequest {
24
24
  autoSendBillingEmails?: boolean;
25
25
  autoSendPaymentEmails?: boolean;
26
26
  lines?: Paid.CreateOrderLineRequest[];
27
+ billingFrequencyOverride?: Paid.OrderBillingFrequencyOverride;
27
28
  }
@@ -0,0 +1,71 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import * as Paid from "../../../index.mjs";
4
+ export declare namespace Pricing {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Pricing {
11
+ protected readonly _options: Pricing.Options;
12
+ constructor(_options: Pricing.Options);
13
+ /**
14
+ * Returns pricing for all product attributes of a product. Each entry includes the attribute's pricing configuration and credit benefits.
15
+ *
16
+ * @param {Paid.ListPricingRequest} request
17
+ * @param {Pricing.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Paid.NotFoundError}
20
+ * @throws {@link Paid.InternalServerError}
21
+ *
22
+ * @example
23
+ * await client.pricing.listPricing({
24
+ * productId: "productId"
25
+ * })
26
+ */
27
+ listPricing(request: Paid.ListPricingRequest, requestOptions?: Pricing.RequestOptions): core.HttpResponsePromise<Paid.PricingListResponse>;
28
+ private __listPricing;
29
+ /**
30
+ * Returns pricing and credit benefits for a single product attribute.
31
+ *
32
+ * @param {Paid.GetPricingRequest} request
33
+ * @param {Pricing.RequestOptions} requestOptions - Request-specific configuration.
34
+ *
35
+ * @throws {@link Paid.NotFoundError}
36
+ * @throws {@link Paid.InternalServerError}
37
+ *
38
+ * @example
39
+ * await client.pricing.getPricing({
40
+ * productAttributeId: "productAttributeId"
41
+ * })
42
+ */
43
+ getPricing(request: Paid.GetPricingRequest, requestOptions?: Pricing.RequestOptions): core.HttpResponsePromise<Paid.PricingResponse>;
44
+ private __getPricing;
45
+ /**
46
+ * Updates pricing on an existing product attribute. If creditBenefits is provided, it fully replaces existing benefits. If omitted, existing benefits are preserved.
47
+ *
48
+ * @param {Paid.UpdatePricingRequest} request
49
+ * @param {Pricing.RequestOptions} requestOptions - Request-specific configuration.
50
+ *
51
+ * @throws {@link Paid.BadRequestError}
52
+ * @throws {@link Paid.NotFoundError}
53
+ * @throws {@link Paid.InternalServerError}
54
+ *
55
+ * @example
56
+ * await client.pricing.updatePricing({
57
+ * productAttributeId: "productAttributeId",
58
+ * pricing: {
59
+ * pricingType: "RecurringPerUnit",
60
+ * billingFrequency: "Monthly",
61
+ * pricePoints: [{
62
+ * currency: "currency",
63
+ * unitPrice: 1.1
64
+ * }]
65
+ * }
66
+ * })
67
+ */
68
+ updatePricing(request: Paid.UpdatePricingRequest, requestOptions?: Pricing.RequestOptions): core.HttpResponsePromise<Paid.PricingResponse>;
69
+ private __updatePricing;
70
+ protected _getAuthorizationHeader(): Promise<string>;
71
+ }
@@ -0,0 +1,247 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
23
+ import * as core from "../../../../core/index.mjs";
24
+ import * as environments from "../../../../environments.mjs";
25
+ import * as errors from "../../../../errors/index.mjs";
26
+ import * as Paid from "../../../index.mjs";
27
+ export class Pricing {
28
+ constructor(_options) {
29
+ this._options = _options;
30
+ }
31
+ /**
32
+ * Returns pricing for all product attributes of a product. Each entry includes the attribute's pricing configuration and credit benefits.
33
+ *
34
+ * @param {Paid.ListPricingRequest} request
35
+ * @param {Pricing.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Paid.NotFoundError}
38
+ * @throws {@link Paid.InternalServerError}
39
+ *
40
+ * @example
41
+ * await client.pricing.listPricing({
42
+ * productId: "productId"
43
+ * })
44
+ */
45
+ listPricing(request, requestOptions) {
46
+ return core.HttpResponsePromise.fromPromise(this.__listPricing(request, requestOptions));
47
+ }
48
+ __listPricing(request, requestOptions) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ var _a, _b, _c, _d, _e, _f, _g, _h;
51
+ const { productId } = request;
52
+ const _queryParams = {};
53
+ _queryParams.productId = productId;
54
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
55
+ const _response = yield core.fetcher({
56
+ 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, "pricing/"),
57
+ method: "GET",
58
+ headers: _headers,
59
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
60
+ 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,
61
+ 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,
62
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
63
+ });
64
+ if (_response.ok) {
65
+ return { data: _response.body, rawResponse: _response.rawResponse };
66
+ }
67
+ if (_response.error.reason === "status-code") {
68
+ switch (_response.error.statusCode) {
69
+ case 404:
70
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
71
+ case 500:
72
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
73
+ default:
74
+ throw new errors.PaidError({
75
+ statusCode: _response.error.statusCode,
76
+ body: _response.error.body,
77
+ rawResponse: _response.rawResponse,
78
+ });
79
+ }
80
+ }
81
+ switch (_response.error.reason) {
82
+ case "non-json":
83
+ throw new errors.PaidError({
84
+ statusCode: _response.error.statusCode,
85
+ body: _response.error.rawBody,
86
+ rawResponse: _response.rawResponse,
87
+ });
88
+ case "timeout":
89
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /pricing/.");
90
+ case "unknown":
91
+ throw new errors.PaidError({
92
+ message: _response.error.errorMessage,
93
+ rawResponse: _response.rawResponse,
94
+ });
95
+ }
96
+ });
97
+ }
98
+ /**
99
+ * Returns pricing and credit benefits for a single product attribute.
100
+ *
101
+ * @param {Paid.GetPricingRequest} request
102
+ * @param {Pricing.RequestOptions} requestOptions - Request-specific configuration.
103
+ *
104
+ * @throws {@link Paid.NotFoundError}
105
+ * @throws {@link Paid.InternalServerError}
106
+ *
107
+ * @example
108
+ * await client.pricing.getPricing({
109
+ * productAttributeId: "productAttributeId"
110
+ * })
111
+ */
112
+ getPricing(request, requestOptions) {
113
+ return core.HttpResponsePromise.fromPromise(this.__getPricing(request, requestOptions));
114
+ }
115
+ __getPricing(request, requestOptions) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ var _a, _b, _c, _d, _e, _f, _g, _h;
118
+ const { productAttributeId } = request;
119
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
120
+ const _response = yield core.fetcher({
121
+ 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, `pricing/${core.url.encodePathParam(productAttributeId)}`),
122
+ method: "GET",
123
+ headers: _headers,
124
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
125
+ 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,
126
+ 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,
127
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
128
+ });
129
+ if (_response.ok) {
130
+ return { data: _response.body, rawResponse: _response.rawResponse };
131
+ }
132
+ if (_response.error.reason === "status-code") {
133
+ switch (_response.error.statusCode) {
134
+ case 404:
135
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
136
+ case 500:
137
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
138
+ default:
139
+ throw new errors.PaidError({
140
+ statusCode: _response.error.statusCode,
141
+ body: _response.error.body,
142
+ rawResponse: _response.rawResponse,
143
+ });
144
+ }
145
+ }
146
+ switch (_response.error.reason) {
147
+ case "non-json":
148
+ throw new errors.PaidError({
149
+ statusCode: _response.error.statusCode,
150
+ body: _response.error.rawBody,
151
+ rawResponse: _response.rawResponse,
152
+ });
153
+ case "timeout":
154
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /pricing/{productAttributeId}.");
155
+ case "unknown":
156
+ throw new errors.PaidError({
157
+ message: _response.error.errorMessage,
158
+ rawResponse: _response.rawResponse,
159
+ });
160
+ }
161
+ });
162
+ }
163
+ /**
164
+ * Updates pricing on an existing product attribute. If creditBenefits is provided, it fully replaces existing benefits. If omitted, existing benefits are preserved.
165
+ *
166
+ * @param {Paid.UpdatePricingRequest} request
167
+ * @param {Pricing.RequestOptions} requestOptions - Request-specific configuration.
168
+ *
169
+ * @throws {@link Paid.BadRequestError}
170
+ * @throws {@link Paid.NotFoundError}
171
+ * @throws {@link Paid.InternalServerError}
172
+ *
173
+ * @example
174
+ * await client.pricing.updatePricing({
175
+ * productAttributeId: "productAttributeId",
176
+ * pricing: {
177
+ * pricingType: "RecurringPerUnit",
178
+ * billingFrequency: "Monthly",
179
+ * pricePoints: [{
180
+ * currency: "currency",
181
+ * unitPrice: 1.1
182
+ * }]
183
+ * }
184
+ * })
185
+ */
186
+ updatePricing(request, requestOptions) {
187
+ return core.HttpResponsePromise.fromPromise(this.__updatePricing(request, requestOptions));
188
+ }
189
+ __updatePricing(request, requestOptions) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ var _a, _b, _c, _d, _e, _f, _g, _h;
192
+ const { productAttributeId } = request, _body = __rest(request, ["productAttributeId"]);
193
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
194
+ const _response = yield core.fetcher({
195
+ 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, `pricing/${core.url.encodePathParam(productAttributeId)}`),
196
+ method: "PUT",
197
+ headers: _headers,
198
+ contentType: "application/json",
199
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
200
+ requestType: "json",
201
+ body: _body,
202
+ 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,
203
+ 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,
204
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
205
+ });
206
+ if (_response.ok) {
207
+ return { data: _response.body, rawResponse: _response.rawResponse };
208
+ }
209
+ if (_response.error.reason === "status-code") {
210
+ switch (_response.error.statusCode) {
211
+ case 400:
212
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
213
+ case 404:
214
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
215
+ case 500:
216
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
217
+ default:
218
+ throw new errors.PaidError({
219
+ statusCode: _response.error.statusCode,
220
+ body: _response.error.body,
221
+ rawResponse: _response.rawResponse,
222
+ });
223
+ }
224
+ }
225
+ switch (_response.error.reason) {
226
+ case "non-json":
227
+ throw new errors.PaidError({
228
+ statusCode: _response.error.statusCode,
229
+ body: _response.error.rawBody,
230
+ rawResponse: _response.rawResponse,
231
+ });
232
+ case "timeout":
233
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /pricing/{productAttributeId}.");
234
+ case "unknown":
235
+ throw new errors.PaidError({
236
+ message: _response.error.errorMessage,
237
+ rawResponse: _response.rawResponse,
238
+ });
239
+ }
240
+ });
241
+ }
242
+ _getAuthorizationHeader() {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
245
+ });
246
+ }
247
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * productAttributeId: "productAttributeId"
5
+ * }
6
+ */
7
+ export interface GetPricingRequest {
8
+ productAttributeId: string;
9
+ }