@emilgroup/tenant-sdk-node 1.0.0-beta.0

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 (313) hide show
  1. package/.openapi-generator/FILES +109 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +68 -0
  5. package/api/alerts-api.ts +860 -0
  6. package/api/custom-schema-api.ts +580 -0
  7. package/api/dashboard-api.ts +792 -0
  8. package/api/data-report-executor-api.ts +183 -0
  9. package/api/permissions-api.ts +307 -0
  10. package/api/reports-api.ts +860 -0
  11. package/api/roles-api.ts +564 -0
  12. package/api/scenario-analysis-api.ts +977 -0
  13. package/api/settings-api.ts +478 -0
  14. package/api/tariff-comparisons-api.ts +381 -0
  15. package/api/tenants-api.ts +514 -0
  16. package/api/user-subscription-api.ts +191 -0
  17. package/api/users-api.ts +1645 -0
  18. package/api.ts +60 -0
  19. package/base.ts +283 -0
  20. package/common.ts +199 -0
  21. package/configuration.ts +109 -0
  22. package/dist/api/alerts-api.d.ts +479 -0
  23. package/dist/api/alerts-api.js +752 -0
  24. package/dist/api/custom-schema-api.d.ts +329 -0
  25. package/dist/api/custom-schema-api.js +548 -0
  26. package/dist/api/dashboard-api.d.ts +434 -0
  27. package/dist/api/dashboard-api.js +724 -0
  28. package/dist/api/data-report-executor-api.d.ts +106 -0
  29. package/dist/api/data-report-executor-api.js +234 -0
  30. package/dist/api/permissions-api.d.ts +172 -0
  31. package/dist/api/permissions-api.js +331 -0
  32. package/dist/api/reports-api.d.ts +479 -0
  33. package/dist/api/reports-api.js +752 -0
  34. package/dist/api/roles-api.d.ts +301 -0
  35. package/dist/api/roles-api.js +578 -0
  36. package/dist/api/scenario-analysis-api.d.ts +529 -0
  37. package/dist/api/scenario-analysis-api.js +895 -0
  38. package/dist/api/settings-api.d.ts +261 -0
  39. package/dist/api/settings-api.js +509 -0
  40. package/dist/api/tariff-comparisons-api.d.ts +206 -0
  41. package/dist/api/tariff-comparisons-api.js +409 -0
  42. package/dist/api/tenants-api.d.ts +282 -0
  43. package/dist/api/tenants-api.js +514 -0
  44. package/dist/api/user-subscription-api.d.ts +111 -0
  45. package/dist/api/user-subscription-api.js +236 -0
  46. package/dist/api/users-api.d.ts +884 -0
  47. package/dist/api/users-api.js +1456 -0
  48. package/dist/api.d.ts +28 -0
  49. package/dist/api.js +48 -0
  50. package/dist/base.d.ts +76 -0
  51. package/dist/base.js +392 -0
  52. package/dist/common.d.ts +92 -0
  53. package/dist/common.js +277 -0
  54. package/dist/configuration.d.ts +90 -0
  55. package/dist/configuration.js +44 -0
  56. package/dist/index.d.ts +15 -0
  57. package/dist/index.js +35 -0
  58. package/dist/models/alert-class.d.ts +90 -0
  59. package/dist/models/alert-class.js +15 -0
  60. package/dist/models/assign-user-roles-request-dto.d.ts +30 -0
  61. package/dist/models/assign-user-roles-request-dto.js +15 -0
  62. package/dist/models/assign-user-roles-response-class.d.ts +25 -0
  63. package/dist/models/assign-user-roles-response-class.js +15 -0
  64. package/dist/models/batch-delete-request-dto.d.ts +24 -0
  65. package/dist/models/batch-delete-request-dto.js +15 -0
  66. package/dist/models/compare-tariffs-request-dto.d.ts +37 -0
  67. package/dist/models/compare-tariffs-request-dto.js +22 -0
  68. package/dist/models/compare-tariffs-response-class.d.ts +30 -0
  69. package/dist/models/compare-tariffs-response-class.js +15 -0
  70. package/dist/models/condition-dto.d.ts +43 -0
  71. package/dist/models/condition-dto.js +22 -0
  72. package/dist/models/create-alert-request-dto.d.ts +79 -0
  73. package/dist/models/create-alert-request-dto.js +27 -0
  74. package/dist/models/create-alert-response-class.d.ts +25 -0
  75. package/dist/models/create-alert-response-class.js +15 -0
  76. package/dist/models/create-custom-schema-request-dto.d.ts +44 -0
  77. package/dist/models/create-custom-schema-request-dto.js +22 -0
  78. package/dist/models/create-custom-schema-response-class.d.ts +25 -0
  79. package/dist/models/create-custom-schema-response-class.js +15 -0
  80. package/dist/models/create-dashboard-request-dto.d.ts +70 -0
  81. package/dist/models/create-dashboard-request-dto.js +29 -0
  82. package/dist/models/create-dashboard-response-class.d.ts +25 -0
  83. package/dist/models/create-dashboard-response-class.js +15 -0
  84. package/dist/models/create-permission-request-dto.d.ts +48 -0
  85. package/dist/models/create-permission-request-dto.js +15 -0
  86. package/dist/models/create-permission-response-class.d.ts +25 -0
  87. package/dist/models/create-permission-response-class.js +15 -0
  88. package/dist/models/create-report-request-dto.d.ts +49 -0
  89. package/dist/models/create-report-request-dto.js +22 -0
  90. package/dist/models/create-report-response-class.d.ts +25 -0
  91. package/dist/models/create-report-response-class.js +15 -0
  92. package/dist/models/create-role-request-dto.d.ts +36 -0
  93. package/dist/models/create-role-request-dto.js +15 -0
  94. package/dist/models/create-role-response-class.d.ts +25 -0
  95. package/dist/models/create-role-response-class.js +15 -0
  96. package/dist/models/create-scenario-analysis-request-dto.d.ts +74 -0
  97. package/dist/models/create-scenario-analysis-request-dto.js +22 -0
  98. package/dist/models/create-scenario-analysis-response-class.d.ts +25 -0
  99. package/dist/models/create-scenario-analysis-response-class.js +15 -0
  100. package/dist/models/create-tenant-request-dto.d.ts +56 -0
  101. package/dist/models/create-tenant-request-dto.js +15 -0
  102. package/dist/models/create-tenant-response-class.d.ts +42 -0
  103. package/dist/models/create-tenant-response-class.js +15 -0
  104. package/dist/models/custom-field-dto.d.ts +68 -0
  105. package/dist/models/custom-field-dto.js +23 -0
  106. package/dist/models/custom-schema-class.d.ts +66 -0
  107. package/dist/models/custom-schema-class.js +15 -0
  108. package/dist/models/dashboard-class.d.ts +78 -0
  109. package/dist/models/dashboard-class.js +15 -0
  110. package/dist/models/dbconfig-dto.d.ts +48 -0
  111. package/dist/models/dbconfig-dto.js +15 -0
  112. package/dist/models/disable-user-response-class.d.ts +25 -0
  113. package/dist/models/disable-user-response-class.js +15 -0
  114. package/dist/models/disable-users-request-dto.d.ts +24 -0
  115. package/dist/models/disable-users-request-dto.js +15 -0
  116. package/dist/models/enable-user-response-class.d.ts +25 -0
  117. package/dist/models/enable-user-response-class.js +15 -0
  118. package/dist/models/enable-users-request-dto.d.ts +24 -0
  119. package/dist/models/enable-users-request-dto.js +15 -0
  120. package/dist/models/get-alert-response-class.d.ts +25 -0
  121. package/dist/models/get-alert-response-class.js +15 -0
  122. package/dist/models/get-custom-schema-response-class.d.ts +25 -0
  123. package/dist/models/get-custom-schema-response-class.js +15 -0
  124. package/dist/models/get-dashboard-response-class.d.ts +25 -0
  125. package/dist/models/get-dashboard-response-class.js +15 -0
  126. package/dist/models/get-embedded-url-response-class.d.ts +24 -0
  127. package/dist/models/get-embedded-url-response-class.js +15 -0
  128. package/dist/models/get-report-response-class.d.ts +25 -0
  129. package/dist/models/get-report-response-class.js +15 -0
  130. package/dist/models/get-role-response-class.d.ts +25 -0
  131. package/dist/models/get-role-response-class.js +15 -0
  132. package/dist/models/get-scenario-analysis-response-class.d.ts +25 -0
  133. package/dist/models/get-scenario-analysis-response-class.js +15 -0
  134. package/dist/models/get-user-response-class.d.ts +25 -0
  135. package/dist/models/get-user-response-class.js +15 -0
  136. package/dist/models/index.d.ts +83 -0
  137. package/dist/models/index.js +99 -0
  138. package/dist/models/invite-class.d.ts +54 -0
  139. package/dist/models/invite-class.js +15 -0
  140. package/dist/models/invite-user-request-dto.d.ts +30 -0
  141. package/dist/models/invite-user-request-dto.js +15 -0
  142. package/dist/models/invite-user-response-class.d.ts +25 -0
  143. package/dist/models/invite-user-response-class.js +15 -0
  144. package/dist/models/invite-users-request-dto.d.ts +30 -0
  145. package/dist/models/invite-users-request-dto.js +15 -0
  146. package/dist/models/list-alert-history-response-class.d.ts +30 -0
  147. package/dist/models/list-alert-history-response-class.js +15 -0
  148. package/dist/models/list-alerts-response-class.d.ts +30 -0
  149. package/dist/models/list-alerts-response-class.js +15 -0
  150. package/dist/models/list-channels-response-class.d.ts +24 -0
  151. package/dist/models/list-channels-response-class.js +15 -0
  152. package/dist/models/list-custom-schemas-response-class.d.ts +30 -0
  153. package/dist/models/list-custom-schemas-response-class.js +15 -0
  154. package/dist/models/list-dashboards-response-class.d.ts +30 -0
  155. package/dist/models/list-dashboards-response-class.js +15 -0
  156. package/dist/models/list-insurance-companies-response-class.d.ts +24 -0
  157. package/dist/models/list-insurance-companies-response-class.js +15 -0
  158. package/dist/models/list-invites-response-class.d.ts +30 -0
  159. package/dist/models/list-invites-response-class.js +15 -0
  160. package/dist/models/list-permissions-response-class.d.ts +30 -0
  161. package/dist/models/list-permissions-response-class.js +15 -0
  162. package/dist/models/list-report-history-response-class.d.ts +30 -0
  163. package/dist/models/list-report-history-response-class.js +15 -0
  164. package/dist/models/list-reports-response-class.d.ts +30 -0
  165. package/dist/models/list-reports-response-class.js +15 -0
  166. package/dist/models/list-roles-response-class.d.ts +30 -0
  167. package/dist/models/list-roles-response-class.js +15 -0
  168. package/dist/models/list-scenario-analyses-response-class.d.ts +30 -0
  169. package/dist/models/list-scenario-analyses-response-class.js +15 -0
  170. package/dist/models/list-scenario-analysis-dates-response-class.d.ts +24 -0
  171. package/dist/models/list-scenario-analysis-dates-response-class.js +15 -0
  172. package/dist/models/list-tariff-insurance-companies-response-class.d.ts +24 -0
  173. package/dist/models/list-tariff-insurance-companies-response-class.js +15 -0
  174. package/dist/models/list-tariffs-response-class.d.ts +24 -0
  175. package/dist/models/list-tariffs-response-class.js +15 -0
  176. package/dist/models/list-users-response-class.d.ts +30 -0
  177. package/dist/models/list-users-response-class.js +15 -0
  178. package/dist/models/manage-subscription-request-dto.d.ts +24 -0
  179. package/dist/models/manage-subscription-request-dto.js +15 -0
  180. package/dist/models/manage-subscription-response-class.d.ts +25 -0
  181. package/dist/models/manage-subscription-response-class.js +15 -0
  182. package/dist/models/permission-class.d.ts +66 -0
  183. package/dist/models/permission-class.js +15 -0
  184. package/dist/models/report-class.d.ts +66 -0
  185. package/dist/models/report-class.js +15 -0
  186. package/dist/models/role-class.d.ts +60 -0
  187. package/dist/models/role-class.js +15 -0
  188. package/dist/models/run-data-report-request-dto.d.ts +30 -0
  189. package/dist/models/run-data-report-request-dto.js +15 -0
  190. package/dist/models/run-data-report-response-class.d.ts +24 -0
  191. package/dist/models/run-data-report-response-class.js +15 -0
  192. package/dist/models/scenario-analysis-class.d.ts +108 -0
  193. package/dist/models/scenario-analysis-class.js +15 -0
  194. package/dist/models/set-user-setting-request-dto.d.ts +30 -0
  195. package/dist/models/set-user-setting-request-dto.js +15 -0
  196. package/dist/models/subscription-class.d.ts +60 -0
  197. package/dist/models/subscription-class.js +15 -0
  198. package/dist/models/tenant-admin-user-dto.d.ts +42 -0
  199. package/dist/models/tenant-admin-user-dto.js +15 -0
  200. package/dist/models/update-alert-request-dto.d.ts +72 -0
  201. package/dist/models/update-alert-request-dto.js +21 -0
  202. package/dist/models/update-alert-response-class.d.ts +25 -0
  203. package/dist/models/update-alert-response-class.js +15 -0
  204. package/dist/models/update-custom-schema-request-dto.d.ts +44 -0
  205. package/dist/models/update-custom-schema-request-dto.js +22 -0
  206. package/dist/models/update-custom-schema-response-class.d.ts +25 -0
  207. package/dist/models/update-custom-schema-response-class.js +15 -0
  208. package/dist/models/update-dashboard-request-dto.d.ts +76 -0
  209. package/dist/models/update-dashboard-request-dto.js +29 -0
  210. package/dist/models/update-dashboard-response-class.d.ts +25 -0
  211. package/dist/models/update-dashboard-response-class.js +15 -0
  212. package/dist/models/update-report-request-dto.d.ts +55 -0
  213. package/dist/models/update-report-request-dto.js +22 -0
  214. package/dist/models/update-report-response-class.d.ts +25 -0
  215. package/dist/models/update-report-response-class.js +15 -0
  216. package/dist/models/update-role-request-dto.d.ts +42 -0
  217. package/dist/models/update-role-request-dto.js +15 -0
  218. package/dist/models/update-role-response-class.d.ts +25 -0
  219. package/dist/models/update-role-response-class.js +15 -0
  220. package/dist/models/update-scenario-analysis-request-dto.d.ts +74 -0
  221. package/dist/models/update-scenario-analysis-request-dto.js +22 -0
  222. package/dist/models/update-scenario-analysis-response-class.d.ts +25 -0
  223. package/dist/models/update-scenario-analysis-response-class.js +15 -0
  224. package/dist/models/user-class.d.ts +90 -0
  225. package/dist/models/user-class.js +15 -0
  226. package/git_push.sh +57 -0
  227. package/index.ts +19 -0
  228. package/models/alert-class.ts +96 -0
  229. package/models/assign-user-roles-request-dto.ts +36 -0
  230. package/models/assign-user-roles-response-class.ts +31 -0
  231. package/models/batch-delete-request-dto.ts +30 -0
  232. package/models/compare-tariffs-request-dto.ts +46 -0
  233. package/models/compare-tariffs-response-class.ts +36 -0
  234. package/models/condition-dto.ts +52 -0
  235. package/models/create-alert-request-dto.ts +89 -0
  236. package/models/create-alert-response-class.ts +31 -0
  237. package/models/create-custom-schema-request-dto.ts +53 -0
  238. package/models/create-custom-schema-response-class.ts +31 -0
  239. package/models/create-dashboard-request-dto.ts +81 -0
  240. package/models/create-dashboard-response-class.ts +31 -0
  241. package/models/create-permission-request-dto.ts +54 -0
  242. package/models/create-permission-response-class.ts +31 -0
  243. package/models/create-report-request-dto.ts +58 -0
  244. package/models/create-report-response-class.ts +31 -0
  245. package/models/create-role-request-dto.ts +42 -0
  246. package/models/create-role-response-class.ts +31 -0
  247. package/models/create-scenario-analysis-request-dto.ts +83 -0
  248. package/models/create-scenario-analysis-response-class.ts +31 -0
  249. package/models/create-tenant-request-dto.ts +62 -0
  250. package/models/create-tenant-response-class.ts +48 -0
  251. package/models/custom-field-dto.ts +77 -0
  252. package/models/custom-schema-class.ts +72 -0
  253. package/models/dashboard-class.ts +84 -0
  254. package/models/dbconfig-dto.ts +54 -0
  255. package/models/disable-user-response-class.ts +31 -0
  256. package/models/disable-users-request-dto.ts +30 -0
  257. package/models/enable-user-response-class.ts +31 -0
  258. package/models/enable-users-request-dto.ts +30 -0
  259. package/models/get-alert-response-class.ts +31 -0
  260. package/models/get-custom-schema-response-class.ts +31 -0
  261. package/models/get-dashboard-response-class.ts +31 -0
  262. package/models/get-embedded-url-response-class.ts +30 -0
  263. package/models/get-report-response-class.ts +31 -0
  264. package/models/get-role-response-class.ts +31 -0
  265. package/models/get-scenario-analysis-response-class.ts +31 -0
  266. package/models/get-user-response-class.ts +31 -0
  267. package/models/index.ts +83 -0
  268. package/models/invite-class.ts +60 -0
  269. package/models/invite-user-request-dto.ts +36 -0
  270. package/models/invite-user-response-class.ts +31 -0
  271. package/models/invite-users-request-dto.ts +36 -0
  272. package/models/list-alert-history-response-class.ts +36 -0
  273. package/models/list-alerts-response-class.ts +36 -0
  274. package/models/list-channels-response-class.ts +30 -0
  275. package/models/list-custom-schemas-response-class.ts +36 -0
  276. package/models/list-dashboards-response-class.ts +36 -0
  277. package/models/list-insurance-companies-response-class.ts +30 -0
  278. package/models/list-invites-response-class.ts +36 -0
  279. package/models/list-permissions-response-class.ts +36 -0
  280. package/models/list-report-history-response-class.ts +36 -0
  281. package/models/list-reports-response-class.ts +36 -0
  282. package/models/list-roles-response-class.ts +36 -0
  283. package/models/list-scenario-analyses-response-class.ts +36 -0
  284. package/models/list-scenario-analysis-dates-response-class.ts +30 -0
  285. package/models/list-tariff-insurance-companies-response-class.ts +30 -0
  286. package/models/list-tariffs-response-class.ts +30 -0
  287. package/models/list-users-response-class.ts +36 -0
  288. package/models/manage-subscription-request-dto.ts +30 -0
  289. package/models/manage-subscription-response-class.ts +31 -0
  290. package/models/permission-class.ts +72 -0
  291. package/models/report-class.ts +72 -0
  292. package/models/role-class.ts +66 -0
  293. package/models/run-data-report-request-dto.ts +36 -0
  294. package/models/run-data-report-response-class.ts +30 -0
  295. package/models/scenario-analysis-class.ts +114 -0
  296. package/models/set-user-setting-request-dto.ts +36 -0
  297. package/models/subscription-class.ts +66 -0
  298. package/models/tenant-admin-user-dto.ts +48 -0
  299. package/models/update-alert-request-dto.ts +81 -0
  300. package/models/update-alert-response-class.ts +31 -0
  301. package/models/update-custom-schema-request-dto.ts +53 -0
  302. package/models/update-custom-schema-response-class.ts +31 -0
  303. package/models/update-dashboard-request-dto.ts +87 -0
  304. package/models/update-dashboard-response-class.ts +31 -0
  305. package/models/update-report-request-dto.ts +64 -0
  306. package/models/update-report-response-class.ts +31 -0
  307. package/models/update-role-request-dto.ts +48 -0
  308. package/models/update-role-response-class.ts +31 -0
  309. package/models/update-scenario-analysis-request-dto.ts +83 -0
  310. package/models/update-scenario-analysis-response-class.ts +31 -0
  311. package/models/user-class.ts +96 -0
  312. package/package.json +29 -0
  313. package/tsconfig.json +22 -0
package/dist/api.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * EMIL Tenant Service
3
+ * The EMIL TenantService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export * from './api/alerts-api';
13
+ export * from './api/custom-schema-api';
14
+ export * from './api/dashboard-api';
15
+ export * from './api/data-report-executor-api';
16
+ export * from './api/permissions-api';
17
+ export * from './api/reports-api';
18
+ export * from './api/roles-api';
19
+ export * from './api/scenario-analysis-api';
20
+ export * from './api/settings-api';
21
+ export * from './api/tariff-comparisons-api';
22
+ export * from './api/tenants-api';
23
+ export * from './api/user-subscription-api';
24
+ export * from './api/users-api';
25
+ export declare enum Environment {
26
+ Production = "https://apiv2.emil.de",
27
+ Test = "https://apiv2-test.emil.de"
28
+ }
package/dist/api.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL Tenant Service
6
+ * The EMIL TenantService API description
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.Environment = void 0;
31
+ __exportStar(require("./api/alerts-api"), exports);
32
+ __exportStar(require("./api/custom-schema-api"), exports);
33
+ __exportStar(require("./api/dashboard-api"), exports);
34
+ __exportStar(require("./api/data-report-executor-api"), exports);
35
+ __exportStar(require("./api/permissions-api"), exports);
36
+ __exportStar(require("./api/reports-api"), exports);
37
+ __exportStar(require("./api/roles-api"), exports);
38
+ __exportStar(require("./api/scenario-analysis-api"), exports);
39
+ __exportStar(require("./api/settings-api"), exports);
40
+ __exportStar(require("./api/tariff-comparisons-api"), exports);
41
+ __exportStar(require("./api/tenants-api"), exports);
42
+ __exportStar(require("./api/user-subscription-api"), exports);
43
+ __exportStar(require("./api/users-api"), exports);
44
+ var Environment;
45
+ (function (Environment) {
46
+ Environment["Production"] = "https://apiv2.emil.de";
47
+ Environment["Test"] = "https://apiv2-test.emil.de";
48
+ })(Environment = exports.Environment || (exports.Environment = {}));
package/dist/base.d.ts ADDED
@@ -0,0 +1,76 @@
1
+ /**
2
+ * EMIL Tenant Service
3
+ * The EMIL TenantService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { Configuration } from "./configuration";
13
+ import { AxiosInstance, AxiosRequestConfig } from 'axios';
14
+ export declare const BASE_PATH: string;
15
+ /**
16
+ *
17
+ * @export
18
+ */
19
+ export declare const COLLECTION_FORMATS: {
20
+ csv: string;
21
+ ssv: string;
22
+ tsv: string;
23
+ pipes: string;
24
+ };
25
+ export interface LoginClass {
26
+ accessToken: string;
27
+ permissions: Array<string>;
28
+ }
29
+ export declare enum Environment {
30
+ Production = "https://apiv2.emil.de",
31
+ Test = "https://apiv2-test.emil.de"
32
+ }
33
+ export declare function resetRetry(): void;
34
+ /**
35
+ *
36
+ * @export
37
+ * @interface RequestArgs
38
+ */
39
+ export interface RequestArgs {
40
+ url: string;
41
+ options: AxiosRequestConfig;
42
+ }
43
+ /**
44
+ *
45
+ * @export
46
+ * @class BaseAPI
47
+ */
48
+ export declare class BaseAPI {
49
+ protected basePath: string;
50
+ protected axios: AxiosInstance;
51
+ protected configuration: Configuration;
52
+ private username?;
53
+ private password?;
54
+ constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
55
+ initialize(env?: Environment): Promise<void>;
56
+ private loadCredentials;
57
+ private readConfigFile;
58
+ private readEnvVariables;
59
+ selectEnvironment(env: Environment): void;
60
+ authorize(username: string, password: string): Promise<void>;
61
+ refreshToken(): Promise<string>;
62
+ private extractRefreshToken;
63
+ getConfiguration(): Configuration;
64
+ private attachInterceptor;
65
+ }
66
+ /**
67
+ *
68
+ * @export
69
+ * @class RequiredError
70
+ * @extends {Error}
71
+ */
72
+ export declare class RequiredError extends Error {
73
+ field: string;
74
+ name: "RequiredError";
75
+ constructor(field: string, msg?: string);
76
+ }
package/dist/base.js ADDED
@@ -0,0 +1,392 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL Tenant Service
6
+ * The EMIL TenantService API description
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __extends = (this && this.__extends) || (function () {
16
+ var extendStatics = function (d, b) {
17
+ extendStatics = Object.setPrototypeOf ||
18
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
+ return extendStatics(d, b);
21
+ };
22
+ return function (d, b) {
23
+ if (typeof b !== "function" && b !== null)
24
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
+ extendStatics(d, b);
26
+ function __() { this.constructor = d; }
27
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
+ };
29
+ })();
30
+ var __assign = (this && this.__assign) || function () {
31
+ __assign = Object.assign || function(t) {
32
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
33
+ s = arguments[i];
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
35
+ t[p] = s[p];
36
+ }
37
+ return t;
38
+ };
39
+ return __assign.apply(this, arguments);
40
+ };
41
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42
+ if (k2 === undefined) k2 = k;
43
+ var desc = Object.getOwnPropertyDescriptor(m, k);
44
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45
+ desc = { enumerable: true, get: function() { return m[k]; } };
46
+ }
47
+ Object.defineProperty(o, k2, desc);
48
+ }) : (function(o, m, k, k2) {
49
+ if (k2 === undefined) k2 = k;
50
+ o[k2] = m[k];
51
+ }));
52
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
53
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
54
+ }) : function(o, v) {
55
+ o["default"] = v;
56
+ });
57
+ var __importStar = (this && this.__importStar) || function (mod) {
58
+ if (mod && mod.__esModule) return mod;
59
+ var result = {};
60
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
61
+ __setModuleDefault(result, mod);
62
+ return result;
63
+ };
64
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
65
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66
+ return new (P || (P = Promise))(function (resolve, reject) {
67
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
68
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
69
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
70
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
71
+ });
72
+ };
73
+ var __generator = (this && this.__generator) || function (thisArg, body) {
74
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
75
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
76
+ function verb(n) { return function (v) { return step([n, v]); }; }
77
+ function step(op) {
78
+ if (f) throw new TypeError("Generator is already executing.");
79
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
80
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
81
+ if (y = 0, t) op = [op[0] & 2, t.value];
82
+ switch (op[0]) {
83
+ case 0: case 1: t = op; break;
84
+ case 4: _.label++; return { value: op[1], done: false };
85
+ case 5: _.label++; y = op[1]; op = [0]; continue;
86
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
87
+ default:
88
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
89
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
90
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
91
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
92
+ if (t[2]) _.ops.pop();
93
+ _.trys.pop(); continue;
94
+ }
95
+ op = body.call(thisArg, _);
96
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
97
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
98
+ }
99
+ };
100
+ var __importDefault = (this && this.__importDefault) || function (mod) {
101
+ return (mod && mod.__esModule) ? mod : { "default": mod };
102
+ };
103
+ Object.defineProperty(exports, "__esModule", { value: true });
104
+ exports.RequiredError = exports.BaseAPI = exports.resetRetry = exports.Environment = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
105
+ var configuration_1 = require("./configuration");
106
+ // Some imports not used depending on template conditions
107
+ // @ts-ignore
108
+ var axios_1 = __importDefault(require("axios"));
109
+ var fs = __importStar(require("fs"));
110
+ var path = __importStar(require("path"));
111
+ var os = __importStar(require("os"));
112
+ exports.BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
113
+ var CONFIG_DIRECTORY = '.emil';
114
+ var CONFIG_FILENAME = 'credentials';
115
+ var KEY_USERNAME = 'emil_username';
116
+ var KEY_PASSWORD = 'emil_password';
117
+ var filePath = os.homedir() + path.sep + CONFIG_DIRECTORY + path.sep + CONFIG_FILENAME;
118
+ /**
119
+ *
120
+ * @export
121
+ */
122
+ exports.COLLECTION_FORMATS = {
123
+ csv: ",",
124
+ ssv: " ",
125
+ tsv: "\t",
126
+ pipes: "|",
127
+ };
128
+ var Environment;
129
+ (function (Environment) {
130
+ Environment["Production"] = "https://apiv2.emil.de";
131
+ Environment["Test"] = "https://apiv2-test.emil.de";
132
+ })(Environment = exports.Environment || (exports.Environment = {}));
133
+ var _retry_count = 0;
134
+ var _retry = null;
135
+ function resetRetry() {
136
+ _retry_count = 0;
137
+ }
138
+ exports.resetRetry = resetRetry;
139
+ var NETWORK_ERROR_MESSAGE = "Network Error";
140
+ /**
141
+ *
142
+ * @export
143
+ * @class BaseAPI
144
+ */
145
+ var BaseAPI = /** @class */ (function () {
146
+ function BaseAPI(configuration, basePath, axios) {
147
+ if (basePath === void 0) { basePath = exports.BASE_PATH; }
148
+ if (axios === void 0) { axios = axios_1.default; }
149
+ this.basePath = basePath;
150
+ this.axios = axios;
151
+ if (configuration) {
152
+ this.configuration = configuration;
153
+ this.basePath = configuration.basePath || this.basePath;
154
+ }
155
+ else {
156
+ this.configuration = new configuration_1.Configuration({
157
+ basePath: this.basePath,
158
+ });
159
+ }
160
+ this.attachInterceptor(axios);
161
+ }
162
+ BaseAPI.prototype.initialize = function (env) {
163
+ if (env === void 0) { env = Environment.Production; }
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ return __generator(this, function (_a) {
166
+ switch (_a.label) {
167
+ case 0:
168
+ this.configuration.basePath = env;
169
+ return [4 /*yield*/, this.loadCredentials()];
170
+ case 1:
171
+ _a.sent();
172
+ if (!this.username) return [3 /*break*/, 3];
173
+ return [4 /*yield*/, this.authorize(this.username, this.password)];
174
+ case 2:
175
+ _a.sent();
176
+ this.password = null; // to avoid keeping password loaded in memory.
177
+ _a.label = 3;
178
+ case 3: return [2 /*return*/];
179
+ }
180
+ });
181
+ });
182
+ };
183
+ BaseAPI.prototype.loadCredentials = function () {
184
+ return __awaiter(this, void 0, void 0, function () {
185
+ var error_1;
186
+ return __generator(this, function (_a) {
187
+ switch (_a.label) {
188
+ case 0:
189
+ _a.trys.push([0, 2, , 3]);
190
+ return [4 /*yield*/, this.readConfigFile()];
191
+ case 1:
192
+ _a.sent();
193
+ return [3 /*break*/, 3];
194
+ case 2:
195
+ error_1 = _a.sent();
196
+ console.warn("No credentials file found. Check that ".concat(filePath, " exists."));
197
+ return [3 /*break*/, 3];
198
+ case 3:
199
+ this.readEnvVariables();
200
+ if (!this.username) {
201
+ console.info("No credentials found in credentials file or environment variables. Either provide some or use \n authorize() function.");
202
+ }
203
+ return [2 /*return*/];
204
+ }
205
+ });
206
+ });
207
+ };
208
+ BaseAPI.prototype.readConfigFile = function () {
209
+ return __awaiter(this, void 0, void 0, function () {
210
+ var file, lines;
211
+ var _this = this;
212
+ return __generator(this, function (_a) {
213
+ switch (_a.label) {
214
+ case 0: return [4 /*yield*/, fs.promises.readFile(filePath, 'utf-8')];
215
+ case 1:
216
+ file = _a.sent();
217
+ lines = file.split(os.EOL)
218
+ .filter(Boolean);
219
+ lines.forEach(function (line) {
220
+ if (line.startsWith(KEY_USERNAME)) {
221
+ _this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
222
+ }
223
+ else if (line.startsWith(KEY_PASSWORD)) {
224
+ _this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
225
+ }
226
+ });
227
+ return [2 /*return*/];
228
+ }
229
+ });
230
+ });
231
+ };
232
+ BaseAPI.prototype.readEnvVariables = function () {
233
+ if (process.env.EMIL_USERNAME) {
234
+ this.username = process.env.EMIL_USERNAME;
235
+ this.password = process.env.EMIL_PASSWORD || '';
236
+ return true;
237
+ }
238
+ return false;
239
+ };
240
+ BaseAPI.prototype.selectEnvironment = function (env) {
241
+ this.configuration.basePath = env;
242
+ };
243
+ BaseAPI.prototype.authorize = function (username, password) {
244
+ return __awaiter(this, void 0, void 0, function () {
245
+ var options, response, accessToken, refreshToken;
246
+ return __generator(this, function (_a) {
247
+ switch (_a.label) {
248
+ case 0:
249
+ options = {
250
+ method: 'POST',
251
+ url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
252
+ headers: { 'Content-Type': 'application/json' },
253
+ data: {
254
+ username: username,
255
+ password: password,
256
+ },
257
+ withCredentials: true,
258
+ };
259
+ return [4 /*yield*/, axios_1.default.request(options)];
260
+ case 1:
261
+ response = _a.sent();
262
+ accessToken = response.data.accessToken;
263
+ this.configuration.username = username;
264
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
265
+ refreshToken = this.extractRefreshToken(response);
266
+ this.configuration.refreshToken = refreshToken;
267
+ return [2 /*return*/];
268
+ }
269
+ });
270
+ });
271
+ };
272
+ BaseAPI.prototype.refreshToken = function () {
273
+ return __awaiter(this, void 0, void 0, function () {
274
+ var _a, username, refreshToken, options, accessToken;
275
+ return __generator(this, function (_b) {
276
+ switch (_b.label) {
277
+ case 0:
278
+ _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
279
+ if (!username || !refreshToken) {
280
+ return [2 /*return*/, ''];
281
+ }
282
+ options = {
283
+ method: 'POST',
284
+ url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
285
+ headers: {
286
+ 'Content-Type': 'application/json',
287
+ Cookie: refreshToken,
288
+ },
289
+ data: { username: username },
290
+ withCredentials: true,
291
+ };
292
+ return [4 /*yield*/, axios_1.default.request(options)];
293
+ case 1:
294
+ accessToken = (_b.sent()).data.accessToken;
295
+ return [2 /*return*/, accessToken];
296
+ }
297
+ });
298
+ });
299
+ };
300
+ BaseAPI.prototype.extractRefreshToken = function (response) {
301
+ if (response.headers && response.headers['set-cookie']
302
+ && response.headers['set-cookie'].length > 0) {
303
+ return "".concat(response.headers['set-cookie'][0].split(';')[0], ";");
304
+ }
305
+ return '';
306
+ };
307
+ BaseAPI.prototype.getConfiguration = function () {
308
+ return this.configuration;
309
+ };
310
+ BaseAPI.prototype.attachInterceptor = function (axios) {
311
+ var _this = this;
312
+ axios.interceptors.response.use(function (res) {
313
+ return res;
314
+ }, function (err) { return __awaiter(_this, void 0, void 0, function () {
315
+ var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
316
+ return __generator(this, function (_a) {
317
+ switch (_a.label) {
318
+ case 0:
319
+ originalConfig = err.config;
320
+ if (!err.response) return [3 /*break*/, 5];
321
+ if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
322
+ originalConfig._retry = true;
323
+ _a.label = 1;
324
+ case 1:
325
+ _a.trys.push([1, 3, , 4]);
326
+ return [4 /*yield*/, this.refreshToken()];
327
+ case 2:
328
+ tokenString = _a.sent();
329
+ accessToken = "Bearer ".concat(tokenString);
330
+ originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
331
+ this.configuration.accessToken = accessToken;
332
+ return [2 /*return*/, axios.request(originalConfig)];
333
+ case 3:
334
+ _error_1 = _a.sent();
335
+ if (_error_1.response && _error_1.response.data) {
336
+ return [2 /*return*/, Promise.reject(_error_1.response.data)];
337
+ }
338
+ return [2 /*return*/, Promise.reject(_error_1)];
339
+ case 4:
340
+ if (err.response.status === 403 && err.response.data) {
341
+ return [2 /*return*/, Promise.reject(err.response.data)];
342
+ }
343
+ return [3 /*break*/, 9];
344
+ case 5:
345
+ if (!(err.message === NETWORK_ERROR_MESSAGE
346
+ && err.isAxiosError
347
+ && originalConfig.headers.hasOwnProperty('Authorization')
348
+ && _retry_count < 4)) return [3 /*break*/, 9];
349
+ _retry_count++;
350
+ _a.label = 6;
351
+ case 6:
352
+ _a.trys.push([6, 8, , 9]);
353
+ return [4 /*yield*/, this.refreshToken()];
354
+ case 7:
355
+ tokenString = _a.sent();
356
+ accessToken = "Bearer ".concat(tokenString);
357
+ _retry = true;
358
+ originalConfig.headers['Authorization'] = accessToken;
359
+ this.configuration.accessToken = accessToken;
360
+ return [2 /*return*/, axios.request(__assign({}, originalConfig))];
361
+ case 8:
362
+ _error_2 = _a.sent();
363
+ if (_error_2.response && _error_2.response.data) {
364
+ return [2 /*return*/, Promise.reject(_error_2.response.data)];
365
+ }
366
+ return [2 /*return*/, Promise.reject(_error_2)];
367
+ case 9: return [2 /*return*/, Promise.reject(err)];
368
+ }
369
+ });
370
+ }); });
371
+ };
372
+ return BaseAPI;
373
+ }());
374
+ exports.BaseAPI = BaseAPI;
375
+ ;
376
+ /**
377
+ *
378
+ * @export
379
+ * @class RequiredError
380
+ * @extends {Error}
381
+ */
382
+ var RequiredError = /** @class */ (function (_super) {
383
+ __extends(RequiredError, _super);
384
+ function RequiredError(field, msg) {
385
+ var _this = _super.call(this, msg) || this;
386
+ _this.field = field;
387
+ _this.name = "RequiredError";
388
+ return _this;
389
+ }
390
+ return RequiredError;
391
+ }(Error));
392
+ exports.RequiredError = RequiredError;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * EMIL Tenant Service
3
+ * The EMIL TenantService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { Configuration } from "./configuration";
13
+ import { RequestArgs } from "./base";
14
+ import { AxiosInstance, AxiosResponse } from 'axios';
15
+ import { URL } from 'url';
16
+ /**
17
+ *
18
+ * @export
19
+ */
20
+ export declare const DUMMY_BASE_URL = "https://example.com";
21
+ /**
22
+ *
23
+ * @throws {RequiredError}
24
+ * @export
25
+ */
26
+ export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
27
+ /**
28
+ *
29
+ * @export
30
+ */
31
+ export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
32
+ /**
33
+ *
34
+ * @export
35
+ */
36
+ export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
37
+ /**
38
+ *
39
+ * @export
40
+ */
41
+ export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
42
+ /**
43
+ *
44
+ * @export
45
+ */
46
+ export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
47
+ /**
48
+ *
49
+ * @export
50
+ */
51
+ export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
52
+ /**
53
+ *
54
+ * @export
55
+ */
56
+ export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
57
+ /**
58
+ *
59
+ * @export
60
+ */
61
+ export declare const toPathString: (url: URL) => string;
62
+ /**
63
+ *
64
+ * @export
65
+ */
66
+ export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
67
+ /**
68
+ * EMIL Tenant Service
69
+ * The EMIL TenantService API description
70
+ *
71
+ * The version of the OpenAPI document: 1.0
72
+ *
73
+ *
74
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
75
+ * https://openapi-generator.tech
76
+ * Do not edit the class manually.
77
+ */
78
+ export interface IStorageConverter<D, SD> {
79
+ toStorageData(data: D): SD;
80
+ fromStorageData(storageData: SD): D;
81
+ }
82
+ export interface IStorage {
83
+ get<T>(key: string, converter?: IStorageConverter<T, any>): T | null;
84
+ set<T>(key: string, value: T, converter?: IStorageConverter<T, any>): void;
85
+ }
86
+ export declare class LocalStorage implements IStorage {
87
+ readonly storage: Storage;
88
+ constructor();
89
+ get<T>(key: string, converter?: IStorageConverter<T, any>): T | null;
90
+ set<T>(key: string, value: T, converter?: IStorageConverter<T, any>): void;
91
+ }
92
+ export declare const defaultStorage: () => IStorage;