/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; /** * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. */ export type CreateAuthorMetadata = { /** * Whether the author's email is verified */ emailVerified?: boolean | null | undefined; /** * Whether the author's phone number is verified */ phoneVerified?: boolean | null | undefined; /** * Whether the author's identity is verified */ identityVerified?: boolean | null | undefined; /** * Whether the author is a paying customer */ isPayingCustomer?: boolean | null | undefined; [additionalProperties: string]: unknown; }; export type CreateAuthorRequestBody = { /** * URL of the author's profile picture */ profilePicture?: string | null | undefined; /** * URL of the author's external profile */ externalLink?: string | null | undefined; /** * Author name or identifier */ name?: string | null | undefined; /** * Author email address */ email?: string | null | undefined; /** * The author's company or organization */ company?: string | null | undefined; /** * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. */ metadata?: CreateAuthorMetadata | undefined; /** * Timestamp when author first appeared */ firstSeen?: number | undefined; /** * Timestamp of last activity */ lastSeen?: number | undefined; manualTrustLevel?: number | null | undefined; /** * External ID of the user, typically the ID of the author in your database. */ externalId: string; }; export type CreateAuthorRequest = { /** * The project to act on, when you call with an organization key. Optional when the organization has one project. A project key acts on its own project: naming another one is an error. */ projectId?: string | undefined; body: CreateAuthorRequestBody; }; /** @internal */ export type CreateAuthorMetadata$Outbound = { email_verified?: boolean | null | undefined; phone_verified?: boolean | null | undefined; identity_verified?: boolean | null | undefined; is_paying_customer?: boolean | null | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const CreateAuthorMetadata$outboundSchema: z.ZodMiniType< CreateAuthorMetadata$Outbound, CreateAuthorMetadata > = z.pipe( z.catchall( z.object({ emailVerified: z.optional(z.nullable(z.boolean())), phoneVerified: z.optional(z.nullable(z.boolean())), identityVerified: z.optional(z.nullable(z.boolean())), isPayingCustomer: z.optional(z.nullable(z.boolean())), }), z.any(), ), z.transform((v) => { return { ...remap$(v, { emailVerified: "email_verified", phoneVerified: "phone_verified", identityVerified: "identity_verified", isPayingCustomer: "is_paying_customer", }), }; }), ); export function createAuthorMetadataToJSON( createAuthorMetadata: CreateAuthorMetadata, ): string { return JSON.stringify( CreateAuthorMetadata$outboundSchema.parse(createAuthorMetadata), ); } /** @internal */ export type CreateAuthorRequestBody$Outbound = { profile_picture?: string | null | undefined; external_link?: string | null | undefined; name?: string | null | undefined; email?: string | null | undefined; company?: string | null | undefined; metadata?: CreateAuthorMetadata$Outbound | undefined; first_seen?: number | undefined; last_seen?: number | undefined; manual_trust_level?: number | null | undefined; external_id: string; }; /** @internal */ export const CreateAuthorRequestBody$outboundSchema: z.ZodMiniType< CreateAuthorRequestBody$Outbound, CreateAuthorRequestBody > = z.pipe( z.object({ profilePicture: z.optional(z.nullable(z.string())), externalLink: z.optional(z.nullable(z.string())), name: z.optional(z.nullable(z.string())), email: z.optional(z.nullable(z.string())), company: z.optional(z.nullable(z.string())), metadata: z.optional(z.lazy(() => CreateAuthorMetadata$outboundSchema)), firstSeen: z.optional(z.number()), lastSeen: z.optional(z.number()), manualTrustLevel: z.optional(z.nullable(z.number())), externalId: z.string(), }), z.transform((v) => { return remap$(v, { profilePicture: "profile_picture", externalLink: "external_link", firstSeen: "first_seen", lastSeen: "last_seen", manualTrustLevel: "manual_trust_level", externalId: "external_id", }); }), ); export function createAuthorRequestBodyToJSON( createAuthorRequestBody: CreateAuthorRequestBody, ): string { return JSON.stringify( CreateAuthorRequestBody$outboundSchema.parse(createAuthorRequestBody), ); } /** @internal */ export type CreateAuthorRequest$Outbound = { projectId?: string | undefined; body: CreateAuthorRequestBody$Outbound; }; /** @internal */ export const CreateAuthorRequest$outboundSchema: z.ZodMiniType< CreateAuthorRequest$Outbound, CreateAuthorRequest > = z.object({ projectId: z.optional(z.string()), body: z.lazy(() => CreateAuthorRequestBody$outboundSchema), }); export function createAuthorRequestToJSON( createAuthorRequest: CreateAuthorRequest, ): string { return JSON.stringify( CreateAuthorRequest$outboundSchema.parse(createAuthorRequest), ); }