@equinor/fusion-framework-module-services 4.1.5 → 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.
Files changed (245) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/esm/bookmarks/api-version.js +6 -0
  3. package/dist/esm/bookmarks/api-version.js.map +1 -0
  4. package/dist/esm/bookmarks/client.js +148 -47
  5. package/dist/esm/bookmarks/client.js.map +1 -1
  6. package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js +49 -0
  7. package/dist/esm/bookmarks/endpoints/bookmark-apply.get.js.map +1 -0
  8. package/dist/esm/bookmarks/endpoints/bookmark.delete.js +48 -0
  9. package/dist/esm/bookmarks/endpoints/bookmark.delete.js.map +1 -0
  10. package/dist/esm/bookmarks/endpoints/bookmark.get.js +53 -0
  11. package/dist/esm/bookmarks/endpoints/bookmark.get.js.map +1 -0
  12. package/dist/esm/bookmarks/endpoints/bookmark.patch.js +68 -0
  13. package/dist/esm/bookmarks/endpoints/bookmark.patch.js.map +1 -0
  14. package/dist/esm/bookmarks/endpoints/bookmark.post.js +57 -0
  15. package/dist/esm/bookmarks/endpoints/bookmark.post.js.map +1 -0
  16. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js +48 -0
  17. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.delete.js.map +1 -0
  18. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js +49 -0
  19. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.head.js.map +1 -0
  20. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js +49 -0
  21. package/dist/esm/bookmarks/endpoints/user-bookmark-favourite.post.js.map +1 -0
  22. package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js +75 -0
  23. package/dist/esm/bookmarks/endpoints/user-bookmarks.get.js.map +1 -0
  24. package/dist/esm/bookmarks/index.js +1 -2
  25. package/dist/esm/bookmarks/index.js.map +1 -1
  26. package/dist/esm/bookmarks/schemas.js +76 -0
  27. package/dist/esm/bookmarks/schemas.js.map +1 -0
  28. package/dist/esm/bookmarks/selectors.js +58 -0
  29. package/dist/esm/bookmarks/selectors.js.map +1 -0
  30. package/dist/esm/utils.js +35 -0
  31. package/dist/esm/utils.js.map +1 -0
  32. package/dist/esm/version.js +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/dist/types/bookmarks/api-version.d.ts +4 -0
  35. package/dist/types/bookmarks/client.d.ts +132 -34
  36. package/dist/types/bookmarks/endpoints/bookmark-apply.get.d.ts +40 -0
  37. package/dist/types/bookmarks/endpoints/bookmark.delete.d.ts +31 -0
  38. package/dist/types/bookmarks/endpoints/bookmark.get.d.ts +351 -0
  39. package/dist/types/bookmarks/endpoints/bookmark.patch.d.ts +254 -0
  40. package/dist/types/bookmarks/endpoints/bookmark.post.d.ts +231 -0
  41. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.delete.d.ts +31 -0
  42. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.head.d.ts +31 -0
  43. package/dist/types/bookmarks/endpoints/user-bookmark-favourite.post.d.ts +31 -0
  44. package/dist/types/bookmarks/endpoints/user-bookmarks.get.d.ts +235 -0
  45. package/dist/types/bookmarks/index.d.ts +3 -2
  46. package/dist/types/bookmarks/schemas.d.ts +383 -0
  47. package/dist/types/bookmarks/selectors.d.ts +17 -0
  48. package/dist/types/bookmarks/types.d.ts +5 -1
  49. package/dist/types/provider.d.ts +2 -2
  50. package/dist/types/types.d.ts +74 -11
  51. package/dist/types/utils.d.ts +18 -0
  52. package/dist/types/version.d.ts +1 -1
  53. package/package.json +8 -7
  54. package/src/bookmarks/README.md +90 -0
  55. package/src/bookmarks/api-version.ts +4 -0
  56. package/src/bookmarks/client.ts +257 -77
  57. package/src/bookmarks/endpoints/bookmark-apply.get.ts +114 -0
  58. package/src/bookmarks/endpoints/bookmark.delete.ts +113 -0
  59. package/src/bookmarks/endpoints/bookmark.get.ts +118 -0
  60. package/src/bookmarks/endpoints/bookmark.patch.ts +135 -0
  61. package/src/bookmarks/endpoints/bookmark.post.ts +124 -0
  62. package/src/bookmarks/endpoints/user-bookmark-favourite.delete.ts +113 -0
  63. package/src/bookmarks/endpoints/user-bookmark-favourite.head.ts +114 -0
  64. package/src/bookmarks/endpoints/user-bookmark-favourite.post.ts +114 -0
  65. package/src/bookmarks/endpoints/user-bookmarks.get.ts +142 -0
  66. package/src/bookmarks/index.ts +3 -3
  67. package/src/bookmarks/schemas.ts +81 -0
  68. package/src/bookmarks/selectors.ts +49 -0
  69. package/src/bookmarks/types.ts +16 -1
  70. package/src/provider.ts +4 -4
  71. package/src/types.ts +92 -11
  72. package/src/utils.ts +51 -0
  73. package/src/version.ts +1 -1
  74. package/dist/esm/bookmarks/api-models.js +0 -2
  75. package/dist/esm/bookmarks/api-models.js.map +0 -1
  76. package/dist/esm/bookmarks/delete/client.js +0 -10
  77. package/dist/esm/bookmarks/delete/client.js.map +0 -1
  78. package/dist/esm/bookmarks/delete/generate-endpoint.js +0 -20
  79. package/dist/esm/bookmarks/delete/generate-endpoint.js.map +0 -1
  80. package/dist/esm/bookmarks/delete/generate-parameters.js +0 -8
  81. package/dist/esm/bookmarks/delete/generate-parameters.js.map +0 -1
  82. package/dist/esm/bookmarks/delete/index.js +0 -5
  83. package/dist/esm/bookmarks/delete/index.js.map +0 -1
  84. package/dist/esm/bookmarks/delete/types-v1.js +0 -2
  85. package/dist/esm/bookmarks/delete/types-v1.js.map +0 -1
  86. package/dist/esm/bookmarks/delete/types.js +0 -2
  87. package/dist/esm/bookmarks/delete/types.js.map +0 -1
  88. package/dist/esm/bookmarks/favorites/delete/client.js +0 -10
  89. package/dist/esm/bookmarks/favorites/delete/client.js.map +0 -1
  90. package/dist/esm/bookmarks/favorites/delete/generate-endpoint.js +0 -15
  91. package/dist/esm/bookmarks/favorites/delete/generate-endpoint.js.map +0 -1
  92. package/dist/esm/bookmarks/favorites/delete/generate-parameters.js +0 -8
  93. package/dist/esm/bookmarks/favorites/delete/generate-parameters.js.map +0 -1
  94. package/dist/esm/bookmarks/favorites/delete/index.js +0 -5
  95. package/dist/esm/bookmarks/favorites/delete/index.js.map +0 -1
  96. package/dist/esm/bookmarks/favorites/delete/types-v1.js +0 -2
  97. package/dist/esm/bookmarks/favorites/delete/types-v1.js.map +0 -1
  98. package/dist/esm/bookmarks/favorites/delete/types.js +0 -2
  99. package/dist/esm/bookmarks/favorites/delete/types.js.map +0 -1
  100. package/dist/esm/bookmarks/favorites/head/client.js +0 -10
  101. package/dist/esm/bookmarks/favorites/head/client.js.map +0 -1
  102. package/dist/esm/bookmarks/favorites/head/generate-endpoint.js +0 -15
  103. package/dist/esm/bookmarks/favorites/head/generate-endpoint.js.map +0 -1
  104. package/dist/esm/bookmarks/favorites/head/generate-parameters.js +0 -10
  105. package/dist/esm/bookmarks/favorites/head/generate-parameters.js.map +0 -1
  106. package/dist/esm/bookmarks/favorites/head/index.js +0 -5
  107. package/dist/esm/bookmarks/favorites/head/index.js.map +0 -1
  108. package/dist/esm/bookmarks/favorites/head/types.js +0 -2
  109. package/dist/esm/bookmarks/favorites/head/types.js.map +0 -1
  110. package/dist/esm/bookmarks/favorites/post/client.js +0 -10
  111. package/dist/esm/bookmarks/favorites/post/client.js.map +0 -1
  112. package/dist/esm/bookmarks/favorites/post/generate-endpoint.js +0 -14
  113. package/dist/esm/bookmarks/favorites/post/generate-endpoint.js.map +0 -1
  114. package/dist/esm/bookmarks/favorites/post/generate-parameters.js +0 -10
  115. package/dist/esm/bookmarks/favorites/post/generate-parameters.js.map +0 -1
  116. package/dist/esm/bookmarks/favorites/post/index.js +0 -5
  117. package/dist/esm/bookmarks/favorites/post/index.js.map +0 -1
  118. package/dist/esm/bookmarks/favorites/post/types.js +0 -2
  119. package/dist/esm/bookmarks/favorites/post/types.js.map +0 -1
  120. package/dist/esm/bookmarks/get/client.js +0 -10
  121. package/dist/esm/bookmarks/get/client.js.map +0 -1
  122. package/dist/esm/bookmarks/get/generate-endpoint.js +0 -20
  123. package/dist/esm/bookmarks/get/generate-endpoint.js.map +0 -1
  124. package/dist/esm/bookmarks/get/generate-parameters.js +0 -7
  125. package/dist/esm/bookmarks/get/generate-parameters.js.map +0 -1
  126. package/dist/esm/bookmarks/get/index.js +0 -5
  127. package/dist/esm/bookmarks/get/index.js.map +0 -1
  128. package/dist/esm/bookmarks/get/types.js +0 -2
  129. package/dist/esm/bookmarks/get/types.js.map +0 -1
  130. package/dist/esm/bookmarks/getAll/client.js +0 -10
  131. package/dist/esm/bookmarks/getAll/client.js.map +0 -1
  132. package/dist/esm/bookmarks/getAll/generate-endpoint.js +0 -14
  133. package/dist/esm/bookmarks/getAll/generate-endpoint.js.map +0 -1
  134. package/dist/esm/bookmarks/getAll/generate-parameters.js +0 -7
  135. package/dist/esm/bookmarks/getAll/generate-parameters.js.map +0 -1
  136. package/dist/esm/bookmarks/getAll/index.js +0 -5
  137. package/dist/esm/bookmarks/getAll/index.js.map +0 -1
  138. package/dist/esm/bookmarks/getAll/types.js +0 -2
  139. package/dist/esm/bookmarks/getAll/types.js.map +0 -1
  140. package/dist/esm/bookmarks/patch/client.js +0 -10
  141. package/dist/esm/bookmarks/patch/client.js.map +0 -1
  142. package/dist/esm/bookmarks/patch/generate-endpoint.js +0 -14
  143. package/dist/esm/bookmarks/patch/generate-endpoint.js.map +0 -1
  144. package/dist/esm/bookmarks/patch/generate-parameters.js +0 -10
  145. package/dist/esm/bookmarks/patch/generate-parameters.js.map +0 -1
  146. package/dist/esm/bookmarks/patch/index.js +0 -5
  147. package/dist/esm/bookmarks/patch/index.js.map +0 -1
  148. package/dist/esm/bookmarks/patch/types.js +0 -2
  149. package/dist/esm/bookmarks/patch/types.js.map +0 -1
  150. package/dist/esm/bookmarks/post/client.js +0 -10
  151. package/dist/esm/bookmarks/post/client.js.map +0 -1
  152. package/dist/esm/bookmarks/post/generate-endpoint.js +0 -14
  153. package/dist/esm/bookmarks/post/generate-endpoint.js.map +0 -1
  154. package/dist/esm/bookmarks/post/generate-parameters.js +0 -10
  155. package/dist/esm/bookmarks/post/generate-parameters.js.map +0 -1
  156. package/dist/esm/bookmarks/post/index.js +0 -5
  157. package/dist/esm/bookmarks/post/index.js.map +0 -1
  158. package/dist/esm/bookmarks/post/types.js +0 -2
  159. package/dist/esm/bookmarks/post/types.js.map +0 -1
  160. package/dist/types/bookmarks/api-models.d.ts +0 -42
  161. package/dist/types/bookmarks/delete/client.d.ts +0 -11
  162. package/dist/types/bookmarks/delete/generate-endpoint.d.ts +0 -5
  163. package/dist/types/bookmarks/delete/generate-parameters.d.ts +0 -5
  164. package/dist/types/bookmarks/delete/index.d.ts +0 -4
  165. package/dist/types/bookmarks/delete/types-v1.d.ts +0 -4
  166. package/dist/types/bookmarks/delete/types.d.ts +0 -18
  167. package/dist/types/bookmarks/favorites/delete/client.d.ts +0 -11
  168. package/dist/types/bookmarks/favorites/delete/generate-endpoint.d.ts +0 -5
  169. package/dist/types/bookmarks/favorites/delete/generate-parameters.d.ts +0 -5
  170. package/dist/types/bookmarks/favorites/delete/index.d.ts +0 -4
  171. package/dist/types/bookmarks/favorites/delete/types-v1.d.ts +0 -4
  172. package/dist/types/bookmarks/favorites/delete/types.d.ts +0 -16
  173. package/dist/types/bookmarks/favorites/head/client.d.ts +0 -11
  174. package/dist/types/bookmarks/favorites/head/generate-endpoint.d.ts +0 -5
  175. package/dist/types/bookmarks/favorites/head/generate-parameters.d.ts +0 -5
  176. package/dist/types/bookmarks/favorites/head/index.d.ts +0 -4
  177. package/dist/types/bookmarks/favorites/head/types.d.ts +0 -17
  178. package/dist/types/bookmarks/favorites/post/client.d.ts +0 -11
  179. package/dist/types/bookmarks/favorites/post/generate-endpoint.d.ts +0 -5
  180. package/dist/types/bookmarks/favorites/post/generate-parameters.d.ts +0 -5
  181. package/dist/types/bookmarks/favorites/post/index.d.ts +0 -4
  182. package/dist/types/bookmarks/favorites/post/types.d.ts +0 -17
  183. package/dist/types/bookmarks/get/client.d.ts +0 -11
  184. package/dist/types/bookmarks/get/generate-endpoint.d.ts +0 -5
  185. package/dist/types/bookmarks/get/generate-parameters.d.ts +0 -5
  186. package/dist/types/bookmarks/get/index.d.ts +0 -4
  187. package/dist/types/bookmarks/get/types.d.ts +0 -21
  188. package/dist/types/bookmarks/getAll/client.d.ts +0 -11
  189. package/dist/types/bookmarks/getAll/generate-endpoint.d.ts +0 -5
  190. package/dist/types/bookmarks/getAll/generate-parameters.d.ts +0 -5
  191. package/dist/types/bookmarks/getAll/index.d.ts +0 -4
  192. package/dist/types/bookmarks/getAll/types.d.ts +0 -11
  193. package/dist/types/bookmarks/patch/client.d.ts +0 -11
  194. package/dist/types/bookmarks/patch/generate-endpoint.d.ts +0 -5
  195. package/dist/types/bookmarks/patch/generate-parameters.d.ts +0 -5
  196. package/dist/types/bookmarks/patch/index.d.ts +0 -4
  197. package/dist/types/bookmarks/patch/types.d.ts +0 -21
  198. package/dist/types/bookmarks/post/client.d.ts +0 -11
  199. package/dist/types/bookmarks/post/generate-endpoint.d.ts +0 -5
  200. package/dist/types/bookmarks/post/generate-parameters.d.ts +0 -5
  201. package/dist/types/bookmarks/post/index.d.ts +0 -4
  202. package/dist/types/bookmarks/post/types.d.ts +0 -34
  203. package/src/bookmarks/api-models.ts +0 -46
  204. package/src/bookmarks/delete/client.ts +0 -35
  205. package/src/bookmarks/delete/generate-endpoint.ts +0 -24
  206. package/src/bookmarks/delete/generate-parameters.ts +0 -25
  207. package/src/bookmarks/delete/index.ts +0 -6
  208. package/src/bookmarks/delete/types-v1.ts +0 -2
  209. package/src/bookmarks/delete/types.ts +0 -35
  210. package/src/bookmarks/favorites/delete/client.ts +0 -35
  211. package/src/bookmarks/favorites/delete/generate-endpoint.ts +0 -19
  212. package/src/bookmarks/favorites/delete/generate-parameters.ts +0 -25
  213. package/src/bookmarks/favorites/delete/index.ts +0 -6
  214. package/src/bookmarks/favorites/delete/types-v1.ts +0 -2
  215. package/src/bookmarks/favorites/delete/types.ts +0 -33
  216. package/src/bookmarks/favorites/head/client.ts +0 -35
  217. package/src/bookmarks/favorites/head/generate-endpoint.ts +0 -19
  218. package/src/bookmarks/favorites/head/generate-parameters.ts +0 -28
  219. package/src/bookmarks/favorites/head/index.ts +0 -6
  220. package/src/bookmarks/favorites/head/types.ts +0 -35
  221. package/src/bookmarks/favorites/post/client.ts +0 -35
  222. package/src/bookmarks/favorites/post/generate-endpoint.ts +0 -18
  223. package/src/bookmarks/favorites/post/generate-parameters.ts +0 -28
  224. package/src/bookmarks/favorites/post/index.ts +0 -6
  225. package/src/bookmarks/favorites/post/types.ts +0 -35
  226. package/src/bookmarks/get/client.ts +0 -30
  227. package/src/bookmarks/get/generate-endpoint.ts +0 -24
  228. package/src/bookmarks/get/generate-parameters.ts +0 -18
  229. package/src/bookmarks/get/index.ts +0 -6
  230. package/src/bookmarks/get/types.ts +0 -39
  231. package/src/bookmarks/getAll/client.ts +0 -30
  232. package/src/bookmarks/getAll/generate-endpoint.ts +0 -15
  233. package/src/bookmarks/getAll/generate-parameters.ts +0 -18
  234. package/src/bookmarks/getAll/index.ts +0 -6
  235. package/src/bookmarks/getAll/types.ts +0 -21
  236. package/src/bookmarks/patch/client.ts +0 -30
  237. package/src/bookmarks/patch/generate-endpoint.ts +0 -18
  238. package/src/bookmarks/patch/generate-parameters.ts +0 -28
  239. package/src/bookmarks/patch/index.ts +0 -6
  240. package/src/bookmarks/patch/types.ts +0 -45
  241. package/src/bookmarks/post/client.ts +0 -30
  242. package/src/bookmarks/post/generate-endpoint.ts +0 -18
  243. package/src/bookmarks/post/generate-parameters.ts +0 -28
  244. package/src/bookmarks/post/index.ts +0 -6
  245. package/src/bookmarks/post/types.ts +0 -58
@@ -1,5 +1,19 @@
1
- import { ClientRequestInit, IHttpClient, StreamResponse, BlobResult, FetchResponse } from '@equinor/fusion-framework-module-http/client';
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>;
@@ -1 +1 @@
1
- export declare const version = "4.1.5";
1
+ export declare const version = "5.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-module-services",
3
- "version": "4.1.5",
3
+ "version": "5.0.0",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "main": "dist/esm/index.js",
@@ -50,6 +50,10 @@
50
50
  "import": "./dist/esm/index.js",
51
51
  "types": "./dist/types/index.d.ts"
52
52
  },
53
+ "./bookmarks": {
54
+ "import": "./dist/esm/bookmarks/index.js",
55
+ "types": "./dist/types/bookmarks/index.d.ts"
56
+ },
53
57
  "./context": {
54
58
  "import": "./dist/esm/context/index.js",
55
59
  "types": "./dist/types/context/index.d.ts"
@@ -66,10 +70,6 @@
66
70
  "import": "./dist/esm/context/related/index.js",
67
71
  "types": "./dist/types/context/related/index.d.ts"
68
72
  },
69
- "./bookmarks": {
70
- "import": "./dist/esm/bookmarks/index.js",
71
- "types": "./dist/types/bookmarks/index.d.ts"
72
- },
73
73
  "./notification": {
74
74
  "import": "./dist/esm/notification/index.js",
75
75
  "types": "./dist/types/notification/index.d.ts"
@@ -112,13 +112,14 @@
112
112
  "directory": "packages/modules/services"
113
113
  },
114
114
  "dependencies": {
115
- "odata-query": "^7.0.4"
115
+ "odata-query": "^7.0.4",
116
+ "zod": "^3.23.8"
116
117
  },
117
118
  "devDependencies": {
118
119
  "typescript": "^5.5.4",
119
120
  "@equinor/fusion-framework-module": "^4.3.5",
120
121
  "@equinor/fusion-framework-module-http": "^6.2.0",
121
- "@equinor/fusion-framework-module-service-discovery": "^8.0.1"
122
+ "@equinor/fusion-framework-module-service-discovery": "^8.0.2"
122
123
  },
123
124
  "peerDependencies": {
124
125
  "odata-query": "^7.0.4",
@@ -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
+ ```
@@ -0,0 +1,4 @@
1
+ export enum ApiVersion {
2
+ 'v1' = '1.0',
3
+ 'v2' = '2.0',
4
+ }
@@ -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 { ClientMethod } from '..';
4
- import deleteBookmark from './delete/client';
5
- import { DeleteBookmarkResult, DeleteBookmarksFn, DeleteBookmarksResult } from './delete/types';
6
- import getBookmark from './get/client';
7
- import { ApiVersions, GetBookmarkResult, GetBookmarksFn, GetBookmarksResult } from './get/types';
8
- import { PostBookmarkResult, PostBookmarkFn, PostBookmarksResult } from './post/types';
9
- import postBookmark from './post/client';
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 bookmark by id
37
- * @see {@link get/client}
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 ApiVersions, TResult = GetBookmarkResult<TVersion, TPayload>>(
136
+ public get<TVersion extends GetBookmarkVersion, TResponse = GetBookmarkResponse<TVersion>>(
40
137
  version: TVersion,
41
- ...args: Parameters<GetBookmarksFn<TVersion, TMethod, TClient, TPayload, TResult>>
42
- ): GetBookmarksResult<TVersion, TMethod, TPayload, TResult> {
43
- const fn = getBookmark(this._client, version, this._method);
44
- return fn<TResult>(...args);
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
- * Fetch all bookmarks
48
- * @see {@link get/client}
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 getAll<TVersion extends ApiVersions, TResult = GetAllBookmarkResult<TVersion, TPayload>>(
154
+ public getPayload<
155
+ TVersion extends BookmarkApplyVersion,
156
+ TResponse = BookmarkApplyResponse<TVersion>,
157
+ >(
51
158
  version: TVersion,
52
- ): GetAllBookmarksResult<TVersion, TMethod, TPayload, TResult> {
53
- const fn = getAllBookmarks(this._client, version, this._method);
54
- return fn<TResult>();
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
- * Create a new bookmark
59
- * @see {@link get/client}
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 post<TVersion extends ApiVersions, TResult = PostBookmarkResult<TVersion, TPayload>>(
176
+ public query<TVersion extends GetBookmarksVersion, TResponse = GetBookmarksResponse<TVersion>>(
62
177
  version: TVersion,
63
- ...args: Parameters<PostBookmarkFn<TVersion, TMethod, TClient, TPayload, TResult>>
64
- ): PostBookmarksResult<TVersion, TMethod, TPayload, TResult> {
65
- const fn = postBookmark(this._client, version, this._method);
66
- return fn<TResult>(...args);
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
- * @see {@link get/client}
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 patch<TVersion extends ApiVersions, TResult = PatchBookmarkResult<TVersion, TPayload>>(
215
+ public create<
216
+ TVersion extends CreateBookmarkVersion,
217
+ TResponse = CreateBookmarkResponse<TVersion>,
218
+ >(
74
219
  version: TVersion,
75
- ...args: Parameters<PatchBookmarkFn<TVersion, TMethod, TClient, TPayload, TResult>>
76
- ): PatchBookmarksResult<TVersion, TMethod, TPayload, TResult> {
77
- const fn = patchBookmark(this._client, version, this._method);
78
- return fn<TResult>(...args);
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
- * Delete a bookmark
83
- * @see {@link delete/client}
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<TVersion extends ApiVersions, TResult = DeleteBookmarkResult<TVersion>>(
236
+ public delete<
237
+ TVersion extends DeleteBookmarkVersion,
238
+ TResponse = DeleteBookmarkResponse<TVersion>,
239
+ >(
86
240
  version: TVersion,
87
- ...args: Parameters<DeleteBookmarksFn<TVersion, TMethod, TClient, TResult>>
88
- ): DeleteBookmarksResult<TVersion, TMethod, TResult> {
89
- const fn = deleteBookmark(this._client, version, this._method);
90
- return fn<TResult>(...args);
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
- * Add bookmark to favorites by bookmark id
95
- * @see {@link addFavorite/client}
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 addFavorite<TVersion extends ApiVersions, TResult = DeleteBookmarkResult<TVersion>>(
257
+ public isFavorite<
258
+ TVersion extends IsFavoriteBookmarkVersion,
259
+ TResponse = IsFavoriteBookmarkResponse<TVersion>,
260
+ >(
98
261
  version: TVersion,
99
- ...args: Parameters<PostBookmarkFavoriteFn<TVersion, TMethod, TClient, TResult>>
100
- ): PostBookmarksFavoriteResult<TVersion, TMethod, TResult> {
101
- const fn = addBookmarkFavorite(this._client, version, this._method);
102
- return fn<TResult>(...args);
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
- * Remove bookmark from favorites by bookmark id
108
- * @see {@link removeFavorite/client}
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 removeFavorite<TVersion extends ApiVersions, TResult = DeleteBookmarkResult<TVersion>>(
278
+ public addFavourite<
279
+ TVersion extends AddBookmarkFavouriteVersion,
280
+ TResponse = AddBookmarkFavouriteResponse<TVersion>,
281
+ >(
111
282
  version: TVersion,
112
- ...args: Parameters<DeleteBookmarksFavoriteFn<TVersion, TMethod, TClient, TResult>>
113
- ): DeleteBookmarksFavoriteResult<TVersion, TMethod, TResult> {
114
- const fn = deleteBookmarkFavorite(this._client, version, this._method);
115
- return fn<TResult>(...args);
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
- * Verify that the current bookmark is present in the users collection of bookmarks.
121
- * @see {@link verifyFavorite/client}
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 verifyFavorite<TVersion extends ApiVersions, TResult = DeleteBookmarkResult<TVersion>>(
299
+ public removeFavourite<
300
+ TVersion extends RemoveBookmarkFavouriteVersion,
301
+ TResponse = RemoveBookmarkFavouriteResponse<TVersion>,
302
+ >(
124
303
  version: TVersion,
125
- ...args: Parameters<HeadBookmarkFavoriteFn<TVersion, TMethod, TClient, TResult>>
126
- ): HeadBookmarksFavoriteResult<TVersion, TMethod, TResult> {
127
- const fn = verifyBookmarkFavorite(this._client, version, this._method);
128
- return fn<TResult>(...args);
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