{"id":15048466,"url":"https://github.com/k1low/go-github-client","last_synced_at":"2025-04-10T01:24:19.715Z","repository":{"id":46195777,"uuid":"424825033","full_name":"k1LoW/go-github-client","owner":"k1LoW","description":":octocat: go-github client factory.","archived":false,"fork":false,"pushed_at":"2024-04-19T22:44:16.000Z","size":458,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-02T00:02:01.392Z","etag":null,"topics":["github","golang"],"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/k1LoW.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"k1LoW","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-11-05T04:14:25.000Z","updated_at":"2024-05-30T06:22:06.059Z","dependencies_parsed_at":"2024-01-18T14:35:15.663Z","dependency_job_id":"d8202293-2b02-44e6-accd-e0ff86c57dc3","html_url":"https://github.com/k1LoW/go-github-client","commit_stats":{"total_commits":193,"total_committers":3,"mean_commits":64.33333333333333,"dds":"0.49740932642487046","last_synced_commit":"15d55d66474c34014d5595321775e901fc7dec8c"},"previous_names":[],"tags_count":231,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgo-github-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgo-github-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgo-github-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgo-github-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k1LoW","download_url":"https://codeload.github.com/k1LoW/go-github-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248138874,"owners_count":21053972,"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":["github","golang"],"created_at":"2024-09-24T21:13:19.349Z","updated_at":"2025-04-10T01:24:19.684Z","avatar_url":"https://github.com/k1LoW.png","language":"Go","readme":"# go-github-client\n\n:octocat: [go-github](https://github.com/google/go-github) client factory.\n\n## Usage\n\n`go-github-client/[VERSION]/factory.NewGithubClient()` returns `github.com/google/go-github/[VERSION]/github.Client` with environment variable resolution\n\n``` go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/k1LoW/go-github-client/v49/factory\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tc, _ := factory.NewGithubClient()\n\tu, _, _ := c.Users.Get(ctx, \"k1LoW\")\n\tfmt.Printf(\"%s\\n\", u.GetLocation())\n}\n```\n\n### Mocking\n\n``` go\npackage main\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/google/go-github/v49/github\"\n\t\"github.com/k1LoW/go-github-client/v49/factory\"\n\t\"github.com/migueleliasweb/go-github-mock/src/mock\"\n)\n\nfunc TestUsingMock(t *testing.T) {\n\tmockedHTTPClient := mock.NewMockedHTTPClient(\n\t\tmock.WithRequestMatch(\n\t\t\tmock.GetUsersByUsername,\n\t\t\tgithub.User{\n\t\t\t\tName: github.String(\"foobar\"),\n\t\t\t},\n\t\t),\n\t)\n\tc, err := factory.NewGithubClient(factory.HTTPClient(mockedHTTPClient))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tctx := context.Background()\n\tuser, _, err := c.Users.Get(ctx, \"myuser\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tgot := user.GetName()\n\tif want := \"foobar\"; got != want {\n\t\tt.Errorf(\"got %v\\nwant %v\", got, want)\n\t}\n}\n```\n\n## Environment variables that affect client initialization\n\n- `GH_TOKEN`, `GITHUB_TOKEN`\n- `GH_ENTERPRISE_TOKEN`, `GITHUB_ENTERPRISE_TOKEN`\n- `GH_HOST`, `GITHUB_API_URL`, `GITHUB_GRAPHQL_URL`\n- `GH_CONFIG_DIR`\n- `GITHUB_APP_ID`, `GITHUB_APP_INSTALLATION_ID`, `GITHUB_APP_PRIVATE_KEY`, `GH_REPO`, `GITHUB_REPOSITORY`, `GITHUB_REPOSITORY_OWNER` for authentication with a GitHub App\n\n## Versioning\n\n| Version | Description |\n| --- | --- |\n| Major | google/go-github major version |\n| Minor | google/go-github minor version |\n| Patch | google/go-github patch version + k1LoW/go-github-client update |\n","funding_links":["https://github.com/sponsors/k1LoW"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1low%2Fgo-github-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk1low%2Fgo-github-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1low%2Fgo-github-client/lists"}