@stackfactor/client-api 1.0.1 → 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/index.js +22 -22
- package/lib/actionNotifications.js +16 -19
- package/lib/address.js +3 -3
- package/lib/axios.js +196 -196
- package/lib/config.js +5 -12
- package/lib/dashboard.js +5 -5
- package/lib/departmentTrainingPlans.js +9 -9
- package/lib/groups.js +19 -23
- package/lib/integration.js +24 -20
- package/lib/integrationConfiguration.js +5 -5
- package/lib/integrations/contentgenerator.js +4 -5
- package/lib/logger.js +6 -6
- package/lib/role.js +14 -14
- package/lib/roleTemplate.js +11 -11
- package/lib/skill.js +16 -17
- package/lib/skillAssessmentTestingSession.js +7 -7
- package/lib/skillAssessments.js +6 -6
- package/lib/skillTemplate.js +11 -11
- package/lib/teams.js +15 -18
- package/lib/templateDocument.js +6 -14
- package/lib/templatePhase.js +5 -13
- package/lib/templateRelease.js +4 -10
- package/lib/templates.js +8 -19
- package/lib/tenants.js +4 -7
- package/lib/trainingPlanTemplate.js +10 -10
- package/lib/trainingPlans.js +12 -12
- package/lib/userInformation.js +4 -4
- package/lib/users.js +33 -43
- package/lib/utils.js +1 -5
- package/package.json +9 -2
package/lib/templates.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
const axios = require("./axios");
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module.exports = {
|
|
4
4
|
axios: axios,
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
7
|
* Create template and set information
|
|
9
|
-
*
|
|
10
8
|
* @param {Object} data New template data information
|
|
11
9
|
* @param {String} token Authorization token
|
|
12
|
-
*
|
|
13
10
|
*/
|
|
14
|
-
createTemplate(data, token) {
|
|
11
|
+
createTemplate: (data, token) => {
|
|
15
12
|
return new Promise(function (resolve, reject) {
|
|
16
13
|
const requestData = {
|
|
17
14
|
data: data,
|
|
@@ -31,12 +28,10 @@ export default {
|
|
|
31
28
|
|
|
32
29
|
/**
|
|
33
30
|
* Delete template
|
|
34
|
-
*
|
|
35
31
|
* @param {number} id The id of the template to be deleted
|
|
36
32
|
* @param {String} token Authorization token
|
|
37
|
-
*
|
|
38
33
|
*/
|
|
39
|
-
deleteTemplate(id, token) {
|
|
34
|
+
deleteTemplate: (id, token) => {
|
|
40
35
|
return new Promise(function (resolve, reject) {
|
|
41
36
|
const requestData = {
|
|
42
37
|
id: id,
|
|
@@ -57,12 +52,10 @@ export default {
|
|
|
57
52
|
|
|
58
53
|
/**
|
|
59
54
|
* Get template information
|
|
60
|
-
*
|
|
61
55
|
* @param {number} id The id of the template
|
|
62
56
|
* @param {String} token Authorization token
|
|
63
|
-
*
|
|
64
57
|
*/
|
|
65
|
-
getTemplateInformationById(id, version, token) {
|
|
58
|
+
getTemplateInformationById: (id, version, token) => {
|
|
66
59
|
return new Promise(function (resolve, reject) {
|
|
67
60
|
let confirmationRequest = axios.get(`api/v1/templates/${id}/${version}`, {
|
|
68
61
|
headers: { authorization: token },
|
|
@@ -79,11 +72,10 @@ export default {
|
|
|
79
72
|
|
|
80
73
|
/**
|
|
81
74
|
* Get template information
|
|
82
|
-
*
|
|
83
75
|
* @param {Object} filter The filter used to select the template
|
|
84
76
|
* @param {String} token Authorization token
|
|
85
77
|
*/
|
|
86
|
-
getTemplateList(filter, version, token) {
|
|
78
|
+
getTemplateList: (filter, version, token) => {
|
|
87
79
|
return new Promise(function (resolve, reject) {
|
|
88
80
|
const requestData = {
|
|
89
81
|
filter: filter ? filter : "",
|
|
@@ -104,11 +96,10 @@ export default {
|
|
|
104
96
|
|
|
105
97
|
/**
|
|
106
98
|
* Publish template
|
|
107
|
-
*
|
|
108
99
|
* @param {number} id The id of the template to be published
|
|
109
100
|
* @param {String} token Authorization token
|
|
110
101
|
*/
|
|
111
|
-
publishTemplate(id, token) {
|
|
102
|
+
publishTemplate: (id, token) => {
|
|
112
103
|
return new Promise(function (resolve, reject) {
|
|
113
104
|
let confirmationRequest = axios.post(
|
|
114
105
|
`api/v1/templates/publish/${id}`,
|
|
@@ -129,13 +120,11 @@ export default {
|
|
|
129
120
|
|
|
130
121
|
/**
|
|
131
122
|
* Set template profile information
|
|
132
|
-
*
|
|
133
123
|
* @param {String} id The id of the template to be updated
|
|
134
124
|
* @param {Object} data Data used to update the template
|
|
135
125
|
* @param {String} token Authorization token
|
|
136
|
-
*
|
|
137
126
|
*/
|
|
138
|
-
setTemplateInformation(id, data, token) {
|
|
127
|
+
setTemplateInformation: (id, data, token) => {
|
|
139
128
|
return new Promise(function (resolve, reject) {
|
|
140
129
|
const requestData = {
|
|
141
130
|
data: data,
|
package/lib/tenants.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
const axios = require("./axios");
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module.exports = {
|
|
4
4
|
axios: axios,
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Get tenant information
|
|
8
|
-
*
|
|
9
8
|
* @param {String} category Tenant information category
|
|
10
9
|
* @param {String} token Authorization token
|
|
11
10
|
*/
|
|
12
|
-
getTenantInformation(categories, token) {
|
|
11
|
+
getTenantInformation: (categories, token) => {
|
|
13
12
|
return new Promise(function (resolve, reject) {
|
|
14
13
|
const requestData = {
|
|
15
14
|
categories: categories,
|
|
@@ -29,13 +28,11 @@ export default {
|
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Set tenant profile information
|
|
32
|
-
*
|
|
33
31
|
* @param {String} category Tenant information category
|
|
34
32
|
* @param {String} data New or updated tenant data information
|
|
35
33
|
* @param {Object} token Authorization token
|
|
36
|
-
*
|
|
37
34
|
*/
|
|
38
|
-
setTenantInformation(category, data, token) {
|
|
35
|
+
setTenantInformation: (category, data, token) => {
|
|
39
36
|
return new Promise(function (resolve, reject) {
|
|
40
37
|
const requestData = {
|
|
41
38
|
category: category,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const axios = require("./axios");
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module.exports = {
|
|
4
4
|
axios: axios,
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
* @param {Object} data
|
|
9
9
|
* @param {String} token Authorization token
|
|
10
10
|
*/
|
|
11
|
-
createTrainingPlanTemplate(data, token) {
|
|
11
|
+
createTrainingPlanTemplate: (data, token) => {
|
|
12
12
|
return new Promise(function (resolve, reject) {
|
|
13
13
|
let confirmationRequest = axios.put(
|
|
14
14
|
"api/v1/trainingplantemplates",
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
* @param {String} comment The comment for approver
|
|
34
34
|
* @param {String} token Authorization token
|
|
35
35
|
*/
|
|
36
|
-
deleteTrainingPlanTemplate(id, comment, token) {
|
|
36
|
+
deleteTrainingPlanTemplate: (id, comment, token) => {
|
|
37
37
|
return new Promise(function (resolve, reject) {
|
|
38
38
|
const data = {
|
|
39
39
|
id: id,
|
|
@@ -58,7 +58,7 @@ export default {
|
|
|
58
58
|
* @param {String} id The id of the training plan to be deleted
|
|
59
59
|
* @param {String} token Authorization token
|
|
60
60
|
*/
|
|
61
|
-
discardTrainingPlanChanges(id, token) {
|
|
61
|
+
discardTrainingPlanChanges: (id, token) => {
|
|
62
62
|
return new Promise(function (resolve, reject) {
|
|
63
63
|
const data = {};
|
|
64
64
|
const request = axios.get(`api/v1/trainingplantemplates/discard/${id}`, {
|
|
@@ -80,7 +80,7 @@ export default {
|
|
|
80
80
|
* @param {String} id The id of the template
|
|
81
81
|
* @param {String} token Authorization token
|
|
82
82
|
*/
|
|
83
|
-
getTrainingPlanTemplateInformationById(id, version, token) {
|
|
83
|
+
getTrainingPlanTemplateInformationById: (id, version, token) => {
|
|
84
84
|
return new Promise(function (resolve, reject) {
|
|
85
85
|
let confirmationRequest = axios.get(
|
|
86
86
|
`api/v1/trainingplantemplates/${id}/${version}`,
|
|
@@ -104,7 +104,7 @@ export default {
|
|
|
104
104
|
* @param {String} version The version to be retrieved
|
|
105
105
|
* @param {String} token Authorization token
|
|
106
106
|
*/
|
|
107
|
-
getTrainingPlanTemplatesList(list, version, includeDeleted, token) {
|
|
107
|
+
getTrainingPlanTemplatesList: (list, version, includeDeleted, token) => {
|
|
108
108
|
return new Promise(function (resolve, reject) {
|
|
109
109
|
const requestData = {
|
|
110
110
|
version: version,
|
|
@@ -134,7 +134,7 @@ export default {
|
|
|
134
134
|
* @param {String} comment The comment to be include with the request
|
|
135
135
|
* @param {String} token Authorization token
|
|
136
136
|
*/
|
|
137
|
-
publishTrainingPlanTemplate(id, comment, token) {
|
|
137
|
+
publishTrainingPlanTemplate: (id, comment, token) => {
|
|
138
138
|
return new Promise(function (resolve, reject) {
|
|
139
139
|
let data = {};
|
|
140
140
|
if (comment) data.comment = comment;
|
|
@@ -161,7 +161,7 @@ export default {
|
|
|
161
161
|
* @param {Object} data Data used to update the template
|
|
162
162
|
* @param {String} token Authorization token
|
|
163
163
|
*/
|
|
164
|
-
setTrainingPlanTemplateInformation(id, data, token) {
|
|
164
|
+
setTrainingPlanTemplateInformation: (id, data, token) => {
|
|
165
165
|
return new Promise(function (resolve, reject) {
|
|
166
166
|
const requestData = {
|
|
167
167
|
data: data,
|
|
@@ -190,7 +190,7 @@ export default {
|
|
|
190
190
|
* @param {Object} tags The updated tags
|
|
191
191
|
* @param {String} token Authorization token
|
|
192
192
|
*/
|
|
193
|
-
setTrainingPlanTemplateTags(id, tags, token) {
|
|
193
|
+
setTrainingPlanTemplateTags: (id, tags, token) => {
|
|
194
194
|
return new Promise(function (resolve, reject) {
|
|
195
195
|
const requestData = {
|
|
196
196
|
tags: tags,
|
package/lib/trainingPlans.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const axios = require("./axios");
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module.exports = {
|
|
4
4
|
axios: axios,
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
* @param {Boolean} saveAsDraft Save as draft flag
|
|
11
11
|
* @param {String} token Authorization token
|
|
12
12
|
*/
|
|
13
|
-
createTrainingPlan(data, type, saveAsDraft, token) {
|
|
13
|
+
createTrainingPlan: (data, type, saveAsDraft, token) => {
|
|
14
14
|
return new Promise(function (resolve, reject) {
|
|
15
15
|
const requestData = {
|
|
16
16
|
data: {
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
* @param {String} comment The comment for approver
|
|
39
39
|
* @param {String} token Authorization token
|
|
40
40
|
*/
|
|
41
|
-
deleteTrainingPlan(id, comment, token) {
|
|
41
|
+
deleteTrainingPlan: (id, comment, token) => {
|
|
42
42
|
return new Promise(function (resolve, reject) {
|
|
43
43
|
const data = {
|
|
44
44
|
id: id,
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
* @param {String} id The id of the training plan to be deleted
|
|
64
64
|
* @param {String} token Authorization token
|
|
65
65
|
*/
|
|
66
|
-
discardTrainingPlanChanges(id, token) {
|
|
66
|
+
discardTrainingPlanChanges: (id, token) => {
|
|
67
67
|
return new Promise(function (resolve, reject) {
|
|
68
68
|
const request = axios.get(`api/v1/trainingplans/discard/${id}`, {
|
|
69
69
|
headers: { authorization: token },
|
|
@@ -86,7 +86,7 @@ export default {
|
|
|
86
86
|
* @param {Boolean} saveBaseline If set to true it will save the baseline
|
|
87
87
|
* @param {String} token Authorization token
|
|
88
88
|
*/
|
|
89
|
-
generateNewBaseline(id, data, returnMinimized, saveBaseline, token) {
|
|
89
|
+
generateNewBaseline: (id, data, returnMinimized, saveBaseline, token) => {
|
|
90
90
|
return new Promise(function (resolve, reject) {
|
|
91
91
|
const requestData = {
|
|
92
92
|
data: data,
|
|
@@ -116,7 +116,7 @@ export default {
|
|
|
116
116
|
* @param {String} id The id of the training plan
|
|
117
117
|
* @param {String} token Authorization token
|
|
118
118
|
*/
|
|
119
|
-
getTrainingPlanById(id, version, token) {
|
|
119
|
+
getTrainingPlanById: (id, version, token) => {
|
|
120
120
|
return new Promise(function (resolve, reject) {
|
|
121
121
|
let confirmationRequest = axios.get(
|
|
122
122
|
`api/v1/trainingplans/${id}/${version}`,
|
|
@@ -144,7 +144,7 @@ export default {
|
|
|
144
144
|
* @param {Boolean} returnDefaultIfVersionNotAvailable If set to true it will load the draft information if the plan was never published
|
|
145
145
|
* @param {String} token Authorization token
|
|
146
146
|
*/
|
|
147
|
-
getListOfTrainingPlans(
|
|
147
|
+
getListOfTrainingPlans: (
|
|
148
148
|
users,
|
|
149
149
|
types,
|
|
150
150
|
version,
|
|
@@ -153,7 +153,7 @@ export default {
|
|
|
153
153
|
includeDetailedInformation,
|
|
154
154
|
returnDefaultIfVersionNotAvailable,
|
|
155
155
|
token
|
|
156
|
-
) {
|
|
156
|
+
) => {
|
|
157
157
|
return new Promise(function (resolve, reject) {
|
|
158
158
|
const requestData = {
|
|
159
159
|
version: version,
|
|
@@ -187,7 +187,7 @@ export default {
|
|
|
187
187
|
* @param {String} comment The comment to be include with the request
|
|
188
188
|
* @param {String} token Authorization token
|
|
189
189
|
*/
|
|
190
|
-
publishTrainingPlan(id, comment, token) {
|
|
190
|
+
publishTrainingPlan: (id, comment, token) => {
|
|
191
191
|
return new Promise(function (resolve, reject) {
|
|
192
192
|
let data = {};
|
|
193
193
|
if (comment) data.comment = comment;
|
|
@@ -214,7 +214,7 @@ export default {
|
|
|
214
214
|
* @param {Object} data The updated data
|
|
215
215
|
* @param {String} token Authorization token
|
|
216
216
|
*/
|
|
217
|
-
updateTrainingPlan(planId, data, saveAsDraft, token) {
|
|
217
|
+
updateTrainingPlan: (planId, data, saveAsDraft, token) => {
|
|
218
218
|
return new Promise(function (resolve, reject) {
|
|
219
219
|
const requestData = {
|
|
220
220
|
data: data,
|
|
@@ -246,7 +246,7 @@ export default {
|
|
|
246
246
|
* @param {Function} failCallBack
|
|
247
247
|
* @returns {Object} An object containing the task information
|
|
248
248
|
*/
|
|
249
|
-
updateActivities(planId, data, token) {
|
|
249
|
+
updateActivities: (planId, data, token) => {
|
|
250
250
|
return new Promise(function (resolve, reject) {
|
|
251
251
|
let confirmationRequest = axios.post(
|
|
252
252
|
`api/v1/trainingplans/${planId}/activities`,
|
package/lib/userInformation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const axios = require("./axios");
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
axios: axios,
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
* @param {Object} data
|
|
11
11
|
* @param {String} token Authorization token
|
|
12
12
|
*/
|
|
13
|
-
addEntryToArrayBusinessProperty(userId, property, data, token) {
|
|
13
|
+
addEntryToArrayBusinessProperty: (userId, property, data, token) => {
|
|
14
14
|
return new Promise(function (resolve, reject) {
|
|
15
15
|
const requestData = {
|
|
16
16
|
data: data,
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
* @param {String} id
|
|
40
40
|
* @param {String} token Authorization token
|
|
41
41
|
*/
|
|
42
|
-
removeEntryFromArrayBusinessProperty(userId, property, id, token) {
|
|
42
|
+
removeEntryFromArrayBusinessProperty: (userId, property, id, token) => {
|
|
43
43
|
return new Promise(function (resolve, reject) {
|
|
44
44
|
const confirmationRequest = axios.delete(
|
|
45
45
|
`api/v1/user/arrayproperty/${userId}/${property}/${id}`,
|
|
@@ -65,7 +65,7 @@ export default {
|
|
|
65
65
|
* @param {Object} data
|
|
66
66
|
* @param {String} token Authorization token
|
|
67
67
|
*/
|
|
68
|
-
updateEntryfromArrayBusinessProperty(userId, property, id, data, token) {
|
|
68
|
+
updateEntryfromArrayBusinessProperty: (userId, property, id, data, token) => {
|
|
69
69
|
return new Promise(function (resolve, reject) {
|
|
70
70
|
const requestData = {
|
|
71
71
|
data: data,
|
package/lib/users.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// User sepcific requests
|
|
3
|
-
//
|
|
4
1
|
import axios from "./axios";
|
|
5
2
|
import { removeNullProperties } from "../components/Utils";
|
|
6
3
|
|
|
@@ -12,7 +9,7 @@ export default {
|
|
|
12
9
|
* @param {Date} expiration Expiration date of the token
|
|
13
10
|
* @param {String} authToken Authorization token
|
|
14
11
|
*/
|
|
15
|
-
addAPIToken(name, expiration, authToken) {
|
|
12
|
+
addAPIToken: (name, expiration, authToken) => {
|
|
16
13
|
return new Promise(function (resolve, reject) {
|
|
17
14
|
const requestData = removeNullProperties({
|
|
18
15
|
name: name,
|
|
@@ -41,11 +38,9 @@ export default {
|
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
40
|
* Confirm email address
|
|
44
|
-
*
|
|
45
41
|
* @param {String} validationCode The code was provided to the user in advance by email
|
|
46
|
-
*
|
|
47
42
|
*/
|
|
48
|
-
confirmEmailAddress(validationCode) {
|
|
43
|
+
confirmEmailAddress: (validationCode) => {
|
|
49
44
|
return new Promise(function (resolve, reject) {
|
|
50
45
|
const requestData = removeNullProperties({
|
|
51
46
|
validationCode: validationCode,
|
|
@@ -65,9 +60,7 @@ export default {
|
|
|
65
60
|
},
|
|
66
61
|
|
|
67
62
|
/**
|
|
68
|
-
*
|
|
69
63
|
* Create a new account (tenant). It returns a promise
|
|
70
|
-
*
|
|
71
64
|
* @param {String} email User's email address
|
|
72
65
|
* @param {String} firstName User's first name
|
|
73
66
|
* @param {String} lastName User's last name
|
|
@@ -76,7 +69,14 @@ export default {
|
|
|
76
69
|
* @param {String} inviteCode Invitation code received in advance from one of the account owners
|
|
77
70
|
* @param
|
|
78
71
|
*/
|
|
79
|
-
createAccount(
|
|
72
|
+
createAccount: (
|
|
73
|
+
email,
|
|
74
|
+
firstName,
|
|
75
|
+
lastName,
|
|
76
|
+
password,
|
|
77
|
+
subSite,
|
|
78
|
+
inviteCode
|
|
79
|
+
) => {
|
|
80
80
|
return new Promise(function (resolve, reject) {
|
|
81
81
|
if (
|
|
82
82
|
email.trim() === "" ||
|
|
@@ -110,15 +110,13 @@ export default {
|
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Create a new user account. It returns a promise
|
|
113
|
-
*
|
|
114
113
|
* @param {String} email User's email address
|
|
115
114
|
* @param {String} firstName User's first name
|
|
116
115
|
* @param {String} lastName User's last name
|
|
117
116
|
* @param {String} password User's password
|
|
118
117
|
* @param {String} token Invitation token provided to the user
|
|
119
|
-
*
|
|
120
118
|
*/
|
|
121
|
-
createUserAccount(email, firstName, lastName, password, token) {
|
|
119
|
+
createUserAccount: (email, firstName, lastName, password, token) => {
|
|
122
120
|
return new Promise(function (resolve, reject) {
|
|
123
121
|
if (
|
|
124
122
|
email.trim() === "" ||
|
|
@@ -150,11 +148,10 @@ export default {
|
|
|
150
148
|
|
|
151
149
|
/**
|
|
152
150
|
* Delete an existing API token
|
|
153
|
-
*
|
|
154
151
|
* @param {String} token Expiration date of the token
|
|
155
152
|
* @param {String} authToken Authorization token
|
|
156
153
|
*/
|
|
157
|
-
deleteAPIToken(token, authToken) {
|
|
154
|
+
deleteAPIToken: (token, authToken) => {
|
|
158
155
|
return new Promise(function (resolve, reject) {
|
|
159
156
|
const deleteTokenRequest = axios.delete(
|
|
160
157
|
`api/v1/users/user/token`,
|
|
@@ -177,11 +174,10 @@ export default {
|
|
|
177
174
|
|
|
178
175
|
/**
|
|
179
176
|
* Delete existing users
|
|
180
|
-
*
|
|
181
|
-
* @param {Array} userIds The ID of the users to be deleted
|
|
177
|
+
* @param {Array<String>} userIds The ID of the users to be deleted
|
|
182
178
|
* @param {String} authToken Authorization token
|
|
183
179
|
*/
|
|
184
|
-
deleteUsers(userIds, authToken) {
|
|
180
|
+
deleteUsers: (userIds, authToken) => {
|
|
185
181
|
return new Promise(function (resolve, reject) {
|
|
186
182
|
const deleteTokenRequest = axios.delete(
|
|
187
183
|
`api/v1/users/`,
|
|
@@ -206,7 +202,7 @@ export default {
|
|
|
206
202
|
* Get all the API tokens
|
|
207
203
|
* @param {String} authToken Authorization token
|
|
208
204
|
*/
|
|
209
|
-
getAPITokens(authToken) {
|
|
205
|
+
getAPITokens: (authToken) => {
|
|
210
206
|
return new Promise(function (resolve, reject) {
|
|
211
207
|
const getTokensRequest = axios.get(`api/v1/users/getapitokens`, {
|
|
212
208
|
headers: { authorization: authToken },
|
|
@@ -222,13 +218,10 @@ export default {
|
|
|
222
218
|
},
|
|
223
219
|
|
|
224
220
|
/**
|
|
225
|
-
*
|
|
226
221
|
* Get the specified user account by Id. It returns a promise
|
|
227
|
-
*
|
|
228
222
|
* @param {String} id Id of the user for which information is being requested
|
|
229
|
-
*
|
|
230
223
|
*/
|
|
231
|
-
getUserById(id) {
|
|
224
|
+
getUserById: (id) => {
|
|
232
225
|
return new Promise(function (resolve, reject) {
|
|
233
226
|
const getUserInformationRequest = axios.get(`api/v1/users/user/${id}`);
|
|
234
227
|
getUserInformationRequest
|
|
@@ -251,7 +244,7 @@ export default {
|
|
|
251
244
|
* @param {String} category User information category
|
|
252
245
|
* @param {String} token Authorization token
|
|
253
246
|
*/
|
|
254
|
-
getUserInformation(userId, category, token) {
|
|
247
|
+
getUserInformation: (userId, category, token) => {
|
|
255
248
|
return new Promise(function (resolve, reject) {
|
|
256
249
|
let confirmationRequest = axios.get(
|
|
257
250
|
`api/v1/users/user/${userId ? userId : 0}/${category ? category : "*"}`,
|
|
@@ -275,7 +268,7 @@ export default {
|
|
|
275
268
|
* @param {Array} fields Fields to be loaded. Ex: ["firstName"]
|
|
276
269
|
* @param {String} token Authorization token
|
|
277
270
|
*/
|
|
278
|
-
getUsers(filter, fields, token) {
|
|
271
|
+
getUsers: (filter, fields, token) => {
|
|
279
272
|
return new Promise(function (resolve, reject) {
|
|
280
273
|
const requestData = removeNullProperties({
|
|
281
274
|
filter: filter,
|
|
@@ -296,10 +289,10 @@ export default {
|
|
|
296
289
|
|
|
297
290
|
/**
|
|
298
291
|
* Invite other users to join the same account
|
|
299
|
-
* @param {Array} invitees List of emails of the invitees
|
|
292
|
+
* @param {Array<String>} invitees List of emails of the invitees
|
|
300
293
|
* @param {String} token Authorization token
|
|
301
294
|
*/
|
|
302
|
-
inviteUsers(invitees, authToken) {
|
|
295
|
+
inviteUsers: (invitees, authToken) => {
|
|
303
296
|
return new Promise(function (resolve, reject) {
|
|
304
297
|
const requestData = removeNullProperties({
|
|
305
298
|
invitees: invitees,
|
|
@@ -324,7 +317,7 @@ export default {
|
|
|
324
317
|
* @param {String} password User's password
|
|
325
318
|
* @param {boolean} rememberMe Set to true if the user wants his account to be saved on the current machine
|
|
326
319
|
*/
|
|
327
|
-
login(email, password, rememberMe) {
|
|
320
|
+
login: (email, password, rememberMe) => {
|
|
328
321
|
return new Promise(function (resolve, reject) {
|
|
329
322
|
const requestData = removeNullProperties({
|
|
330
323
|
email: email,
|
|
@@ -346,7 +339,7 @@ export default {
|
|
|
346
339
|
* Logout from the server. It returns a promise
|
|
347
340
|
* @param {String} token Authorization token
|
|
348
341
|
*/
|
|
349
|
-
logout(token) {
|
|
342
|
+
logout: (token) => {
|
|
350
343
|
return new Promise(function (resolve, reject) {
|
|
351
344
|
const options = removeNullProperties({
|
|
352
345
|
headers: { authorization: token },
|
|
@@ -367,7 +360,7 @@ export default {
|
|
|
367
360
|
* a new token can be restablished using login
|
|
368
361
|
* @param {String} token User's auth token to be refreshed
|
|
369
362
|
*/
|
|
370
|
-
refreshToken(token) {
|
|
363
|
+
refreshToken: (token) => {
|
|
371
364
|
return new Promise(function (resolve, reject) {
|
|
372
365
|
let options = removeNullProperties({ headers: { Authorization: token } });
|
|
373
366
|
let request = axios.post("api/v1/auth/refreshToken", {}, options);
|
|
@@ -386,7 +379,7 @@ export default {
|
|
|
386
379
|
* @param {String} id The ID of the token to be removed
|
|
387
380
|
* @param {String} authToken Authorization token
|
|
388
381
|
*/
|
|
389
|
-
removeAPIToken(id, authToken) {
|
|
382
|
+
removeAPIToken: (id, authToken) => {
|
|
390
383
|
return new Promise(function (resolve, reject) {
|
|
391
384
|
const requestData = removeNullProperties({
|
|
392
385
|
id: id,
|
|
@@ -410,10 +403,10 @@ export default {
|
|
|
410
403
|
|
|
411
404
|
/**
|
|
412
405
|
* Resend invitation emails
|
|
413
|
-
* @param {Array} invitees List of emails of the invitees
|
|
406
|
+
* @param {Array<String>} invitees List of emails of the invitees
|
|
414
407
|
* @param {String} token Authorization token
|
|
415
408
|
*/
|
|
416
|
-
resendInvitationEmails(invitees, authToken) {
|
|
409
|
+
resendInvitationEmails: (invitees, authToken) => {
|
|
417
410
|
return new Promise(function (resolve, reject) {
|
|
418
411
|
const requestData = removeNullProperties({
|
|
419
412
|
invitees: invitees,
|
|
@@ -438,7 +431,7 @@ export default {
|
|
|
438
431
|
* @param {String} email User's email address
|
|
439
432
|
* @param {String} password User's new password
|
|
440
433
|
*/
|
|
441
|
-
resetPassword(email, code, password) {
|
|
434
|
+
resetPassword: (email, code, password) => {
|
|
442
435
|
return new Promise(function (resolve, reject) {
|
|
443
436
|
let postData = removeNullProperties({
|
|
444
437
|
email: email,
|
|
@@ -460,7 +453,7 @@ export default {
|
|
|
460
453
|
* Send an email to the user indicated by the email address to reset the password. It returns a promise
|
|
461
454
|
* @param {String} email Email of the user who needs to reset the password
|
|
462
455
|
*/
|
|
463
|
-
sendPasswordResetNotification(email) {
|
|
456
|
+
sendPasswordResetNotification: (email) => {
|
|
464
457
|
return new Promise(function (resolve, reject) {
|
|
465
458
|
let postData = removeNullProperties({
|
|
466
459
|
email: email,
|
|
@@ -486,7 +479,7 @@ export default {
|
|
|
486
479
|
* @param {String} data New or updated user data information
|
|
487
480
|
* @param {Object} token Authorization token
|
|
488
481
|
*/
|
|
489
|
-
setUserInformation(userId, category, data, token) {
|
|
482
|
+
setUserInformation: (userId, category, data, token) => {
|
|
490
483
|
return new Promise(function (resolve, reject) {
|
|
491
484
|
const requestData = removeNullProperties({
|
|
492
485
|
data: category ? { category: { ...data } } : data,
|
|
@@ -511,7 +504,7 @@ export default {
|
|
|
511
504
|
* @param {String} password The current password
|
|
512
505
|
* @param {String} token Authorization token
|
|
513
506
|
*/
|
|
514
|
-
updateUserEmail(email, password, token) {
|
|
507
|
+
updateUserEmail: (email, password, token) => {
|
|
515
508
|
return new Promise(function (resolve, reject) {
|
|
516
509
|
const requestData = removeNullProperties({
|
|
517
510
|
email: email,
|
|
@@ -540,7 +533,7 @@ export default {
|
|
|
540
533
|
* @param {Array<String>} groups The id of the groups the user should belong to
|
|
541
534
|
* @param {String} token Authorization token
|
|
542
535
|
*/
|
|
543
|
-
updateUserGroups(userId, groups, token) {
|
|
536
|
+
updateUserGroups: (userId, groups, token) => {
|
|
544
537
|
return new Promise(function (resolve, reject) {
|
|
545
538
|
const requestData = removeNullProperties({
|
|
546
539
|
userId: userId,
|
|
@@ -569,7 +562,7 @@ export default {
|
|
|
569
562
|
* @param {String} newPassword The new password
|
|
570
563
|
* @param {String} token Authorization token
|
|
571
564
|
*/
|
|
572
|
-
updateUserPassword(password, newPassword, token) {
|
|
565
|
+
updateUserPassword: (password, newPassword, token) => {
|
|
573
566
|
return new Promise(function (resolve, reject) {
|
|
574
567
|
const requestData = removeNullProperties({
|
|
575
568
|
password: password,
|
|
@@ -593,14 +586,11 @@ export default {
|
|
|
593
586
|
},
|
|
594
587
|
|
|
595
588
|
/**
|
|
596
|
-
*
|
|
597
589
|
* Validate reset password code. It returns a promise
|
|
598
|
-
*
|
|
599
590
|
* @param {String} email User's email address
|
|
600
591
|
* @param {String} code Provided reset code
|
|
601
|
-
*
|
|
602
592
|
*/
|
|
603
|
-
validateResetPasswordCode(email, code) {
|
|
593
|
+
validateResetPasswordCode: (email, code) => {
|
|
604
594
|
return new Promise(function (resolve, reject) {
|
|
605
595
|
let postData = removeNullProperties({
|
|
606
596
|
email: email,
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackfactor/client-api",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "StackFactor
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Node.js library for the StackFactor API",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./index.js",
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
6
13
|
"scripts": {
|
|
7
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
15
|
},
|