@equinor/fusion-framework-module-services 5.1.1-msal-6cf764b628c2afdd64dfd06e42abc953d78556d2 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -98
- package/dist/esm/bookmarks/api-version.js.map +1 -1
- package/dist/esm/bookmarks/client.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/bookmark.delete.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/bookmark.get.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/bookmark.patch.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/bookmark.post.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js.map +1 -1
- package/dist/esm/bookmarks/schemas.js +1 -3
- package/dist/esm/bookmarks/schemas.js.map +1 -1
- package/dist/esm/bookmarks/selectors.js.map +1 -1
- package/dist/esm/context/client.js +2 -2
- package/dist/esm/context/client.js.map +1 -1
- package/dist/esm/context/get/client.js.map +1 -1
- package/dist/esm/context/get/generate-endpoint.js +0 -1
- package/dist/esm/context/get/generate-endpoint.js.map +1 -1
- package/dist/esm/context/get/generate-parameters.js.map +1 -1
- package/dist/esm/context/get/types.js.map +1 -1
- package/dist/esm/context/query/client.js.map +1 -1
- package/dist/esm/context/query/generate-endpoint.js +0 -1
- package/dist/esm/context/query/generate-endpoint.js.map +1 -1
- package/dist/esm/context/query/generate-parameters.js.map +1 -1
- package/dist/esm/context/query/types.js.map +1 -1
- package/dist/esm/context/related/client.js.map +1 -1
- package/dist/esm/context/related/generate-endpoint.js +0 -1
- package/dist/esm/context/related/generate-endpoint.js.map +1 -1
- package/dist/esm/context/related/generate-parameters.js.map +1 -1
- package/dist/esm/context/related/types.js.map +1 -1
- package/dist/esm/context/static.js.map +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/module.js.map +1 -1
- package/dist/esm/notification/client.js.map +1 -1
- package/dist/esm/notification/notification/delete/client.js.map +1 -1
- package/dist/esm/notification/notification/delete/generate-endpoint.js +0 -1
- package/dist/esm/notification/notification/delete/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/delete/generate-parameters.js.map +1 -1
- package/dist/esm/notification/notification/get/client.js.map +1 -1
- package/dist/esm/notification/notification/get/generate-endpoint.js +0 -1
- package/dist/esm/notification/notification/get/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/get/generate-parameters.js.map +1 -1
- package/dist/esm/notification/notification/getAll/client.js.map +1 -1
- package/dist/esm/notification/notification/getAll/generate-endpoint.js +0 -1
- package/dist/esm/notification/notification/getAll/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/getAll/generate-parameters.js.map +1 -1
- package/dist/esm/notification/notification/patch/client.js.map +1 -1
- package/dist/esm/notification/notification/patch/generate-endpoint.js +0 -1
- package/dist/esm/notification/notification/patch/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/patch/generate-parameters.js.map +1 -1
- package/dist/esm/notification/notification/post/client.js.map +1 -1
- package/dist/esm/notification/notification/post/generate-endpoint.js +0 -1
- package/dist/esm/notification/notification/post/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/post/generate-parameters.js.map +1 -1
- package/dist/esm/notification/settings/get/client.js.map +1 -1
- package/dist/esm/notification/settings/get/generate-endpoint.js +0 -1
- package/dist/esm/notification/settings/get/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/settings/get/generate-parameters.js.map +1 -1
- package/dist/esm/notification/settings/put/client.js.map +1 -1
- package/dist/esm/notification/settings/put/generate-endpoint.js +0 -1
- package/dist/esm/notification/settings/put/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/settings/put/generate-parameters.js.map +1 -1
- package/dist/esm/notification/static.js.map +1 -1
- package/dist/esm/people/client.js.map +1 -1
- package/dist/esm/people/person-details/client.js.map +1 -1
- package/dist/esm/people/person-details/generate-endpoint.js.map +1 -1
- package/dist/esm/people/person-details/generate-parameters.js.map +1 -1
- package/dist/esm/people/person-photo/client.js.map +1 -1
- package/dist/esm/people/person-photo/generate-endpoint.js.map +1 -1
- package/dist/esm/people/person-photo/generate-parameters.js.map +1 -1
- package/dist/esm/people/query/client.js.map +1 -1
- package/dist/esm/people/query/generate-endpoint.js.map +1 -1
- package/dist/esm/people/query/generate-parameters.js.map +1 -1
- package/dist/esm/people/static.js.map +1 -1
- package/dist/esm/people/utils.js.map +1 -1
- package/dist/esm/provider.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bookmarks/api-version.d.ts +2 -2
- package/dist/types/bookmarks/client.d.ts +8 -8
- package/dist/types/bookmarks/endpoints/bookmark-apply.get.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/bookmark.delete.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/bookmark.get.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/bookmark.patch.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/bookmark.post.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/user-bookmark-favourite.delete.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/user-bookmark-favourite.head.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/user-bookmark-favourite.post.d.ts +1 -1
- package/dist/types/bookmarks/endpoints/user-bookmarks.get.d.ts +1 -1
- package/dist/types/bookmarks/selectors.d.ts +1 -1
- package/dist/types/bookmarks/types.d.ts +1 -1
- package/dist/types/configurator.d.ts +1 -1
- package/dist/types/context/client.d.ts +4 -4
- package/dist/types/context/get/client.d.ts +1 -1
- package/dist/types/context/get/types.d.ts +2 -2
- package/dist/types/context/query/client.d.ts +1 -1
- package/dist/types/context/query/generate-parameters.d.ts +1 -1
- package/dist/types/context/query/types.d.ts +2 -2
- package/dist/types/context/related/client.d.ts +1 -1
- package/dist/types/context/related/generate-parameters.d.ts +1 -1
- package/dist/types/context/related/types.d.ts +2 -2
- package/dist/types/context/static.d.ts +2 -2
- package/dist/types/module.d.ts +2 -2
- package/dist/types/notification/client.d.ts +9 -9
- package/dist/types/notification/notification/delete/client.d.ts +2 -2
- package/dist/types/notification/notification/delete/generate-parameters.d.ts +2 -2
- package/dist/types/notification/notification/delete/types.d.ts +3 -3
- package/dist/types/notification/notification/get/client.d.ts +2 -2
- package/dist/types/notification/notification/get/generate-parameters.d.ts +2 -2
- package/dist/types/notification/notification/get/types.d.ts +3 -3
- package/dist/types/notification/notification/getAll/client.d.ts +2 -2
- package/dist/types/notification/notification/getAll/generate-parameters.d.ts +2 -2
- package/dist/types/notification/notification/getAll/types.d.ts +3 -3
- package/dist/types/notification/notification/patch/client.d.ts +2 -2
- package/dist/types/notification/notification/patch/generate-parameters.d.ts +2 -2
- package/dist/types/notification/notification/patch/types.d.ts +3 -3
- package/dist/types/notification/notification/post/client.d.ts +2 -2
- package/dist/types/notification/notification/post/generate-parameters.d.ts +2 -2
- package/dist/types/notification/notification/post/types.d.ts +3 -3
- package/dist/types/notification/settings/get/client.d.ts +2 -2
- package/dist/types/notification/settings/get/generate-parameters.d.ts +2 -2
- package/dist/types/notification/settings/get/types.d.ts +3 -3
- package/dist/types/notification/settings/put/client.d.ts +2 -2
- package/dist/types/notification/settings/put/generate-parameters.d.ts +2 -2
- package/dist/types/notification/settings/put/types.d.ts +3 -3
- package/dist/types/notification/static.d.ts +2 -2
- package/dist/types/people/api-models.d.ts +2 -2
- package/dist/types/people/api-models.v2.d.ts +1 -1
- package/dist/types/people/api-models.v4.d.ts +1 -1
- package/dist/types/people/client.d.ts +4 -4
- package/dist/types/people/person-details/client.d.ts +1 -1
- package/dist/types/people/person-details/types.d.ts +1 -1
- package/dist/types/people/person-photo/client.d.ts +1 -1
- package/dist/types/people/person-photo/types.d.ts +2 -2
- package/dist/types/people/query/client.d.ts +1 -1
- package/dist/types/people/query/types.d.ts +2 -2
- package/dist/types/people/static.d.ts +2 -2
- package/dist/types/people/utils.d.ts +1 -1
- package/dist/types/provider.d.ts +3 -3
- package/dist/types/types.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/bookmarks/api-version.ts +2 -2
- package/src/bookmarks/client.ts +228 -231
- package/src/bookmarks/endpoints/bookmark-apply.get.ts +58 -58
- package/src/bookmarks/endpoints/bookmark.delete.ts +57 -57
- package/src/bookmarks/endpoints/bookmark.get.ts +62 -62
- package/src/bookmarks/endpoints/bookmark.patch.ts +78 -78
- package/src/bookmarks/endpoints/bookmark.post.ts +68 -68
- package/src/bookmarks/endpoints/user-bookmark-favourite.delete.ts +57 -57
- package/src/bookmarks/endpoints/user-bookmark-favourite.head.ts +57 -57
- package/src/bookmarks/endpoints/user-bookmark-favourite.post.ts +58 -58
- package/src/bookmarks/endpoints/user-bookmarks.get.ts +98 -98
- package/src/bookmarks/schemas.ts +54 -56
- package/src/bookmarks/selectors.ts +24 -24
- package/src/bookmarks/types.ts +6 -6
- package/src/configurator.ts +3 -3
- package/src/context/api-models.ts +19 -19
- package/src/context/client.ts +68 -58
- package/src/context/get/client.ts +18 -18
- package/src/context/get/generate-endpoint.ts +13 -14
- package/src/context/get/generate-parameters.ts +9 -9
- package/src/context/get/types.ts +20 -20
- package/src/context/query/client.ts +22 -22
- package/src/context/query/generate-endpoint.ts +43 -44
- package/src/context/query/generate-parameters.ts +10 -10
- package/src/context/query/types.ts +25 -25
- package/src/context/related/client.ts +22 -22
- package/src/context/related/generate-endpoint.ts +40 -41
- package/src/context/related/generate-parameters.ts +10 -10
- package/src/context/related/types.ts +27 -27
- package/src/context/static.ts +3 -3
- package/src/errors.ts +6 -6
- package/src/module.ts +50 -52
- package/src/notification/api-models.ts +36 -36
- package/src/notification/client.ts +131 -151
- package/src/notification/notification/delete/client.ts +22 -22
- package/src/notification/notification/delete/generate-endpoint.ts +13 -14
- package/src/notification/notification/delete/generate-parameters.ts +18 -18
- package/src/notification/notification/delete/types.ts +21 -21
- package/src/notification/notification/get/client.ts +19 -19
- package/src/notification/notification/get/generate-endpoint.ts +13 -14
- package/src/notification/notification/get/generate-parameters.ts +11 -11
- package/src/notification/notification/get/types.ts +21 -21
- package/src/notification/notification/getAll/client.ts +22 -22
- package/src/notification/notification/getAll/generate-endpoint.ts +13 -14
- package/src/notification/notification/getAll/generate-parameters.ts +11 -11
- package/src/notification/notification/getAll/types.ts +21 -21
- package/src/notification/notification/patch/client.ts +22 -22
- package/src/notification/notification/patch/generate-endpoint.ts +13 -14
- package/src/notification/notification/patch/generate-parameters.ts +18 -18
- package/src/notification/notification/patch/types.ts +22 -22
- package/src/notification/notification/post/client.ts +22 -22
- package/src/notification/notification/post/generate-endpoint.ts +13 -14
- package/src/notification/notification/post/generate-parameters.ts +18 -18
- package/src/notification/notification/post/types.ts +31 -31
- package/src/notification/settings/get/client.ts +22 -22
- package/src/notification/settings/get/generate-endpoint.ts +13 -14
- package/src/notification/settings/get/generate-parameters.ts +11 -11
- package/src/notification/settings/get/types.ts +21 -21
- package/src/notification/settings/put/client.ts +22 -22
- package/src/notification/settings/put/generate-endpoint.ts +13 -14
- package/src/notification/settings/put/generate-parameters.ts +20 -20
- package/src/notification/settings/put/types.ts +20 -20
- package/src/notification/static.ts +3 -3
- package/src/people/api-models.ts +30 -30
- package/src/people/api-models.v2.ts +27 -27
- package/src/people/api-models.v4.ts +79 -79
- package/src/people/client.ts +73 -77
- package/src/people/person-details/client.ts +21 -18
- package/src/people/person-details/generate-endpoint.ts +16 -16
- package/src/people/person-details/generate-parameters.ts +8 -8
- package/src/people/person-details/types.ts +13 -13
- package/src/people/person-photo/client.ts +19 -22
- package/src/people/person-photo/generate-endpoint.ts +13 -13
- package/src/people/person-photo/generate-parameters.ts +8 -8
- package/src/people/person-photo/types.ts +8 -8
- package/src/people/query/client.ts +20 -18
- package/src/people/query/generate-endpoint.ts +14 -14
- package/src/people/query/generate-parameters.ts +8 -8
- package/src/people/query/types.ts +10 -10
- package/src/people/static.ts +2 -2
- package/src/people/utils.ts +20 -20
- package/src/provider.ts +85 -85
- package/src/types.ts +34 -34
- package/src/utils.ts +22 -26
- package/src/version.ts +1 -1
|
@@ -1,45 +1,45 @@
|
|
|
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 PatchNotificationArgs_v1 = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
id: string;
|
|
8
|
+
seenByUser: boolean;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
type PatchNotificationArgs_v2 = PatchNotificationArgs_v1;
|
|
12
12
|
|
|
13
13
|
type PatchNotificationArgsTypes = {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
[ApiVersion.v1]: PatchNotificationArgs_v1;
|
|
15
|
+
[ApiVersion.v2]: PatchNotificationArgs_v2;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export type PatchNotificationArgs<T extends string> = T extends keyof typeof ApiVersion
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
? PatchNotificationArgsTypes[(typeof ApiVersion)[T]]
|
|
20
|
+
: unknown;
|
|
21
21
|
|
|
22
22
|
type PatchNotificationResponseTypes = {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
[ApiVersion.v1]: ApiNotificationEntity<ApiVersion.v1>;
|
|
24
|
+
[ApiVersion.v2]: ApiNotificationEntity<ApiVersion.v2>;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export type PatchNotificationResponse<T> = T extends keyof typeof ApiVersion
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
? PatchNotificationResponseTypes[(typeof ApiVersion)[T]]
|
|
29
|
+
: unknown;
|
|
30
30
|
|
|
31
31
|
export type PatchNotificationFn<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
33
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
34
|
+
TClient extends IHttpClient = IHttpClient,
|
|
35
|
+
TResult = PatchNotificationResponse<TVersion>,
|
|
36
36
|
> = (
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
args: PatchNotificationArgs<TVersion>,
|
|
38
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
39
39
|
) => PatchNotificationResult<TVersion, TMethod, TResult>;
|
|
40
40
|
|
|
41
41
|
export type PatchNotificationResult<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
43
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
44
|
+
TResult = PatchNotificationResponse<TVersion>,
|
|
45
45
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
PostNotificationArgs,
|
|
9
|
+
PostNotificationResult,
|
|
10
|
+
PostNotificationResponse,
|
|
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 createNotification =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 = PostNotificationResponse<TVersion>>(
|
|
30
|
+
args: PostNotificationArgs<TVersion>,
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
|
+
): PostNotificationResult<TVersion, TMethod, T> =>
|
|
33
|
+
client[method](
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
|
+
) as PostNotificationResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default createNotification;
|
|
@@ -7,19 +7,18 @@ import type { PostNotificationArgs } from './types';
|
|
|
7
7
|
* Method for generating endpoint for getting all notifications
|
|
8
8
|
*/
|
|
9
9
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return `/person/${userId}/notifications/?${String(params)}`;
|
|
23
|
-
}
|
|
10
|
+
version: TVersion,
|
|
11
|
+
args: PostNotificationArgs<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 { userId } = args as { userId: string };
|
|
19
|
+
const params = new URLSearchParams();
|
|
20
|
+
params.append('api-version', apiVersion);
|
|
21
|
+
return `/person/${userId}/notifications/?${String(params)}`;
|
|
24
22
|
}
|
|
23
|
+
}
|
|
25
24
|
};
|
|
@@ -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 { PostNotificationArgs } from './types';
|
|
6
|
+
import type { PostNotificationArgs } from './types';
|
|
7
7
|
|
|
8
8
|
/** function for creating http client arguments */
|
|
9
9
|
export const generateParameters = <
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
TResult,
|
|
11
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
version: TVersion,
|
|
15
|
+
args: PostNotificationArgs<TVersion>,
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
|
-
|
|
18
|
+
const path = generateEndpoint(version, args);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const headers = new Headers();
|
|
21
|
+
headers.append('content-type', 'application/json');
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const requestParams: ClientRequestInit<TClient, TResult> = Object.assign(
|
|
24
|
+
{},
|
|
25
|
+
{ method: 'POST', body: JSON.stringify(args), headers: headers },
|
|
26
|
+
init,
|
|
27
|
+
);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
return [path, requestParams];
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export default generateParameters;
|
|
@@ -1,57 +1,57 @@
|
|
|
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 SourceSystem_v1 = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
name: string;
|
|
8
|
+
subSystem: string;
|
|
9
|
+
identifier: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
type PostNotificationArgs_v1 = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
appKey: string;
|
|
14
|
+
emailPriority: number;
|
|
15
|
+
fallbackHtml: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
card: string;
|
|
19
|
+
sourceSystem: SourceSystem_v1;
|
|
20
|
+
originalCreatorUniqueId: string;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
type PostNotificationArgs_v2 = PostNotificationArgs_v1;
|
|
24
24
|
|
|
25
25
|
type PostNotificationArgsTypes = {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
[ApiVersion.v1]: PostNotificationArgs_v1;
|
|
27
|
+
[ApiVersion.v2]: PostNotificationArgs_v2;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export type PostNotificationArgs<T extends string> = T extends keyof typeof ApiVersion
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
? PostNotificationArgsTypes[(typeof ApiVersion)[T]]
|
|
32
|
+
: unknown;
|
|
33
33
|
|
|
34
34
|
type PostNotificationResponseTypes = {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
[ApiVersion.v1]: Array<ApiNotificationEntity<ApiVersion.v1>>;
|
|
36
|
+
[ApiVersion.v2]: Array<ApiNotificationEntity<ApiVersion.v2>>;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export type PostNotificationResponse<T> = T extends keyof typeof ApiVersion
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
? PostNotificationResponseTypes[(typeof ApiVersion)[T]]
|
|
41
|
+
: unknown;
|
|
42
42
|
|
|
43
43
|
export type PostNotificationFn<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
45
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
46
|
+
TClient extends IHttpClient = IHttpClient,
|
|
47
|
+
TResult = PostNotificationResponse<TVersion>,
|
|
48
48
|
> = (
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
args: PostNotificationArgs<TVersion>,
|
|
50
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
51
51
|
) => PostNotificationResult<TVersion, TMethod, TResult>;
|
|
52
52
|
|
|
53
53
|
export type PostNotificationResult<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
55
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
56
|
+
TResult = PostNotificationResponse<TVersion>,
|
|
57
57
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
GetUserNotificationSettingsArgs,
|
|
9
|
+
GetUserNotificationsSettingsResult,
|
|
10
|
+
GetUserNotificationSettingsResponse,
|
|
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 getUserNotificationSettings =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 = GetUserNotificationSettingsResponse<TVersion>>(
|
|
30
|
+
args: GetUserNotificationSettingsArgs<TVersion>,
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
|
+
): GetUserNotificationsSettingsResult<TVersion, TMethod, T> =>
|
|
33
|
+
client[method](
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
|
+
) as GetUserNotificationsSettingsResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default getUserNotificationSettings;
|
|
@@ -7,19 +7,18 @@ import type { GetUserNotificationSettingsArgs } from './types';
|
|
|
7
7
|
* Method for generating endpoint for getting all notifications
|
|
8
8
|
*/
|
|
9
9
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return `/person/${userId}/notifications/settings/?${String(params)}`;
|
|
23
|
-
}
|
|
10
|
+
version: TVersion,
|
|
11
|
+
args: GetUserNotificationSettingsArgs<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 { userId } = args as { userId: string };
|
|
19
|
+
const params = new URLSearchParams();
|
|
20
|
+
params.append('api-version', apiVersion);
|
|
21
|
+
return `/person/${userId}/notifications/settings/?${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 { GetUserNotificationSettingsArgs } from './types';
|
|
6
|
+
import type { GetUserNotificationSettingsArgs } from './types';
|
|
7
7
|
|
|
8
8
|
/** function for creating http client arguments */
|
|
9
9
|
export const generateParameters = <
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
TResult,
|
|
11
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
version: TVersion,
|
|
15
|
+
args: GetUserNotificationSettingsArgs<TVersion>,
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const path = generateEndpoint(version, args);
|
|
19
|
+
return [path, init];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
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 { ApiNotificationSettingsEntity } from '../../api-models';
|
|
1
|
+
import type { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
import type { ClientMethod } from '../../../types';
|
|
3
|
+
import type { ApiNotificationSettingsEntity } from '../../api-models';
|
|
4
4
|
import { ApiVersion } from '../../static';
|
|
5
5
|
|
|
6
6
|
type GetUserNotificationSettingsArgs_v1 = {
|
|
7
|
-
|
|
7
|
+
userId: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
type GetUserNotificationSettingsArgs_v2 = GetUserNotificationSettingsArgs_v1;
|
|
11
11
|
|
|
12
12
|
type GetUserNotificationSettingsArgsTypes = {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
[ApiVersion.v1]: GetUserNotificationSettingsArgs_v1;
|
|
14
|
+
[ApiVersion.v2]: GetUserNotificationSettingsArgs_v2;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export type GetUserNotificationSettingsArgs<T extends string> = T extends keyof typeof ApiVersion
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
? GetUserNotificationSettingsArgsTypes[(typeof ApiVersion)[T]]
|
|
19
|
+
: unknown;
|
|
20
20
|
|
|
21
21
|
type GetUserNotificationSettingsResponseTypes = {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
[ApiVersion.v1]: ApiNotificationSettingsEntity<ApiVersion.v1>;
|
|
23
|
+
[ApiVersion.v2]: ApiNotificationSettingsEntity<ApiVersion.v2>;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type GetUserNotificationSettingsResponse<T> = T extends keyof typeof ApiVersion
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
? GetUserNotificationSettingsResponseTypes[(typeof ApiVersion)[T]]
|
|
28
|
+
: unknown;
|
|
29
29
|
|
|
30
30
|
export type GetUserNotificationSettingsFn<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
32
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
33
|
+
TClient extends IHttpClient = IHttpClient,
|
|
34
|
+
TResult = GetUserNotificationSettingsResponse<TVersion>,
|
|
35
35
|
> = (
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
args: GetUserNotificationSettingsArgs<TVersion>,
|
|
37
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
38
38
|
) => GetUserNotificationsSettingsResult<TVersion, TMethod, TResult>;
|
|
39
39
|
|
|
40
40
|
export type GetUserNotificationsSettingsResult<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
42
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
43
|
+
TResult = GetUserNotificationSettingsResponse<TVersion>,
|
|
44
44
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
PutUserNotificationSettingsArgs,
|
|
9
|
+
PutUserNotificationSettingsResult,
|
|
10
|
+
PutUserNotificationSettingsResponse,
|
|
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 updateUserNotificationSettings =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 = PutUserNotificationSettingsResponse<TVersion>>(
|
|
30
|
+
args: PutUserNotificationSettingsArgs<TVersion>,
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
|
+
): PutUserNotificationSettingsResult<TVersion, TMethod, T> =>
|
|
33
|
+
client[method](
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
|
+
) as PutUserNotificationSettingsResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default updateUserNotificationSettings;
|
|
@@ -7,19 +7,18 @@ import type { PutUserNotificationSettingsArgs } from './types';
|
|
|
7
7
|
* Method for generating endpoint for getting all notifications
|
|
8
8
|
*/
|
|
9
9
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return `/person/${userId}/notifications/settings/?${String(params)}`;
|
|
23
|
-
}
|
|
10
|
+
version: TVersion,
|
|
11
|
+
args: PutUserNotificationSettingsArgs<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 { userId } = args as { userId: string };
|
|
19
|
+
const params = new URLSearchParams();
|
|
20
|
+
params.append('api-version', apiVersion);
|
|
21
|
+
return `/person/${userId}/notifications/settings/?${String(params)}`;
|
|
24
22
|
}
|
|
23
|
+
}
|
|
25
24
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
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 { PutUserNotificationSettingsArgs } from './types';
|
|
6
|
+
import type { PutUserNotificationSettingsArgs } from './types';
|
|
7
7
|
|
|
8
8
|
/** function for creating http client arguments */
|
|
9
9
|
export const generateParameters = <
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
TResult,
|
|
11
|
+
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
version: TVersion,
|
|
15
|
+
args: PutUserNotificationSettingsArgs<TVersion>,
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const path = generateEndpoint(version, args);
|
|
19
|
+
//add versions switch case later
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
//Not sure why this is needed, defaults to application/problem+json failing the request
|
|
22
|
+
const headers = new Headers();
|
|
23
|
+
headers.append('content-type', 'application/json');
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const requestParams: ClientRequestInit<TClient, TResult> = Object.assign(
|
|
26
|
+
{},
|
|
27
|
+
{ method: 'PUT', body: JSON.stringify(args), headers: headers },
|
|
28
|
+
init,
|
|
29
|
+
);
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
return [path, requestParams];
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export default generateParameters;
|