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<T extends GQL.IQuery | GQL.IMutation>(result: GraphQLResult<T>): result is ErrorGraphQLResult;
export declare function dataOrThrowErrors<T extends GQL.IQuery | GQL.IMutation>(result: GraphQLResult<T>): 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<T extends GQL.IQuery | GQL.IMutation> {
    data: T;
    errors: undefined;
}
export interface ErrorGraphQLResult {
    data: undefined;
    errors: GQL.IGraphQLResponseError[];
}
export declare type GraphQLResult<T extends GQL.IQuery | GQL.IMutation> = SuccessGraphQLResult<T> | 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<GraphQLResult<GQL.IQuery>>;
/**
 * 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<GraphQLResult<GQL.IMutation>>;
//# sourceMappingURL=graphql.d.ts.map