UNPKG

graphql-request

Version:

[![CircleCI](https://circleci.com/gh/graphcool/graphql-request.svg?style=shield)](https://circleci.com/gh/graphcool/graphql-request) [![npm version](https://badge.fury.io/js/graphql-request.svg)](https://badge.fury.io/js/graphql-request)

28 lines (27 loc) 1.04 kB
import { GraphQLError, Headers as HttpHeaders, Options, Variables } from './types'; export { ClientError } from './types'; import 'cross-fetch/polyfill'; export declare class GraphQLClient { private url; private options; constructor(url: string, options?: Options); rawRequest<T extends any>(query: string, variables?: Variables): Promise<{ data?: T; extensions?: any; headers: Headers; status: number; errors?: GraphQLError[]; }>; request<T extends any>(query: string, variables?: Variables): Promise<T>; setHeaders(headers: HttpHeaders): GraphQLClient; setHeader(key: string, value: string): GraphQLClient; } export declare function rawRequest<T extends any>(url: string, query: string, variables?: Variables): Promise<{ data?: T; extensions?: any; headers: Headers; status: number; errors?: GraphQLError[]; }>; export declare function request<T extends any>(url: string, query: string, variables?: Variables): Promise<T>; export default request;