@tolt/api 0.7.0 → 1.1.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 (303) hide show
  1. package/dist/BaseClient.js +1 -0
  2. package/dist/Client.d.ts +3 -3
  3. package/dist/Client.js +3 -3
  4. package/dist/api/errors/BadRequestError.d.ts +2 -2
  5. package/dist/api/errors/ConflictError.d.ts +2 -2
  6. package/dist/api/errors/ContentTooLargeError.d.ts +2 -2
  7. package/dist/api/errors/NotFoundError.d.ts +2 -2
  8. package/dist/api/errors/TooManyRequestsError.d.ts +2 -2
  9. package/dist/api/errors/UnauthorizedError.d.ts +2 -2
  10. package/dist/api/resources/clicks/client/Client.d.ts +10 -7
  11. package/dist/api/resources/clicks/client/Client.js +82 -68
  12. package/dist/api/resources/clicks/client/requests/CreateClickRequest.d.ts +28 -0
  13. package/dist/api/resources/clicks/client/requests/{GetClicksRequest.d.ts → GetClickRequest.d.ts} +1 -1
  14. package/dist/api/resources/clicks/client/requests/index.d.ts +2 -1
  15. package/dist/api/resources/clicks/types/{CreateClicksResponse.d.ts → CreateClickResponse.d.ts} +1 -1
  16. package/dist/api/resources/clicks/types/{GetClicksResponse.d.ts → GetClickResponse.d.ts} +1 -1
  17. package/dist/api/resources/clicks/types/index.d.ts +2 -3
  18. package/dist/api/resources/clicks/types/index.js +2 -3
  19. package/dist/api/resources/commissions/client/Client.d.ts +19 -15
  20. package/dist/api/resources/commissions/client/Client.js +94 -76
  21. package/dist/api/resources/commissions/client/requests/{DeleteCommissionsRequest.d.ts → ApproveCommissionRequest.d.ts} +1 -1
  22. package/dist/api/resources/commissions/client/requests/CreateCommissionRequest.d.ts +40 -0
  23. package/dist/api/resources/commissions/client/requests/CreateCommissionRequest.js +9 -0
  24. package/dist/api/resources/commissions/client/requests/{DeclineCommissionsRequest.d.ts → DeclineCommissionRequest.d.ts} +1 -1
  25. package/dist/api/resources/commissions/client/requests/{ApproveCommissionsRequest.d.ts → DeleteCommissionRequest.d.ts} +1 -1
  26. package/dist/api/resources/commissions/client/requests/{GetCommissionsRequest.d.ts → GetCommissionRequest.d.ts} +1 -1
  27. package/dist/api/resources/commissions/client/requests/{UpdateCommissionsRequest.d.ts → UpdateCommissionRequest.d.ts} +3 -3
  28. package/dist/api/resources/commissions/client/requests/UpdateCommissionRequest.js +9 -0
  29. package/dist/api/resources/commissions/client/requests/index.d.ts +6 -5
  30. package/dist/api/resources/commissions/client/requests/index.js +2 -1
  31. package/dist/api/resources/commissions/types/{UpdateCommissionsResponse.d.ts → ApproveCommissionResponse.d.ts} +1 -1
  32. package/dist/api/resources/commissions/types/{DeleteCommissionsResponse.d.ts → CreateCommissionResponse.d.ts} +1 -1
  33. package/dist/api/resources/commissions/types/{CreateCommissionsResponse.d.ts → DeclineCommissionResponse.d.ts} +1 -1
  34. package/dist/api/resources/commissions/types/DeleteCommissionResponse.d.ts +6 -0
  35. package/dist/api/resources/commissions/types/{GetCommissionsResponse.d.ts → GetCommissionResponse.d.ts} +1 -1
  36. package/dist/api/resources/commissions/types/UpdateCommissionResponse.d.ts +6 -0
  37. package/dist/api/resources/commissions/types/index.d.ts +6 -7
  38. package/dist/api/resources/commissions/types/index.js +6 -7
  39. package/dist/api/resources/customers/client/Client.d.ts +9 -10
  40. package/dist/api/resources/customers/client/Client.js +84 -71
  41. package/dist/api/resources/customers/client/requests/{CreateCustomersRequest.d.ts → CreateCustomerRequest.d.ts} +3 -3
  42. package/dist/api/resources/customers/client/requests/{CreateCustomersRequest.js → CreateCustomerRequest.js} +4 -4
  43. package/dist/api/resources/customers/client/requests/{DeleteCustomersRequest.d.ts → DeleteCustomerRequest.d.ts} +1 -1
  44. package/dist/api/resources/customers/client/requests/{GetCustomersRequest.d.ts → GetCustomerRequest.d.ts} +1 -1
  45. package/dist/api/resources/customers/client/requests/{UpdateCustomersRequest.d.ts → UpdateCustomerRequest.d.ts} +3 -3
  46. package/dist/api/resources/customers/client/requests/{UpdateCustomersRequest.js → UpdateCustomerRequest.js} +4 -4
  47. package/dist/api/resources/customers/client/requests/index.d.ts +4 -4
  48. package/dist/api/resources/customers/client/requests/index.js +2 -2
  49. package/dist/api/resources/customers/types/{DeleteCustomersResponse.d.ts → CreateCustomerResponse.d.ts} +1 -1
  50. package/dist/api/resources/customers/types/{UpdateCustomersResponse.d.ts → DeleteCustomerResponse.d.ts} +1 -1
  51. package/dist/api/resources/customers/types/{GetCustomersResponse.d.ts → GetCustomerResponse.d.ts} +1 -1
  52. package/dist/api/resources/customers/types/{CreateCustomersResponse.d.ts → UpdateCustomerResponse.d.ts} +1 -1
  53. package/dist/api/resources/customers/types/index.d.ts +4 -4
  54. package/dist/api/resources/customers/types/index.js +4 -4
  55. package/dist/api/resources/{embed → embedTokens}/client/Client.d.ts +9 -11
  56. package/dist/api/resources/{embed → embedTokens}/client/Client.js +7 -9
  57. package/dist/api/resources/embedTokens/client/index.d.ts +1 -0
  58. package/dist/api/resources/embedTokens/client/index.js +1 -0
  59. package/dist/api/resources/embedTokens/client/requests/CreateEmbedTokenRequest.d.ts +21 -0
  60. package/dist/api/resources/embedTokens/client/requests/index.d.ts +1 -0
  61. package/dist/api/resources/embedTokens/exports.d.ts +2 -0
  62. package/dist/api/resources/{embed → embedTokens}/exports.js +1 -1
  63. package/dist/api/resources/{embed/types/CreateTokenEmbedResponse.d.ts → embedTokens/types/CreateEmbedTokenResponse.d.ts} +1 -1
  64. package/dist/api/resources/embedTokens/types/index.d.ts +1 -0
  65. package/dist/api/resources/embedTokens/types/index.js +1 -0
  66. package/dist/api/resources/flows/client/Client.d.ts +3 -4
  67. package/dist/api/resources/flows/client/Client.js +74 -64
  68. package/dist/api/resources/flows/client/requests/{GetFlowsRequest.d.ts → GetFlowRequest.d.ts} +1 -1
  69. package/dist/api/resources/flows/client/requests/ListFlowsRequest.d.ts +1 -1
  70. package/dist/api/resources/flows/client/requests/index.d.ts +1 -1
  71. package/dist/api/resources/flows/types/{GetFlowsResponse.d.ts → GetFlowResponse.d.ts} +1 -1
  72. package/dist/api/resources/flows/types/index.d.ts +1 -2
  73. package/dist/api/resources/flows/types/index.js +1 -2
  74. package/dist/api/resources/groups/client/Client.d.ts +3 -4
  75. package/dist/api/resources/groups/client/Client.js +71 -61
  76. package/dist/api/resources/groups/client/requests/{GetGroupsRequest.d.ts → GetGroupRequest.d.ts} +1 -1
  77. package/dist/api/resources/groups/client/requests/ListGroupsRequest.d.ts +1 -1
  78. package/dist/api/resources/groups/client/requests/index.d.ts +1 -1
  79. package/dist/api/resources/groups/types/{GetGroupsResponse.d.ts → GetGroupResponse.d.ts} +1 -1
  80. package/dist/api/resources/groups/types/index.d.ts +1 -2
  81. package/dist/api/resources/groups/types/index.js +1 -2
  82. package/dist/api/resources/index.d.ts +3 -2
  83. package/dist/api/resources/index.js +3 -2
  84. package/dist/api/resources/links/client/Client.d.ts +11 -12
  85. package/dist/api/resources/links/client/Client.js +80 -70
  86. package/dist/api/resources/links/client/requests/{CreateLinksRequest.d.ts → CreateLinkRequest.d.ts} +1 -1
  87. package/dist/api/resources/links/client/requests/{DeleteLinksRequest.d.ts → DeleteLinkRequest.d.ts} +1 -1
  88. package/dist/api/resources/links/client/requests/{GetByParamValueLinksRequest.d.ts → GetLinkByParamValueRequest.d.ts} +1 -1
  89. package/dist/api/resources/links/client/requests/{GetLinksRequest.d.ts → GetLinkRequest.d.ts} +1 -1
  90. package/dist/api/resources/links/client/requests/{UpdateLinksRequest.d.ts → UpdateLinkRequest.d.ts} +1 -1
  91. package/dist/api/resources/links/client/requests/index.d.ts +5 -5
  92. package/dist/api/resources/links/types/{DeleteLinksResponse.d.ts → CreateLinkResponse.d.ts} +1 -1
  93. package/dist/api/resources/links/types/{CreateLinksResponse.d.ts → DeleteLinkResponse.d.ts} +1 -1
  94. package/dist/api/resources/links/types/GetLinkByParamValueResponse.d.ts +6 -0
  95. package/dist/api/resources/links/types/{GetLinksResponse.d.ts → GetLinkResponse.d.ts} +1 -1
  96. package/dist/api/resources/links/types/{UpdateLinksResponse.d.ts → UpdateLinkResponse.d.ts} +1 -1
  97. package/dist/api/resources/links/types/index.d.ts +5 -5
  98. package/dist/api/resources/links/types/index.js +5 -5
  99. package/dist/api/resources/partners/client/Client.d.ts +13 -14
  100. package/dist/api/resources/partners/client/Client.js +82 -72
  101. package/dist/api/resources/partners/client/requests/{ApprovePartnersRequest.d.ts → ApprovePartnerRequest.d.ts} +1 -1
  102. package/dist/api/resources/partners/client/requests/{CreatePartnersRequest.d.ts → CreatePartnerRequest.d.ts} +4 -4
  103. package/dist/api/resources/partners/client/requests/{CreatePartnersRequest.js → CreatePartnerRequest.js} +4 -4
  104. package/dist/api/resources/partners/client/requests/{GetPartnersRequest.d.ts → GetPartnerRequest.d.ts} +1 -1
  105. package/dist/api/resources/partners/client/requests/{RejectPartnersRequest.d.ts → RejectPartnerRequest.d.ts} +1 -1
  106. package/dist/api/resources/partners/client/requests/{SuspendPartnersRequest.d.ts → SuspendPartnerRequest.d.ts} +1 -1
  107. package/dist/api/resources/partners/client/requests/{UpdatePartnersRequest.d.ts → UpdatePartnerRequest.d.ts} +1 -1
  108. package/dist/api/resources/partners/client/requests/index.d.ts +6 -6
  109. package/dist/api/resources/partners/client/requests/index.js +1 -1
  110. package/dist/api/resources/partners/types/{RejectPartnersResponse.d.ts → ApprovePartnerResponse.d.ts} +1 -1
  111. package/dist/api/resources/partners/types/{CreatePartnersResponse.d.ts → CreatePartnerResponse.d.ts} +1 -1
  112. package/dist/api/resources/partners/types/{GetPartnersResponse.d.ts → GetPartnerResponse.d.ts} +1 -1
  113. package/dist/api/resources/partners/types/{UpdatePartnersResponse.d.ts → RejectPartnerResponse.d.ts} +1 -1
  114. package/dist/api/resources/partners/types/{ApprovePartnersResponse.d.ts → SuspendPartnerResponse.d.ts} +1 -1
  115. package/dist/api/resources/partners/types/{SuspendPartnersResponse.d.ts → UpdatePartnerResponse.d.ts} +1 -1
  116. package/dist/api/resources/partners/types/index.d.ts +6 -6
  117. package/dist/api/resources/partners/types/index.js +6 -6
  118. package/dist/api/resources/programs/client/Client.d.ts +3 -4
  119. package/dist/api/resources/programs/client/Client.js +69 -59
  120. package/dist/api/resources/programs/client/requests/{GetProgramsRequest.d.ts → GetProgramRequest.d.ts} +1 -1
  121. package/dist/api/resources/programs/client/requests/index.d.ts +1 -1
  122. package/dist/api/resources/programs/types/{GetProgramsResponse.d.ts → GetProgramResponse.d.ts} +1 -1
  123. package/dist/api/resources/programs/types/index.d.ts +1 -1
  124. package/dist/api/resources/programs/types/index.js +1 -1
  125. package/dist/api/resources/promotionCodes/client/Client.d.ts +9 -10
  126. package/dist/api/resources/promotionCodes/client/Client.js +81 -68
  127. package/dist/api/resources/promotionCodes/client/requests/{CreatePromotionCodesRequest.d.ts → CreatePromotionCodeRequest.d.ts} +3 -3
  128. package/dist/api/resources/promotionCodes/client/requests/{CreatePromotionCodesRequest.js → CreatePromotionCodeRequest.js} +4 -4
  129. package/dist/api/resources/promotionCodes/client/requests/{DeletePromotionCodesRequest.d.ts → DeletePromotionCodeRequest.d.ts} +1 -1
  130. package/dist/api/resources/promotionCodes/client/requests/{GetPromotionCodesRequest.d.ts → GetPromotionCodeRequest.d.ts} +1 -1
  131. package/dist/api/resources/promotionCodes/client/requests/{UpdatePromotionCodesRequest.d.ts → UpdatePromotionCodeRequest.d.ts} +3 -3
  132. package/dist/api/resources/promotionCodes/client/requests/{UpdatePromotionCodesRequest.js → UpdatePromotionCodeRequest.js} +4 -4
  133. package/dist/api/resources/promotionCodes/client/requests/index.d.ts +4 -4
  134. package/dist/api/resources/promotionCodes/client/requests/index.js +2 -2
  135. package/dist/api/resources/promotionCodes/types/{CreatePromotionCodesResponse.d.ts → CreatePromotionCodeResponse.d.ts} +1 -1
  136. package/dist/api/resources/promotionCodes/types/{DeletePromotionCodesResponse.d.ts → DeletePromotionCodeResponse.d.ts} +1 -1
  137. package/dist/api/resources/promotionCodes/types/{GetPromotionCodesResponse.d.ts → GetPromotionCodeResponse.d.ts} +1 -1
  138. package/dist/api/resources/promotionCodes/types/{UpdatePromotionCodesResponse.d.ts → UpdatePromotionCodeResponse.d.ts} +1 -1
  139. package/dist/api/resources/promotionCodes/types/index.d.ts +4 -4
  140. package/dist/api/resources/promotionCodes/types/index.js +4 -4
  141. package/dist/api/resources/reports/client/Client.d.ts +12 -14
  142. package/dist/api/resources/reports/client/Client.js +158 -119
  143. package/dist/api/resources/reports/client/requests/{CustomerStatsReportsRequest.d.ts → ReportsCustomersRequest.d.ts} +1 -1
  144. package/dist/api/resources/reports/client/requests/{LinksReportsRequest.d.ts → ReportsLinksRequest.d.ts} +1 -1
  145. package/dist/api/resources/reports/client/requests/{OverviewReportsRequest.d.ts → ReportsOverviewRequest.d.ts} +1 -1
  146. package/dist/api/resources/reports/client/requests/{PartnersReportsRequest.d.ts → ReportsPartnersRequest.d.ts} +1 -1
  147. package/dist/api/resources/reports/client/requests/{TimeseriesReportsRequest.d.ts → ReportsTimeseriesRequest.d.ts} +1 -1
  148. package/dist/api/resources/reports/client/requests/index.d.ts +5 -5
  149. package/dist/api/resources/reports/types/{CustomerStatsReportsResponse.d.ts → ReportsCustomersResponse.d.ts} +1 -1
  150. package/dist/api/resources/reports/types/{LinksReportsResponse.d.ts → ReportsLinksResponse.d.ts} +1 -1
  151. package/dist/api/resources/reports/types/{OverviewReportsResponse.d.ts → ReportsOverviewResponse.d.ts} +1 -1
  152. package/dist/api/resources/reports/types/{PartnersReportsResponse.d.ts → ReportsPartnersResponse.d.ts} +1 -1
  153. package/dist/api/resources/reports/types/{TimeseriesReportsResponse.d.ts → ReportsTimeseriesResponse.d.ts} +1 -1
  154. package/dist/api/resources/reports/types/index.d.ts +5 -5
  155. package/dist/api/resources/reports/types/index.js +5 -5
  156. package/dist/api/resources/transactions/client/Client.d.ts +13 -14
  157. package/dist/api/resources/transactions/client/Client.js +87 -74
  158. package/dist/api/resources/transactions/client/requests/{CreateTransactionsRequest.d.ts → CreateTransactionRequest.d.ts} +1 -1
  159. package/dist/api/resources/transactions/client/requests/{DeleteTransactionsRequest.d.ts → DeleteTransactionRequest.d.ts} +1 -1
  160. package/dist/api/resources/transactions/client/requests/{GetTransactionsRequest.d.ts → GetTransactionRequest.d.ts} +1 -1
  161. package/dist/api/resources/transactions/client/requests/{RefundTransactionsRequest.d.ts → RefundTransactionRequest.d.ts} +1 -1
  162. package/dist/api/resources/transactions/client/requests/{RerunFlowsTransactionsRequest.d.ts → RerunTransactionFlowsRequest.d.ts} +1 -1
  163. package/dist/api/resources/transactions/client/requests/{UpdateTransactionsRequest.d.ts → UpdateTransactionRequest.d.ts} +1 -1
  164. package/dist/api/resources/transactions/client/requests/index.d.ts +6 -6
  165. package/dist/api/resources/transactions/types/{CreateTransactionsResponse.d.ts → CreateTransactionResponse.d.ts} +1 -1
  166. package/dist/api/resources/transactions/types/{DeleteTransactionsResponse.d.ts → DeleteTransactionResponse.d.ts} +1 -1
  167. package/dist/api/resources/transactions/types/{GetTransactionsResponse.d.ts → GetTransactionResponse.d.ts} +1 -1
  168. package/dist/api/resources/transactions/types/{RefundTransactionsResponse.d.ts → RefundTransactionResponse.d.ts} +1 -1
  169. package/dist/api/resources/transactions/types/{RerunFlowsTransactionsResponse.d.ts → RerunTransactionFlowsResponse.d.ts} +1 -1
  170. package/dist/api/resources/transactions/types/UpdateTransactionResponse.d.ts +6 -0
  171. package/dist/api/resources/transactions/types/index.d.ts +6 -6
  172. package/dist/api/resources/transactions/types/index.js +6 -6
  173. package/dist/api/types/{Error_.d.ts → ErrorResponse.d.ts} +4 -4
  174. package/dist/api/types/{Error_.js → ErrorResponse.js} +4 -4
  175. package/dist/api/types/index.d.ts +1 -1
  176. package/dist/api/types/index.js +1 -1
  177. package/dist/core/exports.d.ts +1 -0
  178. package/dist/core/exports.js +1 -0
  179. package/dist/core/fetcher/Fetcher.js +35 -4
  180. package/dist/core/fetcher/getErrorResponseBody.js +21 -8
  181. package/dist/core/fetcher/getResponseBody.d.ts +16 -0
  182. package/dist/core/fetcher/getResponseBody.js +26 -22
  183. package/dist/core/fetcher/makePassthroughRequest.js +18 -2
  184. package/dist/core/fetcher/makeRequest.d.ts +6 -1
  185. package/dist/core/fetcher/makeRequest.js +45 -13
  186. package/dist/core/fetcher/requestWithRetries.d.ts +1 -1
  187. package/dist/core/fetcher/requestWithRetries.js +23 -2
  188. package/dist/core/fetcher/signals.d.ts +1 -0
  189. package/dist/core/fetcher/signals.js +1 -1
  190. package/dist/core/index.d.ts +2 -0
  191. package/dist/core/index.js +2 -0
  192. package/dist/core/pagination/Page.d.ts +33 -0
  193. package/dist/core/pagination/Page.js +49 -0
  194. package/dist/core/pagination/exports.d.ts +1 -0
  195. package/dist/core/pagination/index.d.ts +1 -0
  196. package/dist/core/pagination/index.js +1 -0
  197. package/dist/core/url/encodePathParam.d.ts +3 -1
  198. package/dist/core/url/encodePathParam.js +8 -2
  199. package/dist/core/utils/index.d.ts +1 -0
  200. package/dist/core/utils/index.js +1 -0
  201. package/dist/core/utils/setObjectProperty.d.ts +12 -0
  202. package/dist/core/utils/setObjectProperty.js +45 -0
  203. package/dist/environments.d.ts +1 -1
  204. package/dist/environments.js +1 -1
  205. package/dist/errors/ToltApiError.js +15 -1
  206. package/package.json +7 -2
  207. package/dist/api/resources/clicks/types/CreateClicksRequest.d.ts +0 -1
  208. package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.js +0 -9
  209. package/dist/api/resources/commissions/types/ApproveCommissionsResponse.d.ts +0 -6
  210. package/dist/api/resources/commissions/types/CreateCommissionsRequest.d.ts +0 -1
  211. package/dist/api/resources/commissions/types/DeclineCommissionsResponse.d.ts +0 -6
  212. package/dist/api/resources/embed/exports.d.ts +0 -2
  213. package/dist/api/resources/embed/types/CreateTokenEmbedRequest.d.ts +0 -1
  214. package/dist/api/resources/embed/types/index.d.ts +0 -2
  215. package/dist/api/resources/embed/types/index.js +0 -2
  216. package/dist/api/resources/flows/types/ListFlowsRequestActive.d.ts +0 -6
  217. package/dist/api/resources/flows/types/ListFlowsRequestActive.js +0 -6
  218. package/dist/api/resources/groups/types/ListGroupsRequestDefault.d.ts +0 -6
  219. package/dist/api/resources/groups/types/ListGroupsRequestDefault.js +0 -6
  220. package/dist/api/resources/links/types/GetByParamValueLinksResponse.d.ts +0 -6
  221. package/dist/api/resources/transactions/types/UpdateTransactionsResponse.d.ts +0 -6
  222. package/dist/api/resources/transactions/types/UpdateTransactionsResponse.js +0 -2
  223. /package/dist/api/resources/clicks/client/requests/{GetClicksRequest.js → CreateClickRequest.js} +0 -0
  224. /package/dist/api/resources/clicks/{types/CreateClicksRequest.js → client/requests/GetClickRequest.js} +0 -0
  225. /package/dist/api/resources/clicks/types/{CreateClicksResponse.js → CreateClickResponse.js} +0 -0
  226. /package/dist/api/resources/clicks/types/{GetClicksResponse.js → GetClickResponse.js} +0 -0
  227. /package/dist/api/resources/commissions/client/requests/{ApproveCommissionsRequest.js → ApproveCommissionRequest.js} +0 -0
  228. /package/dist/api/resources/commissions/client/requests/{DeclineCommissionsRequest.js → DeclineCommissionRequest.js} +0 -0
  229. /package/dist/api/resources/commissions/client/requests/{DeleteCommissionsRequest.js → DeleteCommissionRequest.js} +0 -0
  230. /package/dist/api/resources/commissions/client/requests/{GetCommissionsRequest.js → GetCommissionRequest.js} +0 -0
  231. /package/dist/api/resources/commissions/types/{ApproveCommissionsResponse.js → ApproveCommissionResponse.js} +0 -0
  232. /package/dist/api/resources/commissions/types/{CreateCommissionsRequest.js → CreateCommissionResponse.js} +0 -0
  233. /package/dist/api/resources/commissions/types/{CreateCommissionsResponse.js → DeclineCommissionResponse.js} +0 -0
  234. /package/dist/api/resources/commissions/types/{DeclineCommissionsResponse.js → DeleteCommissionResponse.js} +0 -0
  235. /package/dist/api/resources/commissions/types/{DeleteCommissionsResponse.js → GetCommissionResponse.js} +0 -0
  236. /package/dist/api/resources/commissions/types/{GetCommissionsResponse.js → UpdateCommissionResponse.js} +0 -0
  237. /package/dist/api/resources/{commissions/types/UpdateCommissionsResponse.js → customers/client/requests/DeleteCustomerRequest.js} +0 -0
  238. /package/dist/api/resources/customers/client/requests/{DeleteCustomersRequest.js → GetCustomerRequest.js} +0 -0
  239. /package/dist/api/resources/customers/{client/requests/GetCustomersRequest.js → types/CreateCustomerResponse.js} +0 -0
  240. /package/dist/api/resources/customers/types/{CreateCustomersResponse.js → DeleteCustomerResponse.js} +0 -0
  241. /package/dist/api/resources/customers/types/{DeleteCustomersResponse.js → GetCustomerResponse.js} +0 -0
  242. /package/dist/api/resources/customers/types/{GetCustomersResponse.js → UpdateCustomerResponse.js} +0 -0
  243. /package/dist/api/resources/{customers/types/UpdateCustomersResponse.js → embedTokens/client/requests/CreateEmbedTokenRequest.js} +0 -0
  244. /package/dist/api/resources/{embed/client → embedTokens/client/requests}/index.js +0 -0
  245. /package/dist/api/resources/{embed → embedTokens}/index.d.ts +0 -0
  246. /package/dist/api/resources/{embed → embedTokens}/index.js +0 -0
  247. /package/dist/api/resources/{embed/types/CreateTokenEmbedRequest.js → embedTokens/types/CreateEmbedTokenResponse.js} +0 -0
  248. /package/dist/api/resources/{embed/types/CreateTokenEmbedResponse.js → flows/client/requests/GetFlowRequest.js} +0 -0
  249. /package/dist/api/resources/flows/{client/requests/GetFlowsRequest.js → types/GetFlowResponse.js} +0 -0
  250. /package/dist/api/resources/{flows/types/GetFlowsResponse.js → groups/client/requests/GetGroupRequest.js} +0 -0
  251. /package/dist/api/resources/groups/{client/requests/GetGroupsRequest.js → types/GetGroupResponse.js} +0 -0
  252. /package/dist/api/resources/{groups/types/GetGroupsResponse.js → links/client/requests/CreateLinkRequest.js} +0 -0
  253. /package/dist/api/resources/links/client/requests/{CreateLinksRequest.js → DeleteLinkRequest.js} +0 -0
  254. /package/dist/api/resources/links/client/requests/{DeleteLinksRequest.js → GetLinkByParamValueRequest.js} +0 -0
  255. /package/dist/api/resources/links/client/requests/{GetByParamValueLinksRequest.js → GetLinkRequest.js} +0 -0
  256. /package/dist/api/resources/links/client/requests/{GetLinksRequest.js → UpdateLinkRequest.js} +0 -0
  257. /package/dist/api/resources/links/{client/requests/UpdateLinksRequest.js → types/CreateLinkResponse.js} +0 -0
  258. /package/dist/api/resources/links/types/{CreateLinksResponse.js → DeleteLinkResponse.js} +0 -0
  259. /package/dist/api/resources/links/types/{DeleteLinksResponse.js → GetLinkByParamValueResponse.js} +0 -0
  260. /package/dist/api/resources/links/types/{GetByParamValueLinksResponse.js → GetLinkResponse.js} +0 -0
  261. /package/dist/api/resources/links/types/{GetLinksResponse.js → UpdateLinkResponse.js} +0 -0
  262. /package/dist/api/resources/{links/types/UpdateLinksResponse.js → partners/client/requests/ApprovePartnerRequest.js} +0 -0
  263. /package/dist/api/resources/partners/client/requests/{ApprovePartnersRequest.js → GetPartnerRequest.js} +0 -0
  264. /package/dist/api/resources/partners/client/requests/{GetPartnersRequest.js → RejectPartnerRequest.js} +0 -0
  265. /package/dist/api/resources/partners/client/requests/{RejectPartnersRequest.js → SuspendPartnerRequest.js} +0 -0
  266. /package/dist/api/resources/partners/client/requests/{SuspendPartnersRequest.js → UpdatePartnerRequest.js} +0 -0
  267. /package/dist/api/resources/partners/{client/requests/UpdatePartnersRequest.js → types/ApprovePartnerResponse.js} +0 -0
  268. /package/dist/api/resources/partners/types/{ApprovePartnersResponse.js → CreatePartnerResponse.js} +0 -0
  269. /package/dist/api/resources/partners/types/{CreatePartnersResponse.js → GetPartnerResponse.js} +0 -0
  270. /package/dist/api/resources/partners/types/{GetPartnersResponse.js → RejectPartnerResponse.js} +0 -0
  271. /package/dist/api/resources/partners/types/{RejectPartnersResponse.js → SuspendPartnerResponse.js} +0 -0
  272. /package/dist/api/resources/partners/types/{SuspendPartnersResponse.js → UpdatePartnerResponse.js} +0 -0
  273. /package/dist/api/resources/{partners/types/UpdatePartnersResponse.js → programs/client/requests/GetProgramRequest.js} +0 -0
  274. /package/dist/api/resources/programs/{client/requests/GetProgramsRequest.js → types/GetProgramResponse.js} +0 -0
  275. /package/dist/api/resources/{programs/types/GetProgramsResponse.js → promotionCodes/client/requests/DeletePromotionCodeRequest.js} +0 -0
  276. /package/dist/api/resources/promotionCodes/client/requests/{DeletePromotionCodesRequest.js → GetPromotionCodeRequest.js} +0 -0
  277. /package/dist/api/resources/promotionCodes/{client/requests/GetPromotionCodesRequest.js → types/CreatePromotionCodeResponse.js} +0 -0
  278. /package/dist/api/resources/promotionCodes/types/{CreatePromotionCodesResponse.js → DeletePromotionCodeResponse.js} +0 -0
  279. /package/dist/api/resources/promotionCodes/types/{DeletePromotionCodesResponse.js → GetPromotionCodeResponse.js} +0 -0
  280. /package/dist/api/resources/promotionCodes/types/{GetPromotionCodesResponse.js → UpdatePromotionCodeResponse.js} +0 -0
  281. /package/dist/api/resources/{promotionCodes/types/UpdatePromotionCodesResponse.js → reports/client/requests/ReportsCustomersRequest.js} +0 -0
  282. /package/dist/api/resources/reports/client/requests/{CustomerStatsReportsRequest.js → ReportsLinksRequest.js} +0 -0
  283. /package/dist/api/resources/reports/client/requests/{LinksReportsRequest.js → ReportsOverviewRequest.js} +0 -0
  284. /package/dist/api/resources/reports/client/requests/{OverviewReportsRequest.js → ReportsPartnersRequest.js} +0 -0
  285. /package/dist/api/resources/reports/client/requests/{PartnersReportsRequest.js → ReportsTimeseriesRequest.js} +0 -0
  286. /package/dist/api/resources/reports/{client/requests/TimeseriesReportsRequest.js → types/ReportsCustomersResponse.js} +0 -0
  287. /package/dist/api/resources/reports/types/{CustomerStatsReportsResponse.js → ReportsLinksResponse.js} +0 -0
  288. /package/dist/api/resources/reports/types/{LinksReportsResponse.js → ReportsOverviewResponse.js} +0 -0
  289. /package/dist/api/resources/reports/types/{OverviewReportsResponse.js → ReportsPartnersResponse.js} +0 -0
  290. /package/dist/api/resources/reports/types/{PartnersReportsResponse.js → ReportsTimeseriesResponse.js} +0 -0
  291. /package/dist/api/resources/{reports/types/TimeseriesReportsResponse.js → transactions/client/requests/CreateTransactionRequest.js} +0 -0
  292. /package/dist/api/resources/transactions/client/requests/{CreateTransactionsRequest.js → DeleteTransactionRequest.js} +0 -0
  293. /package/dist/api/resources/transactions/client/requests/{DeleteTransactionsRequest.js → GetTransactionRequest.js} +0 -0
  294. /package/dist/api/resources/transactions/client/requests/{GetTransactionsRequest.js → RefundTransactionRequest.js} +0 -0
  295. /package/dist/api/resources/transactions/client/requests/{RefundTransactionsRequest.js → RerunTransactionFlowsRequest.js} +0 -0
  296. /package/dist/api/resources/transactions/client/requests/{RerunFlowsTransactionsRequest.js → UpdateTransactionRequest.js} +0 -0
  297. /package/dist/api/resources/transactions/{client/requests/UpdateTransactionsRequest.js → types/CreateTransactionResponse.js} +0 -0
  298. /package/dist/api/resources/transactions/types/{CreateTransactionsResponse.js → DeleteTransactionResponse.js} +0 -0
  299. /package/dist/api/resources/transactions/types/{DeleteTransactionsResponse.js → GetTransactionResponse.js} +0 -0
  300. /package/dist/api/resources/transactions/types/{GetTransactionsResponse.js → RefundTransactionResponse.js} +0 -0
  301. /package/dist/api/resources/transactions/types/{RefundTransactionsResponse.js → RerunTransactionFlowsResponse.js} +0 -0
  302. /package/dist/api/resources/transactions/types/{RerunFlowsTransactionsResponse.js → UpdateTransactionResponse.js} +0 -0
  303. /package/dist/{api/resources/embed/client/index.d.ts → core/pagination/exports.js} +0 -0
@@ -154,72 +154,82 @@ export class PartnersClient {
154
154
  * @example
155
155
  * await client.partners.list()
156
156
  */
157
- list(request = {}, requestOptions) {
158
- return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
159
- }
160
- async __list(request = {}, requestOptions) {
161
- const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, status, program_id: programId, group_id: groupId, search, } = request;
162
- const _queryParams = {
163
- limit,
164
- order: order != null ? order : undefined,
165
- sort: sort != null ? sort : undefined,
166
- starting_after: startingAfter,
167
- ending_before: endingBefore,
168
- created_after: createdAfter != null ? createdAfter : undefined,
169
- created_before: createdBefore != null ? createdBefore : undefined,
170
- updated_after: updatedAfter != null ? updatedAfter : undefined,
171
- updated_before: updatedBefore != null ? updatedBefore : undefined,
172
- status: status != null ? status : undefined,
173
- program_id: programId,
174
- group_id: groupId,
175
- search,
176
- };
177
- const _authRequest = await this._options.authProvider.getAuthRequest();
178
- const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
179
- const _response = await core.fetcher({
180
- url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
181
- (await core.Supplier.get(this._options.environment)) ??
182
- environments.ToltApiEnvironment.Default, "v2/partners"),
183
- method: "GET",
184
- headers: _headers,
185
- queryString: core.url
186
- .queryBuilder()
187
- .addMany(_queryParams)
188
- .mergeAdditional(requestOptions?.queryParams)
189
- .build(),
190
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
191
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
192
- abortSignal: requestOptions?.abortSignal,
193
- fetchFn: this._options?.fetch,
194
- logging: this._options.logging,
195
- });
196
- if (_response.ok) {
197
- return { data: _response.body, rawResponse: _response.rawResponse };
198
- }
199
- if (_response.error.reason === "status-code") {
200
- switch (_response.error.statusCode) {
201
- case 400:
202
- throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
203
- case 401:
204
- throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
205
- case 413:
206
- throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
207
- case 429:
208
- throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
209
- default:
210
- throw new errors.ToltApiError({
211
- statusCode: _response.error.statusCode,
212
- body: _response.error.body,
213
- rawResponse: _response.rawResponse,
214
- });
157
+ async list(request = {}, requestOptions) {
158
+ const list = core.HttpResponsePromise.interceptFunction(async (request) => {
159
+ const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, status, program_id: programId, group_id: groupId, search, } = request;
160
+ const _queryParams = {
161
+ limit,
162
+ order: order != null ? order : undefined,
163
+ sort: sort != null ? sort : undefined,
164
+ starting_after: startingAfter,
165
+ ending_before: endingBefore,
166
+ created_after: createdAfter != null ? createdAfter : undefined,
167
+ created_before: createdBefore != null ? createdBefore : undefined,
168
+ updated_after: updatedAfter != null ? updatedAfter : undefined,
169
+ updated_before: updatedBefore != null ? updatedBefore : undefined,
170
+ status: status != null ? status : undefined,
171
+ program_id: programId,
172
+ group_id: groupId,
173
+ search,
174
+ };
175
+ const _authRequest = await this._options.authProvider.getAuthRequest();
176
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
177
+ const _response = await core.fetcher({
178
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
179
+ (await core.Supplier.get(this._options.environment)) ??
180
+ environments.ToltApiEnvironment.Default, "v2/partners"),
181
+ method: "GET",
182
+ headers: _headers,
183
+ queryString: core.url
184
+ .queryBuilder()
185
+ .addMany(_queryParams)
186
+ .mergeAdditional(requestOptions?.queryParams)
187
+ .build(),
188
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
189
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
190
+ abortSignal: requestOptions?.abortSignal,
191
+ fetchFn: this._options?.fetch,
192
+ logging: this._options.logging,
193
+ });
194
+ if (_response.ok) {
195
+ return { data: _response.body, rawResponse: _response.rawResponse };
215
196
  }
216
- }
217
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/partners");
197
+ if (_response.error.reason === "status-code") {
198
+ switch (_response.error.statusCode) {
199
+ case 400:
200
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
201
+ case 401:
202
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
203
+ case 413:
204
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
205
+ case 429:
206
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
207
+ default:
208
+ throw new errors.ToltApiError({
209
+ statusCode: _response.error.statusCode,
210
+ body: _response.error.body,
211
+ rawResponse: _response.rawResponse,
212
+ });
213
+ }
214
+ }
215
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/partners");
216
+ });
217
+ const dataWithRawResponse = await list(request).withRawResponse();
218
+ return new core.Page({
219
+ response: dataWithRawResponse.data,
220
+ rawResponse: dataWithRawResponse.rawResponse,
221
+ hasNextPage: (response) => response?.next_cursor != null &&
222
+ !(typeof response?.next_cursor === "string" && response?.next_cursor === ""),
223
+ getItems: (response) => response?.data ?? [],
224
+ loadPage: (response) => {
225
+ return list(core.setObjectProperty(request, "starting_after", response?.next_cursor));
226
+ },
227
+ });
218
228
  }
219
229
  /**
220
230
  * Creates an onboarded partner together with their referral link. The link value defaults to a slug of the partner's name or email and the parameter to the program's first link parameter. Omit group_id to place the partner in the program's default group.
221
231
  *
222
- * @param {ToltApi.CreatePartnersRequest} request
232
+ * @param {ToltApi.CreatePartnerRequest} request
223
233
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
224
234
  *
225
235
  * @throws {@link ToltApi.BadRequestError}
@@ -260,7 +270,7 @@ export class PartnersClient {
260
270
  requestType: "json",
261
271
  body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters),
262
272
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
263
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
273
+ maxRetries: 0,
264
274
  abortSignal: requestOptions?.abortSignal,
265
275
  fetchFn: this._options?.fetch,
266
276
  logging: this._options.logging,
@@ -293,7 +303,7 @@ export class PartnersClient {
293
303
  /**
294
304
  * Gets a partner by ID, with their profile, status, group and program.
295
305
  *
296
- * @param {ToltApi.GetPartnersRequest} request
306
+ * @param {ToltApi.GetPartnerRequest} request
297
307
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
298
308
  *
299
309
  * @throws {@link ToltApi.UnauthorizedError}
@@ -318,7 +328,7 @@ export class PartnersClient {
318
328
  const _response = await core.fetcher({
319
329
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
320
330
  (await core.Supplier.get(this._options.environment)) ??
321
- environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id)}`),
331
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}`),
322
332
  method: "GET",
323
333
  headers: _headers,
324
334
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
@@ -354,7 +364,7 @@ export class PartnersClient {
354
364
  /**
355
365
  * Edits profile fields and group membership. Status changes go through the approve, reject and suspend actions.
356
366
  *
357
- * @param {ToltApi.UpdatePartnersRequest} request
367
+ * @param {ToltApi.UpdatePartnerRequest} request
358
368
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
359
369
  *
360
370
  * @throws {@link ToltApi.BadRequestError}
@@ -383,7 +393,7 @@ export class PartnersClient {
383
393
  const _response = await core.fetcher({
384
394
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
385
395
  (await core.Supplier.get(this._options.environment)) ??
386
- environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id)}`),
396
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}`),
387
397
  method: "PUT",
388
398
  headers: _headers,
389
399
  contentType: "application/json",
@@ -424,7 +434,7 @@ export class PartnersClient {
424
434
  /**
425
435
  * Makes the partner active. A partner who was not already active is sent the program's approval email.
426
436
  *
427
- * @param {ToltApi.ApprovePartnersRequest} request
437
+ * @param {ToltApi.ApprovePartnerRequest} request
428
438
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
429
439
  *
430
440
  * @throws {@link ToltApi.UnauthorizedError}
@@ -449,7 +459,7 @@ export class PartnersClient {
449
459
  const _response = await core.fetcher({
450
460
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
451
461
  (await core.Supplier.get(this._options.environment)) ??
452
- environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id)}/approve`),
462
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/approve`),
453
463
  method: "POST",
454
464
  headers: _headers,
455
465
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
@@ -485,7 +495,7 @@ export class PartnersClient {
485
495
  /**
486
496
  * Rejects the partner. A partner who was not already rejected is sent the program's rejection email with the note.
487
497
  *
488
- * @param {ToltApi.RejectPartnersRequest} request
498
+ * @param {ToltApi.RejectPartnerRequest} request
489
499
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
490
500
  *
491
501
  * @throws {@link ToltApi.BadRequestError}
@@ -511,7 +521,7 @@ export class PartnersClient {
511
521
  const _response = await core.fetcher({
512
522
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
513
523
  (await core.Supplier.get(this._options.environment)) ??
514
- environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id)}/reject`),
524
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/reject`),
515
525
  method: "POST",
516
526
  headers: _headers,
517
527
  contentType: "application/json",
@@ -552,7 +562,7 @@ export class PartnersClient {
552
562
  /**
553
563
  * Suspends the partner, with an optional suspension_reason. Use the approve action to make them active again.
554
564
  *
555
- * @param {ToltApi.SuspendPartnersRequest} request
565
+ * @param {ToltApi.SuspendPartnerRequest} request
556
566
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
557
567
  *
558
568
  * @throws {@link ToltApi.BadRequestError}
@@ -578,7 +588,7 @@ export class PartnersClient {
578
588
  const _response = await core.fetcher({
579
589
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
580
590
  (await core.Supplier.get(this._options.environment)) ??
581
- environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id)}/suspend`),
591
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/suspend`),
582
592
  method: "POST",
583
593
  headers: _headers,
584
594
  contentType: "application/json",
@@ -4,6 +4,6 @@
4
4
  * id: "part_NLYzgNKuSuASvrvoxNtau6SY"
5
5
  * }
6
6
  */
7
- export interface ApprovePartnersRequest {
7
+ export interface ApprovePartnerRequest {
8
8
  id: string;
9
9
  }
@@ -12,7 +12,7 @@
12
12
  * }
13
13
  * }
14
14
  */
15
- export interface CreatePartnersRequest {
15
+ export interface CreatePartnerRequest {
16
16
  /** Partner's email address, where program emails such as the welcome email go. It identifies the partner in the program, so it cannot match another partner's email there, ignoring case. */
17
17
  email: string;
18
18
  /** Id of the program to add the partner to (prg_...), as returned when listing programs. */
@@ -34,13 +34,13 @@ export interface CreatePartnersRequest {
34
34
  /** Group in the program. Defaults to the program's default group. */
35
35
  group_id?: string;
36
36
  /** Use pending to add the partner as an application that still needs approval instead of an active partner. */
37
- status?: CreatePartnersRequest.Status;
37
+ status?: CreatePartnerRequest.Status;
38
38
  /** The referral link created with the partner. Leave it out to build the slug from the partner's name, or from the part of the email before the @ when there is no name. */
39
- link?: CreatePartnersRequest.Link;
39
+ link?: CreatePartnerRequest.Link;
40
40
  /** Send the partner the program's welcome email. Only goes out when the program's welcome email is enabled and the partner is active. */
41
41
  notify_partner?: boolean;
42
42
  }
43
- export declare namespace CreatePartnersRequest {
43
+ export declare namespace CreatePartnerRequest {
44
44
  /** Use pending to add the partner as an application that still needs approval instead of an active partner. */
45
45
  const Status: {
46
46
  readonly Active: "active";
@@ -1,9 +1,9 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export var CreatePartnersRequest;
3
- (function (CreatePartnersRequest) {
2
+ export var CreatePartnerRequest;
3
+ (function (CreatePartnerRequest) {
4
4
  /** Use pending to add the partner as an application that still needs approval instead of an active partner. */
5
- CreatePartnersRequest.Status = {
5
+ CreatePartnerRequest.Status = {
6
6
  Active: "active",
7
7
  Pending: "pending",
8
8
  };
9
- })(CreatePartnersRequest || (CreatePartnersRequest = {}));
9
+ })(CreatePartnerRequest || (CreatePartnerRequest = {}));
@@ -4,6 +4,6 @@
4
4
  * id: "part_NLYzgNKuSuASvrvoxNtau6SY"
5
5
  * }
6
6
  */
7
- export interface GetPartnersRequest {
7
+ export interface GetPartnerRequest {
8
8
  id: string;
9
9
  }
@@ -4,7 +4,7 @@
4
4
  * id: "part_NLYzgNKuSuASvrvoxNtau6SY"
5
5
  * }
6
6
  */
7
- export interface RejectPartnersRequest {
7
+ export interface RejectPartnerRequest {
8
8
  id: string;
9
9
  /** Reason for the rejection, shown to the partner in the partner portal. Null clears an earlier note. */
10
10
  rejection_note?: string | null;
@@ -4,7 +4,7 @@
4
4
  * id: "part_NLYzgNKuSuASvrvoxNtau6SY"
5
5
  * }
6
6
  */
7
- export interface SuspendPartnersRequest {
7
+ export interface SuspendPartnerRequest {
8
8
  id: string;
9
9
  /** Reason for the suspension, shown to the partner in the partner portal. Null clears an earlier reason. */
10
10
  suspension_reason?: string | null;
@@ -7,7 +7,7 @@
7
7
  * group_id: "grp_zUQ8Pt281MsbNDApmDPN3Y2a"
8
8
  * }
9
9
  */
10
- export interface UpdatePartnersRequest {
10
+ export interface UpdatePartnerRequest {
11
11
  id: string;
12
12
  /** Partner's first name, part of the name shown for them unless they have a display name; null clears it. */
13
13
  first_name?: string | null;
@@ -1,9 +1,9 @@
1
- export type { ApprovePartnersRequest } from "./ApprovePartnersRequest.js";
1
+ export type { ApprovePartnerRequest } from "./ApprovePartnerRequest.js";
2
2
  export type { BulkApprovePartnersRequest } from "./BulkApprovePartnersRequest.js";
3
3
  export type { BulkRejectPartnersRequest } from "./BulkRejectPartnersRequest.js";
4
- export { CreatePartnersRequest } from "./CreatePartnersRequest.js";
5
- export type { GetPartnersRequest } from "./GetPartnersRequest.js";
4
+ export { CreatePartnerRequest } from "./CreatePartnerRequest.js";
5
+ export type { GetPartnerRequest } from "./GetPartnerRequest.js";
6
6
  export type { ListPartnersRequest } from "./ListPartnersRequest.js";
7
- export type { RejectPartnersRequest } from "./RejectPartnersRequest.js";
8
- export type { SuspendPartnersRequest } from "./SuspendPartnersRequest.js";
9
- export type { UpdatePartnersRequest } from "./UpdatePartnersRequest.js";
7
+ export type { RejectPartnerRequest } from "./RejectPartnerRequest.js";
8
+ export type { SuspendPartnerRequest } from "./SuspendPartnerRequest.js";
9
+ export type { UpdatePartnerRequest } from "./UpdatePartnerRequest.js";
@@ -1 +1 @@
1
- export { CreatePartnersRequest } from "./CreatePartnersRequest.js";
1
+ export { CreatePartnerRequest } from "./CreatePartnerRequest.js";
@@ -1,5 +1,5 @@
1
1
  import type * as ToltApi from "../../../index.js";
2
- export interface RejectPartnersResponse {
2
+ export interface ApprovePartnerResponse {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data: ToltApi.Partner;
@@ -1,5 +1,5 @@
1
1
  import type * as ToltApi from "../../../index.js";
2
- export interface CreatePartnersResponse {
2
+ export interface CreatePartnerResponse {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data: ToltApi.CreatedPartner;
@@ -1,5 +1,5 @@
1
1
  import type * as ToltApi from "../../../index.js";
2
- export interface GetPartnersResponse {
2
+ export interface GetPartnerResponse {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data: ToltApi.PartnerDetails;
@@ -1,5 +1,5 @@
1
1
  import type * as ToltApi from "../../../index.js";
2
- export interface UpdatePartnersResponse {
2
+ export interface RejectPartnerResponse {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data: ToltApi.Partner;
@@ -1,5 +1,5 @@
1
1
  import type * as ToltApi from "../../../index.js";
2
- export interface ApprovePartnersResponse {
2
+ export interface SuspendPartnerResponse {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data: ToltApi.Partner;
@@ -1,5 +1,5 @@
1
1
  import type * as ToltApi from "../../../index.js";
2
- export interface SuspendPartnersResponse {
2
+ export interface UpdatePartnerResponse {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data: ToltApi.Partner;
@@ -1,12 +1,12 @@
1
- export * from "./ApprovePartnersResponse.js";
1
+ export * from "./ApprovePartnerResponse.js";
2
2
  export * from "./BulkApprovePartnersResponse.js";
3
3
  export * from "./BulkRejectPartnersResponse.js";
4
- export * from "./CreatePartnersResponse.js";
5
- export * from "./GetPartnersResponse.js";
4
+ export * from "./CreatePartnerResponse.js";
5
+ export * from "./GetPartnerResponse.js";
6
6
  export * from "./ListPartnersRequestOrder.js";
7
7
  export * from "./ListPartnersRequestSort.js";
8
8
  export * from "./ListPartnersRequestStatus.js";
9
9
  export * from "./ListPartnersResponse.js";
10
- export * from "./RejectPartnersResponse.js";
11
- export * from "./SuspendPartnersResponse.js";
12
- export * from "./UpdatePartnersResponse.js";
10
+ export * from "./RejectPartnerResponse.js";
11
+ export * from "./SuspendPartnerResponse.js";
12
+ export * from "./UpdatePartnerResponse.js";
@@ -1,12 +1,12 @@
1
- export * from "./ApprovePartnersResponse.js";
1
+ export * from "./ApprovePartnerResponse.js";
2
2
  export * from "./BulkApprovePartnersResponse.js";
3
3
  export * from "./BulkRejectPartnersResponse.js";
4
- export * from "./CreatePartnersResponse.js";
5
- export * from "./GetPartnersResponse.js";
4
+ export * from "./CreatePartnerResponse.js";
5
+ export * from "./GetPartnerResponse.js";
6
6
  export * from "./ListPartnersRequestOrder.js";
7
7
  export * from "./ListPartnersRequestSort.js";
8
8
  export * from "./ListPartnersRequestStatus.js";
9
9
  export * from "./ListPartnersResponse.js";
10
- export * from "./RejectPartnersResponse.js";
11
- export * from "./SuspendPartnersResponse.js";
12
- export * from "./UpdatePartnersResponse.js";
10
+ export * from "./RejectPartnerResponse.js";
11
+ export * from "./SuspendPartnerResponse.js";
12
+ export * from "./UpdatePartnerResponse.js";
@@ -26,12 +26,11 @@ export declare class ProgramsClient {
26
26
  * @example
27
27
  * await client.programs.list()
28
28
  */
29
- list(request?: ToltApi.ListProgramsRequest, requestOptions?: ProgramsClient.RequestOptions): core.HttpResponsePromise<ToltApi.ListProgramsResponse>;
30
- private __list;
29
+ list(request?: ToltApi.ListProgramsRequest, requestOptions?: ProgramsClient.RequestOptions): Promise<core.Page<ToltApi.Program, ToltApi.ListProgramsResponse>>;
31
30
  /**
32
31
  * Gets a program by ID, with its name, currency, website, cookie duration and payout terms.
33
32
  *
34
- * @param {ToltApi.GetProgramsRequest} request
33
+ * @param {ToltApi.GetProgramRequest} request
35
34
  * @param {ProgramsClient.RequestOptions} requestOptions - Request-specific configuration.
36
35
  *
37
36
  * @throws {@link ToltApi.UnauthorizedError}
@@ -46,6 +45,6 @@ export declare class ProgramsClient {
46
45
  * id: "prg_T6z8aRW3XCmvFWP972RKxpAd"
47
46
  * })
48
47
  */
49
- get(request: ToltApi.GetProgramsRequest, requestOptions?: ProgramsClient.RequestOptions): core.HttpResponsePromise<ToltApi.GetProgramsResponse>;
48
+ get(request: ToltApi.GetProgramRequest, requestOptions?: ProgramsClient.RequestOptions): core.HttpResponsePromise<ToltApi.GetProgramResponse>;
50
49
  private __get;
51
50
  }
@@ -26,69 +26,79 @@ export class ProgramsClient {
26
26
  * @example
27
27
  * await client.programs.list()
28
28
  */
29
- list(request = {}, requestOptions) {
30
- return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
31
- }
32
- async __list(request = {}, requestOptions) {
33
- const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, search, } = request;
34
- const _queryParams = {
35
- limit,
36
- order: order != null ? order : undefined,
37
- sort: sort != null ? sort : undefined,
38
- starting_after: startingAfter,
39
- ending_before: endingBefore,
40
- created_after: createdAfter != null ? createdAfter : undefined,
41
- created_before: createdBefore != null ? createdBefore : undefined,
42
- updated_after: updatedAfter != null ? updatedAfter : undefined,
43
- updated_before: updatedBefore != null ? updatedBefore : undefined,
44
- search,
45
- };
46
- const _authRequest = await this._options.authProvider.getAuthRequest();
47
- const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
48
- const _response = await core.fetcher({
49
- url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
50
- (await core.Supplier.get(this._options.environment)) ??
51
- environments.ToltApiEnvironment.Default, "v2/programs"),
52
- method: "GET",
53
- headers: _headers,
54
- queryString: core.url
55
- .queryBuilder()
56
- .addMany(_queryParams)
57
- .mergeAdditional(requestOptions?.queryParams)
58
- .build(),
59
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
60
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
61
- abortSignal: requestOptions?.abortSignal,
62
- fetchFn: this._options?.fetch,
63
- logging: this._options.logging,
64
- });
65
- if (_response.ok) {
66
- return { data: _response.body, rawResponse: _response.rawResponse };
67
- }
68
- if (_response.error.reason === "status-code") {
69
- switch (_response.error.statusCode) {
70
- case 400:
71
- throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
72
- case 401:
73
- throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
74
- case 413:
75
- throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
76
- case 429:
77
- throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
78
- default:
79
- throw new errors.ToltApiError({
80
- statusCode: _response.error.statusCode,
81
- body: _response.error.body,
82
- rawResponse: _response.rawResponse,
83
- });
29
+ async list(request = {}, requestOptions) {
30
+ const list = core.HttpResponsePromise.interceptFunction(async (request) => {
31
+ const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, search, } = request;
32
+ const _queryParams = {
33
+ limit,
34
+ order: order != null ? order : undefined,
35
+ sort: sort != null ? sort : undefined,
36
+ starting_after: startingAfter,
37
+ ending_before: endingBefore,
38
+ created_after: createdAfter != null ? createdAfter : undefined,
39
+ created_before: createdBefore != null ? createdBefore : undefined,
40
+ updated_after: updatedAfter != null ? updatedAfter : undefined,
41
+ updated_before: updatedBefore != null ? updatedBefore : undefined,
42
+ search,
43
+ };
44
+ const _authRequest = await this._options.authProvider.getAuthRequest();
45
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
46
+ const _response = await core.fetcher({
47
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
48
+ (await core.Supplier.get(this._options.environment)) ??
49
+ environments.ToltApiEnvironment.Default, "v2/programs"),
50
+ method: "GET",
51
+ headers: _headers,
52
+ queryString: core.url
53
+ .queryBuilder()
54
+ .addMany(_queryParams)
55
+ .mergeAdditional(requestOptions?.queryParams)
56
+ .build(),
57
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
58
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
59
+ abortSignal: requestOptions?.abortSignal,
60
+ fetchFn: this._options?.fetch,
61
+ logging: this._options.logging,
62
+ });
63
+ if (_response.ok) {
64
+ return { data: _response.body, rawResponse: _response.rawResponse };
84
65
  }
85
- }
86
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/programs");
66
+ if (_response.error.reason === "status-code") {
67
+ switch (_response.error.statusCode) {
68
+ case 400:
69
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
70
+ case 401:
71
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
72
+ case 413:
73
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
74
+ case 429:
75
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
76
+ default:
77
+ throw new errors.ToltApiError({
78
+ statusCode: _response.error.statusCode,
79
+ body: _response.error.body,
80
+ rawResponse: _response.rawResponse,
81
+ });
82
+ }
83
+ }
84
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/programs");
85
+ });
86
+ const dataWithRawResponse = await list(request).withRawResponse();
87
+ return new core.Page({
88
+ response: dataWithRawResponse.data,
89
+ rawResponse: dataWithRawResponse.rawResponse,
90
+ hasNextPage: (response) => response?.next_cursor != null &&
91
+ !(typeof response?.next_cursor === "string" && response?.next_cursor === ""),
92
+ getItems: (response) => response?.data ?? [],
93
+ loadPage: (response) => {
94
+ return list(core.setObjectProperty(request, "starting_after", response?.next_cursor));
95
+ },
96
+ });
87
97
  }
88
98
  /**
89
99
  * Gets a program by ID, with its name, currency, website, cookie duration and payout terms.
90
100
  *
91
- * @param {ToltApi.GetProgramsRequest} request
101
+ * @param {ToltApi.GetProgramRequest} request
92
102
  * @param {ProgramsClient.RequestOptions} requestOptions - Request-specific configuration.
93
103
  *
94
104
  * @throws {@link ToltApi.UnauthorizedError}
@@ -113,7 +123,7 @@ export class ProgramsClient {
113
123
  const _response = await core.fetcher({
114
124
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
115
125
  (await core.Supplier.get(this._options.environment)) ??
116
- environments.ToltApiEnvironment.Default, `v2/programs/${core.url.encodePathParam(id)}`),
126
+ environments.ToltApiEnvironment.Default, `v2/programs/${core.url.encodePathParam(id, errors.ToltApiError)}`),
117
127
  method: "GET",
118
128
  headers: _headers,
119
129
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
@@ -4,6 +4,6 @@
4
4
  * id: "prg_T6z8aRW3XCmvFWP972RKxpAd"
5
5
  * }
6
6
  */
7
- export interface GetProgramsRequest {
7
+ export interface GetProgramRequest {
8
8
  id: string;
9
9
  }
@@ -1,2 +1,2 @@
1
- export type { GetProgramsRequest } from "./GetProgramsRequest.js";
1
+ export type { GetProgramRequest } from "./GetProgramRequest.js";
2
2
  export type { ListProgramsRequest } from "./ListProgramsRequest.js";