zudello-integration-sdk 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudello-integration-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
package/src/index.js CHANGED
@@ -18,6 +18,7 @@ const JobReadySDK = require('./sdk/JobReady')
18
18
  const Logger = require('./utils/logger')
19
19
  const Metadata = require('./utils/metadata')
20
20
  const Tags = require('./utils/tags')
21
+ const Trigger = require('./utils/trigger')
21
22
  const Properties = require('./utils/properties')
22
23
  const MiscHelper = require('./utils/miscHelper')
23
24
  const ModelHelper = require('./utils/modelHelper')
@@ -55,6 +56,7 @@ module.exports = {
55
56
  Logger,
56
57
  Metadata,
57
58
  Tags,
59
+ Trigger,
58
60
  Properties,
59
61
  MiscHelper,
60
62
  ModelHelper,
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+
3
+ class Trigger {
4
+ constructor(apiInstance = null, teamUUID = null) {
5
+ this.apiInstance = apiInstance
6
+ this.teamUUID = teamUUID
7
+ }
8
+
9
+ async run(uuid, data = {}) {
10
+ if (!this.apiInstance || !this.teamUUID || !uuid || !process.env.ZUDELLO_API_URL) {
11
+ return
12
+ }
13
+
14
+ return await this.apiInstance.post(`${process.env.ZUDELLO_API_URL}/trigger/run`, {
15
+ uuid,
16
+ // callback: 'SENTENCES',
17
+ payload: {
18
+ mode: 'PRODUCTION',
19
+ data
20
+ }
21
+ }, {
22
+ 'x-team': this.teamUUID
23
+ })
24
+ }
25
+ }
26
+
27
+ module.exports = Trigger