/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: dbc7e83d8be8 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { ConnectionCredentialsInput, ConnectionCredentialsInput$Outbound, ConnectionCredentialsInput$outboundSchema, } from "./connectioncredentialsinput.js"; /** * Request to create or update credentials for a connector. */ export type CredentialsCreateOrUpdate = { /** * Name of the credentials. Use this name to access or modify your credentials. */ name: string; /** * Human-readable title for the credentials. */ title?: string | null | undefined; /** * Controls whether this credential is the default for its auth method. On creation: if no credential exists yet for this auth method, the credential is automatically set as default when is_default is true or omitted; setting is_default to false is rejected because a default must exist. If other credentials already exist, setting is_default to true promotes this credential (demoting the previous default); false or omitted creates it as non-default. On update: true promotes this credential, false is rejected if it is currently the default (promote another credential first), omitted leaves the default status unchanged. */ isDefault?: boolean | null | undefined; /** * The credential data (headers, bearer_token, or OAuth2 client credentials). */ credentials?: ConnectionCredentialsInput | null | undefined; }; /** @internal */ export type CredentialsCreateOrUpdate$Outbound = { name: string; title?: string | null | undefined; is_default?: boolean | null | undefined; credentials?: ConnectionCredentialsInput$Outbound | null | undefined; }; /** @internal */ export const CredentialsCreateOrUpdate$outboundSchema: z.ZodType< CredentialsCreateOrUpdate$Outbound, CredentialsCreateOrUpdate > = z.object({ name: z.string(), title: z.nullable(z.string()).optional(), isDefault: z.nullable(z.boolean()).optional(), credentials: z.nullable(ConnectionCredentialsInput$outboundSchema).optional(), }).transform((v) => { return remap$(v, { isDefault: "is_default", }); }); export function credentialsCreateOrUpdateToJSON( credentialsCreateOrUpdate: CredentialsCreateOrUpdate, ): string { return JSON.stringify( CredentialsCreateOrUpdate$outboundSchema.parse(credentialsCreateOrUpdate), ); }