mailslurp-client
Version:
Official client for MailSlurp Email and SMS API. Create email addresses and phone numbers in Javascript without a mail server. Send and receive real emails in applications or tests.
141 lines (140 loc) • 5.08 kB
TypeScript
/**
* MailSlurp API
* MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. It\'s designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export declare const BASE_PATH: string;
/**
* This is the base class for all generated API classes.
*/
export declare class BaseAPI {
protected configuration: Configuration;
private middleware;
constructor(configuration?: Configuration);
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
protected request(context: RequestOpts, initOverrides?: RequestInit): Promise<Response>;
private createFetchParams;
private fetchApi;
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone;
}
export declare class RequiredError extends Error {
field: string;
name: 'RequiredError';
constructor(field: string, msg?: string);
}
export declare const COLLECTION_FORMATS: {
csv: string;
ssv: string;
tsv: string;
pipes: string;
};
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
export interface ConfigurationParameters {
basePath?: string;
fetchApi?: FetchAPI;
middleware?: Middleware[];
queryParamsStringify?: (params: HTTPQuery) => string;
username?: string;
password?: string;
apiKey?: string | ((name: string) => string);
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
headers?: HTTPHeaders;
credentials?: RequestCredentials;
}
export declare class Configuration {
private configuration;
constructor(configuration?: ConfigurationParameters);
get basePath(): string;
get fetchApi(): FetchAPI;
get middleware(): Middleware[];
get queryParamsStringify(): (params: HTTPQuery) => string;
get username(): string | undefined;
get password(): string | undefined;
get apiKey(): ((name: string) => string) | undefined;
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
get headers(): HTTPHeaders | undefined;
get credentials(): RequestCredentials | undefined;
}
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
export type HTTPHeaders = {
[key: string]: string;
};
export type HTTPQuery = {
[key: string]: string | number | null | boolean | Array<string | number | null | boolean> | HTTPQuery;
};
export type HTTPBody = Json | FormData | URLSearchParams;
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export declare function exists(json: any, key: string): boolean;
export declare function querystring(params: HTTPQuery, prefix?: string): string;
export declare function mapValues(data: any, fn: (item: any) => any): {};
export declare function canConsumeForm(consumes: Consume[]): boolean;
export interface Consume {
contentType: string;
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export declare class JSONApiResponse<T> {
raw: Response;
private transformer;
constructor(raw: Response, transformer?: ResponseTransformer<T>);
value(): Promise<T>;
}
export declare class VoidApiResponse {
raw: Response;
constructor(raw: Response);
value(): Promise<void>;
}
export declare class BlobApiResponse {
raw: Response;
constructor(raw: Response);
value(): Promise<Blob>;
}
export declare class TextApiResponse {
raw: Response;
constructor(raw: Response);
value(): Promise<string>;
}