Coder Social home page Coder Social logo

laughedelic / scalajs-octokit Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 51 KB

:octocat: Scala.js facades for octokit/rest.js (GitHub REST API v3)

Home Page: https://github.com/octokit/rest.js

License: Mozilla Public License 2.0

Scala 100.00%
scalajs scalajs-facade scala-js scala github-api github-rest-v3 octokit octokit-js rest-api rest

scalajs-octokit's Introduction

This project contains Scala.js facades for octokit/rest.js, the official GitHub REST API v3 client for Node.js.

๐Ÿšง WORK IN PROGRESS ๐Ÿšง

This project is in active development, there are no published releases yet. Things may break without a warning, so don't rely on it.

Usage

Installation

๐Ÿ›  Check installation instructions later, when there is a published release...
  1. Add Octokit dependency to your project. It's important that the version of the underlying JS library matches the one this facade is built for.

    • If it's a Node.js project where you manage dependencies with npm, run

      npm install @octokit/[email protected]
    • If it's a Scala.js project use scalajs-bundler and add to your build.sbt:

      Compile/npmDependencies += "@octokit/rest" -> "15.8.0"
  2. Add facades dependency to your build.sbt:

    resolvers += Resolver.jcenterRepo
    libraryDependencies += "laughedelic" %%% "scalajs-octokit" % "<version>"

    (see the latest release version on the badge above)

Example

Here's a simple usage example:

import laughedelic.octokit.rest._

// Non-authenticated client with default parameters:
val octokit = new Octokit()

// A simple request (returns a Future)
octokit.repos.get(
  owner = "octokit",
  repo = "rest.js"
).foreach { response =>

  // Check some data in the response
  println(response.data.full_name)
  println(response.data.stargazers_count)
  println(response.data.license.name)

  // Or print the whole payload (see https://developer.github.com/v3/repos/#get)
  println(js.JSON.stringify(response.data, space = 2))
}

Project structure

Most of the code in this project is generated, so you won't find it in the repository. To see that code you need to clone the project and run sbt compile.

The code that parses routes.json and generates the Scala code is in project/src/, so it's available to the main build and is used in the sourceGenerators.

There is also some manually written code: src/main/scala/octokit.scala. It defines types for the Octokit client, its options, authentication and pagination.

Documentation

There's no documentation in the project (yet), but you may find useful these resources:

Related projects

  • scalajs-io/github-api-node: partial facade for the Github.js library

    Github.js provides a minimal higher-level wrapper around Github's API

  • 47deg/github4s: JVM/JS-compatible Scala wrapper for (a part of) the GitHub API

    Github4s is based on a Free Monad Architecture, which helps decoupling of program declaration from program interpretation

How is this project different

  • This is a Scala.js-only (facades) library, no JVM
  • It builds on the official JS client for node which covers all available GitHub REST API v3 (including latest previews)
  • The code is automatically generated using the same source as the underlying JS library, which means it should be easy to maintain and keep in sync

scalajs-octokit's People

Contributors

laughedelic avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mibexsoftware

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.