NGql.Core
1.1.1-alpha.0.1
This is a prerelease version of NGql.Core.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NGql.Core --version 1.1.1-alpha.0.1
NuGet\Install-Package NGql.Core -Version 1.1.1-alpha.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NGql.Core" Version="1.1.1-alpha.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NGql.Core --version 1.1.1-alpha.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NGql.Core, 1.1.1-alpha.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NGql.Core as a Cake Addin #addin nuget:?package=NGql.Core&version=1.1.1-alpha.0.1&prerelease // Install NGql.Core as a Cake Tool #tool nuget:?package=NGql.Core&version=1.1.1-alpha.0.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NGql
Schemaless GraphQL client for .NET Core.
Quick Start
dotnet add package NGql.Core
Usage
Core library allows creation of Query
and Mutation
's.
Both have an implicit conversion to string
.
Query
var query = new Query("PersonAndFilms")
.Select(new Query("person")
.Where("id", "cGVvcGxlOjE=")
.Select("name")
.Select(new Query("filmConnection")
.Select(new Query("films")
.Select("title")))
);
the output will be the following
query PersonAndFilms{
person(id:"cGVvcGxlOjE="){
name
filmConnection{
films{
title
}
}
}
}
Mutation
var mutation = new Mutation("CreateUser")
.Select(new Query("createUser")
.Where("name", "Name")
.Where("password", "Password")
.Select("id", "name"))
.ToString();
the output will be the following
mutation CreateUser{
createUser(name:"Name", password:"Password"){
id
name
}
}
Variables
Variables allows to reuse existing queries and mutations instead of building them from start every time.
Passing variables
var variable = new Variable("$name", "String");
// pass as constructor parameter
var ctor = new Query("name", variables: variable);
// or as method variable
var fluent = new Query("name", variables: variable).Variable(variable););
the output will be the following
query name($name:String){
id
}
Getting data from server
You can check QueryTests that uses GraphQL.Client
var graphQLClient = new GraphQLHttpClient("http://swapi.apis.guru/", new NewtonsoftJsonSerializer());
var query = new Query("PersonAndFilms")
.Select(new Query("person")
.Where("id", "cGVvcGxlOjE=")
.Select("name")
.Select(new Query("filmConnection")
.Select(new Query("films")
.Select("title")))
);
var request = new GraphQLRequest
{
Query = query
};
var graphQLResponse = await graphQLClient.SendQueryAsync<ResponseType>(request);
var personName = graphQLResponse.Data.Person.Name;
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.4.0 | 121 | 5/30/2024 |
1.3.3 | 1,723 | 5/10/2024 |
1.3.2 | 98 | 5/10/2024 |
1.3.1 | 146 | 5/9/2024 |
1.3.0 | 116 | 5/8/2024 |
1.2.0 | 242 | 3/24/2024 |
1.1.1 | 3,587 | 10/16/2023 |
1.1.1-alpha.0.1 | 72 | 10/5/2023 |
1.1.0 | 2,653 | 10/3/2023 |
1.0.0 | 16,115 | 11/28/2021 |
0.1.6 | 1,290 | 11/19/2021 |
0.1.5 | 1,518 | 10/22/2021 |
0.1.3 | 1,376 | 10/11/2021 |
0.1.2 | 920 | 9/15/2021 |
0.1.1 | 786 | 9/9/2021 |
0.1.0 | 766 | 9/9/2021 |
0.0.0-alpha.0.24 | 70 | 10/3/2023 |