/* * 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 CreateTeamRequestBody = { name: string; }; export type CreateTeamRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; requestBody?: CreateTeamRequestBody | undefined; }; export type Team = { id: string; name: string; organizationId: string; createdAt: string; updatedAt: string; }; /** * Team created */ export type CreateTeamResponseBody = { team: Team; }; /** @internal */ export const CreateTeamRequestBody$inboundSchema: z.ZodType< CreateTeamRequestBody, z.ZodTypeDef, unknown > = z.object({ name: z.string(), }); /** @internal */ export type CreateTeamRequestBody$Outbound = { name: string; }; /** @internal */ export const CreateTeamRequestBody$outboundSchema: z.ZodType< CreateTeamRequestBody$Outbound, z.ZodTypeDef, CreateTeamRequestBody > = z.object({ name: z.string(), }); export function createTeamRequestBodyToJSON( createTeamRequestBody: CreateTeamRequestBody, ): string { return JSON.stringify( CreateTeamRequestBody$outboundSchema.parse(createTeamRequestBody), ); } export function createTeamRequestBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTeamRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTeamRequestBody' from JSON`, ); } /** @internal */ export const CreateTeamRequest$inboundSchema: z.ZodType< CreateTeamRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), "X-On-Behalf-Of": z.string().optional(), RequestBody: z.lazy(() => CreateTeamRequestBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "RequestBody": "requestBody", }); }); /** @internal */ export type CreateTeamRequest$Outbound = { orgId: string; "X-On-Behalf-Of"?: string | undefined; RequestBody?: CreateTeamRequestBody$Outbound | undefined; }; /** @internal */ export const CreateTeamRequest$outboundSchema: z.ZodType< CreateTeamRequest$Outbound, z.ZodTypeDef, CreateTeamRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), requestBody: z.lazy(() => CreateTeamRequestBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", requestBody: "RequestBody", }); }); export function createTeamRequestToJSON( createTeamRequest: CreateTeamRequest, ): string { return JSON.stringify( CreateTeamRequest$outboundSchema.parse(createTeamRequest), ); } export function createTeamRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTeamRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTeamRequest' from JSON`, ); } /** @internal */ export const Team$inboundSchema: z.ZodType = z .object({ id: z.string(), name: z.string(), organizationId: z.string(), createdAt: z.string(), updatedAt: z.string(), }); /** @internal */ export type Team$Outbound = { id: string; name: string; organizationId: string; createdAt: string; updatedAt: string; }; /** @internal */ export const Team$outboundSchema: z.ZodType = z.object({ id: z.string(), name: z.string(), organizationId: z.string(), createdAt: z.string(), updatedAt: z.string(), }); export function teamToJSON(team: Team): string { return JSON.stringify(Team$outboundSchema.parse(team)); } export function teamFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Team$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Team' from JSON`, ); } /** @internal */ export const CreateTeamResponseBody$inboundSchema: z.ZodType< CreateTeamResponseBody, z.ZodTypeDef, unknown > = z.object({ team: z.lazy(() => Team$inboundSchema), }); /** @internal */ export type CreateTeamResponseBody$Outbound = { team: Team$Outbound; }; /** @internal */ export const CreateTeamResponseBody$outboundSchema: z.ZodType< CreateTeamResponseBody$Outbound, z.ZodTypeDef, CreateTeamResponseBody > = z.object({ team: z.lazy(() => Team$outboundSchema), }); export function createTeamResponseBodyToJSON( createTeamResponseBody: CreateTeamResponseBody, ): string { return JSON.stringify( CreateTeamResponseBody$outboundSchema.parse(createTeamResponseBody), ); } export function createTeamResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTeamResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTeamResponseBody' from JSON`, ); }