Cross-platform Swift library for accessing the public GitHub API.

Overview

GoatHerb

CI Status Code Coverage Latest Release Swift Compatibility Platform Compatibility License

GoatHerb is a cross-platform Swift library for accessing the GitHub API.

Features

General

  • Compatible with swift-log.
  • Full concurrency (async/await) support.
  • Cross-platform support:
    • iOS
    • macOS
    • tvOS
    • watchOS
    • Linux (optimized for Server-side Swift)

Most cross-platform SDKs simply replace Foundation's URLSession with SwiftNIO's AsyncHTTPClient and call it a day. Not GoatHerb! GoatHerb is built on top of KippleNetworking, which intelligently chooses between Foundation's URLSession or SwiftNIO's AsyncHTTPClient depending on the platform, ensuring optimal networking for the platform it's running on.

GitHub API

  • 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.

Usage

Create a GitHub object.

let gitHub = GitHub()

You can optionally provide an accessToken in the initializer, or via setting the GITHUB_ACCESS_TOKEN or 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")

Contributing

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.

Credits

Special thanks to @boiarqin for providing me with an unforgettable repository name.

License

This project is released under the MIT license. See LICENSE for details.

You might also like...
nds4ios is a port of the multi-platform Nintendo DS emulator, DeSmuME to iOS.

nds4ios Supports iOS 6 to iOS 9. nds4ios is a port of the multi-platform Nintendo DS emulator, DeSmuME to iOS. Currently, emulation is powered by a th

Pexels API client library for the Swift programming language.
Pexels API client library for the Swift programming language.

Pexels-Swift Pexels.com API client library for the Swift programming language. Overview This Swift Package is a wrapper for Pexels API to get access t

A Swift library for Discord REST/Gateway API in all platforms.

swift-discord main develop A Swift library for Discord API. Package Products Discord, alias library that contains DiscordREST, DiscordGateway. Discord

🐦 An asynchronous Twitter library based on the Twitter v2 API

Twift Twift is an asynchronous Swift library for the Twitter v2 API. No external dependencies Only one callback-based method (requestUserCredentials)

A Swift playground that comes pre-loaded with Plot, that can be used to explore the new component API.

PlotPlayground A Swift playground that comes pre-loaded with Plot, so that you can quickly try out the library and its new, SwiftUI-like API for build

A web API client in Swift built using Async/Await

Web API Client A modern web API client in Swift built using Async/Await and Actors. let client = APIClient(host: "api.github.com") // Using the clien

A Swift wrapper around the JSONbin.io API
A Swift wrapper around the JSONbin.io API

A Swift wrapper around the JSONbin.io API

An IPFS client/api Swift Package, with the ability to add and pin any data on iOS/iPadOS/macOS

An IPFS client/api Swift Package, with the ability to add and pin any data on iOS/iPadOS/macOS. Originally bundled with GraniteUI, pulled out for independant use by any party.

iOS 15 share play API in react-native

react-native-shareplay iOS 15 share play API in react-native Installation yarn add react-native-shareplay And go to Xcode Capabilities and enable "Gro

Owner
Brian Drelling
I make apps, games, and music. The trick is never sleeping. He/Him.
Brian Drelling
Cross-platform, sophisticated frontend for the libretro API.

RetroArch is the reference frontend for the libretro API. Popular examples of implementations for this API includes video game system emulators and game engines as well as more generalized 3D programs. These programs are instantiated as dynamic libraries. We refer to these as "libretro cores".

null 7.4k Dec 27, 2022
A Swift cross-platform (Apple and Linux) networking library.

KippleNetworking A Swift library that offers cross-platform (Apple and Linux) networking support, intended for the creation of cross-platform SDKs to

Kipple 11 Sep 20, 2022
Cross-platform instrumentation and introspection library written in C

Gum Cross-platform instrumentation and introspection library written in C. This library is consumed by frida-core through its JavaScript bindings, Gum

Frida 524 Jan 4, 2023
Easily generate cross platform Swift framework projects from the command line

SwiftPlate Easily generate cross platform Swift framework projects from the command line. SwiftPlate will generate Xcode projects for you in seconds,

John Sundell 1.8k Dec 27, 2022
Managing Pull Requests and Issues For GitHub & GitHub Enterprise

Trailer For maintained binaries and/or more info: Latest macOS version Latest iOS version Trailer CLI for Mac, Linux and Windows Trailer for Android N

Paul Tsochantaris 1.1k Dec 14, 2022
The Outline Client is a cross-platform VPN or proxy client for Windows, macOS, iOS, Android, and ChromeOS

Outline Client The Outline Client is a cross-platform VPN or proxy client for Windows, macOS, iOS, Android, and ChromeOS. The Outline Client is design

Jigsaw 7.3k Dec 31, 2022
A macOS application for accessing the output of the SimpleAnalytics package on the desktop.

The SimpleAnalytics package allows you to collect data user interaction analytic data in iOS and macOS applications. This SimpleAnalytics Reader app project allows you to more easily make sense of that collected data by displaying it on your Mac.

Dennis Birch 10 Dec 22, 2022
Monkey is an unofficial GitHub client for iOS,to show the rank of coders and repositories.

Monkey for GitHub 中文README Monkey is an unofficial GitHub client. Monkey for GitHub is my first App,open source project.Welcome to download. GitHub op

coderyi 1.8k Jan 6, 2023
GitHub in your pocket. Built with React Native

GitPoint GitHub in your pocket. Built with React Native. Table of Contents Introduction Features Feedback Contributors Build Process Backers Sponsors

GitPoint 4.6k Jan 1, 2023
Demo of using Metal to render EDR / HDR content on iOS platform

MetalEDR-iOS Demo of using Metal to render EDR/HDR content on iOS platform. How it works This demo uses a hack to activate EDR display on iOS platform

Wutian 38 Oct 24, 2022