@stackfactor/client-api 1.1.140 → 1.1.143

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.
Files changed (311) hide show
  1. package/dist/cjs/actionNotifications.d.ts +24 -0
  2. package/dist/cjs/actionNotifications.d.ts.map +1 -0
  3. package/dist/cjs/actionNotifications.js +73 -0
  4. package/dist/cjs/actionNotifications.js.map +1 -0
  5. package/dist/cjs/address.d.ts +8 -0
  6. package/dist/cjs/address.d.ts.map +1 -0
  7. package/dist/cjs/address.js +24 -0
  8. package/dist/cjs/address.js.map +1 -0
  9. package/dist/cjs/aiAssistant.d.ts +42 -0
  10. package/dist/cjs/aiAssistant.d.ts.map +1 -0
  11. package/dist/cjs/aiAssistant.js +135 -0
  12. package/dist/cjs/aiAssistant.js.map +1 -0
  13. package/dist/cjs/avatar.d.ts +11 -0
  14. package/dist/cjs/avatar.d.ts.map +1 -0
  15. package/dist/cjs/avatar.js +32 -0
  16. package/dist/cjs/avatar.js.map +1 -0
  17. package/dist/cjs/axiosClient.d.ts +31 -0
  18. package/dist/cjs/axiosClient.d.ts.map +1 -0
  19. package/dist/cjs/axiosClient.js +123 -0
  20. package/dist/cjs/axiosClient.js.map +1 -0
  21. package/dist/cjs/config.d.ts +23 -0
  22. package/dist/cjs/config.d.ts.map +1 -0
  23. package/dist/cjs/config.js +63 -0
  24. package/dist/cjs/config.js.map +1 -0
  25. package/dist/cjs/constants.d.ts +69 -0
  26. package/dist/cjs/constants.d.ts.map +1 -0
  27. package/dist/cjs/constants.js +91 -0
  28. package/dist/cjs/constants.js.map +1 -0
  29. package/dist/cjs/dashboard.d.ts +23 -0
  30. package/dist/cjs/dashboard.d.ts.map +1 -0
  31. package/dist/cjs/dashboard.js +74 -0
  32. package/dist/cjs/dashboard.js.map +1 -0
  33. package/dist/cjs/departmentTrainingPlans.d.ts +53 -0
  34. package/dist/cjs/departmentTrainingPlans.d.ts.map +1 -0
  35. package/dist/cjs/departmentTrainingPlans.js +153 -0
  36. package/dist/cjs/departmentTrainingPlans.js.map +1 -0
  37. package/dist/cjs/groups.d.ts +90 -0
  38. package/dist/cjs/groups.d.ts.map +1 -0
  39. package/dist/cjs/groups.js +273 -0
  40. package/dist/cjs/groups.js.map +1 -0
  41. package/{src/lib/index.ts → dist/cjs/index.d.ts} +3 -13
  42. package/dist/cjs/index.d.ts.map +1 -0
  43. package/dist/cjs/index.js +77 -0
  44. package/dist/cjs/index.js.map +1 -0
  45. package/dist/cjs/integration.d.ts +82 -0
  46. package/dist/cjs/integration.d.ts.map +1 -0
  47. package/dist/cjs/integration.js +316 -0
  48. package/dist/cjs/integration.js.map +1 -0
  49. package/dist/cjs/integrationConfiguration.d.ts +27 -0
  50. package/dist/cjs/integrationConfiguration.d.ts.map +1 -0
  51. package/dist/cjs/integrationConfiguration.js +86 -0
  52. package/dist/cjs/integrationConfiguration.js.map +1 -0
  53. package/dist/cjs/integrations/contentGenerator.d.ts +22 -0
  54. package/dist/cjs/integrations/contentGenerator.d.ts.map +1 -0
  55. package/dist/cjs/integrations/contentGenerator.js +69 -0
  56. package/dist/cjs/integrations/contentGenerator.js.map +1 -0
  57. package/dist/cjs/learningContent.d.ts +122 -0
  58. package/dist/cjs/learningContent.d.ts.map +1 -0
  59. package/dist/cjs/learningContent.js +394 -0
  60. package/dist/cjs/learningContent.js.map +1 -0
  61. package/dist/cjs/learningPath.d.ts +64 -0
  62. package/dist/cjs/learningPath.d.ts.map +1 -0
  63. package/dist/cjs/learningPath.js +205 -0
  64. package/dist/cjs/learningPath.js.map +1 -0
  65. package/dist/cjs/logger.d.ts +19 -0
  66. package/dist/cjs/logger.d.ts.map +1 -0
  67. package/dist/cjs/logger.js +60 -0
  68. package/dist/cjs/logger.js.map +1 -0
  69. package/dist/cjs/microSkillsQuizes.d.ts +18 -0
  70. package/dist/cjs/microSkillsQuizes.d.ts.map +1 -0
  71. package/dist/cjs/microSkillsQuizes.js +53 -0
  72. package/dist/cjs/microSkillsQuizes.js.map +1 -0
  73. package/dist/cjs/quotas.d.ts +15 -0
  74. package/dist/cjs/quotas.d.ts.map +1 -0
  75. package/dist/cjs/quotas.js +50 -0
  76. package/dist/cjs/quotas.js.map +1 -0
  77. package/dist/cjs/role.d.ts +113 -0
  78. package/dist/cjs/role.d.ts.map +1 -0
  79. package/dist/cjs/role.js +363 -0
  80. package/dist/cjs/role.js.map +1 -0
  81. package/dist/cjs/roleTemplate.d.ts +73 -0
  82. package/dist/cjs/roleTemplate.d.ts.map +1 -0
  83. package/dist/cjs/roleTemplate.js +236 -0
  84. package/dist/cjs/roleTemplate.js.map +1 -0
  85. package/dist/cjs/security.d.ts +27 -0
  86. package/dist/cjs/security.d.ts.map +1 -0
  87. package/dist/cjs/security.js +79 -0
  88. package/dist/cjs/security.js.map +1 -0
  89. package/dist/cjs/skill.d.ts +141 -0
  90. package/dist/cjs/skill.d.ts.map +1 -0
  91. package/dist/cjs/skill.js +440 -0
  92. package/dist/cjs/skill.js.map +1 -0
  93. package/dist/cjs/skillAssessmentTestingSession.d.ts +49 -0
  94. package/dist/cjs/skillAssessmentTestingSession.d.ts.map +1 -0
  95. package/dist/cjs/skillAssessmentTestingSession.js +156 -0
  96. package/dist/cjs/skillAssessmentTestingSession.js.map +1 -0
  97. package/dist/cjs/skillAssessments.d.ts +49 -0
  98. package/dist/cjs/skillAssessments.d.ts.map +1 -0
  99. package/dist/cjs/skillAssessments.js +156 -0
  100. package/dist/cjs/skillAssessments.js.map +1 -0
  101. package/dist/cjs/skillTemplate.d.ts +87 -0
  102. package/dist/cjs/skillTemplate.d.ts.map +1 -0
  103. package/dist/cjs/skillTemplate.js +281 -0
  104. package/dist/cjs/skillTemplate.js.map +1 -0
  105. package/dist/cjs/talentTransfromation.d.ts +29 -0
  106. package/dist/cjs/talentTransfromation.d.ts.map +1 -0
  107. package/dist/cjs/talentTransfromation.js +100 -0
  108. package/dist/cjs/talentTransfromation.js.map +1 -0
  109. package/dist/cjs/teams.d.ts +85 -0
  110. package/dist/cjs/teams.d.ts.map +1 -0
  111. package/dist/cjs/teams.js +252 -0
  112. package/dist/cjs/teams.js.map +1 -0
  113. package/dist/cjs/tenants.d.ts +16 -0
  114. package/dist/cjs/tenants.d.ts.map +1 -0
  115. package/dist/cjs/tenants.js +55 -0
  116. package/dist/cjs/tenants.js.map +1 -0
  117. package/dist/cjs/trainingPlans.d.ts +92 -0
  118. package/dist/cjs/trainingPlans.d.ts.map +1 -0
  119. package/dist/cjs/trainingPlans.js +309 -0
  120. package/dist/cjs/trainingPlans.js.map +1 -0
  121. package/dist/cjs/trainingPlansProficiencyLevels.d.ts +32 -0
  122. package/dist/cjs/trainingPlansProficiencyLevels.d.ts.map +1 -0
  123. package/dist/cjs/trainingPlansProficiencyLevels.js +97 -0
  124. package/dist/cjs/trainingPlansProficiencyLevels.js.map +1 -0
  125. package/dist/cjs/userInformation.d.ts +29 -0
  126. package/dist/cjs/userInformation.d.ts.map +1 -0
  127. package/dist/cjs/userInformation.js +81 -0
  128. package/dist/cjs/userInformation.js.map +1 -0
  129. package/dist/cjs/users.d.ts +206 -0
  130. package/dist/cjs/users.d.ts.map +1 -0
  131. package/dist/cjs/users.js +694 -0
  132. package/dist/cjs/users.js.map +1 -0
  133. package/dist/cjs/utils.d.ts +14 -0
  134. package/dist/cjs/utils.d.ts.map +1 -0
  135. package/dist/cjs/utils.js +58 -0
  136. package/dist/cjs/utils.js.map +1 -0
  137. package/dist/esm/actionNotifications.d.ts +24 -0
  138. package/dist/esm/actionNotifications.d.ts.map +1 -0
  139. package/dist/esm/actionNotifications.js +67 -0
  140. package/dist/esm/actionNotifications.js.map +1 -0
  141. package/dist/esm/address.d.ts +8 -0
  142. package/dist/esm/address.d.ts.map +1 -0
  143. package/dist/esm/address.js +20 -0
  144. package/dist/esm/address.js.map +1 -0
  145. package/dist/esm/aiAssistant.d.ts +42 -0
  146. package/dist/esm/aiAssistant.d.ts.map +1 -0
  147. package/dist/esm/aiAssistant.js +126 -0
  148. package/dist/esm/aiAssistant.js.map +1 -0
  149. package/dist/esm/avatar.d.ts +11 -0
  150. package/dist/esm/avatar.d.ts.map +1 -0
  151. package/dist/esm/avatar.js +28 -0
  152. package/dist/esm/avatar.js.map +1 -0
  153. package/dist/esm/axiosClient.d.ts +31 -0
  154. package/dist/esm/axiosClient.d.ts.map +1 -0
  155. package/dist/esm/axiosClient.js +78 -0
  156. package/dist/esm/axiosClient.js.map +1 -0
  157. package/dist/esm/config.d.ts +23 -0
  158. package/dist/esm/config.d.ts.map +1 -0
  159. package/dist/esm/config.js +57 -0
  160. package/dist/esm/config.js.map +1 -0
  161. package/dist/esm/constants.d.ts +69 -0
  162. package/dist/esm/constants.d.ts.map +1 -0
  163. package/dist/esm/constants.js +88 -0
  164. package/dist/esm/constants.js.map +1 -0
  165. package/dist/esm/dashboard.d.ts +23 -0
  166. package/dist/esm/dashboard.d.ts.map +1 -0
  167. package/dist/esm/dashboard.js +68 -0
  168. package/dist/esm/dashboard.js.map +1 -0
  169. package/dist/esm/departmentTrainingPlans.d.ts +53 -0
  170. package/dist/esm/departmentTrainingPlans.d.ts.map +1 -0
  171. package/dist/esm/departmentTrainingPlans.js +144 -0
  172. package/dist/esm/departmentTrainingPlans.js.map +1 -0
  173. package/dist/esm/groups.d.ts +90 -0
  174. package/dist/esm/groups.d.ts.map +1 -0
  175. package/dist/esm/groups.js +258 -0
  176. package/dist/esm/groups.js.map +1 -0
  177. package/dist/esm/index.d.ts +33 -0
  178. package/dist/esm/index.d.ts.map +1 -0
  179. package/dist/esm/index.js +33 -0
  180. package/dist/esm/index.js.map +1 -0
  181. package/dist/esm/integration.d.ts +82 -0
  182. package/dist/esm/integration.d.ts.map +1 -0
  183. package/dist/esm/integration.js +299 -0
  184. package/dist/esm/integration.js.map +1 -0
  185. package/dist/esm/integrationConfiguration.d.ts +27 -0
  186. package/dist/esm/integrationConfiguration.d.ts.map +1 -0
  187. package/dist/esm/integrationConfiguration.js +80 -0
  188. package/dist/esm/integrationConfiguration.js.map +1 -0
  189. package/dist/esm/integrations/contentGenerator.d.ts +22 -0
  190. package/dist/esm/integrations/contentGenerator.d.ts.map +1 -0
  191. package/dist/esm/integrations/contentGenerator.js +64 -0
  192. package/dist/esm/integrations/contentGenerator.js.map +1 -0
  193. package/dist/esm/learningContent.d.ts +122 -0
  194. package/dist/esm/learningContent.d.ts.map +1 -0
  195. package/dist/esm/learningContent.js +376 -0
  196. package/dist/esm/learningContent.js.map +1 -0
  197. package/dist/esm/learningPath.d.ts +64 -0
  198. package/dist/esm/learningPath.d.ts.map +1 -0
  199. package/dist/esm/learningPath.js +194 -0
  200. package/dist/esm/learningPath.js.map +1 -0
  201. package/dist/esm/logger.d.ts +19 -0
  202. package/dist/esm/logger.d.ts.map +1 -0
  203. package/dist/esm/logger.js +55 -0
  204. package/dist/esm/logger.js.map +1 -0
  205. package/dist/esm/microSkillsQuizes.d.ts +18 -0
  206. package/dist/esm/microSkillsQuizes.d.ts.map +1 -0
  207. package/dist/esm/microSkillsQuizes.js +48 -0
  208. package/dist/esm/microSkillsQuizes.js.map +1 -0
  209. package/dist/esm/quotas.d.ts +15 -0
  210. package/dist/esm/quotas.d.ts.map +1 -0
  211. package/dist/esm/quotas.js +45 -0
  212. package/dist/esm/quotas.js.map +1 -0
  213. package/dist/esm/role.d.ts +113 -0
  214. package/dist/esm/role.d.ts.map +1 -0
  215. package/dist/esm/role.js +346 -0
  216. package/dist/esm/role.js.map +1 -0
  217. package/dist/esm/roleTemplate.d.ts +73 -0
  218. package/dist/esm/roleTemplate.d.ts.map +1 -0
  219. package/dist/esm/roleTemplate.js +224 -0
  220. package/dist/esm/roleTemplate.js.map +1 -0
  221. package/dist/esm/security.d.ts +27 -0
  222. package/dist/esm/security.d.ts.map +1 -0
  223. package/dist/esm/security.js +72 -0
  224. package/dist/esm/security.js.map +1 -0
  225. package/dist/esm/skill.d.ts +141 -0
  226. package/dist/esm/skill.d.ts.map +1 -0
  227. package/dist/esm/skill.js +418 -0
  228. package/dist/esm/skill.js.map +1 -0
  229. package/dist/esm/skillAssessmentTestingSession.d.ts +49 -0
  230. package/dist/esm/skillAssessmentTestingSession.d.ts.map +1 -0
  231. package/dist/esm/skillAssessmentTestingSession.js +147 -0
  232. package/dist/esm/skillAssessmentTestingSession.js.map +1 -0
  233. package/dist/esm/skillAssessments.d.ts +49 -0
  234. package/dist/esm/skillAssessments.d.ts.map +1 -0
  235. package/dist/esm/skillAssessments.js +147 -0
  236. package/dist/esm/skillAssessments.js.map +1 -0
  237. package/dist/esm/skillTemplate.d.ts +87 -0
  238. package/dist/esm/skillTemplate.d.ts.map +1 -0
  239. package/dist/esm/skillTemplate.js +267 -0
  240. package/dist/esm/skillTemplate.js.map +1 -0
  241. package/dist/esm/talentTransfromation.d.ts +29 -0
  242. package/dist/esm/talentTransfromation.d.ts.map +1 -0
  243. package/dist/esm/talentTransfromation.js +93 -0
  244. package/dist/esm/talentTransfromation.js.map +1 -0
  245. package/dist/esm/teams.d.ts +85 -0
  246. package/dist/esm/teams.d.ts.map +1 -0
  247. package/dist/esm/teams.js +238 -0
  248. package/dist/esm/teams.js.map +1 -0
  249. package/dist/esm/tenants.d.ts +16 -0
  250. package/dist/esm/tenants.d.ts.map +1 -0
  251. package/dist/esm/tenants.js +50 -0
  252. package/dist/esm/tenants.js.map +1 -0
  253. package/dist/esm/trainingPlans.d.ts +92 -0
  254. package/dist/esm/trainingPlans.d.ts.map +1 -0
  255. package/dist/esm/trainingPlans.js +293 -0
  256. package/dist/esm/trainingPlans.js.map +1 -0
  257. package/dist/esm/trainingPlansProficiencyLevels.d.ts +32 -0
  258. package/dist/esm/trainingPlansProficiencyLevels.d.ts.map +1 -0
  259. package/dist/esm/trainingPlansProficiencyLevels.js +90 -0
  260. package/dist/esm/trainingPlansProficiencyLevels.js.map +1 -0
  261. package/dist/esm/userInformation.d.ts +29 -0
  262. package/dist/esm/userInformation.d.ts.map +1 -0
  263. package/dist/esm/userInformation.js +75 -0
  264. package/dist/esm/userInformation.js.map +1 -0
  265. package/dist/esm/users.d.ts +206 -0
  266. package/dist/esm/users.d.ts.map +1 -0
  267. package/dist/esm/users.js +663 -0
  268. package/dist/esm/users.js.map +1 -0
  269. package/dist/esm/utils.d.ts +14 -0
  270. package/dist/esm/utils.d.ts.map +1 -0
  271. package/dist/esm/utils.js +50 -0
  272. package/dist/esm/utils.js.map +1 -0
  273. package/package.json +9 -2
  274. package/. npmignore +0 -11
  275. package/.eslintrc.json +0 -14
  276. package/src/lib/actionNotifications.ts +0 -87
  277. package/src/lib/address.ts +0 -25
  278. package/src/lib/aiAssistant.ts +0 -190
  279. package/src/lib/avatar.ts +0 -38
  280. package/src/lib/axiosClient.ts +0 -97
  281. package/src/lib/config.ts +0 -80
  282. package/src/lib/constants.ts +0 -90
  283. package/src/lib/dashboard.ts +0 -83
  284. package/src/lib/departmentTrainingPlans.ts +0 -197
  285. package/src/lib/groups.ts +0 -327
  286. package/src/lib/integration.ts +0 -395
  287. package/src/lib/integrationConfiguration.ts +0 -108
  288. package/src/lib/integrations/contentGenerator.ts +0 -97
  289. package/src/lib/learningContent.ts +0 -522
  290. package/src/lib/learningPath.ts +0 -237
  291. package/src/lib/logger.ts +0 -69
  292. package/src/lib/microSkillsQuizes.ts +0 -66
  293. package/src/lib/quotas.ts +0 -55
  294. package/src/lib/role.ts +0 -438
  295. package/src/lib/roleTemplate.ts +0 -282
  296. package/src/lib/security.ts +0 -93
  297. package/src/lib/skill.ts +0 -532
  298. package/src/lib/skillAssessmentTestingSession.ts +0 -184
  299. package/src/lib/skillAssessments.ts +0 -184
  300. package/src/lib/skillTemplate.ts +0 -336
  301. package/src/lib/talentTransfromation.ts +0 -120
  302. package/src/lib/teams.ts +0 -316
  303. package/src/lib/tenants.ts +0 -63
  304. package/src/lib/trainingPlans.ts +0 -368
  305. package/src/lib/trainingPlansProficiencyLevels.ts +0 -124
  306. package/src/lib/userInformation.ts +0 -105
  307. package/src/lib/users.ts +0 -764
  308. package/src/lib/utils.ts +0 -51
  309. package/tsconfig.cjs.json +0 -9
  310. package/tsconfig.esm.json +0 -9
  311. package/tsconfig.json +0 -23
@@ -1,395 +0,0 @@
1
- import { AxiosError, AxiosResponse } from "axios";
2
- import { client, errorToString } from "./axiosClient";
3
- import axiosLib from "axios";
4
- import htmlParser from "node-html-parser";
5
- import htmlToText from "html2plaintext";
6
-
7
- interface IntegrationData {
8
- data: object;
9
- }
10
-
11
- interface IntegrationFilter {
12
- filter?: string[];
13
- type?: string;
14
- version: string;
15
- includeSupportedCapabilities: boolean;
16
- }
17
-
18
- interface ContentInformation {
19
- url: string;
20
- verb: string;
21
- }
22
-
23
- interface ContentInformationResponse {
24
- description: string;
25
- duration: number;
26
- icon: string;
27
- title: string;
28
- type: number;
29
- internal: boolean;
30
- }
31
-
32
- /**
33
- * Create integration and set information
34
- * @param {Object} data The new integration information
35
- * @param {String} token Authorization token
36
- */
37
- export const createIntegration = (
38
- data: object,
39
- token: string
40
- ): Promise<object> => {
41
- return new Promise((resolve, reject) => {
42
- const requestData: IntegrationData = {
43
- data: data,
44
- };
45
- const confirmationRequest = client.put("api/v1/integrations/", requestData, {
46
- headers: { authorization: token },
47
- });
48
- confirmationRequest
49
- .then((response : AxiosResponse) => {
50
- resolve(response.data);
51
- })
52
- .catch((error : AxiosError) => {
53
- reject(error);
54
- });
55
- });
56
- };
57
-
58
- /**
59
- * Delete integration
60
- * @param {String} id The id of the integration to be deleted
61
- * @param {String} token Authorization token
62
- */
63
- export const deleteIntegration = (
64
- id: string,
65
- token: string
66
- ): Promise<object> => {
67
- return new Promise((resolve, reject) => {
68
- const request = client.delete(`api/v1/integrations/`, {
69
- headers: { authorization: token },
70
- data: {
71
- id: id,
72
- },
73
- });
74
- request
75
- .then((response : AxiosResponse) => {
76
- resolve(response.data);
77
- })
78
- .catch((error : AxiosError) => {
79
- reject(error);
80
- });
81
- });
82
- };
83
-
84
- /**
85
- * Discard the integration draft changes
86
- * @param {String} id The id of the role template to be deleted
87
- * @param {String} token Authorization token
88
- */
89
- export const discardIntegrationChanges = (
90
- id: string,
91
- token: string
92
- ): Promise<object> => {
93
- return new Promise((resolve, reject) => {
94
- const data = {};
95
- const request = client.get(`api/v1/integrations/discard/${id}`, {
96
- headers: { authorization: token },
97
- data: data,
98
- });
99
- request
100
- .then((response : AxiosResponse) => {
101
- resolve(response.data);
102
- })
103
- .catch((error : AxiosError) => {
104
- reject(error);
105
- });
106
- });
107
- };
108
-
109
- /**
110
- * Get integration information
111
- * @param {String} id The id of the integration
112
- * @param {String} version The version of the integration to be received
113
- * @param {String} token Authorization token
114
- */
115
- export const getIntegrationInformationById = (
116
- id: string,
117
- version: string,
118
- token: string
119
- ): Promise<object> => {
120
- return new Promise((resolve, reject) => {
121
- const confirmationRequest = client.get(
122
- `api/v1/integrations/${id}/${version}`,
123
- {
124
- headers: { authorization: token },
125
- }
126
- );
127
- confirmationRequest
128
- .then((response : AxiosResponse) => {
129
- resolve(response.data);
130
- })
131
- .catch((error : AxiosError) => {
132
- reject(error);
133
- });
134
- });
135
- };
136
-
137
- /**
138
- * Get integrations list
139
- * @param {Array<String>} filter The filter used to select the integration
140
- * @param {String} type The type of the integration
141
- * @param {String} version The version to be retrieved
142
- * @param {Boolean} includeSupportedCapabilities If true, the supported capabilities will be included in the response
143
- * @param {String} token Authorization token
144
- */
145
- export const getIntegrationsList = (
146
- filter: string[],
147
- type: string,
148
- version: string,
149
- includeSupportedCapabilities: boolean,
150
- token: string
151
- ): Promise<object> => {
152
- return new Promise((resolve, reject) => {
153
- const requestData: IntegrationFilter = {
154
- includeSupportedCapabilities: includeSupportedCapabilities,
155
- version: version,
156
- };
157
- if (filter) requestData.filter = filter;
158
- if (type) requestData.type = type;
159
- const confirmationRequest = client.post(`api/v1/integrations`, requestData, {
160
- headers: { authorization: token },
161
- });
162
- confirmationRequest
163
- .then((response : AxiosResponse) => {
164
- resolve(response.data);
165
- })
166
- .catch((error : AxiosError) => {
167
- reject(error);
168
- });
169
- });
170
- };
171
-
172
- /**
173
- * Get content information by Url
174
- * @param {String} url The training url
175
- * @param {String} verb The verb
176
- * @param {String} token Authorization token
177
- */
178
- export const getContentInformationByUrl = (
179
- url: string,
180
- verb: string,
181
- token: string
182
- ): Promise<object> => {
183
- return new Promise((resolve, reject) => {
184
- const requestData: ContentInformation = {
185
- url: url,
186
- verb: verb,
187
- };
188
- const confirmationRequest = client.post(
189
- `api/v1/contentproviders/getcontentinformationbyurl`,
190
- requestData,
191
- {
192
- headers: { authorization: token },
193
- }
194
- );
195
- confirmationRequest
196
- .then((response : AxiosResponse) => {
197
- resolve(response.data);
198
- })
199
- .catch((error : AxiosError) => {
200
- reject(error);
201
- });
202
- });
203
- };
204
-
205
- /**
206
- * Get content information by url from the browser instead of the backend
207
- * @param {String} url
208
- * @returns {Promise<ContentInformationResponse>}
209
- */
210
- export const getContentInformationByUrlFromBrowser = (
211
- url: string
212
- ): Promise<ContentInformationResponse> => {
213
- return new Promise((resolve, reject) => {
214
- const domain = new URL(url);
215
- const instance = axiosLib.create({
216
- baseURL: domain.origin,
217
- });
218
- const confirmationRequest = instance.get(domain.pathname, {
219
- headers: {
220
- "Access-Control-Allow-Origin": "*",
221
- "Access-Control-Allow-Headers":
222
- "Authorization, Origin, X-Requested-With, Content-Type, Accept",
223
- Accept:
224
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
225
- "Accept-Encoding": "gzip, deflate, br",
226
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE",
227
- "User-Agent": "Mozilla/5.0",
228
- },
229
- });
230
- confirmationRequest
231
- .then((response : AxiosResponse) => {
232
- //get the reading time
233
- const getReadingTime = (text: string): number => {
234
- const wpm = 225;
235
- const words = text.trim().split(/\s+/).length;
236
- return Math.ceil(words / wpm);
237
- };
238
-
239
- const document = htmlParser.parse(response.data);
240
- const duration = getReadingTime(htmlToText(response.data));
241
- const titleTag = document.querySelector("title");
242
- const title = titleTag ? titleTag.rawText : "";
243
- const description = "";
244
- const descriptionEl = document.querySelector("meta");
245
- try {
246
- if (descriptionEl) {
247
- const descriptionParentNode = descriptionEl.parentNode;
248
- if (descriptionEl) {
249
- const descriptionChildNodes = descriptionParentNode.childNodes;
250
- if (descriptionChildNodes) {
251
- //TODO: Code needs fixing
252
- // const descriptionRawAttr = descriptionChildNodes.find((element) => {
253
- // return element.rawAttrs && element.rawAttrs.includes("description");
254
- // });
255
- // if (descriptionRawAttr) {
256
- // const element = descriptionRawAttr as any; // Cast to any to access rawAttrs
257
- // const descriptionContent = element.rawAttrs.substring(
258
- // element.rawAttrs.indexOf("content=") + 8
259
- // );
260
- // description = descriptionContent.substring(
261
- // 0,
262
- // descriptionContent.length - 1
263
- // );
264
- // }
265
- }
266
- }
267
- }
268
- } finally {
269
- resolve({
270
- description: description,
271
- duration: duration,
272
- icon: `http://www.google.com/s2/favicons?sz=128&domain_url=${domain.hostname}`,
273
- title: title ? title.trim() : url,
274
- type: 0,
275
- internal: true,
276
- });
277
- }
278
- })
279
- .catch((error : AxiosError) => {
280
- reject(new Error(errorToString(error)));
281
- });
282
- });
283
- };
284
-
285
- /**
286
- * Get enabled content providers
287
- * @param {String} userId
288
- * @param {String} token Authorization token
289
- */
290
- export const getEnabledContentProviders = (
291
- userId: string,
292
- token: string
293
- ): Promise<object> => {
294
- return new Promise((resolve, reject) => {
295
- const confirmationRequest = client.get(
296
- `api/v1/contentproviders/getenabledcontentproviders/${userId}`,
297
- {
298
- headers: { authorization: token },
299
- }
300
- );
301
- confirmationRequest
302
- .then((response : AxiosResponse) => {
303
- resolve(response.data);
304
- })
305
- .catch((error : AxiosError) => {
306
- reject(error);
307
- });
308
- });
309
- };
310
-
311
- /**
312
- * Publish integration
313
- * @param {String} id The id of the integration to be published
314
- * @param {String} token Authorization token
315
- */
316
- export const publishIntegration = (
317
- id: string,
318
- token: string
319
- ): Promise<object> => {
320
- return new Promise((resolve, reject) => {
321
- const confirmationRequest = client.post(
322
- `api/v1/integrations/publish/${id}`,
323
- {},
324
- {
325
- headers: { authorization: token },
326
- }
327
- );
328
- confirmationRequest
329
- .then((response : AxiosResponse) => {
330
- resolve(response.data);
331
- })
332
- .catch((error : AxiosError) => {
333
- reject(error);
334
- });
335
- });
336
- };
337
-
338
- /**
339
- * Set integration information
340
- * @param {String} id The id of the integration to be updated
341
- * @param {Object} data Data used to update the integration
342
- * @param {String} token Authorization token
343
- */
344
- export const setIntegrationInformation = (
345
- id: string,
346
- data: object,
347
- token: string
348
- ): Promise<object> => {
349
- return new Promise((resolve, reject) => {
350
- const requestData: IntegrationData = {
351
- data: data,
352
- };
353
- const confirmationRequest = client.post(
354
- `api/v1/integrations/${id}`,
355
- requestData,
356
- {
357
- headers: { authorization: token },
358
- }
359
- );
360
- confirmationRequest
361
- .then((response : AxiosResponse) => {
362
- resolve(response.data);
363
- })
364
- .catch((error : AxiosError) => {
365
- reject(error);
366
- });
367
- });
368
- };
369
-
370
- /**
371
- * Set default integration
372
- * @param {String} id The id of the integration to be set as default
373
- * @param {String} token Authorization token
374
- */
375
- export const setDefaultIntegration = (
376
- id: string,
377
- token: string
378
- ): Promise<object> => {
379
- return new Promise((resolve, reject) => {
380
- const confirmationRequest = client.post(
381
- `api/v1/integrations/${id}/default`,
382
- "",
383
- {
384
- headers: { authorization: token },
385
- }
386
- );
387
- confirmationRequest
388
- .then((response : AxiosResponse) => {
389
- resolve(response.data);
390
- })
391
- .catch((error : AxiosError) => {
392
- reject(error);
393
- });
394
- });
395
- };
@@ -1,108 +0,0 @@
1
- import { AxiosError, AxiosResponse } from "axios";
2
- import { client } from "./axiosClient";
3
-
4
- /**
5
- * Get the integration configuration
6
- * @param {Array<String>} ids
7
- * @param {Number} type
8
- * @param {String} token Authorization token
9
- * @returns {Promise<object>}
10
- */
11
- export const getIntegrationsConfiguration = (
12
- ids: string[],
13
- type: number,
14
- token: string
15
- ): Promise<object> => {
16
- return new Promise((resolve, reject) => {
17
- const requestData: { type: number; ids?: string[] } = { type: type };
18
- if (ids) requestData.ids = ids;
19
- const confirmationRequest = client.post(
20
- "api/v1/integrationsconfiguration",
21
- requestData,
22
- {
23
- headers: { authorization: token },
24
- }
25
- );
26
- confirmationRequest
27
- .then((response : AxiosResponse) => {
28
- resolve(response.data);
29
- })
30
- .catch((error : AxiosError) => {
31
- reject(error);
32
- });
33
- });
34
- };
35
-
36
- /**
37
- * Save integration configuration
38
- * @param {String} id The id of the integration configuration to be updated
39
- * @param {Number} type The type of configuration
40
- * @param {Object} configuration Data used to update the integration configuration
41
- * @param {String} token Authorization token
42
- * @returns {Promise<object>}
43
- */
44
- export const saveIntegrationConfiguration = (
45
- id: string,
46
- type: number,
47
- configuration: object,
48
- token: string
49
- ): Promise<object> => {
50
- return new Promise((resolve, reject) => {
51
- const requestData = {
52
- id: id,
53
- configuration: configuration,
54
- type: type,
55
- };
56
- const confirmationRequest = client.put(
57
- `api/v1/integrationsconfiguration`,
58
- requestData,
59
- {
60
- headers: { authorization: token },
61
- }
62
- );
63
- confirmationRequest
64
- .then((response : AxiosResponse) => {
65
- resolve(response.data);
66
- })
67
- .catch((error : AxiosError) => {
68
- reject(error);
69
- });
70
- });
71
- };
72
-
73
- /**
74
- * Test integration configuration
75
- * @param {String} id The id of the integration to be updated
76
- * @param {String} type The type of configuration
77
- * @param {Object} configuration Configuration to be tested
78
- * @param {String} token Authorization token
79
- * @returns {Promise<object>}
80
- */
81
- export const testIntegrationConfiguration = (
82
- id: string,
83
- type: string,
84
- configuration: object,
85
- token: string
86
- ): Promise<object> => {
87
- return new Promise((resolve, reject) => {
88
- const requestData = {
89
- id: id,
90
- configuration: configuration,
91
- type: type,
92
- };
93
- const confirmationRequest = client.post(
94
- `api/v1/integrationsconfiguration/testConfiguration`,
95
- requestData,
96
- {
97
- headers: { authorization: token },
98
- }
99
- );
100
- confirmationRequest
101
- .then((response : AxiosResponse) => {
102
- resolve(response.data);
103
- })
104
- .catch((error : AxiosError) => {
105
- reject(error);
106
- });
107
- });
108
- };
@@ -1,97 +0,0 @@
1
- import { AxiosError, AxiosResponse } from "axios";
2
- import { client } from "../axiosClient";
3
-
4
- interface GenerateContentData {
5
- data: string[];
6
- contentType: string;
7
- integrationId?: string;
8
- }
9
-
10
- interface GenerateContentAsyncData {
11
- id: string;
12
- data: object;
13
- contentType: string;
14
- elementType: string;
15
- integrationId?: string;
16
- comments: string;
17
- }
18
-
19
- /**
20
- * Generate content
21
- * @param {Array<String>} data
22
- * @param {String} contentType
23
- * @param {String} integrationId
24
- * @param {String} token
25
- * @returns {Promise<object>}
26
- */
27
- export const generateContent = (
28
- data: string[],
29
- contentType: string,
30
- integrationId: string,
31
- token: string
32
- ): Promise<object> => {
33
- return new Promise((resolve, reject) => {
34
- const data_: GenerateContentData = {
35
- data: data,
36
- contentType: contentType,
37
- };
38
- if (integrationId) data_.integrationId = integrationId;
39
- const request = client.post(`api/v1/contentgenerators/generate`, data_, {
40
- headers: { authorization: token },
41
- });
42
- request
43
- .then((response : AxiosResponse) => {
44
- resolve(response.data);
45
- })
46
- .catch((error : AxiosError) => {
47
- reject(error);
48
- });
49
- });
50
- };
51
-
52
- /**
53
- * Generate content async
54
- * @param {String} id
55
- * @param {Object} data
56
- * @param {String} contentType
57
- * @param {String} elementType
58
- * @param {String} integrationId
59
- * @param {String} comments
60
- * @param {String} token
61
- * @returns {Promise<object>}
62
- */
63
- export const generateContentAsync = (
64
- id: string,
65
- data: object,
66
- contentType: string,
67
- elementType: string,
68
- integrationId: string,
69
- comments: string,
70
- token: string
71
- ): Promise<object> => {
72
- return new Promise((resolve, reject) => {
73
- const data_: GenerateContentAsyncData = {
74
- id: id,
75
- data: data,
76
- comments: comments,
77
- contentType: contentType,
78
- elementType: elementType,
79
- };
80
- if (integrationId) data_.integrationId = integrationId;
81
- const request = client.post(
82
- `api/v1/contentgenerators/generateasync`,
83
- data_,
84
- {
85
- headers: { authorization: token },
86
- }
87
- );
88
- request
89
- .then((response : AxiosResponse) => {
90
- resolve(response.data);
91
- })
92
- .catch((error : AxiosError) => {
93
- reject(error);
94
- });
95
- });
96
- };
97
-