@stackfactor/client-api 1.0.31 → 1.0.33

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.
@@ -1,94 +1,100 @@
1
- import { axios } from "./axiosClient";
1
+ import axios from "./axiosClient";
2
2
 
3
- module.exports = {
4
- axios: axios,
5
-
6
- /**
7
- * Get the integration configuration
8
- * @param {Array<String>} ids
9
- * @param {Number} type
10
- * @param {String} token Authorization token
11
- */
12
- getIntegrationsConfiguration: (ids, type, token) => {
13
- return new Promise(function (resolve, reject) {
14
- let requestData = { type: type };
15
- if (ids) requestData.ids = ids;
16
- let confirmationRequest = axios.post(
17
- "api/v1/integrationsconfiguration",
18
- requestData,
19
- {
20
- headers: { authorization: token },
21
- }
22
- );
23
- confirmationRequest
24
- .then((response) => {
25
- resolve(response.data);
26
- })
27
- .catch((error) => {
28
- reject(error);
29
- });
30
- });
31
- },
3
+ /**
4
+ * Get the integration configuration
5
+ * @param {Array<String>} ids
6
+ * @param {Number} type
7
+ * @param {String} token Authorization token
8
+ */
9
+ export const getIntegrationsConfiguration = (ids, type, token) => {
10
+ return new Promise(function (resolve, reject) {
11
+ let requestData = { type: type };
12
+ if (ids) requestData.ids = ids;
13
+ let confirmationRequest = axios.post(
14
+ "api/v1/integrationsconfiguration",
15
+ requestData,
16
+ {
17
+ headers: { authorization: token },
18
+ }
19
+ );
20
+ confirmationRequest
21
+ .then((response) => {
22
+ resolve(response.data);
23
+ })
24
+ .catch((error) => {
25
+ reject(error);
26
+ });
27
+ });
28
+ };
32
29
 
33
- /**
34
- * Save integration configuration
35
- * @param {String} id The id of the integration configurationto be updated
36
- * @param {Number} type The type of configuration
37
- * @param {Object} configuration Data used to update the integration configuration
38
- * @param {String} token Authorization token
39
- */
40
- saveIntegrationConfiguration: (id, type, configuration, token) => {
41
- return new Promise(function (resolve, reject) {
42
- const requestData = {
43
- id: id,
44
- configuration: configuration,
45
- type: type,
46
- };
47
- let confirmationRequest = axios.put(
48
- `api/v1/integrationsconfiguration`,
49
- requestData,
50
- {
51
- headers: { authorization: token },
52
- }
53
- );
54
- confirmationRequest
55
- .then((response) => {
56
- resolve(response.data);
57
- })
58
- .catch((error) => {
59
- reject(error);
60
- });
61
- });
62
- },
30
+ /**
31
+ * Save integration configuration
32
+ * @param {String} id The id of the integration configurationto be updated
33
+ * @param {Number} type The type of configuration
34
+ * @param {Object} configuration Data used to update the integration configuration
35
+ * @param {String} token Authorization token
36
+ */
37
+ export const saveIntegrationConfiguration = (
38
+ id,
39
+ type,
40
+ configuration,
41
+ token
42
+ ) => {
43
+ return new Promise(function (resolve, reject) {
44
+ const requestData = {
45
+ id: id,
46
+ configuration: configuration,
47
+ type: type,
48
+ };
49
+ let confirmationRequest = axios.put(
50
+ `api/v1/integrationsconfiguration`,
51
+ requestData,
52
+ {
53
+ headers: { authorization: token },
54
+ }
55
+ );
56
+ confirmationRequest
57
+ .then((response) => {
58
+ resolve(response.data);
59
+ })
60
+ .catch((error) => {
61
+ reject(error);
62
+ });
63
+ });
64
+ };
63
65
 
64
- /**
65
- * Test integration configuration
66
- * @param {String} id The id of the integration to be updated
67
- * @param {String} type The type of configuration
68
- * @param {Object} configuration Configuration to be tested
69
- * @param {String} token Authorization token
70
- */
71
- testIntegrationConfiguration: (id, type, configuration, token) => {
72
- return new Promise(function (resolve, reject) {
73
- const requestData = {
74
- id: id,
75
- configuration: configuration,
76
- type: type,
77
- };
78
- let confirmationRequest = axios.post(
79
- `api/v1/integrationsconfiguration/testConfiguration`,
80
- requestData,
81
- {
82
- headers: { authorization: token },
83
- }
84
- );
85
- confirmationRequest
86
- .then((response) => {
87
- resolve(response.data);
88
- })
89
- .catch((error) => {
90
- reject(error);
91
- });
92
- });
93
- },
66
+ /**
67
+ * Test integration configuration
68
+ * @param {String} id The id of the integration to be updated
69
+ * @param {String} type The type of configuration
70
+ * @param {Object} configuration Configuration to be tested
71
+ * @param {String} token Authorization token
72
+ */
73
+ export const testIntegrationConfiguration = (
74
+ id,
75
+ type,
76
+ configuration,
77
+ token
78
+ ) => {
79
+ return new Promise(function (resolve, reject) {
80
+ const requestData = {
81
+ id: id,
82
+ configuration: configuration,
83
+ type: type,
84
+ };
85
+ let confirmationRequest = axios.post(
86
+ `api/v1/integrationsconfiguration/testConfiguration`,
87
+ requestData,
88
+ {
89
+ headers: { authorization: token },
90
+ }
91
+ );
92
+ confirmationRequest
93
+ .then((response) => {
94
+ resolve(response.data);
95
+ })
96
+ .catch((error) => {
97
+ reject(error);
98
+ });
99
+ });
94
100
  };
@@ -1,78 +1,75 @@
1
- const axios = require("../axiosClient");
1
+ import axios from "./axiosClient";
2
2
 
3
- module.exports = {
4
- axios: axios,
5
- /**
6
- * Generate content
7
- * @param {Array<String>} data
8
- * @param {String} contentType
9
- * @param {String} integrationId
10
- * @param {String} token
11
- * @returns {Object}
12
- */
13
- generateContent: (data, contentType, integrationId, token) => {
14
- return new Promise(function (resolve, reject) {
15
- let data_ = {
16
- data: data,
17
- contentType: contentType,
18
- };
19
- if (integrationId) data.integrationId = integrationId;
20
- const request = axios.post(`api/v1/contentgenerators/generate`, data_, {
21
- headers: { authorization: token },
22
- });
23
- request
24
- .then((response) => {
25
- resolve(response.data);
26
- })
27
- .catch((error) => {
28
- reject(error);
29
- });
3
+ /**
4
+ * Generate content
5
+ * @param {Array<String>} data
6
+ * @param {String} contentType
7
+ * @param {String} integrationId
8
+ * @param {String} token
9
+ * @returns {Object}
10
+ */
11
+ export const generateContent = (data, contentType, integrationId, token) => {
12
+ return new Promise(function (resolve, reject) {
13
+ let data_ = {
14
+ data: data,
15
+ contentType: contentType,
16
+ };
17
+ if (integrationId) data.integrationId = integrationId;
18
+ const request = axios.post(`api/v1/contentgenerators/generate`, data_, {
19
+ headers: { authorization: token },
30
20
  });
31
- },
21
+ request
22
+ .then((response) => {
23
+ resolve(response.data);
24
+ })
25
+ .catch((error) => {
26
+ reject(error);
27
+ });
28
+ });
29
+ };
32
30
 
33
- /**
34
- * Generate content aync
35
- * @param {String} id
36
- * @param {Object} data
37
- * @param {String} contentType
38
- * @param {String} elementType
39
- * @param {String} integrationId
40
- * @param {String} comments
41
- * @param {String} token
42
- * @returns {Object}
43
- */
44
- generateContentAsync: (
45
- id,
46
- data,
47
- contentType,
48
- elementType,
49
- integrationId,
50
- comments,
51
- token
52
- ) => {
53
- return new Promise(function (resolve, reject) {
54
- let data_ = {
55
- data: data,
56
- comments: comments,
57
- contentType: contentType,
58
- elementType: elementType,
59
- id: id,
60
- };
61
- if (integrationId) data_.integrationId = integrationId;
62
- const request = axios.post(
63
- `api/v1/contentgenerators/generateasync`,
64
- data_,
65
- {
66
- headers: { authorization: token },
67
- }
68
- );
69
- request
70
- .then((response) => {
71
- resolve(response.data);
72
- })
73
- .catch((error) => {
74
- reject(error);
75
- });
76
- });
77
- },
31
+ /**
32
+ * Generate content aync
33
+ * @param {String} id
34
+ * @param {Object} data
35
+ * @param {String} contentType
36
+ * @param {String} elementType
37
+ * @param {String} integrationId
38
+ * @param {String} comments
39
+ * @param {String} token
40
+ * @returns {Object}
41
+ */
42
+ export const generateContentAsync = (
43
+ id,
44
+ data,
45
+ contentType,
46
+ elementType,
47
+ integrationId,
48
+ comments,
49
+ token
50
+ ) => {
51
+ return new Promise(function (resolve, reject) {
52
+ let data_ = {
53
+ data: data,
54
+ comments: comments,
55
+ contentType: contentType,
56
+ elementType: elementType,
57
+ id: id,
58
+ };
59
+ if (integrationId) data_.integrationId = integrationId;
60
+ const request = axios.post(
61
+ `api/v1/contentgenerators/generateasync`,
62
+ data_,
63
+ {
64
+ headers: { authorization: token },
65
+ }
66
+ );
67
+ request
68
+ .then((response) => {
69
+ resolve(response.data);
70
+ })
71
+ .catch((error) => {
72
+ reject(error);
73
+ });
74
+ });
78
75
  };