@tolt/api 0.7.0 → 1.0.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.
- package/dist/BaseClient.js +1 -0
- package/dist/Client.d.ts +3 -3
- package/dist/Client.js +3 -3
- package/dist/api/errors/BadRequestError.d.ts +2 -2
- package/dist/api/errors/ConflictError.d.ts +2 -2
- package/dist/api/errors/ContentTooLargeError.d.ts +2 -2
- package/dist/api/errors/NotFoundError.d.ts +2 -2
- package/dist/api/errors/TooManyRequestsError.d.ts +2 -2
- package/dist/api/errors/UnauthorizedError.d.ts +2 -2
- package/dist/api/resources/clicks/client/Client.d.ts +10 -7
- package/dist/api/resources/clicks/client/Client.js +82 -68
- package/dist/api/resources/clicks/client/requests/CreateClickRequest.d.ts +28 -0
- package/dist/api/resources/clicks/client/requests/{GetClicksRequest.d.ts → GetClickRequest.d.ts} +1 -1
- package/dist/api/resources/clicks/client/requests/index.d.ts +2 -1
- package/dist/api/resources/clicks/types/{CreateClicksResponse.d.ts → CreateClickResponse.d.ts} +1 -1
- package/dist/api/resources/clicks/types/{GetClicksResponse.d.ts → GetClickResponse.d.ts} +1 -1
- package/dist/api/resources/clicks/types/index.d.ts +2 -3
- package/dist/api/resources/clicks/types/index.js +2 -3
- package/dist/api/resources/commissions/client/Client.d.ts +19 -15
- package/dist/api/resources/commissions/client/Client.js +94 -76
- package/dist/api/resources/commissions/client/requests/{DeleteCommissionsRequest.d.ts → ApproveCommissionRequest.d.ts} +1 -1
- package/dist/api/resources/commissions/client/requests/CreateCommissionRequest.d.ts +40 -0
- package/dist/api/resources/commissions/client/requests/CreateCommissionRequest.js +9 -0
- package/dist/api/resources/commissions/client/requests/{DeclineCommissionsRequest.d.ts → DeclineCommissionRequest.d.ts} +1 -1
- package/dist/api/resources/commissions/client/requests/{ApproveCommissionsRequest.d.ts → DeleteCommissionRequest.d.ts} +1 -1
- package/dist/api/resources/commissions/client/requests/{GetCommissionsRequest.d.ts → GetCommissionRequest.d.ts} +1 -1
- package/dist/api/resources/commissions/client/requests/{UpdateCommissionsRequest.d.ts → UpdateCommissionRequest.d.ts} +3 -3
- package/dist/api/resources/commissions/client/requests/UpdateCommissionRequest.js +9 -0
- package/dist/api/resources/commissions/client/requests/index.d.ts +6 -5
- package/dist/api/resources/commissions/client/requests/index.js +2 -1
- package/dist/api/resources/commissions/types/{UpdateCommissionsResponse.d.ts → ApproveCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/{DeleteCommissionsResponse.d.ts → CreateCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/{CreateCommissionsResponse.d.ts → DeclineCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/DeleteCommissionResponse.d.ts +6 -0
- package/dist/api/resources/commissions/types/{GetCommissionsResponse.d.ts → GetCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/UpdateCommissionResponse.d.ts +6 -0
- package/dist/api/resources/commissions/types/index.d.ts +6 -7
- package/dist/api/resources/commissions/types/index.js +6 -7
- package/dist/api/resources/customers/client/Client.d.ts +9 -10
- package/dist/api/resources/customers/client/Client.js +84 -71
- package/dist/api/resources/customers/client/requests/{CreateCustomersRequest.d.ts → CreateCustomerRequest.d.ts} +3 -3
- package/dist/api/resources/customers/client/requests/{CreateCustomersRequest.js → CreateCustomerRequest.js} +4 -4
- package/dist/api/resources/customers/client/requests/{DeleteCustomersRequest.d.ts → DeleteCustomerRequest.d.ts} +1 -1
- package/dist/api/resources/customers/client/requests/{GetCustomersRequest.d.ts → GetCustomerRequest.d.ts} +1 -1
- package/dist/api/resources/customers/client/requests/{UpdateCustomersRequest.d.ts → UpdateCustomerRequest.d.ts} +3 -3
- package/dist/api/resources/customers/client/requests/{UpdateCustomersRequest.js → UpdateCustomerRequest.js} +4 -4
- package/dist/api/resources/customers/client/requests/index.d.ts +4 -4
- package/dist/api/resources/customers/client/requests/index.js +2 -2
- package/dist/api/resources/customers/types/{DeleteCustomersResponse.d.ts → CreateCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/{UpdateCustomersResponse.d.ts → DeleteCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/{GetCustomersResponse.d.ts → GetCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/{CreateCustomersResponse.d.ts → UpdateCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/index.d.ts +4 -4
- package/dist/api/resources/customers/types/index.js +4 -4
- package/dist/api/resources/{embed → embedTokens}/client/Client.d.ts +9 -11
- package/dist/api/resources/{embed → embedTokens}/client/Client.js +7 -9
- package/dist/api/resources/embedTokens/client/index.d.ts +1 -0
- package/dist/api/resources/embedTokens/client/index.js +1 -0
- package/dist/api/resources/embedTokens/client/requests/CreateEmbedTokenRequest.d.ts +21 -0
- package/dist/api/resources/embedTokens/client/requests/index.d.ts +1 -0
- package/dist/api/resources/embedTokens/exports.d.ts +2 -0
- package/dist/api/resources/{embed → embedTokens}/exports.js +1 -1
- package/dist/api/resources/{embed/types/CreateTokenEmbedResponse.d.ts → embedTokens/types/CreateEmbedTokenResponse.d.ts} +1 -1
- package/dist/api/resources/embedTokens/types/index.d.ts +1 -0
- package/dist/api/resources/embedTokens/types/index.js +1 -0
- package/dist/api/resources/flows/client/Client.d.ts +3 -4
- package/dist/api/resources/flows/client/Client.js +74 -64
- package/dist/api/resources/flows/client/requests/{GetFlowsRequest.d.ts → GetFlowRequest.d.ts} +1 -1
- package/dist/api/resources/flows/client/requests/ListFlowsRequest.d.ts +1 -1
- package/dist/api/resources/flows/client/requests/index.d.ts +1 -1
- package/dist/api/resources/flows/types/{GetFlowsResponse.d.ts → GetFlowResponse.d.ts} +1 -1
- package/dist/api/resources/flows/types/index.d.ts +1 -2
- package/dist/api/resources/flows/types/index.js +1 -2
- package/dist/api/resources/groups/client/Client.d.ts +3 -4
- package/dist/api/resources/groups/client/Client.js +71 -61
- package/dist/api/resources/groups/client/requests/{GetGroupsRequest.d.ts → GetGroupRequest.d.ts} +1 -1
- package/dist/api/resources/groups/client/requests/ListGroupsRequest.d.ts +1 -1
- package/dist/api/resources/groups/client/requests/index.d.ts +1 -1
- package/dist/api/resources/groups/types/{GetGroupsResponse.d.ts → GetGroupResponse.d.ts} +1 -1
- package/dist/api/resources/groups/types/index.d.ts +1 -2
- package/dist/api/resources/groups/types/index.js +1 -2
- package/dist/api/resources/index.d.ts +3 -2
- package/dist/api/resources/index.js +3 -2
- package/dist/api/resources/links/client/Client.d.ts +11 -12
- package/dist/api/resources/links/client/Client.js +80 -70
- package/dist/api/resources/links/client/requests/{CreateLinksRequest.d.ts → CreateLinkRequest.d.ts} +1 -1
- package/dist/api/resources/links/client/requests/{DeleteLinksRequest.d.ts → DeleteLinkRequest.d.ts} +1 -1
- package/dist/api/resources/links/client/requests/{GetByParamValueLinksRequest.d.ts → GetLinkByParamValueRequest.d.ts} +1 -1
- package/dist/api/resources/links/client/requests/{GetLinksRequest.d.ts → GetLinkRequest.d.ts} +1 -1
- package/dist/api/resources/links/client/requests/{UpdateLinksRequest.d.ts → UpdateLinkRequest.d.ts} +1 -1
- package/dist/api/resources/links/client/requests/index.d.ts +5 -5
- package/dist/api/resources/links/types/{DeleteLinksResponse.d.ts → CreateLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/{CreateLinksResponse.d.ts → DeleteLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/GetLinkByParamValueResponse.d.ts +6 -0
- package/dist/api/resources/links/types/{GetLinksResponse.d.ts → GetLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/{UpdateLinksResponse.d.ts → UpdateLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/index.d.ts +5 -5
- package/dist/api/resources/links/types/index.js +5 -5
- package/dist/api/resources/partners/client/Client.d.ts +13 -14
- package/dist/api/resources/partners/client/Client.js +82 -72
- package/dist/api/resources/partners/client/requests/{ApprovePartnersRequest.d.ts → ApprovePartnerRequest.d.ts} +1 -1
- package/dist/api/resources/partners/client/requests/{CreatePartnersRequest.d.ts → CreatePartnerRequest.d.ts} +4 -4
- package/dist/api/resources/partners/client/requests/{CreatePartnersRequest.js → CreatePartnerRequest.js} +4 -4
- package/dist/api/resources/partners/client/requests/{GetPartnersRequest.d.ts → GetPartnerRequest.d.ts} +1 -1
- package/dist/api/resources/partners/client/requests/{RejectPartnersRequest.d.ts → RejectPartnerRequest.d.ts} +1 -1
- package/dist/api/resources/partners/client/requests/{SuspendPartnersRequest.d.ts → SuspendPartnerRequest.d.ts} +1 -1
- package/dist/api/resources/partners/client/requests/{UpdatePartnersRequest.d.ts → UpdatePartnerRequest.d.ts} +1 -1
- package/dist/api/resources/partners/client/requests/index.d.ts +6 -6
- package/dist/api/resources/partners/client/requests/index.js +1 -1
- package/dist/api/resources/partners/types/{RejectPartnersResponse.d.ts → ApprovePartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{CreatePartnersResponse.d.ts → CreatePartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{GetPartnersResponse.d.ts → GetPartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{UpdatePartnersResponse.d.ts → RejectPartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{ApprovePartnersResponse.d.ts → SuspendPartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{SuspendPartnersResponse.d.ts → UpdatePartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/index.d.ts +6 -6
- package/dist/api/resources/partners/types/index.js +6 -6
- package/dist/api/resources/programs/client/Client.d.ts +3 -4
- package/dist/api/resources/programs/client/Client.js +69 -59
- package/dist/api/resources/programs/client/requests/{GetProgramsRequest.d.ts → GetProgramRequest.d.ts} +1 -1
- package/dist/api/resources/programs/client/requests/index.d.ts +1 -1
- package/dist/api/resources/programs/types/{GetProgramsResponse.d.ts → GetProgramResponse.d.ts} +1 -1
- package/dist/api/resources/programs/types/index.d.ts +1 -1
- package/dist/api/resources/programs/types/index.js +1 -1
- package/dist/api/resources/promotionCodes/client/Client.d.ts +9 -10
- package/dist/api/resources/promotionCodes/client/Client.js +81 -68
- package/dist/api/resources/promotionCodes/client/requests/{CreatePromotionCodesRequest.d.ts → CreatePromotionCodeRequest.d.ts} +3 -3
- package/dist/api/resources/promotionCodes/client/requests/{CreatePromotionCodesRequest.js → CreatePromotionCodeRequest.js} +4 -4
- package/dist/api/resources/promotionCodes/client/requests/{DeletePromotionCodesRequest.d.ts → DeletePromotionCodeRequest.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/client/requests/{GetPromotionCodesRequest.d.ts → GetPromotionCodeRequest.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/client/requests/{UpdatePromotionCodesRequest.d.ts → UpdatePromotionCodeRequest.d.ts} +3 -3
- package/dist/api/resources/promotionCodes/client/requests/{UpdatePromotionCodesRequest.js → UpdatePromotionCodeRequest.js} +4 -4
- package/dist/api/resources/promotionCodes/client/requests/index.d.ts +4 -4
- package/dist/api/resources/promotionCodes/client/requests/index.js +2 -2
- package/dist/api/resources/promotionCodes/types/{CreatePromotionCodesResponse.d.ts → CreatePromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/{DeletePromotionCodesResponse.d.ts → DeletePromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/{GetPromotionCodesResponse.d.ts → GetPromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/{UpdatePromotionCodesResponse.d.ts → UpdatePromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/index.d.ts +4 -4
- package/dist/api/resources/promotionCodes/types/index.js +4 -4
- package/dist/api/resources/reports/client/Client.d.ts +12 -14
- package/dist/api/resources/reports/client/Client.js +158 -119
- package/dist/api/resources/reports/client/requests/{CustomerStatsReportsRequest.d.ts → ReportsCustomersRequest.d.ts} +1 -1
- package/dist/api/resources/reports/client/requests/{LinksReportsRequest.d.ts → ReportsLinksRequest.d.ts} +1 -1
- package/dist/api/resources/reports/client/requests/{OverviewReportsRequest.d.ts → ReportsOverviewRequest.d.ts} +1 -1
- package/dist/api/resources/reports/client/requests/{PartnersReportsRequest.d.ts → ReportsPartnersRequest.d.ts} +1 -1
- package/dist/api/resources/reports/client/requests/{TimeseriesReportsRequest.d.ts → ReportsTimeseriesRequest.d.ts} +1 -1
- package/dist/api/resources/reports/client/requests/index.d.ts +5 -5
- package/dist/api/resources/reports/types/{CustomerStatsReportsResponse.d.ts → ReportsCustomersResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{LinksReportsResponse.d.ts → ReportsLinksResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{OverviewReportsResponse.d.ts → ReportsOverviewResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{PartnersReportsResponse.d.ts → ReportsPartnersResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{TimeseriesReportsResponse.d.ts → ReportsTimeseriesResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/index.d.ts +5 -5
- package/dist/api/resources/reports/types/index.js +5 -5
- package/dist/api/resources/transactions/client/Client.d.ts +13 -14
- package/dist/api/resources/transactions/client/Client.js +87 -74
- package/dist/api/resources/transactions/client/requests/{CreateTransactionsRequest.d.ts → CreateTransactionRequest.d.ts} +1 -1
- package/dist/api/resources/transactions/client/requests/{DeleteTransactionsRequest.d.ts → DeleteTransactionRequest.d.ts} +1 -1
- package/dist/api/resources/transactions/client/requests/{GetTransactionsRequest.d.ts → GetTransactionRequest.d.ts} +1 -1
- package/dist/api/resources/transactions/client/requests/{RefundTransactionsRequest.d.ts → RefundTransactionRequest.d.ts} +1 -1
- package/dist/api/resources/transactions/client/requests/{RerunFlowsTransactionsRequest.d.ts → RerunTransactionFlowsRequest.d.ts} +1 -1
- package/dist/api/resources/transactions/client/requests/{UpdateTransactionsRequest.d.ts → UpdateTransactionRequest.d.ts} +1 -1
- package/dist/api/resources/transactions/client/requests/index.d.ts +6 -6
- package/dist/api/resources/transactions/types/{CreateTransactionsResponse.d.ts → CreateTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{DeleteTransactionsResponse.d.ts → DeleteTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{GetTransactionsResponse.d.ts → GetTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{RefundTransactionsResponse.d.ts → RefundTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{RerunFlowsTransactionsResponse.d.ts → RerunTransactionFlowsResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/UpdateTransactionResponse.d.ts +6 -0
- package/dist/api/resources/transactions/types/index.d.ts +6 -6
- package/dist/api/resources/transactions/types/index.js +6 -6
- package/dist/api/types/{Error_.d.ts → ErrorResponse.d.ts} +4 -4
- package/dist/api/types/{Error_.js → ErrorResponse.js} +4 -4
- package/dist/api/types/index.d.ts +1 -1
- package/dist/api/types/index.js +1 -1
- package/dist/core/exports.d.ts +1 -0
- package/dist/core/exports.js +1 -0
- package/dist/core/fetcher/Fetcher.js +35 -4
- package/dist/core/fetcher/getErrorResponseBody.js +21 -8
- package/dist/core/fetcher/getResponseBody.d.ts +16 -0
- package/dist/core/fetcher/getResponseBody.js +26 -22
- package/dist/core/fetcher/makePassthroughRequest.js +18 -2
- package/dist/core/fetcher/makeRequest.d.ts +6 -1
- package/dist/core/fetcher/makeRequest.js +45 -13
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -1
- package/dist/core/fetcher/requestWithRetries.js +23 -2
- package/dist/core/fetcher/signals.d.ts +1 -0
- package/dist/core/fetcher/signals.js +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/pagination/Page.d.ts +33 -0
- package/dist/core/pagination/Page.js +49 -0
- package/dist/core/pagination/exports.d.ts +1 -0
- package/dist/core/pagination/index.d.ts +1 -0
- package/dist/core/pagination/index.js +1 -0
- package/dist/core/url/encodePathParam.d.ts +3 -1
- package/dist/core/url/encodePathParam.js +8 -2
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.js +1 -0
- package/dist/core/utils/setObjectProperty.d.ts +12 -0
- package/dist/core/utils/setObjectProperty.js +45 -0
- package/dist/errors/ToltApiError.js +15 -1
- package/package.json +7 -2
- package/dist/api/resources/clicks/types/CreateClicksRequest.d.ts +0 -1
- package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.js +0 -9
- package/dist/api/resources/commissions/types/ApproveCommissionsResponse.d.ts +0 -6
- package/dist/api/resources/commissions/types/CreateCommissionsRequest.d.ts +0 -1
- package/dist/api/resources/commissions/types/DeclineCommissionsResponse.d.ts +0 -6
- package/dist/api/resources/embed/exports.d.ts +0 -2
- package/dist/api/resources/embed/types/CreateTokenEmbedRequest.d.ts +0 -1
- package/dist/api/resources/embed/types/index.d.ts +0 -2
- package/dist/api/resources/embed/types/index.js +0 -2
- package/dist/api/resources/flows/types/ListFlowsRequestActive.d.ts +0 -6
- package/dist/api/resources/flows/types/ListFlowsRequestActive.js +0 -6
- package/dist/api/resources/groups/types/ListGroupsRequestDefault.d.ts +0 -6
- package/dist/api/resources/groups/types/ListGroupsRequestDefault.js +0 -6
- package/dist/api/resources/links/types/GetByParamValueLinksResponse.d.ts +0 -6
- package/dist/api/resources/transactions/types/UpdateTransactionsResponse.d.ts +0 -6
- package/dist/api/resources/transactions/types/UpdateTransactionsResponse.js +0 -2
- /package/dist/api/resources/clicks/client/requests/{GetClicksRequest.js → CreateClickRequest.js} +0 -0
- /package/dist/api/resources/clicks/{types/CreateClicksRequest.js → client/requests/GetClickRequest.js} +0 -0
- /package/dist/api/resources/clicks/types/{CreateClicksResponse.js → CreateClickResponse.js} +0 -0
- /package/dist/api/resources/clicks/types/{GetClicksResponse.js → GetClickResponse.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{ApproveCommissionsRequest.js → ApproveCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{DeclineCommissionsRequest.js → DeclineCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{DeleteCommissionsRequest.js → DeleteCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{GetCommissionsRequest.js → GetCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/types/{ApproveCommissionsResponse.js → ApproveCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{CreateCommissionsRequest.js → CreateCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{CreateCommissionsResponse.js → DeclineCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{DeclineCommissionsResponse.js → DeleteCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{DeleteCommissionsResponse.js → GetCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{GetCommissionsResponse.js → UpdateCommissionResponse.js} +0 -0
- /package/dist/api/resources/{commissions/types/UpdateCommissionsResponse.js → customers/client/requests/DeleteCustomerRequest.js} +0 -0
- /package/dist/api/resources/customers/client/requests/{DeleteCustomersRequest.js → GetCustomerRequest.js} +0 -0
- /package/dist/api/resources/customers/{client/requests/GetCustomersRequest.js → types/CreateCustomerResponse.js} +0 -0
- /package/dist/api/resources/customers/types/{CreateCustomersResponse.js → DeleteCustomerResponse.js} +0 -0
- /package/dist/api/resources/customers/types/{DeleteCustomersResponse.js → GetCustomerResponse.js} +0 -0
- /package/dist/api/resources/customers/types/{GetCustomersResponse.js → UpdateCustomerResponse.js} +0 -0
- /package/dist/api/resources/{customers/types/UpdateCustomersResponse.js → embedTokens/client/requests/CreateEmbedTokenRequest.js} +0 -0
- /package/dist/api/resources/{embed/client → embedTokens/client/requests}/index.js +0 -0
- /package/dist/api/resources/{embed → embedTokens}/index.d.ts +0 -0
- /package/dist/api/resources/{embed → embedTokens}/index.js +0 -0
- /package/dist/api/resources/{embed/types/CreateTokenEmbedRequest.js → embedTokens/types/CreateEmbedTokenResponse.js} +0 -0
- /package/dist/api/resources/{embed/types/CreateTokenEmbedResponse.js → flows/client/requests/GetFlowRequest.js} +0 -0
- /package/dist/api/resources/flows/{client/requests/GetFlowsRequest.js → types/GetFlowResponse.js} +0 -0
- /package/dist/api/resources/{flows/types/GetFlowsResponse.js → groups/client/requests/GetGroupRequest.js} +0 -0
- /package/dist/api/resources/groups/{client/requests/GetGroupsRequest.js → types/GetGroupResponse.js} +0 -0
- /package/dist/api/resources/{groups/types/GetGroupsResponse.js → links/client/requests/CreateLinkRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{CreateLinksRequest.js → DeleteLinkRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{DeleteLinksRequest.js → GetLinkByParamValueRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{GetByParamValueLinksRequest.js → GetLinkRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{GetLinksRequest.js → UpdateLinkRequest.js} +0 -0
- /package/dist/api/resources/links/{client/requests/UpdateLinksRequest.js → types/CreateLinkResponse.js} +0 -0
- /package/dist/api/resources/links/types/{CreateLinksResponse.js → DeleteLinkResponse.js} +0 -0
- /package/dist/api/resources/links/types/{DeleteLinksResponse.js → GetLinkByParamValueResponse.js} +0 -0
- /package/dist/api/resources/links/types/{GetByParamValueLinksResponse.js → GetLinkResponse.js} +0 -0
- /package/dist/api/resources/links/types/{GetLinksResponse.js → UpdateLinkResponse.js} +0 -0
- /package/dist/api/resources/{links/types/UpdateLinksResponse.js → partners/client/requests/ApprovePartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{ApprovePartnersRequest.js → GetPartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{GetPartnersRequest.js → RejectPartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{RejectPartnersRequest.js → SuspendPartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{SuspendPartnersRequest.js → UpdatePartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/{client/requests/UpdatePartnersRequest.js → types/ApprovePartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{ApprovePartnersResponse.js → CreatePartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{CreatePartnersResponse.js → GetPartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{GetPartnersResponse.js → RejectPartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{RejectPartnersResponse.js → SuspendPartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{SuspendPartnersResponse.js → UpdatePartnerResponse.js} +0 -0
- /package/dist/api/resources/{partners/types/UpdatePartnersResponse.js → programs/client/requests/GetProgramRequest.js} +0 -0
- /package/dist/api/resources/programs/{client/requests/GetProgramsRequest.js → types/GetProgramResponse.js} +0 -0
- /package/dist/api/resources/{programs/types/GetProgramsResponse.js → promotionCodes/client/requests/DeletePromotionCodeRequest.js} +0 -0
- /package/dist/api/resources/promotionCodes/client/requests/{DeletePromotionCodesRequest.js → GetPromotionCodeRequest.js} +0 -0
- /package/dist/api/resources/promotionCodes/{client/requests/GetPromotionCodesRequest.js → types/CreatePromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/promotionCodes/types/{CreatePromotionCodesResponse.js → DeletePromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/promotionCodes/types/{DeletePromotionCodesResponse.js → GetPromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/promotionCodes/types/{GetPromotionCodesResponse.js → UpdatePromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/{promotionCodes/types/UpdatePromotionCodesResponse.js → reports/client/requests/ReportsCustomersRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{CustomerStatsReportsRequest.js → ReportsLinksRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{LinksReportsRequest.js → ReportsOverviewRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{OverviewReportsRequest.js → ReportsPartnersRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{PartnersReportsRequest.js → ReportsTimeseriesRequest.js} +0 -0
- /package/dist/api/resources/reports/{client/requests/TimeseriesReportsRequest.js → types/ReportsCustomersResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{CustomerStatsReportsResponse.js → ReportsLinksResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{LinksReportsResponse.js → ReportsOverviewResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{OverviewReportsResponse.js → ReportsPartnersResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{PartnersReportsResponse.js → ReportsTimeseriesResponse.js} +0 -0
- /package/dist/api/resources/{reports/types/TimeseriesReportsResponse.js → transactions/client/requests/CreateTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{CreateTransactionsRequest.js → DeleteTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{DeleteTransactionsRequest.js → GetTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{GetTransactionsRequest.js → RefundTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{RefundTransactionsRequest.js → RerunTransactionFlowsRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{RerunFlowsTransactionsRequest.js → UpdateTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/{client/requests/UpdateTransactionsRequest.js → types/CreateTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{CreateTransactionsResponse.js → DeleteTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{DeleteTransactionsResponse.js → GetTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{GetTransactionsResponse.js → RefundTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{RefundTransactionsResponse.js → RerunTransactionFlowsResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{RerunFlowsTransactionsResponse.js → UpdateTransactionResponse.js} +0 -0
- /package/dist/{api/resources/embed/client/index.d.ts → core/pagination/exports.js} +0 -0
|
@@ -27,73 +27,86 @@ export class TransactionsClient {
|
|
|
27
27
|
* @example
|
|
28
28
|
* await client.transactions.list()
|
|
29
29
|
*/
|
|
30
|
-
list(request = {}, requestOptions) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (_response.error.reason === "status-code") {
|
|
74
|
-
switch (_response.error.statusCode) {
|
|
75
|
-
case 400:
|
|
76
|
-
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
77
|
-
case 401:
|
|
78
|
-
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
79
|
-
case 413:
|
|
80
|
-
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
81
|
-
case 429:
|
|
82
|
-
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
83
|
-
default:
|
|
84
|
-
throw new errors.ToltApiError({
|
|
85
|
-
statusCode: _response.error.statusCode,
|
|
86
|
-
body: _response.error.body,
|
|
87
|
-
rawResponse: _response.rawResponse,
|
|
88
|
-
});
|
|
30
|
+
async list(request = {}, requestOptions) {
|
|
31
|
+
const list = core.HttpResponsePromise.interceptFunction(async (request) => {
|
|
32
|
+
const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, program_id: programId, partner_id: partnerId, customer_id: customerId, status, search, } = request;
|
|
33
|
+
const _queryParams = {
|
|
34
|
+
limit,
|
|
35
|
+
order: order != null ? order : undefined,
|
|
36
|
+
sort: sort != null ? sort : undefined,
|
|
37
|
+
starting_after: startingAfter,
|
|
38
|
+
ending_before: endingBefore,
|
|
39
|
+
created_after: createdAfter != null ? createdAfter : undefined,
|
|
40
|
+
created_before: createdBefore != null ? createdBefore : undefined,
|
|
41
|
+
updated_after: updatedAfter != null ? updatedAfter : undefined,
|
|
42
|
+
updated_before: updatedBefore != null ? updatedBefore : undefined,
|
|
43
|
+
program_id: programId,
|
|
44
|
+
partner_id: partnerId,
|
|
45
|
+
customer_id: customerId,
|
|
46
|
+
status,
|
|
47
|
+
search,
|
|
48
|
+
};
|
|
49
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
50
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
51
|
+
const _response = await core.fetcher({
|
|
52
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
53
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
54
|
+
environments.ToltApiEnvironment.Default, "v2/transactions"),
|
|
55
|
+
method: "GET",
|
|
56
|
+
headers: _headers,
|
|
57
|
+
queryString: core.url
|
|
58
|
+
.queryBuilder()
|
|
59
|
+
.addMany(_queryParams)
|
|
60
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
61
|
+
.build(),
|
|
62
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
63
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
64
|
+
abortSignal: requestOptions?.abortSignal,
|
|
65
|
+
fetchFn: this._options?.fetch,
|
|
66
|
+
logging: this._options.logging,
|
|
67
|
+
});
|
|
68
|
+
if (_response.ok) {
|
|
69
|
+
return {
|
|
70
|
+
data: _response.body,
|
|
71
|
+
rawResponse: _response.rawResponse,
|
|
72
|
+
};
|
|
89
73
|
}
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
if (_response.error.reason === "status-code") {
|
|
75
|
+
switch (_response.error.statusCode) {
|
|
76
|
+
case 400:
|
|
77
|
+
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
78
|
+
case 401:
|
|
79
|
+
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
80
|
+
case 413:
|
|
81
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
82
|
+
case 429:
|
|
83
|
+
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
84
|
+
default:
|
|
85
|
+
throw new errors.ToltApiError({
|
|
86
|
+
statusCode: _response.error.statusCode,
|
|
87
|
+
body: _response.error.body,
|
|
88
|
+
rawResponse: _response.rawResponse,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/transactions");
|
|
93
|
+
});
|
|
94
|
+
const dataWithRawResponse = await list(request).withRawResponse();
|
|
95
|
+
return new core.Page({
|
|
96
|
+
response: dataWithRawResponse.data,
|
|
97
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
98
|
+
hasNextPage: (response) => response?.next_cursor != null &&
|
|
99
|
+
!(typeof response?.next_cursor === "string" && response?.next_cursor === ""),
|
|
100
|
+
getItems: (response) => response?.data ?? [],
|
|
101
|
+
loadPage: (response) => {
|
|
102
|
+
return list(core.setObjectProperty(request, "starting_after", response?.next_cursor));
|
|
103
|
+
},
|
|
104
|
+
});
|
|
92
105
|
}
|
|
93
106
|
/**
|
|
94
107
|
* Supports historical created_at values. product_id and product_name are stored and returned in product_ids and product_names arrays.
|
|
95
108
|
*
|
|
96
|
-
* @param {ToltApi.
|
|
109
|
+
* @param {ToltApi.CreateTransactionRequest} request
|
|
97
110
|
* @param {TransactionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
98
111
|
*
|
|
99
112
|
* @throws {@link ToltApi.BadRequestError}
|
|
@@ -132,7 +145,7 @@ export class TransactionsClient {
|
|
|
132
145
|
requestType: "json",
|
|
133
146
|
body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters),
|
|
134
147
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
135
|
-
maxRetries:
|
|
148
|
+
maxRetries: 0,
|
|
136
149
|
abortSignal: requestOptions?.abortSignal,
|
|
137
150
|
fetchFn: this._options?.fetch,
|
|
138
151
|
logging: this._options.logging,
|
|
@@ -165,7 +178,7 @@ export class TransactionsClient {
|
|
|
165
178
|
/**
|
|
166
179
|
* Gets a transaction by ID, with its amount, status, billing details, products and the customer it belongs to.
|
|
167
180
|
*
|
|
168
|
-
* @param {ToltApi.
|
|
181
|
+
* @param {ToltApi.GetTransactionRequest} request
|
|
169
182
|
* @param {TransactionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
170
183
|
*
|
|
171
184
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
@@ -190,7 +203,7 @@ export class TransactionsClient {
|
|
|
190
203
|
const _response = await core.fetcher({
|
|
191
204
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
192
205
|
(await core.Supplier.get(this._options.environment)) ??
|
|
193
|
-
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id)}`),
|
|
206
|
+
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id, errors.ToltApiError)}`),
|
|
194
207
|
method: "GET",
|
|
195
208
|
headers: _headers,
|
|
196
209
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
@@ -226,7 +239,7 @@ export class TransactionsClient {
|
|
|
226
239
|
/**
|
|
227
240
|
* Updates a transaction's amount, status, billing or product details. Refunded transactions cannot be modified.
|
|
228
241
|
*
|
|
229
|
-
* @param {ToltApi.
|
|
242
|
+
* @param {ToltApi.UpdateTransactionRequest} request
|
|
230
243
|
* @param {TransactionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
231
244
|
*
|
|
232
245
|
* @throws {@link ToltApi.BadRequestError}
|
|
@@ -255,7 +268,7 @@ export class TransactionsClient {
|
|
|
255
268
|
const _response = await core.fetcher({
|
|
256
269
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
257
270
|
(await core.Supplier.get(this._options.environment)) ??
|
|
258
|
-
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id)}`),
|
|
271
|
+
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id, errors.ToltApiError)}`),
|
|
259
272
|
method: "PUT",
|
|
260
273
|
headers: _headers,
|
|
261
274
|
contentType: "application/json",
|
|
@@ -298,7 +311,7 @@ export class TransactionsClient {
|
|
|
298
311
|
/**
|
|
299
312
|
* Deletes a transaction. Refunded transactions and transactions that already have commissions cannot be deleted.
|
|
300
313
|
*
|
|
301
|
-
* @param {ToltApi.
|
|
314
|
+
* @param {ToltApi.DeleteTransactionRequest} request
|
|
302
315
|
* @param {TransactionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
303
316
|
*
|
|
304
317
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
@@ -324,7 +337,7 @@ export class TransactionsClient {
|
|
|
324
337
|
const _response = await core.fetcher({
|
|
325
338
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
326
339
|
(await core.Supplier.get(this._options.environment)) ??
|
|
327
|
-
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id)}`),
|
|
340
|
+
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id, errors.ToltApiError)}`),
|
|
328
341
|
method: "DELETE",
|
|
329
342
|
headers: _headers,
|
|
330
343
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
@@ -362,7 +375,7 @@ export class TransactionsClient {
|
|
|
362
375
|
/**
|
|
363
376
|
* Unpaid commissions are zeroed while preserving their original deducted commission amount, and affected draft invoices are recalculated. Paid commissions and commissions linked to legacy autopayout invoices receive a negative reversal.
|
|
364
377
|
*
|
|
365
|
-
* @param {ToltApi.
|
|
378
|
+
* @param {ToltApi.RefundTransactionRequest} request
|
|
366
379
|
* @param {TransactionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
367
380
|
*
|
|
368
381
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
@@ -388,7 +401,7 @@ export class TransactionsClient {
|
|
|
388
401
|
const _response = await core.fetcher({
|
|
389
402
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
390
403
|
(await core.Supplier.get(this._options.environment)) ??
|
|
391
|
-
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id)}/refund`),
|
|
404
|
+
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id, errors.ToltApiError)}/refund`),
|
|
392
405
|
method: "POST",
|
|
393
406
|
headers: _headers,
|
|
394
407
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
@@ -426,7 +439,7 @@ export class TransactionsClient {
|
|
|
426
439
|
/**
|
|
427
440
|
* Re-queues the transaction for asynchronous flow processing. Only transactions without an existing commission are eligible, so a rerun cannot create a duplicate commission.
|
|
428
441
|
*
|
|
429
|
-
* @param {ToltApi.
|
|
442
|
+
* @param {ToltApi.RerunTransactionFlowsRequest} request
|
|
430
443
|
* @param {TransactionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
431
444
|
*
|
|
432
445
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
@@ -452,12 +465,12 @@ export class TransactionsClient {
|
|
|
452
465
|
const _response = await core.fetcher({
|
|
453
466
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
454
467
|
(await core.Supplier.get(this._options.environment)) ??
|
|
455
|
-
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id)}/rerun-flows`),
|
|
468
|
+
environments.ToltApiEnvironment.Default, `v2/transactions/${core.url.encodePathParam(id, errors.ToltApiError)}/rerun-flows`),
|
|
456
469
|
method: "POST",
|
|
457
470
|
headers: _headers,
|
|
458
471
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
459
472
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
460
|
-
maxRetries:
|
|
473
|
+
maxRetries: 0,
|
|
461
474
|
abortSignal: requestOptions?.abortSignal,
|
|
462
475
|
fetchFn: this._options?.fetch,
|
|
463
476
|
logging: this._options.logging,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* source: "api"
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
13
|
+
export interface CreateTransactionRequest {
|
|
14
14
|
/** When the payment happened, as a timestamp with a time zone, for example 2026-03-01T12:00:00Z. Reports and date filters place the transaction on this date. Defaults to now. */
|
|
15
15
|
created_at?: string;
|
|
16
16
|
/** Id of the purchased product in your billing system. Commission flows can match on it. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* product_name: "Pro plan"
|
|
7
7
|
* }
|
|
8
8
|
*/
|
|
9
|
-
export interface
|
|
9
|
+
export interface UpdateTransactionRequest {
|
|
10
10
|
id: string;
|
|
11
11
|
/** The payment amount in the smallest unit of the program currency (cents for USD); percentage commissions are calculated from it. */
|
|
12
12
|
amount?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
1
|
+
export type { CreateTransactionRequest } from "./CreateTransactionRequest.js";
|
|
2
|
+
export type { DeleteTransactionRequest } from "./DeleteTransactionRequest.js";
|
|
3
|
+
export type { GetTransactionRequest } from "./GetTransactionRequest.js";
|
|
4
4
|
export type { ListTransactionsRequest } from "./ListTransactionsRequest.js";
|
|
5
|
-
export type {
|
|
6
|
-
export type {
|
|
7
|
-
export type {
|
|
5
|
+
export type { RefundTransactionRequest } from "./RefundTransactionRequest.js";
|
|
6
|
+
export type { RerunTransactionFlowsRequest } from "./RerunTransactionFlowsRequest.js";
|
|
7
|
+
export type { UpdateTransactionRequest } from "./UpdateTransactionRequest.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
export * from "./CreateTransactionResponse.js";
|
|
2
|
+
export * from "./DeleteTransactionResponse.js";
|
|
3
|
+
export * from "./GetTransactionResponse.js";
|
|
4
4
|
export * from "./ListTransactionsRequestOrder.js";
|
|
5
5
|
export * from "./ListTransactionsRequestSort.js";
|
|
6
6
|
export * from "./ListTransactionsResponse.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
7
|
+
export * from "./RefundTransactionResponse.js";
|
|
8
|
+
export * from "./RerunTransactionFlowsResponse.js";
|
|
9
|
+
export * from "./UpdateTransactionResponse.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
export * from "./CreateTransactionResponse.js";
|
|
2
|
+
export * from "./DeleteTransactionResponse.js";
|
|
3
|
+
export * from "./GetTransactionResponse.js";
|
|
4
4
|
export * from "./ListTransactionsRequestOrder.js";
|
|
5
5
|
export * from "./ListTransactionsRequestSort.js";
|
|
6
6
|
export * from "./ListTransactionsResponse.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
7
|
+
export * from "./RefundTransactionResponse.js";
|
|
8
|
+
export * from "./RerunTransactionFlowsResponse.js";
|
|
9
|
+
export * from "./UpdateTransactionResponse.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ErrorResponse {
|
|
2
2
|
success: boolean;
|
|
3
3
|
/** Human-readable explanation. May change; branch on code instead. */
|
|
4
4
|
message: string;
|
|
5
5
|
/** Stable machine-readable error code. */
|
|
6
|
-
code:
|
|
6
|
+
code: ErrorResponse.Code;
|
|
7
7
|
doc_url: string;
|
|
8
8
|
/** One entry per offending field. Present on validation_error and invalid_reference. */
|
|
9
|
-
errors?:
|
|
9
|
+
errors?: ErrorResponse.Errors.Item[] | undefined;
|
|
10
10
|
}
|
|
11
|
-
export declare namespace
|
|
11
|
+
export declare namespace ErrorResponse {
|
|
12
12
|
/** Stable machine-readable error code. */
|
|
13
13
|
const Code: {
|
|
14
14
|
readonly BadRequest: "bad_request";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
export var
|
|
3
|
-
(function (
|
|
2
|
+
export var ErrorResponse;
|
|
3
|
+
(function (ErrorResponse) {
|
|
4
4
|
/** Stable machine-readable error code. */
|
|
5
|
-
|
|
5
|
+
ErrorResponse.Code = {
|
|
6
6
|
BadRequest: "bad_request",
|
|
7
7
|
ValidationError: "validation_error",
|
|
8
8
|
InvalidReference: "invalid_reference",
|
|
@@ -20,4 +20,4 @@ export var Error_;
|
|
|
20
20
|
PayloadTooLarge: "payload_too_large",
|
|
21
21
|
InternalError: "internal_error",
|
|
22
22
|
};
|
|
23
|
-
})(
|
|
23
|
+
})(ErrorResponse || (ErrorResponse = {}));
|
|
@@ -4,7 +4,7 @@ export * from "./Commission.js";
|
|
|
4
4
|
export * from "./CreatedPartner.js";
|
|
5
5
|
export * from "./Customer.js";
|
|
6
6
|
export * from "./EmbedToken.js";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./ErrorResponse.js";
|
|
8
8
|
export * from "./Flow.js";
|
|
9
9
|
export * from "./Group.js";
|
|
10
10
|
export * from "./Link.js";
|
package/dist/api/types/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export * from "./Commission.js";
|
|
|
4
4
|
export * from "./CreatedPartner.js";
|
|
5
5
|
export * from "./Customer.js";
|
|
6
6
|
export * from "./EmbedToken.js";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./ErrorResponse.js";
|
|
8
8
|
export * from "./Flow.js";
|
|
9
9
|
export * from "./Group.js";
|
|
10
10
|
export * from "./Link.js";
|
package/dist/core/exports.d.ts
CHANGED
package/dist/core/exports.js
CHANGED
|
@@ -5,12 +5,13 @@ import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
|
5
5
|
import { getErrorResponseBody } from "./getErrorResponseBody.js";
|
|
6
6
|
import { getFetchFn } from "./getFetchFn.js";
|
|
7
7
|
import { getRequestBody } from "./getRequestBody.js";
|
|
8
|
-
import { getResponseBody } from "./getResponseBody.js";
|
|
8
|
+
import { getResponseBody, isResponseBodyError } from "./getResponseBody.js";
|
|
9
9
|
import { Headers } from "./Headers.js";
|
|
10
|
-
import { makeRequest } from "./makeRequest.js";
|
|
10
|
+
import { clearResponseTimeout, makeRequest } from "./makeRequest.js";
|
|
11
11
|
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
12
12
|
import { redactUrl, SENSITIVE_QUERY_PARAMS } from "./redactUrl.js";
|
|
13
13
|
import { requestWithRetries } from "./requestWithRetries.js";
|
|
14
|
+
import { TIMEOUT } from "./signals.js";
|
|
14
15
|
const SENSITIVE_HEADERS = new Set([
|
|
15
16
|
"authorization",
|
|
16
17
|
"www-authenticate",
|
|
@@ -79,6 +80,10 @@ async function getHeaders(args) {
|
|
|
79
80
|
}
|
|
80
81
|
return newHeaders;
|
|
81
82
|
}
|
|
83
|
+
function isJsonContentType(contentType) {
|
|
84
|
+
const mediaType = contentType?.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
85
|
+
return mediaType === "application/json" || mediaType === "text/json" || mediaType.endsWith("+json");
|
|
86
|
+
}
|
|
82
87
|
export async function fetcherImpl(args) {
|
|
83
88
|
let url = args.url;
|
|
84
89
|
if (args.queryString != null && args.queryString.length > 0) {
|
|
@@ -104,8 +109,19 @@ export async function fetcherImpl(args) {
|
|
|
104
109
|
};
|
|
105
110
|
logger.debug("Making HTTP request", metadata);
|
|
106
111
|
}
|
|
112
|
+
// Bodies that are read in full here stay covered by the timeout; streamed bodies are read by the caller.
|
|
113
|
+
const keepTimeoutUntilBodyRead = args.responseType !== "streaming" && args.responseType !== "sse" && args.responseType !== "binary-response";
|
|
114
|
+
const attemptResponses = [];
|
|
107
115
|
try {
|
|
108
|
-
const response = await requestWithRetries(async () =>
|
|
116
|
+
const response = await requestWithRetries(async () => {
|
|
117
|
+
// A retry means the previous attempt is over; stop its timer now rather than at the end.
|
|
118
|
+
for (const previousResponse of attemptResponses) {
|
|
119
|
+
clearResponseTimeout(previousResponse);
|
|
120
|
+
}
|
|
121
|
+
const attemptResponse = await makeRequest(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex, args.responseType === "streaming" || args.responseType === "sse", keepTimeoutUntilBodyRead);
|
|
122
|
+
attemptResponses.push(attemptResponse);
|
|
123
|
+
return attemptResponse;
|
|
124
|
+
}, args.maxRetries, args.abortSignal);
|
|
109
125
|
if (response.status >= 200 && response.status < 400) {
|
|
110
126
|
if (logger.isDebug()) {
|
|
111
127
|
const metadata = {
|
|
@@ -117,6 +133,16 @@ export async function fetcherImpl(args) {
|
|
|
117
133
|
logger.debug("HTTP request succeeded", metadata);
|
|
118
134
|
}
|
|
119
135
|
const body = await getResponseBody(response, args.responseType);
|
|
136
|
+
// Only a body the server labelled as JSON is an error here; void endpoints may return plain text.
|
|
137
|
+
if (isResponseBodyError(body) &&
|
|
138
|
+
body.error.reason === "non-json" &&
|
|
139
|
+
isJsonContentType(response.headers.get("Content-Type"))) {
|
|
140
|
+
return {
|
|
141
|
+
ok: false,
|
|
142
|
+
error: body.error,
|
|
143
|
+
rawResponse: toRawResponse(response),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
120
146
|
return {
|
|
121
147
|
ok: true,
|
|
122
148
|
body: body,
|
|
@@ -164,7 +190,7 @@ export async function fetcherImpl(args) {
|
|
|
164
190
|
rawResponse: abortRawResponse,
|
|
165
191
|
};
|
|
166
192
|
}
|
|
167
|
-
else if (error instanceof Error && error.name === "AbortError") {
|
|
193
|
+
else if (error === TIMEOUT || (error instanceof Error && error.name === "AbortError")) {
|
|
168
194
|
if (logger.isError()) {
|
|
169
195
|
const metadata = {
|
|
170
196
|
method: args.method,
|
|
@@ -219,5 +245,10 @@ export async function fetcherImpl(args) {
|
|
|
219
245
|
rawResponse: unknownRawResponse,
|
|
220
246
|
};
|
|
221
247
|
}
|
|
248
|
+
finally {
|
|
249
|
+
for (const attemptResponse of attemptResponses) {
|
|
250
|
+
clearResponseTimeout(attemptResponse);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
222
253
|
}
|
|
223
254
|
export const fetcher = fetcherImpl;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { fromJson } from "../json.js";
|
|
2
|
-
import { getResponseBody } from "./getResponseBody.js";
|
|
2
|
+
import { getResponseBody, isResponseBodyError } from "./getResponseBody.js";
|
|
3
|
+
/** Parses a JSON error body, falling back to the raw text so the status and body are never lost. */
|
|
4
|
+
function parseJsonErrorBody(text) {
|
|
5
|
+
if (text.length === 0) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return fromJson(text);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
3
15
|
export async function getErrorResponseBody(response) {
|
|
4
16
|
let contentType = response.headers.get("Content-Type")?.toLowerCase();
|
|
5
17
|
if (contentType == null || contentType.length === 0) {
|
|
6
|
-
|
|
18
|
+
const body = await getResponseBody(response);
|
|
19
|
+
if (isResponseBodyError(body)) {
|
|
20
|
+
return body.error.reason === "non-json" ? body.error.rawBody : undefined;
|
|
21
|
+
}
|
|
22
|
+
return body;
|
|
7
23
|
}
|
|
8
24
|
if (contentType.indexOf(";") !== -1) {
|
|
9
25
|
contentType = contentType.split(";")[0]?.trim() ?? "";
|
|
@@ -14,14 +30,11 @@ export async function getErrorResponseBody(response) {
|
|
|
14
30
|
case "application/ld+json":
|
|
15
31
|
case "application/problem+json":
|
|
16
32
|
case "application/vnd.api+json":
|
|
17
|
-
case "text/json":
|
|
18
|
-
|
|
19
|
-
return text.length > 0 ? fromJson(text) : undefined;
|
|
20
|
-
}
|
|
33
|
+
case "text/json":
|
|
34
|
+
return parseJsonErrorBody(await response.text());
|
|
21
35
|
default:
|
|
22
36
|
if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
|
|
23
|
-
|
|
24
|
-
return text.length > 0 ? fromJson(text) : undefined;
|
|
37
|
+
return parseJsonErrorBody(await response.text());
|
|
25
38
|
}
|
|
26
39
|
// Fallback to plain text if content type is not recognized
|
|
27
40
|
// Even if no body is present, the response will be an empty string
|
|
@@ -1 +1,17 @@
|
|
|
1
|
+
export type ResponseBodyError = {
|
|
2
|
+
ok: false;
|
|
3
|
+
error: {
|
|
4
|
+
reason: "non-json";
|
|
5
|
+
statusCode: number;
|
|
6
|
+
rawBody: string;
|
|
7
|
+
} | {
|
|
8
|
+
reason: "body-is-null";
|
|
9
|
+
statusCode: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Returns true when `value` is a failure record created by `getResponseBody` (for example malformed JSON),
|
|
14
|
+
* as opposed to a parsed JSON body that happens to have the same shape.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isResponseBodyError(value: unknown): value is ResponseBodyError;
|
|
1
17
|
export declare function getResponseBody(response: Response, responseType?: string): Promise<unknown>;
|