@equinor/fusion-framework-module-services 3.1.3 → 3.1.4
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 +13 -0
- package/LICENSE +21 -0
- package/dist/esm/bookmarks/client.js.map +1 -1
- package/dist/esm/context/client.js +1 -1
- package/dist/esm/context/client.js.map +1 -1
- package/dist/esm/context/get/generate-endpoint.js +2 -2
- package/dist/esm/context/get/generate-endpoint.js.map +1 -1
- package/dist/esm/context/get/index.js +1 -1
- package/dist/esm/context/get/index.js.map +1 -1
- package/dist/esm/context/get/types.js +1 -1
- package/dist/esm/context/get/types.js.map +1 -1
- package/dist/esm/context/query/generate-endpoint.js +2 -2
- package/dist/esm/context/query/generate-endpoint.js.map +1 -1
- package/dist/esm/context/query/index.js +1 -1
- package/dist/esm/context/query/index.js.map +1 -1
- package/dist/esm/context/query/types.js +1 -1
- package/dist/esm/context/query/types.js.map +1 -1
- package/dist/esm/context/related/generate-endpoint.js +2 -2
- package/dist/esm/context/related/generate-endpoint.js.map +1 -1
- package/dist/esm/context/related/index.js +1 -1
- package/dist/esm/context/related/index.js.map +1 -1
- package/dist/esm/context/related/types.js +1 -1
- package/dist/esm/context/related/types.js.map +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/notification/client.js.map +1 -1
- package/dist/esm/notification/notification/delete/generate-endpoint.js +2 -2
- package/dist/esm/notification/notification/delete/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/delete/index.js +1 -1
- package/dist/esm/notification/notification/delete/index.js.map +1 -1
- package/dist/esm/notification/notification/get/generate-endpoint.js +2 -2
- package/dist/esm/notification/notification/get/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/get/index.js +1 -1
- package/dist/esm/notification/notification/get/index.js.map +1 -1
- package/dist/esm/notification/notification/getAll/generate-endpoint.js +2 -2
- package/dist/esm/notification/notification/getAll/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/getAll/index.js +1 -1
- package/dist/esm/notification/notification/getAll/index.js.map +1 -1
- package/dist/esm/notification/notification/patch/generate-endpoint.js +2 -2
- package/dist/esm/notification/notification/patch/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/patch/index.js +1 -1
- package/dist/esm/notification/notification/patch/index.js.map +1 -1
- package/dist/esm/notification/notification/post/generate-endpoint.js +2 -2
- package/dist/esm/notification/notification/post/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/notification/post/index.js +1 -1
- package/dist/esm/notification/notification/post/index.js.map +1 -1
- package/dist/esm/notification/settings/get/generate-endpoint.js +2 -2
- package/dist/esm/notification/settings/get/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/settings/get/index.js +1 -1
- package/dist/esm/notification/settings/get/index.js.map +1 -1
- package/dist/esm/notification/settings/put/generate-endpoint.js +2 -2
- package/dist/esm/notification/settings/put/generate-endpoint.js.map +1 -1
- package/dist/esm/notification/settings/put/index.js +1 -1
- package/dist/esm/notification/settings/put/index.js.map +1 -1
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bookmarks/client.d.ts +1 -1
- package/dist/types/bookmarks/types.d.ts +1 -1
- package/dist/types/context/client.d.ts +2 -1
- package/dist/types/context/get/index.d.ts +1 -1
- package/dist/types/context/get/types.d.ts +2 -2
- package/dist/types/context/query/index.d.ts +1 -1
- package/dist/types/context/query/types.d.ts +2 -2
- package/dist/types/context/related/index.d.ts +1 -1
- package/dist/types/context/related/types.d.ts +2 -2
- package/dist/types/context/types.d.ts +1 -1
- package/dist/types/notification/notification/delete/index.d.ts +1 -1
- package/dist/types/notification/notification/get/index.d.ts +1 -1
- package/dist/types/notification/notification/getAll/index.d.ts +1 -1
- package/dist/types/notification/notification/patch/index.d.ts +1 -1
- package/dist/types/notification/notification/post/index.d.ts +1 -1
- package/dist/types/notification/settings/get/index.d.ts +1 -1
- package/dist/types/notification/settings/put/index.d.ts +1 -1
- package/dist/types/notification/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -0
- package/package.json +67 -68
- package/src/bookmarks/client.ts +7 -4
- package/src/bookmarks/delete/client.ts +4 -4
- package/src/bookmarks/delete/generate-endpoint.ts +1 -1
- package/src/bookmarks/delete/generate-parameters.ts +3 -3
- package/src/bookmarks/delete/types.ts +3 -3
- package/src/bookmarks/favorites/delete/client.ts +4 -4
- package/src/bookmarks/favorites/delete/generate-endpoint.ts +1 -1
- package/src/bookmarks/favorites/delete/generate-parameters.ts +3 -3
- package/src/bookmarks/favorites/delete/types.ts +3 -3
- package/src/bookmarks/favorites/head/client.ts +4 -4
- package/src/bookmarks/favorites/head/generate-endpoint.ts +1 -1
- package/src/bookmarks/favorites/head/generate-parameters.ts +3 -3
- package/src/bookmarks/favorites/head/types.ts +3 -3
- package/src/bookmarks/favorites/post/client.ts +4 -4
- package/src/bookmarks/favorites/post/generate-endpoint.ts +1 -1
- package/src/bookmarks/favorites/post/generate-parameters.ts +3 -3
- package/src/bookmarks/favorites/post/types.ts +3 -3
- package/src/bookmarks/get/client.ts +4 -4
- package/src/bookmarks/get/generate-endpoint.ts +1 -1
- package/src/bookmarks/get/generate-parameters.ts +2 -2
- package/src/bookmarks/get/types.ts +4 -4
- package/src/bookmarks/getAll/client.ts +4 -4
- package/src/bookmarks/getAll/generate-parameters.ts +2 -2
- package/src/bookmarks/getAll/types.ts +2 -2
- package/src/bookmarks/patch/client.ts +4 -4
- package/src/bookmarks/patch/generate-endpoint.ts +1 -1
- package/src/bookmarks/patch/generate-parameters.ts +3 -3
- package/src/bookmarks/patch/types.ts +5 -5
- package/src/bookmarks/post/client.ts +4 -4
- package/src/bookmarks/post/generate-endpoint.ts +1 -1
- package/src/bookmarks/post/generate-parameters.ts +3 -3
- package/src/bookmarks/post/types.ts +5 -5
- package/src/bookmarks/types.ts +1 -5
- package/src/context/client.ts +10 -6
- package/src/context/get/client.ts +5 -5
- package/src/context/get/generate-endpoint.ts +3 -3
- package/src/context/get/generate-parameters.ts +3 -3
- package/src/context/get/index.ts +1 -1
- package/src/context/get/types.ts +5 -12
- package/src/context/query/client.ts +5 -5
- package/src/context/query/generate-endpoint.ts +3 -3
- package/src/context/query/generate-parameters.ts +3 -3
- package/src/context/query/index.ts +1 -1
- package/src/context/query/types.ts +5 -12
- package/src/context/related/client.ts +5 -5
- package/src/context/related/generate-endpoint.ts +3 -3
- package/src/context/related/generate-parameters.ts +3 -3
- package/src/context/related/index.ts +1 -1
- package/src/context/related/types.ts +5 -12
- package/src/context/types.ts +1 -5
- package/src/errors.ts +4 -1
- package/src/module.ts +3 -3
- package/src/notification/client.ts +19 -16
- package/src/notification/notification/delete/client.ts +4 -4
- package/src/notification/notification/delete/generate-endpoint.ts +3 -3
- package/src/notification/notification/delete/generate-parameters.ts +3 -3
- package/src/notification/notification/delete/index.ts +1 -1
- package/src/notification/notification/delete/types.ts +3 -3
- package/src/notification/notification/get/client.ts +4 -4
- package/src/notification/notification/get/generate-endpoint.ts +3 -3
- package/src/notification/notification/get/generate-parameters.ts +2 -2
- package/src/notification/notification/get/index.ts +1 -1
- package/src/notification/notification/get/types.ts +3 -3
- package/src/notification/notification/getAll/client.ts +4 -4
- package/src/notification/notification/getAll/generate-endpoint.ts +3 -3
- package/src/notification/notification/getAll/generate-parameters.ts +2 -2
- package/src/notification/notification/getAll/index.ts +1 -1
- package/src/notification/notification/getAll/types.ts +3 -3
- package/src/notification/notification/patch/client.ts +4 -4
- package/src/notification/notification/patch/generate-endpoint.ts +3 -3
- package/src/notification/notification/patch/generate-parameters.ts +3 -3
- package/src/notification/notification/patch/index.ts +1 -1
- package/src/notification/notification/patch/types.ts +3 -3
- package/src/notification/notification/post/client.ts +4 -4
- package/src/notification/notification/post/generate-endpoint.ts +3 -3
- package/src/notification/notification/post/generate-parameters.ts +3 -3
- package/src/notification/notification/post/index.ts +1 -1
- package/src/notification/notification/post/types.ts +3 -3
- package/src/notification/settings/get/client.ts +4 -4
- package/src/notification/settings/get/generate-endpoint.ts +3 -3
- package/src/notification/settings/get/generate-parameters.ts +2 -2
- package/src/notification/settings/get/index.ts +1 -1
- package/src/notification/settings/get/types.ts +3 -3
- package/src/notification/settings/put/client.ts +4 -4
- package/src/notification/settings/put/generate-endpoint.ts +3 -3
- package/src/notification/settings/put/generate-parameters.ts +3 -3
- package/src/notification/settings/put/index.ts +1 -1
- package/src/notification/settings/put/types.ts +3 -3
- package/src/notification/types.ts +1 -5
- package/src/provider.ts +6 -6
- package/src/types.ts +2 -2
- package/src/version.ts +2 -0
- package/tsconfig.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import buildOdataQuery from 'odata-query';
|
|
2
2
|
|
|
3
|
-
import { UnsupportedApiVersion } from '
|
|
3
|
+
import { UnsupportedApiVersion } from '../../errors';
|
|
4
4
|
|
|
5
|
-
import { ApiVersion } from '
|
|
5
|
+
import { ApiVersion } from '..';
|
|
6
6
|
|
|
7
7
|
import type {
|
|
8
8
|
RelatedContextArgs,
|
|
@@ -44,7 +44,7 @@ const createSearchParameters = (args: string | RelatedContextOdataParameters) =>
|
|
|
44
44
|
|
|
45
45
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
46
46
|
version: TVersion,
|
|
47
|
-
args: RelatedContextArgs<TVersion
|
|
47
|
+
args: RelatedContextArgs<TVersion>,
|
|
48
48
|
) => {
|
|
49
49
|
const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
|
|
50
50
|
switch (apiVersion) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
2
|
|
|
3
|
-
import { ApiVersion } from '
|
|
3
|
+
import { ApiVersion } from '..';
|
|
4
4
|
|
|
5
5
|
import { generateEndpoint } from './generate-endpoint';
|
|
6
6
|
|
|
@@ -10,11 +10,11 @@ import type { RelatedContextArgs, ApiClientArguments } from './types';
|
|
|
10
10
|
export const generateParameters = <
|
|
11
11
|
TResult,
|
|
12
12
|
TVersion extends string = keyof typeof ApiVersion,
|
|
13
|
-
TClient extends IHttpClient = IHttpClient
|
|
13
|
+
TClient extends IHttpClient = IHttpClient,
|
|
14
14
|
>(
|
|
15
15
|
version: TVersion,
|
|
16
16
|
args: RelatedContextArgs<TVersion>,
|
|
17
|
-
init?: ClientRequestInit<TClient, TResult
|
|
17
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
18
18
|
): ApiClientArguments<TClient, TResult> => {
|
|
19
19
|
const path = generateEndpoint(version, args);
|
|
20
20
|
return [path, init];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ApiVersion, ApiContextEntity } from '
|
|
1
|
+
export { ApiVersion, ApiContextEntity } from '..';
|
|
2
2
|
|
|
3
3
|
export { generateEndpoint } from './generate-endpoint';
|
|
4
4
|
export { generateParameters } from './generate-parameters';
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
ApiVersion,
|
|
5
|
-
ApiContextEntity,
|
|
6
|
-
ClientMethod,
|
|
7
|
-
} from '@equinor/fusion-framework-module-services/context';
|
|
3
|
+
import { ApiVersion, ApiContextEntity, ClientMethod } from '..';
|
|
8
4
|
|
|
9
|
-
export {
|
|
10
|
-
ApiClientArguments,
|
|
11
|
-
ClientMethod,
|
|
12
|
-
} from '@equinor/fusion-framework-module-services/context';
|
|
5
|
+
export { ApiClientArguments, ClientMethod } from '..';
|
|
13
6
|
|
|
14
7
|
export type ApiRelatedContextEntity<T extends ApiVersion> = ApiContextEntity<T> & {
|
|
15
8
|
relationSource: string; // "ProjectMaster|OrgChart",
|
|
@@ -55,14 +48,14 @@ export type RelatedContextFn<
|
|
|
55
48
|
TVersion extends string = keyof typeof ApiVersion,
|
|
56
49
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
57
50
|
TClient extends IHttpClient = IHttpClient,
|
|
58
|
-
TResult = RelatedContextResponse<TVersion
|
|
51
|
+
TResult = RelatedContextResponse<TVersion>,
|
|
59
52
|
> = (
|
|
60
53
|
args: RelatedContextArgs<TVersion>,
|
|
61
|
-
init?: ClientRequestInit<TClient, TResult
|
|
54
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
62
55
|
) => RelatedContextResult<TVersion, TMethod, TResult>;
|
|
63
56
|
|
|
64
57
|
export type RelatedContextResult<
|
|
65
58
|
TVersion extends string = keyof typeof ApiVersion,
|
|
66
59
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
67
|
-
TResult = RelatedContextResponse<TVersion
|
|
60
|
+
TResult = RelatedContextResponse<TVersion>,
|
|
68
61
|
> = ClientMethod<TResult>[TMethod];
|
package/src/context/types.ts
CHANGED
package/src/errors.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export class UnsupportedApiVersion extends Error {
|
|
2
|
-
constructor(
|
|
2
|
+
constructor(
|
|
3
|
+
public readonly version: string | number,
|
|
4
|
+
cause?: unknown,
|
|
5
|
+
) {
|
|
3
6
|
super(`unsupported version ${version}`, { cause });
|
|
4
7
|
}
|
|
5
8
|
}
|
package/src/module.ts
CHANGED
|
@@ -51,7 +51,7 @@ export const module: ServicesModule = {
|
|
|
51
51
|
if (!config.createClient) {
|
|
52
52
|
const http = await requireInstance('http');
|
|
53
53
|
const serviceDiscovery: ServiceDiscoveryProvider | undefined = hasModule(
|
|
54
|
-
'serviceDiscovery'
|
|
54
|
+
'serviceDiscovery',
|
|
55
55
|
)
|
|
56
56
|
? /** if the module is within module, await creation */
|
|
57
57
|
await requireInstance('serviceDiscovery')
|
|
@@ -73,7 +73,7 @@ export const module: ServicesModule = {
|
|
|
73
73
|
*/
|
|
74
74
|
export const enableServices = (
|
|
75
75
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
-
config: IModulesConfigurator<any, any
|
|
76
|
+
config: IModulesConfigurator<any, any>,
|
|
77
77
|
): void => {
|
|
78
78
|
config.addConfig({ module });
|
|
79
79
|
};
|
|
@@ -87,7 +87,7 @@ export const enableServices = (
|
|
|
87
87
|
* @returns Configuration object
|
|
88
88
|
*/
|
|
89
89
|
export const configureServices = (
|
|
90
|
-
configure: (configurator: IApiConfigurator) => void
|
|
90
|
+
configure: (configurator: IApiConfigurator) => void,
|
|
91
91
|
): IModuleConfigurator<ServicesModule> => {
|
|
92
92
|
return {
|
|
93
93
|
module,
|
|
@@ -24,13 +24,16 @@ import getUserNotificationSettings, {
|
|
|
24
24
|
|
|
25
25
|
export class NotificationApiClient<
|
|
26
26
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
27
|
-
TClient extends IHttpClient = IHttpClient
|
|
27
|
+
TClient extends IHttpClient = IHttpClient,
|
|
28
28
|
> {
|
|
29
29
|
get Version(): typeof ApiVersion {
|
|
30
30
|
return ApiVersion;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(
|
|
34
|
+
protected _client: TClient,
|
|
35
|
+
protected _method: TMethod,
|
|
36
|
+
) {}
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* Fetch all notifications
|
|
@@ -38,7 +41,7 @@ export class NotificationApiClient<
|
|
|
38
41
|
*/
|
|
39
42
|
public getAll<
|
|
40
43
|
TVersion extends string = keyof typeof ApiVersion,
|
|
41
|
-
TResult = GetNotificationsResult<TVersion
|
|
44
|
+
TResult = GetNotificationsResult<TVersion>,
|
|
42
45
|
>(
|
|
43
46
|
version: TVersion,
|
|
44
47
|
...args: Parameters<GetNotificationsFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -46,7 +49,7 @@ export class NotificationApiClient<
|
|
|
46
49
|
const fn = getNotifications<TVersion, TMethod, TClient>(
|
|
47
50
|
this._client,
|
|
48
51
|
version,
|
|
49
|
-
this._method
|
|
52
|
+
this._method,
|
|
50
53
|
);
|
|
51
54
|
return fn<TResult>(...args);
|
|
52
55
|
}
|
|
@@ -57,7 +60,7 @@ export class NotificationApiClient<
|
|
|
57
60
|
*/
|
|
58
61
|
public getById<
|
|
59
62
|
TVersion extends string = keyof typeof ApiVersion,
|
|
60
|
-
TResult = GetNotificationResult<TVersion
|
|
63
|
+
TResult = GetNotificationResult<TVersion>,
|
|
61
64
|
>(
|
|
62
65
|
version: TVersion,
|
|
63
66
|
...args: Parameters<GetNotificationFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -65,7 +68,7 @@ export class NotificationApiClient<
|
|
|
65
68
|
const fn = getNotificationById<TVersion, TMethod, TClient>(
|
|
66
69
|
this._client,
|
|
67
70
|
version,
|
|
68
|
-
this._method
|
|
71
|
+
this._method,
|
|
69
72
|
);
|
|
70
73
|
return fn<TResult>(...args);
|
|
71
74
|
}
|
|
@@ -76,7 +79,7 @@ export class NotificationApiClient<
|
|
|
76
79
|
*/
|
|
77
80
|
public setSeenByUser<
|
|
78
81
|
TVersion extends string = keyof typeof ApiVersion,
|
|
79
|
-
TResult = PatchNotificationResult<TVersion
|
|
82
|
+
TResult = PatchNotificationResult<TVersion>,
|
|
80
83
|
>(
|
|
81
84
|
version: TVersion,
|
|
82
85
|
...args: Parameters<PatchNotificationFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -84,7 +87,7 @@ export class NotificationApiClient<
|
|
|
84
87
|
const fn = updateSeenByUser<TVersion, TMethod, TClient>(
|
|
85
88
|
this._client,
|
|
86
89
|
version,
|
|
87
|
-
this._method
|
|
90
|
+
this._method,
|
|
88
91
|
);
|
|
89
92
|
return fn<TResult>(...args);
|
|
90
93
|
}
|
|
@@ -95,7 +98,7 @@ export class NotificationApiClient<
|
|
|
95
98
|
*/
|
|
96
99
|
public create<
|
|
97
100
|
TVersion extends string = keyof typeof ApiVersion,
|
|
98
|
-
TResult = PostNotificationResult<TVersion
|
|
101
|
+
TResult = PostNotificationResult<TVersion>,
|
|
99
102
|
>(
|
|
100
103
|
version: TVersion,
|
|
101
104
|
...args: Parameters<PostNotificationFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -103,7 +106,7 @@ export class NotificationApiClient<
|
|
|
103
106
|
const fn = createNotification<TVersion, TMethod, TClient>(
|
|
104
107
|
this._client,
|
|
105
108
|
version,
|
|
106
|
-
this._method
|
|
109
|
+
this._method,
|
|
107
110
|
);
|
|
108
111
|
return fn<TResult>(...args);
|
|
109
112
|
}
|
|
@@ -114,7 +117,7 @@ export class NotificationApiClient<
|
|
|
114
117
|
*/
|
|
115
118
|
public delete<
|
|
116
119
|
TVersion extends string = keyof typeof ApiVersion,
|
|
117
|
-
TResult = PostNotificationResult<TVersion
|
|
120
|
+
TResult = PostNotificationResult<TVersion>,
|
|
118
121
|
>(
|
|
119
122
|
version: TVersion,
|
|
120
123
|
...args: Parameters<DeleteNotificationFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -122,7 +125,7 @@ export class NotificationApiClient<
|
|
|
122
125
|
const fn = deleteNotification<TVersion, TMethod, TClient>(
|
|
123
126
|
this._client,
|
|
124
127
|
version,
|
|
125
|
-
this._method
|
|
128
|
+
this._method,
|
|
126
129
|
);
|
|
127
130
|
return fn<TResult>(...args);
|
|
128
131
|
}
|
|
@@ -132,7 +135,7 @@ export class NotificationApiClient<
|
|
|
132
135
|
*/
|
|
133
136
|
public getSettings<
|
|
134
137
|
TVersion extends string = keyof typeof ApiVersion,
|
|
135
|
-
TResult = PostNotificationResult<TVersion
|
|
138
|
+
TResult = PostNotificationResult<TVersion>,
|
|
136
139
|
>(
|
|
137
140
|
version: TVersion,
|
|
138
141
|
...args: Parameters<GetUserNotificationSettingsFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -140,7 +143,7 @@ export class NotificationApiClient<
|
|
|
140
143
|
const fn = getUserNotificationSettings<TVersion, TMethod, TClient>(
|
|
141
144
|
this._client,
|
|
142
145
|
version,
|
|
143
|
-
this._method
|
|
146
|
+
this._method,
|
|
144
147
|
);
|
|
145
148
|
return fn<TResult>(...args);
|
|
146
149
|
}
|
|
@@ -150,7 +153,7 @@ export class NotificationApiClient<
|
|
|
150
153
|
*/
|
|
151
154
|
public updateSettings<
|
|
152
155
|
TVersion extends string = keyof typeof ApiVersion,
|
|
153
|
-
TResult = PostNotificationResult<TVersion
|
|
156
|
+
TResult = PostNotificationResult<TVersion>,
|
|
154
157
|
>(
|
|
155
158
|
version: TVersion,
|
|
156
159
|
...args: Parameters<PutUserNotificationSettingsFn<TVersion, TMethod, TClient, TResult>>
|
|
@@ -158,7 +161,7 @@ export class NotificationApiClient<
|
|
|
158
161
|
const fn = updateUserNotificationSettings<TVersion, TMethod, TClient>(
|
|
159
162
|
this._client,
|
|
160
163
|
version,
|
|
161
|
-
this._method
|
|
164
|
+
this._method,
|
|
162
165
|
);
|
|
163
166
|
return fn<TResult>(...args);
|
|
164
167
|
}
|
|
@@ -20,18 +20,18 @@ export const deleteNotification =
|
|
|
20
20
|
<
|
|
21
21
|
TVersion extends string = keyof typeof ApiVersion,
|
|
22
22
|
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
23
|
-
TClient extends IHttpClient = IHttpClient
|
|
23
|
+
TClient extends IHttpClient = IHttpClient,
|
|
24
24
|
>(
|
|
25
25
|
client: TClient,
|
|
26
26
|
version: TVersion,
|
|
27
|
-
method: TMethod = 'json' as TMethod
|
|
27
|
+
method: TMethod = 'json' as TMethod,
|
|
28
28
|
) =>
|
|
29
29
|
<T = DeleteNotificationResponse<TVersion>>(
|
|
30
30
|
args: DeleteNotificationArgs<TVersion>,
|
|
31
|
-
init?: ClientRequestInit<TClient, T
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
32
|
): DeleteNotificationResult<TVersion, TMethod, T> =>
|
|
33
33
|
client[method](
|
|
34
|
-
...generateParameters<T, TVersion, TClient>(version, args, init)
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
35
|
) as DeleteNotificationResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default deleteNotification;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnsupportedApiVersion } from '
|
|
2
|
-
import { ApiVersion } from '
|
|
1
|
+
import { UnsupportedApiVersion } from '../../../errors';
|
|
2
|
+
import { ApiVersion } from '../..';
|
|
3
3
|
import type { DeleteNotificationArgs } from './types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ import type { DeleteNotificationArgs } from './types';
|
|
|
7
7
|
*/
|
|
8
8
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
9
9
|
version: TVersion,
|
|
10
|
-
args: DeleteNotificationArgs<TVersion
|
|
10
|
+
args: DeleteNotificationArgs<TVersion>,
|
|
11
11
|
) => {
|
|
12
12
|
const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
|
|
13
13
|
switch (apiVersion) {
|
|
@@ -9,11 +9,11 @@ import { DeleteNotificationArgs } from './types';
|
|
|
9
9
|
export const generateParameters = <
|
|
10
10
|
TResult,
|
|
11
11
|
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
-
TClient extends IHttpClient = IHttpClient
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
14
|
version: TVersion,
|
|
15
15
|
args: DeleteNotificationArgs<TVersion>,
|
|
16
|
-
init?: ClientRequestInit<TClient, TResult
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
18
|
const path = generateEndpoint(version, args);
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ export const generateParameters = <
|
|
|
23
23
|
const requestParams: ClientRequestInit<TClient, TResult> = Object.assign(
|
|
24
24
|
{},
|
|
25
25
|
{ method: 'delete', headers: headers },
|
|
26
|
-
init
|
|
26
|
+
init,
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
return [path, requestParams];
|
|
@@ -31,14 +31,14 @@ export type DeleteNotificationFn<
|
|
|
31
31
|
TVersion extends string = keyof typeof ApiVersion,
|
|
32
32
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
33
33
|
TClient extends IHttpClient = IHttpClient,
|
|
34
|
-
TResult = DeleteNotificationResponse<TVersion
|
|
34
|
+
TResult = DeleteNotificationResponse<TVersion>,
|
|
35
35
|
> = (
|
|
36
36
|
args: DeleteNotificationArgs<TVersion>,
|
|
37
|
-
init?: ClientRequestInit<TClient, TResult
|
|
37
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
38
38
|
) => DeleteNotificationResult<TVersion, TMethod, TResult>;
|
|
39
39
|
|
|
40
40
|
export type DeleteNotificationResult<
|
|
41
41
|
TVersion extends string = keyof typeof ApiVersion,
|
|
42
42
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
43
|
-
TResult = DeleteNotificationResponse<TVersion
|
|
43
|
+
TResult = DeleteNotificationResponse<TVersion>,
|
|
44
44
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -16,18 +16,18 @@ export const getNotificationById =
|
|
|
16
16
|
<
|
|
17
17
|
TVersion extends string = keyof typeof ApiVersion,
|
|
18
18
|
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
19
|
-
TClient extends IHttpClient = IHttpClient
|
|
19
|
+
TClient extends IHttpClient = IHttpClient,
|
|
20
20
|
>(
|
|
21
21
|
client: TClient,
|
|
22
22
|
version: TVersion,
|
|
23
|
-
method: TMethod = 'json' as TMethod
|
|
23
|
+
method: TMethod = 'json' as TMethod,
|
|
24
24
|
) =>
|
|
25
25
|
<T = GetNotificationResponse<TVersion>>(
|
|
26
26
|
args: GetNotificationArgs<TVersion>,
|
|
27
|
-
init?: ClientRequestInit<TClient, T
|
|
27
|
+
init?: ClientRequestInit<TClient, T>,
|
|
28
28
|
): GetNotificationResult<TVersion, TMethod, T> =>
|
|
29
29
|
client[method](
|
|
30
|
-
...generateParameters<T, TVersion, TClient>(version, args, init)
|
|
30
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
31
31
|
) as GetNotificationResult<TVersion, TMethod, T>;
|
|
32
32
|
|
|
33
33
|
export default getNotificationById;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnsupportedApiVersion } from '
|
|
2
|
-
import { ApiVersion } from '
|
|
1
|
+
import { UnsupportedApiVersion } from '../../../errors';
|
|
2
|
+
import { ApiVersion } from '../..';
|
|
3
3
|
|
|
4
4
|
import type { GetNotificationArgs } from './types';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ import type { GetNotificationArgs } from './types';
|
|
|
8
8
|
*/
|
|
9
9
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
10
10
|
version: TVersion,
|
|
11
|
-
args: GetNotificationArgs<TVersion
|
|
11
|
+
args: GetNotificationArgs<TVersion>,
|
|
12
12
|
) => {
|
|
13
13
|
const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
|
|
14
14
|
switch (apiVersion) {
|
|
@@ -9,11 +9,11 @@ import { GetNotificationArgs } from './types';
|
|
|
9
9
|
export const generateParameters = <
|
|
10
10
|
TResult,
|
|
11
11
|
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
-
TClient extends IHttpClient = IHttpClient
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
14
|
version: TVersion,
|
|
15
15
|
args: GetNotificationArgs<TVersion>,
|
|
16
|
-
init?: ClientRequestInit<TClient, TResult
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
18
|
const path = generateEndpoint(version, args);
|
|
19
19
|
return [path, init];
|
|
@@ -31,14 +31,14 @@ export type GetNotificationFn<
|
|
|
31
31
|
TVersion extends string = keyof typeof ApiVersion,
|
|
32
32
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
33
33
|
TClient extends IHttpClient = IHttpClient,
|
|
34
|
-
TResult = GetNotificationResponse<TVersion
|
|
34
|
+
TResult = GetNotificationResponse<TVersion>,
|
|
35
35
|
> = (
|
|
36
36
|
args: GetNotificationArgs<TVersion>,
|
|
37
|
-
init?: ClientRequestInit<TClient, TResult
|
|
37
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
38
38
|
) => GetNotificationResult<TVersion, TMethod, TResult>;
|
|
39
39
|
|
|
40
40
|
export type GetNotificationResult<
|
|
41
41
|
TVersion extends string = keyof typeof ApiVersion,
|
|
42
42
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
43
|
-
TResult = GetNotificationResponse<TVersion
|
|
43
|
+
TResult = GetNotificationResponse<TVersion>,
|
|
44
44
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -20,18 +20,18 @@ export const getNotifications =
|
|
|
20
20
|
<
|
|
21
21
|
TVersion extends string = keyof typeof ApiVersion,
|
|
22
22
|
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
23
|
-
TClient extends IHttpClient = IHttpClient
|
|
23
|
+
TClient extends IHttpClient = IHttpClient,
|
|
24
24
|
>(
|
|
25
25
|
client: TClient,
|
|
26
26
|
version: TVersion,
|
|
27
|
-
method: TMethod = 'json' as TMethod
|
|
27
|
+
method: TMethod = 'json' as TMethod,
|
|
28
28
|
) =>
|
|
29
29
|
<T = GetNotificationsResponse<TVersion>>(
|
|
30
30
|
args: GetNotificationsArgs<TVersion>,
|
|
31
|
-
init?: ClientRequestInit<TClient, T
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
32
|
): GetNotificationsResult<TVersion, TMethod, T> =>
|
|
33
33
|
client[method](
|
|
34
|
-
...generateParameters<T, TVersion, TClient>(version, args, init)
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
35
|
) as GetNotificationsResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default getNotifications;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnsupportedApiVersion } from '
|
|
2
|
-
import { ApiVersion } from '
|
|
1
|
+
import { UnsupportedApiVersion } from '../../../errors';
|
|
2
|
+
import { ApiVersion } from '../..';
|
|
3
3
|
|
|
4
4
|
import type { GetNotificationsArgs } from './types';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ import type { GetNotificationsArgs } from './types';
|
|
|
8
8
|
*/
|
|
9
9
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
10
10
|
version: TVersion,
|
|
11
|
-
args: GetNotificationsArgs<TVersion
|
|
11
|
+
args: GetNotificationsArgs<TVersion>,
|
|
12
12
|
) => {
|
|
13
13
|
const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
|
|
14
14
|
switch (apiVersion) {
|
|
@@ -9,11 +9,11 @@ import { GetNotificationsArgs } from './types';
|
|
|
9
9
|
export const generateParameters = <
|
|
10
10
|
TResult,
|
|
11
11
|
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
-
TClient extends IHttpClient = IHttpClient
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
14
|
version: TVersion,
|
|
15
15
|
args: GetNotificationsArgs<TVersion>,
|
|
16
|
-
init?: ClientRequestInit<TClient, TResult
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
18
|
const path = generateEndpoint(version, args);
|
|
19
19
|
return [path, init];
|
|
@@ -31,14 +31,14 @@ export type GetNotificationsFn<
|
|
|
31
31
|
TVersion extends string = keyof typeof ApiVersion,
|
|
32
32
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
33
33
|
TClient extends IHttpClient = IHttpClient,
|
|
34
|
-
TResult = GetNotificationsResponse<TVersion
|
|
34
|
+
TResult = GetNotificationsResponse<TVersion>,
|
|
35
35
|
> = (
|
|
36
36
|
args: GetNotificationsArgs<TVersion>,
|
|
37
|
-
init?: ClientRequestInit<TClient, TResult
|
|
37
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
38
38
|
) => GetNotificationsResult<TVersion, TMethod, TResult>;
|
|
39
39
|
|
|
40
40
|
export type GetNotificationsResult<
|
|
41
41
|
TVersion extends string = keyof typeof ApiVersion,
|
|
42
42
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
43
|
-
TResult = GetNotificationsResponse<TVersion
|
|
43
|
+
TResult = GetNotificationsResponse<TVersion>,
|
|
44
44
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -20,18 +20,18 @@ export const updateSeenByUser =
|
|
|
20
20
|
<
|
|
21
21
|
TVersion extends string = keyof typeof ApiVersion,
|
|
22
22
|
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
23
|
-
TClient extends IHttpClient = IHttpClient
|
|
23
|
+
TClient extends IHttpClient = IHttpClient,
|
|
24
24
|
>(
|
|
25
25
|
client: TClient,
|
|
26
26
|
version: TVersion,
|
|
27
|
-
method: TMethod = 'json' as TMethod
|
|
27
|
+
method: TMethod = 'json' as TMethod,
|
|
28
28
|
) =>
|
|
29
29
|
<T = PatchNotificationResponse<TVersion>>(
|
|
30
30
|
args: PatchNotificationArgs<TVersion>,
|
|
31
|
-
init?: ClientRequestInit<TClient, T
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
32
|
): PatchNotificationResult<TVersion, TMethod, T> =>
|
|
33
33
|
client[method](
|
|
34
|
-
...generateParameters<T, TVersion, TClient>(version, args, init)
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
35
|
) as PatchNotificationResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default updateSeenByUser;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnsupportedApiVersion } from '
|
|
2
|
-
import { ApiVersion } from '
|
|
1
|
+
import { UnsupportedApiVersion } from '../../../errors';
|
|
2
|
+
import { ApiVersion } from '../..';
|
|
3
3
|
import type { PatchNotificationArgs } from './types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ import type { PatchNotificationArgs } from './types';
|
|
|
7
7
|
*/
|
|
8
8
|
export const generateEndpoint = <TVersion extends string = keyof typeof ApiVersion>(
|
|
9
9
|
version: TVersion,
|
|
10
|
-
args: PatchNotificationArgs<TVersion
|
|
10
|
+
args: PatchNotificationArgs<TVersion>,
|
|
11
11
|
) => {
|
|
12
12
|
const apiVersion = ApiVersion[version as keyof typeof ApiVersion] ?? version;
|
|
13
13
|
switch (apiVersion) {
|
|
@@ -9,11 +9,11 @@ import { PatchNotificationArgs } from './types';
|
|
|
9
9
|
export const generateParameters = <
|
|
10
10
|
TResult,
|
|
11
11
|
TVersion extends string = keyof typeof ApiVersion,
|
|
12
|
-
TClient extends IHttpClient = IHttpClient
|
|
12
|
+
TClient extends IHttpClient = IHttpClient,
|
|
13
13
|
>(
|
|
14
14
|
version: TVersion,
|
|
15
15
|
args: PatchNotificationArgs<TVersion>,
|
|
16
|
-
init?: ClientRequestInit<TClient, TResult
|
|
16
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
17
17
|
): ApiClientArguments<TClient, TResult> => {
|
|
18
18
|
const path = generateEndpoint(version, args);
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ export const generateParameters = <
|
|
|
23
23
|
const requestParams: ClientRequestInit<TClient, TResult> = Object.assign(
|
|
24
24
|
{},
|
|
25
25
|
{ method: 'patch', body: JSON.stringify(args), headers: headers },
|
|
26
|
-
init
|
|
26
|
+
init,
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
return [path, requestParams];
|
|
@@ -32,14 +32,14 @@ export type PatchNotificationFn<
|
|
|
32
32
|
TVersion extends string = keyof typeof ApiVersion,
|
|
33
33
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
34
34
|
TClient extends IHttpClient = IHttpClient,
|
|
35
|
-
TResult = PatchNotificationResponse<TVersion
|
|
35
|
+
TResult = PatchNotificationResponse<TVersion>,
|
|
36
36
|
> = (
|
|
37
37
|
args: PatchNotificationArgs<TVersion>,
|
|
38
|
-
init?: ClientRequestInit<TClient, TResult
|
|
38
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
39
39
|
) => PatchNotificationResult<TVersion, TMethod, TResult>;
|
|
40
40
|
|
|
41
41
|
export type PatchNotificationResult<
|
|
42
42
|
TVersion extends string = keyof typeof ApiVersion,
|
|
43
43
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
44
|
-
TResult = PatchNotificationResponse<TVersion
|
|
44
|
+
TResult = PatchNotificationResponse<TVersion>,
|
|
45
45
|
> = ClientMethod<TResult>[TMethod];
|
|
@@ -20,18 +20,18 @@ export const createNotification =
|
|
|
20
20
|
<
|
|
21
21
|
TVersion extends string = keyof typeof ApiVersion,
|
|
22
22
|
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
23
|
-
TClient extends IHttpClient = IHttpClient
|
|
23
|
+
TClient extends IHttpClient = IHttpClient,
|
|
24
24
|
>(
|
|
25
25
|
client: TClient,
|
|
26
26
|
version: TVersion,
|
|
27
|
-
method: TMethod = 'json' as TMethod
|
|
27
|
+
method: TMethod = 'json' as TMethod,
|
|
28
28
|
) =>
|
|
29
29
|
<T = PostNotificationResponse<TVersion>>(
|
|
30
30
|
args: PostNotificationArgs<TVersion>,
|
|
31
|
-
init?: ClientRequestInit<TClient, T
|
|
31
|
+
init?: ClientRequestInit<TClient, T>,
|
|
32
32
|
): PostNotificationResult<TVersion, TMethod, T> =>
|
|
33
33
|
client[method](
|
|
34
|
-
...generateParameters<T, TVersion, TClient>(version, args, init)
|
|
34
|
+
...generateParameters<T, TVersion, TClient>(version, args, init),
|
|
35
35
|
) as PostNotificationResult<TVersion, TMethod, T>;
|
|
36
36
|
|
|
37
37
|
export default createNotification;
|