/* * 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"; export type AuthenticatorNotionConnection = { provider: "notion"; workspaceId: string; workspaceName: string; /** * The email of the Notion account this is for */ userEmail: string; credentials: AccessTokenCredentials; }; /** @internal */ export const AuthenticatorNotionConnection$inboundSchema: z.ZodType< AuthenticatorNotionConnection, z.ZodTypeDef, unknown > = z.object({ provider: z.literal("notion"), workspace_id: z.string(), workspace_name: z.string(), user_email: z.string(), credentials: AccessTokenCredentials$inboundSchema, }).transform((v) => { return remap$(v, { "workspace_id": "workspaceId", "workspace_name": "workspaceName", "user_email": "userEmail", }); }); /** @internal */ export type AuthenticatorNotionConnection$Outbound = { provider: "notion"; workspace_id: string; workspace_name: string; user_email: string; credentials: AccessTokenCredentials$Outbound; }; /** @internal */ export const AuthenticatorNotionConnection$outboundSchema: z.ZodType< AuthenticatorNotionConnection$Outbound, z.ZodTypeDef, AuthenticatorNotionConnection > = z.object({ provider: z.literal("notion"), workspaceId: z.string(), workspaceName: z.string(), userEmail: z.string(), credentials: AccessTokenCredentials$outboundSchema, }).transform((v) => { return remap$(v, { workspaceId: "workspace_id", workspaceName: "workspace_name", userEmail: "user_email", }); }); export function authenticatorNotionConnectionToJSON( authenticatorNotionConnection: AuthenticatorNotionConnection, ): string { return JSON.stringify( AuthenticatorNotionConnection$outboundSchema.parse( authenticatorNotionConnection, ), ); } export function authenticatorNotionConnectionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthenticatorNotionConnection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthenticatorNotionConnection' from JSON`, ); }