UNPKG

1.02 kBTypeScriptView Raw
1/// <reference types="express" />
2import { NextFunction, Request, Response } from "express";
3export interface IMarvelErrorMessage {
4 UNAUTHORIZED_ACCESS: string;
5}
6export interface IMarvelErrorCode {
7 AUTH_FAIL: number;
8}
9export interface IMarvelOption {
10 query?: any;
11 body?: any;
12 headers?: {
13 [key: string]: string;
14 };
15 method?: string;
16}
17export interface IMarvelClientOption {
18 marvelApi: string;
19 projectName: string;
20 secret: string;
21}
22export interface IMarvelRequest extends Request {
23 marvel: (url: string, params?: IMarvelOption, projectSuffix?: string) => Promise<any>;
24}
25export declare const checkAuth: (errorMessage: IMarvelErrorMessage, errorCode: IMarvelErrorCode, secret: string) => (req: Request, res: Response, next: NextFunction) => void;
26export declare let marvel: (url: string, params?: IMarvelOption) => Promise<never>;
27export declare const marvelMiddleWare: (options: IMarvelClientOption) => (req: IMarvelRequest, res: Response, next: NextFunction) => void;