UNPKG

cryptopay-node

Version:

Cryptopay is a payment gateway and business wallet that allows merchants to automate the processes of accepting cryptocurrency payments and payouts from their customers, as well as making currency exchange transactions and receiving data on the transactio

1,043 lines 156 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * Cryptopay API * Cryptopay is a payment gateway and business wallet that allows merchants to automate the processes of accepting cryptocurrency payments and payouts from their customers, as well as making currency exchange transactions and receiving data on the transaction history and account balance statuses for reporting. * * The version of the OpenAPI document: 0.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SubscriptionsFp = exports.SubscriptionsAxiosParamCreator = exports.Rates = exports.RatesFactory = exports.RatesFp = exports.RatesAxiosParamCreator = exports.Invoices = exports.InvoicesFactory = exports.InvoicesFp = exports.InvoicesAxiosParamCreator = exports.ExchangeTransfers = exports.ExchangeTransfersFactory = exports.ExchangeTransfersFp = exports.ExchangeTransfersAxiosParamCreator = exports.Customers = exports.CustomersFactory = exports.CustomersFp = exports.CustomersAxiosParamCreator = exports.Coins = exports.CoinsFactory = exports.CoinsFp = exports.CoinsAxiosParamCreator = exports.CoinWithdrawals = exports.CoinWithdrawalsFactory = exports.CoinWithdrawalsFp = exports.CoinWithdrawalsAxiosParamCreator = exports.Channels = exports.ChannelsFactory = exports.ChannelsFp = exports.ChannelsAxiosParamCreator = exports.Accounts = exports.AccountsFactory = exports.AccountsFp = exports.AccountsAxiosParamCreator = exports.TransactionReferenceType = exports.SubscriptionStatus = exports.SubscriptionPeriod = exports.SubscriptionCallbackEvent = exports.RiskLevel = exports.NetworkFeeLevel = exports.InvoiceStatusContext = exports.InvoiceStatus = exports.InvoiceCallbackEvent = exports.CoinWithdrawalStatus = exports.CoinWithdrawalCallbackEvent = exports.ChannelStatus = exports.ChannelPaymentStatusContext = exports.ChannelPaymentStatus = exports.ChannelPaymentCallbackEvent = exports.BeneficiaryType = void 0; exports.Transactions = exports.TransactionsFactory = exports.TransactionsFp = exports.TransactionsAxiosParamCreator = exports.Subscriptions = exports.SubscriptionsFactory = void 0; const axios_1 = __importDefault(require("axios")); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("./common"); // @ts-ignore const base_1 = require("./base"); /** * * @export * @enum {string} */ var BeneficiaryType; (function (BeneficiaryType) { BeneficiaryType["NaturalPerson"] = "natural_person"; BeneficiaryType["LegalPerson"] = "legal_person"; })(BeneficiaryType = exports.BeneficiaryType || (exports.BeneficiaryType = {})); /** * * @export * @enum {string} */ var ChannelPaymentCallbackEvent; (function (ChannelPaymentCallbackEvent) { ChannelPaymentCallbackEvent["Created"] = "created"; ChannelPaymentCallbackEvent["OnHold"] = "on_hold"; ChannelPaymentCallbackEvent["Completed"] = "completed"; ChannelPaymentCallbackEvent["Refunded"] = "refunded"; ChannelPaymentCallbackEvent["Cancelled"] = "cancelled"; })(ChannelPaymentCallbackEvent = exports.ChannelPaymentCallbackEvent || (exports.ChannelPaymentCallbackEvent = {})); /** * * @export * @enum {string} */ var ChannelPaymentStatus; (function (ChannelPaymentStatus) { ChannelPaymentStatus["Pending"] = "pending"; ChannelPaymentStatus["OnHold"] = "on_hold"; ChannelPaymentStatus["Completed"] = "completed"; ChannelPaymentStatus["Refunded"] = "refunded"; ChannelPaymentStatus["Cancelled"] = "cancelled"; })(ChannelPaymentStatus = exports.ChannelPaymentStatus || (exports.ChannelPaymentStatus = {})); /** * * @export * @enum {string} */ var ChannelPaymentStatusContext; (function (ChannelPaymentStatusContext) { ChannelPaymentStatusContext["IllicitResource"] = "illicit_resource"; ChannelPaymentStatusContext["ChannelDisabled"] = "channel_disabled"; })(ChannelPaymentStatusContext = exports.ChannelPaymentStatusContext || (exports.ChannelPaymentStatusContext = {})); /** * * @export * @enum {string} */ var ChannelStatus; (function (ChannelStatus) { ChannelStatus["Enabled"] = "enabled"; ChannelStatus["Disabled"] = "disabled"; })(ChannelStatus = exports.ChannelStatus || (exports.ChannelStatus = {})); /** * * @export * @enum {string} */ var CoinWithdrawalCallbackEvent; (function (CoinWithdrawalCallbackEvent) { CoinWithdrawalCallbackEvent["Created"] = "created"; CoinWithdrawalCallbackEvent["StatusChanged"] = "status_changed"; })(CoinWithdrawalCallbackEvent = exports.CoinWithdrawalCallbackEvent || (exports.CoinWithdrawalCallbackEvent = {})); /** * * @export * @enum {string} */ var CoinWithdrawalStatus; (function (CoinWithdrawalStatus) { CoinWithdrawalStatus["New"] = "new"; CoinWithdrawalStatus["Pending"] = "pending"; CoinWithdrawalStatus["OnHold"] = "on_hold"; CoinWithdrawalStatus["Processing"] = "processing"; CoinWithdrawalStatus["Sent"] = "sent"; CoinWithdrawalStatus["Completed"] = "completed"; CoinWithdrawalStatus["Failed"] = "failed"; CoinWithdrawalStatus["Cancelled"] = "cancelled"; })(CoinWithdrawalStatus = exports.CoinWithdrawalStatus || (exports.CoinWithdrawalStatus = {})); /** * * @export * @enum {string} */ var InvoiceCallbackEvent; (function (InvoiceCallbackEvent) { InvoiceCallbackEvent["Created"] = "created"; InvoiceCallbackEvent["Refunded"] = "refunded"; InvoiceCallbackEvent["Recalculated"] = "recalculated"; InvoiceCallbackEvent["StatusChanged"] = "status_changed"; InvoiceCallbackEvent["TransactionCreated"] = "transaction_created"; InvoiceCallbackEvent["TransactionConfirmed"] = "transaction_confirmed"; })(InvoiceCallbackEvent = exports.InvoiceCallbackEvent || (exports.InvoiceCallbackEvent = {})); /** * Invoice status * @export * @enum {string} */ var InvoiceStatus; (function (InvoiceStatus) { InvoiceStatus["New"] = "new"; InvoiceStatus["Completed"] = "completed"; InvoiceStatus["Unresolved"] = "unresolved"; InvoiceStatus["Refunded"] = "refunded"; InvoiceStatus["Cancelled"] = "cancelled"; })(InvoiceStatus = exports.InvoiceStatus || (exports.InvoiceStatus = {})); /** * Invoice status context * @export * @enum {string} */ var InvoiceStatusContext; (function (InvoiceStatusContext) { InvoiceStatusContext["Overpaid"] = "overpaid"; InvoiceStatusContext["Underpaid"] = "underpaid"; InvoiceStatusContext["PaidLate"] = "paid_late"; InvoiceStatusContext["IllicitResource"] = "illicit_resource"; })(InvoiceStatusContext = exports.InvoiceStatusContext || (exports.InvoiceStatusContext = {})); /** * * @export * @enum {string} */ var NetworkFeeLevel; (function (NetworkFeeLevel) { NetworkFeeLevel["Fast"] = "fast"; NetworkFeeLevel["Average"] = "average"; NetworkFeeLevel["Slow"] = "slow"; })(NetworkFeeLevel = exports.NetworkFeeLevel || (exports.NetworkFeeLevel = {})); /** * Transaction risk level depending on the `score` value * @export * @enum {string} */ var RiskLevel; (function (RiskLevel) { RiskLevel["Low"] = "low"; RiskLevel["Medium"] = "medium"; RiskLevel["High"] = "high"; })(RiskLevel = exports.RiskLevel || (exports.RiskLevel = {})); /** * * @export * @enum {string} */ var SubscriptionCallbackEvent; (function (SubscriptionCallbackEvent) { SubscriptionCallbackEvent["Paid"] = "paid"; SubscriptionCallbackEvent["Cancelled"] = "cancelled"; })(SubscriptionCallbackEvent = exports.SubscriptionCallbackEvent || (exports.SubscriptionCallbackEvent = {})); /** * * @export * @enum {string} */ var SubscriptionPeriod; (function (SubscriptionPeriod) { SubscriptionPeriod["Day"] = "day"; SubscriptionPeriod["Week"] = "week"; SubscriptionPeriod["Month"] = "month"; SubscriptionPeriod["Year"] = "year"; })(SubscriptionPeriod = exports.SubscriptionPeriod || (exports.SubscriptionPeriod = {})); /** * Subscription status * @export * @enum {string} */ var SubscriptionStatus; (function (SubscriptionStatus) { SubscriptionStatus["Active"] = "active"; SubscriptionStatus["Cancelled"] = "cancelled"; })(SubscriptionStatus = exports.SubscriptionStatus || (exports.SubscriptionStatus = {})); /** * * @export * @enum {string} */ var TransactionReferenceType; (function (TransactionReferenceType) { TransactionReferenceType["BankDeposit"] = "BankDeposit"; TransactionReferenceType["BankWithdrawal"] = "BankWithdrawal"; TransactionReferenceType["ChannelPayment"] = "ChannelPayment"; TransactionReferenceType["CoinDeposit"] = "CoinDeposit"; TransactionReferenceType["CoinWithdrawal"] = "CoinWithdrawal"; TransactionReferenceType["ExchangeTransfer"] = "ExchangeTransfer"; TransactionReferenceType["Invoice"] = "Invoice"; TransactionReferenceType["InvoiceRefund"] = "InvoiceRefund"; TransactionReferenceType["ManualBalanceTransaction"] = "ManualBalanceTransaction"; })(TransactionReferenceType = exports.TransactionReferenceType || (exports.TransactionReferenceType = {})); /** * Accounts - axios parameter creator * @export */ const AccountsAxiosParamCreator = function (configuration) { return { /** * * @summary List accounts * @param {*} [options] Override http request option. * @throws {RequiredError} */ list: (options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/api/accounts`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary List account transactions * @param {string} accountId Account ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ listTransactions: (accountId, startingAfter, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'accountId' is not null or undefined (0, common_1.assertParamExists)('listTransactions', 'accountId', accountId); const localVarPath = `/api/accounts/{account_id}/transactions` .replace(`{${"account_id"}}`, encodeURIComponent(String(accountId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required if (startingAfter !== undefined) { localVarQueryParameter['starting_after'] = startingAfter; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; exports.AccountsAxiosParamCreator = AccountsAxiosParamCreator; /** * Accounts - functional programming interface * @export */ const AccountsFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.AccountsAxiosParamCreator)(configuration); return { /** * * @summary List accounts * @param {*} [options] Override http request option. * @throws {RequiredError} */ list(options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.list(options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary List account transactions * @param {string} accountId Account ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ listTransactions(accountId, startingAfter, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.listTransactions(accountId, startingAfter, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, }; }; exports.AccountsFp = AccountsFp; /** * Accounts - factory interface * @export */ const AccountsFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.AccountsFp)(configuration); return { /** * * @summary List accounts * @param {*} [options] Override http request option. * @throws {RequiredError} */ list(options) { return localVarFp.list(options).then((request) => request(axios, basePath)); }, /** * * @summary List account transactions * @param {string} accountId Account ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ listTransactions(accountId, startingAfter, options) { return localVarFp.listTransactions(accountId, startingAfter, options).then((request) => request(axios, basePath)); }, }; }; exports.AccountsFactory = AccountsFactory; /** * Accounts - object-oriented interface * @export * @class Accounts * @extends {BaseAPI} */ class Accounts extends base_1.BaseAPI { /** * * @summary List accounts * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Accounts */ list(options) { return (0, exports.AccountsFp)(this.configuration).list(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary List account transactions * @param {string} accountId Account ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Accounts */ listTransactions(accountId, startingAfter, options) { return (0, exports.AccountsFp)(this.configuration).listTransactions(accountId, startingAfter, options).then((request) => request(this.axios, this.basePath)); } } exports.Accounts = Accounts; /** * Channels - axios parameter creator * @export */ const ChannelsAxiosParamCreator = function (configuration) { return { /** * * @summary Create a channel * @param {ChannelParams} channelParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ create: (channelParams, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'channelParams' is not null or undefined (0, common_1.assertParamExists)('create', 'channelParams', channelParams); const localVarPath = `/api/channels`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(channelParams, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary List channels * @param {string} [customerId] The internal ID of your customer that the transaction relates to * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ list: (customerId, startingAfter, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/api/channels`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required if (customerId !== undefined) { localVarQueryParameter['customer_id'] = customerId; } if (startingAfter !== undefined) { localVarQueryParameter['starting_after'] = startingAfter; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary List channel payments * @param {string} channelId Channel ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPayments: (channelId, startingAfter, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'channelId' is not null or undefined (0, common_1.assertParamExists)('listPayments', 'channelId', channelId); const localVarPath = `/api/channels/{channel_id}/payments` .replace(`{${"channel_id"}}`, encodeURIComponent(String(channelId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required if (startingAfter !== undefined) { localVarQueryParameter['starting_after'] = startingAfter; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Retrieve a channel * @param {string} channelId Channel ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrieve: (channelId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'channelId' is not null or undefined (0, common_1.assertParamExists)('retrieve', 'channelId', channelId); const localVarPath = `/api/channels/{channel_id}` .replace(`{${"channel_id"}}`, encodeURIComponent(String(channelId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Retrieve a channel by custom id * @param {string} customId * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrieveByCustomId: (customId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'customId' is not null or undefined (0, common_1.assertParamExists)('retrieveByCustomId', 'customId', customId); const localVarPath = `/api/channels/custom_id/{custom_id}` .replace(`{${"custom_id"}}`, encodeURIComponent(String(customId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Retrieve a channel payment * @param {string} channelId Channel ID * @param {string} channelPaymentId Channel payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrievePayment: (channelId, channelPaymentId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'channelId' is not null or undefined (0, common_1.assertParamExists)('retrievePayment', 'channelId', channelId); // verify required parameter 'channelPaymentId' is not null or undefined (0, common_1.assertParamExists)('retrievePayment', 'channelPaymentId', channelPaymentId); const localVarPath = `/api/channels/{channel_id}/payments/{channel_payment_id}` .replace(`{${"channel_id"}}`, encodeURIComponent(String(channelId))) .replace(`{${"channel_payment_id"}}`, encodeURIComponent(String(channelPaymentId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Update a channel * @param {string} channelId Channel ID * @param {ChannelUpdateParams} channelUpdateParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ update: (channelId, channelUpdateParams, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'channelId' is not null or undefined (0, common_1.assertParamExists)('update', 'channelId', channelId); // verify required parameter 'channelUpdateParams' is not null or undefined (0, common_1.assertParamExists)('update', 'channelUpdateParams', channelUpdateParams); const localVarPath = `/api/channels/{channel_id}` .replace(`{${"channel_id"}}`, encodeURIComponent(String(channelId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'PATCH' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(channelUpdateParams, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; exports.ChannelsAxiosParamCreator = ChannelsAxiosParamCreator; /** * Channels - functional programming interface * @export */ const ChannelsFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.ChannelsAxiosParamCreator)(configuration); return { /** * * @summary Create a channel * @param {ChannelParams} channelParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ create(channelParams, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.create(channelParams, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary List channels * @param {string} [customerId] The internal ID of your customer that the transaction relates to * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ list(customerId, startingAfter, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.list(customerId, startingAfter, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary List channel payments * @param {string} channelId Channel ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPayments(channelId, startingAfter, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.listPayments(channelId, startingAfter, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary Retrieve a channel * @param {string} channelId Channel ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrieve(channelId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.retrieve(channelId, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary Retrieve a channel by custom id * @param {string} customId * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrieveByCustomId(customId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.retrieveByCustomId(customId, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary Retrieve a channel payment * @param {string} channelId Channel ID * @param {string} channelPaymentId Channel payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrievePayment(channelId, channelPaymentId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.retrievePayment(channelId, channelPaymentId, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * * @summary Update a channel * @param {string} channelId Channel ID * @param {ChannelUpdateParams} channelUpdateParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ update(channelId, channelUpdateParams, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.update(channelId, channelUpdateParams, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, }; }; exports.ChannelsFp = ChannelsFp; /** * Channels - factory interface * @export */ const ChannelsFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.ChannelsFp)(configuration); return { /** * * @summary Create a channel * @param {ChannelParams} channelParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ create(channelParams, options) { return localVarFp.create(channelParams, options).then((request) => request(axios, basePath)); }, /** * * @summary List channels * @param {string} [customerId] The internal ID of your customer that the transaction relates to * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ list(customerId, startingAfter, options) { return localVarFp.list(customerId, startingAfter, options).then((request) => request(axios, basePath)); }, /** * * @summary List channel payments * @param {string} channelId Channel ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPayments(channelId, startingAfter, options) { return localVarFp.listPayments(channelId, startingAfter, options).then((request) => request(axios, basePath)); }, /** * * @summary Retrieve a channel * @param {string} channelId Channel ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrieve(channelId, options) { return localVarFp.retrieve(channelId, options).then((request) => request(axios, basePath)); }, /** * * @summary Retrieve a channel by custom id * @param {string} customId * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrieveByCustomId(customId, options) { return localVarFp.retrieveByCustomId(customId, options).then((request) => request(axios, basePath)); }, /** * * @summary Retrieve a channel payment * @param {string} channelId Channel ID * @param {string} channelPaymentId Channel payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ retrievePayment(channelId, channelPaymentId, options) { return localVarFp.retrievePayment(channelId, channelPaymentId, options).then((request) => request(axios, basePath)); }, /** * * @summary Update a channel * @param {string} channelId Channel ID * @param {ChannelUpdateParams} channelUpdateParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ update(channelId, channelUpdateParams, options) { return localVarFp.update(channelId, channelUpdateParams, options).then((request) => request(axios, basePath)); }, }; }; exports.ChannelsFactory = ChannelsFactory; /** * Channels - object-oriented interface * @export * @class Channels * @extends {BaseAPI} */ class Channels extends base_1.BaseAPI { /** * * @summary Create a channel * @param {ChannelParams} channelParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ create(channelParams, options) { return (0, exports.ChannelsFp)(this.configuration).create(channelParams, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary List channels * @param {string} [customerId] The internal ID of your customer that the transaction relates to * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ list(customerId, startingAfter, options) { return (0, exports.ChannelsFp)(this.configuration).list(customerId, startingAfter, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary List channel payments * @param {string} channelId Channel ID * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ listPayments(channelId, startingAfter, options) { return (0, exports.ChannelsFp)(this.configuration).listPayments(channelId, startingAfter, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retrieve a channel * @param {string} channelId Channel ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ retrieve(channelId, options) { return (0, exports.ChannelsFp)(this.configuration).retrieve(channelId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retrieve a channel by custom id * @param {string} customId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ retrieveByCustomId(customId, options) { return (0, exports.ChannelsFp)(this.configuration).retrieveByCustomId(customId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retrieve a channel payment * @param {string} channelId Channel ID * @param {string} channelPaymentId Channel payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ retrievePayment(channelId, channelPaymentId, options) { return (0, exports.ChannelsFp)(this.configuration).retrievePayment(channelId, channelPaymentId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Update a channel * @param {string} channelId Channel ID * @param {ChannelUpdateParams} channelUpdateParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof Channels */ update(channelId, channelUpdateParams, options) { return (0, exports.ChannelsFp)(this.configuration).update(channelId, channelUpdateParams, options).then((request) => request(this.axios, this.basePath)); } } exports.Channels = Channels; /** * CoinWithdrawals - axios parameter creator * @export */ const CoinWithdrawalsAxiosParamCreator = function (configuration) { return { /** * * @summary Commit a withdrawal * @param {string} coinWithdrawalId Coin withdrawal ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ commit: (coinWithdrawalId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'coinWithdrawalId' is not null or undefined (0, common_1.assertParamExists)('commit', 'coinWithdrawalId', coinWithdrawalId); const localVarPath = `/api/coin_withdrawals/{coin_withdrawal_id}/commit` .replace(`{${"coin_withdrawal_id"}}`, encodeURIComponent(String(coinWithdrawalId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * To create a withdrawal you need to use either `charged_amount`, `charged_amount_to_send` or `received_amount` parameters in your request body. * @summary Create a withdrawal * @param {CoinWithdrawalParams} coinWithdrawalParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ create: (coinWithdrawalParams, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'coinWithdrawalParams' is not null or undefined (0, common_1.assertParamExists)('create', 'coinWithdrawalParams', coinWithdrawalParams); const localVarPath = `/api/coin_withdrawals`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(coinWithdrawalParams, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary List withdrawals * @param {string} [customerId] The internal ID of your customer that the transaction relates to * @param {string} [startingAfter] Pagination parameter. ID to start after * @param {*} [options] Override http request option. * @throws {RequiredError} */ list: (customerId, startingAfter, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/api/coin_withdrawals`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required if (customerId !== undefined) { localVarQueryParameter['customer_id'] = customerId; } if (startingAfter !== undefined) { localVarQueryParameter['starting_after'] = startingAfter; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary List network fees * @param {boolean} [allNetworks] Is `false` if omitted. Set `true` to return network fees for all cryptocurrency networks * @param {*} [options] Override http request option. * @throws {RequiredError} */ listNetworkFees: (allNetworks, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/api/coin_withdrawals/network_fees`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication HMAC required if (allNetworks !== undefined) { localVarQueryParameter['all_networks'] = allNetworks; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Retrieve a wit