@graphql-mesh/transport-rest
Version:
29 lines (28 loc) • 1.44 kB
TypeScript
import { GraphQLField, GraphQLSchema } from 'graphql';
import { IStringifyOptions } from 'qs';
import { Logger, MeshFetch } from '@graphql-mesh/types';
type HTTPMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
export interface HTTPRootFieldResolverOpts {
sourceName: string;
endpoint: string;
path: string;
httpMethod: HTTPMethod;
operationSpecificHeaders: Record<string, string>;
isBinary: boolean;
requestBaseBody: any;
queryParamArgMap: Record<string, string>;
queryStringOptionsByParam: Record<string, IStringifyOptions & {
destructObject?: boolean;
}>;
jsonApiFields: boolean;
}
export interface GlobalOptions {
sourceName: string;
endpoint: string;
timeout: number;
operationHeaders: Record<string, string>;
queryStringOptions: IStringifyOptions;
queryParams: Record<string, string | number | boolean>;
}
export declare function addHTTPRootFieldResolver(schema: GraphQLSchema, field: GraphQLField<any, any>, globalLogger: Logger, globalFetch: MeshFetch, { path, operationSpecificHeaders, httpMethod, isBinary, requestBaseBody, queryParamArgMap, queryStringOptionsByParam, jsonApiFields, }: HTTPRootFieldResolverOpts, { sourceName, endpoint, timeout, operationHeaders: globalOperationHeaders, queryStringOptions: globalQueryStringOptions, queryParams: globalQueryParams, }: GlobalOptions): void;
export {};