@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
54 lines • 2.48 kB
JavaScript
/**
* @module Client
*/
// This file was auto-generated by Fern from our API Definition.
import { AccountsClient } from "./api/resources/accounts/client/Client.js";
import { DepositDestinationsClient } from "./api/resources/depositDestinations/client/Client.js";
import { PaymentMethodsClient } from "./api/resources/paymentMethods/client/Client.js";
import { TransfersClient } from "./api/resources/transfers/client/Client.js";
import { normalizeClientOptionsWithAuth } from "./BaseClient.js";
import * as core from "./core/index.js";
export class CoinbaseApiClient {
_options;
_accounts;
_depositDestinations;
_transfers;
_paymentMethods;
constructor(options) {
this._options = normalizeClientOptionsWithAuth(options);
}
get accounts() {
return (this._accounts ??= new AccountsClient(this._options));
}
get depositDestinations() {
return (this._depositDestinations ??= new DepositDestinationsClient(this._options));
}
get transfers() {
return (this._transfers ??= new TransfersClient(this._options));
}
get paymentMethods() {
return (this._paymentMethods ??= new 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);
}
}
//# sourceMappingURL=Client.js.map