How to use the octonode.client function in octonode

To help you get started, we’ve selected a few octonode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stackvana / microcule / lib / plugins / sourceGithubRepo.js View on Github external
function fetchSourceCodeFromGithubRepo () {

      // console.log('fetch source code from github')

      // in the middleware configuration, assume we already have an access token
      // access token must be done through github oauth login
      var token = config.token;

      if (typeof token === "undefined") {
        throw new Error('token is a required option!');
      }

      var client = github.client(token);

      var repo = config.repo || "Stackvana/microcule-examples";
      var branch = config.branch || "master";
      var main = config.main || "index.js";

      var ghrepo = client.repo(repo, branch);

      ghrepo.contents(main, function (err, file) {
        if (err) {
          return config.errorHandler(err, next);
        }
        req.code = base64Decode(file.content).toString();
        next();
        provider.set(key, req.code, function(err, _set){
        });
      });
github Kibibit / achievibit / version1 / achievibitDB.js View on Github external
var _ = require('lodash');
var Q = require('q');
var configService = require('./app/models/configurationService')();
var CONFIG = configService.get();
var dbLibrary = CONFIG.testDB ? 'monkey-js' : 'monk';
var monk = require(dbLibrary);
var async = require('async');
var utilities = require('./utilities');
var github = require('octonode');
var request = require('request');
var colors = require('colors');
var client = github.client({
  username: CONFIG.githubUser,
  password: CONFIG.githubPassword
});
var console = require('./app/models/consoleService')();

var url = CONFIG.databaseUrl;
var db = monk(url);
var apiUrl = 'https://api.github.com/repos/';

var collections = {
  repos: db.get('repos'),
  users: db.get('users'),
  // uses to store additional private user data
  userSettings: db.get('auth_users')
};
github Gisto / Gisto / app / api / routes / gists.js View on Github external
}).login(['user', 'repo', 'gist'], function(err, id, token) {
        settings.token = token; // save the client token
        settings.client = github.client(settings.token); // create a client object
        settings.client.get('/user', function(err, status, body) { // get user details
            settings.info = body;
        });

        ghgist = settings.client.gist(); // create a reference to gist api
        res.send({
            id: id,
            token: token,
            err: err
        });
    });
github MisteFr / BedrockUpdateBot / src / disassembly / MinecraftDisassembly.js View on Github external
}
                                            })
                                        })

                                        console.log('Saving the write&read methods for each packets to config');

                                        if (botManager.config["lastVersionReleasedIsBeta"]) {
                                            config["packetInfoBeta"] = secondPart;
                                        } else {
                                            config["packetInfoRelease"] = secondPart;
                                        }


                                        console.log('Authentificating to github');

                                        var githubClient = github.client(botManager.config['githubToken']);

                                        var toFilter = secondPart.split('\n');

                                        for (var i = 0; i < toFilter.length; i++) {
                                            if ((toFilter[i].includes("BinaryStream") && (toFilter[i].includes("getB") || toFilter[i].includes("writeB") || toFilter[i].includes("writeF") || toFilter[i].includes("writeN") || toFilter[i].includes("writeS") || toFilter[i].includes("writeU") || toFilter[i].includes("writeV") || toFilter[i].includes("getD") || toFilter[i].includes("getF") || toFilter[i].includes("getI") || toFilter[i].includes("getS") || toFilter[i].includes("getT") || toFilter[i].includes("getV") || toFilter[i].includes("getU"))) || toFilter[i].includes('# ') || toFilter[i].includes("```")) {
                                                if (toFilter[i].includes("#")) {
                                                    fixedText = fixedText + "\n\n" + toFilter[i].replace("@plt", "");
                                                } else {
                                                    fixedText = fixedText + "\n" + toFilter[i].replace("@plt", "");
                                                }
                                            }
                                        }


                                        console.log('Posting on github the protocol documentation..');
github worksofbarry / barryCI / src / cicd.js View on Github external
async function updateGitHubStatus(appInfo, appID, commit, status, text) {

  var url = config.address + ':' + config.port + '/result/' + appID + '/' + commit;
  await updateStatus(appInfo, appID, commit, status, text);

  if (commit === "HEAD") return;

  if (appInfo.github !== undefined) {
    var githubClient = github.client(appInfo.github);
    var ghrepo = githubClient.repo(appInfo.repo);
    try {
      await ghrepo.statusAsync(commit, {
        "state": status,
        "target_url": url,
        "description": text
      });
    } catch (error) {
      console.log('Did not update commit status on repo ' + appInfo.repo + ': ' + error.message);
    }
  }
}
github devshelf / devshelf / core / form.js View on Github external
var fork = function(req, res, callback) {
    var token = req.query.token || req.session.authCache.github.accessToken,
        client = github.client(token);

    if (typeof client === "undefined") {
        res.send({
            status: false,
            message: "unauthorized"
        });

        return false;
    }

    var ghme   = client.me();

    //Get user repos and start process
    ghme.repos(function(err, data) {
        if (err) { GhApiOnErr(req, res, err); return; }
github pubnub / angularjs-hubbub / server / app.js View on Github external
app.get('/api/friends', ensureAuthenticated, function(req, res) {

    var github_client = github.client(req.user.oauth_token);
    github_client.requestDefaults['qs'] = {page:1, per_page: 100};
    var ghme = github_client.me()

    ghme.followers(function(err, followers){

        if (!err && res.statusCode == 200){

          ghme.following(function(err, following){

              if (!err && res.statusCode == 200){  

                var friends = _.unionWith(followers,following, function(friend1,friend2){
                    return friend1.id == friend2.id
                });

                friends.push({
github alex-cory / portfolio / src / apis / github / index.js View on Github external
function getInitialReposDataFrom(username) {
	let client = github.client(my.github.ACCESS_TOKEN)

	return new Promise((accept, reject) => {

		client.get('/user/repos', {}, function (err, status, body, headers) {

			let repos = []

		  for(let repo of body) {
		  	if (repo.owner.login == username) {

			  	repos.push({
			  		name: repo.name,
			  		url: repo.html_url,
			  		description: repo.description,
			  		stars: repo.stargazers_count,
			  		forks: repo.forks_count,
github marmelab / ZeroDollarHomePage / src / api / github / githubApi.js View on Github external
export default (config) => githubApi(octonode.client(config.github));

octonode

nodejs wrapper for github v3 api

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis