/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema } from "./address.js"; import { Email, Email$inboundSchema } from "./email.js"; import { PassThroughBody, PassThroughBody$inboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema } from "./phonenumber.js"; export type User = { /** * The unique identifier for the user */ id?: string | undefined; /** * The parent user id */ parentId?: string | null | undefined; /** * The username of the user */ username?: string | null | undefined; /** * The name of the resource. */ name?: string | null | undefined; /** * The first name of the person. */ firstName?: string | null | undefined; /** * The last name of the person. */ lastName?: string | null | undefined; /** * The job title of the person. */ title?: string | null | undefined; /** * The division the person is currently in. Usually a collection of departments or teams or regions. */ division?: string | null | undefined; /** * The department the person is currently in. [Deprecated](https://developers.apideck.com/changelog) in favor of the dedicated department_id and department_name field. * * @deprecated field: Deprecated. Use department_id instead.. */ department?: string | null | undefined; /** * The name of the company. */ companyName?: string | null | undefined; /** * An Employee Number, Employee ID or Employee Code, is a unique number that has been assigned to each individual staff member within a company. */ employeeNumber?: string | null | undefined; /** * A description of the object. */ description?: string | null | undefined; /** * The URL of the user's avatar */ image?: string | null | undefined; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; /** * The status of the user */ status?: string | null | undefined; addresses?: Array
| undefined; phoneNumbers?: Array | undefined; emails: Array; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The date and time when the user was last updated. */ updatedAt?: string | null | undefined; /** * The date and time when the user was created. */ createdAt?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const User$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), parent_id: z.nullable(types.string()).optional(), username: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), title: z.nullable(types.string()).optional(), division: z.nullable(types.string()).optional(), department: z.nullable(types.string()).optional(), company_name: z.nullable(types.string()).optional(), employee_number: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), image: z.nullable(types.string()).optional(), language: z.nullable(types.string()).optional(), status: z.nullable(types.string()).optional(), addresses: types.optional(z.array(Address$inboundSchema)), phone_numbers: types.optional(z.array(PhoneNumber$inboundSchema)), emails: z.array(Email$inboundSchema), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_at: z.nullable(types.string()).optional(), created_at: z.nullable(types.string()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "first_name": "firstName", "last_name": "lastName", "company_name": "companyName", "employee_number": "employeeNumber", "phone_numbers": "phoneNumbers", "custom_mappings": "customMappings", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function userFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => User$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'User' from JSON`, ); }