@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
91 lines • 4.03 kB
JavaScript
;
/**
* @module Client
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoinbaseApiClient = void 0;
// This file was auto-generated by Fern from our API Definition.
const Client_js_1 = require("./api/resources/accounts/client/Client.js");
const Client_js_2 = require("./api/resources/depositDestinations/client/Client.js");
const Client_js_3 = require("./api/resources/paymentMethods/client/Client.js");
const Client_js_4 = require("./api/resources/transfers/client/Client.js");
const BaseClient_js_1 = require("./BaseClient.js");
const core = __importStar(require("./core/index.js"));
class CoinbaseApiClient {
_options;
_accounts;
_depositDestinations;
_transfers;
_paymentMethods;
constructor(options) {
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
}
get accounts() {
return (this._accounts ??= new Client_js_1.AccountsClient(this._options));
}
get depositDestinations() {
return (this._depositDestinations ??= new Client_js_2.DepositDestinationsClient(this._options));
}
get transfers() {
return (this._transfers ??= new Client_js_4.TransfersClient(this._options));
}
get paymentMethods() {
return (this._paymentMethods ??= new Client_js_3.PaymentMethodsClient(this._options));
}
/**
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
* This is useful for making requests to endpoints not yet supported in the SDK.
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
*
* @param {Request | string | URL} input - The URL, path, or Request object.
* @param {RequestInit} init - Standard fetch RequestInit options.
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
* @returns {Promise<Response>} A standard Response object.
*/
async fetch(input, init, requestOptions) {
return core.makePassthroughRequest(input, init, {
baseUrl: this._options.baseUrl ?? this._options.environment,
headers: this._options.headers,
timeoutInSeconds: this._options.timeoutInSeconds,
maxRetries: this._options.maxRetries,
fetch: this._options.fetch,
logging: this._options.logging,
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers,
}, requestOptions);
}
}
exports.CoinbaseApiClient = CoinbaseApiClient;
//# sourceMappingURL=Client.js.map