 { Base, signature } = require 'bongo'
-KodingError         = require '../error'
 
 { argv }  = require 'optimist'
 GithubAPI = require 'github'


  , (client, _options, callback) ->

    { method, options } = _options
    [ base, method ]    = method.split '.'
    # Callback wrapper to add some more
    # functionality to default callback
    cb = (err, response) ->

    # Requires extensive debugging on Bongo.Base ~ GG
    (options ?= {}).per_page = 10

    # Initialize Github api with client object
    # client object includes required token
    gh = initGithubFor client

    # Make sure provided base and method exists
    unless gh[base]?[method]?
      return cbErr "No such base:'#{base}' or method:'#{method}'"

    try
      # TODO We can add a whitelist of accepted methods/bases
