/* * 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 DomainsControllerListDomainRoutesQueryParamOrderDirection = { Asc: "ASC", Desc: "DESC", } as const; /** * Direction of sorting */ export type DomainsControllerListDomainRoutesQueryParamOrderDirection = ClosedEnum; export type DomainsControllerListDomainRoutesRequest = { domain: string; /** * 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?: | DomainsControllerListDomainRoutesQueryParamOrderDirection | undefined; /** * Field to order by */ orderBy?: string | undefined; /** * Include cursor item in response */ includeCursor?: boolean | undefined; /** * Agent identifier to filter routes by. */ agentId?: string | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type DomainsControllerListDomainRoutesResponse = { headers: { [k: string]: Array }; result: components.ListDomainRoutesResponseDto; }; /** @internal */ export const DomainsControllerListDomainRoutesQueryParamOrderDirection$outboundSchema: z.ZodNativeEnum< typeof DomainsControllerListDomainRoutesQueryParamOrderDirection > = z.nativeEnum(DomainsControllerListDomainRoutesQueryParamOrderDirection); /** @internal */ export type DomainsControllerListDomainRoutesRequest$Outbound = { domain: string; after?: string | undefined; before?: string | undefined; limit?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; includeCursor?: boolean | undefined; agentId?: string | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const DomainsControllerListDomainRoutesRequest$outboundSchema: z.ZodType< DomainsControllerListDomainRoutesRequest$Outbound, z.ZodTypeDef, DomainsControllerListDomainRoutesRequest > = z.object({ domain: z.string(), after: z.string().optional(), before: z.string().optional(), limit: z.number().optional(), orderDirection: DomainsControllerListDomainRoutesQueryParamOrderDirection$outboundSchema .optional(), orderBy: z.string().optional(), includeCursor: z.boolean().optional(), agentId: z.string().optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function domainsControllerListDomainRoutesRequestToJSON( domainsControllerListDomainRoutesRequest: DomainsControllerListDomainRoutesRequest, ): string { return JSON.stringify( DomainsControllerListDomainRoutesRequest$outboundSchema.parse( domainsControllerListDomainRoutesRequest, ), ); } /** @internal */ export const DomainsControllerListDomainRoutesResponse$inboundSchema: z.ZodType< DomainsControllerListDomainRoutesResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListDomainRoutesResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function domainsControllerListDomainRoutesResponseFromJSON( jsonString: string, ): SafeParseResult< DomainsControllerListDomainRoutesResponse, SDKValidationError > { return safeParse( jsonString, (x) => DomainsControllerListDomainRoutesResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DomainsControllerListDomainRoutesResponse' from JSON`, ); }