import Client from './client'; export default class Refs extends Client { constructor(opts) { let options = opts; if (typeof opts === 'string') { options = { host: opts }; // convert host string to options object } options.serviceName = 'Github'; super(options); } get(owner, repo, options = {}) { return this.makeRequest(`${this.host}/repos/${owner}/${repo}/git/refs`, options); } getByRef(owner, repo, ref, options = {}) { return this.makeRequest(`${this.host}/repos/${owner}/${repo}/git/refs/${ref}`, options); } post(owner, repo, options = {}) { return this.makeRequest(`${this.host}/repos/${owner}/${repo}/git/refs`, { ...options, method: 'POST', }); } putByRef(owner, repo, ref, options = {}) { return this.makeRequest(`${this.host}/repos/${owner}/${repo}/git/refs/${ref}`, { ...options, method: 'PUT', }); } }