@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
96 lines (87 loc) • 3.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateCustomerById = exports.deleteCustomerById = exports.getCustomerById = exports.getCustomerRequirements = exports.listCustomers = exports.createCustomer = void 0;
const cdpApiClient_js_1 = require("../../cdpApiClient.js");
/**
* Create a new customer record. You can optionally request capabilities
and submit verification requirements in the same request.
This endpoint supports creating a customer with:
- Minimal data (customer type only)
- Capability requests
- KYC data submission
- Combined request for capability and required info for verification
* @summary Create a customer
*/
const createCustomer = (createCustomerRequest, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/customers`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createCustomerRequest,
}, options);
};
exports.createCustomer = createCustomer;
/**
* List all customers. The API will return all customers that the API Key has
permissions to access. Results are not returned in any guaranteed order.
* @summary List customers
*/
const listCustomers = (params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/customers`, method: "GET", params }, options);
};
exports.listCustomers = listCustomers;
/**
* Preview the requirements a hypothetical customer of the given
`customerType` and jurisdiction would need to satisfy to enable the
requested `capabilities`, without creating a customer record.
Partner onboarding UIs can use this to render the collection flow
before any customer state exists.
Today this endpoint only previews the Terms of Service requirement:
the response's `RequirementsMap` will only ever contain a `tos` key.
Other requirement families (PII / CDD inputs) are not yet available
through this endpoint; use `POST /v2/customers` or
`PUT /v2/customers/{customerId}` to discover those via
`Customer.requirements`.
Only `customerType: individual` customers resident in or citizens
of the US are currently supported; every other combination returns
`400 invalid_request`.
* @summary Get customer requirements
*/
const getCustomerRequirements = (params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/customers/requirements`, method: "GET", params }, options);
};
exports.getCustomerRequirements = getCustomerRequirements;
/**
* Get a customer by their ID. Returns the full customer object.
* @summary Get a customer
*/
const getCustomerById = (customerId, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/customers/${customerId}`, method: "GET" }, options);
};
exports.getCustomerById = getCustomerById;
/**
* Initiates deletion of the customer and all associated data. This operation
is idempotent — repeated calls for an already-deleted customer return 204.
A 404 is returned only when no customer with the given ID exists for the
caller's entity.
* @summary Delete a customer
*/
const deleteCustomerById = (customerId, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/customers/${customerId}`, method: "DELETE" }, options);
};
exports.deleteCustomerById = deleteCustomerById;
/**
* Update customer information and/or request capability changes.
This endpoint supports partial updates. Provide only the fields you wish to change.
* @summary Update a customer
*/
const updateCustomerById = (customerId, updateCustomerRequest, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/customers/${customerId}`,
method: "PUT",
headers: { "Content-Type": "application/json" },
data: updateCustomerRequest,
}, options);
};
exports.updateCustomerById = updateCustomerById;
//# sourceMappingURL=customers.js.map