Prakrishtha.GraphqlHttpClient
1.0.1
dotnet add package Prakrishtha.GraphqlHttpClient --version 1.0.1
NuGet\Install-Package Prakrishtha.GraphqlHttpClient -Version 1.0.1
<PackageReference Include="Prakrishtha.GraphqlHttpClient" Version="1.0.1" />
<PackageVersion Include="Prakrishtha.GraphqlHttpClient" Version="1.0.1" />
<PackageReference Include="Prakrishtha.GraphqlHttpClient" />
paket add Prakrishtha.GraphqlHttpClient --version 1.0.1
#r "nuget: Prakrishtha.GraphqlHttpClient, 1.0.1"
#:package Prakrishtha.GraphqlHttpClient@1.0.1
#addin nuget:?package=Prakrishtha.GraphqlHttpClient&version=1.0.1
#tool nuget:?package=Prakrishtha.GraphqlHttpClient&version=1.0.1
GraphqlHttpClient
Very simple Graphql http client for .net by taking advantage of IHttpClientFactory from latest version of .net core and standard
Build Status:
Nuget package installation:
Install-Package Prakrishtha.GraphqlHttpClient -Version 1.0.0
The response object has Data, status code, response time, error message (if any) properties which will be helpful when you interpret the result.
public interface IGraphqlResponse<TEntity> where TEntity : class
{
/// <summary>
/// Gets or sets graphql response data
/// </summary>
TEntity Data { get; set; }
/// <summary>
/// Gets or sets the error occured on execution of the query
/// </summary>
IEnumerable<GraphqlError> Errors { get; set; }
/// <summary>
/// Gets has data flag, returns true if the response has data
/// </summary>
bool HasData { get; }
/// <summary>
/// Gets has error flag, returns true if the response has any error
/// </summary>
bool HasError { get; }
/// <summary>
/// Gets status code flag, returns true if the http status code between 200 and 300
/// </summary>
bool IsSuccessCode { get; }
/// <summary>
/// Gets or sets the http status code
/// </summary>
HttpStatusCode StatusCode { get; set; }
/// <summary>
/// Gets or sets the time taken by operation in milli seconds
/// </summary>
long ElapsedTime { get; set; }
}
There is an extension method available to add Graphql client with inbuilt IoC container.
services.AddGraphqlHttpClient();
If you want to set base url and time out at the time of configuration, it can be achieved with the below code.
services.AddGraphqlHttpClient(new Uri("https://github.com"), new TimeSpan(0,0,20));
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- System.Text.Json (>= 8.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.