{"id":37049380,"url":"https://github.com/anttikajanus/tanka-graphql-net-client","last_synced_at":"2026-01-14T05:44:26.214Z","repository":{"id":38011383,"uuid":"163990994","full_name":"anttikajanus/tanka-graphql-net-client","owner":"anttikajanus","description":"Cross platform .Net client library for working with Tanka GraphQL execution library.","archived":false,"fork":false,"pushed_at":"2022-12-08T09:52:46.000Z","size":166,"stargazers_count":3,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-15T23:13:13.464Z","etag":null,"topics":["client-side","cross-platform","graphql","native-apps","netstandard20","signalr","signalr-core","signalr-hub","tanka","uwp","wpf","xamarin"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anttikajanus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-03T15:35:26.000Z","updated_at":"2022-09-09T12:02:49.000Z","dependencies_parsed_at":"2023-01-25T14:15:53.314Z","dependency_job_id":null,"html_url":"https://github.com/anttikajanus/tanka-graphql-net-client","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/anttikajanus/tanka-graphql-net-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttikajanus%2Ftanka-graphql-net-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttikajanus%2Ftanka-graphql-net-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttikajanus%2Ftanka-graphql-net-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttikajanus%2Ftanka-graphql-net-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anttikajanus","download_url":"https://codeload.github.com/anttikajanus/tanka-graphql-net-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttikajanus%2Ftanka-graphql-net-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28411287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-side","cross-platform","graphql","native-apps","netstandard20","signalr","signalr-core","signalr-hub","tanka","uwp","wpf","xamarin"],"created_at":"2026-01-14T05:44:25.552Z","updated_at":"2026-01-14T05:44:26.207Z","avatar_url":"https://github.com/anttikajanus.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nTanka GraphQL .NET Client library\n=====================================\n\nThis library provides easy to use cross-platform client API for [Tanka GraphQL execution library](https://github.com/pekkah/tanka-graphql) based server using [ASP.NET Core SignalR .NET Client](https://docs.microsoft.com/en-us/aspnet/core/signalr/dotnet-client?view=aspnetcore-2.2)s `HubConnection`. \n\n[![Build Status](https://dev.azure.com/anttikajanus/tanka-graphql-net-client/_apis/build/status/anttikajanus.tanka-graphql-net-client?branchName=master)](https://dev.azure.com/anttikajanus/tanka-graphql-net-client/_build/latest?definitionId=1?branchName=master)\n\n## Features\n\n- Execute queries, mutations and subscriptions using SignalR HubConnection\n- Supports GraphQL validation and tracing\n- Leverage power of SignalR communication techniques (WebSockets, Server-Sent Events, Long Polling) \n\n## Gettings started\n\n### Install\n\nCurrent release is available on Nuget gallery.\n\n```\nInstall-Package Tanka.GraphQL.Net.Client -Version 0.3.2\n```\n\nTo access latest (pre-release) builds, you can connect to a following feed:\n\n```\nhttps://pkgs.dev.azure.com/anttikajanus/_packaging/tanka-graphql-net-client-packages/nuget/v3/index.json\n```\n\nSee how to add custom nuget feeds in Visual Studio from [here](https://go.microsoft.com/fwlink/?linkid=698608)\n\n### Short API summary\n\n#### Add usings\n\n```csharp\nusing Tanka.GraphQL;\n```\n\n#### Defining models\n\nYou can define your DTOs as POCOs. In these examples, I'm using separate models for input and output messages. \n\n```csharp\npublic class Message\n{\n    public int Id { get; set; }\n    public string Content { get; set; }\n}\n\npublic class InputMessage\n{\n    public string Content { get; set; }\n}\n```\n\n#### Connect to the server endpoint\n\nCreate SignalR `HubConnection` normally. Read more [how to connect to a hub](https://docs.microsoft.com/en-us/aspnet/core/signalr/dotnet-client?view=aspnetcore-2.2#connect-to-a-hub)\n\nRead more about the server implementation from [Tanka GraphQL documentation](https://github.com/pekkah/tanka-graphql/tree/aef8fc4a8f9ae4da08812293ad0e7e51cf0312eb#server)\n\n```csharp\nvar connection = new HubConnectionBuilder()\n                    .WithUrl(\"http://localhost:5000/hubs/graphql\")\n                    .Build();\nawait connection.StartAsync();\n```\n\n#### Queries and mutations\n\nIn GraphQL both queries and mutations are defined as **queries** so they are handled the same way in the API. \n\n##### Query\n\n```csharp\nvar channelId = 1;\n\nvar channelMessageGQL = @\"query Messages($channelId: Int!) {\n                messages(channelId: $channelId) {\n                  id\n                  content\n                }\n            }\";\n\nvar queryRequest = new QueryRequest()\n{\n    Query = channelMessageGQL,\n    Variables = new Dictionary\u003cstring, object\u003e()\n        {\n            { \"channelId\", channelId }\n        }\n};\n\nvar result = await connection.QueryAsync(queryRequest);\nvar data = result.GetDataFieldAs\u003cList\u003cMessage\u003e\u003e();\n````\n\n##### Mutation\n\n```csharp\nvar postMessageMutationGQL = @\"mutation PostMessage($channelId: Int!, $message: InputMessage) {\n               postMessage(channelId: $channelId, message: $message) {\n                 id\n                 content\n               }\n            }\";\n\nvar queryRequest = new QueryRequest()\n{\n    Query = postMessageMutationGQL,\n    Variables = new Dictionary\u003cstring, object\u003e()\n        {\n            { \"channelId\", channelId },\n            { \"message\", new InputMessage() { Content = message } }\n        }\n};\n\nvar result = await connection.QueryAsync(queryRequest);\nvar data = result.GetDataFieldAs\u003cMessages\u003e();\n```\n\n#### Subscription\n\nAPI provides support for subscriptions as streams using `IObservable\u003cExecutionResult\u003e`. You can subscribe to the stream using `Subscribe` method.\n\n```csharp\n var channelSubsribtionGQL = @\"subscription MessageAdded($channelId: Int!) {\n                messageAdded(channelId: $channelId) {\n                  id\n                  content\n                }\n            }\";\n\nvar queryRequest = new QueryRequest()\n{\n    Query = channelSubsribtionGQL,\n    Variables = new Dictionary\u003cstring, object\u003e()\n        {\n            { \"channelId\", channelId}\n        }\n};\n\nvar subscriptionSource = new CancellationTokenSource();\nvar serverSubscription = await connection.SubscribeAsync(request, subscriptionSource);\nserverSubscription.Subscribe(\n                // On new message added\n                result =\u003e\n                {\n                    var message = result.GetDataFieldAs\u003cMessage\u003e();\n                    // Handle new message added\n                },\n                // On error corrured\n                error =\u003e\n                {\n                    //Handle error\n                },\n                // On completed\n                () =\u003e\n                {\n                   //No more messages coming\n                });\n                \n// Cancelling the subscription                \nsubscriptionSource.Cancel();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanttikajanus%2Ftanka-graphql-net-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanttikajanus%2Ftanka-graphql-net-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanttikajanus%2Ftanka-graphql-net-client/lists"}