import Client from './client'; export default class Customers extends Client { constructor(opts) { let options = opts; if (typeof opts === 'string') { options = { host: opts }; // convert host string to options object } options.serviceName = 'Customer api'; super(options); } getCustomers(options = {}) { return this.makeRequest(`${this.host}/customers/customers`, options); } getByCustomername(customerName, options = {}) { return this.makeRequest(`${this.host}/customers/${customerName}`, options); } postCustomers(options = {}) { return this.makeRequest(`${this.host}/customers/customers`, { ...options, method: 'POST', }); } putByCustomername(customerName, options = {}) { return this.makeRequest(`${this.host}/customers/${customerName}`, { ...options, method: 'PUT', }); } }