( account: Account, query: TypedDocumentString<TResult, TVariables>, variables: TVariables, )
| 15 | * @returns Resolves to a typed GitHub GraphQL response. |
| 16 | */ |
| 17 | export async function performGraphQLRequest<TResult, TVariables>( |
| 18 | account: Account, |
| 19 | query: TypedDocumentString<TResult, TVariables>, |
| 20 | variables: TVariables, |
| 21 | ): Promise<TResult> { |
| 22 | const octokit = await createOctokitClient(account, 'graphql'); |
| 23 | |
| 24 | try { |
| 25 | return await octokit.graphql<TResult>(query.toString(), variables || {}); |
| 26 | } catch (error) { |
| 27 | if (error instanceof GraphqlResponseError) { |
| 28 | handleGraphQLResponseError<TResult>('performGraphQLRequest', error); |
| 29 | } else { |
| 30 | throw error; |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Perform a GraphQL API request using a raw query string instead of a TypedDocumentString. |
no test coverage detected