/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; export type GetAccountRequest = { /** * The project to act on, when you call with an organization key. Optional when the organization has one project. A project key acts on its own project: naming another one is an error. */ projectId?: string | undefined; }; export type CurrentProject = { /** * ID of the current project */ id: string; /** * Name of the current project */ name: string; }; /** * Account details retrieved successfully */ export type GetAccountResponse = { /** * ID of the account */ id: string; /** * Name of the paid plan */ paidPlanName: string; /** * Text API quota */ textApiQuota: number; /** * Remaining quota */ remainingQuota: number; currentProject?: CurrentProject | undefined; }; /** @internal */ export type GetAccountRequest$Outbound = { projectId?: string | undefined; }; /** @internal */ export const GetAccountRequest$outboundSchema: z.ZodMiniType< GetAccountRequest$Outbound, GetAccountRequest > = z.object({ projectId: z.optional(z.string()), }); export function getAccountRequestToJSON( getAccountRequest: GetAccountRequest, ): string { return JSON.stringify( GetAccountRequest$outboundSchema.parse(getAccountRequest), ); } /** @internal */ export const CurrentProject$inboundSchema: z.ZodMiniType< CurrentProject, unknown > = z.object({ id: types.string(), name: types.string(), }); export function currentProjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CurrentProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CurrentProject' from JSON`, ); } /** @internal */ export const GetAccountResponse$inboundSchema: z.ZodMiniType< GetAccountResponse, unknown > = z.pipe( z.object({ id: types.string(), paid_plan_name: types.string(), text_api_quota: types.number(), remaining_quota: types.number(), current_project: types.optional(z.lazy(() => CurrentProject$inboundSchema)), }), z.transform((v) => { return remap$(v, { "paid_plan_name": "paidPlanName", "text_api_quota": "textApiQuota", "remaining_quota": "remainingQuota", "current_project": "currentProject", }); }), ); export function getAccountResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetAccountResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAccountResponse' from JSON`, ); }