/* * 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 * as components from "../components/index.js"; import * as errors from "../errors/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GenSegmentAnything2Response = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; /** * Successful Response */ masksResponse?: components.MasksResponse | undefined; /** * Error */ studioApiError?: errors.StudioApiError | undefined; }; /** @internal */ export const GenSegmentAnything2Response$inboundSchema: z.ZodType< GenSegmentAnything2Response, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), MasksResponse: components.MasksResponse$inboundSchema.optional(), "studio-api-error": errors.StudioApiError$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", "MasksResponse": "masksResponse", "studio-api-error": "studioApiError", }); }); /** @internal */ export type GenSegmentAnything2Response$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; MasksResponse?: components.MasksResponse$Outbound | undefined; "studio-api-error"?: errors.StudioApiError$Outbound | undefined; }; /** @internal */ export const GenSegmentAnything2Response$outboundSchema: z.ZodType< GenSegmentAnything2Response$Outbound, z.ZodTypeDef, GenSegmentAnything2Response > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), masksResponse: components.MasksResponse$outboundSchema.optional(), studioApiError: errors.StudioApiError$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", masksResponse: "MasksResponse", studioApiError: "studio-api-error", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GenSegmentAnything2Response$ { /** @deprecated use `GenSegmentAnything2Response$inboundSchema` instead. */ export const inboundSchema = GenSegmentAnything2Response$inboundSchema; /** @deprecated use `GenSegmentAnything2Response$outboundSchema` instead. */ export const outboundSchema = GenSegmentAnything2Response$outboundSchema; /** @deprecated use `GenSegmentAnything2Response$Outbound` instead. */ export type Outbound = GenSegmentAnything2Response$Outbound; } export function genSegmentAnything2ResponseToJSON( genSegmentAnything2Response: GenSegmentAnything2Response, ): string { return JSON.stringify( GenSegmentAnything2Response$outboundSchema.parse( genSegmentAnything2Response, ), ); } export function genSegmentAnything2ResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GenSegmentAnything2Response$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenSegmentAnything2Response' from JSON`, ); }