/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Account, Account$inboundSchema, Account$Outbound, Account$outboundSchema, } from "./account.js"; /** * The response to list Accounts. */ export type ListAccountsResponse = { /** * The list of available accounts */ accounts?: Array | undefined; /** * A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. */ nextPageToken?: string | undefined; /** * The total number of accounts in the response. This is an estimate and may be more than the number of accounts in this response if the user is not authorized to view all accounts. */ totalSize?: string | undefined; }; /** @internal */ export const ListAccountsResponse$inboundSchema: z.ZodType< ListAccountsResponse, z.ZodTypeDef, unknown > = z.object({ accounts: z.array(Account$inboundSchema).optional(), next_page_token: z.string().optional(), total_size: z.string().optional(), }).transform((v) => { return remap$(v, { "next_page_token": "nextPageToken", "total_size": "totalSize", }); }); /** @internal */ export type ListAccountsResponse$Outbound = { accounts?: Array | undefined; next_page_token?: string | undefined; total_size?: string | undefined; }; /** @internal */ export const ListAccountsResponse$outboundSchema: z.ZodType< ListAccountsResponse$Outbound, z.ZodTypeDef, ListAccountsResponse > = z.object({ accounts: z.array(Account$outboundSchema).optional(), nextPageToken: z.string().optional(), totalSize: z.string().optional(), }).transform((v) => { return remap$(v, { nextPageToken: "next_page_token", totalSize: "total_size", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListAccountsResponse$ { /** @deprecated use `ListAccountsResponse$inboundSchema` instead. */ export const inboundSchema = ListAccountsResponse$inboundSchema; /** @deprecated use `ListAccountsResponse$outboundSchema` instead. */ export const outboundSchema = ListAccountsResponse$outboundSchema; /** @deprecated use `ListAccountsResponse$Outbound` instead. */ export type Outbound = ListAccountsResponse$Outbound; } export function listAccountsResponseToJSON( listAccountsResponse: ListAccountsResponse, ): string { return JSON.stringify( ListAccountsResponse$outboundSchema.parse(listAccountsResponse), ); } export function listAccountsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAccountsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAccountsResponse' from JSON`, ); }