/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 8b018b9c8b6c */ 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"; import { CustomFieldData, CustomFieldData$inboundSchema, CustomFieldData$Outbound, CustomFieldData$outboundSchema, } from "./customfielddata.js"; import { DatasourceProfile, DatasourceProfile$inboundSchema, DatasourceProfile$Outbound, DatasourceProfile$outboundSchema, } from "./datasourceprofile.js"; import { ObjectPermissions, ObjectPermissions$inboundSchema, ObjectPermissions$Outbound, ObjectPermissions$outboundSchema, } from "./objectpermissions.js"; import { PersonToTeamRelationship, PersonToTeamRelationship$inboundSchema, PersonToTeamRelationship$Outbound, PersonToTeamRelationship$outboundSchema, } from "./persontoteamrelationship.js"; import { RelatedObjectEdge, RelatedObjectEdge$inboundSchema, RelatedObjectEdge$Outbound, RelatedObjectEdge$outboundSchema, } from "./relatedobjectedge.js"; import { TeamEmail, TeamEmail$inboundSchema, TeamEmail$Outbound, TeamEmail$outboundSchema, } from "./teamemail.js"; /** * whether this team is fully processed or there are still unprocessed operations that'll affect it */ export const TeamStatus = { Processed: "PROCESSED", QueuedForCreation: "QUEUED_FOR_CREATION", QueuedForDeletion: "QUEUED_FOR_DELETION", } as const; /** * whether this team is fully processed or there are still unprocessed operations that'll affect it */ export type TeamStatus = OpenEnum; export type Team = { /** * A list of objects related to a source object. */ relatedObjects?: { [k: string]: RelatedObjectEdge } | undefined; permissions?: ObjectPermissions | undefined; /** * Unique identifier */ id: string; /** * Team name */ name: string; /** * A description of the team */ description?: string | undefined; /** * Typically the highest level organizational unit; generally applies to bigger companies with multiple distinct businesses. */ businessUnit?: string | undefined; /** * An organizational unit where everyone has a similar task, e.g. `Engineering`. */ department?: string | undefined; /** * A link to the team's photo. */ photoUrl?: string | undefined; /** * A link to the team's banner photo. */ bannerUrl?: string | undefined; /** * Link to a team page on the internet or your company's intranet */ externalLink?: string | undefined; /** * The members on this team */ members?: Array | undefined; /** * Number of members on this team (recursive; includes all individuals that belong to this team, and all individuals that belong to a subteam within this team) */ memberCount?: number | undefined; /** * The emails for this team */ emails?: Array | undefined; /** * Customizable fields for additional team information. */ customFields?: Array | undefined; /** * The datasource profiles of the team */ datasourceProfiles?: Array | undefined; /** * the data source of the team, e.g. GDRIVE */ datasource?: string | undefined; /** * For teams created from docs, the doc title. Otherwise empty. */ createdFrom?: string | undefined; /** * when this team was last updated. */ lastUpdatedAt?: Date | undefined; /** * whether this team is fully processed or there are still unprocessed operations that'll affect it */ status?: TeamStatus | undefined; /** * can this team be deleted. Some manually ingested teams like GCS_CSV or PUSH_API cannot */ canBeDeleted?: boolean | undefined; /** * The logging id of the team used in scrubbed logs, client analytics, and metrics. */ loggingId?: string | undefined; }; /** @internal */ export const TeamStatus$inboundSchema: z.ZodType< TeamStatus, z.ZodTypeDef, unknown > = openEnums.inboundSchema(TeamStatus); /** @internal */ export const TeamStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, TeamStatus > = openEnums.outboundSchema(TeamStatus); /** @internal */ export const Team$inboundSchema: z.ZodType = z .object({ relatedObjects: z.record(RelatedObjectEdge$inboundSchema).optional(), permissions: ObjectPermissions$inboundSchema.optional(), id: z.string(), name: z.string(), description: z.string().optional(), businessUnit: z.string().optional(), department: z.string().optional(), photoUrl: z.string().optional(), bannerUrl: z.string().optional(), externalLink: z.string().optional(), members: z.array(z.lazy(() => PersonToTeamRelationship$inboundSchema)) .optional(), memberCount: z.number().int().optional(), emails: z.array(TeamEmail$inboundSchema).optional(), customFields: z.array(z.lazy(() => CustomFieldData$inboundSchema)) .optional(), datasourceProfiles: z.array(DatasourceProfile$inboundSchema).optional(), datasource: z.string().optional(), createdFrom: z.string().optional(), lastUpdatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), status: TeamStatus$inboundSchema.default("PROCESSED"), canBeDeleted: z.boolean().default(true), loggingId: z.string().optional(), }); /** @internal */ export type Team$Outbound = { relatedObjects?: { [k: string]: RelatedObjectEdge$Outbound } | undefined; permissions?: ObjectPermissions$Outbound | undefined; id: string; name: string; description?: string | undefined; businessUnit?: string | undefined; department?: string | undefined; photoUrl?: string | undefined; bannerUrl?: string | undefined; externalLink?: string | undefined; members?: Array | undefined; memberCount?: number | undefined; emails?: Array | undefined; customFields?: Array | undefined; datasourceProfiles?: Array | undefined; datasource?: string | undefined; createdFrom?: string | undefined; lastUpdatedAt?: string | undefined; status: string; canBeDeleted: boolean; loggingId?: string | undefined; }; /** @internal */ export const Team$outboundSchema: z.ZodType = z.object({ relatedObjects: z.record(RelatedObjectEdge$outboundSchema).optional(), permissions: ObjectPermissions$outboundSchema.optional(), id: z.string(), name: z.string(), description: z.string().optional(), businessUnit: z.string().optional(), department: z.string().optional(), photoUrl: z.string().optional(), bannerUrl: z.string().optional(), externalLink: z.string().optional(), members: z.array(z.lazy(() => PersonToTeamRelationship$outboundSchema)) .optional(), memberCount: z.number().int().optional(), emails: z.array(TeamEmail$outboundSchema).optional(), customFields: z.array(z.lazy(() => CustomFieldData$outboundSchema)) .optional(), datasourceProfiles: z.array(DatasourceProfile$outboundSchema).optional(), datasource: z.string().optional(), createdFrom: z.string().optional(), lastUpdatedAt: z.date().transform(v => v.toISOString()).optional(), status: TeamStatus$outboundSchema.default("PROCESSED"), canBeDeleted: z.boolean().default(true), loggingId: z.string().optional(), }); 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`, ); }