{"id":14975951,"url":"https://github.com/rdavydenko/smartgraphqlclient","last_synced_at":"2025-10-26T10:47:12.090Z","repository":{"id":176449193,"uuid":"657627041","full_name":"RDavydenko/SmartGraphQLClient","owner":"RDavydenko","description":"Back-to-back GraphQL client using Linq-syntax","archived":false,"fork":false,"pushed_at":"2024-08-02T21:51:27.000Z","size":124,"stargazers_count":13,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T21:27:27.337Z","etag":null,"topics":["back-to-back","csharp","graphql","graphql-client","linq","linq-to-graphql","open-source"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RDavydenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-23T13:25:01.000Z","updated_at":"2024-10-09T07:40:00.000Z","dependencies_parsed_at":"2024-09-23T19:01:20.322Z","dependency_job_id":null,"html_url":"https://github.com/RDavydenko/SmartGraphQLClient","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":"0.45833333333333337","last_synced_commit":"466edb6a6fc587b9a2252f989328693dc5bdf2ab"},"previous_names":["rdavydenko/smartgraphqlclient"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RDavydenko/SmartGraphQLClient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDavydenko%2FSmartGraphQLClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDavydenko%2FSmartGraphQLClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDavydenko%2FSmartGraphQLClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDavydenko%2FSmartGraphQLClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RDavydenko","download_url":"https://codeload.github.com/RDavydenko/SmartGraphQLClient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDavydenko%2FSmartGraphQLClient/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281092772,"owners_count":26442440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["back-to-back","csharp","graphql","graphql-client","linq","linq-to-graphql","open-source"],"created_at":"2024-09-24T13:52:55.896Z","updated_at":"2025-10-26T10:47:12.047Z","avatar_url":"https://github.com/RDavydenko.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SmartGraphQLClient\nBack-to-back GraphQL client using Linq-syntax\n\n## Install NuGet package\nUsing Package Manager:\n``` shell\nInstall-Package SmartGraphQLClient\n```\nor \n\nUsing .NET CLI:\n``` shell\ndotnet add package SmartGraphQLClient\n```\n\n## Usage\n\n### 1. Add required services to DI\n``` csharp\nusing SmartGraphQLClient;\n\nservices.AddSmartGraphQLClient();\n```\n\n### 2. Write GraphQL-request with Linq-syntax\n``` csharp\nusing SmartGraphQLClient;\n\nGraphQLHttpClient client = ... // from DI\n\nvar users = await client.Query\u003cUserModel\u003e(\"users\")\n    .Include(x =\u003e x.Roles)\n        .ThenInclude(x =\u003e x.Users)\n    .Where(x =\u003e x.UserName.StartsWith(\"A\") || x.Roles.Any(r =\u003e r.Code == RoleCode.ADMINISTRATOR))\n    .OrderBy(x =\u003e x.Id)\n      .ThenByDescending(x =\u003e x.UserName)\n    .Select(x =\u003e new \n    {\n        x.Id,\n        Name = x.UserName,\n        x.Roles,\n        IsAdministrator = x.Roles.Any(r =\u003e r.Code == RoleCode.ADMINISTRATOR)\n    })\n    .Skip(5)\n    .Take(10)\n    .Argument(\"secretKey\", \"1234\")\n    .ToListAsync();\n\n```\n\n## Explanation\nWhen you call materializing method (`ToListAsync()`, `ToArrayAsync()`, `FirstAsync()`, etc.), the `GraphQLHttpClient` will build a string query and send it to the GraphQL-server, get a response and materialize the result.\n\nQuery-string from example:\n``` graphql\n{ \n    users (\n      where: {\n        or: [ \n          { userName: { startsWith: \"A\" } }\n          { roles: { some: { code: { eq: ADMINISTRATOR } } } }\n        ]\n      }\n      order: [\n        { id: ASC }\n        { userName: DESC }\n      ]\n      skip: 5\n      take: 10\n      secretKey: \"1234\"\n  ) {\n        id\n        userName\n        roles {\n            code\n            name\n            description\n            id\n            users {\n                userName\n                age\n                id\n            }\n        }\n    }\n}\n```\n\n## More examples\nSee more examples in unit-tests [directory](https://github.com/RDavydenko/SmartGraphQLClient/tree/master/src/SmartGraphQLClient.Tests/Core/GraphQLHttpClient): \n1) more requests (`ToListAsync()`, `ToPageAsync()`, `FirstOrDefaultAsync()`)\n2) attributes (`GraphQLEndpointAttribute`, `GraphQLIgnoreAttribute`, `GraphQLPropertyNameAttribute`)\n3) authorized graphql-http-client (`IGraphQLAuthorizationService\u003c\u003e` for providing tokens in runtime and cache tokens)\n4) and more\n\n## Compatibility\nRequests were tested on [HotChocolate](https://github.com/ChilliCream/graphql-platform/) GraphQL-server. See their [documentation](https://chillicream.com/docs/hotchocolate/v13).\n\n## Features\n| feature's name             | package's version |    |\n|----------------------------|----------------|----|\n| Build Where-string         | 1.0.0          | ✅ |\n| Build Select-string        | 1.0.0          | ✅ |\n| Build Order-string         | 1.0.0          | ✅ |\n| Offset paging (skip, take) | 1.0.0          | ✅ |\n| Custom arguments           | 1.0.0          | ✅ |\n| Execute raw query          | 1.1.0          | ✅ |\n| Cursor paging              |                | ❌ |\n\n## Links\nhttps://www.nuget.org/packages/SmartGraphQLClient/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdavydenko%2Fsmartgraphqlclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdavydenko%2Fsmartgraphqlclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdavydenko%2Fsmartgraphqlclient/lists"}