intercom-client 2.11.2 → 3.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +681 -404
- package/package.json +65 -49
- package/dist/admin.js +0 -46
- package/dist/bulk.js +0 -53
- package/dist/client.js +0 -245
- package/dist/company.js +0 -83
- package/dist/contact.js +0 -81
- package/dist/conversation.js +0 -48
- package/dist/counts.js +0 -86
- package/dist/customer.js +0 -31
- package/dist/event.js +0 -45
- package/dist/index.js +0 -76
- package/dist/message.js +0 -31
- package/dist/note.js +0 -41
- package/dist/scroll.js +0 -80
- package/dist/segment.js +0 -36
- package/dist/snippet.js +0 -119
- package/dist/tag.js +0 -57
- package/dist/user-data.js +0 -103
- package/dist/user.js +0 -118
- package/dist/visitor.js +0 -52
package/package.json
CHANGED
|
@@ -1,51 +1,67 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
2
|
+
"name": "intercom-client",
|
|
3
|
+
"version": "3.0.0-0",
|
|
4
|
+
"description": "Official Node bindings to the Intercom API",
|
|
5
|
+
"homepage": "https://github.com/intercom/intercom-node",
|
|
6
|
+
"bugs:": "https://github.com/intercom/intercom-node/issues",
|
|
7
|
+
"repository": "intercom/intercom-node",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Bob Long",
|
|
10
|
+
"email": "bob@intercom.io"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"intercom",
|
|
18
|
+
"api"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"axios": "^0.24.0",
|
|
22
|
+
"htmlencode": "^0.0.4",
|
|
23
|
+
"lodash": "^4.17.21"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@babel/core": "^7.13.16",
|
|
27
|
+
"@babel/eslint-parser": "^7.16.0",
|
|
28
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
29
|
+
"@babel/polyfill": "^7.12.1",
|
|
30
|
+
"@babel/preset-env": "^7.13.15",
|
|
31
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
32
|
+
"@babel/register": "^7.13.16",
|
|
33
|
+
"@types/lodash": "^4.14.176",
|
|
34
|
+
"@types/mocha": "^9.0.0",
|
|
35
|
+
"@types/node": "^16.11.6",
|
|
36
|
+
"@types/sinon": "^10.0.6",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
38
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
39
|
+
"eslint": "^8.2.0",
|
|
40
|
+
"eslint-config-prettier": "^8.3.0",
|
|
41
|
+
"gulp": "^4.0.2",
|
|
42
|
+
"gulp-babel": "^8.0.0",
|
|
43
|
+
"gulp-cli": "^2.2.0",
|
|
44
|
+
"gulp-eslint": "^6.0.0",
|
|
45
|
+
"gulp-exclude-gitignore": "^1.0.0",
|
|
46
|
+
"gulp-istanbul": "^1.1.3",
|
|
47
|
+
"gulp-mocha": "^6.0.0",
|
|
48
|
+
"gulp-plumber": "^1.2.1",
|
|
49
|
+
"gulp-sourcemaps": "^3.0.0",
|
|
50
|
+
"gulp-typescript": "^6.0.0-alpha.1",
|
|
51
|
+
"merge2": "^1.4.1",
|
|
52
|
+
"nock": "^13.0.11",
|
|
53
|
+
"prettier": "^2.5.1",
|
|
54
|
+
"sinon": "^7.3.2",
|
|
55
|
+
"tslib": "^2.3.1",
|
|
56
|
+
"typescript": "^4.5.3"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"prepublish": "gulp prepublish",
|
|
60
|
+
"test": "gulp"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">= v0.10.0"
|
|
64
|
+
},
|
|
65
|
+
"license": "Apache-2.0",
|
|
66
|
+
"packageManager": "yarn@3.1.0"
|
|
51
67
|
}
|
package/dist/admin.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
-
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
13
|
-
|
|
14
|
-
var Admin = /*#__PURE__*/function () {
|
|
15
|
-
function Admin(client) {
|
|
16
|
-
_classCallCheck(this, Admin);
|
|
17
|
-
|
|
18
|
-
this.client = client;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
_createClass(Admin, [{
|
|
22
|
-
key: "list",
|
|
23
|
-
value: function list(f) {
|
|
24
|
-
return this.client.get('/admins', {}, f);
|
|
25
|
-
}
|
|
26
|
-
}, {
|
|
27
|
-
key: "find",
|
|
28
|
-
value: function find(id, f) {
|
|
29
|
-
return this.client.get("/admins/".concat(id), {}, f);
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "me",
|
|
33
|
-
value: function me(f) {
|
|
34
|
-
return this.client.get('/me', {}, f);
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "away",
|
|
38
|
-
value: function away(id, params, f) {
|
|
39
|
-
return this.client.put("/admins/".concat(id, "/away"), params, f);
|
|
40
|
-
}
|
|
41
|
-
}]);
|
|
42
|
-
|
|
43
|
-
return Admin;
|
|
44
|
-
}();
|
|
45
|
-
|
|
46
|
-
exports["default"] = Admin;
|
package/dist/bulk.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
-
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
13
|
-
|
|
14
|
-
var Bulk = /*#__PURE__*/function () {
|
|
15
|
-
function Bulk(client, dataType) {
|
|
16
|
-
_classCallCheck(this, Bulk);
|
|
17
|
-
|
|
18
|
-
this.client = client;
|
|
19
|
-
this.dataType = dataType;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_createClass(Bulk, [{
|
|
23
|
-
key: "bulk",
|
|
24
|
-
value: function bulk(bulkOperations, f) {
|
|
25
|
-
var dataType = this.dataType;
|
|
26
|
-
var bulkParams = {
|
|
27
|
-
items: []
|
|
28
|
-
};
|
|
29
|
-
var url = "/bulk/".concat(dataType, "s");
|
|
30
|
-
bulkOperations.forEach(function (params) {
|
|
31
|
-
for (var k in params) {
|
|
32
|
-
var data = params[k];
|
|
33
|
-
var method = k === 'create' ? 'post' : k;
|
|
34
|
-
|
|
35
|
-
if (method !== 'post' && method !== 'delete') {
|
|
36
|
-
throw new Error("Unknown bulk type: ".concat(method));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
bulkParams.items.push({
|
|
40
|
-
method: method,
|
|
41
|
-
data_type: dataType,
|
|
42
|
-
data: data
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return this.client.post(url, bulkParams, f);
|
|
47
|
-
}
|
|
48
|
-
}]);
|
|
49
|
-
|
|
50
|
-
return Bulk;
|
|
51
|
-
}();
|
|
52
|
-
|
|
53
|
-
exports["default"] = Bulk;
|
package/dist/client.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _util = require("util");
|
|
9
|
-
|
|
10
|
-
var _request2 = _interopRequireDefault(require("request"));
|
|
11
|
-
|
|
12
|
-
var _bluebird = _interopRequireDefault(require("bluebird"));
|
|
13
|
-
|
|
14
|
-
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
15
|
-
|
|
16
|
-
var _user = _interopRequireDefault(require("./user"));
|
|
17
|
-
|
|
18
|
-
var _event = _interopRequireDefault(require("./event"));
|
|
19
|
-
|
|
20
|
-
var _company = _interopRequireDefault(require("./company"));
|
|
21
|
-
|
|
22
|
-
var _contact = _interopRequireDefault(require("./contact"));
|
|
23
|
-
|
|
24
|
-
var _visitor = _interopRequireDefault(require("./visitor"));
|
|
25
|
-
|
|
26
|
-
var _counts = _interopRequireDefault(require("./counts"));
|
|
27
|
-
|
|
28
|
-
var _admin = _interopRequireDefault(require("./admin"));
|
|
29
|
-
|
|
30
|
-
var _tag = _interopRequireDefault(require("./tag"));
|
|
31
|
-
|
|
32
|
-
var _segment = _interopRequireDefault(require("./segment"));
|
|
33
|
-
|
|
34
|
-
var _message = _interopRequireDefault(require("./message"));
|
|
35
|
-
|
|
36
|
-
var _conversation = _interopRequireDefault(require("./conversation"));
|
|
37
|
-
|
|
38
|
-
var _note = _interopRequireDefault(require("./note"));
|
|
39
|
-
|
|
40
|
-
var _customer = _interopRequireDefault(require("./customer"));
|
|
41
|
-
|
|
42
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
43
|
-
|
|
44
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
45
|
-
|
|
46
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
47
|
-
|
|
48
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
49
|
-
|
|
50
|
-
var Client = /*#__PURE__*/function () {
|
|
51
|
-
function Client() {
|
|
52
|
-
var _this = this;
|
|
53
|
-
|
|
54
|
-
_classCallCheck(this, Client);
|
|
55
|
-
|
|
56
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
|
-
args[_key] = arguments[_key];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (args.length === 2) {
|
|
61
|
-
this.usernamePart = args[0];
|
|
62
|
-
this.passwordPart = args[1];
|
|
63
|
-
} else if (args.length === 1) {
|
|
64
|
-
if (args[0].token) {
|
|
65
|
-
this.usernamePart = args[0].token;
|
|
66
|
-
this.passwordPart = '';
|
|
67
|
-
} else {
|
|
68
|
-
this.usernamePart = args[0].appId;
|
|
69
|
-
this.passwordPart = args[0].appApiKey;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!this.usernamePart || this.passwordPart === undefined) {
|
|
74
|
-
throw new Error('Could not construct a client with those parameters');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
this.users = new _user["default"](this);
|
|
78
|
-
this.events = new _event["default"](this);
|
|
79
|
-
this.companies = new _company["default"](this);
|
|
80
|
-
this.contacts = new _contact["default"](this);
|
|
81
|
-
this.leads = new _contact["default"](this);
|
|
82
|
-
this.visitors = new _visitor["default"](this);
|
|
83
|
-
this.counts = new _counts["default"](this);
|
|
84
|
-
this.admins = new _admin["default"](this);
|
|
85
|
-
this.tags = new _tag["default"](this);
|
|
86
|
-
this.segments = new _segment["default"](this);
|
|
87
|
-
this.messages = new _message["default"](this);
|
|
88
|
-
this.conversations = new _conversation["default"](this);
|
|
89
|
-
this.notes = new _note["default"](this);
|
|
90
|
-
this.customers = new _customer["default"](this);
|
|
91
|
-
this.promises = false;
|
|
92
|
-
this.requestOpts = {
|
|
93
|
-
baseUrl: 'https://api.intercom.io'
|
|
94
|
-
};
|
|
95
|
-
this.useBaseUrl = (0, _util.deprecate)(function (baseUrl) {
|
|
96
|
-
return _this.useRequestOpts({
|
|
97
|
-
baseUrl: baseUrl
|
|
98
|
-
});
|
|
99
|
-
}, 'intercom-client - client.useBaseUrl(url): Use client.useRequestOpts({ baseUrl: url }) instead');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
_createClass(Client, [{
|
|
103
|
-
key: "usePromises",
|
|
104
|
-
value: function usePromises() {
|
|
105
|
-
this.promises = true;
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "useRequestOpts",
|
|
110
|
-
value: function useRequestOpts(opts) {
|
|
111
|
-
this.requestOpts = Object.assign(this.requestOpts, opts);
|
|
112
|
-
return this;
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "promiseProxy",
|
|
116
|
-
value: function promiseProxy(f, args) {
|
|
117
|
-
var _this2 = this;
|
|
118
|
-
|
|
119
|
-
if (this.promises || !f) {
|
|
120
|
-
var callbackHandler = this.callback;
|
|
121
|
-
return new _bluebird["default"](function (resolve, reject) {
|
|
122
|
-
var resolver = function resolver(err, data) {
|
|
123
|
-
if (err) {
|
|
124
|
-
reject(err);
|
|
125
|
-
} else {
|
|
126
|
-
resolve(data);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
_this2.request(args, function (err, r) {
|
|
131
|
-
callbackHandler(resolver, err, r);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
} else {
|
|
135
|
-
this.request(args, function (err, r) {
|
|
136
|
-
return _this2.callback(f, err, r);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}, {
|
|
141
|
-
key: "ping",
|
|
142
|
-
value: function ping(f) {
|
|
143
|
-
this.request({
|
|
144
|
-
uri: '/admins'
|
|
145
|
-
}, function (_, response) {
|
|
146
|
-
return f(response.statusCode);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "put",
|
|
151
|
-
value: function put(endpoint, data, f) {
|
|
152
|
-
return this.promiseProxy(f, {
|
|
153
|
-
method: 'put',
|
|
154
|
-
uri: endpoint,
|
|
155
|
-
body: data
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}, {
|
|
159
|
-
key: "post",
|
|
160
|
-
value: function post(endpoint, data, f) {
|
|
161
|
-
return this.promiseProxy(f, {
|
|
162
|
-
method: 'post',
|
|
163
|
-
uri: endpoint,
|
|
164
|
-
body: data
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "get",
|
|
169
|
-
value: function get(endpoint, data, f) {
|
|
170
|
-
return this.promiseProxy(f, {
|
|
171
|
-
method: 'get',
|
|
172
|
-
uri: endpoint,
|
|
173
|
-
qs: data
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}, {
|
|
177
|
-
key: "nextPage",
|
|
178
|
-
value: function nextPage(paginationObject, f) {
|
|
179
|
-
return this.promiseProxy(f, {
|
|
180
|
-
method: 'get',
|
|
181
|
-
uri: paginationObject.next,
|
|
182
|
-
baseUrl: null
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}, {
|
|
186
|
-
key: "delete",
|
|
187
|
-
value: function _delete(endpoint, data, f) {
|
|
188
|
-
return this.promiseProxy(f, {
|
|
189
|
-
method: 'delete',
|
|
190
|
-
uri: endpoint,
|
|
191
|
-
qs: data
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
}, {
|
|
195
|
-
key: "request",
|
|
196
|
-
value: function request(args, callback) {
|
|
197
|
-
var defaultArgs = {
|
|
198
|
-
json: true,
|
|
199
|
-
headers: {
|
|
200
|
-
Accept: 'application/json',
|
|
201
|
-
'User-Agent': 'intercom-node-client/2.0.0'
|
|
202
|
-
}
|
|
203
|
-
}; // Don't just use Object.assign(requestArgs, args) here because we need to handle special cases like .headers
|
|
204
|
-
// Per request args should take prededence over the default, and both of these over the user specified args via .useRequestOpts
|
|
205
|
-
|
|
206
|
-
var requestArgs = (0, _merge["default"])({}, this.requestOpts, defaultArgs, args);
|
|
207
|
-
return (0, _request2["default"])(requestArgs, callback).auth(this.usernamePart, this.passwordPart);
|
|
208
|
-
}
|
|
209
|
-
}, {
|
|
210
|
-
key: "callback",
|
|
211
|
-
value: function callback(f, err, res) {
|
|
212
|
-
if (!f) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (f.length >= 2) {
|
|
217
|
-
if (res && res.body && res.body.type === 'error.list') {
|
|
218
|
-
var message = null;
|
|
219
|
-
|
|
220
|
-
if (Array.isArray(res.body.errors) && res.body.errors[0] && 'message' in res.body.errors[0]) {
|
|
221
|
-
// Try to use the first errors message
|
|
222
|
-
message = res.body.errors[0].message;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
err = new Error(message || 'Response error');
|
|
226
|
-
err.statusCode = res.statusCode;
|
|
227
|
-
err.body = res.body;
|
|
228
|
-
err.headers = res.headers;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (err) {
|
|
232
|
-
f(err, null);
|
|
233
|
-
} else {
|
|
234
|
-
f(null, res);
|
|
235
|
-
}
|
|
236
|
-
} else {
|
|
237
|
-
f(res || null);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}]);
|
|
241
|
-
|
|
242
|
-
return Client;
|
|
243
|
-
}();
|
|
244
|
-
|
|
245
|
-
exports["default"] = Client;
|
package/dist/company.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _scroll = _interopRequireDefault(require("./scroll"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
|
-
|
|
16
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
17
|
-
|
|
18
|
-
var Company = /*#__PURE__*/function () {
|
|
19
|
-
function Company(client) {
|
|
20
|
-
_classCallCheck(this, Company);
|
|
21
|
-
|
|
22
|
-
this.client = client;
|
|
23
|
-
this.scroll = new _scroll["default"](this.client, 'companie');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
_createClass(Company, [{
|
|
27
|
-
key: "create",
|
|
28
|
-
value: function create(data, f) {
|
|
29
|
-
return this.client.post('/companies', data, f);
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "update",
|
|
33
|
-
value: function update(data, f) {
|
|
34
|
-
return this.create(data, f);
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "list",
|
|
38
|
-
value: function list(f) {
|
|
39
|
-
return this.client.get('/companies', {}, f);
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "listBy",
|
|
43
|
-
value: function listBy(params, f) {
|
|
44
|
-
return this.client.get('/companies', params, f);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "find",
|
|
48
|
-
value: function find(params, f) {
|
|
49
|
-
if (params.id) {
|
|
50
|
-
return this.client.get("/companies/".concat(params.id), {}, f);
|
|
51
|
-
} else if (params.company_id) {
|
|
52
|
-
return this.client.get('/companies', {
|
|
53
|
-
company_id: params.company_id
|
|
54
|
-
}, f);
|
|
55
|
-
} else if (params.name) {
|
|
56
|
-
return this.client.get('/companies', {
|
|
57
|
-
name: params.name
|
|
58
|
-
}, f);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "listUsers",
|
|
63
|
-
value: function listUsers(params, f) {
|
|
64
|
-
if (params.id) {
|
|
65
|
-
return this.client.get("/companies/".concat(params.id, "/users"), {}, f);
|
|
66
|
-
} else if (params.company_id) {
|
|
67
|
-
return this.client.get('/companies', {
|
|
68
|
-
company_id: params.company_id,
|
|
69
|
-
type: 'user'
|
|
70
|
-
}, f);
|
|
71
|
-
} else if (params.name) {
|
|
72
|
-
return this.client.get('/companies', {
|
|
73
|
-
name: params.name,
|
|
74
|
-
type: 'user'
|
|
75
|
-
}, f);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
|
|
80
|
-
return Company;
|
|
81
|
-
}();
|
|
82
|
-
|
|
83
|
-
exports["default"] = Company;
|
package/dist/contact.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _scroll = _interopRequireDefault(require("./scroll"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
|
-
|
|
16
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
17
|
-
|
|
18
|
-
var Contact = /*#__PURE__*/function () {
|
|
19
|
-
function Contact(client) {
|
|
20
|
-
_classCallCheck(this, Contact);
|
|
21
|
-
|
|
22
|
-
this.client = client;
|
|
23
|
-
this.scroll = new _scroll["default"](this.client, 'contact');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
_createClass(Contact, [{
|
|
27
|
-
key: "create",
|
|
28
|
-
value: function create() {
|
|
29
|
-
var parameters_or_function = arguments[0];
|
|
30
|
-
var params = {};
|
|
31
|
-
var callback = parameters_or_function;
|
|
32
|
-
|
|
33
|
-
if (typeof parameters_or_function !== 'function') {
|
|
34
|
-
params = parameters_or_function;
|
|
35
|
-
callback = arguments[1];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return this.client.post('/contacts', params, callback);
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
|
-
key: "update",
|
|
42
|
-
value: function update(params, f) {
|
|
43
|
-
return this.client.post('/contacts', params, f);
|
|
44
|
-
}
|
|
45
|
-
}, {
|
|
46
|
-
key: "list",
|
|
47
|
-
value: function list(f) {
|
|
48
|
-
return this.client.get('/contacts', {}, f);
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "listBy",
|
|
52
|
-
value: function listBy(params, f) {
|
|
53
|
-
return this.client.get('/contacts', params, f);
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: "find",
|
|
57
|
-
value: function find(params, f) {
|
|
58
|
-
if (params.id) {
|
|
59
|
-
return this.client.get("/contacts/".concat(params.id), {}, f);
|
|
60
|
-
} else if (params.user_id) {
|
|
61
|
-
return this.client.get('/contacts', {
|
|
62
|
-
user_id: params.user_id
|
|
63
|
-
}, f);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "delete",
|
|
68
|
-
value: function _delete(params, f) {
|
|
69
|
-
return this.client["delete"]("/contacts/".concat(params.id), {}, f);
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: "convert",
|
|
73
|
-
value: function convert(params, f) {
|
|
74
|
-
return this.client.post('/contacts/convert', params, f);
|
|
75
|
-
}
|
|
76
|
-
}]);
|
|
77
|
-
|
|
78
|
-
return Contact;
|
|
79
|
-
}();
|
|
80
|
-
|
|
81
|
-
exports["default"] = Contact;
|
package/dist/conversation.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
-
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
13
|
-
|
|
14
|
-
var Conversation = /*#__PURE__*/function () {
|
|
15
|
-
function Conversation(client) {
|
|
16
|
-
_classCallCheck(this, Conversation);
|
|
17
|
-
|
|
18
|
-
this.client = client;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
_createClass(Conversation, [{
|
|
22
|
-
key: "list",
|
|
23
|
-
value: function list(data, f) {
|
|
24
|
-
return this.client.get('/conversations', data, f);
|
|
25
|
-
}
|
|
26
|
-
}, {
|
|
27
|
-
key: "find",
|
|
28
|
-
value: function find(params, f) {
|
|
29
|
-
return this.client.get("/conversations/".concat(params.id), params, f);
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "reply",
|
|
33
|
-
value: function reply(params, f) {
|
|
34
|
-
return this.client.post("/conversations/".concat(params.id, "/reply"), params, f);
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "markAsRead",
|
|
38
|
-
value: function markAsRead(params, f) {
|
|
39
|
-
return this.client.put("/conversations/".concat(params.id), {
|
|
40
|
-
read: true
|
|
41
|
-
}, f);
|
|
42
|
-
}
|
|
43
|
-
}]);
|
|
44
|
-
|
|
45
|
-
return Conversation;
|
|
46
|
-
}();
|
|
47
|
-
|
|
48
|
-
exports["default"] = Conversation;
|