/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListTeamsRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type Teams = { id: string; name: string; organizationId: string; createdAt: string; updatedAt: string; }; /** * OK */ export type ListTeamsResponseBody = { teams: Array; }; /** @internal */ export const ListTeamsRequest$inboundSchema: z.ZodType< ListTeamsRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListTeamsRequest$Outbound = { orgId: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListTeamsRequest$outboundSchema: z.ZodType< ListTeamsRequest$Outbound, z.ZodTypeDef, ListTeamsRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listTeamsRequestToJSON( listTeamsRequest: ListTeamsRequest, ): string { return JSON.stringify( ListTeamsRequest$outboundSchema.parse(listTeamsRequest), ); } export function listTeamsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTeamsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTeamsRequest' from JSON`, ); } /** @internal */ export const Teams$inboundSchema: z.ZodType = z .object({ id: z.string(), name: z.string(), organizationId: z.string(), createdAt: z.string(), updatedAt: z.string(), }); /** @internal */ export type Teams$Outbound = { id: string; name: string; organizationId: string; createdAt: string; updatedAt: string; }; /** @internal */ export const Teams$outboundSchema: z.ZodType< Teams$Outbound, z.ZodTypeDef, Teams > = z.object({ id: z.string(), name: z.string(), organizationId: z.string(), createdAt: z.string(), updatedAt: z.string(), }); export function teamsToJSON(teams: Teams): string { return JSON.stringify(Teams$outboundSchema.parse(teams)); } export function teamsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Teams$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Teams' from JSON`, ); } /** @internal */ export const ListTeamsResponseBody$inboundSchema: z.ZodType< ListTeamsResponseBody, z.ZodTypeDef, unknown > = z.object({ teams: z.array(z.lazy(() => Teams$inboundSchema)), }); /** @internal */ export type ListTeamsResponseBody$Outbound = { teams: Array; }; /** @internal */ export const ListTeamsResponseBody$outboundSchema: z.ZodType< ListTeamsResponseBody$Outbound, z.ZodTypeDef, ListTeamsResponseBody > = z.object({ teams: z.array(z.lazy(() => Teams$outboundSchema)), }); export function listTeamsResponseBodyToJSON( listTeamsResponseBody: ListTeamsResponseBody, ): string { return JSON.stringify( ListTeamsResponseBody$outboundSchema.parse(listTeamsResponseBody), ); } export function listTeamsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTeamsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTeamsResponseBody' from JSON`, ); }