/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { walletsCreateWallet } from "../funcs/wallets-create-wallet.js"; import { walletsGetCustomerWallets } from "../funcs/wallets-get-customer-wallets.js"; import { walletsGetWalletBalance } from "../funcs/wallets-get-wallet-balance.js"; import { walletsGetWalletTransactions } from "../funcs/wallets-get-wallet-transactions.js"; import { walletsGetWallet } from "../funcs/wallets-get-wallet.js"; import { walletsGetWalletsByCustomerId } from "../funcs/wallets-get-wallets-by-customer-id.js"; import { walletsQueryWalletTransaction } from "../funcs/wallets-query-wallet-transaction.js"; import { walletsQueryWallet } from "../funcs/wallets-query-wallet.js"; import { walletsTerminateWallet } from "../funcs/wallets-terminate-wallet.js"; import { walletsTopUpWallet } from "../funcs/wallets-top-up-wallet.js"; import { walletsUpdateWallet } from "../funcs/wallets-update-wallet.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class Wallets extends ClientSDK { /** * Get Customer Wallets * * @remarks * Use when resolving wallets by external customer id or lookup key (e.g. from your app's user id). Supports optional real-time balance and expand. */ async getCustomerWallets( request?: models.GetCustomerWalletsRequest | undefined, options?: RequestOptions, ): Promise> { return unwrapAsync(walletsGetCustomerWallets( this, request, options, )); } /** * Get wallets by customer ID * * @remarks * Use when showing a customer's wallets (e.g. balance overview by currency or in a billing portal). Supports optional expand for balance breakdown. */ async getWalletsByCustomerId( id: string, options?: RequestOptions, ): Promise> { return unwrapAsync(walletsGetWalletsByCustomerId( this, id, options, )); } /** * Create a new wallet * * @remarks * Use when giving a customer a prepaid or credit balance (e.g. prepaid plans or promotional credits). */ async createWallet( request: models.CreateWalletRequest, options?: RequestOptions, ): Promise { return unwrapAsync(walletsCreateWallet( this, request, options, )); } /** * Query wallets * * @remarks * Use when listing or searching wallets (e.g. admin view or reporting). Returns a paginated list; supports filtering by customer and status. */ async queryWallet( request: models.WalletFilter, options?: RequestOptions, ): Promise { return unwrapAsync(walletsQueryWallet( this, request, options, )); } /** * Query wallet transactions * * @remarks * Use when searching or reporting on wallet transactions (e.g. cross-wallet history or reconciliation). Returns a paginated list; supports filtering by wallet, customer, type, date range. */ async queryWalletTransaction( request: models.WalletTransactionFilter, options?: RequestOptions, ): Promise { return unwrapAsync(walletsQueryWalletTransaction( this, request, options, )); } /** * Get wallet * * @remarks * Use when you need to load a single wallet (e.g. for a balance or settings view). */ async getWallet( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(walletsGetWallet( this, id, options, )); } /** * Update a wallet * * @remarks * Use when changing wallet settings (e.g. enabling or updating auto top-up thresholds). */ async updateWallet( id: string, body: models.UpdateWalletRequest, options?: RequestOptions, ): Promise { return unwrapAsync(walletsUpdateWallet( this, id, body, options, )); } /** * Get wallet balance * * @remarks * Use when displaying or checking current wallet balance (e.g. before charging or in a portal). Supports optional expand for credits breakdown and from_cache. */ async getWalletBalance( id: string, expand?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(walletsGetWalletBalance( this, id, expand, options, )); } /** * Terminate a wallet * * @remarks * Use when closing a customer wallet (e.g. churn or migration). Closes the wallet and applies remaining balance per policy (refund or forfeit). */ async terminateWallet( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(walletsTerminateWallet( this, id, options, )); } /** * Top up wallet * * @remarks * Use when adding funds to a wallet (e.g. top-up, refund, or manual credit). Supports optional idempotency via reference. */ async topUpWallet( id: string, body: models.TopUpWalletRequest, options?: RequestOptions, ): Promise { return unwrapAsync(walletsTopUpWallet( this, id, body, options, )); } /** * Get wallet transactions * * @remarks * Use when showing transaction history for a wallet (e.g. credit/debit log or audit). Returns a paginated list; supports limit, offset, and filters. */ async getWalletTransactions( request: models.GetWalletTransactionsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(walletsGetWalletTransactions( this, request, options, )); } }