/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type TenantToken = { /** * JWT token scoped to the tenant for safe browser API calls. */ token?: string | undefined; /** * The ID of the tenant this token is scoped to. */ tenantId?: string | undefined; }; /** @internal */ export const TenantToken$inboundSchema: z.ZodType< TenantToken, z.ZodTypeDef, unknown > = z.object({ token: z.string().optional(), tenant_id: z.string().optional(), }).transform((v) => { return remap$(v, { "tenant_id": "tenantId", }); }); /** @internal */ export type TenantToken$Outbound = { token?: string | undefined; tenant_id?: string | undefined; }; /** @internal */ export const TenantToken$outboundSchema: z.ZodType< TenantToken$Outbound, z.ZodTypeDef, TenantToken > = z.object({ token: z.string().optional(), tenantId: z.string().optional(), }).transform((v) => { return remap$(v, { tenantId: "tenant_id", }); }); export function tenantTokenToJSON(tenantToken: TenantToken): string { return JSON.stringify(TenantToken$outboundSchema.parse(tenantToken)); } export function tenantTokenFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TenantToken$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TenantToken' from JSON`, ); }