Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][waiting-feedback] Add GitLab support. #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cirosantilli
Copy link

With this I can do:

var Octokit = require('octokit')
var gh = Octokit.new({
  api: 'gitlab',
  token: '0123456789'
})
var repo = gh.getRepo('cirosantilli', 'test')
repo.getInfo().then(function(repo) {
  console.log(repo)
  console.log(repo.name)
})

If you think I'm going in the right direction I will continue to implement as much of GitLab as possible in this manner, and add tests.

The goal is to:

  • keep the GitHub part unaltered.
  • allow the same interface to interact with both websites by converting GitHub input URLs GitLab's, and GitLab's output JSON to their GitHub analogues. E.g.:
    • GitHub URL /repos/:user/:name becomes GitLab /projects/#{user}%2F#{repo}
    • GitLab's .path reply field becomes is converted to it's GitHub analogue .name, and .name which is the humanish name is converted to a new identifier humanName.
      This is simplistic, but works for many fields.

I felt that implementing it here was simpler than at https://github.com/philschatz/octokat.js because in my mind this is a perfect case for using inheritance to model the situation, and Octokat has no explicit methods that can be polymorphed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant