@nlabs/rip-hunter
Version:
JS utilities for AJAX and GraphQL
20 lines (19 loc) • 1.09 kB
TypeScript
export interface HunterOptionsType {
readonly headers?: Headers;
readonly token?: string;
readonly variables?: any;
}
export interface HunterQueryType {
readonly query: string;
readonly variables?: any;
}
export declare const removeSpaces: (str: string) => string;
export declare const queryString: (json: any) => string;
export declare const ajax: (url: string, method: string, params?: any, options?: HunterOptionsType) => Promise<any>;
export declare const get: (url: string, params?: any, options?: HunterOptionsType) => Promise<any>;
export declare const post: (url: string, params?: any, options?: HunterOptionsType) => Promise<any>;
export declare const put: (url: string, params?: any, options?: HunterOptionsType) => Promise<any>;
export declare const del: (url: string, params?: any, options?: HunterOptionsType) => Promise<any>;
export declare const toGql: (obj: any) => string;
export declare const graphqlQuery: (url: string, query: HunterQueryType | HunterQueryType[], options?: HunterOptionsType) => Promise<any>;
export { ApiError } from './errors/ApiError';