/**
 * 统一接口公共模块
 * @date 2022-03-04
 * @author 何华东
 */
import { AxiosInstance } from 'axios';
import { TyApiConfig } from './Config';
/**
 * 统一接口请求基类
 */
export declare class ApiRequestBase {
    /**
     * 车场id
     */
    parkId?: any;
    /**
     * 接口业务代码
     */
    serviceCode?: string;
}
/**
 * 统一/非标接口响应
 */
export declare class ApiResponse<T = any> {
    constructor(resCode: any);
    /**
     * 响应码,0为成功
     */
    resCode: string;
    /**
     * 响应信息
     */
    resMsg?: string;
    /**
     * 响应数据
     */
    data?: T;
    /**
     * 判断响应码是否为成功
     */
    static resCodeIsSuccess(resCode: string): boolean;
    /**
     * 判断响应是否成功
     */
    static isSuccess(apiResponse: ApiResponse): boolean;
    /**
     * 成功响应实例,resCode=0
     */
    static readonly success: ApiResponse;
    /**
     * 创建一个失败响应，默认响应码为-1
     * @param resMsg
     * @returns
     */
    static failed(resMsg?: string): ApiResponse<any>;
    /**
     * 重推响应实例,resCode=999
     */
    static readonly repush: ApiResponse;
    static successWithData(data: any): ApiResponse<any>;
    static successWithMsg(resMsg: string): ApiResponse<any>;
}
/**
 * 如果统一接口返回的响应码为非成功，则抛出异常
 *
 * @throws {@link Error} if `!ApiResponse.resCodeIsSuccess(apiResponse.resCode)`
 */
export declare function throwIfResCodeNoSuccess(res: ApiResponse): void;
/**
 * 签名工具
 */
export declare class SignUtils {
    /**
     * 获取签名
     */
    static getSign(data: object, appSecret: string): any;
}
/**
 * 统一上行接口装饰器
 *
 * 对请求进行验签(仅`PROD`环境), 异常捕获, 记录日志, 自动返回失败报文`ApiResponse.failed('xxx')`
 *
 * ```ts
 * import { Singleton } from "typescript-ioc";
 * import { IService } from "mslib"
 * import { TyApi, TyExternalApi, ApiResponse } from "refs/nslib";
 *
 * export class PostCarInInfo implements IService {
 *    //去掉注释
 *    //@TyApi.Service()
 *    async doService(input: TyExternalApi.PostCarInInfoInput): Promise<ApiResponse> {
 *        //todo...
 *
 *        return ApiResponse.success;
 *    }
 * }
 * ```
 * @param description 服务描述，仅为日志输出
 */
export declare function Service(description?: string, config?: {
    isLog?: boolean;
}): MethodDecorator;
export declare function generateAxiosInstance(config: TyApiConfig): AxiosInstance;
/**
 * 统一接口axios实例
 *
 * `Ioc`注册`tyApi`配置将会自动创建该实例; @see {@link Config}
 *
 * 如已引用配置依赖[NsConfig](https://me.keytop.cn/service/config), 那么该实例的根地址将会以配置中心的统一接口根地址为准
 *
 * ```ts
 * import { axiosInstance } from "refs/nslib";
 *
 * //直接使用axios实例调用未封装的接口
 * //公共参数不需要赋值，会自动填充
 * //serviceCode也可以不填, 会自动按照接口地址最后一个单词(首字母转小写)填充，如果servieceCode不遵循此规则，则需要手动赋值
 * let res = await axiosInstance.post('get', {
 *    data:1
 * });
 * ```
 */
export declare let axiosInstance: AxiosInstance;
