/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 3aa14ea241e8 */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { GleanBaseError } from "./gleanbaseerror.js"; export type GleanDataErrorData = { /** * Indicates the gmail results could not be fetched due to bad token. */ badGmailToken?: boolean | undefined; /** * Indicates the outlook results could not be fetched due to bad token. */ badOutlookToken?: boolean | undefined; /** * Indicates results could not be fetched due to invalid operators in the query. */ invalidOperators?: Array | undefined; errorMessages?: Array | undefined; /** * Indicates the federated search results could not be fetched due to rate limiting. */ federatedSearchRateLimitError?: boolean | undefined; }; export class GleanDataError extends GleanBaseError { /** * Indicates the gmail results could not be fetched due to bad token. */ badGmailToken?: boolean | undefined; /** * Indicates the outlook results could not be fetched due to bad token. */ badOutlookToken?: boolean | undefined; /** * Indicates results could not be fetched due to invalid operators in the query. */ invalidOperators?: Array | undefined; errorMessages?: Array | undefined; /** * Indicates the federated search results could not be fetched due to rate limiting. */ federatedSearchRateLimitError?: boolean | undefined; /** The original data that was passed to this error instance. */ data$: GleanDataErrorData; constructor( err: GleanDataErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.badGmailToken != null) this.badGmailToken = err.badGmailToken; if (err.badOutlookToken != null) this.badOutlookToken = err.badOutlookToken; if (err.invalidOperators != null) { this.invalidOperators = err.invalidOperators; } if (err.errorMessages != null) this.errorMessages = err.errorMessages; if (err.federatedSearchRateLimitError != null) { this.federatedSearchRateLimitError = err.federatedSearchRateLimitError; } this.name = "GleanDataError"; } } /** @internal */ export const GleanDataError$inboundSchema: z.ZodType< GleanDataError, z.ZodTypeDef, unknown > = z.object({ badGmailToken: z.boolean().optional(), badOutlookToken: z.boolean().optional(), invalidOperators: z.array(components.InvalidOperatorValueError$inboundSchema) .optional(), errorMessages: z.array(components.ErrorMessage$inboundSchema).optional(), federatedSearchRateLimitError: z.boolean().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new GleanDataError(v, { request: v.request$, response: v.response$, body: v.body$, }); });