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