description and source-codefunction Client() {
_classCallCheck(this, Client);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 2) {
this.usernamePart = args[0];
this.passwordPart = args[1];
} else if (args.length === 1) {
if (args[0].token) {
this.usernamePart = args[0].token;
this.passwordPart = '';
} else {
this.usernamePart = args[0].appId;
this.passwordPart = args[0].appApiKey;
}
}
if (!this.usernamePart || this.passwordPart === undefined) {
throw new Error('Could not construct a client with those parameters');
}
this.users = new _user2.default(this);
this.events = new _event2.default(this);
this.companies = new _company2.default(this);
this.contacts = new _contact2.default(this);
this.leads = new _contact2.default(this);
this.visitors = new _visitor2.default(this);
this.counts = new _counts2.default(this);
this.admins = new _admin2.default(this);
this.tags = new _tag2.default(this);
this.segments = new _segment2.default(this);
this.messages = new _message2.default(this);
this.conversations = new _conversation2.default(this);
this.notes = new _note2.default(this);
this.promises = false;
this.baseUrl = 'https://api.intercom.io';
}