/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListRolesRequest = { /** * A pointer to the page of results to return. */ cursor?: string | null | undefined; /** * The maximum number of items that are returned. */ limit?: number | undefined; }; export type ListRolesResponse = { result: components.CollectionRole; }; /** @internal */ export type ListRolesRequest$Outbound = { cursor?: string | null | undefined; limit: number; }; /** @internal */ export const ListRolesRequest$outboundSchema: z.ZodType< ListRolesRequest$Outbound, z.ZodTypeDef, ListRolesRequest > = z.object({ cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), }); export function listRolesRequestToJSON( listRolesRequest: ListRolesRequest, ): string { return JSON.stringify( ListRolesRequest$outboundSchema.parse(listRolesRequest), ); } /** @internal */ export const ListRolesResponse$inboundSchema: z.ZodType< ListRolesResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.CollectionRole$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listRolesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListRolesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListRolesResponse' from JSON`, ); }