/* * 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 { AccessTokenCredentials, AccessTokenCredentials$inboundSchema, AccessTokenCredentials$Outbound, AccessTokenCredentials$outboundSchema, } from "./accesstokencredentials.js"; import { SlackData, SlackData$inboundSchema, SlackData$Outbound, SlackData$outboundSchema, } from "./slackdata.js"; export type AuthenticatorSlackConnection = { provider: "slack"; data: SlackData; /** * The email of the Slack account this is for */ userEmail: string; credentials: AccessTokenCredentials; }; /** @internal */ export const AuthenticatorSlackConnection$inboundSchema: z.ZodType< AuthenticatorSlackConnection, z.ZodTypeDef, unknown > = z.object({ provider: z.literal("slack"), data: SlackData$inboundSchema, user_email: z.string(), credentials: AccessTokenCredentials$inboundSchema, }).transform((v) => { return remap$(v, { "user_email": "userEmail", }); }); /** @internal */ export type AuthenticatorSlackConnection$Outbound = { provider: "slack"; data: SlackData$Outbound; user_email: string; credentials: AccessTokenCredentials$Outbound; }; /** @internal */ export const AuthenticatorSlackConnection$outboundSchema: z.ZodType< AuthenticatorSlackConnection$Outbound, z.ZodTypeDef, AuthenticatorSlackConnection > = z.object({ provider: z.literal("slack"), data: SlackData$outboundSchema, userEmail: z.string(), credentials: AccessTokenCredentials$outboundSchema, }).transform((v) => { return remap$(v, { userEmail: "user_email", }); }); export function authenticatorSlackConnectionToJSON( authenticatorSlackConnection: AuthenticatorSlackConnection, ): string { return JSON.stringify( AuthenticatorSlackConnection$outboundSchema.parse( authenticatorSlackConnection, ), ); } export function authenticatorSlackConnectionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthenticatorSlackConnection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthenticatorSlackConnection' from JSON`, ); }