Table of Contents

Class GraphQlClient

Namespace
BpNexT.NET.GraphQL.Client
Assembly
BpNexT.NET.GraphQL.dll

HTTP client wrapper for executing GraphQL queries. Injects bearer token authentication via IGraphQlAuthProvider.

public class GraphQlClient : IGraphQlClient
Inheritance
object
GraphQlClient
Implements
Extension Methods

Constructors

GraphQlClient(string, IGraphQlAuthProvider, HttpClient?, ILoggerFactory?)

Initializes a new instance of the GraphQlClient class.

public GraphQlClient(string endpoint, IGraphQlAuthProvider authProvider, HttpClient? httpClient = null, ILoggerFactory? loggerFactory = null)

Parameters

endpoint string

The GraphQL endpoint URL.

authProvider IGraphQlAuthProvider

The authentication provider.

httpClient HttpClient

Optional HTTP client instance. When provided, its lifetime is owned by the caller.

loggerFactory ILoggerFactory

Optional logger factory. If null, SDK logging is disabled for this client.

Methods

ExecuteAsync(string, object?, CancellationToken)

Executes a GraphQL query and returns the raw JSON response.

public Task<JObject> ExecuteAsync(string query, object? variables = null, CancellationToken cancellationToken = default)

Parameters

query string

The GraphQL query string.

variables object

Optional variables for the query.

cancellationToken CancellationToken

Token to cancel the request.

Returns

Task<JObject>

The parsed JSON response object.