@learnorama/mozaik-sdk 0.1.0-staging.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/README.md +94 -0
  2. package/dist/api/account.d.ts +75 -0
  3. package/dist/api/account.js +117 -0
  4. package/dist/api/account.js.map +1 -0
  5. package/dist/api/admin-catalogue.d.ts +68 -0
  6. package/dist/api/admin-catalogue.js +155 -0
  7. package/dist/api/admin-catalogue.js.map +1 -0
  8. package/dist/api/admin-consumption.d.ts +27 -0
  9. package/dist/api/admin-consumption.js +55 -0
  10. package/dist/api/admin-consumption.js.map +1 -0
  11. package/dist/api/admin-licenses.d.ts +21 -0
  12. package/dist/api/admin-licenses.js +34 -0
  13. package/dist/api/admin-licenses.js.map +1 -0
  14. package/dist/api/admin-patrons.d.ts +36 -0
  15. package/dist/api/admin-patrons.js +76 -0
  16. package/dist/api/admin-patrons.js.map +1 -0
  17. package/dist/api/admin-reviews.d.ts +30 -0
  18. package/dist/api/admin-reviews.js +63 -0
  19. package/dist/api/admin-reviews.js.map +1 -0
  20. package/dist/api/admin-roles.d.ts +34 -0
  21. package/dist/api/admin-roles.js +62 -0
  22. package/dist/api/admin-roles.js.map +1 -0
  23. package/dist/api/admin-support.d.ts +68 -0
  24. package/dist/api/admin-support.js +116 -0
  25. package/dist/api/admin-support.js.map +1 -0
  26. package/dist/api/admin-tenants.d.ts +33 -0
  27. package/dist/api/admin-tenants.js +68 -0
  28. package/dist/api/admin-tenants.js.map +1 -0
  29. package/dist/api/admin-tutoring.d.ts +159 -0
  30. package/dist/api/admin-tutoring.js +455 -0
  31. package/dist/api/admin-tutoring.js.map +1 -0
  32. package/dist/api/auth.d.ts +92 -0
  33. package/dist/api/auth.js +192 -0
  34. package/dist/api/auth.js.map +1 -0
  35. package/dist/api/biblio-catalogue.d.ts +122 -0
  36. package/dist/api/biblio-catalogue.js +223 -0
  37. package/dist/api/biblio-catalogue.js.map +1 -0
  38. package/dist/api/biblio-home.d.ts +18 -0
  39. package/dist/api/biblio-home.js +31 -0
  40. package/dist/api/biblio-home.js.map +1 -0
  41. package/dist/api/biblio-library.d.ts +94 -0
  42. package/dist/api/biblio-library.js +187 -0
  43. package/dist/api/biblio-library.js.map +1 -0
  44. package/dist/api/biblio-nextory.d.ts +43 -0
  45. package/dist/api/biblio-nextory.js +65 -0
  46. package/dist/api/biblio-nextory.js.map +1 -0
  47. package/dist/api/biblio-press.d.ts +38 -0
  48. package/dist/api/biblio-press.js +70 -0
  49. package/dist/api/biblio-press.js.map +1 -0
  50. package/dist/api/biblio-search.d.ts +17 -0
  51. package/dist/api/biblio-search.js +30 -0
  52. package/dist/api/biblio-search.js.map +1 -0
  53. package/dist/api/biblio-telemetry.d.ts +28 -0
  54. package/dist/api/biblio-telemetry.js +49 -0
  55. package/dist/api/biblio-telemetry.js.map +1 -0
  56. package/dist/api/consumption.d.ts +30 -0
  57. package/dist/api/consumption.js +45 -0
  58. package/dist/api/consumption.js.map +1 -0
  59. package/dist/api/cvs-app.d.ts +39 -0
  60. package/dist/api/cvs-app.js +72 -0
  61. package/dist/api/cvs-app.js.map +1 -0
  62. package/dist/api/cvs-documents.d.ts +106 -0
  63. package/dist/api/cvs-documents.js +208 -0
  64. package/dist/api/cvs-documents.js.map +1 -0
  65. package/dist/api/cvs-favorites.d.ts +53 -0
  66. package/dist/api/cvs-favorites.js +82 -0
  67. package/dist/api/cvs-favorites.js.map +1 -0
  68. package/dist/api/cvs-loans.d.ts +59 -0
  69. package/dist/api/cvs-loans.js +106 -0
  70. package/dist/api/cvs-loans.js.map +1 -0
  71. package/dist/api/cvs-streaming.d.ts +40 -0
  72. package/dist/api/cvs-streaming.js +68 -0
  73. package/dist/api/cvs-streaming.js.map +1 -0
  74. package/dist/api/index.d.ts +34 -0
  75. package/dist/api/index.js +34 -0
  76. package/dist/api/partner-catalogue.d.ts +77 -0
  77. package/dist/api/partner-catalogue.js +125 -0
  78. package/dist/api/partner-catalogue.js.map +1 -0
  79. package/dist/api/partner-reader.d.ts +56 -0
  80. package/dist/api/partner-reader.js +103 -0
  81. package/dist/api/partner-reader.js.map +1 -0
  82. package/dist/api/profiles.d.ts +64 -0
  83. package/dist/api/profiles.js +126 -0
  84. package/dist/api/profiles.js.map +1 -0
  85. package/dist/api/tutoring-catalogue.d.ts +32 -0
  86. package/dist/api/tutoring-catalogue.js +59 -0
  87. package/dist/api/tutoring-catalogue.js.map +1 -0
  88. package/dist/api/tutoring-chat.d.ts +31 -0
  89. package/dist/api/tutoring-chat.js +71 -0
  90. package/dist/api/tutoring-chat.js.map +1 -0
  91. package/dist/api/tutoring-dispatch.d.ts +37 -0
  92. package/dist/api/tutoring-dispatch.js +83 -0
  93. package/dist/api/tutoring-dispatch.js.map +1 -0
  94. package/dist/api/tutoring-practitioner.d.ts +55 -0
  95. package/dist/api/tutoring-practitioner.js +110 -0
  96. package/dist/api/tutoring-practitioner.js.map +1 -0
  97. package/dist/api/tutoring-requests.d.ts +86 -0
  98. package/dist/api/tutoring-requests.js +176 -0
  99. package/dist/api/tutoring-requests.js.map +1 -0
  100. package/dist/chunks/client.d.ts +28 -0
  101. package/dist/chunks/client.js +61 -0
  102. package/dist/chunks/client.js.map +1 -0
  103. package/dist/chunks/index.d.ts +4566 -0
  104. package/dist/index.d.ts +9 -0
  105. package/dist/index.js +10 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/models.d.ts +3 -0
  108. package/dist/models.js +175 -0
  109. package/dist/models.js.map +1 -0
  110. package/dist/react/account.d.ts +163 -0
  111. package/dist/react/account.js +240 -0
  112. package/dist/react/account.js.map +1 -0
  113. package/dist/react/admin-catalogue.d.ts +196 -0
  114. package/dist/react/admin-catalogue.js +336 -0
  115. package/dist/react/admin-catalogue.js.map +1 -0
  116. package/dist/react/admin-consumption.d.ts +75 -0
  117. package/dist/react/admin-consumption.js +127 -0
  118. package/dist/react/admin-consumption.js.map +1 -0
  119. package/dist/react/admin-licenses.d.ts +50 -0
  120. package/dist/react/admin-licenses.js +78 -0
  121. package/dist/react/admin-licenses.js.map +1 -0
  122. package/dist/react/admin-patrons.d.ts +111 -0
  123. package/dist/react/admin-patrons.js +173 -0
  124. package/dist/react/admin-patrons.js.map +1 -0
  125. package/dist/react/admin-reviews.d.ts +78 -0
  126. package/dist/react/admin-reviews.js +135 -0
  127. package/dist/react/admin-reviews.js.map +1 -0
  128. package/dist/react/admin-roles.d.ts +82 -0
  129. package/dist/react/admin-roles.js +135 -0
  130. package/dist/react/admin-roles.js.map +1 -0
  131. package/dist/react/admin-support.d.ts +123 -0
  132. package/dist/react/admin-support.js +208 -0
  133. package/dist/react/admin-support.js.map +1 -0
  134. package/dist/react/admin-tenants.d.ts +108 -0
  135. package/dist/react/admin-tenants.js +165 -0
  136. package/dist/react/admin-tenants.js.map +1 -0
  137. package/dist/react/admin-tutoring.d.ts +556 -0
  138. package/dist/react/admin-tutoring.js +954 -0
  139. package/dist/react/admin-tutoring.js.map +1 -0
  140. package/dist/react/auth.d.ts +220 -0
  141. package/dist/react/auth.js +372 -0
  142. package/dist/react/auth.js.map +1 -0
  143. package/dist/react/biblio-catalogue.d.ts +374 -0
  144. package/dist/react/biblio-catalogue.js +498 -0
  145. package/dist/react/biblio-catalogue.js.map +1 -0
  146. package/dist/react/biblio-home.d.ts +47 -0
  147. package/dist/react/biblio-home.js +75 -0
  148. package/dist/react/biblio-home.js.map +1 -0
  149. package/dist/react/biblio-library.d.ts +285 -0
  150. package/dist/react/biblio-library.js +411 -0
  151. package/dist/react/biblio-library.js.map +1 -0
  152. package/dist/react/biblio-nextory.d.ts +100 -0
  153. package/dist/react/biblio-nextory.js +163 -0
  154. package/dist/react/biblio-nextory.js.map +1 -0
  155. package/dist/react/biblio-press.d.ts +121 -0
  156. package/dist/react/biblio-press.js +163 -0
  157. package/dist/react/biblio-press.js.map +1 -0
  158. package/dist/react/biblio-search.d.ts +46 -0
  159. package/dist/react/biblio-search.js +74 -0
  160. package/dist/react/biblio-search.js.map +1 -0
  161. package/dist/react/biblio-telemetry.d.ts +49 -0
  162. package/dist/react/biblio-telemetry.js +85 -0
  163. package/dist/react/biblio-telemetry.js.map +1 -0
  164. package/dist/react/consumption.d.ts +66 -0
  165. package/dist/react/consumption.js +109 -0
  166. package/dist/react/consumption.js.map +1 -0
  167. package/dist/react/cvs-app.d.ts +86 -0
  168. package/dist/react/cvs-app.js +144 -0
  169. package/dist/react/cvs-app.js.map +1 -0
  170. package/dist/react/cvs-documents.d.ts +254 -0
  171. package/dist/react/cvs-documents.js +418 -0
  172. package/dist/react/cvs-documents.js.map +1 -0
  173. package/dist/react/cvs-favorites.d.ts +143 -0
  174. package/dist/react/cvs-favorites.js +206 -0
  175. package/dist/react/cvs-favorites.js.map +1 -0
  176. package/dist/react/cvs-loans.d.ts +140 -0
  177. package/dist/react/cvs-loans.js +234 -0
  178. package/dist/react/cvs-loans.js.map +1 -0
  179. package/dist/react/cvs-streaming.d.ts +87 -0
  180. package/dist/react/cvs-streaming.js +141 -0
  181. package/dist/react/cvs-streaming.js.map +1 -0
  182. package/dist/react/index.d.ts +34 -0
  183. package/dist/react/index.js +34 -0
  184. package/dist/react/partner-catalogue.d.ts +223 -0
  185. package/dist/react/partner-catalogue.js +301 -0
  186. package/dist/react/partner-catalogue.js.map +1 -0
  187. package/dist/react/partner-reader.d.ts +159 -0
  188. package/dist/react/partner-reader.js +226 -0
  189. package/dist/react/partner-reader.js.map +1 -0
  190. package/dist/react/profiles.d.ts +174 -0
  191. package/dist/react/profiles.js +279 -0
  192. package/dist/react/profiles.js.map +1 -0
  193. package/dist/react/tutoring-catalogue.d.ts +115 -0
  194. package/dist/react/tutoring-catalogue.js +151 -0
  195. package/dist/react/tutoring-catalogue.js.map +1 -0
  196. package/dist/react/tutoring-chat.d.ts +96 -0
  197. package/dist/react/tutoring-chat.js +172 -0
  198. package/dist/react/tutoring-chat.js.map +1 -0
  199. package/dist/react/tutoring-dispatch.d.ts +102 -0
  200. package/dist/react/tutoring-dispatch.js +183 -0
  201. package/dist/react/tutoring-dispatch.js.map +1 -0
  202. package/dist/react/tutoring-practitioner.d.ts +129 -0
  203. package/dist/react/tutoring-practitioner.js +230 -0
  204. package/dist/react/tutoring-practitioner.js.map +1 -0
  205. package/dist/react/tutoring-requests.d.ts +233 -0
  206. package/dist/react/tutoring-requests.js +385 -0
  207. package/dist/react/tutoring-requests.js.map +1 -0
  208. package/package.json +70 -0
@@ -0,0 +1,279 @@
1
+ "use client";
2
+ import { r as request } from "../chunks/client.js";
3
+ import { useMutation, useQuery } from "@tanstack/react-query";
4
+ //#region src/react/profiles/profiles.ts
5
+ /**
6
+ * Generated by orval 🍺
7
+ * Do not edit manually.
8
+ * Mozaik backend
9
+ * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
10
+ * OpenAPI spec version: 0.1.0
11
+ */
12
+ const withQueryKey = (query, queryKey) => {
13
+ const result = { queryKey };
14
+ for (const key of Object.keys(query)) {
15
+ if (key === "queryKey") continue;
16
+ Object.defineProperty(result, key, {
17
+ enumerable: true,
18
+ configurable: true,
19
+ get: () => query[key]
20
+ });
21
+ }
22
+ return result;
23
+ };
24
+ const getListProfilesUrl = () => {
25
+ return `/me/profiles`;
26
+ };
27
+ /**
28
+ * Every profile on this account, the holder included (E20).
29
+ *
30
+ * Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.
31
+ * One endpoint replaces two legacy routes that rendered the same collection
32
+ * differently — the difference was presentation, which is the client's problem.
33
+ * @summary List Profiles
34
+ */
35
+ const listProfiles = async (options) => {
36
+ return request(getListProfilesUrl(), {
37
+ ...options,
38
+ method: "GET"
39
+ });
40
+ };
41
+ const getListProfilesQueryKey = () => {
42
+ return [`/me/profiles`];
43
+ };
44
+ const getListProfilesQueryOptions = (options) => {
45
+ const { query: queryOptions, request: requestOptions } = options ?? {};
46
+ const queryKey = queryOptions?.queryKey ?? getListProfilesQueryKey();
47
+ const queryFn = ({ signal }) => listProfiles({
48
+ signal,
49
+ ...requestOptions
50
+ });
51
+ return {
52
+ queryKey,
53
+ queryFn,
54
+ ...queryOptions
55
+ };
56
+ };
57
+ /**
58
+ * @summary List Profiles
59
+ */
60
+ function useListProfiles(options, queryClient) {
61
+ const queryOptions = getListProfilesQueryOptions(options);
62
+ const query = useQuery(queryOptions, queryClient);
63
+ return withQueryKey(query, queryOptions.queryKey);
64
+ }
65
+ const getCreateProfileUrl = () => {
66
+ return `/me/profiles`;
67
+ };
68
+ /**
69
+ * Add a profile to this account (E21).
70
+ *
71
+ * The new row inherits ``tenant_id`` from the holder rather than accepting one:
72
+ * a profile belongs to the same company as the account it hangs off, and
73
+ * letting that be supplied would be a way into another tenant.
74
+ *
75
+ * A profile has no credential of its own. It has no ``login``, no ``email`` and
76
+ * no password — it is reached by switching within an authenticated session, so
77
+ * there is nothing for it to authenticate *with*.
78
+ * @summary Create Profile
79
+ */
80
+ const createProfile = async (profileCreateWrite, options) => {
81
+ const getHeaders = (h) => {
82
+ if (!h) return {};
83
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
84
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
85
+ const headers = {};
86
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
87
+ return headers;
88
+ };
89
+ return request(getCreateProfileUrl(), {
90
+ ...options,
91
+ method: "POST",
92
+ headers: {
93
+ "Content-Type": "application/json",
94
+ ...getHeaders(options?.headers)
95
+ },
96
+ body: JSON.stringify(profileCreateWrite)
97
+ });
98
+ };
99
+ const getCreateProfileMutationKey = () => ["createProfile"];
100
+ const getCreateProfileMutationOptions = (options) => {
101
+ const mutationKey = getCreateProfileMutationKey();
102
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
103
+ ...options,
104
+ mutation: {
105
+ ...options.mutation,
106
+ mutationKey
107
+ }
108
+ } : {
109
+ mutation: { mutationKey },
110
+ request: void 0
111
+ };
112
+ const mutationFn = (props) => {
113
+ const { data } = props ?? {};
114
+ return createProfile(data, requestOptions);
115
+ };
116
+ return {
117
+ mutationFn,
118
+ ...mutationOptions
119
+ };
120
+ };
121
+ /**
122
+ * @summary Create Profile
123
+ */
124
+ const useCreateProfile = (options, queryClient) => {
125
+ return useMutation(getCreateProfileMutationOptions(options), queryClient);
126
+ };
127
+ const getDeleteProfileUrl = (profileId) => {
128
+ return `/me/profiles/${profileId}`;
129
+ };
130
+ /**
131
+ * Remove a profile (E24). Idempotent.
132
+ *
133
+ * Deleting a profile that is already gone is ``204``, not ``404``: the caller
134
+ * asked for it to be absent and it is absent. A retried delete after a timeout
135
+ * must not read as a failure.
136
+ *
137
+ * The account holder cannot be deleted this way — that is E17, which anonymises
138
+ * the whole account and is a different decision with different consequences.
139
+ * @summary Delete Profile
140
+ */
141
+ const deleteProfile = async (profileId, options) => {
142
+ return request(getDeleteProfileUrl(profileId), {
143
+ ...options,
144
+ method: "DELETE"
145
+ });
146
+ };
147
+ const getDeleteProfileMutationKey = () => ["deleteProfile"];
148
+ const getDeleteProfileMutationOptions = (options) => {
149
+ const mutationKey = getDeleteProfileMutationKey();
150
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
151
+ ...options,
152
+ mutation: {
153
+ ...options.mutation,
154
+ mutationKey
155
+ }
156
+ } : {
157
+ mutation: { mutationKey },
158
+ request: void 0
159
+ };
160
+ const mutationFn = (props) => {
161
+ const { profileId } = props ?? {};
162
+ return deleteProfile(profileId, requestOptions);
163
+ };
164
+ return {
165
+ mutationFn,
166
+ ...mutationOptions
167
+ };
168
+ };
169
+ /**
170
+ * @summary Delete Profile
171
+ */
172
+ const useDeleteProfile = (options, queryClient) => {
173
+ return useMutation(getDeleteProfileMutationOptions(options), queryClient);
174
+ };
175
+ const getReadProfileUrl = (profileId) => {
176
+ return `/me/profiles/${profileId}`;
177
+ };
178
+ /**
179
+ * One profile (E22). Returns the resource; the legacy rendered an edit form.
180
+ * @summary Read Profile
181
+ */
182
+ const readProfile = async (profileId, options) => {
183
+ return request(getReadProfileUrl(profileId), {
184
+ ...options,
185
+ method: "GET"
186
+ });
187
+ };
188
+ const getReadProfileQueryKey = (profileId) => {
189
+ return [`/me/profiles/${profileId}`];
190
+ };
191
+ const getReadProfileQueryOptions = (profileId, options) => {
192
+ const { query: queryOptions, request: requestOptions } = options ?? {};
193
+ const queryKey = queryOptions?.queryKey ?? getReadProfileQueryKey(profileId);
194
+ const queryFn = ({ signal }) => readProfile(profileId, {
195
+ signal,
196
+ ...requestOptions
197
+ });
198
+ return {
199
+ queryKey,
200
+ queryFn,
201
+ enabled: profileId !== null && profileId !== void 0,
202
+ ...queryOptions
203
+ };
204
+ };
205
+ /**
206
+ * @summary Read Profile
207
+ */
208
+ function useReadProfile(profileId, options, queryClient) {
209
+ const queryOptions = getReadProfileQueryOptions(profileId, options);
210
+ const query = useQuery(queryOptions, queryClient);
211
+ return withQueryKey(query, queryOptions.queryKey);
212
+ }
213
+ const getUpdateProfileUrl = (profileId) => {
214
+ return `/me/profiles/${profileId}`;
215
+ };
216
+ /**
217
+ * Partially update a profile (E23).
218
+ *
219
+ * The target comes from the path and the row is re-read from the database
220
+ * before anything is written, so nothing in the body can retarget the write.
221
+ * That is the one habit worth keeping from the legacy handler, which overwrote
222
+ * the identity fields from the trusted record for exactly this reason.
223
+ *
224
+ * ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the
225
+ * wrong verb: a field the client did not send is untouched, which is not the
226
+ * same as a field it sent as null.
227
+ * @summary Update Profile
228
+ */
229
+ const updateProfile = async (profileId, profileUpdateWrite, options) => {
230
+ const getHeaders = (h) => {
231
+ if (!h) return {};
232
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
233
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
234
+ const headers = {};
235
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
236
+ return headers;
237
+ };
238
+ return request(getUpdateProfileUrl(profileId), {
239
+ ...options,
240
+ method: "PATCH",
241
+ headers: {
242
+ "Content-Type": "application/json",
243
+ ...getHeaders(options?.headers)
244
+ },
245
+ body: JSON.stringify(profileUpdateWrite)
246
+ });
247
+ };
248
+ const getUpdateProfileMutationKey = () => ["updateProfile"];
249
+ const getUpdateProfileMutationOptions = (options) => {
250
+ const mutationKey = getUpdateProfileMutationKey();
251
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
252
+ ...options,
253
+ mutation: {
254
+ ...options.mutation,
255
+ mutationKey
256
+ }
257
+ } : {
258
+ mutation: { mutationKey },
259
+ request: void 0
260
+ };
261
+ const mutationFn = (props) => {
262
+ const { profileId, data } = props ?? {};
263
+ return updateProfile(profileId, data, requestOptions);
264
+ };
265
+ return {
266
+ mutationFn,
267
+ ...mutationOptions
268
+ };
269
+ };
270
+ /**
271
+ * @summary Update Profile
272
+ */
273
+ const useUpdateProfile = (options, queryClient) => {
274
+ return useMutation(getUpdateProfileMutationOptions(options), queryClient);
275
+ };
276
+ //#endregion
277
+ export { createProfile, deleteProfile, getCreateProfileMutationKey, getCreateProfileMutationOptions, getCreateProfileUrl, getDeleteProfileMutationKey, getDeleteProfileMutationOptions, getDeleteProfileUrl, getListProfilesQueryKey, getListProfilesQueryOptions, getListProfilesUrl, getReadProfileQueryKey, getReadProfileQueryOptions, getReadProfileUrl, getUpdateProfileMutationKey, getUpdateProfileMutationOptions, getUpdateProfileUrl, listProfiles, readProfile, updateProfile, useCreateProfile, useDeleteProfile, useListProfiles, useReadProfile, useUpdateProfile };
278
+
279
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","names":[],"sources":["../../src/react/profiles/profiles.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ProfileCreateWrite,\n ProfileListRead,\n ProfileRead,\n ProfileUpdateWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListProfilesUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Every profile on this account, the holder included (E20).\n *\n * Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.\n * One endpoint replaces two legacy routes that rendered the same collection\n * differently — the difference was presentation, which is the client's problem.\n * @summary List Profiles\n */\nexport const listProfiles = async ( options?: Parameters<typeof request>[1]): Promise<ProfileListRead> => {\n\n return request<ProfileListRead>(getListProfilesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListProfilesQueryKey = () => {\n return [\n `/me/profiles`\n ] as const;\n }\n\n\nexport const getListProfilesQueryOptions = <TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListProfilesQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listProfiles>>> = ({ signal }) => listProfiles({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListProfilesQueryResult = NonNullable<Awaited<ReturnType<typeof listProfiles>>>\nexport type ListProfilesQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listProfiles>>,\n TError,\n Awaited<ReturnType<typeof listProfiles>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listProfiles>>,\n TError,\n Awaited<ReturnType<typeof listProfiles>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Profiles\n */\n\nexport function useListProfiles<TData = Awaited<ReturnType<typeof listProfiles>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listProfiles>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListProfilesQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getCreateProfileUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Add a profile to this account (E21).\n *\n * The new row inherits ``tenant_id`` from the holder rather than accepting one:\n * a profile belongs to the same company as the account it hangs off, and\n * letting that be supplied would be a way into another tenant.\n *\n * A profile has no credential of its own. It has no ``login``, no ``email`` and\n * no password — it is reached by switching within an authenticated session, so\n * there is nothing for it to authenticate *with*.\n * @summary Create Profile\n */\nexport const createProfile = async (profileCreateWrite: ProfileCreateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<ProfileRead>(getCreateProfileUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileCreateWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateProfileMutationKey = () => ['createProfile'] as const;\n\nexport const getCreateProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext> => {\n\nconst mutationKey = getCreateProfileMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createProfile>>, CreateProfileMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createProfile(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateProfileMutationResult = NonNullable<Awaited<ReturnType<typeof createProfile>>>\n export type CreateProfileMutationBody = BodyType<ProfileCreateWrite>\n export type CreateProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateProfileMutationVariables = {data: BodyType<ProfileCreateWrite>}\n\n /**\n * @summary Create Profile\n */\nexport const useCreateProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProfile>>, TError,CreateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createProfile>>,\n TError,\n CreateProfileMutationVariables,\n TContext\n > => {\n return useMutation(getCreateProfileMutationOptions(options), queryClient);\n }\n export const getDeleteProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Remove a profile (E24). Idempotent.\n *\n * Deleting a profile that is already gone is ``204``, not ``404``: the caller\n * asked for it to be absent and it is absent. A retried delete after a timeout\n * must not read as a failure.\n *\n * The account holder cannot be deleted this way — that is E17, which anonymises\n * the whole account and is a different decision with different consequences.\n * @summary Delete Profile\n */\nexport const deleteProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteProfileUrl(profileId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getDeleteProfileMutationKey = () => ['deleteProfile'] as const;\n\nexport const getDeleteProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext> => {\n\nconst mutationKey = getDeleteProfileMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteProfile>>, DeleteProfileMutationVariables> = (props) => {\n const {profileId} = props ?? {};\n\n return deleteProfile(profileId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteProfileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProfile>>>\n\n export type DeleteProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type DeleteProfileMutationVariables = {profileId: number}\n\n /**\n * @summary Delete Profile\n */\nexport const useDeleteProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProfile>>, TError,DeleteProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof deleteProfile>>,\n TError,\n DeleteProfileMutationVariables,\n TContext\n > => {\n return useMutation(getDeleteProfileMutationOptions(options), queryClient);\n }\n export const getReadProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * One profile (E22). Returns the resource; the legacy rendered an edit form.\n * @summary Read Profile\n */\nexport const readProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\n\n return request<ProfileRead>(getReadProfileUrl(profileId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadProfileQueryKey = (profileId: number,) => {\n return [\n `/me/profiles/${profileId}`\n ] as const;\n }\n\n\nexport const getReadProfileQueryOptions = <TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadProfileQueryKey(profileId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readProfile>>> = ({ signal }) => readProfile(profileId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: profileId !== null && profileId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadProfileQueryResult = NonNullable<Awaited<ReturnType<typeof readProfile>>>\nexport type ReadProfileQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readProfile>>,\n TError,\n Awaited<ReturnType<typeof readProfile>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readProfile>>,\n TError,\n Awaited<ReturnType<typeof readProfile>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Profile\n */\n\nexport function useReadProfile<TData = Awaited<ReturnType<typeof readProfile>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n profileId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readProfile>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadProfileQueryOptions(profileId,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getUpdateProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Partially update a profile (E23).\n *\n * The target comes from the path and the row is re-read from the database\n * before anything is written, so nothing in the body can retarget the write.\n * That is the one habit worth keeping from the legacy handler, which overwrote\n * the identity fields from the trusted record for exactly this reason.\n *\n * ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the\n * wrong verb: a field the client did not send is untouched, which is not the\n * same as a field it sent as null.\n * @summary Update Profile\n */\nexport const updateProfile = async (profileId: number,\n profileUpdateWrite: ProfileUpdateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<ProfileRead>(getUpdateProfileUrl(profileId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdateProfileMutationKey = () => ['updateProfile'] as const;\n\nexport const getUpdateProfileMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext> => {\n\nconst mutationKey = getUpdateProfileMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateProfile>>, UpdateProfileMutationVariables> = (props) => {\n const {profileId,data} = props ?? {};\n\n return updateProfile(profileId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdateProfileMutationResult = NonNullable<Awaited<ReturnType<typeof updateProfile>>>\n export type UpdateProfileMutationBody = BodyType<ProfileUpdateWrite>\n export type UpdateProfileMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdateProfileMutationVariables = {profileId: number;data: BodyType<ProfileUpdateWrite>}\n\n /**\n * @summary Update Profile\n */\nexport const useUpdateProfile = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProfile>>, TError,UpdateProfileMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updateProfile>>,\n TError,\n UpdateProfileMutationVariables,\n TContext\n > => {\n return useMutation(getUpdateProfileMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;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W,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAAqB,oBAAoB,SAAS,GACvD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,kBAAkB;CACzC,CACF;AAAE;AAMF,MAAa,oCAAoC,CAAC,eAAe;AAEjE,MAAa,mCACW,YAC6F;CAErH,MAAM,cAAc,4BAA4B;CAChD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAA2G,UAAU;EACvH,MAAM,EAAC,WAAU,SAAQ,SAAS,CAAC;EAEnC,OAAQ,cAAc,WAAU,MAAK,cAAc;CACrD;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,oBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,gCAAgC,OAAO,GAAG,WAAW;AAC1E"}
@@ -0,0 +1,115 @@
1
+
2
+ import { Fn as LevelListRead, Gn as HTTPExceptionResponse, P as SubjectListRead, sr as EducationalGoalListRead, t as ValidationErrorResponse, xn as ListGoalsParams } from "../chunks/index.js";
3
+ import { a as ErrorType, c as request } from "../chunks/client.js";
4
+ import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
5
+ //#region src/react/tutoring-catalogue/tutoring-catalogue.d.ts
6
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
7
+ export declare const getListGoalsUrl: (params?: ListGoalsParams) => string;
8
+ /**
9
+ * Goals on offer, optionally narrowed to one request kind.
10
+ *
11
+ * The filter is a containment test against ``applies_to``, which is what the
12
+ * GIN index on that column is for. The legacy asks the same question with four
13
+ * boolean columns and a different ``WHERE`` per surface.
14
+ * @summary List Goals
15
+ */
16
+ export declare const listGoals: (params?: ListGoalsParams, options?: Parameters<typeof request>[1]) => Promise<EducationalGoalListRead>;
17
+ export declare const getListGoalsQueryKey: (params?: ListGoalsParams) => readonly ["/tutoring/goals", ...ListGoalsParams[]];
18
+ export declare const getListGoalsQueryOptions: <TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: {
19
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>;
20
+ request?: SecondParameter<typeof request>;
21
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData> & {
22
+ queryKey: DataTag<QueryKey, TData, TError>;
23
+ };
24
+ export type ListGoalsQueryResult = NonNullable<Awaited<ReturnType<typeof listGoals>>>;
25
+ export type ListGoalsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
26
+ export declare function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | ListGoalsParams, options: {
27
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listGoals>>, TError, Awaited<ReturnType<typeof listGoals>>>, 'initialData'>;
28
+ request?: SecondParameter<typeof request>;
29
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
30
+ queryKey: DataTag<QueryKey, TData, TError>;
31
+ };
32
+ export declare function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: {
33
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listGoals>>, TError, Awaited<ReturnType<typeof listGoals>>>, 'initialData'>;
34
+ request?: SecondParameter<typeof request>;
35
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
36
+ queryKey: DataTag<QueryKey, TData, TError>;
37
+ };
38
+ export declare function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: {
39
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>;
40
+ request?: SecondParameter<typeof request>;
41
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
42
+ queryKey: DataTag<QueryKey, TData, TError>;
43
+ };
44
+ export declare const getListLevelsUrl: () => string;
45
+ /**
46
+ * Every school level, in teaching order rather than alphabetical.
47
+ * @summary List Levels
48
+ */
49
+ export declare const listLevels: (options?: Parameters<typeof request>[1]) => Promise<LevelListRead>;
50
+ export declare const getListLevelsQueryKey: () => readonly [`/tutoring/levels`];
51
+ export declare const getListLevelsQueryOptions: <TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
52
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>;
53
+ request?: SecondParameter<typeof request>;
54
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData> & {
55
+ queryKey: DataTag<QueryKey, TData, TError>;
56
+ };
57
+ export type ListLevelsQueryResult = NonNullable<Awaited<ReturnType<typeof listLevels>>>;
58
+ export type ListLevelsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
59
+ export declare function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options: {
60
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listLevels>>, TError, Awaited<ReturnType<typeof listLevels>>>, 'initialData'>;
61
+ request?: SecondParameter<typeof request>;
62
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
63
+ queryKey: DataTag<QueryKey, TData, TError>;
64
+ };
65
+ export declare function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
66
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listLevels>>, TError, Awaited<ReturnType<typeof listLevels>>>, 'initialData'>;
67
+ request?: SecondParameter<typeof request>;
68
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
69
+ queryKey: DataTag<QueryKey, TData, TError>;
70
+ };
71
+ export declare function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
72
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>;
73
+ request?: SecondParameter<typeof request>;
74
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
75
+ queryKey: DataTag<QueryKey, TData, TError>;
76
+ };
77
+ export declare const getListSubjectsUrl: () => string;
78
+ /**
79
+ * Every subject a pupil may ask about, in display order.
80
+ *
81
+ * Authenticated, though the data is not secret: the list differs by nothing
82
+ * today, and leaving it open would make it the one tutoring endpoint that does
83
+ * not establish a tenant. Cheap to relax later, expensive to tighten.
84
+ * @summary List Subjects
85
+ */
86
+ export declare const listSubjects: (options?: Parameters<typeof request>[1]) => Promise<SubjectListRead>;
87
+ export declare const getListSubjectsQueryKey: () => readonly [`/tutoring/subjects`];
88
+ export declare const getListSubjectsQueryOptions: <TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
89
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>;
90
+ request?: SecondParameter<typeof request>;
91
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData> & {
92
+ queryKey: DataTag<QueryKey, TData, TError>;
93
+ };
94
+ export type ListSubjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listSubjects>>>;
95
+ export type ListSubjectsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
96
+ export declare function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options: {
97
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listSubjects>>, TError, Awaited<ReturnType<typeof listSubjects>>>, 'initialData'>;
98
+ request?: SecondParameter<typeof request>;
99
+ }, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
100
+ queryKey: DataTag<QueryKey, TData, TError>;
101
+ };
102
+ export declare function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
103
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listSubjects>>, TError, Awaited<ReturnType<typeof listSubjects>>>, 'initialData'>;
104
+ request?: SecondParameter<typeof request>;
105
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
106
+ queryKey: DataTag<QueryKey, TData, TError>;
107
+ };
108
+ export declare function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(options?: {
109
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>;
110
+ request?: SecondParameter<typeof request>;
111
+ }, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
112
+ queryKey: DataTag<QueryKey, TData, TError>;
113
+ };
114
+ //#endregion
115
+ //# sourceMappingURL=tutoring-catalogue.d.ts.map
@@ -0,0 +1,151 @@
1
+ "use client";
2
+ import { r as request } from "../chunks/client.js";
3
+ import { useQuery } from "@tanstack/react-query";
4
+ //#region src/react/tutoring-catalogue/tutoring-catalogue.ts
5
+ /**
6
+ * Generated by orval 🍺
7
+ * Do not edit manually.
8
+ * Mozaik backend
9
+ * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
10
+ * OpenAPI spec version: 0.1.0
11
+ */
12
+ const withQueryKey = (query, queryKey) => {
13
+ const result = { queryKey };
14
+ for (const key of Object.keys(query)) {
15
+ if (key === "queryKey") continue;
16
+ Object.defineProperty(result, key, {
17
+ enumerable: true,
18
+ configurable: true,
19
+ get: () => query[key]
20
+ });
21
+ }
22
+ return result;
23
+ };
24
+ const getListGoalsUrl = (params) => {
25
+ const normalizedParams = new URLSearchParams();
26
+ Object.entries(params || {}).forEach(([key, value]) => {
27
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
28
+ });
29
+ const stringifiedParams = normalizedParams.toString();
30
+ return stringifiedParams.length > 0 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`;
31
+ };
32
+ /**
33
+ * Goals on offer, optionally narrowed to one request kind.
34
+ *
35
+ * The filter is a containment test against ``applies_to``, which is what the
36
+ * GIN index on that column is for. The legacy asks the same question with four
37
+ * boolean columns and a different ``WHERE`` per surface.
38
+ * @summary List Goals
39
+ */
40
+ const listGoals = async (params, options) => {
41
+ return request(getListGoalsUrl(params), {
42
+ ...options,
43
+ method: "GET"
44
+ });
45
+ };
46
+ const getListGoalsQueryKey = (params) => {
47
+ return [`/tutoring/goals`, ...params ? [params] : []];
48
+ };
49
+ const getListGoalsQueryOptions = (params, options) => {
50
+ const { query: queryOptions, request: requestOptions } = options ?? {};
51
+ const queryKey = queryOptions?.queryKey ?? getListGoalsQueryKey(params);
52
+ const queryFn = ({ signal }) => listGoals(params, {
53
+ signal,
54
+ ...requestOptions
55
+ });
56
+ return {
57
+ queryKey,
58
+ queryFn,
59
+ ...queryOptions
60
+ };
61
+ };
62
+ /**
63
+ * @summary List Goals
64
+ */
65
+ function useListGoals(params, options, queryClient) {
66
+ const queryOptions = getListGoalsQueryOptions(params, options);
67
+ const query = useQuery(queryOptions, queryClient);
68
+ return withQueryKey(query, queryOptions.queryKey);
69
+ }
70
+ const getListLevelsUrl = () => {
71
+ return `/tutoring/levels`;
72
+ };
73
+ /**
74
+ * Every school level, in teaching order rather than alphabetical.
75
+ * @summary List Levels
76
+ */
77
+ const listLevels = async (options) => {
78
+ return request(getListLevelsUrl(), {
79
+ ...options,
80
+ method: "GET"
81
+ });
82
+ };
83
+ const getListLevelsQueryKey = () => {
84
+ return [`/tutoring/levels`];
85
+ };
86
+ const getListLevelsQueryOptions = (options) => {
87
+ const { query: queryOptions, request: requestOptions } = options ?? {};
88
+ const queryKey = queryOptions?.queryKey ?? getListLevelsQueryKey();
89
+ const queryFn = ({ signal }) => listLevels({
90
+ signal,
91
+ ...requestOptions
92
+ });
93
+ return {
94
+ queryKey,
95
+ queryFn,
96
+ ...queryOptions
97
+ };
98
+ };
99
+ /**
100
+ * @summary List Levels
101
+ */
102
+ function useListLevels(options, queryClient) {
103
+ const queryOptions = getListLevelsQueryOptions(options);
104
+ const query = useQuery(queryOptions, queryClient);
105
+ return withQueryKey(query, queryOptions.queryKey);
106
+ }
107
+ const getListSubjectsUrl = () => {
108
+ return `/tutoring/subjects`;
109
+ };
110
+ /**
111
+ * Every subject a pupil may ask about, in display order.
112
+ *
113
+ * Authenticated, though the data is not secret: the list differs by nothing
114
+ * today, and leaving it open would make it the one tutoring endpoint that does
115
+ * not establish a tenant. Cheap to relax later, expensive to tighten.
116
+ * @summary List Subjects
117
+ */
118
+ const listSubjects = async (options) => {
119
+ return request(getListSubjectsUrl(), {
120
+ ...options,
121
+ method: "GET"
122
+ });
123
+ };
124
+ const getListSubjectsQueryKey = () => {
125
+ return [`/tutoring/subjects`];
126
+ };
127
+ const getListSubjectsQueryOptions = (options) => {
128
+ const { query: queryOptions, request: requestOptions } = options ?? {};
129
+ const queryKey = queryOptions?.queryKey ?? getListSubjectsQueryKey();
130
+ const queryFn = ({ signal }) => listSubjects({
131
+ signal,
132
+ ...requestOptions
133
+ });
134
+ return {
135
+ queryKey,
136
+ queryFn,
137
+ ...queryOptions
138
+ };
139
+ };
140
+ /**
141
+ * @summary List Subjects
142
+ */
143
+ function useListSubjects(options, queryClient) {
144
+ const queryOptions = getListSubjectsQueryOptions(options);
145
+ const query = useQuery(queryOptions, queryClient);
146
+ return withQueryKey(query, queryOptions.queryKey);
147
+ }
148
+ //#endregion
149
+ export { getListGoalsQueryKey, getListGoalsQueryOptions, getListGoalsUrl, getListLevelsQueryKey, getListLevelsQueryOptions, getListLevelsUrl, getListSubjectsQueryKey, getListSubjectsQueryOptions, getListSubjectsUrl, listGoals, listLevels, listSubjects, useListGoals, useListLevels, useListSubjects };
150
+
151
+ //# sourceMappingURL=tutoring-catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tutoring-catalogue.js","names":[],"sources":["../../src/react/tutoring-catalogue/tutoring-catalogue.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n EducationalGoalListRead,\n HTTPExceptionResponse,\n LevelListRead,\n ListGoalsParams,\n SubjectListRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListGoalsUrl = (params?: ListGoalsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`\n}\n\n/**\n * Goals on offer, optionally narrowed to one request kind.\n *\n * The filter is a containment test against ``applies_to``, which is what the\n * GIN index on that column is for. The legacy asks the same question with four\n * boolean columns and a different ``WHERE`` per surface.\n * @summary List Goals\n */\nexport const listGoals = async (params?: ListGoalsParams, options?: Parameters<typeof request>[1]): Promise<EducationalGoalListRead> => {\n\n return request<EducationalGoalListRead>(getListGoalsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListGoalsQueryKey = (params?: ListGoalsParams,) => {\n return [\n `/tutoring/goals`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListGoalsQueryOptions = <TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListGoalsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listGoals>>> = ({ signal }) => listGoals(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListGoalsQueryResult = NonNullable<Awaited<ReturnType<typeof listGoals>>>\nexport type ListGoalsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListGoalsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listGoals>>,\n TError,\n Awaited<ReturnType<typeof listGoals>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Goals\n */\n\nexport function useListGoals<TData = Awaited<ReturnType<typeof listGoals>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListGoalsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listGoals>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListGoalsQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getListLevelsUrl = () => {\n\n\n\n\n return `/tutoring/levels`\n}\n\n/**\n * Every school level, in teaching order rather than alphabetical.\n * @summary List Levels\n */\nexport const listLevels = async ( options?: Parameters<typeof request>[1]): Promise<LevelListRead> => {\n\n return request<LevelListRead>(getListLevelsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListLevelsQueryKey = () => {\n return [\n `/tutoring/levels`\n ] as const;\n }\n\n\nexport const getListLevelsQueryOptions = <TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListLevelsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listLevels>>> = ({ signal }) => listLevels({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListLevelsQueryResult = NonNullable<Awaited<ReturnType<typeof listLevels>>>\nexport type ListLevelsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listLevels>>,\n TError,\n Awaited<ReturnType<typeof listLevels>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Levels\n */\n\nexport function useListLevels<TData = Awaited<ReturnType<typeof listLevels>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLevels>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListLevelsQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getListSubjectsUrl = () => {\n\n\n\n\n return `/tutoring/subjects`\n}\n\n/**\n * Every subject a pupil may ask about, in display order.\n *\n * Authenticated, though the data is not secret: the list differs by nothing\n * today, and leaving it open would make it the one tutoring endpoint that does\n * not establish a tenant. Cheap to relax later, expensive to tighten.\n * @summary List Subjects\n */\nexport const listSubjects = async ( options?: Parameters<typeof request>[1]): Promise<SubjectListRead> => {\n\n return request<SubjectListRead>(getListSubjectsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListSubjectsQueryKey = () => {\n return [\n `/tutoring/subjects`\n ] as const;\n }\n\n\nexport const getListSubjectsQueryOptions = <TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListSubjectsQueryKey();\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listSubjects>>> = ({ signal }) => listSubjects({ signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListSubjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listSubjects>>>\nexport type ListSubjectsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listSubjects>>,\n TError,\n Awaited<ReturnType<typeof listSubjects>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Subjects\n */\n\nexport function useListSubjects<TData = Awaited<ReturnType<typeof listSubjects>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listSubjects>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListSubjectsQueryOptions(options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, T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