import Blobs from './blobs'; import Commits from './commits'; import Contents from './contents'; import Hooks from './hooks'; import PullRequests from './pull-requests'; import Refs from './refs'; import Repositories from './repositories'; import Tags from './tags'; import Trees from './trees'; import Users from './users'; import UserEmails from './user-emails'; const enums = { contentsType: ['file', 'dir', 'symlink', 'submodule'], encoding: ['base64', 'utf-8'], hookEvent: ['push', 'pull_request'], nodeType: ['blob', 'tree', 'commit'], ownerType: ['User'], visibility: ['all', 'public', 'private'], }; export default class GithubClient { constructor(opts) { let options = opts; if (typeof opts === 'string') { options = { host: opts }; // convert host string to options object } this.enums = enums; this.blobs = new Blobs(options); this.commits = new Commits(options); this.contents = new Contents(options); this.hooks = new Hooks(options); this.pullRequests = new PullRequests(options); this.refs = new Refs(options); this.repositories = new Repositories(options); this.tags = new Tags(options); this.trees = new Trees(options); this.users = new Users(options); this.userEmails = new UserEmails(options); } }