@equinor/fusion-framework-module-services 5.0.0-next-663bed8344cc2ca0111705b05045173328b3104d → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -7
- package/dist/esm/bookmarks/api-version.js +6 -0
- package/dist/esm/bookmarks/api-version.js.map +1 -0
- package/dist/esm/bookmarks/client.js +148 -47
- package/dist/esm/bookmarks/client.js.map +1 -1
- package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js +49 -0
- package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/bookmark.delete.js +48 -0
- package/dist/esm/bookmarks/endpoints/bookmark.delete.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/bookmark.get.js +53 -0
- package/dist/esm/bookmarks/endpoints/bookmark.get.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/bookmark.patch.js +68 -0
- package/dist/esm/bookmarks/endpoints/bookmark.patch.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/bookmark.post.js +57 -0
- package/dist/esm/bookmarks/endpoints/bookmark.post.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js +48 -0
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js +49 -0
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js +49 -0
- package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js.map +1 -0
- package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js +75 -0
- package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js.map +1 -0
- package/dist/esm/bookmarks/index.js +1 -2
- package/dist/esm/bookmarks/index.js.map +1 -1
- package/dist/esm/bookmarks/schemas.js +76 -0
- package/dist/esm/bookmarks/schemas.js.map +1 -0
- package/dist/esm/bookmarks/selectors.js +58 -0
- package/dist/esm/bookmarks/selectors.js.map +1 -0
- package/dist/esm/utils.js +35 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bookmarks/api-version.d.ts +4 -0
- package/dist/types/bookmarks/client.d.ts +132 -34
- package/dist/types/bookmarks/endpoints/bookmark-apply.get.d.ts +40 -0
- package/dist/types/bookmarks/endpoints/bookmark.delete.d.ts +31 -0
- package/dist/types/bookmarks/endpoints/bookmark.get.d.ts +351 -0
- package/dist/types/bookmarks/endpoints/bookmark.patch.d.ts +254 -0
- package/dist/types/bookmarks/endpoints/bookmark.post.d.ts +231 -0
- package/dist/types/bookmarks/endpoints/user-bookmark-favourite.delete.d.ts +31 -0
- package/dist/types/bookmarks/endpoints/user-bookmark-favourite.head.d.ts +31 -0
- package/dist/types/bookmarks/endpoints/user-bookmark-favourite.post.d.ts +31 -0
- package/dist/types/bookmarks/endpoints/user-bookmarks.get.d.ts +235 -0
- package/dist/types/bookmarks/index.d.ts +3 -2
- package/dist/types/bookmarks/schemas.d.ts +383 -0
- package/dist/types/bookmarks/selectors.d.ts +17 -0
- package/dist/types/bookmarks/types.d.ts +5 -1
- package/dist/types/provider.d.ts +2 -2
- package/dist/types/types.d.ts +74 -11
- package/dist/types/utils.d.ts +18 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -11
- package/src/bookmarks/README.md +90 -0
- package/src/bookmarks/api-version.ts +4 -0
- package/src/bookmarks/client.ts +257 -77
- package/src/bookmarks/endpoints/bookmark-apply.get.ts +114 -0
- package/src/bookmarks/endpoints/bookmark.delete.ts +113 -0
- package/src/bookmarks/endpoints/bookmark.get.ts +118 -0
- package/src/bookmarks/endpoints/bookmark.patch.ts +135 -0
- package/src/bookmarks/endpoints/bookmark.post.ts +124 -0
- package/src/bookmarks/endpoints/user-bookmark-favourite.delete.ts +113 -0
- package/src/bookmarks/endpoints/user-bookmark-favourite.head.ts +114 -0
- package/src/bookmarks/endpoints/user-bookmark-favourite.post.ts +114 -0
- package/src/bookmarks/endpoints/user-bookmarks.get.ts +142 -0
- package/src/bookmarks/index.ts +3 -3
- package/src/bookmarks/schemas.ts +81 -0
- package/src/bookmarks/selectors.ts +49 -0
- package/src/bookmarks/types.ts +16 -1
- package/src/provider.ts +4 -4
- package/src/types.ts +92 -11
- package/src/utils.ts +51 -0
- package/src/version.ts +1 -1
- package/dist/esm/bookmarks/api-models.js +0 -2
- package/dist/esm/bookmarks/api-models.js.map +0 -1
- package/dist/esm/bookmarks/delete/client.js +0 -10
- package/dist/esm/bookmarks/delete/client.js.map +0 -1
- package/dist/esm/bookmarks/delete/generate-endpoint.js +0 -20
- package/dist/esm/bookmarks/delete/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/delete/generate-parameters.js +0 -8
- package/dist/esm/bookmarks/delete/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/delete/index.js +0 -5
- package/dist/esm/bookmarks/delete/index.js.map +0 -1
- package/dist/esm/bookmarks/delete/types-v1.js +0 -2
- package/dist/esm/bookmarks/delete/types-v1.js.map +0 -1
- package/dist/esm/bookmarks/delete/types.js +0 -2
- package/dist/esm/bookmarks/delete/types.js.map +0 -1
- package/dist/esm/bookmarks/favorites/delete/client.js +0 -10
- package/dist/esm/bookmarks/favorites/delete/client.js.map +0 -1
- package/dist/esm/bookmarks/favorites/delete/generate-endpoint.js +0 -15
- package/dist/esm/bookmarks/favorites/delete/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/favorites/delete/generate-parameters.js +0 -8
- package/dist/esm/bookmarks/favorites/delete/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/favorites/delete/index.js +0 -5
- package/dist/esm/bookmarks/favorites/delete/index.js.map +0 -1
- package/dist/esm/bookmarks/favorites/delete/types-v1.js +0 -2
- package/dist/esm/bookmarks/favorites/delete/types-v1.js.map +0 -1
- package/dist/esm/bookmarks/favorites/delete/types.js +0 -2
- package/dist/esm/bookmarks/favorites/delete/types.js.map +0 -1
- package/dist/esm/bookmarks/favorites/head/client.js +0 -10
- package/dist/esm/bookmarks/favorites/head/client.js.map +0 -1
- package/dist/esm/bookmarks/favorites/head/generate-endpoint.js +0 -15
- package/dist/esm/bookmarks/favorites/head/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/favorites/head/generate-parameters.js +0 -10
- package/dist/esm/bookmarks/favorites/head/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/favorites/head/index.js +0 -5
- package/dist/esm/bookmarks/favorites/head/index.js.map +0 -1
- package/dist/esm/bookmarks/favorites/head/types.js +0 -2
- package/dist/esm/bookmarks/favorites/head/types.js.map +0 -1
- package/dist/esm/bookmarks/favorites/post/client.js +0 -10
- package/dist/esm/bookmarks/favorites/post/client.js.map +0 -1
- package/dist/esm/bookmarks/favorites/post/generate-endpoint.js +0 -14
- package/dist/esm/bookmarks/favorites/post/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/favorites/post/generate-parameters.js +0 -10
- package/dist/esm/bookmarks/favorites/post/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/favorites/post/index.js +0 -5
- package/dist/esm/bookmarks/favorites/post/index.js.map +0 -1
- package/dist/esm/bookmarks/favorites/post/types.js +0 -2
- package/dist/esm/bookmarks/favorites/post/types.js.map +0 -1
- package/dist/esm/bookmarks/get/client.js +0 -10
- package/dist/esm/bookmarks/get/client.js.map +0 -1
- package/dist/esm/bookmarks/get/generate-endpoint.js +0 -20
- package/dist/esm/bookmarks/get/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/get/generate-parameters.js +0 -7
- package/dist/esm/bookmarks/get/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/get/index.js +0 -5
- package/dist/esm/bookmarks/get/index.js.map +0 -1
- package/dist/esm/bookmarks/get/types.js +0 -2
- package/dist/esm/bookmarks/get/types.js.map +0 -1
- package/dist/esm/bookmarks/getAll/client.js +0 -10
- package/dist/esm/bookmarks/getAll/client.js.map +0 -1
- package/dist/esm/bookmarks/getAll/generate-endpoint.js +0 -14
- package/dist/esm/bookmarks/getAll/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/getAll/generate-parameters.js +0 -7
- package/dist/esm/bookmarks/getAll/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/getAll/index.js +0 -5
- package/dist/esm/bookmarks/getAll/index.js.map +0 -1
- package/dist/esm/bookmarks/getAll/types.js +0 -2
- package/dist/esm/bookmarks/getAll/types.js.map +0 -1
- package/dist/esm/bookmarks/patch/client.js +0 -10
- package/dist/esm/bookmarks/patch/client.js.map +0 -1
- package/dist/esm/bookmarks/patch/generate-endpoint.js +0 -14
- package/dist/esm/bookmarks/patch/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/patch/generate-parameters.js +0 -10
- package/dist/esm/bookmarks/patch/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/patch/index.js +0 -5
- package/dist/esm/bookmarks/patch/index.js.map +0 -1
- package/dist/esm/bookmarks/patch/types.js +0 -2
- package/dist/esm/bookmarks/patch/types.js.map +0 -1
- package/dist/esm/bookmarks/post/client.js +0 -10
- package/dist/esm/bookmarks/post/client.js.map +0 -1
- package/dist/esm/bookmarks/post/generate-endpoint.js +0 -14
- package/dist/esm/bookmarks/post/generate-endpoint.js.map +0 -1
- package/dist/esm/bookmarks/post/generate-parameters.js +0 -10
- package/dist/esm/bookmarks/post/generate-parameters.js.map +0 -1
- package/dist/esm/bookmarks/post/index.js +0 -5
- package/dist/esm/bookmarks/post/index.js.map +0 -1
- package/dist/esm/bookmarks/post/types.js +0 -2
- package/dist/esm/bookmarks/post/types.js.map +0 -1
- package/dist/types/bookmarks/api-models.d.ts +0 -42
- package/dist/types/bookmarks/delete/client.d.ts +0 -11
- package/dist/types/bookmarks/delete/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/delete/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/delete/index.d.ts +0 -4
- package/dist/types/bookmarks/delete/types-v1.d.ts +0 -4
- package/dist/types/bookmarks/delete/types.d.ts +0 -18
- package/dist/types/bookmarks/favorites/delete/client.d.ts +0 -11
- package/dist/types/bookmarks/favorites/delete/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/favorites/delete/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/favorites/delete/index.d.ts +0 -4
- package/dist/types/bookmarks/favorites/delete/types-v1.d.ts +0 -4
- package/dist/types/bookmarks/favorites/delete/types.d.ts +0 -16
- package/dist/types/bookmarks/favorites/head/client.d.ts +0 -11
- package/dist/types/bookmarks/favorites/head/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/favorites/head/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/favorites/head/index.d.ts +0 -4
- package/dist/types/bookmarks/favorites/head/types.d.ts +0 -17
- package/dist/types/bookmarks/favorites/post/client.d.ts +0 -11
- package/dist/types/bookmarks/favorites/post/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/favorites/post/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/favorites/post/index.d.ts +0 -4
- package/dist/types/bookmarks/favorites/post/types.d.ts +0 -17
- package/dist/types/bookmarks/get/client.d.ts +0 -11
- package/dist/types/bookmarks/get/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/get/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/get/index.d.ts +0 -4
- package/dist/types/bookmarks/get/types.d.ts +0 -21
- package/dist/types/bookmarks/getAll/client.d.ts +0 -11
- package/dist/types/bookmarks/getAll/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/getAll/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/getAll/index.d.ts +0 -4
- package/dist/types/bookmarks/getAll/types.d.ts +0 -11
- package/dist/types/bookmarks/patch/client.d.ts +0 -11
- package/dist/types/bookmarks/patch/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/patch/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/patch/index.d.ts +0 -4
- package/dist/types/bookmarks/patch/types.d.ts +0 -21
- package/dist/types/bookmarks/post/client.d.ts +0 -11
- package/dist/types/bookmarks/post/generate-endpoint.d.ts +0 -5
- package/dist/types/bookmarks/post/generate-parameters.d.ts +0 -5
- package/dist/types/bookmarks/post/index.d.ts +0 -4
- package/dist/types/bookmarks/post/types.d.ts +0 -34
- package/src/bookmarks/api-models.ts +0 -46
- package/src/bookmarks/delete/client.ts +0 -35
- package/src/bookmarks/delete/generate-endpoint.ts +0 -24
- package/src/bookmarks/delete/generate-parameters.ts +0 -25
- package/src/bookmarks/delete/index.ts +0 -6
- package/src/bookmarks/delete/types-v1.ts +0 -2
- package/src/bookmarks/delete/types.ts +0 -35
- package/src/bookmarks/favorites/delete/client.ts +0 -35
- package/src/bookmarks/favorites/delete/generate-endpoint.ts +0 -19
- package/src/bookmarks/favorites/delete/generate-parameters.ts +0 -25
- package/src/bookmarks/favorites/delete/index.ts +0 -6
- package/src/bookmarks/favorites/delete/types-v1.ts +0 -2
- package/src/bookmarks/favorites/delete/types.ts +0 -33
- package/src/bookmarks/favorites/head/client.ts +0 -35
- package/src/bookmarks/favorites/head/generate-endpoint.ts +0 -19
- package/src/bookmarks/favorites/head/generate-parameters.ts +0 -28
- package/src/bookmarks/favorites/head/index.ts +0 -6
- package/src/bookmarks/favorites/head/types.ts +0 -35
- package/src/bookmarks/favorites/post/client.ts +0 -35
- package/src/bookmarks/favorites/post/generate-endpoint.ts +0 -18
- package/src/bookmarks/favorites/post/generate-parameters.ts +0 -28
- package/src/bookmarks/favorites/post/index.ts +0 -6
- package/src/bookmarks/favorites/post/types.ts +0 -35
- package/src/bookmarks/get/client.ts +0 -30
- package/src/bookmarks/get/generate-endpoint.ts +0 -24
- package/src/bookmarks/get/generate-parameters.ts +0 -18
- package/src/bookmarks/get/index.ts +0 -6
- package/src/bookmarks/get/types.ts +0 -39
- package/src/bookmarks/getAll/client.ts +0 -30
- package/src/bookmarks/getAll/generate-endpoint.ts +0 -15
- package/src/bookmarks/getAll/generate-parameters.ts +0 -18
- package/src/bookmarks/getAll/index.ts +0 -6
- package/src/bookmarks/getAll/types.ts +0 -21
- package/src/bookmarks/patch/client.ts +0 -30
- package/src/bookmarks/patch/generate-endpoint.ts +0 -18
- package/src/bookmarks/patch/generate-parameters.ts +0 -28
- package/src/bookmarks/patch/index.ts +0 -6
- package/src/bookmarks/patch/types.ts +0 -45
- package/src/bookmarks/post/client.ts +0 -30
- package/src/bookmarks/post/generate-endpoint.ts +0 -18
- package/src/bookmarks/post/generate-parameters.ts +0 -28
- package/src/bookmarks/post/index.ts +0 -6
- package/src/bookmarks/post/types.ts +0 -58
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import { ClientRequestInit, IHttpClient, StreamResponse, BlobResult
|
|
1
|
+
import { ClientRequestInit, IHttpClient, StreamResponse, BlobResult } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
/**
|
|
3
|
+
* A factory function that creates an instance of an HTTP client.
|
|
4
|
+
*
|
|
5
|
+
* @param name - The name of the HTTP client to create.
|
|
6
|
+
* @returns A Promise that resolves to an instance of the HTTP client.
|
|
7
|
+
*/
|
|
2
8
|
export type ApiClientFactory<TClient extends IHttpClient = IHttpClient> = (name: string) => Promise<TClient>;
|
|
9
|
+
/**
|
|
10
|
+
* Represents the arguments for an API client function.
|
|
11
|
+
*
|
|
12
|
+
* @template TClient - The type of the HTTP client used by the API client.
|
|
13
|
+
* @template TResult - The type of the result returned by the API client.
|
|
14
|
+
* @param path - The path of the API endpoint.
|
|
15
|
+
* @param init - Optional initialization options for the API client request.
|
|
16
|
+
*/
|
|
3
17
|
export type ApiClientArguments<TClient extends IHttpClient, TResult = unknown> = [
|
|
4
18
|
path: string,
|
|
5
19
|
init?: ClientRequestInit<TClient, TResult>
|
|
@@ -8,20 +22,10 @@ export type ApiClientArguments<TClient extends IHttpClient, TResult = unknown> =
|
|
|
8
22
|
* Execute methods on the IHttpClient
|
|
9
23
|
*/
|
|
10
24
|
export type ClientMethod<T = unknown> = {
|
|
11
|
-
/**
|
|
12
|
-
* Fetch data async
|
|
13
|
-
* NOTE: data needs to be extracted from the response
|
|
14
|
-
*/
|
|
15
|
-
fetch: Promise<FetchResponse<T>>;
|
|
16
25
|
/**
|
|
17
26
|
* Fetch JSON data from a service
|
|
18
27
|
*/
|
|
19
28
|
json: Promise<T>;
|
|
20
|
-
/**
|
|
21
|
-
* Fetch data as an observable
|
|
22
|
-
* NOTE: data needs to be extracted from the response
|
|
23
|
-
*/
|
|
24
|
-
fetch$: StreamResponse<FetchResponse<T>>;
|
|
25
29
|
/**
|
|
26
30
|
* Fetch JSON data from a service as observable
|
|
27
31
|
*/
|
|
@@ -32,3 +36,62 @@ export type ClientDataMethod<T extends BlobResult = BlobResult> = {
|
|
|
32
36
|
blob$: StreamResponse<T>;
|
|
33
37
|
};
|
|
34
38
|
export type ClientMethodType = keyof ClientMethod;
|
|
39
|
+
/**
|
|
40
|
+
* Utility type that filters the keys of an `AvailableTypes` object to only those
|
|
41
|
+
* whose values are a subset of the `AllowedTypes` string.
|
|
42
|
+
*
|
|
43
|
+
* This can be useful for creating a type that represents a subset of an API's
|
|
44
|
+
* available versions, where the allowed versions are a subset of the total
|
|
45
|
+
* available versions.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* enum ApiVersions = {
|
|
50
|
+
* v1: '1.0'
|
|
51
|
+
* v2: '2.0'
|
|
52
|
+
* v3: '3.0'
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* type Services = {
|
|
56
|
+
* [ApiVersions.v1]: { request: ApiRequestModel_v1, response: ApiResponseModel_v1 }
|
|
57
|
+
* [ApiVersions.v2]: { request: ApiRequestModel_v2, response: ApiResponseModel_v2 }
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* type ApiServiceVersions = keyof Services; // '1.0' | '2.0'
|
|
61
|
+
* type AllowedApiVersions = FilterAllowApiVersions<ApiVersions, ApiServiceVersions> // ApiVersions.v1 | 'v1' | ApiVersions.v2 | v2'
|
|
62
|
+
*
|
|
63
|
+
* const execute<TVersion extends AllowedApiVersions>(
|
|
64
|
+
* version: TVersion,
|
|
65
|
+
* args: Services[TVersion]['request']
|
|
66
|
+
* ): Services[TVersion]['response'] {
|
|
67
|
+
* const apiVersion = version in ApiVersion ? ApiVersion[version] : version;
|
|
68
|
+
* switch (apiVersion) {
|
|
69
|
+
* case ApiVersion.v1:
|
|
70
|
+
* case ApiVersion.v2:
|
|
71
|
+
* return fetch(args);
|
|
72
|
+
* }
|
|
73
|
+
* throw new Error('Invalid version');
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* execute('v1', { id: '123' }); // OK
|
|
77
|
+
* execute('v3', { id: '123' }); // Error
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @template TAvailableTypes - An object type that maps string keys to string values,
|
|
81
|
+
* representing the available API versions.
|
|
82
|
+
* @template TAllowedTypes - A string union type representing the allowed API versions.
|
|
83
|
+
* @returns A string union type containing the keys from `AvailableTypes` whose
|
|
84
|
+
* values are a subset of `AllowedTypes`.
|
|
85
|
+
*/
|
|
86
|
+
export type FilterAllowedApiVersions<TAvailableTypes extends Record<string, string>, TAllowedTypes extends string | number | symbol = keyof TAvailableTypes> = {
|
|
87
|
+
[K in keyof TAvailableTypes]: TAvailableTypes extends Record<K, infer V> ? K extends TAllowedTypes ? K | V : V extends TAllowedTypes ? V | K : never : never;
|
|
88
|
+
}[keyof TAvailableTypes];
|
|
89
|
+
/**
|
|
90
|
+
* Extracts the API version from a set of available types, based on a list of allowed types.
|
|
91
|
+
*
|
|
92
|
+
* @template TAvailableTypes - An object mapping API version strings to their corresponding types.
|
|
93
|
+
* @template TAllowedTypes - A list of allowed API version strings.
|
|
94
|
+
* @template TVersion - The API version to extract.
|
|
95
|
+
* @returns The API version type if it is available and allowed, otherwise `never`.
|
|
96
|
+
*/
|
|
97
|
+
export type ExtractApiVersion<TAvailableTypes extends Record<string, string>, TVersion extends string, TAllowedTypes extends string | number | symbol = FilterAllowedApiVersions<TAvailableTypes>> = TVersion extends keyof TAvailableTypes ? TAvailableTypes[TVersion] : TVersion extends TAllowedTypes ? TVersion : never;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ResponseSelector } from '@equinor/fusion-framework-module-http/selectors';
|
|
3
|
+
import type { ExtractApiVersion } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the correct API version from the provided `apiVersions` object based on the given `version` parameter.
|
|
6
|
+
*
|
|
7
|
+
* @param apiVersions - An object mapping API version strings to their corresponding versions.
|
|
8
|
+
* @param version - The version string to extract.
|
|
9
|
+
* @returns The extracted API version, or throws an error if the version is not supported.
|
|
10
|
+
*/
|
|
11
|
+
export declare const extractVersion: <TApiVersions extends Record<string, string>, TAllowedApiVersion extends string, TVersion extends string>(apiVersions: TApiVersions, version: TVersion) => ExtractApiVersion<TApiVersions, TVersion, TAllowedApiVersion>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a response selector that parses the response body using the provided Zod schema.
|
|
14
|
+
*
|
|
15
|
+
* @param schema - The Zod schema to use for parsing the response body.
|
|
16
|
+
* @returns A response selector function that parses the response body using the provided schema.
|
|
17
|
+
*/
|
|
18
|
+
export declare const schemaSelector: <Output, Def extends z.ZodTypeDef, Input>(schema: z.ZodSchema<Output, Def, Input>) => ResponseSelector<Output>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "5.0.0";
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-services",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"type": "module",
|
|
7
6
|
"main": "dist/esm/index.js",
|
|
8
7
|
"types": "index.d.ts",
|
|
9
8
|
"typesVersions": {
|
|
@@ -51,6 +50,10 @@
|
|
|
51
50
|
"import": "./dist/esm/index.js",
|
|
52
51
|
"types": "./dist/types/index.d.ts"
|
|
53
52
|
},
|
|
53
|
+
"./bookmarks": {
|
|
54
|
+
"import": "./dist/esm/bookmarks/index.js",
|
|
55
|
+
"types": "./dist/types/bookmarks/index.d.ts"
|
|
56
|
+
},
|
|
54
57
|
"./context": {
|
|
55
58
|
"import": "./dist/esm/context/index.js",
|
|
56
59
|
"types": "./dist/types/context/index.d.ts"
|
|
@@ -67,10 +70,6 @@
|
|
|
67
70
|
"import": "./dist/esm/context/related/index.js",
|
|
68
71
|
"types": "./dist/types/context/related/index.d.ts"
|
|
69
72
|
},
|
|
70
|
-
"./bookmarks": {
|
|
71
|
-
"import": "./dist/esm/bookmarks/index.js",
|
|
72
|
-
"types": "./dist/types/bookmarks/index.d.ts"
|
|
73
|
-
},
|
|
74
73
|
"./notification": {
|
|
75
74
|
"import": "./dist/esm/notification/index.js",
|
|
76
75
|
"types": "./dist/types/notification/index.d.ts"
|
|
@@ -113,17 +112,18 @@
|
|
|
113
112
|
"directory": "packages/modules/services"
|
|
114
113
|
},
|
|
115
114
|
"dependencies": {
|
|
116
|
-
"odata-query": "^7.0.4"
|
|
115
|
+
"odata-query": "^7.0.4",
|
|
116
|
+
"zod": "^3.23.8"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"typescript": "^5.5.4",
|
|
120
|
-
"@equinor/fusion-framework-module
|
|
121
|
-
"@equinor/fusion-framework-module": "^
|
|
122
|
-
"@equinor/fusion-framework-module-service-discovery": "^
|
|
120
|
+
"@equinor/fusion-framework-module": "^4.3.5",
|
|
121
|
+
"@equinor/fusion-framework-module-http": "^6.2.0",
|
|
122
|
+
"@equinor/fusion-framework-module-service-discovery": "^8.0.2"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"odata-query": "^7.0.4",
|
|
126
|
-
"@equinor/fusion-framework-module": "^
|
|
126
|
+
"@equinor/fusion-framework-module": "^4.3.5"
|
|
127
127
|
},
|
|
128
128
|
"scripts": {
|
|
129
129
|
"build": "tsc -b"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Bookmarks API Module
|
|
2
|
+
|
|
3
|
+
This module provides a set of services and utilities to manage user bookmarks. It allows for creating, reading, updating, and deleting bookmarks, ensuring that users can easily save and retrieve their favorite or frequently accessed items. The module is designed to be flexible and scalable, supporting various types of bookmarks and integrating seamlessly with other parts of the application.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- **Create Bookmarks**: Create new bookmarks with custom payloads.
|
|
7
|
+
- **Retrieve Bookmarks**: Fetch individual bookmarks or all bookmarks.
|
|
8
|
+
- **Update Bookmarks**: Update existing bookmarks with new data.
|
|
9
|
+
- **Delete Bookmarks**: Remove bookmarks by their ID.
|
|
10
|
+
- **Manage Favorites**: Add or remove bookmarks from the user's favorites.
|
|
11
|
+
- **Bookmark Payloads**: Retrieve and manage bookmark payloads.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Creating a Bookmarks API Client
|
|
16
|
+
To create an instance of the `BookmarksApiClient`, you need to provide an HTTP client and specify the method for API requests.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { BookmarksApiClient } from '@equinor/fusion-framework-module-services';
|
|
21
|
+
import { HttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
22
|
+
|
|
23
|
+
// Create an instance of the HTTP client
|
|
24
|
+
const httpClient = new HttpClient();
|
|
25
|
+
|
|
26
|
+
// Create an instance of the BookmarksApiClient
|
|
27
|
+
const bookmarksClient = new BookmarksApiClient(httpClient, 'json');
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Fetching All Bookmarks
|
|
31
|
+
You can fetch all bookmarks using the `getAll` method.
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
const allBookmarks = await bookmarksClient.getAll('v1');
|
|
35
|
+
console.log(allBookmarks);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Creating a Bookmark
|
|
39
|
+
To create a new bookmark, use the `create` method.
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
const newBookmark = await bookmarksClient.create('v1', {
|
|
43
|
+
name: 'My Bookmark',
|
|
44
|
+
description: 'A description for my bookmark',
|
|
45
|
+
isShared: true,
|
|
46
|
+
payload: { key: 'value' },
|
|
47
|
+
});
|
|
48
|
+
console.log(newBookmark);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Updating a Bookmark
|
|
52
|
+
To update an existing bookmark, use the `patch` method.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
const updatedBookmark = await bookmarksClient.patch('v1', {
|
|
56
|
+
bookmarkId: 'bookmark-id',
|
|
57
|
+
data: {
|
|
58
|
+
name: 'Updated Bookmark Name',
|
|
59
|
+
payload: { key: 'new value' },
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
console.log(updatedBookmark);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Deleting a Bookmark
|
|
66
|
+
To delete a bookmark by its ID, use the `delete` method.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const deletedBookmarkId = await bookmarksClient.delete('v1', { bookmarkId: 'bookmark-id' });
|
|
70
|
+
console.log(`Deleted bookmark with ID: ${deletedBookmarkId}`);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Managing Bookmark Favorites
|
|
74
|
+
You can add or remove bookmarks from the user's favorites.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// Add to favorites
|
|
78
|
+
await bookmarksClient.addFavourite('v1', { bookmarkId: 'bookmark-id' });
|
|
79
|
+
|
|
80
|
+
// Remove from favorites
|
|
81
|
+
await bookmarksClient.removeFavorite('v1', { bookmarkId: 'bookmark-id' });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Fetching a Bookmark Payload
|
|
85
|
+
To fetch the payload of a specific bookmark, use the `getPayload` method.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const bookmarkPayload = await bookmarksClient.getPayload('v1', { bookmarkId: 'bookmark-id' });
|
|
89
|
+
console.log(bookmarkPayload);
|
|
90
|
+
```
|
package/src/bookmarks/client.ts
CHANGED
|
@@ -1,131 +1,311 @@
|
|
|
1
|
-
import { IHttpClient } from '@equinor/fusion-framework-module-http';
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
import type { ClientMethod } from '../types';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import patchBookmark, { PatchBookmarkFn, PatchBookmarkResult, PatchBookmarksResult } from './patch';
|
|
11
|
-
import getAllBookmarks, { GetAllBookmarkResult, GetAllBookmarksResult } from './getAll';
|
|
12
|
-
import addBookmarkFavorite, {
|
|
13
|
-
PostBookmarkFavoriteFn,
|
|
14
|
-
PostBookmarksFavoriteResult,
|
|
15
|
-
} from './favorites/post';
|
|
16
|
-
import deleteBookmarkFavorite, {
|
|
17
|
-
DeleteBookmarksFavoriteFn,
|
|
18
|
-
DeleteBookmarksFavoriteResult,
|
|
19
|
-
} from './favorites/delete';
|
|
20
|
-
import verifyBookmarkFavorite, {
|
|
21
|
-
HeadBookmarkFavoriteFn,
|
|
22
|
-
HeadBookmarksFavoriteResult,
|
|
23
|
-
} from './favorites/head';
|
|
4
|
+
import {
|
|
5
|
+
GetBookmarksArgs,
|
|
6
|
+
GetBookmarksResponse,
|
|
7
|
+
GetBookmarksResult,
|
|
8
|
+
GetBookmarksVersion,
|
|
9
|
+
getBookmarks,
|
|
10
|
+
} from './endpoints/user-bookmarks.get';
|
|
24
11
|
|
|
12
|
+
import {
|
|
13
|
+
GetBookmarkArg,
|
|
14
|
+
GetBookmarkResponse,
|
|
15
|
+
GetBookmarkResult,
|
|
16
|
+
GetBookmarkVersion,
|
|
17
|
+
getBookmark,
|
|
18
|
+
} from './endpoints/bookmark.get';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
CreateBookmarkArg,
|
|
22
|
+
CreateBookmarkResponse,
|
|
23
|
+
CreateBookmarkVersion,
|
|
24
|
+
CreateBookmarksResult,
|
|
25
|
+
createBookmark,
|
|
26
|
+
} from './endpoints/bookmark.post';
|
|
27
|
+
import {
|
|
28
|
+
type PatchBookmarkArg,
|
|
29
|
+
type PatchBookmarkResponse,
|
|
30
|
+
type PatchBookmarkVersion,
|
|
31
|
+
type PatchBookmarksResult,
|
|
32
|
+
patchBookmark,
|
|
33
|
+
} from './endpoints/bookmark.patch';
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
BookmarkApplyArgs,
|
|
37
|
+
BookmarkApplyResponse,
|
|
38
|
+
BookmarkApplyResult,
|
|
39
|
+
BookmarkApplyVersion,
|
|
40
|
+
getBookmarkApply,
|
|
41
|
+
} from './endpoints/bookmark-apply.get';
|
|
42
|
+
import {
|
|
43
|
+
AddBookmarkFavouriteArgs,
|
|
44
|
+
AddBookmarkFavouriteResponse,
|
|
45
|
+
AddBookmarkFavouriteResult,
|
|
46
|
+
AddBookmarkFavouriteVersion,
|
|
47
|
+
addBookmarkAsFavourite,
|
|
48
|
+
} from './endpoints/user-bookmark-favourite.post';
|
|
49
|
+
import {
|
|
50
|
+
DeleteBookmarkArg,
|
|
51
|
+
DeleteBookmarkResponse,
|
|
52
|
+
DeleteBookmarkVersion,
|
|
53
|
+
deleteBookmark,
|
|
54
|
+
} from './endpoints/bookmark.delete';
|
|
55
|
+
import {
|
|
56
|
+
IsFavoriteBookmarkArgs,
|
|
57
|
+
IsFavoriteBookmarkResponse,
|
|
58
|
+
IsFavoriteBookmarkResult,
|
|
59
|
+
IsFavoriteBookmarkVersion,
|
|
60
|
+
isFavoriteBookmark,
|
|
61
|
+
} from './endpoints/user-bookmark-favourite.head';
|
|
62
|
+
import {
|
|
63
|
+
RemoveBookmarkFavouriteArgs,
|
|
64
|
+
RemoveBookmarkFavouriteResponse,
|
|
65
|
+
RemoveBookmarkFavouriteResult,
|
|
66
|
+
RemoveBookmarkFavouriteVersion,
|
|
67
|
+
removeFavoriteBookmark,
|
|
68
|
+
} from './endpoints/user-bookmark-favourite.delete';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Provides a client interface for interacting with the bookmarks API.
|
|
72
|
+
* This class abstracts the details of making API requests and handling responses.
|
|
73
|
+
* It provides methods for fetching, creating, updating, and deleting bookmarks,
|
|
74
|
+
* as well as managing bookmark favorites.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* import { BookmarksApiClient } from '@equinor/fusion';
|
|
79
|
+
* import { HttpClient } from '@equinor/fusion-framework-module-http';
|
|
80
|
+
*
|
|
81
|
+
* const httpClient = new HttpClient({ baseUri: 'https://my-bookmarks-api.com/' });
|
|
82
|
+
*
|
|
83
|
+
* // create a bookmarks API client using a custom HTTP client
|
|
84
|
+
* const client = new BookmarksApiClient(httpClient, 'json');
|
|
85
|
+
*
|
|
86
|
+
* // fetch a bookmark by its ID
|
|
87
|
+
* const bookmark = await client.getBookmark('my-bookmark-id');
|
|
88
|
+
*
|
|
89
|
+
* // fetch all bookmarks for the current user
|
|
90
|
+
* const bookmarks = await client.query();
|
|
91
|
+
*
|
|
92
|
+
* // update a bookmark by its ID
|
|
93
|
+
* await client.patch({
|
|
94
|
+
* bookmarkId: 'my-bookmark-id',
|
|
95
|
+
* data: {
|
|
96
|
+
* name: 'new-name'
|
|
97
|
+
* payload: { foo: 'bar' }
|
|
98
|
+
* }
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* // delete a bookmark by its ID
|
|
102
|
+
* await client.deleteBookmark('my-bookmark-id');
|
|
103
|
+
*
|
|
104
|
+
* // add or remove a bookmark to the current user's favorites
|
|
105
|
+
* await client.addFavorite({ bookmarkId:'my-bookmark-id' });
|
|
106
|
+
* await client.removeFavorite({ bookmarkId:'my-bookmark-id' });
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @template TMethod - The client method to use for the request, defaults to 'json'.
|
|
110
|
+
* @template TClient - The HTTP client to use for executing the request.
|
|
111
|
+
*/
|
|
25
112
|
export class BookmarksApiClient<
|
|
26
113
|
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
27
114
|
TClient extends IHttpClient = IHttpClient,
|
|
28
|
-
TPayload = unknown,
|
|
29
115
|
> {
|
|
116
|
+
/**
|
|
117
|
+
* Constructs a new instance of the BookmarksClient class.
|
|
118
|
+
*
|
|
119
|
+
* @param _client - The client instance to use for making API requests.
|
|
120
|
+
* @param _method - The client method to use for API requests.
|
|
121
|
+
*/
|
|
30
122
|
constructor(
|
|
31
123
|
protected _client: TClient,
|
|
32
124
|
protected _method: TMethod,
|
|
33
125
|
) {}
|
|
34
126
|
|
|
35
127
|
/**
|
|
36
|
-
* Fetch
|
|
37
|
-
*
|
|
128
|
+
* Fetch a single bookmark
|
|
129
|
+
*
|
|
130
|
+
* @template TVersion - The version of the API to call
|
|
131
|
+
* @template TResponse - The type of the result of the `getBookmark` function
|
|
132
|
+
* @param version - The API version to use
|
|
133
|
+
* @param args - Additional parameters to pass to the `getBookmark` function
|
|
134
|
+
* @returns The result of the `getBookmark` function
|
|
38
135
|
*/
|
|
39
|
-
public get<TVersion extends
|
|
136
|
+
public get<TVersion extends GetBookmarkVersion, TResponse = GetBookmarkResponse<TVersion>>(
|
|
40
137
|
version: TVersion,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
138
|
+
args: GetBookmarkArg<TVersion>,
|
|
139
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
140
|
+
): GetBookmarkResult<TVersion, TMethod, TResponse> {
|
|
141
|
+
const fn = getBookmark(version, this._client, this._method);
|
|
142
|
+
return fn(args, init);
|
|
45
143
|
}
|
|
144
|
+
|
|
46
145
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
146
|
+
* Retrieves the payload for a bookmark using the specified API version.
|
|
147
|
+
*
|
|
148
|
+
* @template TVersion - The version of the API to call.
|
|
149
|
+
* @template TResult - The type of the result of the `getBookmarkPayload` function.
|
|
150
|
+
* @param version - The API version to use for the bookmark payload.
|
|
151
|
+
* @param args - The arguments to pass to the `getBookmarkPayload` function.
|
|
152
|
+
* @returns The result of the `getBookmarkPayload` function.
|
|
49
153
|
*/
|
|
50
|
-
public
|
|
154
|
+
public getPayload<
|
|
155
|
+
TVersion extends BookmarkApplyVersion,
|
|
156
|
+
TResponse = BookmarkApplyResponse<TVersion>,
|
|
157
|
+
>(
|
|
51
158
|
version: TVersion,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
159
|
+
args: BookmarkApplyArgs<TVersion>,
|
|
160
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
161
|
+
): BookmarkApplyResult<TVersion, TMethod, TResponse> {
|
|
162
|
+
const fn = getBookmarkApply(version, this._client, this._method);
|
|
163
|
+
return fn(args, init);
|
|
55
164
|
}
|
|
56
165
|
|
|
57
166
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
167
|
+
* Query a person's bookmarks.
|
|
168
|
+
*
|
|
169
|
+
* @template TVersion - The version of the API to call.
|
|
170
|
+
* @template TResponse - The type of the result of the `getBookmarks` function.
|
|
171
|
+
* @param version - The API version to use.
|
|
172
|
+
* @param args - Additional arguments to pass to the `getBookmarks` function.
|
|
173
|
+
* @param init - Optional request initialization options.
|
|
174
|
+
* @returns The result of calling the `getBookmarks` function.
|
|
60
175
|
*/
|
|
61
|
-
public
|
|
176
|
+
public query<TVersion extends GetBookmarksVersion, TResponse = GetBookmarksResponse<TVersion>>(
|
|
62
177
|
version: TVersion,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
178
|
+
args?: GetBookmarksArgs<TVersion>,
|
|
179
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
180
|
+
): GetBookmarksResult<TVersion, TMethod, TResponse> {
|
|
181
|
+
const fn = getBookmarks(version, this._client, this._method);
|
|
182
|
+
return fn(args, init);
|
|
67
183
|
}
|
|
68
184
|
|
|
69
185
|
/**
|
|
70
186
|
* Update a bookmark
|
|
71
|
-
*
|
|
187
|
+
*
|
|
188
|
+
* @template TVersion - The version of the API to call
|
|
189
|
+
* @template TResponse - The type of the result of the `patchBookmark` function
|
|
190
|
+
* @param version - The API version to use
|
|
191
|
+
* @param args - The parameters to pass to the `patchBookmark` function
|
|
192
|
+
* @returns The result of the `patchBookmark` function
|
|
193
|
+
*/
|
|
194
|
+
public patch<
|
|
195
|
+
TVersion extends PatchBookmarkVersion,
|
|
196
|
+
TResponse = PatchBookmarkResponse<TVersion>,
|
|
197
|
+
>(
|
|
198
|
+
version: TVersion,
|
|
199
|
+
args: PatchBookmarkArg<TVersion>,
|
|
200
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
201
|
+
): PatchBookmarksResult<TVersion, TMethod, TResponse> {
|
|
202
|
+
const fn = patchBookmark(version, this._client, this._method);
|
|
203
|
+
return fn(args, init);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Create a new bookmark
|
|
208
|
+
*
|
|
209
|
+
* @template TVersion - The version of the API to call
|
|
210
|
+
* @template TResult - The type of the result of the `postBookmark` function
|
|
211
|
+
* @param version - The API version to use
|
|
212
|
+
* @param request - The parameters to pass to the `postBookmark` function
|
|
213
|
+
* @returns The result of creating the bookmark
|
|
72
214
|
*/
|
|
73
|
-
public
|
|
215
|
+
public create<
|
|
216
|
+
TVersion extends CreateBookmarkVersion,
|
|
217
|
+
TResponse = CreateBookmarkResponse<TVersion>,
|
|
218
|
+
>(
|
|
74
219
|
version: TVersion,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
220
|
+
request: CreateBookmarkArg<TVersion>,
|
|
221
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
222
|
+
): CreateBookmarksResult<TVersion, TMethod, TResponse> {
|
|
223
|
+
const fn = createBookmark(version, this._client, this._method);
|
|
224
|
+
return fn(request, init);
|
|
79
225
|
}
|
|
80
226
|
|
|
81
227
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
228
|
+
* Deletes a bookmark.
|
|
229
|
+
*
|
|
230
|
+
* @template TVersion - The version of the API to call.
|
|
231
|
+
* @template TResponse - The type of the result of the `deleteBookmark` function.
|
|
232
|
+
* @param version - The version of the delete bookmark API to use.
|
|
233
|
+
* @param args - The arguments to pass to the `deleteBookmark` function.
|
|
234
|
+
* @returns The result of the delete bookmark operation.
|
|
84
235
|
*/
|
|
85
|
-
public delete<
|
|
236
|
+
public delete<
|
|
237
|
+
TVersion extends DeleteBookmarkVersion,
|
|
238
|
+
TResponse = DeleteBookmarkResponse<TVersion>,
|
|
239
|
+
>(
|
|
86
240
|
version: TVersion,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
241
|
+
args: DeleteBookmarkArg<TVersion>,
|
|
242
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
243
|
+
): GetBookmarkResult<TVersion, TMethod, TResponse> {
|
|
244
|
+
const fn = deleteBookmark(version, this._client, this._method);
|
|
245
|
+
return fn(args, init);
|
|
91
246
|
}
|
|
92
247
|
|
|
93
248
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
249
|
+
* Check if a bookmark is a favorite.
|
|
250
|
+
*
|
|
251
|
+
* @template TVersion - The version of the API to call.
|
|
252
|
+
* @template TResult - The type of the result of the `verifyBookmarkFavorite` function.
|
|
253
|
+
* @param version - The API version to use.
|
|
254
|
+
* @param args - The arguments to pass to the `HeadBookmarkFavoriteFn` function.
|
|
255
|
+
* @returns The result of the `HeadBookmarksFavoriteResult` function.
|
|
96
256
|
*/
|
|
97
|
-
public
|
|
257
|
+
public isFavorite<
|
|
258
|
+
TVersion extends IsFavoriteBookmarkVersion,
|
|
259
|
+
TResponse = IsFavoriteBookmarkResponse<TVersion>,
|
|
260
|
+
>(
|
|
98
261
|
version: TVersion,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
262
|
+
args: IsFavoriteBookmarkArgs<TVersion>,
|
|
263
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
264
|
+
): IsFavoriteBookmarkResult<TVersion, TMethod, TResponse> {
|
|
265
|
+
const fn = isFavoriteBookmark(version, this._client, this._method);
|
|
266
|
+
return fn(args, init);
|
|
103
267
|
}
|
|
104
268
|
|
|
105
269
|
/**
|
|
270
|
+
* Add the provided bookmark to the user's favorites.
|
|
106
271
|
*
|
|
107
|
-
*
|
|
108
|
-
* @
|
|
272
|
+
* @template TVersion - The version of the API to call.
|
|
273
|
+
* @template TResponse - The type of the result of the `addBookmarkFavorite` function.
|
|
274
|
+
* @param version - The API version to use.
|
|
275
|
+
* @param args - The parameters to pass to the `PostBookmarkFavoriteFn` function.
|
|
276
|
+
* @returns The result of adding the bookmark to the user's favorites.
|
|
109
277
|
*/
|
|
110
|
-
public
|
|
278
|
+
public addFavourite<
|
|
279
|
+
TVersion extends AddBookmarkFavouriteVersion,
|
|
280
|
+
TResponse = AddBookmarkFavouriteResponse<TVersion>,
|
|
281
|
+
>(
|
|
111
282
|
version: TVersion,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
283
|
+
args: AddBookmarkFavouriteArgs<TVersion>,
|
|
284
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
285
|
+
): AddBookmarkFavouriteResult<TVersion, TMethod, TResponse> {
|
|
286
|
+
const fn = addBookmarkAsFavourite(version, this._client, this._method);
|
|
287
|
+
return fn(args, init);
|
|
116
288
|
}
|
|
117
289
|
|
|
118
290
|
/**
|
|
291
|
+
* Removes the provided bookmark from the user's collection of bookmarks.
|
|
119
292
|
*
|
|
120
|
-
*
|
|
121
|
-
* @
|
|
293
|
+
* @template TVersion - The version of the API to call.
|
|
294
|
+
* @template TResult - The type of the result of the `deleteBookmarkFavorite` function.
|
|
295
|
+
* @param version - The API version to use for the request.
|
|
296
|
+
* @param request - The parameters to pass to the `deleteBookmarkFavorite` function.
|
|
297
|
+
* @returns The result of the `deleteBookmarkFavorite` function.
|
|
122
298
|
*/
|
|
123
|
-
public
|
|
299
|
+
public removeFavourite<
|
|
300
|
+
TVersion extends RemoveBookmarkFavouriteVersion,
|
|
301
|
+
TResponse = RemoveBookmarkFavouriteResponse<TVersion>,
|
|
302
|
+
>(
|
|
124
303
|
version: TVersion,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
304
|
+
request: RemoveBookmarkFavouriteArgs<TVersion>,
|
|
305
|
+
init?: ClientRequestInit<TClient, TResponse>,
|
|
306
|
+
): RemoveBookmarkFavouriteResult<TVersion, TMethod, TResponse> {
|
|
307
|
+
const fn = removeFavoriteBookmark(version, this._client, this._method);
|
|
308
|
+
return fn(request, init);
|
|
129
309
|
}
|
|
130
310
|
}
|
|
131
311
|
|