/* * 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"; import { SharepointData, SharepointData$inboundSchema, SharepointData$Outbound, SharepointData$outboundSchema, } from "./sharepointdata.js"; export type AuthenticatorSharepointConnection = { provider: "sharepoint"; data: SharepointData; /** * The email of the Sharepoint account this is for */ userEmail: string; credentials: OAuthRefreshTokenCredentials; }; /** @internal */ export const AuthenticatorSharepointConnection$inboundSchema: z.ZodType< AuthenticatorSharepointConnection, z.ZodTypeDef, unknown > = z.object({ provider: z.literal("sharepoint"), data: SharepointData$inboundSchema, user_email: z.string(), credentials: OAuthRefreshTokenCredentials$inboundSchema, }).transform((v) => { return remap$(v, { "user_email": "userEmail", }); }); /** @internal */ export type AuthenticatorSharepointConnection$Outbound = { provider: "sharepoint"; data: SharepointData$Outbound; user_email: string; credentials: OAuthRefreshTokenCredentials$Outbound; }; /** @internal */ export const AuthenticatorSharepointConnection$outboundSchema: z.ZodType< AuthenticatorSharepointConnection$Outbound, z.ZodTypeDef, AuthenticatorSharepointConnection > = z.object({ provider: z.literal("sharepoint"), data: SharepointData$outboundSchema, userEmail: z.string(), credentials: OAuthRefreshTokenCredentials$outboundSchema, }).transform((v) => { return remap$(v, { userEmail: "user_email", }); }); export function authenticatorSharepointConnectionToJSON( authenticatorSharepointConnection: AuthenticatorSharepointConnection, ): string { return JSON.stringify( AuthenticatorSharepointConnection$outboundSchema.parse( authenticatorSharepointConnection, ), ); } export function authenticatorSharepointConnectionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthenticatorSharepointConnection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthenticatorSharepointConnection' from JSON`, ); }