/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 8b0ba84443ff */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { smartUnion } from "../../types/smartUnion.js"; import { AuthenticationMethodCreateOrUpdateRequest, AuthenticationMethodCreateOrUpdateRequest$Outbound, AuthenticationMethodCreateOrUpdateRequest$outboundSchema, } from "./authenticationmethodcreateorupdaterequest.js"; import { BearerAuthMethod, BearerAuthMethod$Outbound, BearerAuthMethod$outboundSchema, } from "./bearerauthmethod.js"; import { NoneAuthMethod, NoneAuthMethod$Outbound, NoneAuthMethod$outboundSchema, } from "./noneauthmethod.js"; import { OAuth2AuthMethod, OAuth2AuthMethod$Outbound, OAuth2AuthMethod$outboundSchema, } from "./oauth2authmethod.js"; export type UpdateHTTPConnectorRequestAuthMethod1 = | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }); export type UpdateHTTPConnectorRequestAuthMethod2 = | AuthenticationMethodCreateOrUpdateRequest | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }); export type UpdateHTTPConnectorRequest = { /** * Optional human-readable title for the connector. */ title?: string | null | undefined; /** * The name of the connector. */ name?: string | null | undefined; /** * The description of the connector. */ description?: string | null | undefined; /** * The optional url of the icon you want to associate to the connector. */ iconUrl?: string | null | undefined; /** * New connector server URL. */ server?: string | null | undefined; /** * Authentication methods supported by the connector. */ authMethods?: | Array< | AuthenticationMethodCreateOrUpdateRequest | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }) > | null | undefined; protocol: "http"; }; /** @internal */ export type UpdateHTTPConnectorRequestAuthMethod1$Outbound = | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }); /** @internal */ export const UpdateHTTPConnectorRequestAuthMethod1$outboundSchema: z.ZodType< UpdateHTTPConnectorRequestAuthMethod1$Outbound, UpdateHTTPConnectorRequestAuthMethod1 > = z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]); export function updateHTTPConnectorRequestAuthMethod1ToJSON( updateHTTPConnectorRequestAuthMethod1: UpdateHTTPConnectorRequestAuthMethod1, ): string { return JSON.stringify( UpdateHTTPConnectorRequestAuthMethod1$outboundSchema.parse( updateHTTPConnectorRequestAuthMethod1, ), ); } /** @internal */ export type UpdateHTTPConnectorRequestAuthMethod2$Outbound = | AuthenticationMethodCreateOrUpdateRequest$Outbound | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }); /** @internal */ export const UpdateHTTPConnectorRequestAuthMethod2$outboundSchema: z.ZodType< UpdateHTTPConnectorRequestAuthMethod2$Outbound, UpdateHTTPConnectorRequestAuthMethod2 > = smartUnion([ AuthenticationMethodCreateOrUpdateRequest$outboundSchema, z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]), ]); export function updateHTTPConnectorRequestAuthMethod2ToJSON( updateHTTPConnectorRequestAuthMethod2: UpdateHTTPConnectorRequestAuthMethod2, ): string { return JSON.stringify( UpdateHTTPConnectorRequestAuthMethod2$outboundSchema.parse( updateHTTPConnectorRequestAuthMethod2, ), ); } /** @internal */ export type UpdateHTTPConnectorRequest$Outbound = { title?: string | null | undefined; name?: string | null | undefined; description?: string | null | undefined; icon_url?: string | null | undefined; server?: string | null | undefined; auth_methods?: | Array< | AuthenticationMethodCreateOrUpdateRequest$Outbound | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }) > | null | undefined; protocol: "http"; }; /** @internal */ export const UpdateHTTPConnectorRequest$outboundSchema: z.ZodType< UpdateHTTPConnectorRequest$Outbound, UpdateHTTPConnectorRequest > = z.object({ title: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), iconUrl: z.nullable(z.string()).optional(), server: z.nullable(z.string()).optional(), authMethods: z.nullable( z.array( smartUnion([ AuthenticationMethodCreateOrUpdateRequest$outboundSchema, z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]), ]), ), ).optional(), protocol: z.literal("http"), }).transform((v) => { return remap$(v, { iconUrl: "icon_url", authMethods: "auth_methods", }); }); export function updateHTTPConnectorRequestToJSON( updateHTTPConnectorRequest: UpdateHTTPConnectorRequest, ): string { return JSON.stringify( UpdateHTTPConnectorRequest$outboundSchema.parse(updateHTTPConnectorRequest), ); }