/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; export type UserInput = { /** * The parent user id */ parentId?: string | null | undefined; /** * The username of the user */ username?: 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: This will be removed in a future release, please migrate away from it as soon as possible. */ 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; /** * The password of the user */ password?: string | null | undefined; addresses?: Array
| undefined; phoneNumbers?: Array | undefined; emails: Array; /** * 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 UserInput$inboundSchema: z.ZodType< UserInput, z.ZodTypeDef, unknown > = z.object({ parent_id: z.nullable(z.string()).optional(), username: z.nullable(z.string()).optional(), first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), division: z.nullable(z.string()).optional(), department: z.nullable(z.string()).optional(), company_name: z.nullable(z.string()).optional(), employee_number: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), image: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), status: z.nullable(z.string()).optional(), password: z.nullable(z.string()).optional(), addresses: z.array(Address$inboundSchema).optional(), phone_numbers: z.array(PhoneNumber$inboundSchema).optional(), emails: z.array(Email$inboundSchema), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "first_name": "firstName", "last_name": "lastName", "company_name": "companyName", "employee_number": "employeeNumber", "phone_numbers": "phoneNumbers", "pass_through": "passThrough", }); }); /** @internal */ export type UserInput$Outbound = { parent_id?: string | null | undefined; username?: string | null | undefined; first_name?: string | null | undefined; last_name?: string | null | undefined; title?: string | null | undefined; division?: string | null | undefined; department?: string | null | undefined; company_name?: string | null | undefined; employee_number?: string | null | undefined; description?: string | null | undefined; image?: string | null | undefined; language?: string | null | undefined; status?: string | null | undefined; password?: string | null | undefined; addresses?: Array | undefined; phone_numbers?: Array | undefined; emails: Array; pass_through?: Array | undefined; }; /** @internal */ export const UserInput$outboundSchema: z.ZodType< UserInput$Outbound, z.ZodTypeDef, UserInput > = z.object({ parentId: z.nullable(z.string()).optional(), username: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), division: z.nullable(z.string()).optional(), department: z.nullable(z.string()).optional(), companyName: z.nullable(z.string()).optional(), employeeNumber: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), image: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), status: z.nullable(z.string()).optional(), password: z.nullable(z.string()).optional(), addresses: z.array(Address$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), emails: z.array(Email$outboundSchema), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", firstName: "first_name", lastName: "last_name", companyName: "company_name", employeeNumber: "employee_number", phoneNumbers: "phone_numbers", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UserInput$ { /** @deprecated use `UserInput$inboundSchema` instead. */ export const inboundSchema = UserInput$inboundSchema; /** @deprecated use `UserInput$outboundSchema` instead. */ export const outboundSchema = UserInput$outboundSchema; /** @deprecated use `UserInput$Outbound` instead. */ export type Outbound = UserInput$Outbound; } export function userInputToJSON(userInput: UserInput): string { return JSON.stringify(UserInput$outboundSchema.parse(userInput)); } export function userInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UserInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserInput' from JSON`, ); }