{"id":16366445,"url":"https://github.com/steebchen/gqlclient","last_synced_at":"2025-10-26T07:30:29.183Z","repository":{"id":57481831,"uuid":"190096866","full_name":"steebchen/gqlclient","owner":"steebchen","description":"🚀 A simple generic GraphQL client for Go","archived":false,"fork":false,"pushed_at":"2019-11-04T17:39:30.000Z","size":48,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-31T16:41:54.738Z","etag":null,"topics":["api","go","golang","gql","graphql","graphql-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steebchen.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-06-03T23:36:24.000Z","updated_at":"2024-10-21T08:05:54.000Z","dependencies_parsed_at":"2022-09-02T06:04:22.185Z","dependency_job_id":null,"html_url":"https://github.com/steebchen/gqlclient","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fgqlclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fgqlclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fgqlclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fgqlclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steebchen","download_url":"https://codeload.github.com/steebchen/gqlclient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238284723,"owners_count":19446715,"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","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":["api","go","golang","gql","graphql","graphql-client"],"created_at":"2024-10-11T02:46:28.084Z","updated_at":"2025-10-26T07:30:28.798Z","avatar_url":"https://github.com/steebchen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gqlclient [![GoDoc](https://godoc.org/github.com/steebchen/gqlclient?status.png)](http://godoc.org/github.com/steebchen/gqlclient) [![Go Report Card](https://goreportcard.com/badge/github.com/steebchen/gqlclient)](https://goreportcard.com/report/github.com/steebchen/gqlclient) [![Actions Status](https://github.com/steebchen/gqlclient/workflows/test%20all/badge.svg)](https://github.com/steebchen/gqlclient/actions)\n\nThe package gqlclient provides a GraphQL client implementation.\n\n\u003cp align=\"center\"\u003e\n\t\u003ca target=\"_blank\" href=\"https://github.com/MariaLetta/free-gophers-pack\"\u003e\n\t\t\u003cimg src=\"./gopher.svg\"  alt=\"GraphQL Gopher\" height=\"350\" /\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\nReasons to use gqlclient:\n\n- Simple, familiar API\n- Use strong Go types for variables and response data\n- Receive a full GraphQL response with data, errors and extensions\n- Respects `context.Context` cancellations and timeouts\n- Supports GraphQL Errors with Extensions\n\n*Note*: This package already works quite well, but it is under heavy development to work towards a v1.0 release. Before that, the API may have breaking changes even with minor versions.\n\nComing soon:\n\n- Uploads\n- Subscriptions\n- More options (e.g. http headers)\n\n## Installation\n\nMake sure you have a working Go environment, preferably with Go modules.\n\nTo install graphql, simply run:\n\n```\n$ go get github.com/steebchen/gqlclient\n```\n\n## Quickstart\n\nThe recommended way is to use structs depending on your schema for best type-safety.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"context\"\n\t\"github.com/steebchen/gqlclient\"\n)\n\nfunc main() {\n\tclient := gqlclient.New(\"https://metaphysics-production.artsy.net\")\n\t\n\tvar data struct {\n\t\tArticle struct {\n\t\t\tID  string\n\t\t\tTitle string\n\t\t}\n\t}\n\t\n\ttype variables struct{\n\t\tID string `json:\"id\"`\n\t}\n\n\tquery := `\n\t\tquery Article($id: String!) {\n\t\t\tarticle(id: $id) {\n\t\t\t\tid\n\t\t\t\ttitle\n\t\t\t}\n\t\t}\n\t`\n\n\t_, err := client.Send(context.Background(), \u0026data, query, variables{\n\t\tID: \"55bfed9275de7b060098b9bc\",\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"data: %+v\", data)\n\t// Output:\n\t// Article: {\n\t//   ID: 55bfed9275de7b060098b9bc\n\t//   Title: How the 1960s’ Most Iconic Artists Made Art Contemporary\n\t// }\n}\n```\n\nIf you don't want to use structs, you use `Raw()` to use maps for both input (variables) and output (response data).\n\n```go\nresp, err := client.Raw(context.Background(), query, map[string]interface{}{\n  \"id\": \"55bfed9275de7b060098b9bc\",\n})\n\nif err != nil {\n\tpanic(err)\n}\n\nlog.Printf(\"data: %+v\", resp.Data)\n// Output:\n// data: map[\n//   article: map[\n//\t   id: 55bfed9275de7b060098b9bc\n//\t   title: How the 1960s’ Most Iconic Artists Made Art Contemporary\n//   ]\n// ]\n```\n\nBoth `Send()` and `Raw()` always return a GraphQL [`Response`](https://godoc.org/github.com/steebchen/gqlclient#Response), so you can access GraphQL Errors and Extensions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteebchen%2Fgqlclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteebchen%2Fgqlclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteebchen%2Fgqlclient/lists"}