import { Kernel } from "oly-core"; import { HttpClient, IHttpRequest } from "oly-http"; import { Pixie } from "./Pixie"; import { PixieSession } from "./PixieSession"; /** * It use HttpClient. * * All requests are wrapped with Pixie#fly(). * * A token is sent on each request if PixieSession exists. */ export declare class PixieHttp { apiRoot: string; protected kernel: Kernel; protected pixie: Pixie; protected session: PixieSession; protected client: HttpClient; /** * */ readonly root: string; /** * Create an identifier used by pixie data. * * @param method Http method * @param url Http url * @internal */ createCacheKey(method: string, url: string): string; /** * Create a new http request. * It's like HttpClient#request(), except that result * are stored into pixie data. * This data is reused browser-side after a server-side rendering. * * @param options HttpClient request options */ request(options: IHttpRequest): Promise; /** * Make a GET request. * GET should be used by default. * * @param url Complete url * @param options Request options */ get(url: string, options?: IHttpRequest): Promise; /** * Make a POST request. * POST should be used when you create data. * * @param url Complete url * @param data Request body * @param options Request options */ post(url: string, data?: any, options?: IHttpRequest): Promise; /** * Make a PUT request. * PUT should be used when you update data. * * @param url Complete url * @param data Request body * @param options Request options */ put(url: string, data?: any, options?: IHttpRequest): Promise; /** * Make a DEL request. * DEL should be used when you remove data. * * @param url Complete url * @param options Request options */ del(url: string, options?: IHttpRequest): Promise; }