intercom-client 2.11.0 → 3.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 +873 -396
- package/dist/admin/admin.types.d.ts +13 -0
- package/dist/admin/admin.types.d.ts.map +1 -0
- package/dist/admin/admin.types.js +3 -0
- package/dist/admin/admin.types.js.map +1 -0
- package/dist/admin.d.ts +48 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +40 -41
- package/dist/admin.js.map +1 -0
- package/dist/client.d.ts +67 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +230 -239
- package/dist/client.js.map +1 -0
- package/dist/common/common.types.d.ts +91 -0
- package/dist/common/common.types.d.ts.map +1 -0
- package/dist/common/common.types.js +29 -0
- package/dist/common/common.types.js.map +1 -0
- package/dist/company/company.types.d.ts +37 -0
- package/dist/company/company.types.d.ts.map +1 -0
- package/dist/company/company.types.js +3 -0
- package/dist/company/company.types.js.map +1 -0
- package/dist/company.d.ts +67 -0
- package/dist/company.d.ts.map +1 -0
- package/dist/company.js +110 -83
- package/dist/company.js.map +1 -0
- package/dist/contact/contact.types.d.ts +80 -0
- package/dist/contact/contact.types.d.ts.map +1 -0
- package/dist/contact/contact.types.js +3 -0
- package/dist/contact/contact.types.js.map +1 -0
- package/dist/contact.d.ts +130 -0
- package/dist/contact.d.ts.map +1 -0
- package/dist/contact.js +155 -81
- package/dist/contact.js.map +1 -0
- package/dist/conversation/conversation.types.d.ts +144 -0
- package/dist/conversation/conversation.types.d.ts.map +1 -0
- package/dist/conversation/conversation.types.js +50 -0
- package/dist/conversation/conversation.types.js.map +1 -0
- package/dist/conversation.d.ts +176 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +287 -48
- package/dist/conversation.js.map +1 -0
- package/dist/dataAttribute/dataAttribute.types.d.ts +32 -0
- package/dist/dataAttribute/dataAttribute.types.d.ts.map +1 -0
- package/dist/dataAttribute/dataAttribute.types.js +18 -0
- package/dist/dataAttribute/dataAttribute.types.js.map +1 -0
- package/dist/dataAttribute.d.ts +33 -0
- package/dist/dataAttribute.d.ts.map +1 -0
- package/dist/dataAttribute.js +49 -0
- package/dist/dataAttribute.js.map +1 -0
- package/dist/errors/badResponse.error.d.ts +9 -0
- package/dist/errors/badResponse.error.d.ts.map +1 -0
- package/dist/errors/badResponse.error.js +21 -0
- package/dist/errors/badResponse.error.js.map +1 -0
- package/dist/event/event.types.d.ts +29 -0
- package/dist/event/event.types.d.ts.map +1 -0
- package/dist/event/event.types.js +3 -0
- package/dist/event/event.types.js.map +1 -0
- package/dist/event.d.ts +41 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +42 -45
- package/dist/event.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -76
- package/dist/index.js.map +1 -0
- package/dist/message/message.types.d.ts +17 -0
- package/dist/message/message.types.d.ts.map +1 -0
- package/dist/message/message.types.js +11 -0
- package/dist/message/message.types.js.map +1 -0
- package/dist/message.d.ts +30 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +32 -31
- package/dist/message.js.map +1 -0
- package/dist/scroll.d.ts +24 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +67 -79
- package/dist/scroll.js.map +1 -0
- package/dist/segment/segment.types.d.ts +11 -0
- package/dist/segment/segment.types.d.ts.map +1 -0
- package/dist/segment/segment.types.js +3 -0
- package/dist/segment/segment.types.js.map +1 -0
- package/dist/segment.d.ts +22 -0
- package/dist/segment.d.ts.map +1 -0
- package/dist/segment.js +26 -36
- package/dist/segment.js.map +1 -0
- package/dist/subscription/subscription.types.d.ts +19 -0
- package/dist/subscription/subscription.types.d.ts.map +1 -0
- package/dist/subscription/subscription.types.js +10 -0
- package/dist/subscription/subscription.types.js.map +1 -0
- package/dist/tag/tag.types.d.ts +6 -0
- package/dist/tag/tag.types.d.ts.map +1 -0
- package/dist/tag/tag.types.js +3 -0
- package/dist/tag/tag.types.js.map +1 -0
- package/dist/tag.d.ts +52 -0
- package/dist/tag.d.ts.map +1 -0
- package/dist/tag.js +93 -57
- package/dist/tag.js.map +1 -0
- package/dist/team/team.types.d.ts +7 -0
- package/dist/team/team.types.d.ts.map +1 -0
- package/dist/team/team.types.js +3 -0
- package/dist/team/team.types.js.map +1 -0
- package/dist/team.d.ts +18 -0
- package/dist/team.d.ts.map +1 -0
- package/dist/team.js +23 -0
- package/dist/team.js.map +1 -0
- package/dist/util/time.d.ts +3 -0
- package/dist/util/time.d.ts.map +1 -0
- package/dist/util/time.js +6 -0
- package/dist/util/time.js.map +1 -0
- package/dist/util/url.d.ts +3 -0
- package/dist/util/url.d.ts.map +1 -0
- package/dist/util/url.js +9 -0
- package/dist/util/url.js.map +1 -0
- package/package.json +57 -48
- package/dist/bulk.js +0 -55
- package/dist/counts.js +0 -88
- package/dist/customer.js +0 -33
- package/dist/note.js +0 -43
- package/dist/snippet.js +0 -121
- package/dist/user-data.js +0 -105
- package/dist/user.js +0 -120
- package/dist/visitor.js +0 -54
package/dist/segment.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 Segment =
|
|
15
|
-
/*#__PURE__*/
|
|
16
|
-
function () {
|
|
17
|
-
function Segment(client) {
|
|
18
|
-
_classCallCheck(this, Segment);
|
|
19
|
-
|
|
20
|
-
this.client = client;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_createClass(Segment, [{
|
|
24
|
-
key: "list",
|
|
25
|
-
value: function list(f) {
|
|
26
|
-
return this.client.get('/segments', {}, f);
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Segment = /** @class */ (function () {
|
|
4
|
+
function Segment(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
this.baseUrl = 'segments';
|
|
7
|
+
this.client = client;
|
|
27
8
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
9
|
+
Segment.prototype.list = function (_a) {
|
|
10
|
+
var include_count = _a.includeCount;
|
|
11
|
+
var params = { include_count: include_count };
|
|
12
|
+
return this.client.get({
|
|
13
|
+
url: "/".concat(this.baseUrl),
|
|
14
|
+
params: params,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
Segment.prototype.find = function (_a) {
|
|
18
|
+
var id = _a.id, include_count = _a.includeCount;
|
|
19
|
+
var params = { include_count: include_count };
|
|
20
|
+
return this.client.get({
|
|
21
|
+
url: "/".concat(this.baseUrl, "/").concat(id),
|
|
22
|
+
params: params,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return Segment;
|
|
26
|
+
}());
|
|
27
|
+
exports.default = Segment;
|
|
28
|
+
//# sourceMappingURL=segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.js","sourceRoot":"","sources":["../lib/segment.ts"],"names":[],"mappings":";;AAGA;IAGI,iBAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAF3B,YAAO,GAAG,UAAU,CAAC;QAGjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACD,sBAAI,GAAJ,UAAK,EAAyC;YAAzB,aAAa,kBAAA;QAC9B,IAAM,MAAM,GAAG,EAAE,aAAa,eAAA,EAAE,CAAC;QAEjC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe;YACjC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE;YACvB,MAAM,QAAA;SACT,CAAC,CAAC;IACP,CAAC;IACD,sBAAI,GAAJ,UAAK,EAAoD;YAAlD,EAAE,QAAA,EAAgB,aAAa,kBAAA;QAClC,IAAM,MAAM,GAAG,EAAE,aAAa,eAAA,EAAE,CAAC;QAEjC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB;YAClC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,cAAI,EAAE,CAAE;YAC7B,MAAM,QAAA;SACT,CAAC,CAAC;IACP,CAAC;IACL,cAAC;AAAD,CAAC,AAtBD,IAsBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare type SubscriptionObject = {
|
|
2
|
+
type: 'subscription';
|
|
3
|
+
id: string;
|
|
4
|
+
state: SubscriptionState;
|
|
5
|
+
default_translation: TranslationObject;
|
|
6
|
+
translations: TranslationObject[];
|
|
7
|
+
consent_type: 'opt_out';
|
|
8
|
+
};
|
|
9
|
+
export declare enum SubscriptionState {
|
|
10
|
+
ARCHIVED = "archived",
|
|
11
|
+
DRAFT = "draft",
|
|
12
|
+
LIVE = "live"
|
|
13
|
+
}
|
|
14
|
+
export declare type TranslationObject = {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
locale: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=subscription.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.types.d.ts","sourceRoot":"","sources":["../../lib/subscription/subscription.types.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB,GAAG;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,iBAAiB,CAAC;IACzB,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,YAAY,EAAE,SAAS,CAAC;CAC3B,CAAC;AAEF,oBAAY,iBAAiB;IACzB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;CAChB;AAED,oBAAY,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionState = void 0;
|
|
4
|
+
var SubscriptionState;
|
|
5
|
+
(function (SubscriptionState) {
|
|
6
|
+
SubscriptionState["ARCHIVED"] = "archived";
|
|
7
|
+
SubscriptionState["DRAFT"] = "draft";
|
|
8
|
+
SubscriptionState["LIVE"] = "live";
|
|
9
|
+
})(SubscriptionState = exports.SubscriptionState || (exports.SubscriptionState = {}));
|
|
10
|
+
//# sourceMappingURL=subscription.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.types.js","sourceRoot":"","sources":["../../lib/subscription/subscription.types.ts"],"names":[],"mappings":";;;AASA,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,0CAAqB,CAAA;IACrB,oCAAe,CAAA;IACf,kCAAa,CAAA;AACjB,CAAC,EAJW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAI5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.types.d.ts","sourceRoot":"","sources":["../../lib/tag/tag.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.types.js","sourceRoot":"","sources":["../../lib/tag/tag.types.ts"],"names":[],"mappings":""}
|
package/dist/tag.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Client } from '.';
|
|
2
|
+
import { TagObject } from './tag/tag.types';
|
|
3
|
+
export default class Tag {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private tagsBaseUrl;
|
|
6
|
+
constructor(client: Client);
|
|
7
|
+
create(data: CreateTagData): Promise<TagObject>;
|
|
8
|
+
update(data: UpdateTagData): Promise<TagObject>;
|
|
9
|
+
delete({ id }: DeleteTagData): Promise<TagObject>;
|
|
10
|
+
tagContact({ contactId, tagId }: TagContactData): Promise<TagObject>;
|
|
11
|
+
tagConversation({ conversationId, tagId, adminId: admin_id, }: TagConversationData): Promise<TagObject>;
|
|
12
|
+
tagCompanies({ tagName: name, companiesIds }: TagCompaniesData): Promise<TagObject>;
|
|
13
|
+
untagContact({ contactId, tagId }: UntagContactData): Promise<TagObject>;
|
|
14
|
+
untagConversation({ conversationId, tagId, adminId: admin_id, }: UntagConversationData): Promise<TagObject>;
|
|
15
|
+
untagCompanies({ tagName: name, companiesIds }: UntagCompaniesData): Promise<TagObject>;
|
|
16
|
+
list(): Promise<ListAllTagsResponse>;
|
|
17
|
+
}
|
|
18
|
+
interface CreateTagData {
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
interface UpdateTagData extends CreateTagData {
|
|
22
|
+
id: string;
|
|
23
|
+
}
|
|
24
|
+
interface DeleteTagData {
|
|
25
|
+
id: string;
|
|
26
|
+
}
|
|
27
|
+
interface TagContactData {
|
|
28
|
+
contactId: string;
|
|
29
|
+
tagId: string;
|
|
30
|
+
}
|
|
31
|
+
interface TagConversationData {
|
|
32
|
+
conversationId: string;
|
|
33
|
+
tagId: string;
|
|
34
|
+
adminId: string;
|
|
35
|
+
}
|
|
36
|
+
interface TagCompaniesData {
|
|
37
|
+
tagName: string;
|
|
38
|
+
companiesIds: string[];
|
|
39
|
+
}
|
|
40
|
+
declare type UntagContactData = TagContactData;
|
|
41
|
+
interface UntagConversationData {
|
|
42
|
+
tagId: string;
|
|
43
|
+
conversationId: string;
|
|
44
|
+
adminId: string;
|
|
45
|
+
}
|
|
46
|
+
declare type UntagCompaniesData = TagCompaniesData;
|
|
47
|
+
interface ListAllTagsResponse {
|
|
48
|
+
type: 'list';
|
|
49
|
+
data: Array<TagObject>;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../lib/tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAO,GAAG;IAGR,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,WAAW,CAAU;gBAEA,MAAM,EAAE,MAAM;IAI3C,MAAM,CAAC,IAAI,EAAE,aAAa;IAM1B,MAAM,CAAC,IAAI,EAAE,aAAa;IAM1B,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,aAAa;IAK5B,UAAU,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,cAAc;IAS/C,eAAe,CAAC,EACZ,cAAc,EACd,KAAK,EACL,OAAO,EAAE,QAAQ,GACpB,EAAE,mBAAmB;IAWtB,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,gBAAgB;IAW9D,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,gBAAgB;IAKnD,iBAAiB,CAAC,EACd,cAAc,EACd,KAAK,EACL,OAAO,EAAE,QAAQ,GACpB,EAAE,qBAAqB;IAWxB,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,kBAAkB;IAWlE,IAAI;CAKP;AAED,UAAU,aAAa;IACnB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAc,SAAQ,aAAa;IACzC,EAAE,EAAE,MAAM,CAAC;CACd;AAED,UAAU,aAAa;IACnB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,UAAU,cAAc;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,mBAAmB;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,gBAAgB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,aAAK,gBAAgB,GAAG,cAAc,CAAC;AAEvC,UAAU,qBAAqB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,aAAK,kBAAkB,GAAG,gBAAgB,CAAC;AAE3C,UAAU,mBAAmB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC1B"}
|
package/dist/tag.js
CHANGED
|
@@ -1,59 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 Tag =
|
|
15
|
-
/*#__PURE__*/
|
|
16
|
-
function () {
|
|
17
|
-
function Tag(client) {
|
|
18
|
-
_classCallCheck(this, Tag);
|
|
19
|
-
|
|
20
|
-
this.client = client;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_createClass(Tag, [{
|
|
24
|
-
key: "create",
|
|
25
|
-
value: function create(data, f) {
|
|
26
|
-
return this.client.post('/tags', data, f);
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Tag = /** @class */ (function () {
|
|
4
|
+
function Tag(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
this.tagsBaseUrl = 'tags';
|
|
7
|
+
this.client = client;
|
|
27
8
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
9
|
+
Tag.prototype.create = function (data) {
|
|
10
|
+
return this.client.post({
|
|
11
|
+
url: "/".concat(this.tagsBaseUrl),
|
|
12
|
+
data: data,
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Tag.prototype.update = function (data) {
|
|
16
|
+
return this.client.post({
|
|
17
|
+
url: "/".concat(this.tagsBaseUrl),
|
|
18
|
+
data: data,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Tag.prototype.delete = function (_a) {
|
|
22
|
+
var id = _a.id;
|
|
23
|
+
return this.client.delete({
|
|
24
|
+
url: "/".concat(this.tagsBaseUrl, "/").concat(id),
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
Tag.prototype.tagContact = function (_a) {
|
|
28
|
+
var contactId = _a.contactId, tagId = _a.tagId;
|
|
29
|
+
var data = {
|
|
30
|
+
id: tagId,
|
|
31
|
+
};
|
|
32
|
+
return this.client.post({
|
|
33
|
+
url: "/".concat(this.client.contacts.baseUrl, "/").concat(contactId, "/").concat(this.tagsBaseUrl),
|
|
34
|
+
data: data,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
Tag.prototype.tagConversation = function (_a) {
|
|
38
|
+
var conversationId = _a.conversationId, tagId = _a.tagId, admin_id = _a.adminId;
|
|
39
|
+
var data = {
|
|
40
|
+
id: tagId,
|
|
41
|
+
admin_id: admin_id,
|
|
42
|
+
};
|
|
43
|
+
return this.client.post({
|
|
44
|
+
url: "/".concat(this.client.conversations.baseUrl, "/").concat(conversationId, "/").concat(this.tagsBaseUrl),
|
|
45
|
+
data: data,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
Tag.prototype.tagCompanies = function (_a) {
|
|
49
|
+
var name = _a.tagName, companiesIds = _a.companiesIds;
|
|
50
|
+
var data = {
|
|
51
|
+
name: name,
|
|
52
|
+
companies: companiesIds.map(function (id) { return ({ id: id }); }),
|
|
53
|
+
};
|
|
54
|
+
return this.client.post({
|
|
55
|
+
url: "/".concat(this.tagsBaseUrl),
|
|
56
|
+
data: data,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
Tag.prototype.untagContact = function (_a) {
|
|
60
|
+
var contactId = _a.contactId, tagId = _a.tagId;
|
|
61
|
+
return this.client.delete({
|
|
62
|
+
url: "/".concat(this.client.contacts.baseUrl, "/").concat(contactId, "/").concat(this.tagsBaseUrl, "/").concat(tagId),
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
Tag.prototype.untagConversation = function (_a) {
|
|
66
|
+
var conversationId = _a.conversationId, tagId = _a.tagId, admin_id = _a.adminId;
|
|
67
|
+
var data = {
|
|
68
|
+
id: tagId,
|
|
69
|
+
admin_id: admin_id,
|
|
70
|
+
};
|
|
71
|
+
return this.client.delete({
|
|
72
|
+
url: "/".concat(this.client.conversations.baseUrl, "/").concat(conversationId, "/").concat(this.tagsBaseUrl, "/").concat(tagId),
|
|
73
|
+
data: data,
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
Tag.prototype.untagCompanies = function (_a) {
|
|
77
|
+
var name = _a.tagName, companiesIds = _a.companiesIds;
|
|
78
|
+
var data = {
|
|
79
|
+
name: name,
|
|
80
|
+
companies: companiesIds.map(function (id) { return ({ id: id, untag: true }); }),
|
|
81
|
+
};
|
|
82
|
+
return this.client.post({
|
|
83
|
+
url: "/".concat(this.tagsBaseUrl),
|
|
84
|
+
data: data,
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
Tag.prototype.list = function () {
|
|
88
|
+
return this.client.get({
|
|
89
|
+
url: "/".concat(this.tagsBaseUrl),
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return Tag;
|
|
93
|
+
}());
|
|
94
|
+
exports.default = Tag;
|
|
95
|
+
//# sourceMappingURL=tag.js.map
|
package/dist/tag.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../lib/tag.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.types.d.ts","sourceRoot":"","sources":["../../lib/team/team.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.types.js","sourceRoot":"","sources":["../../lib/team/team.types.ts"],"names":[],"mappings":""}
|
package/dist/team.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client } from '.';
|
|
2
|
+
import { TeamObject } from './team/team.types';
|
|
3
|
+
export default class Team {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private readonly baseUrl;
|
|
6
|
+
constructor(client: Client);
|
|
7
|
+
find({ id }: FindTeamData): Promise<TeamObject>;
|
|
8
|
+
list(): Promise<ListTeamsResponse>;
|
|
9
|
+
}
|
|
10
|
+
interface FindTeamData {
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
interface ListTeamsResponse {
|
|
14
|
+
type: 'team.list';
|
|
15
|
+
teams: TeamObject[];
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=team.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../lib/team.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,IAAI;IAGT,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;gBAEN,MAAM,EAAE,MAAM;IAI3C,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,YAAY;IAMzB,IAAI;CAKP;AAED,UAAU,YAAY;IAClB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,UAAU,iBAAiB;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,UAAU,EAAE,CAAC;CACvB"}
|
package/dist/team.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Team = /** @class */ (function () {
|
|
4
|
+
function Team(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
this.baseUrl = 'teams';
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
Team.prototype.find = function (_a) {
|
|
10
|
+
var id = _a.id;
|
|
11
|
+
return this.client.get({
|
|
12
|
+
url: "/".concat(this.baseUrl, "/").concat(id),
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Team.prototype.list = function () {
|
|
16
|
+
return this.client.get({
|
|
17
|
+
url: "/".concat(this.baseUrl),
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return Team;
|
|
21
|
+
}());
|
|
22
|
+
exports.default = Team;
|
|
23
|
+
//# sourceMappingURL=team.js.map
|
package/dist/team.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.js","sourceRoot":"","sources":["../lib/team.ts"],"names":[],"mappings":";;AAGA;IAGI,cAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAF1B,YAAO,GAAG,OAAO,CAAC;QAG/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,mBAAI,GAAJ,UAAK,EAAoB;YAAlB,EAAE,QAAA;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa;YAC/B,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,cAAI,EAAE,CAAE;SAChC,CAAC,CAAC;IACP,CAAC;IAED,mBAAI,GAAJ;QACI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAoB;YACtC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE;SAC1B,CAAC,CAAC;IACP,CAAC;IACL,WAAC;AAAD,CAAC,AAlBD,IAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../lib/util/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAO,MAAM,mBAAmB,SAAU,IAAI,KAAG,SAA8C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateToUnixTimestamp = void 0;
|
|
4
|
+
var dateToUnixTimestamp = function (date) { return Math.floor(date.getTime() / 1000); };
|
|
5
|
+
exports.dateToUnixTimestamp = dateToUnixTimestamp;
|
|
6
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../lib/util/time.ts"],"names":[],"mappings":";;;AAEO,IAAM,mBAAmB,GAAG,UAAC,IAAU,IAAgB,OAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,EAAjC,CAAiC,CAAC;AAAnF,QAAA,mBAAmB,uBAAgE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../lib/util/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAGtC,eAAO,MAAM,kBAAkB,WACnB,OAAO,MAAM,EAAE,MAAM,GAAG,cAAc,MAAM,CAAC,CAAC,KACvD,eAAmE,CAAC"}
|
package/dist/util/url.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeParamsForURL = void 0;
|
|
4
|
+
var url_1 = require("url");
|
|
5
|
+
var lodash_1 = require("lodash");
|
|
6
|
+
var encodeParamsForURL = function (params) { return new url_1.URLSearchParams(purifyFromEmptiness(params)); };
|
|
7
|
+
exports.encodeParamsForURL = encodeParamsForURL;
|
|
8
|
+
var purifyFromEmptiness = function (object) { return (0, lodash_1.omitBy)(object, lodash_1.isEmpty); };
|
|
9
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../lib/util/url.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AACtC,iCAAyC;AAElC,IAAM,kBAAkB,GAAG,UAC9B,MAAsD,IACpC,OAAA,IAAI,qBAAe,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAhD,CAAgD,CAAC;AAF1D,QAAA,kBAAkB,sBAEwC;AAEvE,IAAM,mBAAmB,GAAG,UACxB,MAAsD,IACL,OAAA,IAAA,eAAM,EAAC,MAAM,EAAE,gBAAO,CAAC,EAAvB,CAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,50 +1,59 @@
|
|
|
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
|
-
|
|
2
|
+
"name": "intercom-client",
|
|
3
|
+
"version": "3.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
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
27
|
+
"@types/lodash": "^4.14.176",
|
|
28
|
+
"@types/mocha": "^9.1.0",
|
|
29
|
+
"@types/node": "^16.11.6",
|
|
30
|
+
"@types/sinon": "^10.0.6",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
32
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
33
|
+
"eslint": "^8.2.0",
|
|
34
|
+
"eslint-config-prettier": "^8.3.0",
|
|
35
|
+
"merge2": "^1.4.1",
|
|
36
|
+
"mocha": "^9.2.0",
|
|
37
|
+
"nock": "^13.0.11",
|
|
38
|
+
"nyc": "^15.1.0",
|
|
39
|
+
"prettier": "^2.5.1",
|
|
40
|
+
"sinon": "^7.3.2",
|
|
41
|
+
"ts-node": "^10.4.0",
|
|
42
|
+
"tslib": "^2.3.1",
|
|
43
|
+
"typescript": "^4.5.3"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"clean": "rm -r dist",
|
|
47
|
+
"static": "eslint .",
|
|
48
|
+
"compile_ts": "tsc",
|
|
49
|
+
"move_compiled_to_dist": "mv dist/lib/* dist && rmdir dist/lib",
|
|
50
|
+
"prepublish": "yarn clean && yarn static && yarn compile_ts && yarn move_compiled_to_dist",
|
|
51
|
+
"test": "mocha -r ts-node/register test/*.ts",
|
|
52
|
+
"coverage": "nyc yarn test"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">= v8.0.0"
|
|
56
|
+
},
|
|
57
|
+
"license": "Apache-2.0",
|
|
58
|
+
"packageManager": "yarn@3.1.1"
|
|
50
59
|
}
|
package/dist/bulk.js
DELETED
|
@@ -1,55 +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 =
|
|
15
|
-
/*#__PURE__*/
|
|
16
|
-
function () {
|
|
17
|
-
function Bulk(client, dataType) {
|
|
18
|
-
_classCallCheck(this, Bulk);
|
|
19
|
-
|
|
20
|
-
this.client = client;
|
|
21
|
-
this.dataType = dataType;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
_createClass(Bulk, [{
|
|
25
|
-
key: "bulk",
|
|
26
|
-
value: function bulk(bulkOperations, f) {
|
|
27
|
-
var dataType = this.dataType;
|
|
28
|
-
var bulkParams = {
|
|
29
|
-
items: []
|
|
30
|
-
};
|
|
31
|
-
var url = "/bulk/".concat(dataType, "s");
|
|
32
|
-
bulkOperations.forEach(function (params) {
|
|
33
|
-
for (var k in params) {
|
|
34
|
-
var data = params[k];
|
|
35
|
-
var method = k === 'create' ? 'post' : k;
|
|
36
|
-
|
|
37
|
-
if (method !== 'post' && method !== 'delete') {
|
|
38
|
-
throw new Error("Unknown bulk type: ".concat(method));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
bulkParams.items.push({
|
|
42
|
-
method: method,
|
|
43
|
-
data_type: dataType,
|
|
44
|
-
data: data
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return this.client.post(url, bulkParams, f);
|
|
49
|
-
}
|
|
50
|
-
}]);
|
|
51
|
-
|
|
52
|
-
return Bulk;
|
|
53
|
-
}();
|
|
54
|
-
|
|
55
|
-
exports["default"] = Bulk;
|