{"id":23177607,"url":"https://github.com/aj-foster/open-api-github","last_synced_at":"2025-08-18T11:32:54.743Z","repository":{"id":65164811,"uuid":"578860487","full_name":"aj-foster/open-api-github","owner":"aj-foster","description":"GitHub REST API client for Elixir","archived":false,"fork":false,"pushed_at":"2024-04-29T13:39:49.000Z","size":1840,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-17T17:50:04.426Z","etag":null,"topics":["elixir","github","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/aj-foster.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":["aj-foster"]}},"created_at":"2022-12-16T03:44:24.000Z","updated_at":"2024-09-15T02:58:16.000Z","dependencies_parsed_at":"2023-09-27T02:00:27.643Z","dependency_job_id":"db60b653-74ab-48b6-b4ee-d1d0b1fbd597","html_url":"https://github.com/aj-foster/open-api-github","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"484fa1d4f2e37e4013287755e4f38cc944ebb73b"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fopen-api-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fopen-api-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fopen-api-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fopen-api-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aj-foster","download_url":"https://codeload.github.com/aj-foster/open-api-github/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230202073,"owners_count":18189418,"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":["elixir","github","rest-api"],"created_at":"2024-12-18T06:35:53.032Z","updated_at":"2024-12-18T06:35:53.455Z","avatar_url":"https://github.com/aj-foster.png","language":"Elixir","readme":"# GitHub REST API Client for Elixir\n\n[![Hex.pm](https://img.shields.io/hexpm/v/oapi_github)](https://hex.pm/packages/oapi_github)\n[![Documentation](https://img.shields.io/badge/hex-docs-blue)](https://hexdocs.pm/oapi_github)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n\n_The ergonomics of a hand-crafted client with the API coverage of generated code._\n\n---\n\nThis library uses an [OpenAPI Code Generator](https://github.com/aj-foster/open-api-generator) that has the flexibility to wrangle the generated code into an ergonomic client.\nSo instead of dealing with `NullableRepository` vs. `FullRepository` and other odd artifacts of GitHub's OpenAPI description, there's a predictable interface.\n\nFurthermore, this library has no opinions about what you use for HTTP requests, serialization, etc.\nInstead it allows users to define their own **stack** of plugins, many of which are provided here.\n\n## Installation\n\nThis library is available on Hex.pm.\nAdd the dependency in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:oapi_github, \"~\u003e 0.3.3\"}\n  ]\nend\n```\n\nThen install the dependency using `mix deps.get`.\n\n## Configuration\n\nThis library comes with a common default set of configuration.\nTo use it successfully, you will need to install `HTTPoison` and `Jason`.\n(Remember, these libraries can easily be switched out by changing the `stack` configuration.\nSee `GitHub.Config` for more information.)\n\nSome good up-and-running configuration to set:\n\n* `app_name` will include the name of your application in the User Agent so GitHub can contact you if they notice any problems.\n* `default_auth` allows you to provide default Authorization header credentials, such as a client ID and secret to increase your rate limit when no other credentials are available.\n\n```elixir\nconfig :oapi_github,\n  app_name: \"MyApp\",\n  default_auth: {\"client_id\", \"client_secret\"}\n```\n\nFor more information about configuration, see the documentation for `GitHub.Config`.\n\n## Usage\n\nAll of the client operations are generated based on the OpenAPI description provided by GitHub.\nIn general, you can expect to find:\n\n```elixir\nGitHub.Resource.operation(path1, path2, ..., body, opts)\n```\n\nWhere:\n\n* `Resource` is the name of the resource as tagged by GitHub, like `Repos`.\n* `operation` is the name of the route, like `get` or `create_commit_comment`.\n* The first arguments are path parameters, such as `owner` and `repo` in `/repos/{owner}/{repo}`.\n* If the request accepts a body, then there will be a `body` parameter.\n* Finally, all operations accept a keyword list of options.\n\nThe options accepted by operations may differ depending on your chosen stack.\nHowever, the following are always available:\n\n* `auth` (string, 2-tuple, or struct implementing `GitHub.Auth`) Credentials to use for the request.\n* `server` (URL including scheme) Base API server to use, such as `https://api.github.com` (useful for interacting with GitHub Enterprise installations).\n* `version` (string) GitHub API version to use (not recommended to override this, because the generated code may not match the specified version).\n\nWhenever GitHub specifies a named schema as the response type for an operation, an Elixir struct will be returned.\nNote that GitHub often has similarly named schemas (such as `SimpleUser`, `PrivateUser`, `PublicUser`, etc.).\nWhere possible, these have been collapsed into a single struct (like `GitHub.User`) where not all of the fields may be filled in.\nHowever, responses are still properly typed by their type specifications.\n\n## Testing\n\nTest helpers are available in `GitHub.Testing` together with the `GitHub.Plugins.TestClient` plugin.\n\n```elixir\ndefmodule MyApp.MyTest do\n  use ExUnit.Case\n  use GitHub.Testing\n\n  test \"calls GitHub API\" do\n    mock_gh \u0026GitHub.Repo.get/2, fn -\u003e\n      {:ok, 200, %GitHub.Repository{id: 12345}}\n    end\n\n    my_function()\n\n    assert_called_gh GitHub.Repos.get(\"owner\", :_)\n  end\nend\n```\n\nFor more information, see the documentation for `GitHub.Testing`.\n\n## Contributing\n\nBecause this library uses a code generator for the majority of its mass, there are two modes of contribution.\nPlease consider these when creating issues or opening pull requests:\n\n* If the generated code is out of date, the fix may be as simple as running `mix gen.api` using the latest OpenAPI description.\n* If the client isn't working as expected, the fix may be more involved and require careful thought and versioning.\n\nFor more on what this means to you as a contributor, please see the [contribution guidelines](CONTRIBUTING.md).\n\n## Sponsorship\n\nIf you like this library or it makes you money, please consider [sponsoring](https://github.com/sponsors/aj-foster).\n","funding_links":["https://github.com/sponsors/aj-foster"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faj-foster%2Fopen-api-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faj-foster%2Fopen-api-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faj-foster%2Fopen-api-github/lists"}