@stackfactor/client-api 1.0.32 → 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,272 +1,267 @@
1
- import { axios } from "./axiosClient";
1
+ import axios from "./axiosClient";
2
2
 
3
- module.exports = {
4
- axios: axios,
5
-
6
- /**
7
- * Create skill template and set information
8
- * @param {Object} data
9
- * @param {String} token Authorization token
10
- */
11
- createSkillTemplate: (data, token) => {
12
- return new Promise(function (resolve, reject) {
13
- const requestData = {
14
- data: data,
15
- };
16
- let confirmationRequest = axios.put(
17
- "api/v1/skilltemplates",
18
- requestData,
19
- { headers: { authorization: token } }
20
- );
21
- confirmationRequest
22
- .then((response) => {
23
- resolve(response.data);
24
- })
25
- .catch((error) => {
26
- reject(error);
27
- });
3
+ /**
4
+ * Create skill template and set information
5
+ * @param {Object} data
6
+ * @param {String} token Authorization token
7
+ */
8
+ export const createSkillTemplate = (data, token) => {
9
+ return new Promise(function (resolve, reject) {
10
+ const requestData = {
11
+ data: data,
12
+ };
13
+ let confirmationRequest = axios.put("api/v1/skilltemplates", requestData, {
14
+ headers: { authorization: token },
28
15
  });
29
- },
16
+ confirmationRequest
17
+ .then((response) => {
18
+ resolve(response.data);
19
+ })
20
+ .catch((error) => {
21
+ reject(error);
22
+ });
23
+ });
24
+ };
30
25
 
31
- /**
32
- * Delete skill template
33
- * @param {number} id The id of the template to be deleted
34
- * @param {String} comment The comment included with the deletion
35
- * @param {String} token Authorization token
36
- */
37
- deleteSkillTemplate: (id, comment, token) => {
38
- const data = {
39
- id: id,
40
- };
41
- if (comment) data.comment = comment;
42
- return new Promise(function (resolve, reject) {
43
- const request = axios.delete(`api/v1/skilltemplates/`, {
44
- headers: { authorization: token },
45
- data: data,
26
+ /**
27
+ * Delete skill template
28
+ * @param {number} id The id of the template to be deleted
29
+ * @param {String} comment The comment included with the deletion
30
+ * @param {String} token Authorization token
31
+ */
32
+ export const deleteSkillTemplate = (id, comment, token) => {
33
+ const data = {
34
+ id: id,
35
+ };
36
+ if (comment) data.comment = comment;
37
+ return new Promise(function (resolve, reject) {
38
+ const request = axios.delete(`api/v1/skilltemplates/`, {
39
+ headers: { authorization: token },
40
+ data: data,
41
+ });
42
+ request
43
+ .then((response) => {
44
+ resolve(response.data);
45
+ })
46
+ .catch((error) => {
47
+ reject(error);
46
48
  });
47
- request
48
- .then((response) => {
49
- resolve(response.data);
50
- })
51
- .catch((error) => {
52
- reject(error);
53
- });
49
+ });
50
+ };
51
+
52
+ /**
53
+ * Discard the skill template draft changes
54
+ * @param {String} id The id of the skill template to be deleted
55
+ * @param {String} token Authorization token
56
+ */
57
+ export const discardSkillTemplateChanges = (id, token) => {
58
+ return new Promise(function (resolve, reject) {
59
+ const data = {};
60
+ const request = axios.get(`api/v1/skilltemplates/discard/${id}`, {
61
+ headers: { authorization: token },
62
+ data: data,
54
63
  });
55
- },
64
+ request
65
+ .then((response) => {
66
+ resolve(response.data);
67
+ })
68
+ .catch((error) => {
69
+ reject(error);
70
+ });
71
+ });
72
+ };
56
73
 
57
- /**
58
- * Discard the skill template draft changes
59
- * @param {String} id The id of the skill template to be deleted
60
- * @param {String} token Authorization token
61
- */
62
- discardSkillTemplateChanges: (id, token) => {
63
- return new Promise(function (resolve, reject) {
64
- const data = {};
65
- const request = axios.get(`api/v1/skilltemplates/discard/${id}`, {
74
+ /**
75
+ * Get skill template information
76
+ * @param {String} id The id of the template
77
+ * @param {String} version The version of the template
78
+ * @param {String} token Authorization token
79
+ */
80
+ export const getSkillTemplateInformationById = (id, version, token) => {
81
+ return new Promise(function (resolve, reject) {
82
+ let confirmationRequest = axios.get(
83
+ `api/v1/skilltemplates/${id}/${version}`,
84
+ {
66
85
  headers: { authorization: token },
67
- data: data,
86
+ }
87
+ );
88
+ confirmationRequest
89
+ .then((response) => {
90
+ resolve(response.data);
91
+ })
92
+ .catch((error) => {
93
+ reject(error);
68
94
  });
69
- request
70
- .then((response) => {
71
- resolve(response.data);
72
- })
73
- .catch((error) => {
74
- reject(error);
75
- });
76
- });
77
- },
78
-
79
- /**
80
- * Get skill template information
81
- * @param {String} id The id of the template
82
- * @param {String} version The version of the template
83
- * @param {String} token Authorization token
84
- */
85
- getSkillTemplateInformationById: (id, version, token) => {
86
- return new Promise(function (resolve, reject) {
87
- let confirmationRequest = axios.get(
88
- `api/v1/skilltemplates/${id}/${version}`,
89
- {
90
- headers: { authorization: token },
91
- }
92
- );
93
- confirmationRequest
94
- .then((response) => {
95
- resolve(response.data);
96
- })
97
- .catch((error) => {
98
- reject(error);
99
- });
100
- });
101
- },
95
+ });
96
+ };
102
97
 
103
- /**
104
- * Get skill template list
105
- * @param {Array<String>} filter The filter used to select the template
106
- * @param {String} version The version to be retrieved
107
- * @param {boolean} includeDeleted When true it will return the deleted records as well
108
- * @param {String} token Authorization token
109
- */
110
- getSkillTemplateList: (filter, version, includeDeleted, token) => {
111
- return new Promise(function (resolve, reject) {
112
- const requestData = {
113
- version: version,
114
- includeDeleted: includeDeleted,
115
- };
116
- if (filter) requestData.filter = filter;
117
- let confirmationRequest = axios.post(
118
- `api/v1/skilltemplates`,
119
- requestData,
120
- {
121
- headers: { authorization: token },
122
- }
123
- );
124
- confirmationRequest
125
- .then((response) => {
126
- resolve(response.data);
127
- })
128
- .catch((error) => {
129
- reject(error);
130
- });
98
+ /**
99
+ * Get skill template list
100
+ * @param {Array<String>} filter The filter used to select the template
101
+ * @param {String} version The version to be retrieved
102
+ * @param {boolean} includeDeleted When true it will return the deleted records as well
103
+ * @param {String} token Authorization token
104
+ */
105
+ export const getSkillTemplateList = (
106
+ filter,
107
+ version,
108
+ includeDeleted,
109
+ token
110
+ ) => {
111
+ return new Promise(function (resolve, reject) {
112
+ const requestData = {
113
+ version: version,
114
+ includeDeleted: includeDeleted,
115
+ };
116
+ if (filter) requestData.filter = filter;
117
+ let confirmationRequest = axios.post(`api/v1/skilltemplates`, requestData, {
118
+ headers: { authorization: token },
131
119
  });
132
- },
120
+ confirmationRequest
121
+ .then((response) => {
122
+ resolve(response.data);
123
+ })
124
+ .catch((error) => {
125
+ reject(error);
126
+ });
127
+ });
128
+ };
133
129
 
134
- /**
135
- * Get skill tecnology stacks template list
136
- * @param {String} token Authorization token
137
- */
138
- getTechnologyStacks: (token) => {
139
- return new Promise(function (resolve, reject) {
140
- const requestData = {};
141
- let confirmationRequest = axios.get(
142
- `api/v1/skilltemplates/stacks`,
143
- requestData,
144
- {
145
- headers: { authorization: token },
146
- }
147
- );
148
- confirmationRequest
149
- .then((response) => {
150
- resolve(response.data);
151
- })
152
- .catch((error) => {
153
- reject(error);
154
- });
155
- });
156
- },
130
+ /**
131
+ * Get skill tecnology stacks template list
132
+ * @param {String} token Authorization token
133
+ */
134
+ export const getTechnologyStacks = (token) => {
135
+ return new Promise(function (resolve, reject) {
136
+ const requestData = {};
137
+ let confirmationRequest = axios.get(
138
+ `api/v1/skilltemplates/stacks`,
139
+ requestData,
140
+ {
141
+ headers: { authorization: token },
142
+ }
143
+ );
144
+ confirmationRequest
145
+ .then((response) => {
146
+ resolve(response.data);
147
+ })
148
+ .catch((error) => {
149
+ reject(error);
150
+ });
151
+ });
152
+ };
157
153
 
158
- /**
159
- * Publish template
160
- * @param {number} id The id of the template to be published
161
- * @param {String} comment The comment to be include with the request
162
- * @param {String} token Authorization token
163
- */
164
- publishTemplate: (id, comment, token) => {
165
- return new Promise(function (resolve, reject) {
166
- let data = {};
167
- if (comment) data.comment = comment;
154
+ /**
155
+ * Publish template
156
+ * @param {number} id The id of the template to be published
157
+ * @param {String} comment The comment to be include with the request
158
+ * @param {String} token Authorization token
159
+ */
160
+ export const publishTemplate = (id, comment, token) => {
161
+ return new Promise(function (resolve, reject) {
162
+ let data = {};
163
+ if (comment) data.comment = comment;
168
164
 
169
- let confirmationRequest = axios.post(
170
- `api/v1/skilltemplates/publish/${id}`,
171
- data,
172
- {
173
- headers: { authorization: token },
174
- }
175
- );
176
- confirmationRequest
177
- .then((response) => {
178
- resolve(response.data);
179
- })
180
- .catch((error) => {
181
- reject(error);
182
- });
183
- });
184
- },
165
+ let confirmationRequest = axios.post(
166
+ `api/v1/skilltemplates/publish/${id}`,
167
+ data,
168
+ {
169
+ headers: { authorization: token },
170
+ }
171
+ );
172
+ confirmationRequest
173
+ .then((response) => {
174
+ resolve(response.data);
175
+ })
176
+ .catch((error) => {
177
+ reject(error);
178
+ });
179
+ });
180
+ };
185
181
 
186
- /**
187
- * Set template profile information
188
- * @param {String} id The id of the template to be updated
189
- * @param {Object} data Data used to update the template
190
- * @param {String} token Authorization token
191
- */
192
- setTemplateInformation: (id, data, token) => {
193
- return new Promise(function (resolve, reject) {
194
- const requestData = {
195
- data: data,
196
- id: id,
197
- };
198
- let confirmationRequest = axios.post(
199
- `api/v1/skilltemplates/update`,
200
- requestData,
201
- {
202
- headers: { authorization: token },
203
- }
204
- );
205
- confirmationRequest
206
- .then((response) => {
207
- resolve(response.data);
208
- })
209
- .catch((error) => {
210
- reject(error);
211
- });
212
- });
213
- },
182
+ /**
183
+ * Set template profile information
184
+ * @param {String} id The id of the template to be updated
185
+ * @param {Object} data Data used to update the template
186
+ * @param {String} token Authorization token
187
+ */
188
+ export const setTemplateInformation = (id, data, token) => {
189
+ return new Promise(function (resolve, reject) {
190
+ const requestData = {
191
+ data: data,
192
+ id: id,
193
+ };
194
+ let confirmationRequest = axios.post(
195
+ `api/v1/skilltemplates/update`,
196
+ requestData,
197
+ {
198
+ headers: { authorization: token },
199
+ }
200
+ );
201
+ confirmationRequest
202
+ .then((response) => {
203
+ resolve(response.data);
204
+ })
205
+ .catch((error) => {
206
+ reject(error);
207
+ });
208
+ });
209
+ };
214
210
 
215
- /**
216
- * Update the skill template tags
217
- * @param {String} id The id of the template to be updated
218
- * @param {Object} tags Updated template tags
219
- * @param {String} token Authorization token
220
- */
221
- setTemplateTags: (id, tags, token) => {
222
- return new Promise(function (resolve, reject) {
223
- const requestData = {
224
- tags: tags,
225
- id: id,
226
- };
227
- let confirmationRequest = axios.post(
228
- `api/v1/skilltemplates/updatetags/`,
229
- requestData,
230
- {
231
- headers: { authorization: token },
232
- }
233
- );
234
- confirmationRequest
235
- .then((response) => {
236
- resolve(response.data);
237
- })
238
- .catch((error) => {
239
- reject(error);
240
- });
241
- });
242
- },
211
+ /**
212
+ * Update the skill template tags
213
+ * @param {String} id The id of the template to be updated
214
+ * @param {Object} tags Updated template tags
215
+ * @param {String} token Authorization token
216
+ */
217
+ export const setTemplateTags = (id, tags, token) => {
218
+ return new Promise(function (resolve, reject) {
219
+ const requestData = {
220
+ tags: tags,
221
+ id: id,
222
+ };
223
+ let confirmationRequest = axios.post(
224
+ `api/v1/skilltemplates/updatetags/`,
225
+ requestData,
226
+ {
227
+ headers: { authorization: token },
228
+ }
229
+ );
230
+ confirmationRequest
231
+ .then((response) => {
232
+ resolve(response.data);
233
+ })
234
+ .catch((error) => {
235
+ reject(error);
236
+ });
237
+ });
238
+ };
243
239
 
244
- /**
245
- * Watch skill template
246
- * @param {String} id The id of the skill template to be updated
247
- * @param {Boolean} watch Set to true or false
248
- * @param {String} token Authorization token
249
- */
250
- watchSkillTemplate: (id, watch, token) => {
251
- return new Promise(function (resolve, reject) {
252
- const requestData = {
253
- id: id,
254
- watch: watch,
255
- };
256
- let confirmationRequest = axios.post(
257
- `api/v1/skilltemplates/watch`,
258
- requestData,
259
- {
260
- headers: { authorization: token },
261
- }
262
- );
263
- confirmationRequest
264
- .then((response) => {
265
- resolve(response.data);
266
- })
267
- .catch((error) => {
268
- reject(error);
269
- });
270
- });
271
- },
240
+ /**
241
+ * Watch skill template
242
+ * @param {String} id The id of the skill template to be updated
243
+ * @param {Boolean} watch Set to true or false
244
+ * @param {String} token Authorization token
245
+ */
246
+ export const watchSkillTemplate = (id, watch, token) => {
247
+ return new Promise(function (resolve, reject) {
248
+ const requestData = {
249
+ id: id,
250
+ watch: watch,
251
+ };
252
+ let confirmationRequest = axios.post(
253
+ `api/v1/skilltemplates/watch`,
254
+ requestData,
255
+ {
256
+ headers: { authorization: token },
257
+ }
258
+ );
259
+ confirmationRequest
260
+ .then((response) => {
261
+ resolve(response.data);
262
+ })
263
+ .catch((error) => {
264
+ reject(error);
265
+ });
266
+ });
272
267
  };