GoatHerb is a cross-platform Swift library for accessing the GitHub API.
- Compatible with swift-log.
- Full concurrency (async/await) support.
- Cross-platform support:
- Linux (optimized for Server-side Swift)
Most cross-platform SDKs simply replace Foundation's
AsyncHTTPClientand call it a day. Not GoatHerb! GoatHerb is built on top of KippleNetworking, which intelligently chooses between Foundation's
AsyncHTTPClientdepending on the platform, ensuring optimal networking for the platform it's running on.
- Get Rate Limit
- Get User
- Get Organization
- Get User Repositories
- Get Organization Repositories
- Get Repository
That's it for now! If you're looking for a more feature-complete SDK, check out the list of GitHub SDKs on Swift Package Index.
let gitHub = GitHub()
You can optionally provide an
accessToken in the initializer, or via setting the
GITHUB_TOKEN environment variable.
let gitHub = GitHub(accessToken: "<token>")
From there, requests are extremely straight-forward. Here are some examples:
// Get a user. let user = try await self.gitHub.getUser("bdrelling") // Get an organization. let organization = try await self.gitHub.getOrganization("swift-kipple") // Get all repositories for a user. let repositories = try await self.gitHub.getRepositories(user: "bdrelling") // Get all repositories for an organization. let repositories = try await self.gitHub.getRepositories(org: "swift-kipple")
Discussions, issues, and pull requests are more than welcome! I'm happy to extend the functionality of this library, with respect to the features listed in the Out of Scope section.
If opening a pull request, please ensure that the package retains as close to 100% code coverage as possible.
Special thanks to @boiarqin for providing me with an unforgettable repository name.
This project is released under the MIT license. See LICENSE for details.