import { Request, RequestInit, Response, BodyInit, Headers, URL, URLSearchParams, URLSearchParamsInit, fetch } from 'apollo-server-env'; import { DataSource, DataSourceConfig } from 'apollo-datasource'; import { HTTPCache } from './HTTPCache'; import { ApolloError } from 'apollo-server-errors'; declare type ValueOrPromise = T | Promise; declare module 'apollo-server-env/dist/fetch' { interface RequestInit { cacheOptions?: CacheOptions | ((response: Response, request: Request) => CacheOptions | undefined); } } export declare type RequestOptions = RequestInit & { path: string; params: URLSearchParams; headers: Headers; body?: Body; }; export interface CacheOptions { ttl?: number; } export declare type Body = BodyInit | object; export { Request }; export declare abstract class RESTDataSource extends DataSource { private httpFetch?; httpCache: HTTPCache; context: TContext; memoizedResults: Map>; baseURL?: string; memoizeGetRequests: boolean; constructor(httpFetch?: typeof fetch | undefined); initialize(config: DataSourceConfig): void; protected cacheKeyFor(request: Request): string; protected willSendRequest?(request: RequestOptions): ValueOrPromise; protected resolveURL(request: RequestOptions): ValueOrPromise; protected cacheOptionsFor?(response: Response, request: Request): CacheOptions | undefined; protected didReceiveResponse(response: Response, _request: Request): Promise; protected didEncounterError(error: Error, _request: Request): void; protected parseBody(response: Response): Promise; protected errorFromResponse(response: Response): Promise; protected get(path: string, params?: URLSearchParamsInit, init?: RequestInit): Promise; protected post(path: string, body?: Body, init?: RequestInit): Promise; protected patch(path: string, body?: Body, init?: RequestInit): Promise; protected put(path: string, body?: Body, init?: RequestInit): Promise; protected delete(path: string, params?: URLSearchParamsInit, init?: RequestInit): Promise; private fetch; protected trace(request: Request, fn: () => Promise): Promise; } //# sourceMappingURL=RESTDataSource.d.ts.map