@equinor/fusion-framework-module-services 5.1.1-msal-0b0dadf270ee512f019a325c2f1586f91f9150a4 → 5.1.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.
Files changed (254) hide show
  1. package/CHANGELOG.md +114 -98
  2. package/dist/esm/bookmarks/api-version.js.map +1 -1
  3. package/dist/esm/bookmarks/client.js.map +1 -1
  4. package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js.map +1 -1
  5. package/dist/esm/bookmarks/endpoints/bookmark.delete.js.map +1 -1
  6. package/dist/esm/bookmarks/endpoints/bookmark.get.js.map +1 -1
  7. package/dist/esm/bookmarks/endpoints/bookmark.patch.js.map +1 -1
  8. package/dist/esm/bookmarks/endpoints/bookmark.post.js.map +1 -1
  9. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js.map +1 -1
  10. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js.map +1 -1
  11. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js.map +1 -1
  12. package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js.map +1 -1
  13. package/dist/esm/bookmarks/schemas.js +1 -3
  14. package/dist/esm/bookmarks/schemas.js.map +1 -1
  15. package/dist/esm/bookmarks/selectors.js.map +1 -1
  16. package/dist/esm/context/client.js +2 -2
  17. package/dist/esm/context/client.js.map +1 -1
  18. package/dist/esm/context/get/client.js.map +1 -1
  19. package/dist/esm/context/get/generate-endpoint.js +0 -1
  20. package/dist/esm/context/get/generate-endpoint.js.map +1 -1
  21. package/dist/esm/context/get/generate-parameters.js.map +1 -1
  22. package/dist/esm/context/get/types.js.map +1 -1
  23. package/dist/esm/context/index.js.map +1 -1
  24. package/dist/esm/context/query/client.js.map +1 -1
  25. package/dist/esm/context/query/generate-endpoint.js +58 -13
  26. package/dist/esm/context/query/generate-endpoint.js.map +1 -1
  27. package/dist/esm/context/query/generate-parameters.js.map +1 -1
  28. package/dist/esm/context/query/types.js.map +1 -1
  29. package/dist/esm/context/related/client.js.map +1 -1
  30. package/dist/esm/context/related/generate-endpoint.js +56 -13
  31. package/dist/esm/context/related/generate-endpoint.js.map +1 -1
  32. package/dist/esm/context/related/generate-parameters.js.map +1 -1
  33. package/dist/esm/context/related/types.js.map +1 -1
  34. package/dist/esm/context/static.js.map +1 -1
  35. package/dist/esm/errors.js.map +1 -1
  36. package/dist/esm/module.js.map +1 -1
  37. package/dist/esm/notification/client.js.map +1 -1
  38. package/dist/esm/notification/notification/delete/client.js.map +1 -1
  39. package/dist/esm/notification/notification/delete/generate-endpoint.js +0 -1
  40. package/dist/esm/notification/notification/delete/generate-endpoint.js.map +1 -1
  41. package/dist/esm/notification/notification/delete/generate-parameters.js.map +1 -1
  42. package/dist/esm/notification/notification/get/client.js.map +1 -1
  43. package/dist/esm/notification/notification/get/generate-endpoint.js +0 -1
  44. package/dist/esm/notification/notification/get/generate-endpoint.js.map +1 -1
  45. package/dist/esm/notification/notification/get/generate-parameters.js.map +1 -1
  46. package/dist/esm/notification/notification/getAll/client.js.map +1 -1
  47. package/dist/esm/notification/notification/getAll/generate-endpoint.js +0 -1
  48. package/dist/esm/notification/notification/getAll/generate-endpoint.js.map +1 -1
  49. package/dist/esm/notification/notification/getAll/generate-parameters.js.map +1 -1
  50. package/dist/esm/notification/notification/patch/client.js.map +1 -1
  51. package/dist/esm/notification/notification/patch/generate-endpoint.js +0 -1
  52. package/dist/esm/notification/notification/patch/generate-endpoint.js.map +1 -1
  53. package/dist/esm/notification/notification/patch/generate-parameters.js.map +1 -1
  54. package/dist/esm/notification/notification/post/client.js.map +1 -1
  55. package/dist/esm/notification/notification/post/generate-endpoint.js +0 -1
  56. package/dist/esm/notification/notification/post/generate-endpoint.js.map +1 -1
  57. package/dist/esm/notification/notification/post/generate-parameters.js.map +1 -1
  58. package/dist/esm/notification/settings/get/client.js.map +1 -1
  59. package/dist/esm/notification/settings/get/generate-endpoint.js +0 -1
  60. package/dist/esm/notification/settings/get/generate-endpoint.js.map +1 -1
  61. package/dist/esm/notification/settings/get/generate-parameters.js.map +1 -1
  62. package/dist/esm/notification/settings/put/client.js.map +1 -1
  63. package/dist/esm/notification/settings/put/generate-endpoint.js +0 -1
  64. package/dist/esm/notification/settings/put/generate-endpoint.js.map +1 -1
  65. package/dist/esm/notification/settings/put/generate-parameters.js.map +1 -1
  66. package/dist/esm/notification/static.js.map +1 -1
  67. package/dist/esm/people/client.js.map +1 -1
  68. package/dist/esm/people/person-details/client.js.map +1 -1
  69. package/dist/esm/people/person-details/generate-endpoint.js.map +1 -1
  70. package/dist/esm/people/person-details/generate-parameters.js.map +1 -1
  71. package/dist/esm/people/person-photo/client.js.map +1 -1
  72. package/dist/esm/people/person-photo/generate-endpoint.js.map +1 -1
  73. package/dist/esm/people/person-photo/generate-parameters.js.map +1 -1
  74. package/dist/esm/people/query/client.js.map +1 -1
  75. package/dist/esm/people/query/generate-endpoint.js.map +1 -1
  76. package/dist/esm/people/query/generate-parameters.js.map +1 -1
  77. package/dist/esm/people/static.js.map +1 -1
  78. package/dist/esm/people/utils.js.map +1 -1
  79. package/dist/esm/provider.js.map +1 -1
  80. package/dist/esm/utils.js.map +1 -1
  81. package/dist/esm/version.js +1 -1
  82. package/dist/tsconfig.tsbuildinfo +1 -1
  83. package/dist/types/bookmarks/api-version.d.ts +2 -2
  84. package/dist/types/bookmarks/client.d.ts +8 -8
  85. package/dist/types/bookmarks/endpoints/bookmark-apply.get.d.ts +1 -1
  86. package/dist/types/bookmarks/endpoints/bookmark.delete.d.ts +1 -1
  87. package/dist/types/bookmarks/endpoints/bookmark.get.d.ts +1 -1
  88. package/dist/types/bookmarks/endpoints/bookmark.patch.d.ts +1 -1
  89. package/dist/types/bookmarks/endpoints/bookmark.post.d.ts +1 -1
  90. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.delete.d.ts +1 -1
  91. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.head.d.ts +1 -1
  92. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.post.d.ts +1 -1
  93. package/dist/types/bookmarks/endpoints/user-bookmarks.get.d.ts +1 -1
  94. package/dist/types/bookmarks/selectors.d.ts +1 -1
  95. package/dist/types/bookmarks/types.d.ts +1 -1
  96. package/dist/types/configurator.d.ts +1 -1
  97. package/dist/types/context/client.d.ts +4 -4
  98. package/dist/types/context/get/client.d.ts +3 -2
  99. package/dist/types/context/get/generate-endpoint.d.ts +2 -1
  100. package/dist/types/context/get/generate-parameters.d.ts +2 -1
  101. package/dist/types/context/get/types.d.ts +2 -2
  102. package/dist/types/context/index.d.ts +1 -0
  103. package/dist/types/context/query/client.d.ts +3 -2
  104. package/dist/types/context/query/generate-endpoint.d.ts +11 -1
  105. package/dist/types/context/query/generate-parameters.d.ts +3 -2
  106. package/dist/types/context/query/types.d.ts +2 -2
  107. package/dist/types/context/related/client.d.ts +3 -2
  108. package/dist/types/context/related/generate-endpoint.d.ts +11 -1
  109. package/dist/types/context/related/generate-parameters.d.ts +3 -2
  110. package/dist/types/context/related/types.d.ts +2 -2
  111. package/dist/types/context/static.d.ts +2 -2
  112. package/dist/types/module.d.ts +2 -2
  113. package/dist/types/notification/client.d.ts +9 -9
  114. package/dist/types/notification/notification/delete/client.d.ts +4 -3
  115. package/dist/types/notification/notification/delete/generate-endpoint.d.ts +2 -1
  116. package/dist/types/notification/notification/delete/generate-parameters.d.ts +4 -3
  117. package/dist/types/notification/notification/delete/types.d.ts +3 -3
  118. package/dist/types/notification/notification/get/client.d.ts +4 -3
  119. package/dist/types/notification/notification/get/generate-endpoint.d.ts +2 -1
  120. package/dist/types/notification/notification/get/generate-parameters.d.ts +4 -3
  121. package/dist/types/notification/notification/get/types.d.ts +3 -3
  122. package/dist/types/notification/notification/getAll/client.d.ts +4 -3
  123. package/dist/types/notification/notification/getAll/generate-endpoint.d.ts +2 -1
  124. package/dist/types/notification/notification/getAll/generate-parameters.d.ts +4 -3
  125. package/dist/types/notification/notification/getAll/types.d.ts +3 -3
  126. package/dist/types/notification/notification/patch/client.d.ts +4 -3
  127. package/dist/types/notification/notification/patch/generate-endpoint.d.ts +2 -1
  128. package/dist/types/notification/notification/patch/generate-parameters.d.ts +4 -3
  129. package/dist/types/notification/notification/patch/types.d.ts +3 -3
  130. package/dist/types/notification/notification/post/client.d.ts +4 -3
  131. package/dist/types/notification/notification/post/generate-endpoint.d.ts +2 -1
  132. package/dist/types/notification/notification/post/generate-parameters.d.ts +4 -3
  133. package/dist/types/notification/notification/post/types.d.ts +3 -3
  134. package/dist/types/notification/settings/get/client.d.ts +4 -3
  135. package/dist/types/notification/settings/get/generate-endpoint.d.ts +2 -1
  136. package/dist/types/notification/settings/get/generate-parameters.d.ts +4 -3
  137. package/dist/types/notification/settings/get/types.d.ts +3 -3
  138. package/dist/types/notification/settings/put/client.d.ts +4 -3
  139. package/dist/types/notification/settings/put/generate-endpoint.d.ts +2 -1
  140. package/dist/types/notification/settings/put/generate-parameters.d.ts +4 -3
  141. package/dist/types/notification/settings/put/types.d.ts +3 -3
  142. package/dist/types/notification/static.d.ts +2 -2
  143. package/dist/types/people/api-models.d.ts +2 -2
  144. package/dist/types/people/api-models.v2.d.ts +1 -1
  145. package/dist/types/people/api-models.v4.d.ts +1 -1
  146. package/dist/types/people/client.d.ts +4 -4
  147. package/dist/types/people/person-details/client.d.ts +2 -2
  148. package/dist/types/people/person-details/generate-parameters.d.ts +1 -1
  149. package/dist/types/people/person-details/types.d.ts +1 -1
  150. package/dist/types/people/person-photo/client.d.ts +2 -2
  151. package/dist/types/people/person-photo/generate-parameters.d.ts +1 -1
  152. package/dist/types/people/person-photo/types.d.ts +2 -2
  153. package/dist/types/people/query/client.d.ts +2 -2
  154. package/dist/types/people/query/generate-parameters.d.ts +1 -1
  155. package/dist/types/people/query/types.d.ts +2 -2
  156. package/dist/types/people/static.d.ts +2 -2
  157. package/dist/types/people/utils.d.ts +1 -1
  158. package/dist/types/provider.d.ts +3 -3
  159. package/dist/types/types.d.ts +1 -1
  160. package/dist/types/utils.d.ts +1 -1
  161. package/dist/types/version.d.ts +1 -1
  162. package/package.json +11 -7
  163. package/src/bookmarks/api-version.ts +2 -2
  164. package/src/bookmarks/client.ts +228 -231
  165. package/src/bookmarks/endpoints/bookmark-apply.get.ts +58 -58
  166. package/src/bookmarks/endpoints/bookmark.delete.ts +57 -57
  167. package/src/bookmarks/endpoints/bookmark.get.ts +62 -62
  168. package/src/bookmarks/endpoints/bookmark.patch.ts +78 -78
  169. package/src/bookmarks/endpoints/bookmark.post.ts +68 -68
  170. package/src/bookmarks/endpoints/user-bookmark-favourite.delete.ts +57 -57
  171. package/src/bookmarks/endpoints/user-bookmark-favourite.head.ts +57 -57
  172. package/src/bookmarks/endpoints/user-bookmark-favourite.post.ts +58 -58
  173. package/src/bookmarks/endpoints/user-bookmarks.get.ts +98 -98
  174. package/src/bookmarks/schemas.ts +54 -56
  175. package/src/bookmarks/selectors.ts +24 -24
  176. package/src/bookmarks/types.ts +6 -6
  177. package/src/configurator.ts +3 -3
  178. package/src/context/api-models.ts +19 -19
  179. package/src/context/client.ts +68 -58
  180. package/src/context/get/client.ts +18 -18
  181. package/src/context/get/generate-endpoint.ts +13 -14
  182. package/src/context/get/generate-parameters.ts +9 -9
  183. package/src/context/get/types.ts +20 -20
  184. package/src/context/index.ts +2 -0
  185. package/src/context/query/client.ts +22 -22
  186. package/src/context/query/generate-endpoint.ts +97 -49
  187. package/src/context/query/generate-parameters.ts +10 -10
  188. package/src/context/query/types.ts +25 -25
  189. package/src/context/related/client.ts +22 -22
  190. package/src/context/related/generate-endpoint.ts +92 -45
  191. package/src/context/related/generate-parameters.ts +10 -10
  192. package/src/context/related/types.ts +27 -27
  193. package/src/context/static.ts +3 -3
  194. package/src/errors.ts +6 -6
  195. package/src/module.ts +50 -52
  196. package/src/notification/api-models.ts +36 -36
  197. package/src/notification/client.ts +131 -151
  198. package/src/notification/notification/delete/client.ts +22 -22
  199. package/src/notification/notification/delete/generate-endpoint.ts +13 -14
  200. package/src/notification/notification/delete/generate-parameters.ts +18 -18
  201. package/src/notification/notification/delete/types.ts +21 -21
  202. package/src/notification/notification/get/client.ts +19 -19
  203. package/src/notification/notification/get/generate-endpoint.ts +13 -14
  204. package/src/notification/notification/get/generate-parameters.ts +11 -11
  205. package/src/notification/notification/get/types.ts +21 -21
  206. package/src/notification/notification/getAll/client.ts +22 -22
  207. package/src/notification/notification/getAll/generate-endpoint.ts +13 -14
  208. package/src/notification/notification/getAll/generate-parameters.ts +11 -11
  209. package/src/notification/notification/getAll/types.ts +21 -21
  210. package/src/notification/notification/patch/client.ts +22 -22
  211. package/src/notification/notification/patch/generate-endpoint.ts +13 -14
  212. package/src/notification/notification/patch/generate-parameters.ts +18 -18
  213. package/src/notification/notification/patch/types.ts +22 -22
  214. package/src/notification/notification/post/client.ts +22 -22
  215. package/src/notification/notification/post/generate-endpoint.ts +13 -14
  216. package/src/notification/notification/post/generate-parameters.ts +18 -18
  217. package/src/notification/notification/post/types.ts +31 -31
  218. package/src/notification/settings/get/client.ts +22 -22
  219. package/src/notification/settings/get/generate-endpoint.ts +13 -14
  220. package/src/notification/settings/get/generate-parameters.ts +11 -11
  221. package/src/notification/settings/get/types.ts +21 -21
  222. package/src/notification/settings/put/client.ts +22 -22
  223. package/src/notification/settings/put/generate-endpoint.ts +13 -14
  224. package/src/notification/settings/put/generate-parameters.ts +20 -20
  225. package/src/notification/settings/put/types.ts +20 -20
  226. package/src/notification/static.ts +3 -3
  227. package/src/people/api-models.ts +30 -30
  228. package/src/people/api-models.v2.ts +27 -27
  229. package/src/people/api-models.v4.ts +79 -79
  230. package/src/people/client.ts +73 -77
  231. package/src/people/person-details/client.ts +21 -18
  232. package/src/people/person-details/generate-endpoint.ts +16 -16
  233. package/src/people/person-details/generate-parameters.ts +8 -8
  234. package/src/people/person-details/types.ts +13 -13
  235. package/src/people/person-photo/client.ts +19 -22
  236. package/src/people/person-photo/generate-endpoint.ts +13 -13
  237. package/src/people/person-photo/generate-parameters.ts +8 -8
  238. package/src/people/person-photo/types.ts +8 -8
  239. package/src/people/query/client.ts +20 -18
  240. package/src/people/query/generate-endpoint.ts +14 -14
  241. package/src/people/query/generate-parameters.ts +8 -8
  242. package/src/people/query/types.ts +10 -10
  243. package/src/people/static.ts +2 -2
  244. package/src/people/utils.ts +20 -20
  245. package/src/provider.ts +85 -85
  246. package/src/types.ts +34 -34
  247. package/src/utils.ts +22 -26
  248. package/src/version.ts +1 -1
  249. package/tests/context.test.ts +109 -0
  250. package/tests/mocks/get-context-item.ts +60 -0
  251. package/tests/mocks/index.ts +1 -0
  252. package/tests/setup.ts +73 -0
  253. package/tsconfig.json +4 -3
  254. package/vitest.config.ts +11 -0
@@ -1,170 +1,150 @@
1
- import { IHttpClient } from '@equinor/fusion-framework-module-http';
2
- import { ClientMethod } from '../types';
3
- import { GetNotificationFn, GetNotificationResult } from './notification/get';
1
+ import type { IHttpClient } from '@equinor/fusion-framework-module-http';
2
+ import type { ClientMethod } from '../types';
3
+ import type { GetNotificationFn, GetNotificationResult } from './notification/get';
4
4
  import {
5
- createNotification,
6
- deleteNotification,
7
- getNotificationById,
8
- getNotifications,
9
- updateSeenByUser,
5
+ createNotification,
6
+ deleteNotification,
7
+ getNotificationById,
8
+ getNotifications,
9
+ updateSeenByUser,
10
10
  } from './notification';
11
11
  import { ApiVersion } from './static';
12
- import { PatchNotificationFn, PatchNotificationResult } from './notification/patch';
13
- import { GetNotificationsFn, GetNotificationsResult } from './notification/getAll';
14
- import { PostNotificationResult, PostNotificationFn } from './notification/post';
15
- import { DeleteNotificationFn, DeleteNotificationResult } from './notification/delete';
12
+ import type { PatchNotificationFn, PatchNotificationResult } from './notification/patch';
13
+ import type { GetNotificationsFn, GetNotificationsResult } from './notification/getAll';
14
+ import type { PostNotificationResult, PostNotificationFn } from './notification/post';
15
+ import type { DeleteNotificationFn, DeleteNotificationResult } from './notification/delete';
16
16
  import updateUserNotificationSettings, {
17
- PutUserNotificationSettingsFn,
18
- PutUserNotificationSettingsResult,
17
+ type PutUserNotificationSettingsFn,
18
+ type PutUserNotificationSettingsResult,
19
19
  } from './settings/put';
20
20
  import getUserNotificationSettings, {
21
- GetUserNotificationSettingsFn,
22
- GetUserNotificationsSettingsResult,
21
+ type GetUserNotificationSettingsFn,
22
+ type GetUserNotificationsSettingsResult,
23
23
  } from './settings/get';
24
24
 
25
25
  export class NotificationApiClient<
26
- TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
27
- TClient extends IHttpClient = IHttpClient,
26
+ TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
27
+ TClient extends IHttpClient = IHttpClient,
28
28
  > {
29
- get Version(): typeof ApiVersion {
30
- return ApiVersion;
31
- }
29
+ get Version(): typeof ApiVersion {
30
+ return ApiVersion;
31
+ }
32
32
 
33
- constructor(
34
- protected _client: TClient,
35
- protected _method: TMethod,
36
- ) {}
33
+ constructor(
34
+ protected _client: TClient,
35
+ protected _method: TMethod,
36
+ ) {}
37
37
 
38
- /**
39
- * Fetch all notifications
40
- * @see {@link getAll/client}
41
- */
42
- public getAll<
43
- TVersion extends string = keyof typeof ApiVersion,
44
- TResult = GetNotificationsResult<TVersion>,
45
- >(
46
- version: TVersion,
47
- ...args: Parameters<GetNotificationsFn<TVersion, TMethod, TClient, TResult>>
48
- ): GetNotificationsResult<TVersion, TMethod, TResult> {
49
- const fn = getNotifications<TVersion, TMethod, TClient>(
50
- this._client,
51
- version,
52
- this._method,
53
- );
54
- return fn<TResult>(...args);
55
- }
38
+ /**
39
+ * Fetch all notifications
40
+ * @see {@link getAll/client}
41
+ */
42
+ public getAll<
43
+ TVersion extends string = keyof typeof ApiVersion,
44
+ TResult = GetNotificationsResult<TVersion>,
45
+ >(
46
+ version: TVersion,
47
+ ...args: Parameters<GetNotificationsFn<TVersion, TMethod, TClient, TResult>>
48
+ ): GetNotificationsResult<TVersion, TMethod, TResult> {
49
+ const fn = getNotifications<TVersion, TMethod, TClient>(this._client, version, this._method);
50
+ return fn<TResult>(...args);
51
+ }
56
52
 
57
- /**
58
- * Fetch notification by id
59
- * @see {@link getById/client}
60
- */
61
- public getById<
62
- TVersion extends string = keyof typeof ApiVersion,
63
- TResult = GetNotificationResult<TVersion>,
64
- >(
65
- version: TVersion,
66
- ...args: Parameters<GetNotificationFn<TVersion, TMethod, TClient, TResult>>
67
- ): GetNotificationResult<TVersion, TMethod, TResult> {
68
- const fn = getNotificationById<TVersion, TMethod, TClient>(
69
- this._client,
70
- version,
71
- this._method,
72
- );
73
- return fn<TResult>(...args);
74
- }
53
+ /**
54
+ * Fetch notification by id
55
+ * @see {@link getById/client}
56
+ */
57
+ public getById<
58
+ TVersion extends string = keyof typeof ApiVersion,
59
+ TResult = GetNotificationResult<TVersion>,
60
+ >(
61
+ version: TVersion,
62
+ ...args: Parameters<GetNotificationFn<TVersion, TMethod, TClient, TResult>>
63
+ ): GetNotificationResult<TVersion, TMethod, TResult> {
64
+ const fn = getNotificationById<TVersion, TMethod, TClient>(this._client, version, this._method);
65
+ return fn<TResult>(...args);
66
+ }
75
67
 
76
- /**
77
- * Set notification seen by user
78
- * @see {@link setSeenByUser/client}
79
- */
80
- public setSeenByUser<
81
- TVersion extends string = keyof typeof ApiVersion,
82
- TResult = PatchNotificationResult<TVersion>,
83
- >(
84
- version: TVersion,
85
- ...args: Parameters<PatchNotificationFn<TVersion, TMethod, TClient, TResult>>
86
- ): PatchNotificationResult<TVersion, TMethod, TResult> {
87
- const fn = updateSeenByUser<TVersion, TMethod, TClient>(
88
- this._client,
89
- version,
90
- this._method,
91
- );
92
- return fn<TResult>(...args);
93
- }
68
+ /**
69
+ * Set notification seen by user
70
+ * @see {@link setSeenByUser/client}
71
+ */
72
+ public setSeenByUser<
73
+ TVersion extends string = keyof typeof ApiVersion,
74
+ TResult = PatchNotificationResult<TVersion>,
75
+ >(
76
+ version: TVersion,
77
+ ...args: Parameters<PatchNotificationFn<TVersion, TMethod, TClient, TResult>>
78
+ ): PatchNotificationResult<TVersion, TMethod, TResult> {
79
+ const fn = updateSeenByUser<TVersion, TMethod, TClient>(this._client, version, this._method);
80
+ return fn<TResult>(...args);
81
+ }
94
82
 
95
- /**
96
- * Create a notification
97
- * @see {@link create/client}
98
- */
99
- public create<
100
- TVersion extends string = keyof typeof ApiVersion,
101
- TResult = PostNotificationResult<TVersion>,
102
- >(
103
- version: TVersion,
104
- ...args: Parameters<PostNotificationFn<TVersion, TMethod, TClient, TResult>>
105
- ): PostNotificationResult<TVersion, TMethod, TResult> {
106
- const fn = createNotification<TVersion, TMethod, TClient>(
107
- this._client,
108
- version,
109
- this._method,
110
- );
111
- return fn<TResult>(...args);
112
- }
83
+ /**
84
+ * Create a notification
85
+ * @see {@link create/client}
86
+ */
87
+ public create<
88
+ TVersion extends string = keyof typeof ApiVersion,
89
+ TResult = PostNotificationResult<TVersion>,
90
+ >(
91
+ version: TVersion,
92
+ ...args: Parameters<PostNotificationFn<TVersion, TMethod, TClient, TResult>>
93
+ ): PostNotificationResult<TVersion, TMethod, TResult> {
94
+ const fn = createNotification<TVersion, TMethod, TClient>(this._client, version, this._method);
95
+ return fn<TResult>(...args);
96
+ }
113
97
 
114
- /**
115
- * Delete a notification
116
- * @see {@link delete/client}
117
- */
118
- public delete<
119
- TVersion extends string = keyof typeof ApiVersion,
120
- TResult = PostNotificationResult<TVersion>,
121
- >(
122
- version: TVersion,
123
- ...args: Parameters<DeleteNotificationFn<TVersion, TMethod, TClient, TResult>>
124
- ): DeleteNotificationResult<TVersion, TMethod, TResult> {
125
- const fn = deleteNotification<TVersion, TMethod, TClient>(
126
- this._client,
127
- version,
128
- this._method,
129
- );
130
- return fn<TResult>(...args);
131
- }
132
- /**
133
- * Get users notification settings
134
- * @see {@link getSettings/client}
135
- */
136
- public getSettings<
137
- TVersion extends string = keyof typeof ApiVersion,
138
- TResult = PostNotificationResult<TVersion>,
139
- >(
140
- version: TVersion,
141
- ...args: Parameters<GetUserNotificationSettingsFn<TVersion, TMethod, TClient, TResult>>
142
- ): GetUserNotificationsSettingsResult<TVersion, TMethod, TResult> {
143
- const fn = getUserNotificationSettings<TVersion, TMethod, TClient>(
144
- this._client,
145
- version,
146
- this._method,
147
- );
148
- return fn<TResult>(...args);
149
- }
150
- /**
151
- * Update user notification settings
152
- * @see {@link updateSettings/client}
153
- */
154
- public updateSettings<
155
- TVersion extends string = keyof typeof ApiVersion,
156
- TResult = PostNotificationResult<TVersion>,
157
- >(
158
- version: TVersion,
159
- ...args: Parameters<PutUserNotificationSettingsFn<TVersion, TMethod, TClient, TResult>>
160
- ): PutUserNotificationSettingsResult<TVersion, TMethod, TResult> {
161
- const fn = updateUserNotificationSettings<TVersion, TMethod, TClient>(
162
- this._client,
163
- version,
164
- this._method,
165
- );
166
- return fn<TResult>(...args);
167
- }
98
+ /**
99
+ * Delete a notification
100
+ * @see {@link delete/client}
101
+ */
102
+ public delete<
103
+ TVersion extends string = keyof typeof ApiVersion,
104
+ TResult = PostNotificationResult<TVersion>,
105
+ >(
106
+ version: TVersion,
107
+ ...args: Parameters<DeleteNotificationFn<TVersion, TMethod, TClient, TResult>>
108
+ ): DeleteNotificationResult<TVersion, TMethod, TResult> {
109
+ const fn = deleteNotification<TVersion, TMethod, TClient>(this._client, version, this._method);
110
+ return fn<TResult>(...args);
111
+ }
112
+ /**
113
+ * Get users notification settings
114
+ * @see {@link getSettings/client}
115
+ */
116
+ public getSettings<
117
+ TVersion extends string = keyof typeof ApiVersion,
118
+ TResult = PostNotificationResult<TVersion>,
119
+ >(
120
+ version: TVersion,
121
+ ...args: Parameters<GetUserNotificationSettingsFn<TVersion, TMethod, TClient, TResult>>
122
+ ): GetUserNotificationsSettingsResult<TVersion, TMethod, TResult> {
123
+ const fn = getUserNotificationSettings<TVersion, TMethod, TClient>(
124
+ this._client,
125
+ version,
126
+ this._method,
127
+ );
128
+ return fn<TResult>(...args);
129
+ }
130
+ /**
131
+ * Update user notification settings
132
+ * @see {@link updateSettings/client}
133
+ */
134
+ public updateSettings<
135
+ TVersion extends string = keyof typeof ApiVersion,
136
+ TResult = PostNotificationResult<TVersion>,
137
+ >(
138
+ version: TVersion,
139
+ ...args: Parameters<PutUserNotificationSettingsFn<TVersion, TMethod, TClient, TResult>>
140
+ ): PutUserNotificationSettingsResult<TVersion, TMethod, TResult> {
141
+ const fn = updateUserNotificationSettings<TVersion, TMethod, TClient>(
142
+ this._client,
143
+ version,
144
+ this._method,
145
+ );
146
+ return fn<TResult>(...args);
147
+ }
168
148
  }
169
149
 
170
150
  export default NotificationApiClient;
@@ -1,13 +1,13 @@
1
- import { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
2
- import { ClientMethod } from '../../../types';
3
- import { ApiVersion } from '../../static';
1
+ import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
2
+ import type { ClientMethod } from '../../../types';
3
+ import type { ApiVersion } from '../../static';
4
4
 
5
5
  import { generateParameters } from './generate-parameters';
6
6
 
7
7
  import type {
8
- DeleteNotificationArgs,
9
- DeleteNotificationResponse,
10
- DeleteNotificationResult,
8
+ DeleteNotificationArgs,
9
+ DeleteNotificationResponse,
10
+ DeleteNotificationResult,
11
11
  } from './types';
12
12
 
13
13
  /**
@@ -17,21 +17,21 @@ import type {
17
17
  * @param method - client method to call
18
18
  */
19
19
  export const deleteNotification =
20
- <
21
- TVersion extends string = keyof typeof ApiVersion,
22
- TMethod extends keyof ClientMethod = keyof ClientMethod,
23
- TClient extends IHttpClient = IHttpClient,
24
- >(
25
- client: TClient,
26
- version: TVersion,
27
- method: TMethod = 'json' as TMethod,
28
- ) =>
29
- <T = DeleteNotificationResponse<TVersion>>(
30
- args: DeleteNotificationArgs<TVersion>,
31
- init?: ClientRequestInit<TClient, T>,
32
- ): DeleteNotificationResult<TVersion, TMethod, T> =>
33
- client[method](
34
- ...generateParameters<T, TVersion, TClient>(version, args, init),
35
- ) as DeleteNotificationResult<TVersion, TMethod, T>;
20
+ <
21
+ TVersion extends string = keyof typeof ApiVersion,
22
+ TMethod extends keyof ClientMethod = keyof ClientMethod,
23
+ TClient extends IHttpClient = IHttpClient,
24
+ >(
25
+ client: TClient,
26
+ version: TVersion,
27
+ method: TMethod = 'json' as TMethod,
28
+ ) =>
29
+ <T = DeleteNotificationResponse<TVersion>>(
30
+ args: DeleteNotificationArgs<TVersion>,
31
+ init?: ClientRequestInit<TClient, T>,
32
+ ): DeleteNotificationResult<TVersion, TMethod, T> =>
33
+ client[method](
34
+ ...generateParameters<T, TVersion, TClient>(version, args, init),
35
+ ) as DeleteNotificationResult<TVersion, TMethod, T>;
36
36
 
37
37
  export default deleteNotification;
@@ -6,19 +6,18 @@ import type { DeleteNotificationArgs } from './types';
6
6
  * Method for generating endpoint for getting notification by id
7
7
  */
8
8
  export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
9
- version: TVersion,
10
- args: DeleteNotificationArgs<TVersion>,
11
- ) => {
12
- const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
13
- switch (apiVersion) {
14
- case ApiVersion.v2:
15
- throw new UnsupportedApiVersion(version);
16
- case ApiVersion.v1:
17
- default: {
18
- const { id } = args as { id: string };
19
- const params = new URLSearchParams();
20
- params.append('api-version', apiVersion);
21
- return `/notification/${id}/?${String(params)}`;
22
- }
9
+ version: TVersion,
10
+ args: DeleteNotificationArgs<TVersion>,
11
+ ): string => {
12
+ const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
13
+ switch (apiVersion) {
14
+ case ApiVersion.v2:
15
+ throw new UnsupportedApiVersion(version);
16
+ default: {
17
+ const { id } = args as { id: string };
18
+ const params = new URLSearchParams();
19
+ params.append('api-version', apiVersion);
20
+ return `/notification/${id}/?${String(params)}`;
23
21
  }
22
+ }
24
23
  };
@@ -1,32 +1,32 @@
1
1
  import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
2
- import { ApiVersion } from '../../static';
3
- import { ApiClientArguments } from '../../types';
2
+ import type { ApiVersion } from '../../static';
3
+ import type { ApiClientArguments } from '../../types';
4
4
 
5
5
  import { generateEndpoint } from './generate-endpoint';
6
- import { DeleteNotificationArgs } from './types';
6
+ import type { DeleteNotificationArgs } from './types';
7
7
 
8
8
  /** function for creating http client arguments */
9
9
  export const generateParameters = <
10
- TResult,
11
- TVersion extends string = keyof typeof ApiVersion,
12
- TClient extends IHttpClient = IHttpClient,
10
+ TResult,
11
+ TVersion extends string = keyof typeof ApiVersion,
12
+ TClient extends IHttpClient = IHttpClient,
13
13
  >(
14
- version: TVersion,
15
- args: DeleteNotificationArgs<TVersion>,
16
- init?: ClientRequestInit<TClient, TResult>,
14
+ version: TVersion,
15
+ args: DeleteNotificationArgs<TVersion>,
16
+ init?: ClientRequestInit<TClient, TResult>,
17
17
  ): ApiClientArguments<TClient, TResult> => {
18
- const path = generateEndpoint(version, args);
18
+ const path = generateEndpoint(version, args);
19
19
 
20
- const headers = new Headers();
21
- headers.append('content-type', 'application/json');
20
+ const headers = new Headers();
21
+ headers.append('content-type', 'application/json');
22
22
 
23
- const requestParams: ClientRequestInit<TClient, TResult> = Object.assign(
24
- {},
25
- { method: 'DELETE', headers: headers },
26
- init,
27
- );
23
+ const requestParams: ClientRequestInit<TClient, TResult> = Object.assign(
24
+ {},
25
+ { method: 'DELETE', headers: headers },
26
+ init,
27
+ );
28
28
 
29
- return [path, requestParams];
29
+ return [path, requestParams];
30
30
  };
31
31
 
32
32
  export default generateParameters;
@@ -1,44 +1,44 @@
1
- import { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
2
- import { ClientMethod } from '../../../types';
3
- import { ApiNotificationEntity } from '../../api-models';
1
+ import type { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
2
+ import type { ClientMethod } from '../../../types';
3
+ import type { ApiNotificationEntity } from '../../api-models';
4
4
  import { ApiVersion } from '../../static';
5
5
 
6
6
  type DeleteNotificationArgs_v1 = {
7
- id: string;
7
+ id: string;
8
8
  };
9
9
 
10
10
  type DeleteNotificationArgs_v2 = DeleteNotificationArgs_v1;
11
11
 
12
12
  type DeleteNotificationArgsTypes = {
13
- [ApiVersion.v1]: DeleteNotificationArgs_v1;
14
- [ApiVersion.v2]: DeleteNotificationArgs_v2;
13
+ [ApiVersion.v1]: DeleteNotificationArgs_v1;
14
+ [ApiVersion.v2]: DeleteNotificationArgs_v2;
15
15
  };
16
16
 
17
17
  export type DeleteNotificationArgs<T extends string> = T extends keyof typeof ApiVersion
18
- ? DeleteNotificationArgsTypes[(typeof ApiVersion)[T]]
19
- : unknown;
18
+ ? DeleteNotificationArgsTypes[(typeof ApiVersion)[T]]
19
+ : unknown;
20
20
 
21
21
  type DeleteNotificationResponseTypes = {
22
- [ApiVersion.v1]: ApiNotificationEntity<ApiVersion.v1>;
23
- [ApiVersion.v2]: ApiNotificationEntity<ApiVersion.v2>;
22
+ [ApiVersion.v1]: ApiNotificationEntity<ApiVersion.v1>;
23
+ [ApiVersion.v2]: ApiNotificationEntity<ApiVersion.v2>;
24
24
  };
25
25
 
26
26
  export type DeleteNotificationResponse<T> = T extends keyof typeof ApiVersion
27
- ? DeleteNotificationResponseTypes[(typeof ApiVersion)[T]]
28
- : unknown;
27
+ ? DeleteNotificationResponseTypes[(typeof ApiVersion)[T]]
28
+ : unknown;
29
29
 
30
30
  export type DeleteNotificationFn<
31
- TVersion extends string = keyof typeof ApiVersion,
32
- TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
33
- TClient extends IHttpClient = IHttpClient,
34
- TResult = DeleteNotificationResponse<TVersion>,
31
+ TVersion extends string = keyof typeof ApiVersion,
32
+ TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
33
+ TClient extends IHttpClient = IHttpClient,
34
+ TResult = DeleteNotificationResponse<TVersion>,
35
35
  > = (
36
- args: DeleteNotificationArgs<TVersion>,
37
- init?: ClientRequestInit<TClient, TResult>,
36
+ args: DeleteNotificationArgs<TVersion>,
37
+ init?: ClientRequestInit<TClient, TResult>,
38
38
  ) => DeleteNotificationResult<TVersion, TMethod, TResult>;
39
39
 
40
40
  export type DeleteNotificationResult<
41
- TVersion extends string = keyof typeof ApiVersion,
42
- TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
43
- TResult = DeleteNotificationResponse<TVersion>,
41
+ TVersion extends string = keyof typeof ApiVersion,
42
+ TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
43
+ TResult = DeleteNotificationResponse<TVersion>,
44
44
  > = ClientMethod<TResult>[TMethod];
@@ -1,6 +1,6 @@
1
- import { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
2
- import { ClientMethod } from '../../../types';
3
- import { ApiVersion } from '../../static';
1
+ import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
2
+ import type { ClientMethod } from '../../../types';
3
+ import type { ApiVersion } from '../../static';
4
4
 
5
5
  import { generateParameters } from './generate-parameters';
6
6
 
@@ -13,21 +13,21 @@ import type { GetNotificationArgs, GetNotificationResult, GetNotificationRespons
13
13
  * @param method - client method to call
14
14
  */
15
15
  export const getNotificationById =
16
- <
17
- TVersion extends string = keyof typeof ApiVersion,
18
- TMethod extends keyof ClientMethod = keyof ClientMethod,
19
- TClient extends IHttpClient = IHttpClient,
20
- >(
21
- client: TClient,
22
- version: TVersion,
23
- method: TMethod = 'json' as TMethod,
24
- ) =>
25
- <T = GetNotificationResponse<TVersion>>(
26
- args: GetNotificationArgs<TVersion>,
27
- init?: ClientRequestInit<TClient, T>,
28
- ): GetNotificationResult<TVersion, TMethod, T> =>
29
- client[method](
30
- ...generateParameters<T, TVersion, TClient>(version, args, init),
31
- ) as GetNotificationResult<TVersion, TMethod, T>;
16
+ <
17
+ TVersion extends string = keyof typeof ApiVersion,
18
+ TMethod extends keyof ClientMethod = keyof ClientMethod,
19
+ TClient extends IHttpClient = IHttpClient,
20
+ >(
21
+ client: TClient,
22
+ version: TVersion,
23
+ method: TMethod = 'json' as TMethod,
24
+ ) =>
25
+ <T = GetNotificationResponse<TVersion>>(
26
+ args: GetNotificationArgs<TVersion>,
27
+ init?: ClientRequestInit<TClient, T>,
28
+ ): GetNotificationResult<TVersion, TMethod, T> =>
29
+ client[method](
30
+ ...generateParameters<T, TVersion, TClient>(version, args, init),
31
+ ) as GetNotificationResult<TVersion, TMethod, T>;
32
32
 
33
33
  export default getNotificationById;
@@ -7,19 +7,18 @@ import type { GetNotificationArgs } from './types';
7
7
  * Method for generating endpoint for getting notification by id
8
8
  */
9
9
  export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
10
- version: TVersion,
11
- args: GetNotificationArgs<TVersion>,
12
- ) => {
13
- const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
14
- switch (apiVersion) {
15
- case ApiVersion.v2:
16
- throw new UnsupportedApiVersion(version);
17
- case ApiVersion.v1:
18
- default: {
19
- const { id } = args as { id: string };
20
- const params = new URLSearchParams();
21
- params.append('api-version', apiVersion);
22
- return `/notification/${id}/?${String(params)}`;
23
- }
10
+ version: TVersion,
11
+ args: GetNotificationArgs<TVersion>,
12
+ ): string => {
13
+ const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
14
+ switch (apiVersion) {
15
+ case ApiVersion.v2:
16
+ throw new UnsupportedApiVersion(version);
17
+ default: {
18
+ const { id } = args as { id: string };
19
+ const params = new URLSearchParams();
20
+ params.append('api-version', apiVersion);
21
+ return `/notification/${id}/?${String(params)}`;
24
22
  }
23
+ }
25
24
  };
@@ -1,22 +1,22 @@
1
1
  import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
2
- import { ApiVersion } from '../../static';
3
- import { ApiClientArguments } from '../../types';
2
+ import type { ApiVersion } from '../../static';
3
+ import type { ApiClientArguments } from '../../types';
4
4
 
5
5
  import { generateEndpoint } from './generate-endpoint';
6
- import { GetNotificationArgs } from './types';
6
+ import type { GetNotificationArgs } from './types';
7
7
 
8
8
  /** function for creating http client arguments */
9
9
  export const generateParameters = <
10
- TResult,
11
- TVersion extends string = keyof typeof ApiVersion,
12
- TClient extends IHttpClient = IHttpClient,
10
+ TResult,
11
+ TVersion extends string = keyof typeof ApiVersion,
12
+ TClient extends IHttpClient = IHttpClient,
13
13
  >(
14
- version: TVersion,
15
- args: GetNotificationArgs<TVersion>,
16
- init?: ClientRequestInit<TClient, TResult>,
14
+ version: TVersion,
15
+ args: GetNotificationArgs<TVersion>,
16
+ init?: ClientRequestInit<TClient, TResult>,
17
17
  ): ApiClientArguments<TClient, TResult> => {
18
- const path = generateEndpoint(version, args);
19
- return [path, init];
18
+ const path = generateEndpoint(version, args);
19
+ return [path, init];
20
20
  };
21
21
 
22
22
  export default generateParameters;