{"id":20887964,"url":"https://github.com/canop/byo-graphql","last_synced_at":"2025-07-29T11:09:52.653Z","repository":{"id":62438661,"uuid":"318226958","full_name":"Canop/byo-graphql","owner":"Canop","description":"A simple \"bring your own types and queries\" GraphQL client","archived":false,"fork":false,"pushed_at":"2024-03-11T19:33:07.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-25T05:58:18.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Canop.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}},"created_at":"2020-12-03T14:53:41.000Z","updated_at":"2024-09-17T10:08:46.000Z","dependencies_parsed_at":"2022-11-01T21:47:46.394Z","dependency_job_id":null,"html_url":"https://github.com/Canop/byo-graphql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Canop/byo-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fbyo-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fbyo-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fbyo-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fbyo-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Canop","download_url":"https://codeload.github.com/Canop/byo-graphql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fbyo-graphql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267677350,"owners_count":24126313,"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-07-29T02:00:12.549Z","response_time":2574,"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":[],"created_at":"2024-11-18T08:23:33.932Z","updated_at":"2025-07-29T11:09:52.623Z","avatar_url":"https://github.com/Canop.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MIT][s2]][l2] [![Latest Version][s1]][l1] [![docs][s3]][l3] [![Chat on Miaou][s4]][l4]\n\n[s1]: https://img.shields.io/crates/v/byo-graphql.svg\n[l1]: https://crates.io/crates/byo-graphql\n\n[s2]: https://img.shields.io/badge/license-MIT-blue.svg\n[l2]: LICENSE\n\n[s3]: https://docs.rs/byo-graphql/badge.svg\n[l3]: https://docs.rs/byo-graphql/\n\n[s4]: https://miaou.dystroy.org/static/shields/room.svg\n[l4]: https://miaou.dystroy.org/3\n\n\nA simple *\"bring your own queries and types\"* GraphQL client.\n\n# Design Principles\n\n* I want to use my own Rust structures and not have them generated by macros\n* I want to use my own queries and not have them generated by macros\n* I want to manage queries as strings in my Rust code\n\n# Why not use it\n\n* For now it's very young, the API may grow and change\n* There's already a popular and well tested [GraphQL client in Rust](https://github.com/graphql-rust/graphql-client)\n\n# How to use it\n\n## Simple query\n\nThe [github stars example](examples/github-stars/main.rs) demonstrates querying GitHub's GraphQL API to get the number of stars of a repository.\n\nFirst create a client, that you may keep and reuse:\n\n```rust\nlet mut graphql_client = GraphqlClient::new(\"https://api.github.com/graphql\")?;\ngraphql_client.set_bearer_auth(\"your-github-api-token\");\n```\n\nYou need the struct into which to deserialize the server's answer:\n\n```rust\n#[derive(Deserialize)]\npub struct Repository {\n    stargazers: Count,\n}\n```\n(`Count` is a utility struct provided by byo_graphql, it's just `struct Count { totalCount: usize }`)\n\nAnd you need a query:\n```rust\nlet query = r#\"{\n\trepository(owner: \"Canop\", name: \"bacon\") {\n\t    stargazers {\n\t\ttotalCount\n\t    }\n\t}\n}\"#;\n```\n**note:** in the example's complete code, the query is dynamically built with `format!`, as you'll usually do.\n\nNow you can fetch the data:\n\n```rust\nlet repo: Repository = graphql_client.get_first_item(query).await?;\nlet stars: usize = repo.stargazers.into();\n```\n\n## Querying a long list\n\nThe [github issues example](examples/github-issues/main.rs) demonstrates how to query a long list with a cursor based exchange.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fbyo-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanop%2Fbyo-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fbyo-graphql/lists"}