/* * 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 { ConsumerMetadata, ConsumerMetadata$inboundSchema, ConsumerMetadata$Outbound, ConsumerMetadata$outboundSchema, } from "./consumermetadata.js"; export type ConsumerInput = { /** * Unique consumer identifier. You can freely choose a consumer ID yourself. Most of the time, this is an ID of your internal data model that represents a user or account in your system (for example account:12345). If the consumer doesn't exist yet, Vault will upsert a consumer based on your ID. */ consumerId: string; /** * The metadata of the consumer. This is used to display the consumer in the sidebar. This is optional, but recommended. */ metadata?: ConsumerMetadata | undefined; }; /** @internal */ export const ConsumerInput$inboundSchema: z.ZodType< ConsumerInput, z.ZodTypeDef, unknown > = z.object({ consumer_id: z.string(), metadata: ConsumerMetadata$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "consumer_id": "consumerId", }); }); /** @internal */ export type ConsumerInput$Outbound = { consumer_id: string; metadata?: ConsumerMetadata$Outbound | undefined; }; /** @internal */ export const ConsumerInput$outboundSchema: z.ZodType< ConsumerInput$Outbound, z.ZodTypeDef, ConsumerInput > = z.object({ consumerId: z.string(), metadata: ConsumerMetadata$outboundSchema.optional(), }).transform((v) => { return remap$(v, { consumerId: "consumer_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ConsumerInput$ { /** @deprecated use `ConsumerInput$inboundSchema` instead. */ export const inboundSchema = ConsumerInput$inboundSchema; /** @deprecated use `ConsumerInput$outboundSchema` instead. */ export const outboundSchema = ConsumerInput$outboundSchema; /** @deprecated use `ConsumerInput$Outbound` instead. */ export type Outbound = ConsumerInput$Outbound; } export function consumerInputToJSON(consumerInput: ConsumerInput): string { return JSON.stringify(ConsumerInput$outboundSchema.parse(consumerInput)); } export function consumerInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConsumerInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConsumerInput' from JSON`, ); }