@stackfactor/client-api 1.0.32 → 1.0.34

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,143 +1,138 @@
1
- import { axios } from "./axiosClient";
1
+ import axios from "./axiosClient";
2
2
 
3
- // eslint-disable-next-line no-undef
4
- module.exports = {
5
- axios: axios,
6
-
7
- /**
8
- * End an existing testing session
9
- * @param {String} testingSessionId
10
- * @param {String} token Authorization token
11
- */
12
- endSession: (testingSessionId, token) => {
13
- return new Promise(function (resolve, reject) {
14
- let confirmationRequest = axios.put(
15
- "api/v1/skillassessmenttestingsession/endsession",
16
- { id: testingSessionId },
17
- {
18
- headers: { authorization: token },
19
- }
20
- );
21
- confirmationRequest
22
- .then((response) => {
23
- resolve(response.data);
24
- })
25
- .catch((error) => {
26
- reject(error);
27
- });
28
- });
29
- },
3
+ /**
4
+ * End an existing testing session
5
+ * @param {String} testingSessionId
6
+ * @param {String} token Authorization token
7
+ */
8
+ export const endSession = (testingSessionId, token) => {
9
+ return new Promise(function (resolve, reject) {
10
+ let confirmationRequest = axios.put(
11
+ "api/v1/skillassessmenttestingsession/endsession",
12
+ { id: testingSessionId },
13
+ {
14
+ headers: { authorization: token },
15
+ }
16
+ );
17
+ confirmationRequest
18
+ .then((response) => {
19
+ resolve(response.data);
20
+ })
21
+ .catch((error) => {
22
+ reject(error);
23
+ });
24
+ });
25
+ };
30
26
 
31
- /**
32
- * End an existing testing session
33
- * @param {String} testingSessionId
34
- * @param {Array<String>} selectedAnswers
35
- * @param {String} token Authorization token
36
- */
37
- getNextStep: (testingSessionId, selectedAnswers, token) => {
38
- return new Promise(function (resolve, reject) {
39
- let data = {
40
- id: testingSessionId,
41
- };
42
- if (selectedAnswers) data.selectedAnswers = selectedAnswers;
43
- let confirmationRequest = axios.post(
44
- `api/v1/skillassessmenttestingsession/getnextstep`,
45
- data,
46
- {
47
- headers: { authorization: token },
48
- }
49
- );
50
- confirmationRequest
51
- .then((response) => {
52
- resolve(response.data);
53
- })
54
- .catch((error) => {
55
- reject(error);
56
- });
57
- });
58
- },
27
+ /**
28
+ * End an existing testing session
29
+ * @param {String} testingSessionId
30
+ * @param {Array<String>} selectedAnswers
31
+ * @param {String} token Authorization token
32
+ */
33
+ export const getNextStep = (testingSessionId, selectedAnswers, token) => {
34
+ return new Promise(function (resolve, reject) {
35
+ let data = {
36
+ id: testingSessionId,
37
+ };
38
+ if (selectedAnswers) data.selectedAnswers = selectedAnswers;
39
+ let confirmationRequest = axios.post(
40
+ `api/v1/skillassessmenttestingsession/getnextstep`,
41
+ data,
42
+ {
43
+ headers: { authorization: token },
44
+ }
45
+ );
46
+ confirmationRequest
47
+ .then((response) => {
48
+ resolve(response.data);
49
+ })
50
+ .catch((error) => {
51
+ reject(error);
52
+ });
53
+ });
54
+ };
59
55
 
60
- /**
61
- * Get skill assessment by user and skill
62
- * @param {String} userId
63
- * @param {String} skillId
64
- * @param {String} token
65
- * @returns
66
- */
67
- getSkillTestAssessment: (userId, skillId, token) => {
68
- return new Promise(function (resolve, reject) {
69
- let confirmationRequest = axios.post(
70
- `api/v1/skillassessmenttestingsession/getbyuserandskill`,
71
- {
72
- userId: userId,
73
- skillId: skillId,
74
- },
75
- {
76
- headers: { authorization: token },
77
- }
78
- );
79
- confirmationRequest
80
- .then((response) => {
81
- resolve(response.data);
82
- })
83
- .catch((error) => {
84
- reject(error);
85
- });
86
- });
87
- },
56
+ /**
57
+ * Get skill assessment by user and skill
58
+ * @param {String} userId
59
+ * @param {String} skillId
60
+ * @param {String} token
61
+ * @returns
62
+ */
63
+ export const getSkillTestAssessment = (userId, skillId, token) => {
64
+ return new Promise(function (resolve, reject) {
65
+ let confirmationRequest = axios.post(
66
+ `api/v1/skillassessmenttestingsession/getbyuserandskill`,
67
+ {
68
+ userId: userId,
69
+ skillId: skillId,
70
+ },
71
+ {
72
+ headers: { authorization: token },
73
+ }
74
+ );
75
+ confirmationRequest
76
+ .then((response) => {
77
+ resolve(response.data);
78
+ })
79
+ .catch((error) => {
80
+ reject(error);
81
+ });
82
+ });
83
+ };
88
84
 
89
- /**
90
- * Pause skill assessment
91
- * @param {String} testingSessionId
92
- * @param {String} token
93
- * @returns
94
- */
95
- pause: (testingSessionId, token) => {
96
- return new Promise(function (resolve, reject) {
97
- let confirmationRequest = axios.post(
98
- `api/v1/skillassessmenttestingsession/pausesession`,
99
- {
100
- id: testingSessionId,
101
- },
102
- {
103
- headers: { authorization: token },
104
- }
105
- );
106
- confirmationRequest
107
- .then((response) => {
108
- resolve(response.data);
109
- })
110
- .catch((error) => {
111
- reject(error);
112
- });
113
- });
114
- },
85
+ /**
86
+ * Pause skill assessment
87
+ * @param {String} testingSessionId
88
+ * @param {String} token
89
+ * @returns
90
+ */
91
+ export const pause = (testingSessionId, token) => {
92
+ return new Promise(function (resolve, reject) {
93
+ let confirmationRequest = axios.post(
94
+ `api/v1/skillassessmenttestingsession/pausesession`,
95
+ {
96
+ id: testingSessionId,
97
+ },
98
+ {
99
+ headers: { authorization: token },
100
+ }
101
+ );
102
+ confirmationRequest
103
+ .then((response) => {
104
+ resolve(response.data);
105
+ })
106
+ .catch((error) => {
107
+ reject(error);
108
+ });
109
+ });
110
+ };
115
111
 
116
- /**
117
- * Start a new test skill test assessment session
118
- * @param {String} skillId
119
- * @param {Boolean} saveSession
120
- * @param {String} token
121
- */
122
- startSession: (skillId, saveSession, token) => {
123
- return new Promise(function (resolve, reject) {
124
- let confirmationRequest = axios.post(
125
- "api/v1/skillassessmenttestingsession/startsession",
126
- {
127
- saveSession: saveSession,
128
- skillId: skillId,
129
- },
130
- {
131
- headers: { authorization: token },
132
- }
133
- );
134
- confirmationRequest
135
- .then((response) => {
136
- resolve(response.data);
137
- })
138
- .catch((error) => {
139
- reject(error);
140
- });
141
- });
142
- },
112
+ /**
113
+ * Start a new test skill test assessment session
114
+ * @param {String} skillId
115
+ * @param {Boolean} saveSession
116
+ * @param {String} token
117
+ */
118
+ export const startSession = (skillId, saveSession, token) => {
119
+ return new Promise(function (resolve, reject) {
120
+ let confirmationRequest = axios.post(
121
+ "api/v1/skillassessmenttestingsession/startsession",
122
+ {
123
+ saveSession: saveSession,
124
+ skillId: skillId,
125
+ },
126
+ {
127
+ headers: { authorization: token },
128
+ }
129
+ );
130
+ confirmationRequest
131
+ .then((response) => {
132
+ resolve(response.data);
133
+ })
134
+ .catch((error) => {
135
+ reject(error);
136
+ });
137
+ });
143
138
  };
@@ -1,139 +1,135 @@
1
- import { axios } from "./axiosClient";
1
+ import axios from "./axiosClient";
2
2
 
3
- module.exports = {
4
- axios: axios,
5
-
6
- /**
7
- * Add new entry skill assessment
8
- * @param {String} id
9
- * @param {Object} data
10
- * @param {String} comments
11
- * @param {String} token Authorization token
12
- */
13
- addEntry: (id, data, comments, token) => {
14
- return new Promise(function (resolve, reject) {
15
- const requestData = {
16
- comments: comments,
17
- data: data,
18
- id: id,
19
- };
20
- let confirmationRequest = axios.put(
21
- "api/v1/skillassessments/addentry",
22
- requestData,
23
- {
24
- headers: { authorization: token },
25
- }
26
- );
27
- confirmationRequest
28
- .then((response) => {
29
- resolve(response.data);
30
- })
31
- .catch((error) => {
32
- reject(error);
33
- });
34
- });
35
- },
36
-
37
- /**
38
- * Create skill assessment
39
- * @param {Object} data
40
- * @param {String} comments
41
- * @param {String} userId
42
- * @param {String} token Authorization token
43
- */
44
- create: (data, comments, userId, token) => {
45
- return new Promise(function (resolve, reject) {
46
- const requestData = {
47
- comments: comments,
48
- data: data,
49
- userId: userId,
50
- };
51
- let confirmationRequest = axios.put(
52
- "api/v1/skillassessments/",
53
- requestData,
54
- {
55
- headers: { authorization: token },
56
- }
57
- );
58
- confirmationRequest
59
- .then((response) => {
60
- resolve(response.data);
61
- })
62
- .catch((error) => {
63
- reject(error);
64
- });
65
- });
66
- },
67
-
68
- /**
69
- * Delete skill assessment
70
- * @param {number} id The id of the skill to be deleted
71
- * @param {String} comments The comment included with the deletion
72
- * @param {String} token Authorization token
73
- */
74
- deleteSkillAssessment: (id, comments, token) => {
75
- return new Promise(function (resolve, reject) {
76
- const data = {
77
- id: id,
78
- };
79
- if (comments) data.comments = comments;
80
- const request = axios.delete(`api/v1/skillassessments`, {
3
+ /**
4
+ * Add new entry skill assessment
5
+ * @param {String} id
6
+ * @param {Object} data
7
+ * @param {String} comments
8
+ * @param {String} token Authorization token
9
+ */
10
+ export const addEntry = (id, data, comments, token) => {
11
+ return new Promise(function (resolve, reject) {
12
+ const requestData = {
13
+ comments: comments,
14
+ data: data,
15
+ id: id,
16
+ };
17
+ let confirmationRequest = axios.put(
18
+ "api/v1/skillassessments/addentry",
19
+ requestData,
20
+ {
81
21
  headers: { authorization: token },
82
- data: data,
22
+ }
23
+ );
24
+ confirmationRequest
25
+ .then((response) => {
26
+ resolve(response.data);
27
+ })
28
+ .catch((error) => {
29
+ reject(error);
83
30
  });
84
- request
85
- .then((response) => {
86
- resolve(response.data);
87
- })
88
- .catch((error) => {
89
- reject(error);
90
- });
91
- });
92
- },
31
+ });
32
+ };
93
33
 
94
- /**
95
- * Get skill assessment by id
96
- * @param {String} id
97
- * @param {String} token
98
- */
99
- getById: (id, token) => {
100
- return new Promise(function (resolve, reject) {
101
- let confirmationRequest = axios.get(`api/v1/skillassessments/${id}`, {
34
+ /**
35
+ * Create skill assessment
36
+ * @param {Object} data
37
+ * @param {String} comments
38
+ * @param {String} userId
39
+ * @param {String} token Authorization token
40
+ */
41
+ export const create = (data, comments, userId, token) => {
42
+ return new Promise(function (resolve, reject) {
43
+ const requestData = {
44
+ comments: comments,
45
+ data: data,
46
+ userId: userId,
47
+ };
48
+ let confirmationRequest = axios.put(
49
+ "api/v1/skillassessments/",
50
+ requestData,
51
+ {
102
52
  headers: { authorization: token },
53
+ }
54
+ );
55
+ confirmationRequest
56
+ .then((response) => {
57
+ resolve(response.data);
58
+ })
59
+ .catch((error) => {
60
+ reject(error);
103
61
  });
104
- confirmationRequest
105
- .then((response) => {
106
- resolve(response.data);
107
- })
108
- .catch((error) => {
109
- reject(error);
110
- });
62
+ });
63
+ };
64
+
65
+ /**
66
+ * Delete skill assessment
67
+ * @param {number} id The id of the skill to be deleted
68
+ * @param {String} comments The comment included with the deletion
69
+ * @param {String} token Authorization token
70
+ */
71
+ export const deleteSkillAssessment = (id, comments, token) => {
72
+ return new Promise(function (resolve, reject) {
73
+ const data = {
74
+ id: id,
75
+ };
76
+ if (comments) data.comments = comments;
77
+ const request = axios.delete(`api/v1/skillassessments`, {
78
+ headers: { authorization: token },
79
+ data: data,
111
80
  });
112
- },
81
+ request
82
+ .then((response) => {
83
+ resolve(response.data);
84
+ })
85
+ .catch((error) => {
86
+ reject(error);
87
+ });
88
+ });
89
+ };
113
90
 
114
- /**
115
- * Get list
116
- * @param {Object} userId The user used to select the skill
117
- * @param {String} token Authorization token
118
- */
119
- getList: (userId, token) => {
120
- return new Promise(function (resolve, reject) {
121
- const requestData = {};
122
- if (userId) requestData.userId = userId;
123
- let confirmationRequest = axios.post(
124
- `api/v1/skillassessments`,
125
- requestData,
126
- {
127
- headers: { authorization: token },
128
- }
129
- );
130
- confirmationRequest
131
- .then((response) => {
132
- resolve(response.data);
133
- })
134
- .catch((error) => {
135
- reject(error);
136
- });
91
+ /**
92
+ * Get skill assessment by id
93
+ * @param {String} id
94
+ * @param {String} token
95
+ */
96
+ export const getById = (id, token) => {
97
+ return new Promise(function (resolve, reject) {
98
+ let confirmationRequest = axios.get(`api/v1/skillassessments/${id}`, {
99
+ headers: { authorization: token },
137
100
  });
138
- },
101
+ confirmationRequest
102
+ .then((response) => {
103
+ resolve(response.data);
104
+ })
105
+ .catch((error) => {
106
+ reject(error);
107
+ });
108
+ });
109
+ };
110
+
111
+ /**
112
+ * Get list
113
+ * @param {Object} userId The user used to select the skill
114
+ * @param {String} token Authorization token
115
+ */
116
+ export const getList = (userId, token) => {
117
+ return new Promise(function (resolve, reject) {
118
+ const requestData = {};
119
+ if (userId) requestData.userId = userId;
120
+ let confirmationRequest = axios.post(
121
+ `api/v1/skillassessments`,
122
+ requestData,
123
+ {
124
+ headers: { authorization: token },
125
+ }
126
+ );
127
+ confirmationRequest
128
+ .then((response) => {
129
+ resolve(response.data);
130
+ })
131
+ .catch((error) => {
132
+ reject(error);
133
+ });
134
+ });
139
135
  };