/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 1696ab9023bb */ 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 { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AnonymousEvent, AnonymousEvent$inboundSchema, AnonymousEvent$Outbound, AnonymousEvent$outboundSchema, } from "./anonymousevent.js"; import { Badge, Badge$inboundSchema, Badge$Outbound, Badge$outboundSchema, } from "./badge.js"; import { CustomFieldData, CustomFieldData$inboundSchema, CustomFieldData$Outbound, CustomFieldData$outboundSchema, } from "./customfielddata.js"; import { DatasourceProfile, DatasourceProfile$inboundSchema, DatasourceProfile$Outbound, DatasourceProfile$outboundSchema, } from "./datasourceprofile.js"; import { InviteInfo, InviteInfo$inboundSchema, InviteInfo$Outbound, InviteInfo$outboundSchema, } from "./inviteinfo.js"; import { Permissions, Permissions$inboundSchema, Permissions$Outbound, Permissions$outboundSchema, } from "./permissions.js"; import { Person, Person$inboundSchema, Person$Outbound, Person$outboundSchema, } from "./person.js"; import { PersonDistance, PersonDistance$inboundSchema, PersonDistance$Outbound, PersonDistance$outboundSchema, } from "./persondistance.js"; import { PersonTeam, PersonTeam$inboundSchema, PersonTeam$Outbound, PersonTeam$outboundSchema, } from "./personteam.js"; import { QuerySuggestionList, QuerySuggestionList$inboundSchema, QuerySuggestionList$Outbound, QuerySuggestionList$outboundSchema, } from "./querysuggestionlist.js"; import { SocialNetwork, SocialNetwork$inboundSchema, SocialNetwork$Outbound, SocialNetwork$outboundSchema, } from "./socialnetwork.js"; import { StructuredLocation, StructuredLocation$inboundSchema, StructuredLocation$Outbound, StructuredLocation$outboundSchema, } from "./structuredlocation.js"; export const PersonMetadataType = { /** * The person is a current full-time employee of the company. */ FullTime: "FULL_TIME", /** * The person is a current contractor of the company. */ Contractor: "CONTRACTOR", /** * The person object represents a non-human actor such as a service or admin account. */ NonEmployee: "NON_EMPLOYEE", /** * The person is a previous employee of the company. */ FormerEmployee: "FORMER_EMPLOYEE", } as const; export type PersonMetadataType = OpenEnum; export type PersonMetadata = { type?: PersonMetadataType | undefined; /** * The first name of the person */ firstName?: string | undefined; /** * The last name of the person */ lastName?: string | undefined; /** * Job title. */ title?: 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; /** * Info about the employee's team(s). */ teams?: Array | undefined; /** * The number of people in this person's department. */ departmentCount?: number | undefined; /** * The user's primary email address */ email?: string | undefined; /** * Additional email addresses of this user beyond the primary, if any. */ aliasEmails?: Array | undefined; /** * User facing string representing the person's location. */ location?: string | undefined; /** * Detailed location with information about country, state, city etc. */ structuredLocation?: StructuredLocation | undefined; /** * Link to a customer's internal profile page. This is set to '#' when no link is desired. */ externalProfileLink?: string | undefined; manager?: Person | undefined; /** * The chain of reporting in the company as far up as it goes. The last entry is this person's direct manager. */ managementChain?: Array | undefined; /** * Phone number as a number string. */ phone?: string | undefined; /** * The timezone of the person. E.g. "Pacific Daylight Time". */ timezone?: string | undefined; /** * The offset of the person's timezone in seconds from UTC. */ timezoneOffset?: number | undefined; /** * The IANA timezone identifier, e.g. "America/Los_Angeles". */ timezoneIANA?: string | undefined; /** * The URL of the person's avatar. Public, glean-authenticated and Base64 encoded data URLs are all valid (but not third-party-authenticated URLs). */ photoUrl?: string | undefined; /** * The original photo URL of the person's avatar before any edits they made are applied */ uneditedPhotoUrl?: string | undefined; /** * The URL of the person's banner photo. */ bannerUrl?: string | undefined; reports?: Array | undefined; /** * The date when the employee started. */ startDate?: RFCDate | undefined; /** * If a former employee, the last date of employment. */ endDate?: RFCDate | undefined; /** * Short biography or mission statement of the employee. */ bio?: string | undefined; /** * She/her, He/his or other pronoun. */ pronoun?: string | undefined; /** * The total recursive size of the people reporting to this person, or 1 */ orgSizeCount?: number | undefined; /** * The total number of people who directly report to this person, or 0 */ directReportsCount?: number | undefined; /** * The preferred name of the person, or a nickname. */ preferredName?: string | undefined; /** * List of social network profiles. */ socialNetwork?: Array | undefined; /** * List of profiles this user has in different datasources / tools that they use. */ datasourceProfile?: Array | undefined; querySuggestions?: QuerySuggestionList | undefined; /** * List of people and distances to those people from this person. Optionally with metadata. */ peopleDistance?: Array | undefined; /** * Information regarding the invite status of a person. */ inviteInfo?: InviteInfo | undefined; /** * Whether the user has signed into Glean at least once. */ isSignedUp?: boolean | undefined; /** * The last time the user has used the Glean extension in ISO 8601 format. */ lastExtensionUse?: Date | undefined; /** * Describes the permissions levels that a user has for permissioned features. When the client sends this, Permissions.read and Permissions.write are the additional permissions granted to a user on top of what they have via their roles. * * @remarks * When the server sends this, Permissions.read and Permissions.write are the complete (merged) set of permissions the user has, and Permissions.roles is just for display purposes. */ permissions?: Permissions | undefined; /** * User customizable fields for additional people information. */ customFields?: Array | undefined; /** * The logging id of the person used in scrubbed logs, tracking GA metrics. */ loggingId?: string | undefined; /** * Percentage of the company that started strictly after this person. Between [0,100). */ startDatePercentile?: number | undefined; /** * Intervals of busy time for this person, along with the type of event they're busy with. */ busyEvents?: Array | undefined; /** * flag settings to indicate user profile settings for certain items */ profileBoolSettings?: { [k: string]: boolean } | undefined; /** * The badges that a user has earned over their lifetime. */ badges?: Array | undefined; /** * Whether this person is a "root" node in their organization's hierarchy. */ isOrgRoot?: boolean | undefined; }; /** @internal */ export const PersonMetadataType$inboundSchema: z.ZodType< PersonMetadataType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(PersonMetadataType); /** @internal */ export const PersonMetadataType$outboundSchema: z.ZodType< string, z.ZodTypeDef, PersonMetadataType > = openEnums.outboundSchema(PersonMetadataType); /** @internal */ export const PersonMetadata$inboundSchema: z.ZodType< PersonMetadata, z.ZodTypeDef, unknown > = z.object({ type: PersonMetadataType$inboundSchema.optional(), firstName: z.string().optional(), lastName: z.string().optional(), title: z.string().optional(), businessUnit: z.string().optional(), department: z.string().optional(), teams: z.array(PersonTeam$inboundSchema).optional(), departmentCount: z.number().int().optional(), email: z.string().optional(), aliasEmails: z.array(z.string()).optional(), location: z.string().optional(), structuredLocation: StructuredLocation$inboundSchema.optional(), externalProfileLink: z.string().optional(), manager: z.lazy(() => Person$inboundSchema).optional(), managementChain: z.array(z.lazy(() => Person$inboundSchema)).optional(), phone: z.string().optional(), timezone: z.string().optional(), timezoneOffset: z.number().int().optional(), timezoneIANA: z.string().optional(), photoUrl: z.string().optional(), uneditedPhotoUrl: z.string().optional(), bannerUrl: z.string().optional(), reports: z.array(z.lazy(() => Person$inboundSchema)).optional(), startDate: z.string().transform(v => new RFCDate(v)).optional(), endDate: z.string().transform(v => new RFCDate(v)).optional(), bio: z.string().optional(), pronoun: z.string().optional(), orgSizeCount: z.number().int().optional(), directReportsCount: z.number().int().optional(), preferredName: z.string().optional(), socialNetwork: z.array(SocialNetwork$inboundSchema).optional(), datasourceProfile: z.array(DatasourceProfile$inboundSchema).optional(), querySuggestions: z.lazy(() => QuerySuggestionList$inboundSchema).optional(), peopleDistance: z.array(PersonDistance$inboundSchema).optional(), inviteInfo: z.lazy(() => InviteInfo$inboundSchema).optional(), isSignedUp: z.boolean().optional(), lastExtensionUse: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), permissions: Permissions$inboundSchema.optional(), customFields: z.array(z.lazy(() => CustomFieldData$inboundSchema)).optional(), loggingId: z.string().optional(), startDatePercentile: z.number().optional(), busyEvents: z.array(AnonymousEvent$inboundSchema).optional(), profileBoolSettings: z.record(z.boolean()).optional(), badges: z.array(Badge$inboundSchema).optional(), isOrgRoot: z.boolean().optional(), }); /** @internal */ export type PersonMetadata$Outbound = { type?: string | undefined; firstName?: string | undefined; lastName?: string | undefined; title?: string | undefined; businessUnit?: string | undefined; department?: string | undefined; teams?: Array | undefined; departmentCount?: number | undefined; email?: string | undefined; aliasEmails?: Array | undefined; location?: string | undefined; structuredLocation?: StructuredLocation$Outbound | undefined; externalProfileLink?: string | undefined; manager?: Person$Outbound | undefined; managementChain?: Array | undefined; phone?: string | undefined; timezone?: string | undefined; timezoneOffset?: number | undefined; timezoneIANA?: string | undefined; photoUrl?: string | undefined; uneditedPhotoUrl?: string | undefined; bannerUrl?: string | undefined; reports?: Array | undefined; startDate?: string | undefined; endDate?: string | undefined; bio?: string | undefined; pronoun?: string | undefined; orgSizeCount?: number | undefined; directReportsCount?: number | undefined; preferredName?: string | undefined; socialNetwork?: Array | undefined; datasourceProfile?: Array | undefined; querySuggestions?: QuerySuggestionList$Outbound | undefined; peopleDistance?: Array | undefined; inviteInfo?: InviteInfo$Outbound | undefined; isSignedUp?: boolean | undefined; lastExtensionUse?: string | undefined; permissions?: Permissions$Outbound | undefined; customFields?: Array | undefined; loggingId?: string | undefined; startDatePercentile?: number | undefined; busyEvents?: Array | undefined; profileBoolSettings?: { [k: string]: boolean } | undefined; badges?: Array | undefined; isOrgRoot?: boolean | undefined; }; /** @internal */ export const PersonMetadata$outboundSchema: z.ZodType< PersonMetadata$Outbound, z.ZodTypeDef, PersonMetadata > = z.object({ type: PersonMetadataType$outboundSchema.optional(), firstName: z.string().optional(), lastName: z.string().optional(), title: z.string().optional(), businessUnit: z.string().optional(), department: z.string().optional(), teams: z.array(PersonTeam$outboundSchema).optional(), departmentCount: z.number().int().optional(), email: z.string().optional(), aliasEmails: z.array(z.string()).optional(), location: z.string().optional(), structuredLocation: StructuredLocation$outboundSchema.optional(), externalProfileLink: z.string().optional(), manager: z.lazy(() => Person$outboundSchema).optional(), managementChain: z.array(z.lazy(() => Person$outboundSchema)).optional(), phone: z.string().optional(), timezone: z.string().optional(), timezoneOffset: z.number().int().optional(), timezoneIANA: z.string().optional(), photoUrl: z.string().optional(), uneditedPhotoUrl: z.string().optional(), bannerUrl: z.string().optional(), reports: z.array(z.lazy(() => Person$outboundSchema)).optional(), startDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), endDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), bio: z.string().optional(), pronoun: z.string().optional(), orgSizeCount: z.number().int().optional(), directReportsCount: z.number().int().optional(), preferredName: z.string().optional(), socialNetwork: z.array(SocialNetwork$outboundSchema).optional(), datasourceProfile: z.array(DatasourceProfile$outboundSchema).optional(), querySuggestions: z.lazy(() => QuerySuggestionList$outboundSchema).optional(), peopleDistance: z.array(PersonDistance$outboundSchema).optional(), inviteInfo: z.lazy(() => InviteInfo$outboundSchema).optional(), isSignedUp: z.boolean().optional(), lastExtensionUse: z.date().transform(v => v.toISOString()).optional(), permissions: Permissions$outboundSchema.optional(), customFields: z.array(z.lazy(() => CustomFieldData$outboundSchema)) .optional(), loggingId: z.string().optional(), startDatePercentile: z.number().optional(), busyEvents: z.array(AnonymousEvent$outboundSchema).optional(), profileBoolSettings: z.record(z.boolean()).optional(), badges: z.array(Badge$outboundSchema).optional(), isOrgRoot: z.boolean().optional(), }); export function personMetadataToJSON(personMetadata: PersonMetadata): string { return JSON.stringify(PersonMetadata$outboundSchema.parse(personMetadata)); } export function personMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PersonMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PersonMetadata' from JSON`, ); }