import { AjaxOptions } from "./AjaxOptions";
import { App } from "../../App";
import { CacheSeconds } from "../CacheService";
import { IJsonParserOptions, JsonService } from "../JsonService";
export interface IHttpHeaders {
    [key: string]: string;
}
export interface IApiResponse<T> {
    headers?: IHttpHeaders;
    value?: T;
}
export interface IMethodOptions {
    /**
     * Cache value retrieved from server in JavaScript runtime for
     * given seconds
     */
    jsCacheSeconds?: CacheSeconds<any>;
    /**
     * Accept header, application/json if not set
     */
    accept?: string;
    /**
     * Other headers to pass along with the request
     */
    headers?: IHttpHeaders;
    /**
     * JsonService options to use with this request, use this only if naming strategy
     * is different for this request
     */
    jsonOptions?: IJsonParserOptions;
    /**
     * If you want to inspect response headers, pass this true, but make sure you have
     * return type as IApiResponse<T>
     */
    returnHeaders?: boolean;
}
export declare type RestAttr = (target: BaseService, propertyKey: string | symbol, parameterIndex: number) => void;
export declare type RestParamAttr = (key: string, defaultValue?: any) => RestAttr;
export declare type RestMethodAttr = (key: string, options?: IMethodOptions) => (target: BaseService, propertyKey: string | symbol, descriptor: any) => void;
/**
 * This will register Url path fragment on parameter.
 *
 * @example
 *
 *      @Get("/api/products/{category}")
 *      async getProducts(
 *          @Path("category")  category: number
 *      ): Promise<Product[]> {
 *      }
 *
 * @export
 * @function Path
 * @param {name} - Name of the parameter
 */
export declare const Path: RestParamAttr;
/**
 * This will register header on parameter.
 *
 * @example
 *
 *      @Get("/api/products/{category}")
 *      async getProducts(
 *          @Header("x-http-auth")  category: number
 *      ): Promise<Product[]> {
 *      }
 *
 * @export
 * @function Path
 * @param {name} - Name of the parameter
 */
export declare const Header: RestParamAttr;
/**
 * This will register Url query fragment on parameter.
 *
 * @example
 *
 *      @Get("/api/products")
 *      async getProducts(
 *          @Query("category")  category: number
 *      ): Promise<Product[]> {
 *      }
 *
 * @export
 * @function Query
 * @param {name} - Name of the parameter
 */
export declare const Query: RestParamAttr;
/**
 * This will register data fragment on ajax.
 *
 * @example
 *
 *      @Post("/api/products")
 *      async getProducts(
 *          @Query("id")  id: number,
 *          @Body product: Product
 *      ): Promise<Product[]> {
 *      }
 *
 * @export
 * @function Body
 */
export declare const Body: RestAttr;
export declare const RawBody: RestAttr;
/**
 * This will register data fragment on ajax in old formModel way.
 *
 * @example
 *
 *      @Post("/api/products")
 *      async getProducts(
 *          @Query("id")  id: number,
 *          @BodyFormModel product: Product
 *      ): Promise<Product[]> {
 *      }
 *
 * @export
 * @function BodyFormModel
 */
export declare const BodyFormModel: RestAttr;
export declare const XmlBody: RestAttr;
/**
 * Http Post method
 * @example
 *
 *      @Post("/api/products")
 *      async saveProduct(
 *          @Body product: Product
 *      ): Promise<Product> {
 *      }
 *
 * @export
 * @function Post
 * @param {url} - Url for the operation
 */
export declare const Post: RestMethodAttr;
/**
 * Http Get Method
 *
 * @example
 *
 *      @Get("/api/products/{category}")
 *      async getProducts(
 *          @Path("category") category?:string
 *      ): Promise<Product[]> {
 *      }
 *
 * @export
 * @function Body
 */
export declare const Get: RestMethodAttr;
/**
 * Http Delete method
 * @example
 *
 *      @Delete("/api/products")
 *      async deleteProduct(
 *          @Body product: Product
 *      ): Promise<Product> {
 *      }
 *
 * @export
 * @function Delete
 * @param {url} - Url for the operation
 */
export declare const Delete: RestMethodAttr;
/**
 * Http Put method
 * @example
 *
 *      @Put("/api/products")
 *      async saveProduct(
 *          @Body product: Product
 *      ): Promise<Product> {
 *      }
 *
 * @export
 * @function Put
 * @param {url} - Url for the operation
 */
export declare const Put: RestMethodAttr;
/**
 * Http Patch method
 * @example
 *
 *      @Patch("/api/products")
 *      async saveProduct(
 *          @Body product: any
 *      ): Promise<Product> {
 *      }
 *
 * @export
 * @function Patch
 * @param {url} - Url for the operation
 */
export declare const Patch: RestMethodAttr;
/**
 * Cancellation token
 * @example
 *
 *      @Put("/api/products")
 *      async saveProduct(
 *          @Body product: Product
 *          @Cancel cancel: CancelToken
 *      ): Promise<Product> {
 *      }
 *
 * @export
 * @function Put
 * @param {url} - Url for the operation
 */
export declare function Cancel(target: BaseService, propertyKey: string | symbol, parameterIndex: number): void;
export declare class ServiceParameter {
    readonly type: string;
    readonly key: string;
    readonly defaultValue?: any;
    constructor(type: string, key: string, defaultValue?: any);
}
export default function BaseUrl(baseUrl: string): ((target: any) => void);
/**
 *
 *
 * @export
 * @class BaseService
 */
export declare class BaseService {
    protected readonly app: App;
    readonly jsonService: JsonService;
    static baseUrls: {
        [key: string]: string;
    };
    baseUrl: string;
    testMode: boolean;
    showProgress: boolean;
    showError: boolean;
    methods: any;
    methodReturns: any;
    jsonOptions: IJsonParserOptions;
    constructor(app: App, jsonService: JsonService);
    protected encodeData(o: AjaxOptions): AjaxOptions;
    protected sendResult(result: any, error?: any): Promise<any>;
    protected invoke(url: string, method: string, bag: ServiceParameter[], values: any[], methodOptions: IMethodOptions): Promise<any>;
    protected parseHeaders(headers: string | any): IHttpHeaders;
    protected ajax(url: string, options: AjaxOptions): Promise<AjaxOptions>;
}
//# sourceMappingURL=RestService.d.ts.map