nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
129 lines (128 loc) • 3.39 kB
TypeScript
/**
* Base class for all Nylas API errors.
*/
export declare abstract class AbstractNylasApiError extends Error {
/**
* The unique identifier of the request.
*/
requestId?: string;
/**
* The HTTP status code of the error response.
*/
statusCode?: number;
/**
* The flow ID
* Provide this to Nylas support to help trace requests and responses
*/
flowId?: string | null;
/**
* The response headers
*/
headers?: Record<string, string>;
}
/**
* Base class for all Nylas SDK errors.
*/
export declare abstract class AbstractNylasSdkError extends Error {
}
/**
* Class representation of a general Nylas API error.
*/
export declare class NylasApiError extends AbstractNylasApiError implements NylasApiErrorResponseData {
/**
* Error type.
*/
type: string;
/**
* Provider Error.
*/
providerError: any;
constructor(apiError: NylasApiErrorResponse, statusCode?: number, requestId?: string, flowId?: string, headers?: Record<string, string>);
}
/**
* Class representing an OAuth error returned by the Nylas API.
*/
export declare class NylasOAuthError extends AbstractNylasApiError implements NylasOAuthErrorResponse {
/**
* Error type.
*/
error: string;
/**
* Error code used for referencing the docs, logs, and data stream.
*/
errorCode: number;
/**
* Human readable error description.
*/
errorDescription: string;
/**
* URL to the related documentation and troubleshooting regarding this error.
*/
errorUri: string;
constructor(apiError: NylasOAuthErrorResponse, statusCode?: number, requestId?: string, flowId?: string, headers?: Record<string, string>);
}
/**
* Error thrown when the Nylas SDK times out before receiving a response from the server
*/
export declare class NylasSdkTimeoutError extends AbstractNylasSdkError {
/**
* The URL that timed out
*/
url: string;
/**
* The timeout value set in the Nylas SDK, in seconds
*/
timeout: number;
/**
* The request ID
*/
requestId?: string;
/**
* The flow ID
* Provide this to Nylas support to help trace requests and responses
*/
flowId?: string;
/**
* The response headers
*/
headers?: Record<string, string>;
constructor(url: string, timeout: number, requestId?: string, flowId?: string, headers?: Record<string, string>);
}
/**
* Interface representing the error response from the Nylas API.
*/
export interface NylasApiErrorResponse {
requestId: string;
error: NylasApiErrorResponseData;
flowId?: string;
headers?: Record<string, string>;
}
/**
* Interface representing the error data within the response object.
*/
export interface NylasApiErrorResponseData {
type: string;
message: string;
providerError?: any;
}
/**
* Interface representing an OAuth error returned by the Nylas API.
*/
export interface NylasOAuthErrorResponse {
/**
* Error type.
*/
error: string;
/**
* Error code used for referencing the docs, logs, and data stream.
*/
errorCode: number;
/**
* Human readable error description.
*/
errorDescription: string;
/**
* URL to the related documentation and troubleshooting regarding this error.
*/
errorUri: string;
}