backport
Version:
A CLI tool that automates the process of backporting commits
28 lines (27 loc) • 1.01 kB
TypeScript
/** Low-level GraphQL client with retry logic (p-retry) for GitHub v4 API. */
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
import { GraphQLError } from 'graphql';
export interface GitHubGraphQLError extends GraphQLError {
type?: 'FORBIDDEN';
extensions: {
saml_failure?: boolean;
type?: string;
[key: string]: unknown;
};
originalError: ({
type?: 'NOT_FOUND';
} & GraphQLError['originalError']) | undefined;
}
export interface OperationResultWithMeta<Data = any> {
data: Data | undefined;
error: {
message: string;
graphQLErrors: GitHubGraphQLError[];
} | undefined;
responseHeaders: Headers | undefined;
statusCode: number | undefined;
}
export declare function graphqlRequest<TData, TVars>({ githubApiBaseUrlV4, githubToken, }: {
githubApiBaseUrlV4?: string;
githubToken: string;
}, document: TypedDocumentNode<TData, TVars>, variables: TVars): Promise<OperationResultWithMeta<TData>>;