/* * 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"; import { OAuthRefreshTokenCredentials, OAuthRefreshTokenCredentials$inboundSchema, OAuthRefreshTokenCredentials$Outbound, OAuthRefreshTokenCredentials$outboundSchema, } from "./oauthrefreshtokencredentials.js"; export type AuthenticatorSalesforceConnection = { provider: "salesforce"; /** * The email of the Salesforce account this is for */ userEmail: string; /** * The url of your Salesforce instance, where you go to login. */ url: string; credentials: OAuthRefreshTokenCredentials; }; /** @internal */ export const AuthenticatorSalesforceConnection$inboundSchema: z.ZodType< AuthenticatorSalesforceConnection, z.ZodTypeDef, unknown > = z.object({ provider: z.literal("salesforce"), user_email: z.string(), url: z.string(), credentials: OAuthRefreshTokenCredentials$inboundSchema, }).transform((v) => { return remap$(v, { "user_email": "userEmail", }); }); /** @internal */ export type AuthenticatorSalesforceConnection$Outbound = { provider: "salesforce"; user_email: string; url: string; credentials: OAuthRefreshTokenCredentials$Outbound; }; /** @internal */ export const AuthenticatorSalesforceConnection$outboundSchema: z.ZodType< AuthenticatorSalesforceConnection$Outbound, z.ZodTypeDef, AuthenticatorSalesforceConnection > = z.object({ provider: z.literal("salesforce"), userEmail: z.string(), url: z.string(), credentials: OAuthRefreshTokenCredentials$outboundSchema, }).transform((v) => { return remap$(v, { userEmail: "user_email", }); }); export function authenticatorSalesforceConnectionToJSON( authenticatorSalesforceConnection: AuthenticatorSalesforceConnection, ): string { return JSON.stringify( AuthenticatorSalesforceConnection$outboundSchema.parse( authenticatorSalesforceConnection, ), ); } export function authenticatorSalesforceConnectionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthenticatorSalesforceConnection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthenticatorSalesforceConnection' from JSON`, ); }