/* * 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 UpdateAuthorMetadata = { /** * 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 UpdateAuthorRequestBody = { /** * 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?: UpdateAuthorMetadata | undefined; /** * Timestamp when author first appeared */ firstSeen?: number | undefined; /** * Timestamp of last activity */ lastSeen?: number | undefined; manualTrustLevel?: number | null | undefined; }; export type UpdateAuthorRequest = { /** * Either external ID or the ID assigned by moderation API. */ id: string; /** * 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: UpdateAuthorRequestBody; }; /** @internal */ export type UpdateAuthorMetadata$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 UpdateAuthorMetadata$outboundSchema: z.ZodMiniType< UpdateAuthorMetadata$Outbound, UpdateAuthorMetadata > = 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 updateAuthorMetadataToJSON( updateAuthorMetadata: UpdateAuthorMetadata, ): string { return JSON.stringify( UpdateAuthorMetadata$outboundSchema.parse(updateAuthorMetadata), ); } /** @internal */ export type UpdateAuthorRequestBody$Outbound = { profile_picture?: string | null | undefined; external_link?: string | null | undefined; name?: string | null | undefined; email?: string | null | undefined; company?: string | null | undefined; metadata?: UpdateAuthorMetadata$Outbound | undefined; first_seen?: number | undefined; last_seen?: number | undefined; manual_trust_level?: number | null | undefined; }; /** @internal */ export const UpdateAuthorRequestBody$outboundSchema: z.ZodMiniType< UpdateAuthorRequestBody$Outbound, UpdateAuthorRequestBody > = 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(() => UpdateAuthorMetadata$outboundSchema)), firstSeen: z.optional(z.number()), lastSeen: z.optional(z.number()), manualTrustLevel: z.optional(z.nullable(z.number())), }), z.transform((v) => { return remap$(v, { profilePicture: "profile_picture", externalLink: "external_link", firstSeen: "first_seen", lastSeen: "last_seen", manualTrustLevel: "manual_trust_level", }); }), ); export function updateAuthorRequestBodyToJSON( updateAuthorRequestBody: UpdateAuthorRequestBody, ): string { return JSON.stringify( UpdateAuthorRequestBody$outboundSchema.parse(updateAuthorRequestBody), ); } /** @internal */ export type UpdateAuthorRequest$Outbound = { id: string; projectId?: string | undefined; body: UpdateAuthorRequestBody$Outbound; }; /** @internal */ export const UpdateAuthorRequest$outboundSchema: z.ZodMiniType< UpdateAuthorRequest$Outbound, UpdateAuthorRequest > = z.object({ id: z.string(), projectId: z.optional(z.string()), body: z.lazy(() => UpdateAuthorRequestBody$outboundSchema), }); export function updateAuthorRequestToJSON( updateAuthorRequest: UpdateAuthorRequest, ): string { return JSON.stringify( UpdateAuthorRequest$outboundSchema.parse(updateAuthorRequest), ); }