UNPKG

@vulog/aima-billing

Version:

Invoice management, credits, wallets, and refunds.

17 lines (14 loc) 580 B
import { Client } from '@vulog/aima-client'; import { z } from 'zod'; import { Wallet } from './types'; export const getWalletsByEntity = async (client: Client, entityId: string): Promise<Wallet[]> => { const result = z.string().trim().min(1).uuid().safeParse(entityId); if (!result.success) { throw new TypeError('Invalid entityId', { cause: result.error.issues, }); } return client .get<Wallet[]>(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/wallet/entity/${entityId}`) .then(({ data }) => data); };