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

https://github.com/scalajs-io/github-api-node

A higher-level wrapper around the Github API.
https://github.com/scalajs-io/github-api-node

github node nodejs npm npm-module npm-package scala scalajs

Last synced: 4 months ago
JSON representation

A higher-level wrapper around the Github API.

Awesome Lists containing this project

README

        

GitHub API for Scala.js
================================
[github-api-node](https://www.npmjs.com/package/github-api-node) - A higher-level wrapper around the Github API.

### Description

Github.js provides a minimal higher-level wrapper around git's plumbing commands, exposing an API for
manipulating GitHub repositories on the file level. It was formerly developed in the context of Prose,
a content editor for GitHub.

### Build Dependencies

* [SBT v1.2.x](http://www.scala-sbt.org/download.html)

### Build/publish the SDK locally

```bash
$ sbt clean publish-local
```

### Running the tests

Before running the tests the first time, you must ensure the npm packages are installed:

```bash
$ npm install
```

Then you can run the tests:

```bash
$ sbt test
```

### Examples

```scala
import io.scalajs.nodejs.util.Util
import io.scalajs.npm.githubapinode._
import io.scalajs.util.JSONHelper._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
import scala.scalajs.js

val gitHub = new GitHub(new GithubOptions())

// get the "bignum" repo for user "scalajs-io"
val repo = gitHub.getRepo("scalajs-io", "bignum")

// list the branches in the repo
repo.listBranchesFuture foreach { branches =>
println(s"branches: ${branches.toJson}")
}

// list the contributors to the repo
repo.contributorsFuture foreach { contributors =>
println(s"contributors: ${Util.inspect(contributors)}")
}

// retrieve the contents of the master branch
repo.contentsFuture(branch = "master", pathToDir = ".") foreach { contents =>
println(s"contents: ${Util.inspect(contents)}")
}

// asynchronously read the contents of a file in the repo's master branch
repo.readFuture(branch = "master", pathToFile = "package.json") foreach { data =>
println(s"package.json: ${Util.inspect(data)}")
}
```

### Artifacts and Resolvers

To add the `GitHub` binding to your project, add the following to your build.sbt:

```sbt
libraryDependencies += "io.scalajs.npm" %%% "github-api-node" % "0.5.0"
```

Optionally, you may add the Sonatype Repository resolver:

```sbt
resolvers += Resolver.sonatypeRepo("releases")
```