/* * 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 "./sdkvalidationerror.js"; export type GenerateQRCodeRequestBody = { /** * The text to be encoded in the QR code. */ prompt?: string | undefined; /** * The height of the QR code image. */ height?: number | undefined; /** * The width of the QR code image. */ width?: number | undefined; /** * The model to be used for generating the QR code. */ model?: string | undefined; }; export type GenerateQRCodeRequest = { /** * The account in which the model is. */ accountId: string; /** * The ID of the model, e.g., stable-diffusion-xl-1024-v1-0. */ modelId: string; requestBody: GenerateQRCodeRequestBody; }; export type GenerateQRCodeResponse = | ReadableStream | ReadableStream; /** @internal */ export const GenerateQRCodeRequestBody$inboundSchema: z.ZodType< GenerateQRCodeRequestBody, z.ZodTypeDef, unknown > = z.object({ prompt: z.string().optional(), height: z.number().int().optional(), width: z.number().int().optional(), model: z.string().optional(), }); /** @internal */ export type GenerateQRCodeRequestBody$Outbound = { prompt?: string | undefined; height?: number | undefined; width?: number | undefined; model?: string | undefined; }; /** @internal */ export const GenerateQRCodeRequestBody$outboundSchema: z.ZodType< GenerateQRCodeRequestBody$Outbound, z.ZodTypeDef, GenerateQRCodeRequestBody > = z.object({ prompt: z.string().optional(), height: z.number().int().optional(), width: z.number().int().optional(), model: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GenerateQRCodeRequestBody$ { /** @deprecated use `GenerateQRCodeRequestBody$inboundSchema` instead. */ export const inboundSchema = GenerateQRCodeRequestBody$inboundSchema; /** @deprecated use `GenerateQRCodeRequestBody$outboundSchema` instead. */ export const outboundSchema = GenerateQRCodeRequestBody$outboundSchema; /** @deprecated use `GenerateQRCodeRequestBody$Outbound` instead. */ export type Outbound = GenerateQRCodeRequestBody$Outbound; } export function generateQRCodeRequestBodyToJSON( generateQRCodeRequestBody: GenerateQRCodeRequestBody, ): string { return JSON.stringify( GenerateQRCodeRequestBody$outboundSchema.parse(generateQRCodeRequestBody), ); } export function generateQRCodeRequestBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GenerateQRCodeRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenerateQRCodeRequestBody' from JSON`, ); } /** @internal */ export const GenerateQRCodeRequest$inboundSchema: z.ZodType< GenerateQRCodeRequest, z.ZodTypeDef, unknown > = z.object({ accountId: z.string(), modelId: z.string(), RequestBody: z.lazy(() => GenerateQRCodeRequestBody$inboundSchema), }).transform((v) => { return remap$(v, { "RequestBody": "requestBody", }); }); /** @internal */ export type GenerateQRCodeRequest$Outbound = { accountId: string; modelId: string; RequestBody: GenerateQRCodeRequestBody$Outbound; }; /** @internal */ export const GenerateQRCodeRequest$outboundSchema: z.ZodType< GenerateQRCodeRequest$Outbound, z.ZodTypeDef, GenerateQRCodeRequest > = z.object({ accountId: z.string(), modelId: z.string(), requestBody: z.lazy(() => GenerateQRCodeRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GenerateQRCodeRequest$ { /** @deprecated use `GenerateQRCodeRequest$inboundSchema` instead. */ export const inboundSchema = GenerateQRCodeRequest$inboundSchema; /** @deprecated use `GenerateQRCodeRequest$outboundSchema` instead. */ export const outboundSchema = GenerateQRCodeRequest$outboundSchema; /** @deprecated use `GenerateQRCodeRequest$Outbound` instead. */ export type Outbound = GenerateQRCodeRequest$Outbound; } export function generateQRCodeRequestToJSON( generateQRCodeRequest: GenerateQRCodeRequest, ): string { return JSON.stringify( GenerateQRCodeRequest$outboundSchema.parse(generateQRCodeRequest), ); } export function generateQRCodeRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GenerateQRCodeRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenerateQRCodeRequest' from JSON`, ); } /** @internal */ export const GenerateQRCodeResponse$inboundSchema: z.ZodType< GenerateQRCodeResponse, z.ZodTypeDef, unknown > = z.union([ z.instanceof(ReadableStream), z.instanceof(ReadableStream), ]); /** @internal */ export type GenerateQRCodeResponse$Outbound = | ReadableStream | ReadableStream; /** @internal */ export const GenerateQRCodeResponse$outboundSchema: z.ZodType< GenerateQRCodeResponse$Outbound, z.ZodTypeDef, GenerateQRCodeResponse > = z.union([ z.instanceof(ReadableStream), z.instanceof(ReadableStream), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GenerateQRCodeResponse$ { /** @deprecated use `GenerateQRCodeResponse$inboundSchema` instead. */ export const inboundSchema = GenerateQRCodeResponse$inboundSchema; /** @deprecated use `GenerateQRCodeResponse$outboundSchema` instead. */ export const outboundSchema = GenerateQRCodeResponse$outboundSchema; /** @deprecated use `GenerateQRCodeResponse$Outbound` instead. */ export type Outbound = GenerateQRCodeResponse$Outbound; } export function generateQRCodeResponseToJSON( generateQRCodeResponse: GenerateQRCodeResponse, ): string { return JSON.stringify( GenerateQRCodeResponse$outboundSchema.parse(generateQRCodeResponse), ); } export function generateQRCodeResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GenerateQRCodeResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenerateQRCodeResponse' from JSON`, ); }