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: 3 months ago
JSON representation
A higher-level wrapper around the Github API.
- Host: GitHub
- URL: https://github.com/scalajs-io/github-api-node
- Owner: scalajs-io
- License: apache-2.0
- Created: 2017-02-17T04:11:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T23:08:57.000Z (about 7 years ago)
- Last Synced: 2025-01-17T22:42:43.419Z (over 1 year ago)
- Topics: github, node, nodejs, npm, npm-module, npm-package, scala, scalajs
- Language: Scala
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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")
```