/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d7b65fc389a2 */ import * as z from "zod/v4"; 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 { ConnectorAuthenticationHeader, ConnectorAuthenticationHeader$inboundSchema, } from "./connectorauthenticationheader.js"; import { ExtendedOAuthServerMetadata, ExtendedOAuthServerMetadata$inboundSchema, } from "./extendedoauthservermetadata.js"; import { GlobalHeaderValue, GlobalHeaderValue$inboundSchema, } from "./globalheadervalue.js"; import { OAuth2GrantType, OAuth2GrantType$inboundSchema, } from "./oauth2granttype.js"; import { OutboundAuthenticationType, OutboundAuthenticationType$inboundSchema, } from "./outboundauthenticationtype.js"; /** * Public view of an authentication method, without secrets. */ export type PublicAuthenticationMethod = { methodType: OutboundAuthenticationType; headers?: Array | null | undefined; globalHeaders?: { [k: string]: GlobalHeaderValue } | undefined; hasDefaultCredentials: boolean; grantType?: OAuth2GrantType | null | undefined; oauth2ServerMetadata?: ExtendedOAuthServerMetadata | null | undefined; }; /** @internal */ export const PublicAuthenticationMethod$inboundSchema: z.ZodType< PublicAuthenticationMethod, unknown > = z.object({ method_type: OutboundAuthenticationType$inboundSchema, headers: z.nullable(z.array(ConnectorAuthenticationHeader$inboundSchema)) .optional(), global_headers: z.record(z.string(), GlobalHeaderValue$inboundSchema) .optional(), has_default_credentials: z.boolean(), grant_type: z.nullable(OAuth2GrantType$inboundSchema).optional(), oauth2_server_metadata: z.nullable(ExtendedOAuthServerMetadata$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "method_type": "methodType", "global_headers": "globalHeaders", "has_default_credentials": "hasDefaultCredentials", "grant_type": "grantType", "oauth2_server_metadata": "oauth2ServerMetadata", }); }); export function publicAuthenticationMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PublicAuthenticationMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PublicAuthenticationMethod' from JSON`, ); }