/* * 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"; import { ConsumerConnection, ConsumerConnection$inboundSchema, } from "./consumerconnection.js"; import { ConsumerMetadata, ConsumerMetadata$inboundSchema, } from "./consumermetadata.js"; import { RequestCountAllocation, RequestCountAllocation$inboundSchema, } from "./requestcountallocation.js"; export type Consumer = { /** * 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; /** * ID of your Apideck Application */ applicationId?: string | undefined; /** * The metadata of the consumer. This is used to display the consumer in the sidebar. This is optional, but recommended. */ metadata?: ConsumerMetadata | undefined; connections?: Array | undefined; services?: Array | undefined; aggregatedRequestCount?: number | undefined; requestCounts?: RequestCountAllocation | undefined; created?: string | undefined; modified?: string | undefined; requestCountUpdated?: string | undefined; }; /** @internal */ export const Consumer$inboundSchema: z.ZodType< Consumer, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ consumer_id: types.string(), application_id: types.optional(types.string()), metadata: types.optional(ConsumerMetadata$inboundSchema), connections: types.optional(z.array(ConsumerConnection$inboundSchema)), services: types.optional(z.array(types.string())), aggregated_request_count: types.optional(types.number()), request_counts: types.optional(RequestCountAllocation$inboundSchema), created: types.optional(types.string()), modified: types.optional(types.string()), request_count_updated: types.optional(types.string()), }).transform((v) => { return remap$(v, { "consumer_id": "consumerId", "application_id": "applicationId", "aggregated_request_count": "aggregatedRequestCount", "request_counts": "requestCounts", "request_count_updated": "requestCountUpdated", }); }) ); export function consumerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Consumer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Consumer' from JSON`, ); }