/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 5a70dcd8565e */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The team member's relationship to the team. This defaults to MEMBER if not set. */ export const PersonTeamRelationship = { Member: "MEMBER", Manager: "MANAGER", Lead: "LEAD", PointOfContact: "POINT_OF_CONTACT", Other: "OTHER", } as const; /** * The team member's relationship to the team. This defaults to MEMBER if not set. */ export type PersonTeamRelationship = OpenEnum; /** * Use `id` if you index teams via Glean, and use `name` and `externalLink` if you want to use your own team pages */ export type PersonTeam = { /** * Unique identifier */ id?: string | undefined; /** * Team name */ name?: string | undefined; /** * Link to a team page on the internet or your company's intranet */ externalLink?: string | undefined; /** * The team member's relationship to the team. This defaults to MEMBER if not set. */ relationship?: PersonTeamRelationship | undefined; /** * The team member's start date */ joinDate?: Date | undefined; }; /** @internal */ export const PersonTeamRelationship$inboundSchema: z.ZodType< PersonTeamRelationship, z.ZodTypeDef, unknown > = openEnums.inboundSchema(PersonTeamRelationship); /** @internal */ export const PersonTeamRelationship$outboundSchema: z.ZodType< string, z.ZodTypeDef, PersonTeamRelationship > = openEnums.outboundSchema(PersonTeamRelationship); /** @internal */ export const PersonTeam$inboundSchema: z.ZodType< PersonTeam, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string().optional(), externalLink: z.string().optional(), relationship: PersonTeamRelationship$inboundSchema.default("MEMBER"), joinDate: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), }); /** @internal */ export type PersonTeam$Outbound = { id?: string | undefined; name?: string | undefined; externalLink?: string | undefined; relationship: string; joinDate?: string | undefined; }; /** @internal */ export const PersonTeam$outboundSchema: z.ZodType< PersonTeam$Outbound, z.ZodTypeDef, PersonTeam > = z.object({ id: z.string().optional(), name: z.string().optional(), externalLink: z.string().optional(), relationship: PersonTeamRelationship$outboundSchema.default("MEMBER"), joinDate: z.date().transform(v => v.toISOString()).optional(), }); export function personTeamToJSON(personTeam: PersonTeam): string { return JSON.stringify(PersonTeam$outboundSchema.parse(personTeam)); } export function personTeamFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PersonTeam$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PersonTeam' from JSON`, ); }