/* * 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"; /** * Filter tenants by ID(s). Use bracket notation for multiple values (e.g., `id[0]=t1&id[1]=t2` or `id[]=t1&id[]=t2`). */ export type ListTenantsId = string | Array; /** * Sort direction. */ export const ListTenantsDir = { Asc: "asc", Desc: "desc", } as const; /** * Sort direction. */ export type ListTenantsDir = ClosedEnum; export type ListTenantsRequest = { /** * Filter tenants by ID(s). Use bracket notation for multiple values (e.g., `id[0]=t1&id[1]=t2` or `id[]=t1&id[]=t2`). */ id?: string | Array | undefined; /** * Number of tenants to return per page (1-100, default 20). */ limit?: number | undefined; /** * Sort direction. */ dir?: ListTenantsDir | undefined; /** * Cursor for the next page of results. Mutually exclusive with `prev`. */ next?: string | undefined; /** * Cursor for the previous page of results. Mutually exclusive with `next`. */ prev?: string | undefined; }; export type ListTenantsResponse = { result: components.TenantPaginatedResult; }; /** @internal */ export const ListTenantsId$inboundSchema: z.ZodType< ListTenantsId, z.ZodTypeDef, unknown > = z.union([z.string(), z.array(z.string())]); /** @internal */ export type ListTenantsId$Outbound = string | Array; /** @internal */ export const ListTenantsId$outboundSchema: z.ZodType< ListTenantsId$Outbound, z.ZodTypeDef, ListTenantsId > = z.union([z.string(), z.array(z.string())]); export function listTenantsIdToJSON(listTenantsId: ListTenantsId): string { return JSON.stringify(ListTenantsId$outboundSchema.parse(listTenantsId)); } export function listTenantsIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTenantsId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTenantsId' from JSON`, ); } /** @internal */ export const ListTenantsDir$inboundSchema: z.ZodNativeEnum< typeof ListTenantsDir > = z.nativeEnum(ListTenantsDir); /** @internal */ export const ListTenantsDir$outboundSchema: z.ZodNativeEnum< typeof ListTenantsDir > = ListTenantsDir$inboundSchema; /** @internal */ export const ListTenantsRequest$inboundSchema: z.ZodType< ListTenantsRequest, z.ZodTypeDef, unknown > = z.object({ id: z.union([z.string(), z.array(z.string())]).optional(), limit: z.number().int().default(20), dir: ListTenantsDir$inboundSchema.default("desc"), next: z.string().optional(), prev: z.string().optional(), }); /** @internal */ export type ListTenantsRequest$Outbound = { id?: string | Array | undefined; limit: number; dir: string; next?: string | undefined; prev?: string | undefined; }; /** @internal */ export const ListTenantsRequest$outboundSchema: z.ZodType< ListTenantsRequest$Outbound, z.ZodTypeDef, ListTenantsRequest > = z.object({ id: z.union([z.string(), z.array(z.string())]).optional(), limit: z.number().int().default(20), dir: ListTenantsDir$outboundSchema.default("desc"), next: z.string().optional(), prev: z.string().optional(), }); export function listTenantsRequestToJSON( listTenantsRequest: ListTenantsRequest, ): string { return JSON.stringify( ListTenantsRequest$outboundSchema.parse(listTenantsRequest), ); } export function listTenantsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTenantsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTenantsRequest' from JSON`, ); } /** @internal */ export const ListTenantsResponse$inboundSchema: z.ZodType< ListTenantsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.TenantPaginatedResult$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); /** @internal */ export type ListTenantsResponse$Outbound = { Result: components.TenantPaginatedResult$Outbound; }; /** @internal */ export const ListTenantsResponse$outboundSchema: z.ZodType< ListTenantsResponse$Outbound, z.ZodTypeDef, ListTenantsResponse > = z.object({ result: components.TenantPaginatedResult$outboundSchema, }).transform((v) => { return remap$(v, { result: "Result", }); }); export function listTenantsResponseToJSON( listTenantsResponse: ListTenantsResponse, ): string { return JSON.stringify( ListTenantsResponse$outboundSchema.parse(listTenantsResponse), ); } export function listTenantsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTenantsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTenantsResponse' from JSON`, ); }