Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/request / dist / TwoRequest.d.ts
Size: Mime:
/**
 * @todo - should add .env logging
 */
import 'isomorphic-fetch';
import { Request as ExpressRequest } from 'express';
import { RequestBody, Params, Method, Credentials, CommonChildren, OneRequestStore, ApolloRequestOrRequest, OneRequestObj, HeadersObj, TransformParams, TransformResponse, OneRequestAdapter } from './typings';
declare class OneRequest<Context = any> {
    static init(args?: OneRequestObj): OneRequest<any>;
    context: Context;
    store: OneRequestStore;
    private _parent?;
    private _children?;
    constructor();
    setUrl(url: string): this;
    setMethod(method: Method): this;
    setDefaultParams(params?: any): this;
    setParamsTransform(): this;
    setMock(mock?: any): this;
    setFixture(mock?: any): this;
    setData(data?: any): this;
    toMock(data?: any): any;
    toWretch(): import("wretch/dist/wretcher").Wretcher;
    setDebug(shouldDebug?: boolean): this;
    from(obj?: OneRequestObj): this;
    named(named: string): this;
    debug(shouldDebug: boolean): this;
    parent(parent: OneRequest): this;
    children(): CommonChildren;
    child(childName: string): OneRequest<any>;
    /**
     * @todo validate url...
     */
    url(absoluteUrl: string): this;
    baseUrl(baseUrl: string): this;
    path(path: string): this;
    params(params: Params): this;
    body(body: RequestBody): this;
    tapRequestParams(tapParams: TransformParams): this;
    tapResponseData(tapResponse: TransformResponse): this;
    post(): this;
    get(): this;
    patch(): this;
    delete(): this;
    method(method: Method): this;
    /**
     * @todo should weakmap this...
     */
    toApollo(): import("./adapters/apollo").OneRequestApolloDataSource;
    /**
     * @protected
     * @todo make it settable...
     */
    toRequest(): Request;
    /**
     * same as () / .call() / .end() / .fetch() / send() / doRequest()
     */
    doRequest<ResponseType = any>(): Promise<any>;
    /**
     * @alias to
     * @todo pass in adapter here like `toFetch`, `toAxios`, `toApollo`
     */
    as(adapter?: OneRequestAdapter): import("./typings").AdapterType;
    forwardRequest(request: ApolloRequestOrRequest | ExpressRequest | any): this;
    cookie(cookieToSet: string | string[]): this;
    header(key: string, value: string): this;
    headers(headers?: Headers | HeadersObj): this;
    auth(credentials: Credentials): void;
    jwt(token: string): this;
    clone(): OneRequest<any>;
    /**
     * @todo should be @name .clear?
     */
    reset(): this;
    entries(): import("../../exotic-mono/exotic/dist/types/obj/cast/fromCollectionToObj").CollectionAsObj<any>;
    private _set;
    private _get;
    private _has;
    private _delete;
}
export { OneRequest };
export { OneRequest as Request };