intercom-client 2.11.2 → 3.0.1

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.
Files changed (139) hide show
  1. package/README.md +863 -404
  2. package/dist/admin/admin.types.d.ts +13 -0
  3. package/dist/admin/admin.types.d.ts.map +1 -0
  4. package/dist/admin/admin.types.js +3 -0
  5. package/dist/admin/admin.types.js.map +1 -0
  6. package/dist/admin.d.ts +48 -0
  7. package/dist/admin.d.ts.map +1 -0
  8. package/dist/admin.js +40 -44
  9. package/dist/admin.js.map +1 -0
  10. package/dist/article/article.types.d.ts +87 -0
  11. package/dist/article/article.types.d.ts.map +1 -0
  12. package/dist/article/article.types.js +45 -0
  13. package/dist/article/article.types.js.map +1 -0
  14. package/dist/article.d.ts +37 -0
  15. package/dist/article.d.ts.map +1 -0
  16. package/dist/article.js +69 -0
  17. package/dist/article.js.map +1 -0
  18. package/dist/client.d.ts +71 -0
  19. package/dist/client.d.ts.map +1 -0
  20. package/dist/client.js +235 -237
  21. package/dist/client.js.map +1 -0
  22. package/dist/common/common.types.d.ts +64 -0
  23. package/dist/common/common.types.d.ts.map +1 -0
  24. package/dist/common/common.types.js +29 -0
  25. package/dist/common/common.types.js.map +1 -0
  26. package/dist/company/company.types.d.ts +37 -0
  27. package/dist/company/company.types.d.ts.map +1 -0
  28. package/dist/company/company.types.js +3 -0
  29. package/dist/company/company.types.js.map +1 -0
  30. package/dist/company.d.ts +63 -0
  31. package/dist/company.d.ts.map +1 -0
  32. package/dist/company.js +110 -81
  33. package/dist/company.js.map +1 -0
  34. package/dist/contact/contact.types.d.ts +80 -0
  35. package/dist/contact/contact.types.d.ts.map +1 -0
  36. package/dist/contact/contact.types.js +3 -0
  37. package/dist/contact/contact.types.js.map +1 -0
  38. package/dist/contact.d.ts +126 -0
  39. package/dist/contact.d.ts.map +1 -0
  40. package/dist/contact.js +155 -79
  41. package/dist/contact.js.map +1 -0
  42. package/dist/conversation/conversation.types.d.ts +144 -0
  43. package/dist/conversation/conversation.types.d.ts.map +1 -0
  44. package/dist/conversation/conversation.types.js +50 -0
  45. package/dist/conversation/conversation.types.js.map +1 -0
  46. package/dist/conversation.d.ts +176 -0
  47. package/dist/conversation.d.ts.map +1 -0
  48. package/dist/conversation.js +287 -46
  49. package/dist/conversation.js.map +1 -0
  50. package/dist/dataAttribute/dataAttribute.types.d.ts +32 -0
  51. package/dist/dataAttribute/dataAttribute.types.d.ts.map +1 -0
  52. package/dist/dataAttribute/dataAttribute.types.js +18 -0
  53. package/dist/dataAttribute/dataAttribute.types.js.map +1 -0
  54. package/dist/dataAttribute.d.ts +33 -0
  55. package/dist/dataAttribute.d.ts.map +1 -0
  56. package/dist/dataAttribute.js +49 -0
  57. package/dist/dataAttribute.js.map +1 -0
  58. package/dist/errors/badResponse.error.d.ts +9 -0
  59. package/dist/errors/badResponse.error.d.ts.map +1 -0
  60. package/dist/errors/badResponse.error.js +21 -0
  61. package/dist/errors/badResponse.error.js.map +1 -0
  62. package/dist/event/event.types.d.ts +29 -0
  63. package/dist/event/event.types.d.ts.map +1 -0
  64. package/dist/event/event.types.js +3 -0
  65. package/dist/event/event.types.js.map +1 -0
  66. package/dist/event.d.ts +41 -0
  67. package/dist/event.d.ts.map +1 -0
  68. package/dist/event.js +42 -43
  69. package/dist/event.js.map +1 -0
  70. package/dist/helpCenter/helpCenter.types.d.ts +23 -0
  71. package/dist/helpCenter/helpCenter.types.d.ts.map +1 -0
  72. package/dist/helpCenter/helpCenter.types.js +3 -0
  73. package/dist/helpCenter/helpCenter.types.js.map +1 -0
  74. package/dist/helpCenter.d.ts +61 -0
  75. package/dist/helpCenter.d.ts.map +1 -0
  76. package/dist/helpCenter.js +121 -0
  77. package/dist/helpCenter.js.map +1 -0
  78. package/dist/index.d.ts +25 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +57 -74
  81. package/dist/index.js.map +1 -0
  82. package/dist/message/message.types.d.ts +17 -0
  83. package/dist/message/message.types.d.ts.map +1 -0
  84. package/dist/message/message.types.js +11 -0
  85. package/dist/message/message.types.js.map +1 -0
  86. package/dist/message.d.ts +30 -0
  87. package/dist/message.d.ts.map +1 -0
  88. package/dist/message.js +32 -29
  89. package/dist/message.js.map +1 -0
  90. package/dist/package.json +59 -0
  91. package/dist/scroll.d.ts +24 -0
  92. package/dist/scroll.d.ts.map +1 -0
  93. package/dist/scroll.js +67 -77
  94. package/dist/scroll.js.map +1 -0
  95. package/dist/segment/segment.types.d.ts +11 -0
  96. package/dist/segment/segment.types.d.ts.map +1 -0
  97. package/dist/segment/segment.types.js +3 -0
  98. package/dist/segment/segment.types.js.map +1 -0
  99. package/dist/segment.d.ts +22 -0
  100. package/dist/segment.d.ts.map +1 -0
  101. package/dist/segment.js +26 -34
  102. package/dist/segment.js.map +1 -0
  103. package/dist/subscription/subscription.types.d.ts +19 -0
  104. package/dist/subscription/subscription.types.d.ts.map +1 -0
  105. package/dist/subscription/subscription.types.js +10 -0
  106. package/dist/subscription/subscription.types.js.map +1 -0
  107. package/dist/tag/tag.types.d.ts +6 -0
  108. package/dist/tag/tag.types.d.ts.map +1 -0
  109. package/dist/tag/tag.types.js +3 -0
  110. package/dist/tag/tag.types.js.map +1 -0
  111. package/dist/tag.d.ts +52 -0
  112. package/dist/tag.d.ts.map +1 -0
  113. package/dist/tag.js +93 -55
  114. package/dist/tag.js.map +1 -0
  115. package/dist/team/team.types.d.ts +7 -0
  116. package/dist/team/team.types.d.ts.map +1 -0
  117. package/dist/team/team.types.js +3 -0
  118. package/dist/team/team.types.js.map +1 -0
  119. package/dist/team.d.ts +18 -0
  120. package/dist/team.d.ts.map +1 -0
  121. package/dist/team.js +23 -0
  122. package/dist/team.js.map +1 -0
  123. package/dist/util/time.d.ts +3 -0
  124. package/dist/util/time.d.ts.map +1 -0
  125. package/dist/util/time.js +6 -0
  126. package/dist/util/time.js.map +1 -0
  127. package/dist/util/url.d.ts +3 -0
  128. package/dist/util/url.d.ts.map +1 -0
  129. package/dist/util/url.js +9 -0
  130. package/dist/util/url.js.map +1 -0
  131. package/package.json +57 -49
  132. package/dist/bulk.js +0 -53
  133. package/dist/counts.js +0 -86
  134. package/dist/customer.js +0 -31
  135. package/dist/note.js +0 -41
  136. package/dist/snippet.js +0 -119
  137. package/dist/user-data.js +0 -103
  138. package/dist/user.js +0 -118
  139. package/dist/visitor.js +0 -52
package/dist/event.js CHANGED
@@ -1,45 +1,44 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _bulk = _interopRequireDefault(require("./bulk"));
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 Event = /*#__PURE__*/function () {
19
- function Event(client) {
20
- _classCallCheck(this, Event);
21
-
22
- this.client = client;
23
- }
24
-
25
- _createClass(Event, [{
26
- key: "create",
27
- value: function create(data, f) {
28
- return this.client.post('/events', data, f);
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Event = /** @class */ (function () {
4
+ function Event(client) {
5
+ this.client = client;
6
+ this.baseUrl = 'events';
7
+ this.client = client;
29
8
  }
30
- }, {
31
- key: "listBy",
32
- value: function listBy(params, f) {
33
- return this.client.get('/events', params, f);
34
- }
35
- }, {
36
- key: "bulk",
37
- value: function bulk(params, f) {
38
- return new _bulk["default"](this.client, 'event').bulk(params, f);
39
- }
40
- }]);
41
-
42
- return Event;
43
- }();
44
-
45
- exports["default"] = Event;
9
+ Event.prototype.create = function (_a) {
10
+ var event_name = _a.eventName, created_at = _a.createdAt, user_id = _a.userId, id = _a.id, email = _a.email, metadata = _a.metadata;
11
+ var data = {
12
+ event_name: event_name,
13
+ created_at: created_at,
14
+ user_id: user_id,
15
+ id: id,
16
+ email: email,
17
+ metadata: metadata,
18
+ };
19
+ return this.client.post({ url: "/".concat(this.baseUrl), data: data });
20
+ };
21
+ Event.prototype.listBy = function (_a) {
22
+ var user_id = _a.userId, email = _a.email, intercom_user_id = _a.intercomUserId, per_page = _a.perPage, summary = _a.summary;
23
+ var params = {
24
+ type: 'user',
25
+ user_id: user_id,
26
+ email: email,
27
+ intercom_user_id: intercom_user_id,
28
+ per_page: per_page,
29
+ summary: summary,
30
+ };
31
+ return summary
32
+ ? this.client.get({
33
+ url: "/".concat(this.baseUrl),
34
+ params: params,
35
+ })
36
+ : this.client.get({
37
+ url: "/".concat(this.baseUrl),
38
+ params: params,
39
+ });
40
+ };
41
+ return Event;
42
+ }());
43
+ exports.default = Event;
44
+ //# sourceMappingURL=event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../../lib/event.ts"],"names":[],"mappings":";;AAGA;IAGI,eAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAF3B,YAAO,GAAG,QAAQ,CAAC;QAG/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACD,sBAAM,GAAN,UAAO,EAOW;YANH,UAAU,eAAA,EACV,UAAU,eAAA,EACb,OAAO,YAAA,EACf,EAAE,QAAA,EACF,KAAK,WAAA,EACL,QAAQ,cAAA;QAER,IAAM,IAAI,GAAgB;YACtB,UAAU,YAAA;YACV,UAAU,YAAA;YACV,OAAO,SAAA;YACP,EAAE,IAAA;YACF,KAAK,OAAA;YACL,QAAQ,UAAA;SACX,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAO,EAAE,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,sBAAM,GAAN,UAAO,EAMM;YALD,OAAO,YAAA,EACf,KAAK,WAAA,EACW,gBAAgB,oBAAA,EACvB,QAAQ,aAAA,EACjB,OAAO,aAAA;QAEP,IAAM,MAAM,GAAG;YACX,IAAI,EAAE,MAAM;YACZ,OAAO,SAAA;YACP,KAAK,OAAA;YACL,gBAAgB,kBAAA;YAChB,QAAQ,UAAA;YACR,OAAO,SAAA;SACV,CAAC;QAEF,OAAO,OAAO;YACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgC;gBAC3C,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE;gBACvB,MAAM,QAAA;aACT,CAAC;YACJ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAqB;gBAChC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE;gBACvB,MAAM,QAAA;aACT,CAAC,CAAC;IACb,CAAC;IACL,YAAC;AAAD,CAAC,AAnDD,IAmDC"}
@@ -0,0 +1,23 @@
1
+ import { ArticleObject, Locales } from '../index';
2
+ export declare type CollectionObject = {
3
+ type: 'collection';
4
+ name: string;
5
+ icon: string;
6
+ order: number;
7
+ } & Pick<ArticleObject, 'id' | 'workspace_id' | 'description' | 'created_at' | 'updated_at' | 'url' | 'default_locale' | 'translated_content'>;
8
+ export declare type SectionObject = {
9
+ type: 'section';
10
+ parent_id: number;
11
+ } & Omit<CollectionObject, 'type'>;
12
+ export declare type GroupTranslatedContentObject = {
13
+ type: 'group_translated_content';
14
+ } & Partial<HelpCenterLocalesMapping>;
15
+ export declare type HelpCenterLocalesMapping = {
16
+ [key in Locales]: GroupContentObject;
17
+ };
18
+ export declare type GroupContentObject = {
19
+ name: string;
20
+ description: string;
21
+ type?: 'group_content';
22
+ };
23
+ //# sourceMappingURL=helpCenter.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpCenter.types.d.ts","sourceRoot":"","sources":["../../../lib/helpCenter/helpCenter.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAElD,oBAAY,gBAAgB,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB,GAAG,IAAI,CACJ,aAAa,EACX,IAAI,GACJ,cAAc,GACd,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,KAAK,GACL,gBAAgB,GAChB,oBAAoB,CACzB,CAAC;AAEF,oBAAY,aAAa,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAEnC,oBAAY,4BAA4B,GAAG;IACvC,IAAI,EAAE,0BAA0B,CAAC;CACpC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEtC,oBAAY,wBAAwB,GAAG;KAClC,GAAG,IAAI,OAAO,GAAG,kBAAkB;CACvC,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=helpCenter.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpCenter.types.js","sourceRoot":"","sources":["../../../lib/helpCenter/helpCenter.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import { Client } from '.';
2
+ import { GenericDeletedResponse, Paginated } from './common/common.types';
3
+ import { CollectionObject, GroupTranslatedContentObject, SectionObject } from './helpCenter/helpCenter.types';
4
+ export default class HelpCenter {
5
+ readonly collections: Collection;
6
+ readonly sections: Section;
7
+ constructor(client: Client);
8
+ }
9
+ declare class Collection {
10
+ private readonly client;
11
+ readonly baseUrl = "help_center/collections";
12
+ constructor(client: Client);
13
+ create({ name, description, translatedContent }: CreateCollectionData): Promise<CollectionObject>;
14
+ find({ id }: CollectionFindByIdData): Promise<CollectionObject>;
15
+ update({ id, name, description, translatedContent }: UpdateCollectionData): Promise<CollectionObject>;
16
+ delete({ id }: CollectionDeleteByIdData): Promise<CollectionDeleteByIdResponse>;
17
+ list({ page, perPage: per_page }: CollectionListData): Promise<CollectionListResponse>;
18
+ }
19
+ interface CreateCollectionData {
20
+ name: string;
21
+ description?: string;
22
+ translatedContent?: Omit<GroupTranslatedContentObject, 'type'>;
23
+ }
24
+ declare type CollectionFindByIdData = OperationById;
25
+ declare type UpdateCollectionData = Partial<CreateCollectionData> & OperationById;
26
+ declare type CollectionDeleteByIdData = OperationById;
27
+ declare type CollectionDeleteByIdResponse = GenericDeletedResponse<'collection'>;
28
+ declare type CollectionListData = {
29
+ page?: number;
30
+ perPage?: number;
31
+ };
32
+ declare type CollectionListResponse = Paginated<CollectionObject>;
33
+ declare class Section {
34
+ private readonly client;
35
+ readonly baseUrl = "help_center/sections";
36
+ constructor(client: Client);
37
+ create({ name, parentId, translatedContent }: CreateSectionData): Promise<SectionObject>;
38
+ find({ id }: SectionFindByIdData): Promise<SectionObject>;
39
+ update({ id, name, parentId, translatedContent }: UpdateSectionData): Promise<SectionObject>;
40
+ delete({ id }: SectionDeleteByIdData): Promise<SectionDeleteByIdResponse>;
41
+ list({ page, perPage: per_page }: SectionListData): Promise<SectionListResponse>;
42
+ }
43
+ interface CreateSectionData {
44
+ name: string;
45
+ parentId: string;
46
+ translatedContent?: Omit<GroupTranslatedContentObject, 'type'>;
47
+ }
48
+ declare type SectionFindByIdData = OperationById;
49
+ declare type UpdateSectionData = Partial<CreateSectionData> & OperationById;
50
+ declare type SectionDeleteByIdData = OperationById;
51
+ declare type SectionDeleteByIdResponse = GenericDeletedResponse<'section'>;
52
+ declare type SectionListData = {
53
+ page?: number;
54
+ perPage?: number;
55
+ };
56
+ declare type SectionListResponse = Paginated<SectionObject>;
57
+ interface OperationById {
58
+ id: string;
59
+ }
60
+ export {};
61
+ //# sourceMappingURL=helpCenter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpCenter.d.ts","sourceRoot":"","sources":["../../lib/helpCenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EACH,gBAAgB,EAChB,4BAA4B,EAC5B,aAAa,EAChB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,OAAO,OAAO,UAAU;IAC3B,SAAgB,WAAW,EAAE,UAAU,CAAC;IACxC,SAAgB,QAAQ,EAAE,OAAO,CAAC;gBAEtB,MAAM,EAAE,MAAM;CAI7B;AAED,cAAM,UAAU;IAGA,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,SAAgB,OAAO,6BAA6B;gBAEvB,MAAM,EAAE,MAAM;IAI3C,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAAE,oBAAoB;IAYrE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,sBAAsB;IAKnC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAAE,oBAAoB;IAYzE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,wBAAwB;IAKvC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,kBAAkB;CAWvD;AAED,UAAU,oBAAoB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACr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,aAAK,yBAAyB,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;AAEnE,aAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,aAAK,mBAAmB,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;AAEpD,UAAU,aAAa;IACnB,EAAE,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var HelpCenter = /** @class */ (function () {
4
+ function HelpCenter(client) {
5
+ this.collections = new Collection(client);
6
+ this.sections = new Section(client);
7
+ }
8
+ return HelpCenter;
9
+ }());
10
+ exports.default = HelpCenter;
11
+ var Collection = /** @class */ (function () {
12
+ function Collection(client) {
13
+ this.client = client;
14
+ this.baseUrl = 'help_center/collections';
15
+ this.client = client;
16
+ }
17
+ Collection.prototype.create = function (_a) {
18
+ var name = _a.name, description = _a.description, translatedContent = _a.translatedContent;
19
+ var data = {
20
+ name: name,
21
+ description: description,
22
+ translated_content: translatedContent,
23
+ };
24
+ return this.client.post({
25
+ url: "/".concat(this.baseUrl),
26
+ data: data,
27
+ });
28
+ };
29
+ Collection.prototype.find = function (_a) {
30
+ var id = _a.id;
31
+ return this.client.get({
32
+ url: "/".concat(this.baseUrl, "/").concat(id),
33
+ });
34
+ };
35
+ Collection.prototype.update = function (_a) {
36
+ var id = _a.id, name = _a.name, description = _a.description, translatedContent = _a.translatedContent;
37
+ var data = {
38
+ name: name,
39
+ description: description,
40
+ translated_content: translatedContent,
41
+ };
42
+ return this.client.put({
43
+ url: "/".concat(this.baseUrl, "/").concat(id),
44
+ data: data,
45
+ });
46
+ };
47
+ Collection.prototype.delete = function (_a) {
48
+ var id = _a.id;
49
+ return this.client.delete({
50
+ url: "/".concat(this.baseUrl, "/").concat(id),
51
+ });
52
+ };
53
+ Collection.prototype.list = function (_a) {
54
+ var page = _a.page, per_page = _a.perPage;
55
+ var params = {
56
+ page: page,
57
+ per_page: per_page,
58
+ };
59
+ return this.client.get({
60
+ url: "/".concat(this.baseUrl),
61
+ params: params,
62
+ });
63
+ };
64
+ return Collection;
65
+ }());
66
+ var Section = /** @class */ (function () {
67
+ function Section(client) {
68
+ this.client = client;
69
+ this.baseUrl = 'help_center/sections';
70
+ this.client = client;
71
+ }
72
+ Section.prototype.create = function (_a) {
73
+ var name = _a.name, parentId = _a.parentId, translatedContent = _a.translatedContent;
74
+ var data = {
75
+ name: name,
76
+ parent_id: parentId,
77
+ translated_content: translatedContent,
78
+ };
79
+ return this.client.post({
80
+ url: "/".concat(this.baseUrl),
81
+ data: data,
82
+ });
83
+ };
84
+ Section.prototype.find = function (_a) {
85
+ var id = _a.id;
86
+ return this.client.get({
87
+ url: "/".concat(this.baseUrl, "/").concat(id),
88
+ });
89
+ };
90
+ Section.prototype.update = function (_a) {
91
+ var id = _a.id, name = _a.name, parentId = _a.parentId, translatedContent = _a.translatedContent;
92
+ var data = {
93
+ name: name,
94
+ parent_id: parentId,
95
+ translated_content: translatedContent,
96
+ };
97
+ return this.client.put({
98
+ url: "/".concat(this.baseUrl, "/").concat(id),
99
+ data: data,
100
+ });
101
+ };
102
+ Section.prototype.delete = function (_a) {
103
+ var id = _a.id;
104
+ return this.client.delete({
105
+ url: "/".concat(this.baseUrl, "/").concat(id),
106
+ });
107
+ };
108
+ Section.prototype.list = function (_a) {
109
+ var page = _a.page, per_page = _a.perPage;
110
+ var params = {
111
+ page: page,
112
+ per_page: per_page,
113
+ };
114
+ return this.client.get({
115
+ url: "/".concat(this.baseUrl),
116
+ params: params,
117
+ });
118
+ };
119
+ return Section;
120
+ }());
121
+ //# sourceMappingURL=helpCenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpCenter.js","sourceRoot":"","sources":["../../lib/helpCenter.ts"],"names":[],"mappings":";;AAQA;IAII,oBAAY,MAAc;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI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E,iBAAiB,uBAAA;QAC1C,IAAM,IAAI,GAAG;YACT,IAAI,MAAA;YACJ,SAAS,EAAE,QAAQ;YACnB,kBAAkB,EAAE,iBAAiB;SACxC,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB;YAClC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,cAAI,EAAE,CAAE;YAC7B,IAAI,MAAA;SACP,CAAC,CAAC;IACP,CAAC;IACD,wBAAM,GAAN,UAAO,EAA6B;YAA3B,EAAE,QAAA;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAA4B;YACjD,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,cAAI,EAAE,CAAE;SAChC,CAAC,CAAC;IACP,CAAC;IACD,sBAAI,GAAJ,UAAK,EAA4C;YAA1C,IAAI,UAAA,EAAW,QAAQ,aAAA;QAC1B,IAAM,MAAM,GAAG;YACX,IAAI,MAAA;YACJ,QAAQ,UAAA;SACX,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsB;YACxC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE;YACvB,MAAM,QAAA;SACT,CAAC,CAAC;IACP,CAAC;IACL,cAAC;AAAD,CAAC,AApDD,IAoDC"}
@@ -0,0 +1,25 @@
1
+ export declare class IdentityVerification {
2
+ static userHash({ secretKey, identifier, }: {
3
+ secretKey?: string;
4
+ identifier?: string;
5
+ }): string;
6
+ }
7
+ export { default as Client } from './client';
8
+ export * from './admin/admin.types';
9
+ export * from './article/article.types';
10
+ export * from './common/common.types';
11
+ export * from './company/company.types';
12
+ export * from './contact/contact.types';
13
+ export * from './conversation/conversation.types';
14
+ export * from './dataAttribute/dataAttribute.types';
15
+ export * from './event/event.types';
16
+ export * from './helpCenter/helpCenter.types';
17
+ export * from './message/message.types';
18
+ export * from './segment/segment.types';
19
+ export * from './subscription/subscription.types';
20
+ export * from './tag/tag.types';
21
+ export * from './team/team.types';
22
+ export { SearchContactOrderBy } from './contact';
23
+ export { ReplyToConversationMessageType, ReplyToConversationUserType, AssignToConversationMessageType, AssignToConversationUserType, SnoozeConversationMessageType, CloseConversationMessageType, CloseConversationType, OpenConversationMessageType, SearchConversationOrderBy, SortBy, RedactConversationPartType, } from './conversation';
24
+ export { RecepientType } from './message';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAC7B,MAAM,CAAC,QAAQ,CAAC,EACZ,SAAS,EACT,UAAU,GACb,EAAE;QACC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB;CAYJ;AAED,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAG7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACH,8BAA8B,EAC9B,2BAA2B,EAC3B,+BAA+B,EAC/B,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,EACN,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,76 +1,59 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Client", {
7
- enumerable: true,
8
- get: function get() {
9
- return _client["default"];
10
- }
11
- });
12
- Object.defineProperty(exports, "User", {
13
- enumerable: true,
14
- get: function get() {
15
- return _user["default"];
16
- }
17
- });
18
- Object.defineProperty(exports, "Snippet", {
19
- enumerable: true,
20
- get: function get() {
21
- return _snippet["default"];
22
- }
23
- });
24
- Object.defineProperty(exports, "UserData", {
25
- enumerable: true,
26
- get: function get() {
27
- return _userData["default"];
28
- }
29
- });
30
- exports.IdentityVerification = void 0;
31
-
32
- var _client = _interopRequireDefault(require("./client"));
33
-
34
- var _user = _interopRequireDefault(require("./user"));
35
-
36
- var _snippet = _interopRequireDefault(require("./snippet"));
37
-
38
- var _userData = _interopRequireDefault(require("./user-data"));
39
-
40
- var _crypto = _interopRequireDefault(require("crypto"));
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 IdentityVerification = /*#__PURE__*/function () {
51
- function IdentityVerification() {
52
- _classCallCheck(this, IdentityVerification);
53
- }
54
-
55
- _createClass(IdentityVerification, null, [{
56
- key: "userHash",
57
- value: function userHash(params) {
58
- var secretKey = params.secretKey;
59
- var identifier = params.identifier;
60
-
61
- if (!secretKey) {
62
- throw new Error('secretKey must be provided');
63
- }
64
-
65
- if (!identifier) {
66
- throw new Error('identifier must be provided');
67
- }
68
-
69
- return _crypto["default"].createHmac('sha256', secretKey).update(identifier).digest('hex');
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecepientType = exports.RedactConversationPartType = exports.SortBy = exports.SearchConversationOrderBy = exports.OpenConversationMessageType = exports.CloseConversationType = exports.CloseConversationMessageType = exports.SnoozeConversationMessageType = exports.AssignToConversationUserType = exports.AssignToConversationMessageType = exports.ReplyToConversationUserType = exports.ReplyToConversationMessageType = exports.SearchContactOrderBy = exports.Client = exports.IdentityVerification = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var crypto_1 = (0, tslib_1.__importDefault)(require("crypto"));
6
+ var IdentityVerification = /** @class */ (function () {
7
+ function IdentityVerification() {
70
8
  }
71
- }]);
72
-
73
- return IdentityVerification;
74
- }();
75
-
76
- exports.IdentityVerification = IdentityVerification;
9
+ IdentityVerification.userHash = function (_a) {
10
+ var secretKey = _a.secretKey, identifier = _a.identifier;
11
+ if (!secretKey) {
12
+ throw new Error('secretKey must be provided');
13
+ }
14
+ if (!identifier) {
15
+ throw new Error('identifier must be provided');
16
+ }
17
+ return crypto_1.default
18
+ .createHmac('sha256', secretKey)
19
+ .update(identifier)
20
+ .digest('hex');
21
+ };
22
+ return IdentityVerification;
23
+ }());
24
+ exports.IdentityVerification = IdentityVerification;
25
+ var client_1 = require("./client");
26
+ Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(client_1).default; } });
27
+ // Export model types
28
+ (0, tslib_1.__exportStar)(require("./admin/admin.types"), exports);
29
+ (0, tslib_1.__exportStar)(require("./article/article.types"), exports);
30
+ (0, tslib_1.__exportStar)(require("./common/common.types"), exports);
31
+ (0, tslib_1.__exportStar)(require("./company/company.types"), exports);
32
+ (0, tslib_1.__exportStar)(require("./contact/contact.types"), exports);
33
+ (0, tslib_1.__exportStar)(require("./conversation/conversation.types"), exports);
34
+ (0, tslib_1.__exportStar)(require("./dataAttribute/dataAttribute.types"), exports);
35
+ (0, tslib_1.__exportStar)(require("./event/event.types"), exports);
36
+ (0, tslib_1.__exportStar)(require("./helpCenter/helpCenter.types"), exports);
37
+ (0, tslib_1.__exportStar)(require("./message/message.types"), exports);
38
+ (0, tslib_1.__exportStar)(require("./segment/segment.types"), exports);
39
+ (0, tslib_1.__exportStar)(require("./subscription/subscription.types"), exports);
40
+ (0, tslib_1.__exportStar)(require("./tag/tag.types"), exports);
41
+ (0, tslib_1.__exportStar)(require("./team/team.types"), exports);
42
+ // Export enums needed for requests
43
+ var contact_1 = require("./contact");
44
+ Object.defineProperty(exports, "SearchContactOrderBy", { enumerable: true, get: function () { return contact_1.SearchContactOrderBy; } });
45
+ var conversation_1 = require("./conversation");
46
+ Object.defineProperty(exports, "ReplyToConversationMessageType", { enumerable: true, get: function () { return conversation_1.ReplyToConversationMessageType; } });
47
+ Object.defineProperty(exports, "ReplyToConversationUserType", { enumerable: true, get: function () { return conversation_1.ReplyToConversationUserType; } });
48
+ Object.defineProperty(exports, "AssignToConversationMessageType", { enumerable: true, get: function () { return conversation_1.AssignToConversationMessageType; } });
49
+ Object.defineProperty(exports, "AssignToConversationUserType", { enumerable: true, get: function () { return conversation_1.AssignToConversationUserType; } });
50
+ Object.defineProperty(exports, "SnoozeConversationMessageType", { enumerable: true, get: function () { return conversation_1.SnoozeConversationMessageType; } });
51
+ Object.defineProperty(exports, "CloseConversationMessageType", { enumerable: true, get: function () { return conversation_1.CloseConversationMessageType; } });
52
+ Object.defineProperty(exports, "CloseConversationType", { enumerable: true, get: function () { return conversation_1.CloseConversationType; } });
53
+ Object.defineProperty(exports, "OpenConversationMessageType", { enumerable: true, get: function () { return conversation_1.OpenConversationMessageType; } });
54
+ Object.defineProperty(exports, "SearchConversationOrderBy", { enumerable: true, get: function () { return conversation_1.SearchConversationOrderBy; } });
55
+ Object.defineProperty(exports, "SortBy", { enumerable: true, get: function () { return conversation_1.SortBy; } });
56
+ Object.defineProperty(exports, "RedactConversationPartType", { enumerable: true, get: function () { return conversation_1.RedactConversationPartType; } });
57
+ var message_1 = require("./message");
58
+ Object.defineProperty(exports, "RecepientType", { enumerable: true, get: function () { return message_1.RecepientType; } });
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,+DAA4B;AAE5B;IAAA;IAmBA,CAAC;IAlBU,6BAAQ,GAAf,UAAgB,EAMf;YALG,SAAS,eAAA,EACT,UAAU,gBAAA;QAKV,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SACjD;QACD,IAAI,CAAC,UAAU,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAClD;QACD,OAAO,gBAAM;aACR,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;aAC/B,MAAM,CAAC,UAAU,CAAC;aAClB,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACL,2BAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,oDAAoB;AAqBjC,mCAA6C;AAApC,8HAAA,OAAO,OAAU;AAE1B,qBAAqB;AACrB,mEAAoC;AACpC,uEAAwC;AACxC,qEAAsC;AACtC,uEAAwC;AACxC,uEAAwC;AACxC,iFAAkD;AAClD,mFAAoD;AACpD,mEAAoC;AACpC,6EAA8C;AAC9C,uEAAwC;AACxC,uEAAwC;AACxC,iFAAkD;AAClD,+DAAgC;AAChC,iEAAkC;AAElC,mCAAmC;AACnC,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA;AAC7B,+CAYwB;AAXpB,8HAAA,8BAA8B,OAAA;AAC9B,2HAAA,2BAA2B,OAAA;AAC3B,+HAAA,+BAA+B,OAAA;AAC/B,4HAAA,4BAA4B,OAAA;AAC5B,6HAAA,6BAA6B,OAAA;AAC7B,4HAAA,4BAA4B,OAAA;AAC5B,qHAAA,qBAAqB,OAAA;AACrB,2HAAA,2BAA2B,OAAA;AAC3B,yHAAA,yBAAyB,OAAA;AACzB,sGAAA,MAAM,OAAA;AACN,0HAAA,0BAA0B,OAAA;AAE9B,qCAA0C;AAAjC,wGAAA,aAAa,OAAA"}
@@ -0,0 +1,17 @@
1
+ import { Timestamp } from '../common/common.types';
2
+ export interface MessageObject {
3
+ type: string;
4
+ id: string;
5
+ created_at: Timestamp;
6
+ subject?: string;
7
+ body: string;
8
+ message_type: MessageType;
9
+ conversation_id?: string;
10
+ }
11
+ export declare enum MessageType {
12
+ EMAIL = "email",
13
+ INAPP = "inapp",
14
+ FACEBOOK = "facebook",
15
+ TWITTER = "twitter"
16
+ }
17
+ //# sourceMappingURL=message.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.types.d.ts","sourceRoot":"","sources":["../../../lib/message/message.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oBAAY,WAAW;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,OAAO,YAAY;CACtB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageType = void 0;
4
+ var MessageType;
5
+ (function (MessageType) {
6
+ MessageType["EMAIL"] = "email";
7
+ MessageType["INAPP"] = "inapp";
8
+ MessageType["FACEBOOK"] = "facebook";
9
+ MessageType["TWITTER"] = "twitter";
10
+ })(MessageType = exports.MessageType || (exports.MessageType = {}));
11
+ //# sourceMappingURL=message.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.types.js","sourceRoot":"","sources":["../../../lib/message/message.types.ts"],"names":[],"mappings":";;;AAYA,IAAY,WAKX;AALD,WAAY,WAAW;IACnB,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;AACvB,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB"}
@@ -0,0 +1,30 @@
1
+ import { Client } from '.';
2
+ import { MessageObject, MessageType } from './message/message.types';
3
+ export default class Message {
4
+ private readonly client;
5
+ private messagesBaseUrl;
6
+ constructor(client: Client);
7
+ create({ messageType: message_type, subject, body, template, from, to, }: CreateMessageBody): Promise<MessageObject>;
8
+ }
9
+ interface CreateMessageRequest {
10
+ message_type: MessageType;
11
+ body: string;
12
+ from: Recepient;
13
+ to: Recepient;
14
+ subject?: string;
15
+ template?: string;
16
+ }
17
+ interface CreateMessageBody extends Omit<CreateMessageRequest, 'message_type'> {
18
+ messageType: MessageType;
19
+ }
20
+ declare type Recepient = {
21
+ id: string;
22
+ type: RecepientType;
23
+ };
24
+ export declare enum RecepientType {
25
+ ADMIN = "admin",
26
+ USER = "user",
27
+ LEAD = "lead"
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../lib/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,OAAO,OAAO,OAAO;IAGZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,eAAe,CAAc;gBAER,MAAM,EAAE,MAAM;IAI3C,MAAM,CAAC,EACH,WAAW,EAAE,YAAY,EACzB,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,EAAE,GACL,EAAE,iBAAiB;CAevB;AAED,UAAU,oBAAoB;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,SAAS,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,iBAAkB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,cAAc,CAAC;IAC1E,WAAW,EAAE,WAAW,CAAC;CAC5B;AAED,aAAK,SAAS,GAAG;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,oBAAY,aAAa;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;CAChB"}
package/dist/message.js CHANGED
@@ -1,31 +1,34 @@
1
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 Message = /*#__PURE__*/function () {
15
- function Message(client) {
16
- _classCallCheck(this, Message);
17
-
18
- this.client = client;
19
- }
20
-
21
- _createClass(Message, [{
22
- key: "create",
23
- value: function create(data, f) {
24
- return this.client.post('/messages', data, f);
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecepientType = void 0;
4
+ var Message = /** @class */ (function () {
5
+ function Message(client) {
6
+ this.client = client;
7
+ this.messagesBaseUrl = 'messages';
8
+ this.client = client;
25
9
  }
26
- }]);
27
-
28
- return Message;
29
- }();
30
-
31
- exports["default"] = Message;
10
+ Message.prototype.create = function (_a) {
11
+ var message_type = _a.messageType, subject = _a.subject, body = _a.body, template = _a.template, from = _a.from, to = _a.to;
12
+ var data = {
13
+ message_type: message_type,
14
+ subject: subject,
15
+ body: body,
16
+ template: template,
17
+ from: from,
18
+ to: to,
19
+ };
20
+ return this.client.post({
21
+ url: "/".concat(this.messagesBaseUrl),
22
+ data: data,
23
+ });
24
+ };
25
+ return Message;
26
+ }());
27
+ exports.default = Message;
28
+ var RecepientType;
29
+ (function (RecepientType) {
30
+ RecepientType["ADMIN"] = "admin";
31
+ RecepientType["USER"] = "user";
32
+ RecepientType["LEAD"] = "lead";
33
+ })(RecepientType = exports.RecepientType || (exports.RecepientType = {}));
34
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../lib/message.ts"],"names":[],"mappings":";;;AAGA;IAGI,iBAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAFnC,oBAAe,GAAG,UAAU,CAAC;QAGjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,wBAAM,GAAN,UAAO,EAOa;YANH,YAAY,iBAAA,EACzB,OAAO,aAAA,EACP,IAAI,UAAA,EACJ,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,EAAE,QAAA;QAEF,IAAM,IAAI,GAAyB;YAC/B,YAAY,cAAA;YACZ,OAAO,SAAA;YACP,IAAI,MAAA;YACJ,QAAQ,UAAA;YACR,IAAI,MAAA;YACJ,EAAE,IAAA;SACL,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAgB;YACnC,GAAG,EAAE,WAAI,IAAI,CAAC,eAAe,CAAE;YAC/B,IAAI,MAAA;SACP,CAAC,CAAC;IACP,CAAC;IACL,cAAC;AAAD,CAAC,AA7BD,IA6BC;;AAoBD,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,8BAAa,CAAA;AACjB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"}