Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eneko/github

Swift Package client for the GitHub GraphQL API V4
https://github.com/eneko/github

api api-client github graphql library swift swift-package swift-package-manager

Last synced: 18 days ago
JSON representation

Swift Package client for the GitHub GraphQL API V4

Awesome Lists containing this project

README

        

![Release](https://img.shields.io/github/release/eneko/github.svg)
![Swift 4.2](https://img.shields.io/badge/Swift-4.2-orange.svg)
[![Build Status](https://travis-ci.org/eneko/GitHub.svg?branch=master)](https://travis-ci.org/eneko/GitHub)
[![codecov](https://codecov.io/gh/eneko/GitHub/branch/master/graph/badge.svg)](https://codecov.io/gh/eneko/GitHub)
[![Swift Package Manager Compatible](https://img.shields.io/badge/spm-compatible-brightgreen.svg)](https://swift.org/package-manager)
![Linux Compatible](https://img.shields.io/badge/linux-compatible%20🐧-brightgreen.svg)

# GitHub GraphQL API V4 client

This is a client for the [GitHub GraphQL API V4](https://developer.github.com/v4/).

Note: This client is in very early stages and currently has extremely limited functionality:
- Retrieve version tag for lastest release from a given repository.
- Retrieve list of open pull requests from a given repository.

## Usage

Initialize a client passing in a valid GitHub access token:
```swift
let token = "your_token"
let github = GitHub(token: token)
```

Retrieve latest release version of a given project:
```swift
let version = try github.latestRelease(owner: "eneko", project: "SourceDocs")
print(version) // 0.5.0
```

Retrieve list of open pull requests on a given project:
```swift
let pullRequests = try github.openPullRequests(owner: "eneko", project: "SourceDocs")
print(pullRequests.count) // 0
```