Strongly typed GraphQL client for .NET
Branch: master
Clone or download
Marek Magdziak
Marek Magdziak fix wrong binding creation
o Please enter the commit message for your changes. Lines starting
Latest commit 17287ab Oct 26, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
Telia.GraphQL.Tests fix wrong binding creation Oct 26, 2018
.gitattributes more cases covered Oct 3, 2018
LICENSE updates Sep 28, 2018
LICENSE.txt updates Sep 28, 2018
Telia.GraphQL.sln rebranding Sep 27, 2018
appveyor.yml appveyor configuration Oct 1, 2018
create-nuget.bat more cases covered Oct 3, 2018

Strongly typed client for GraphQL in .NET

NuGet Badge

This project is currently work in progress and contains only very basic functionality. Usage in production is discouraged unless you know what you're doing.

A typesafe way how to request data from GraphQL API.

First, you generate a model

You can get this Visual Studio extension which automatically generates a cs file out of graphql schema file.

For example this IDL

type Query {
	a: Int
	b(x: Int!): Int!

will be translated into

namespace Schema
    using System;
    using System.Collections.Generic;
    using Telia.GraphQL.Client.Attributes;

    public class Query
        public Int32? A

        public Int32 B(Int32 x)
            throw new InvalidOperationException();

Create a client based on your schema

This part will be eventually automated with schema generation

public class MyClient : GraphQLCLient<Query>
    public Client(string endpoint) : base(endpoint)

Then request your data using the generated model

Create requests towards your GraphQL API while keeping full intellisense over the schema.

For example:

var client = new MyClient("<your_endpoint>");

var data = client.Query(e => new
    a = e.A,
    b = e.B(12)