crisp-api 9.13.0 → 10.0.3

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 (116) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -2
  3. package/dist/crisp.d.ts +179 -0
  4. package/dist/crisp.js +773 -0
  5. package/dist/resources/BaseResource.d.ts +21 -0
  6. package/dist/resources/BaseResource.js +26 -0
  7. package/dist/resources/BucketURL.d.ts +37 -0
  8. package/dist/resources/BucketURL.js +35 -0
  9. package/dist/resources/MediaAnimation.d.ts +20 -0
  10. package/dist/resources/MediaAnimation.js +40 -0
  11. package/dist/resources/PluginConnect.d.ts +59 -0
  12. package/dist/resources/PluginConnect.js +79 -0
  13. package/dist/resources/PluginSubscription.d.ts +112 -0
  14. package/dist/resources/PluginSubscription.js +130 -0
  15. package/dist/resources/WebsiteAnalytics.d.ts +20 -0
  16. package/dist/resources/WebsiteAnalytics.js +37 -0
  17. package/dist/resources/WebsiteAvailability.d.ts +40 -0
  18. package/dist/resources/WebsiteAvailability.js +46 -0
  19. package/dist/resources/WebsiteBase.d.ts +69 -0
  20. package/dist/resources/WebsiteBase.js +77 -0
  21. package/dist/resources/WebsiteBatch.d.ts +61 -0
  22. package/dist/resources/WebsiteBatch.js +76 -0
  23. package/dist/resources/WebsiteCampaign.d.ts +208 -0
  24. package/dist/resources/WebsiteCampaign.js +201 -0
  25. package/dist/resources/WebsiteConversation.d.ts +710 -0
  26. package/dist/resources/WebsiteConversation.js +607 -0
  27. package/dist/resources/WebsiteHelpdesk.d.ts +356 -0
  28. package/dist/resources/WebsiteHelpdesk.js +593 -0
  29. package/dist/resources/WebsiteOperator.d.ts +88 -0
  30. package/dist/resources/WebsiteOperator.js +99 -0
  31. package/dist/resources/WebsitePeople.d.ts +257 -0
  32. package/dist/resources/WebsitePeople.js +282 -0
  33. package/dist/resources/WebsiteSettings.d.ts +168 -0
  34. package/dist/resources/WebsiteSettings.js +42 -0
  35. package/dist/resources/WebsiteVerify.d.ts +47 -0
  36. package/dist/resources/WebsiteVerify.js +56 -0
  37. package/dist/resources/WebsiteVisitors.d.ts +122 -0
  38. package/dist/resources/WebsiteVisitors.js +98 -0
  39. package/dist/resources/index.d.ts +20 -0
  40. package/dist/resources/index.js +42 -0
  41. package/dist/services/bucket.d.ts +19 -0
  42. package/dist/services/bucket.js +31 -0
  43. package/dist/services/media.d.ts +19 -0
  44. package/dist/services/media.js +31 -0
  45. package/dist/services/plugin.d.ts +20 -0
  46. package/dist/services/plugin.js +33 -0
  47. package/dist/services/website.d.ts +30 -0
  48. package/dist/services/website.js +53 -0
  49. package/eslint.config.mjs +208 -0
  50. package/lib/crisp.ts +1006 -0
  51. package/lib/resources/BaseResource.ts +37 -0
  52. package/lib/resources/BucketURL.ts +58 -0
  53. package/lib/resources/MediaAnimation.ts +44 -0
  54. package/lib/resources/PluginConnect.ts +135 -0
  55. package/lib/resources/PluginSubscription.ts +236 -0
  56. package/lib/resources/WebsiteAnalytics.ts +41 -0
  57. package/lib/resources/WebsiteAvailability.ts +74 -0
  58. package/lib/resources/WebsiteBase.ts +119 -0
  59. package/lib/resources/WebsiteBatch.ts +116 -0
  60. package/lib/resources/WebsiteCampaign.ts +432 -0
  61. package/lib/resources/WebsiteConversation.ts +1507 -0
  62. package/lib/resources/WebsiteHelpdesk.ts +1024 -0
  63. package/lib/resources/WebsiteOperator.ts +183 -0
  64. package/lib/resources/WebsitePeople.ts +568 -0
  65. package/lib/resources/WebsiteSettings.ts +207 -0
  66. package/lib/resources/WebsiteVerify.ts +90 -0
  67. package/lib/resources/WebsiteVisitors.ts +219 -0
  68. package/lib/resources/index.ts +28 -0
  69. package/lib/services/bucket.ts +36 -0
  70. package/lib/services/media.ts +36 -0
  71. package/lib/services/plugin.ts +40 -0
  72. package/lib/services/website.ts +70 -0
  73. package/package.json +16 -11
  74. package/tsconfig.json +12 -5
  75. package/lib/crisp.js +0 -1171
  76. package/lib/resources/BucketURL.js +0 -34
  77. package/lib/resources/MediaAnimation.js +0 -41
  78. package/lib/resources/PluginConnect.js +0 -119
  79. package/lib/resources/PluginSubscription.js +0 -234
  80. package/lib/resources/WebsiteAnalytics.js +0 -37
  81. package/lib/resources/WebsiteAvailability.js +0 -48
  82. package/lib/resources/WebsiteBase.js +0 -100
  83. package/lib/resources/WebsiteBatch.js +0 -92
  84. package/lib/resources/WebsiteCampaign.js +0 -396
  85. package/lib/resources/WebsiteConversation.js +0 -1261
  86. package/lib/resources/WebsiteHelpdesk.js +0 -1198
  87. package/lib/resources/WebsiteOperator.js +0 -167
  88. package/lib/resources/WebsitePeople.js +0 -516
  89. package/lib/resources/WebsiteSettings.js +0 -50
  90. package/lib/resources/WebsiteVerify.js +0 -79
  91. package/lib/resources/WebsiteVisitors.js +0 -148
  92. package/lib/services/Bucket.js +0 -28
  93. package/lib/services/Media.js +0 -28
  94. package/lib/services/Plugin.js +0 -29
  95. package/lib/services/Website.js +0 -39
  96. package/types/crisp.d.ts +0 -151
  97. package/types/resources/BucketURL.d.ts +0 -15
  98. package/types/resources/MediaAnimation.d.ts +0 -15
  99. package/types/resources/PluginConnect.d.ts +0 -15
  100. package/types/resources/PluginSubscription.d.ts +0 -15
  101. package/types/resources/WebsiteAnalytics.d.ts +0 -15
  102. package/types/resources/WebsiteAvailability.d.ts +0 -15
  103. package/types/resources/WebsiteBase.d.ts +0 -15
  104. package/types/resources/WebsiteBatch.d.ts +0 -15
  105. package/types/resources/WebsiteCampaign.d.ts +0 -15
  106. package/types/resources/WebsiteConversation.d.ts +0 -15
  107. package/types/resources/WebsiteHelpdesk.d.ts +0 -15
  108. package/types/resources/WebsiteOperator.d.ts +0 -15
  109. package/types/resources/WebsitePeople.d.ts +0 -15
  110. package/types/resources/WebsiteSettings.d.ts +0 -15
  111. package/types/resources/WebsiteVerify.d.ts +0 -15
  112. package/types/resources/WebsiteVisitors.d.ts +0 -15
  113. package/types/services/Bucket.d.ts +0 -14
  114. package/types/services/Media.d.ts +0 -14
  115. package/types/services/Plugin.d.ts +0 -14
  116. package/types/services/Website.d.ts +0 -14
@@ -0,0 +1,21 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import Crisp from "../crisp";
5
+ /**************************************************************************
6
+ * CLASSES
7
+ ***************************************************************************/
8
+ /**
9
+ * Crisp Base Resource
10
+ */
11
+ declare class BaseResource {
12
+ protected crisp: Crisp;
13
+ /**
14
+ * Constructor
15
+ */
16
+ constructor(crisp: Crisp);
17
+ }
18
+ /**************************************************************************
19
+ * EXPORTS
20
+ ***************************************************************************/
21
+ export default BaseResource;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ /**************************************************************************
10
+ * CLASSES
11
+ ***************************************************************************/
12
+ /**
13
+ * Crisp Base Resource
14
+ */
15
+ class BaseResource {
16
+ /**
17
+ * Constructor
18
+ */
19
+ constructor(crisp) {
20
+ this.crisp = crisp;
21
+ }
22
+ }
23
+ /**************************************************************************
24
+ * EXPORTS
25
+ ***************************************************************************/
26
+ exports.default = BaseResource;
@@ -0,0 +1,37 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * TYPES
7
+ ***************************************************************************/
8
+ export type BucketURLRequestFile = {
9
+ name?: string;
10
+ type?: string;
11
+ };
12
+ export type BucketURLRequestResource = {
13
+ type?: string;
14
+ id?: string;
15
+ };
16
+ export type BucketURLRequest = {
17
+ namespace?: string;
18
+ id?: string;
19
+ file?: BucketURLRequestFile;
20
+ resource?: BucketURLRequestResource;
21
+ };
22
+ /**************************************************************************
23
+ * CLASSES
24
+ ***************************************************************************/
25
+ /**
26
+ * Crisp BucketURL Resource
27
+ */
28
+ declare class BucketURL extends BaseResource {
29
+ /**
30
+ * Generate Bucket URL
31
+ */
32
+ generateBucketURL(data: BucketURLRequest): Promise<any>;
33
+ }
34
+ /**************************************************************************
35
+ * EXPORTS
36
+ ***************************************************************************/
37
+ export default BucketURL;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp BucketURL Resource
22
+ */
23
+ class BucketURL extends BaseResource_1.default {
24
+ /**
25
+ * Generate Bucket URL
26
+ */
27
+ generateBucketURL(data) {
28
+ return this.crisp.post(this.crisp.prepareRestUrl(["bucket", "url", "generate"]), null, data);
29
+ }
30
+ ;
31
+ }
32
+ /**************************************************************************
33
+ * EXPORTS
34
+ ***************************************************************************/
35
+ exports.default = BucketURL;
@@ -0,0 +1,20 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * CLASSES
7
+ ***************************************************************************/
8
+ /**
9
+ * Crisp MediaAnimation Resource
10
+ */
11
+ declare class MediaAnimation extends BaseResource {
12
+ /**
13
+ * List Animation Medias
14
+ */
15
+ listAnimationMedias(pageNumber: number, listID: string, searchQuery: object): Promise<any>;
16
+ }
17
+ /**************************************************************************
18
+ * EXPORTS
19
+ ***************************************************************************/
20
+ export default MediaAnimation;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Valerian Saliou <valerian@valeriansaliou.name>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp MediaAnimation Resource
22
+ */
23
+ class MediaAnimation extends BaseResource_1.default {
24
+ /**
25
+ * List Animation Medias
26
+ */
27
+ listAnimationMedias(pageNumber, listID, searchQuery) {
28
+ return this.crisp.get(this.crisp.prepareRestUrl([
29
+ "media", "animation", "list", String(pageNumber)
30
+ ]), {
31
+ list_id: listID,
32
+ search_query: searchQuery
33
+ });
34
+ }
35
+ ;
36
+ }
37
+ /**************************************************************************
38
+ * EXPORTS
39
+ ***************************************************************************/
40
+ exports.default = MediaAnimation;
@@ -0,0 +1,59 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * TYPES
7
+ ***************************************************************************/
8
+ export type PluginConnectAccount = {
9
+ plugin_id?: string;
10
+ };
11
+ export type PluginConnectAllWebsites = {
12
+ website_id?: string;
13
+ token?: string;
14
+ settings?: object;
15
+ };
16
+ export type PluginConnectWebsitesSince = {
17
+ website_id?: string;
18
+ token?: string;
19
+ settings?: object;
20
+ difference?: string;
21
+ };
22
+ export type PluginConnectEndpoints = {
23
+ socket?: PluginConnectEndpointsSocket;
24
+ };
25
+ export type PluginConnectEndpointsSocket = {
26
+ app?: string;
27
+ };
28
+ /**************************************************************************
29
+ * CLASSES
30
+ ***************************************************************************/
31
+ /**
32
+ * Crisp PluginConnect Resource
33
+ */
34
+ declare class PluginConnect extends BaseResource {
35
+ /**
36
+ * Get Connect Account
37
+ */
38
+ getConnectAccount(): Promise<PluginConnectAccount>;
39
+ /**
40
+ * Check Connect Session Validity
41
+ */
42
+ checkConnectSessionValidity(): Promise<any>;
43
+ /**
44
+ * List All Connect Websites
45
+ */
46
+ listAllConnectWebsites(pageNumber: number, filterConfigured: boolean): Promise<PluginConnectAllWebsites>;
47
+ /**
48
+ * List Connect Websites Since
49
+ */
50
+ listConnectWebsitesSince(dateSince: string, filterConfigured: boolean): Promise<PluginConnectWebsitesSince>;
51
+ /**
52
+ * Get Connect Endpoints
53
+ */
54
+ getConnectEndpoints(): Promise<PluginConnectEndpoints>;
55
+ }
56
+ /**************************************************************************
57
+ * EXPORTS
58
+ ***************************************************************************/
59
+ export default PluginConnect;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp PluginConnect Resource
22
+ */
23
+ class PluginConnect extends BaseResource_1.default {
24
+ /**
25
+ * Get Connect Account
26
+ */
27
+ getConnectAccount() {
28
+ return this.crisp.get(this.crisp.prepareRestUrl(["plugin", "connect", "account"]), {});
29
+ }
30
+ ;
31
+ /**
32
+ * Check Connect Session Validity
33
+ */
34
+ checkConnectSessionValidity() {
35
+ return this.crisp.head(this.crisp.prepareRestUrl(["plugin", "connect", "session"]), {});
36
+ }
37
+ ;
38
+ /**
39
+ * List All Connect Websites
40
+ */
41
+ listAllConnectWebsites(pageNumber, filterConfigured) {
42
+ // Generate query
43
+ let query = {
44
+ filter_configured: ((filterConfigured === true) ? "1" : "0")
45
+ };
46
+ return this.crisp.get(this.crisp.prepareRestUrl([
47
+ "plugin", "connect", "websites", "all", String(pageNumber)
48
+ ]), query);
49
+ }
50
+ ;
51
+ /**
52
+ * List Connect Websites Since
53
+ */
54
+ listConnectWebsitesSince(dateSince, filterConfigured) {
55
+ // Generate query
56
+ let query = {
57
+ filter_configured: ((filterConfigured === true) ? "1" : "0")
58
+ };
59
+ if (dateSince) {
60
+ // @ts-ignore
61
+ query.date_since = dateSince;
62
+ }
63
+ return this.crisp.get(this.crisp.prepareRestUrl([
64
+ "plugin", "connect", "websites", "since"
65
+ ]), query);
66
+ }
67
+ ;
68
+ /**
69
+ * Get Connect Endpoints
70
+ */
71
+ getConnectEndpoints() {
72
+ return this.crisp.get(this.crisp.prepareRestUrl(["plugin", "connect", "endpoints"]), {});
73
+ }
74
+ ;
75
+ }
76
+ /**************************************************************************
77
+ * EXPORTS
78
+ ***************************************************************************/
79
+ exports.default = PluginConnect;
@@ -0,0 +1,112 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * TYPES
7
+ ***************************************************************************/
8
+ type PluginSubscription = {
9
+ id?: string;
10
+ urn?: string;
11
+ type?: string;
12
+ category?: string;
13
+ name?: string;
14
+ summary?: string;
15
+ price?: number;
16
+ plans?: PluginSubscriptionPlan[];
17
+ icon?: string;
18
+ website_url?: string;
19
+ contact_url?: string;
20
+ terms_url?: string;
21
+ privacy_url?: string;
22
+ help_url?: string;
23
+ video_url?: string;
24
+ configurable?: boolean;
25
+ since?: string;
26
+ active?: boolean;
27
+ website_id?: string;
28
+ card_id?: string;
29
+ };
30
+ type PluginSubscriptionPlan = {
31
+ id?: string;
32
+ name?: string;
33
+ price?: number;
34
+ };
35
+ type PluginSubscriptionSettings = {
36
+ plugin_id?: string;
37
+ website_id?: string;
38
+ token?: string;
39
+ schema?: object;
40
+ settings?: object;
41
+ settings_form_url?: string;
42
+ callback_url?: string;
43
+ };
44
+ type PluginSubscriptionChannelForward = {
45
+ namespace?: string;
46
+ identifier?: string;
47
+ payload?: object;
48
+ };
49
+ type PluginSubscriptionEventDispatch = {
50
+ name?: string;
51
+ data?: object;
52
+ };
53
+ /**************************************************************************
54
+ * CLASSES
55
+ ***************************************************************************/
56
+ /**
57
+ * Crisp PluginSubscription Resource
58
+ */
59
+ declare class PluginSubscriptionService extends BaseResource {
60
+ /**
61
+ * List All Active Subscriptions
62
+ */
63
+ listAllActiveSubscriptions(): Promise<PluginSubscription[]>;
64
+ /**
65
+ * List Subscriptions For A Website
66
+ */
67
+ listSubscriptionsForWebsite(websiteID: string): Promise<PluginSubscription[]>;
68
+ /**
69
+ * Get Subscription Details
70
+ */
71
+ getSubscriptionDetails(websiteID: string, pluginID: string): Promise<PluginSubscription>;
72
+ /**
73
+ * Subscribe Website To Plugin
74
+ */
75
+ subscribeWebsiteToPlugin(websiteID: string, pluginID: string): Promise<any>;
76
+ /**
77
+ * Unsubscribe Plugin From Website
78
+ */
79
+ unsubscribePluginFromWebsite(websiteID: string, pluginID: string): Promise<any>;
80
+ /**
81
+ * Get Subscription Settings
82
+ */
83
+ getSubscriptionSettings(websiteID: string, pluginID: string): Promise<PluginSubscriptionSettings>;
84
+ /**
85
+ * Save Subscription Settings
86
+ */
87
+ saveSubscriptionSettings(websiteID: string, pluginID: string, settings: object): Promise<any>;
88
+ /**
89
+ * Update Subscription Settings
90
+ */
91
+ updateSubscriptionSettings(websiteID: string, pluginID: string, settings: object): Promise<any>;
92
+ /**
93
+ * Get Plugin Usage Bills
94
+ */
95
+ getPluginUsageBills(websiteID: string, pluginID: string): Promise<any>;
96
+ /**
97
+ * Report Plugin Usage To Bill
98
+ */
99
+ reportPluginUsageToBill(websiteID: string, pluginID: string, usage: object): Promise<any>;
100
+ /**
101
+ * Forward Plugin Payload To Channel
102
+ */
103
+ forwardPluginPayloadToChannel(websiteID: string, pluginID: string, payload: PluginSubscriptionChannelForward): Promise<any>;
104
+ /**
105
+ * Dispatch Plugin Event
106
+ */
107
+ dispatchPluginEvent(websiteID: string, pluginID: string, payload: PluginSubscriptionEventDispatch): Promise<any>;
108
+ }
109
+ /**************************************************************************
110
+ * EXPORTS
111
+ ***************************************************************************/
112
+ export default PluginSubscriptionService;
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp PluginSubscription Resource
22
+ */
23
+ class PluginSubscriptionService extends BaseResource_1.default {
24
+ /**
25
+ * List All Active Subscriptions
26
+ */
27
+ listAllActiveSubscriptions() {
28
+ return this.crisp.get(this.crisp.prepareRestUrl(["plugins", "subscription"]));
29
+ }
30
+ ;
31
+ /**
32
+ * List Subscriptions For A Website
33
+ */
34
+ listSubscriptionsForWebsite(websiteID) {
35
+ return this.crisp.get(this.crisp.prepareRestUrl(["plugins", "subscription", websiteID]));
36
+ }
37
+ ;
38
+ /**
39
+ * Get Subscription Details
40
+ */
41
+ getSubscriptionDetails(websiteID, pluginID) {
42
+ return this.crisp.get(this.crisp.prepareRestUrl(["plugins", "subscription", websiteID, pluginID]));
43
+ }
44
+ ;
45
+ /**
46
+ * Subscribe Website To Plugin
47
+ */
48
+ subscribeWebsiteToPlugin(websiteID, pluginID) {
49
+ return this.crisp.post(this.crisp.prepareRestUrl(["plugins", "subscription", websiteID]), null, {
50
+ plugin_id: pluginID
51
+ });
52
+ }
53
+ ;
54
+ /**
55
+ * Unsubscribe Plugin From Website
56
+ */
57
+ unsubscribePluginFromWebsite(websiteID, pluginID) {
58
+ return this.crisp.delete(this.crisp.prepareRestUrl([
59
+ "plugins", "subscription", websiteID, pluginID
60
+ ]));
61
+ }
62
+ ;
63
+ /**
64
+ * Get Subscription Settings
65
+ */
66
+ getSubscriptionSettings(websiteID, pluginID) {
67
+ return this.crisp.get(this.crisp.prepareRestUrl([
68
+ "plugins", "subscription", websiteID, pluginID, "settings"
69
+ ]));
70
+ }
71
+ ;
72
+ /**
73
+ * Save Subscription Settings
74
+ */
75
+ saveSubscriptionSettings(websiteID, pluginID, settings) {
76
+ return this.crisp.put(this.crisp.prepareRestUrl([
77
+ "plugins", "subscription", websiteID, pluginID, "settings"
78
+ ]), null, settings);
79
+ }
80
+ ;
81
+ /**
82
+ * Update Subscription Settings
83
+ */
84
+ updateSubscriptionSettings(websiteID, pluginID, settings) {
85
+ return this.crisp.patch(this.crisp.prepareRestUrl([
86
+ "plugins", "subscription", websiteID, pluginID, "settings"
87
+ ]), null, settings);
88
+ }
89
+ ;
90
+ /**
91
+ * Get Plugin Usage Bills
92
+ */
93
+ getPluginUsageBills(websiteID, pluginID) {
94
+ return this.crisp.get(this.crisp.prepareRestUrl([
95
+ "plugins", "subscription", websiteID, pluginID, "bill", "usage"
96
+ ]));
97
+ }
98
+ ;
99
+ /**
100
+ * Report Plugin Usage To Bill
101
+ */
102
+ reportPluginUsageToBill(websiteID, pluginID, usage) {
103
+ return this.crisp.post(this.crisp.prepareRestUrl([
104
+ "plugins", "subscription", websiteID, pluginID, "bill", "usage"
105
+ ]), null, usage);
106
+ }
107
+ ;
108
+ /**
109
+ * Forward Plugin Payload To Channel
110
+ */
111
+ forwardPluginPayloadToChannel(websiteID, pluginID, payload) {
112
+ return this.crisp.post(this.crisp.prepareRestUrl([
113
+ "plugins", "subscription", websiteID, pluginID, "channel"
114
+ ]), null, payload);
115
+ }
116
+ ;
117
+ /**
118
+ * Dispatch Plugin Event
119
+ */
120
+ dispatchPluginEvent(websiteID, pluginID, payload) {
121
+ return this.crisp.post(this.crisp.prepareRestUrl([
122
+ "plugins", "subscription", websiteID, pluginID, "event"
123
+ ]), null, payload);
124
+ }
125
+ ;
126
+ }
127
+ /**************************************************************************
128
+ * EXPORTS
129
+ ***************************************************************************/
130
+ exports.default = PluginSubscriptionService;
@@ -0,0 +1,20 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * CLASSES
7
+ ***************************************************************************/
8
+ /**
9
+ * Crisp WebsiteAnalytics Resource
10
+ */
11
+ declare class WebsiteAnalytics extends BaseResource {
12
+ /**
13
+ * Generate Analytics
14
+ */
15
+ generateAnalytics(websiteID: string, query: object): Promise<any>;
16
+ }
17
+ /**************************************************************************
18
+ * EXPORTS
19
+ ***************************************************************************/
20
+ export default WebsiteAnalytics;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Valerian Saliou <valerian@valeriansaliou.name>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp WebsiteAnalytics Resource
22
+ */
23
+ class WebsiteAnalytics extends BaseResource_1.default {
24
+ /**
25
+ * Generate Analytics
26
+ */
27
+ generateAnalytics(websiteID, query) {
28
+ return this.crisp.post(this.crisp.prepareRestUrl([
29
+ "website", websiteID, "analytics", "generate"
30
+ ]), null, query);
31
+ }
32
+ ;
33
+ }
34
+ /**************************************************************************
35
+ * EXPORTS
36
+ ***************************************************************************/
37
+ exports.default = WebsiteAnalytics;
@@ -0,0 +1,40 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * TYPES
7
+ ***************************************************************************/
8
+ type WebsiteAvailabilityStatus = {
9
+ status?: string;
10
+ since?: number;
11
+ };
12
+ type WebsiteAvailabilityOperator = {
13
+ user_id?: string;
14
+ type?: string;
15
+ time?: WebsiteAvailabilityOperatorTime;
16
+ };
17
+ type WebsiteAvailabilityOperatorTime = {
18
+ for?: number;
19
+ since?: number;
20
+ };
21
+ /**************************************************************************
22
+ * CLASSES
23
+ ***************************************************************************/
24
+ /**
25
+ * Crisp WebsiteAvailability Resource
26
+ */
27
+ declare class WebsiteAvailability extends BaseResource {
28
+ /**
29
+ * Get Website Availability Status
30
+ */
31
+ getWebsiteAvailabilityStatus(websiteID: string): Promise<WebsiteAvailabilityStatus>;
32
+ /**
33
+ * List Website Operator Availabilities
34
+ */
35
+ listWebsiteOperatorAvailabilities(websiteID: string): Promise<WebsiteAvailabilityOperator[]>;
36
+ }
37
+ /**************************************************************************
38
+ * EXPORTS
39
+ ***************************************************************************/
40
+ export default WebsiteAvailability;