Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/bhavya-dang/node-github.js

A lightweight and fully maintained NodeJS Wrapper for the Github API V3.
https://github.com/bhavya-dang/node-github.js

api api-wrapper github github-api npm npm-module npm-package wrapper wrapper-api

Last synced: 30 days ago
JSON representation

A lightweight and fully maintained NodeJS Wrapper for the Github API V3.

Awesome Lists containing this project

README

        

# node-github.js




NPM version
NPM downloads
circleci



A simple node.js wrapper for the Github API V3
npm installnfo




- 📦 **Lightweight**: Modular to the core. Less then 200 lines of clean and optimized code.
- 🔰 **Simplistic**: Build to be beginner friendly, to suit everyone's needs.

## Installation

```bash
npm install node-github.js --save
```

## Dependencies

It depends on [axios](https://npmjs.org/package/axios) as a main dependency and [moment](https://npmjs.org/package/moment) to parse the date/time returned by the data.

```bash
npm install
```

## Declaration

```js
const GithubClient = require("node-github.js");
const client = new GithubClient();
```

## Usage

The methods return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#:~:text=Description,when%20the%20promise%20is%20created.&text=This%20lets%20asynchronous%20methods%20return,some%20point%20in%20the%20future.). You can resolve it using `.then()` to get the results.

```js
client.getUser("Sync-Codes").then((data) => console.log(data)); // returns a user object with the data
```

## Result Data

```js
{
username: 'Sync-Codes',
avatar: 'https://avatars.githubusercontent.com/u/37131433?v=4',
name: 'Bhavya Dang',
bio: 'Web Developer and Designer',
website: 'https://synxc.carrd.co/',
followers: 11,
following: 25,
createdAt: 'Mar 7th, 2018',
location: 'India',
total_public_repos: 45,
total_private_repos: 'None'
}
```

# Other Methods

## .getUserRepo(para)

Returns a repo object with the Repositiory data of the username passed as `para`.

## .getUserOrgs(para)

Returns a orgs object with the Organization data of the username passed as `para`.

## .searchUsers(query)

Returns an object containing the best match results of the user. Filtered by the `query` parameter passed.

## .searchTopics(query)

Returns an object containing the best match results of the topic. Filtered by the `query`. The topic is always a _featured_ topic.

## Contact

You can contact me on my Discord (Sync#9069).

## Issues

Found an issue? Open up an issue [here!](https://github.com/Sync-Codes/node-github.js/issues/**new**)

## License

© Sync-Codes, 2020
Released under MIT License.