/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { GmailData, GmailData$inboundSchema, GmailData$Outbound, GmailData$outboundSchema, } from "./gmaildata.js"; import { OAuthRefreshTokenCredentials, OAuthRefreshTokenCredentials$inboundSchema, OAuthRefreshTokenCredentials$Outbound, OAuthRefreshTokenCredentials$outboundSchema, } from "./oauthrefreshtokencredentials.js"; export type AuthenticatorGmailConnection = { provider: "gmail"; data: GmailData; /** * The email of the Google Drive account this is for */ email: string; credentials: OAuthRefreshTokenCredentials; }; /** @internal */ export const AuthenticatorGmailConnection$inboundSchema: z.ZodType< AuthenticatorGmailConnection, z.ZodTypeDef, unknown > = z.object({ provider: z.literal("gmail"), data: GmailData$inboundSchema, email: z.string(), credentials: OAuthRefreshTokenCredentials$inboundSchema, }); /** @internal */ export type AuthenticatorGmailConnection$Outbound = { provider: "gmail"; data: GmailData$Outbound; email: string; credentials: OAuthRefreshTokenCredentials$Outbound; }; /** @internal */ export const AuthenticatorGmailConnection$outboundSchema: z.ZodType< AuthenticatorGmailConnection$Outbound, z.ZodTypeDef, AuthenticatorGmailConnection > = z.object({ provider: z.literal("gmail"), data: GmailData$outboundSchema, email: z.string(), credentials: OAuthRefreshTokenCredentials$outboundSchema, }); export function authenticatorGmailConnectionToJSON( authenticatorGmailConnection: AuthenticatorGmailConnection, ): string { return JSON.stringify( AuthenticatorGmailConnection$outboundSchema.parse( authenticatorGmailConnection, ), ); } export function authenticatorGmailConnectionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthenticatorGmailConnection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthenticatorGmailConnection' from JSON`, ); }