/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Direction of sorting */ export const DomainsControllerListDomainsQueryParamOrderDirection = { Asc: "ASC", Desc: "DESC", } as const; /** * Direction of sorting */ export type DomainsControllerListDomainsQueryParamOrderDirection = ClosedEnum< typeof DomainsControllerListDomainsQueryParamOrderDirection >; export type DomainsControllerListDomainsRequest = { /** * Cursor for pagination indicating the starting point after which to fetch results. */ after?: string | undefined; /** * Cursor for pagination indicating the ending point before which to fetch results. */ before?: string | undefined; /** * Limit the number of items to return */ limit?: number | undefined; /** * Direction of sorting */ orderDirection?: | DomainsControllerListDomainsQueryParamOrderDirection | undefined; /** * Field to order by */ orderBy?: string | undefined; /** * Include cursor item in response */ includeCursor?: boolean | undefined; /** * Domain name to filter results by. */ name?: string | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type DomainsControllerListDomainsResponse = { headers: { [k: string]: Array }; result: components.ListDomainsResponseDto; }; /** @internal */ export const DomainsControllerListDomainsQueryParamOrderDirection$outboundSchema: z.ZodNativeEnum = z.nativeEnum(DomainsControllerListDomainsQueryParamOrderDirection); /** @internal */ export type DomainsControllerListDomainsRequest$Outbound = { after?: string | undefined; before?: string | undefined; limit?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; includeCursor?: boolean | undefined; name?: string | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const DomainsControllerListDomainsRequest$outboundSchema: z.ZodType< DomainsControllerListDomainsRequest$Outbound, z.ZodTypeDef, DomainsControllerListDomainsRequest > = z.object({ after: z.string().optional(), before: z.string().optional(), limit: z.number().optional(), orderDirection: DomainsControllerListDomainsQueryParamOrderDirection$outboundSchema .optional(), orderBy: z.string().optional(), includeCursor: z.boolean().optional(), name: z.string().optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function domainsControllerListDomainsRequestToJSON( domainsControllerListDomainsRequest: DomainsControllerListDomainsRequest, ): string { return JSON.stringify( DomainsControllerListDomainsRequest$outboundSchema.parse( domainsControllerListDomainsRequest, ), ); } /** @internal */ export const DomainsControllerListDomainsResponse$inboundSchema: z.ZodType< DomainsControllerListDomainsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListDomainsResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function domainsControllerListDomainsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DomainsControllerListDomainsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DomainsControllerListDomainsResponse' from JSON`, ); }