/* * 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"; /** * The metadata of the consumer. This is used to display the consumer in the sidebar. This is optional, but recommended. */ export type ConsumerMetadata = { /** * The name of the account as shown in the sidebar. */ accountName?: string | undefined; /** * The name of the user as shown in the sidebar. */ userName?: string | undefined; /** * The email of the user as shown in the sidebar. */ email?: string | undefined; /** * The avatar of the user in the sidebar. Must be a valid URL */ image?: string | undefined; }; /** @internal */ export const ConsumerMetadata$inboundSchema: z.ZodType< ConsumerMetadata, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ account_name: types.optional(types.string()), user_name: types.optional(types.string()), email: types.optional(types.string()), image: types.optional(types.string()), }).transform((v) => { return remap$(v, { "account_name": "accountName", "user_name": "userName", }); }) ); /** @internal */ export type ConsumerMetadata$Outbound = { account_name?: string | undefined; user_name?: string | undefined; email?: string | undefined; image?: string | undefined; }; /** @internal */ export const ConsumerMetadata$outboundSchema: z.ZodType< ConsumerMetadata$Outbound, z.ZodTypeDef, ConsumerMetadata > = /* @__PURE__ */ lazySchema$(() => z.object({ accountName: z.string().optional(), userName: z.string().optional(), email: z.string().optional(), image: z.string().optional(), }).transform((v) => { return remap$(v, { accountName: "account_name", userName: "user_name", }); }) ); export function consumerMetadataToJSON( consumerMetadata: ConsumerMetadata, ): string { return JSON.stringify( ConsumerMetadata$outboundSchema.parse(consumerMetadata), ); } export function consumerMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConsumerMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConsumerMetadata' from JSON`, ); }