import { Observable } from 'rxjs'; import * as GQL from './graphqlschema'; export declare const graphQLContent: unique symbol; export interface GraphQLDocument { [graphQLContent]: string; } /** * Guarantees that the GraphQL query resulted in an error. */ export declare function isGraphQLError(result: GraphQLResult): result is ErrorGraphQLResult; export declare function dataOrThrowErrors(result: GraphQLResult): T; export interface GraphQLError extends Error { queryName: string; } export declare const createInvalidGraphQLQueryResponseError: (queryName: string) => GraphQLError; export declare const createInvalidGraphQLMutationResponseError: (queryName: string) => GraphQLError; /** * Use this template string tag for all GraphQL queries */ export declare const gql: (template: TemplateStringsArray, ...substitutions: any[]) => GraphQLDocument; export interface SuccessGraphQLResult { data: T; errors: undefined; } export interface ErrorGraphQLResult { data: undefined; errors: GQL.IGraphQLResponseError[]; } export declare type GraphQLResult = SuccessGraphQLResult | ErrorGraphQLResult; /** * Does a GraphQL query to the Sourcegraph GraphQL API running under `/.api/graphql` * * @param query The GraphQL query * @param variables A key/value object with variable values * @return Observable That emits the result or errors if the HTTP request failed */ export declare function queryGraphQL(query: GraphQLDocument, variables?: any): Observable>; /** * Does a GraphQL mutation to the Sourcegraph GraphQL API running under `/.api/graphql` * * @param mutation The GraphQL mutation * @param variables A key/value object with variable values * @return Observable That emits the result or errors if the HTTP request failed */ export declare function mutateGraphQL(mutation: GraphQLDocument, variables?: any): Observable>; //# sourceMappingURL=graphql.d.ts.map