@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,954 @@
1
+ "use client";
2
+ import { r as request } from "../chunks/client.js";
3
+ import { useMutation, useQuery } from "@tanstack/react-query";
4
+ //#region src/react/admin-tutoring/admin-tutoring.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 getListExpiringDocumentsUrl = (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 ? `/admin/tutoring/documents/expiring?${stringifiedParams}` : `/admin/tutoring/documents/expiring`;
31
+ };
32
+ /**
33
+ * Whose attestation lapses soon, as a query rather than a filing cabinet.
34
+ *
35
+ * An URSSAF *attestation de vigilance* is valid for six months and a lapsed one
36
+ * is a compliance problem. The legacy stores it as a ``text`` column with one
37
+ * ``ursaff_date`` beside it, so this question has no answer there at all.
38
+ * @summary List Expiring Documents
39
+ */
40
+ const listExpiringDocuments = async (params, options) => {
41
+ return request(getListExpiringDocumentsUrl(params), {
42
+ ...options,
43
+ method: "GET"
44
+ });
45
+ };
46
+ const getListExpiringDocumentsQueryKey = (params) => {
47
+ return [`/admin/tutoring/documents/expiring`, ...params ? [params] : []];
48
+ };
49
+ const getListExpiringDocumentsQueryOptions = (params, options) => {
50
+ const { query: queryOptions, request: requestOptions } = options ?? {};
51
+ const queryKey = queryOptions?.queryKey ?? getListExpiringDocumentsQueryKey(params);
52
+ const queryFn = ({ signal }) => listExpiringDocuments(params, {
53
+ signal,
54
+ ...requestOptions
55
+ });
56
+ return {
57
+ queryKey,
58
+ queryFn,
59
+ ...queryOptions
60
+ };
61
+ };
62
+ /**
63
+ * @summary List Expiring Documents
64
+ */
65
+ function useListExpiringDocuments(params, options, queryClient) {
66
+ const queryOptions = getListExpiringDocumentsQueryOptions(params, options);
67
+ const query = useQuery(queryOptions, queryClient);
68
+ return withQueryKey(query, queryOptions.queryKey);
69
+ }
70
+ const getListFeedbackUrl = (params) => {
71
+ const normalizedParams = new URLSearchParams();
72
+ Object.entries(params || {}).forEach(([key, value]) => {
73
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
74
+ });
75
+ const stringifiedParams = normalizedParams.toString();
76
+ return stringifiedParams.length > 0 ? `/admin/tutoring/feedback?${stringifiedParams}` : `/admin/tutoring/feedback`;
77
+ };
78
+ /**
79
+ * Ratings, newest first. ``?publishable=false`` is the moderation queue.
80
+ *
81
+ * Tenant-scoped through the request it belongs to: a rating is a child's free
82
+ * text, so it is reachable only by an operator who reaches the tenant.
83
+ * @summary List Feedback
84
+ */
85
+ const listFeedback = async (params, options) => {
86
+ return request(getListFeedbackUrl(params), {
87
+ ...options,
88
+ method: "GET"
89
+ });
90
+ };
91
+ const getListFeedbackQueryKey = (params) => {
92
+ return [`/admin/tutoring/feedback`, ...params ? [params] : []];
93
+ };
94
+ const getListFeedbackQueryOptions = (params, options) => {
95
+ const { query: queryOptions, request: requestOptions } = options ?? {};
96
+ const queryKey = queryOptions?.queryKey ?? getListFeedbackQueryKey(params);
97
+ const queryFn = ({ signal }) => listFeedback(params, {
98
+ signal,
99
+ ...requestOptions
100
+ });
101
+ return {
102
+ queryKey,
103
+ queryFn,
104
+ ...queryOptions
105
+ };
106
+ };
107
+ /**
108
+ * @summary List Feedback
109
+ */
110
+ function useListFeedback(params, options, queryClient) {
111
+ const queryOptions = getListFeedbackQueryOptions(params, options);
112
+ const query = useQuery(queryOptions, queryClient);
113
+ return withQueryKey(query, queryOptions.queryKey);
114
+ }
115
+ const getModerateFeedbackUrl = (feedbackId) => {
116
+ return `/admin/tutoring/feedback/${feedbackId}/moderation`;
117
+ };
118
+ /**
119
+ * Clear a rating for the public showcase, or withhold it.
120
+ *
121
+ * ``PUT`` on a sub-resource rather than ``PATCH`` on the rating, mirroring
122
+ * ``/admin/reviews/{id}/moderation``: the decision is the resource, and it is
123
+ * idempotent.
124
+ * @summary Moderate Feedback
125
+ */
126
+ const moderateFeedback = async (feedbackId, tutoringFeedbackModerationWrite, options) => {
127
+ const getHeaders = (h) => {
128
+ if (!h) return {};
129
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
130
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
131
+ const headers = {};
132
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
133
+ return headers;
134
+ };
135
+ return request(getModerateFeedbackUrl(feedbackId), {
136
+ ...options,
137
+ method: "PUT",
138
+ headers: {
139
+ "Content-Type": "application/json",
140
+ ...getHeaders(options?.headers)
141
+ },
142
+ body: JSON.stringify(tutoringFeedbackModerationWrite)
143
+ });
144
+ };
145
+ const getModerateFeedbackMutationKey = () => ["moderateFeedback"];
146
+ const getModerateFeedbackMutationOptions = (options) => {
147
+ const mutationKey = getModerateFeedbackMutationKey();
148
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
149
+ ...options,
150
+ mutation: {
151
+ ...options.mutation,
152
+ mutationKey
153
+ }
154
+ } : {
155
+ mutation: { mutationKey },
156
+ request: void 0
157
+ };
158
+ const mutationFn = (props) => {
159
+ const { feedbackId, data } = props ?? {};
160
+ return moderateFeedback(feedbackId, data, requestOptions);
161
+ };
162
+ return {
163
+ mutationFn,
164
+ ...mutationOptions
165
+ };
166
+ };
167
+ /**
168
+ * @summary Moderate Feedback
169
+ */
170
+ const useModerateFeedback = (options, queryClient) => {
171
+ return useMutation(getModerateFeedbackMutationOptions(options), queryClient);
172
+ };
173
+ const getCreateGoalUrl = () => {
174
+ return `/admin/tutoring/goals`;
175
+ };
176
+ /**
177
+ * @summary Create Goal
178
+ */
179
+ const createGoal = async (educationalGoalWrite, options) => {
180
+ const getHeaders = (h) => {
181
+ if (!h) return {};
182
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
183
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
184
+ const headers = {};
185
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
186
+ return headers;
187
+ };
188
+ return request(getCreateGoalUrl(), {
189
+ ...options,
190
+ method: "POST",
191
+ headers: {
192
+ "Content-Type": "application/json",
193
+ ...getHeaders(options?.headers)
194
+ },
195
+ body: JSON.stringify(educationalGoalWrite)
196
+ });
197
+ };
198
+ const getCreateGoalMutationKey = () => ["createGoal"];
199
+ const getCreateGoalMutationOptions = (options) => {
200
+ const mutationKey = getCreateGoalMutationKey();
201
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
202
+ ...options,
203
+ mutation: {
204
+ ...options.mutation,
205
+ mutationKey
206
+ }
207
+ } : {
208
+ mutation: { mutationKey },
209
+ request: void 0
210
+ };
211
+ const mutationFn = (props) => {
212
+ const { data } = props ?? {};
213
+ return createGoal(data, requestOptions);
214
+ };
215
+ return {
216
+ mutationFn,
217
+ ...mutationOptions
218
+ };
219
+ };
220
+ /**
221
+ * @summary Create Goal
222
+ */
223
+ const useCreateGoal = (options, queryClient) => {
224
+ return useMutation(getCreateGoalMutationOptions(options), queryClient);
225
+ };
226
+ const getAmendGoalUrl = (goalId) => {
227
+ return `/admin/tutoring/goals/${goalId}`;
228
+ };
229
+ /**
230
+ * @summary Amend Goal
231
+ */
232
+ const amendGoal = async (goalId, educationalGoalWrite, options) => {
233
+ const getHeaders = (h) => {
234
+ if (!h) return {};
235
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
236
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
237
+ const headers = {};
238
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
239
+ return headers;
240
+ };
241
+ return request(getAmendGoalUrl(goalId), {
242
+ ...options,
243
+ method: "PATCH",
244
+ headers: {
245
+ "Content-Type": "application/json",
246
+ ...getHeaders(options?.headers)
247
+ },
248
+ body: JSON.stringify(educationalGoalWrite)
249
+ });
250
+ };
251
+ const getAmendGoalMutationKey = () => ["amendGoal"];
252
+ const getAmendGoalMutationOptions = (options) => {
253
+ const mutationKey = getAmendGoalMutationKey();
254
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
255
+ ...options,
256
+ mutation: {
257
+ ...options.mutation,
258
+ mutationKey
259
+ }
260
+ } : {
261
+ mutation: { mutationKey },
262
+ request: void 0
263
+ };
264
+ const mutationFn = (props) => {
265
+ const { goalId, data } = props ?? {};
266
+ return amendGoal(goalId, data, requestOptions);
267
+ };
268
+ return {
269
+ mutationFn,
270
+ ...mutationOptions
271
+ };
272
+ };
273
+ /**
274
+ * @summary Amend Goal
275
+ */
276
+ const useAmendGoal = (options, queryClient) => {
277
+ return useMutation(getAmendGoalMutationOptions(options), queryClient);
278
+ };
279
+ const getCreateLevelUrl = () => {
280
+ return `/admin/tutoring/levels`;
281
+ };
282
+ /**
283
+ * @summary Create Level
284
+ */
285
+ const createLevel = async (levelWrite, options) => {
286
+ const getHeaders = (h) => {
287
+ if (!h) return {};
288
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
289
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
290
+ const headers = {};
291
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
292
+ return headers;
293
+ };
294
+ return request(getCreateLevelUrl(), {
295
+ ...options,
296
+ method: "POST",
297
+ headers: {
298
+ "Content-Type": "application/json",
299
+ ...getHeaders(options?.headers)
300
+ },
301
+ body: JSON.stringify(levelWrite)
302
+ });
303
+ };
304
+ const getCreateLevelMutationKey = () => ["createLevel"];
305
+ const getCreateLevelMutationOptions = (options) => {
306
+ const mutationKey = getCreateLevelMutationKey();
307
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
308
+ ...options,
309
+ mutation: {
310
+ ...options.mutation,
311
+ mutationKey
312
+ }
313
+ } : {
314
+ mutation: { mutationKey },
315
+ request: void 0
316
+ };
317
+ const mutationFn = (props) => {
318
+ const { data } = props ?? {};
319
+ return createLevel(data, requestOptions);
320
+ };
321
+ return {
322
+ mutationFn,
323
+ ...mutationOptions
324
+ };
325
+ };
326
+ /**
327
+ * @summary Create Level
328
+ */
329
+ const useCreateLevel = (options, queryClient) => {
330
+ return useMutation(getCreateLevelMutationOptions(options), queryClient);
331
+ };
332
+ const getAmendLevelUrl = (levelId) => {
333
+ return `/admin/tutoring/levels/${levelId}`;
334
+ };
335
+ /**
336
+ * @summary Amend Level
337
+ */
338
+ const amendLevel = async (levelId, levelWrite, options) => {
339
+ const getHeaders = (h) => {
340
+ if (!h) return {};
341
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
342
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
343
+ const headers = {};
344
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
345
+ return headers;
346
+ };
347
+ return request(getAmendLevelUrl(levelId), {
348
+ ...options,
349
+ method: "PATCH",
350
+ headers: {
351
+ "Content-Type": "application/json",
352
+ ...getHeaders(options?.headers)
353
+ },
354
+ body: JSON.stringify(levelWrite)
355
+ });
356
+ };
357
+ const getAmendLevelMutationKey = () => ["amendLevel"];
358
+ const getAmendLevelMutationOptions = (options) => {
359
+ const mutationKey = getAmendLevelMutationKey();
360
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
361
+ ...options,
362
+ mutation: {
363
+ ...options.mutation,
364
+ mutationKey
365
+ }
366
+ } : {
367
+ mutation: { mutationKey },
368
+ request: void 0
369
+ };
370
+ const mutationFn = (props) => {
371
+ const { levelId, data } = props ?? {};
372
+ return amendLevel(levelId, data, requestOptions);
373
+ };
374
+ return {
375
+ mutationFn,
376
+ ...mutationOptions
377
+ };
378
+ };
379
+ /**
380
+ * @summary Amend Level
381
+ */
382
+ const useAmendLevel = (options, queryClient) => {
383
+ return useMutation(getAmendLevelMutationOptions(options), queryClient);
384
+ };
385
+ const getListPractitionersUrl = (params) => {
386
+ const normalizedParams = new URLSearchParams();
387
+ Object.entries(params || {}).forEach(([key, value]) => {
388
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
389
+ });
390
+ const stringifiedParams = normalizedParams.toString();
391
+ return stringifiedParams.length > 0 ? `/admin/tutoring/practitioners?${stringifiedParams}` : `/admin/tutoring/practitioners`;
392
+ };
393
+ /**
394
+ * Who can take work, filtered the way the question is actually asked.
395
+ *
396
+ * ``role``, ``capability``, ``subjectId`` and ``levelId`` together answer "who
397
+ * can take *this* request", which is the only thing anybody wants from this
398
+ * list. The legacy answers it with a different screen per role — nine of them,
399
+ * plus two more for pelite.
400
+ * @summary List Practitioners
401
+ */
402
+ const listPractitioners = async (params, options) => {
403
+ return request(getListPractitionersUrl(params), {
404
+ ...options,
405
+ method: "GET"
406
+ });
407
+ };
408
+ const getListPractitionersQueryKey = (params) => {
409
+ return [`/admin/tutoring/practitioners`, ...params ? [params] : []];
410
+ };
411
+ const getListPractitionersQueryOptions = (params, options) => {
412
+ const { query: queryOptions, request: requestOptions } = options ?? {};
413
+ const queryKey = queryOptions?.queryKey ?? getListPractitionersQueryKey(params);
414
+ const queryFn = ({ signal }) => listPractitioners(params, {
415
+ signal,
416
+ ...requestOptions
417
+ });
418
+ return {
419
+ queryKey,
420
+ queryFn,
421
+ ...queryOptions
422
+ };
423
+ };
424
+ /**
425
+ * @summary List Practitioners
426
+ */
427
+ function useListPractitioners(params, options, queryClient) {
428
+ const queryOptions = getListPractitionersQueryOptions(params, options);
429
+ const query = useQuery(queryOptions, queryClient);
430
+ return withQueryKey(query, queryOptions.queryKey);
431
+ }
432
+ const getAmendPractitionerUrl = (userId) => {
433
+ return `/admin/tutoring/practitioners/${userId}`;
434
+ };
435
+ /**
436
+ * Availability, capabilities and competencies in one call.
437
+ *
438
+ * Competencies are replaced wholesale rather than diffed: the screen shows a
439
+ * checklist and submits it. Absent means unchanged; an empty list means none,
440
+ * which is a real instruction and has to be distinguishable from absence —
441
+ * hence ``exclude_unset``.
442
+ * @summary Amend Practitioner
443
+ */
444
+ const amendPractitioner = async (userId, practitionerWrite, options) => {
445
+ const getHeaders = (h) => {
446
+ if (!h) return {};
447
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
448
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
449
+ const headers = {};
450
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
451
+ return headers;
452
+ };
453
+ return request(getAmendPractitionerUrl(userId), {
454
+ ...options,
455
+ method: "PATCH",
456
+ headers: {
457
+ "Content-Type": "application/json",
458
+ ...getHeaders(options?.headers)
459
+ },
460
+ body: JSON.stringify(practitionerWrite)
461
+ });
462
+ };
463
+ const getAmendPractitionerMutationKey = () => ["amendPractitioner"];
464
+ const getAmendPractitionerMutationOptions = (options) => {
465
+ const mutationKey = getAmendPractitionerMutationKey();
466
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
467
+ ...options,
468
+ mutation: {
469
+ ...options.mutation,
470
+ mutationKey
471
+ }
472
+ } : {
473
+ mutation: { mutationKey },
474
+ request: void 0
475
+ };
476
+ const mutationFn = (props) => {
477
+ const { userId, data } = props ?? {};
478
+ return amendPractitioner(userId, data, requestOptions);
479
+ };
480
+ return {
481
+ mutationFn,
482
+ ...mutationOptions
483
+ };
484
+ };
485
+ /**
486
+ * @summary Amend Practitioner
487
+ */
488
+ const useAmendPractitioner = (options, queryClient) => {
489
+ return useMutation(getAmendPractitionerMutationOptions(options), queryClient);
490
+ };
491
+ const getListPractitionerDocumentsUrl = (userId) => {
492
+ return `/admin/tutoring/practitioners/${userId}/documents`;
493
+ };
494
+ /**
495
+ * One practitioner's compliance paperwork. Metadata only, never the file.
496
+ * @summary List Practitioner Documents
497
+ */
498
+ const listPractitionerDocuments = async (userId, options) => {
499
+ return request(getListPractitionerDocumentsUrl(userId), {
500
+ ...options,
501
+ method: "GET"
502
+ });
503
+ };
504
+ const getListPractitionerDocumentsQueryKey = (userId) => {
505
+ return [`/admin/tutoring/practitioners/${userId}/documents`];
506
+ };
507
+ const getListPractitionerDocumentsQueryOptions = (userId, options) => {
508
+ const { query: queryOptions, request: requestOptions } = options ?? {};
509
+ const queryKey = queryOptions?.queryKey ?? getListPractitionerDocumentsQueryKey(userId);
510
+ const queryFn = ({ signal }) => listPractitionerDocuments(userId, {
511
+ signal,
512
+ ...requestOptions
513
+ });
514
+ return {
515
+ queryKey,
516
+ queryFn,
517
+ enabled: userId !== null && userId !== void 0,
518
+ ...queryOptions
519
+ };
520
+ };
521
+ /**
522
+ * @summary List Practitioner Documents
523
+ */
524
+ function useListPractitionerDocuments(userId, options, queryClient) {
525
+ const queryOptions = getListPractitionerDocumentsQueryOptions(userId, options);
526
+ const query = useQuery(queryOptions, queryClient);
527
+ return withQueryKey(query, queryOptions.queryKey);
528
+ }
529
+ const getListAllRequestsUrl = (params) => {
530
+ const normalizedParams = new URLSearchParams();
531
+ Object.entries(params || {}).forEach(([key, value]) => {
532
+ if (Array.isArray(value) && ["status"].includes(key)) {
533
+ value.forEach((v) => {
534
+ normalizedParams.append(key, v === null ? "null" : String(v));
535
+ });
536
+ return;
537
+ }
538
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
539
+ });
540
+ const stringifiedParams = normalizedParams.toString();
541
+ return stringifiedParams.length > 0 ? `/admin/tutoring/requests?${stringifiedParams}` : `/admin/tutoring/requests`;
542
+ };
543
+ /**
544
+ * Every request in the tenants this operator reaches.
545
+ *
546
+ * Returns the queue shape rather than the staff shape on purpose: this is the
547
+ * list screen, and a list of five hundred requests should not carry five hundred
548
+ * statements. The staff detail shape is on the single-request route.
549
+ * @summary List All Requests
550
+ */
551
+ const listAllRequests = async (params, options) => {
552
+ return request(getListAllRequestsUrl(params), {
553
+ ...options,
554
+ method: "GET"
555
+ });
556
+ };
557
+ const getListAllRequestsQueryKey = (params) => {
558
+ return [`/admin/tutoring/requests`, ...params ? [params] : []];
559
+ };
560
+ const getListAllRequestsQueryOptions = (params, options) => {
561
+ const { query: queryOptions, request: requestOptions } = options ?? {};
562
+ const queryKey = queryOptions?.queryKey ?? getListAllRequestsQueryKey(params);
563
+ const queryFn = ({ signal }) => listAllRequests(params, {
564
+ signal,
565
+ ...requestOptions
566
+ });
567
+ return {
568
+ queryKey,
569
+ queryFn,
570
+ ...queryOptions
571
+ };
572
+ };
573
+ /**
574
+ * @summary List All Requests
575
+ */
576
+ function useListAllRequests(params, options, queryClient) {
577
+ const queryOptions = getListAllRequestsQueryOptions(params, options);
578
+ const query = useQuery(queryOptions, queryClient);
579
+ return withQueryKey(query, queryOptions.queryKey);
580
+ }
581
+ const getReadRequestUrl = (requestId) => {
582
+ return `/admin/tutoring/requests/${requestId}`;
583
+ };
584
+ /**
585
+ * One request in full, including provenance and the staff note.
586
+ * @summary Read Request
587
+ */
588
+ const readRequest = async (requestId, options) => {
589
+ return request(getReadRequestUrl(requestId), {
590
+ ...options,
591
+ method: "GET"
592
+ });
593
+ };
594
+ const getReadRequestQueryKey = (requestId) => {
595
+ return [`/admin/tutoring/requests/${requestId}`];
596
+ };
597
+ const getReadRequestQueryOptions = (requestId, options) => {
598
+ const { query: queryOptions, request: requestOptions } = options ?? {};
599
+ const queryKey = queryOptions?.queryKey ?? getReadRequestQueryKey(requestId);
600
+ const queryFn = ({ signal }) => readRequest(requestId, {
601
+ signal,
602
+ ...requestOptions
603
+ });
604
+ return {
605
+ queryKey,
606
+ queryFn,
607
+ enabled: requestId !== null && requestId !== void 0,
608
+ ...queryOptions
609
+ };
610
+ };
611
+ /**
612
+ * @summary Read Request
613
+ */
614
+ function useReadRequest(requestId, options, queryClient) {
615
+ const queryOptions = getReadRequestQueryOptions(requestId, options);
616
+ const query = useQuery(queryOptions, queryClient);
617
+ return withQueryKey(query, queryOptions.queryKey);
618
+ }
619
+ const getAmendRequestUrl = (requestId) => {
620
+ return `/admin/tutoring/requests/${requestId}`;
621
+ };
622
+ /**
623
+ * Reassign a stalled request, and say why, in one call.
624
+ *
625
+ * Partial: only fields present in the body are applied, so a client that knows
626
+ * about one of them cannot blank the rest. Reassignment does **not** move the
627
+ * status — a request routed to somebody else is still dispatched, and pretending
628
+ * otherwise would corrupt the timestamp ladder every report reads.
629
+ * @summary Amend Request
630
+ */
631
+ const amendRequest = async (requestId, tutoringRequestAdminWrite, options) => {
632
+ const getHeaders = (h) => {
633
+ if (!h) return {};
634
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
635
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
636
+ const headers = {};
637
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
638
+ return headers;
639
+ };
640
+ return request(getAmendRequestUrl(requestId), {
641
+ ...options,
642
+ method: "PATCH",
643
+ headers: {
644
+ "Content-Type": "application/json",
645
+ ...getHeaders(options?.headers)
646
+ },
647
+ body: JSON.stringify(tutoringRequestAdminWrite)
648
+ });
649
+ };
650
+ const getAmendRequestMutationKey = () => ["amendRequest"];
651
+ const getAmendRequestMutationOptions = (options) => {
652
+ const mutationKey = getAmendRequestMutationKey();
653
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
654
+ ...options,
655
+ mutation: {
656
+ ...options.mutation,
657
+ mutationKey
658
+ }
659
+ } : {
660
+ mutation: { mutationKey },
661
+ request: void 0
662
+ };
663
+ const mutationFn = (props) => {
664
+ const { requestId, data } = props ?? {};
665
+ return amendRequest(requestId, data, requestOptions);
666
+ };
667
+ return {
668
+ mutationFn,
669
+ ...mutationOptions
670
+ };
671
+ };
672
+ /**
673
+ * @summary Amend Request
674
+ */
675
+ const useAmendRequest = (options, queryClient) => {
676
+ return useMutation(getAmendRequestMutationOptions(options), queryClient);
677
+ };
678
+ const getAdminCloseRequestUrl = (requestId) => {
679
+ return `/admin/tutoring/requests/${requestId}/close`;
680
+ };
681
+ /**
682
+ * Close a request from the back office. Goes through the state machine.
683
+ * @summary Admin Close Request
684
+ */
685
+ const adminCloseRequest = async (requestId, tutoringRequestAdminCloseWrite, options) => {
686
+ const getHeaders = (h) => {
687
+ if (!h) return {};
688
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
689
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
690
+ const headers = {};
691
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
692
+ return headers;
693
+ };
694
+ return request(getAdminCloseRequestUrl(requestId), {
695
+ ...options,
696
+ method: "POST",
697
+ headers: {
698
+ "Content-Type": "application/json",
699
+ ...getHeaders(options?.headers)
700
+ },
701
+ body: JSON.stringify(tutoringRequestAdminCloseWrite)
702
+ });
703
+ };
704
+ const getAdminCloseRequestMutationKey = () => ["adminCloseRequest"];
705
+ const getAdminCloseRequestMutationOptions = (options) => {
706
+ const mutationKey = getAdminCloseRequestMutationKey();
707
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
708
+ ...options,
709
+ mutation: {
710
+ ...options.mutation,
711
+ mutationKey
712
+ }
713
+ } : {
714
+ mutation: { mutationKey },
715
+ request: void 0
716
+ };
717
+ const mutationFn = (props) => {
718
+ const { requestId, data } = props ?? {};
719
+ return adminCloseRequest(requestId, data, requestOptions);
720
+ };
721
+ return {
722
+ mutationFn,
723
+ ...mutationOptions
724
+ };
725
+ };
726
+ /**
727
+ * @summary Admin Close Request
728
+ */
729
+ const useAdminCloseRequest = (options, queryClient) => {
730
+ return useMutation(getAdminCloseRequestMutationOptions(options), queryClient);
731
+ };
732
+ const getReadDraftUrl = (requestId) => {
733
+ return `/admin/tutoring/requests/${requestId}/draft`;
734
+ };
735
+ /**
736
+ * The latest draft for one request.
737
+ *
738
+ * ``404`` when there is none, which is the ordinary case: drafting is off by
739
+ * default, and even switched on it produces nothing when the provider is
740
+ * unreachable. A client must treat a missing draft as normal rather than as
741
+ * an error — the request is answerable by a person either way.
742
+ *
743
+ * Only the latest. Re-drafting is not a feature yet, and returning a list
744
+ * would promise one.
745
+ * @summary Read Draft
746
+ */
747
+ const readDraft = async (requestId, options) => {
748
+ return request(getReadDraftUrl(requestId), {
749
+ ...options,
750
+ method: "GET"
751
+ });
752
+ };
753
+ const getReadDraftQueryKey = (requestId) => {
754
+ return [`/admin/tutoring/requests/${requestId}/draft`];
755
+ };
756
+ const getReadDraftQueryOptions = (requestId, options) => {
757
+ const { query: queryOptions, request: requestOptions } = options ?? {};
758
+ const queryKey = queryOptions?.queryKey ?? getReadDraftQueryKey(requestId);
759
+ const queryFn = ({ signal }) => readDraft(requestId, {
760
+ signal,
761
+ ...requestOptions
762
+ });
763
+ return {
764
+ queryKey,
765
+ queryFn,
766
+ enabled: requestId !== null && requestId !== void 0,
767
+ ...queryOptions
768
+ };
769
+ };
770
+ /**
771
+ * @summary Read Draft
772
+ */
773
+ function useReadDraft(requestId, options, queryClient) {
774
+ const queryOptions = getReadDraftQueryOptions(requestId, options);
775
+ const query = useQuery(queryOptions, queryClient);
776
+ return withQueryKey(query, queryOptions.queryKey);
777
+ }
778
+ const getReviewDraftUrl = (requestId) => {
779
+ return `/admin/tutoring/requests/${requestId}/draft/review`;
780
+ };
781
+ /**
782
+ * Score a draft, and optionally hand the request to a person.
783
+ *
784
+ * ``escalate`` stamps ``escalatedAt`` — the legacy's ``ai_to_live``. It is
785
+ * taken from the body rather than inferred from a low ``vote``: a reviewer may
786
+ * rate a draft poorly and still keep it as a starting point, or rate it well
787
+ * and escalate anyway because the pupil needs a conversation.
788
+ *
789
+ * Re-reviewing overwrites the score. Escalation does not un-stamp, because
790
+ * handing a request to a person is not a thing that gets taken back.
791
+ *
792
+ * The request's own status is untouched. A draft is not a state of the
793
+ * request, and moving it here would corrupt the timestamp ladder the reports
794
+ * read.
795
+ * @summary Review Draft
796
+ */
797
+ const reviewDraft = async (requestId, aiDraftReviewWrite, options) => {
798
+ const getHeaders = (h) => {
799
+ if (!h) return {};
800
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
801
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
802
+ const headers = {};
803
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
804
+ return headers;
805
+ };
806
+ return request(getReviewDraftUrl(requestId), {
807
+ ...options,
808
+ method: "PUT",
809
+ headers: {
810
+ "Content-Type": "application/json",
811
+ ...getHeaders(options?.headers)
812
+ },
813
+ body: JSON.stringify(aiDraftReviewWrite)
814
+ });
815
+ };
816
+ const getReviewDraftMutationKey = () => ["reviewDraft"];
817
+ const getReviewDraftMutationOptions = (options) => {
818
+ const mutationKey = getReviewDraftMutationKey();
819
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
820
+ ...options,
821
+ mutation: {
822
+ ...options.mutation,
823
+ mutationKey
824
+ }
825
+ } : {
826
+ mutation: { mutationKey },
827
+ request: void 0
828
+ };
829
+ const mutationFn = (props) => {
830
+ const { requestId, data } = props ?? {};
831
+ return reviewDraft(requestId, data, requestOptions);
832
+ };
833
+ return {
834
+ mutationFn,
835
+ ...mutationOptions
836
+ };
837
+ };
838
+ /**
839
+ * @summary Review Draft
840
+ */
841
+ const useReviewDraft = (options, queryClient) => {
842
+ return useMutation(getReviewDraftMutationOptions(options), queryClient);
843
+ };
844
+ const getCreateSubjectUrl = () => {
845
+ return `/admin/tutoring/subjects`;
846
+ };
847
+ /**
848
+ * Add a subject. Reference data, so ADMIN rather than SUPPORT.
849
+ * @summary Create Subject
850
+ */
851
+ const createSubject = async (subjectWrite, options) => {
852
+ const getHeaders = (h) => {
853
+ if (!h) return {};
854
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
855
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
856
+ const headers = {};
857
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
858
+ return headers;
859
+ };
860
+ return request(getCreateSubjectUrl(), {
861
+ ...options,
862
+ method: "POST",
863
+ headers: {
864
+ "Content-Type": "application/json",
865
+ ...getHeaders(options?.headers)
866
+ },
867
+ body: JSON.stringify(subjectWrite)
868
+ });
869
+ };
870
+ const getCreateSubjectMutationKey = () => ["createSubject"];
871
+ const getCreateSubjectMutationOptions = (options) => {
872
+ const mutationKey = getCreateSubjectMutationKey();
873
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
874
+ ...options,
875
+ mutation: {
876
+ ...options.mutation,
877
+ mutationKey
878
+ }
879
+ } : {
880
+ mutation: { mutationKey },
881
+ request: void 0
882
+ };
883
+ const mutationFn = (props) => {
884
+ const { data } = props ?? {};
885
+ return createSubject(data, requestOptions);
886
+ };
887
+ return {
888
+ mutationFn,
889
+ ...mutationOptions
890
+ };
891
+ };
892
+ /**
893
+ * @summary Create Subject
894
+ */
895
+ const useCreateSubject = (options, queryClient) => {
896
+ return useMutation(getCreateSubjectMutationOptions(options), queryClient);
897
+ };
898
+ const getAmendSubjectUrl = (subjectId) => {
899
+ return `/admin/tutoring/subjects/${subjectId}`;
900
+ };
901
+ /**
902
+ * @summary Amend Subject
903
+ */
904
+ const amendSubject = async (subjectId, subjectWrite, options) => {
905
+ const getHeaders = (h) => {
906
+ if (!h) return {};
907
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
908
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
909
+ const headers = {};
910
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
911
+ return headers;
912
+ };
913
+ return request(getAmendSubjectUrl(subjectId), {
914
+ ...options,
915
+ method: "PATCH",
916
+ headers: {
917
+ "Content-Type": "application/json",
918
+ ...getHeaders(options?.headers)
919
+ },
920
+ body: JSON.stringify(subjectWrite)
921
+ });
922
+ };
923
+ const getAmendSubjectMutationKey = () => ["amendSubject"];
924
+ const getAmendSubjectMutationOptions = (options) => {
925
+ const mutationKey = getAmendSubjectMutationKey();
926
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
927
+ ...options,
928
+ mutation: {
929
+ ...options.mutation,
930
+ mutationKey
931
+ }
932
+ } : {
933
+ mutation: { mutationKey },
934
+ request: void 0
935
+ };
936
+ const mutationFn = (props) => {
937
+ const { subjectId, data } = props ?? {};
938
+ return amendSubject(subjectId, data, requestOptions);
939
+ };
940
+ return {
941
+ mutationFn,
942
+ ...mutationOptions
943
+ };
944
+ };
945
+ /**
946
+ * @summary Amend Subject
947
+ */
948
+ const useAmendSubject = (options, queryClient) => {
949
+ return useMutation(getAmendSubjectMutationOptions(options), queryClient);
950
+ };
951
+ //#endregion
952
+ export { adminCloseRequest, amendGoal, amendLevel, amendPractitioner, amendRequest, amendSubject, createGoal, createLevel, createSubject, getAdminCloseRequestMutationKey, getAdminCloseRequestMutationOptions, getAdminCloseRequestUrl, getAmendGoalMutationKey, getAmendGoalMutationOptions, getAmendGoalUrl, getAmendLevelMutationKey, getAmendLevelMutationOptions, getAmendLevelUrl, getAmendPractitionerMutationKey, getAmendPractitionerMutationOptions, getAmendPractitionerUrl, getAmendRequestMutationKey, getAmendRequestMutationOptions, getAmendRequestUrl, getAmendSubjectMutationKey, getAmendSubjectMutationOptions, getAmendSubjectUrl, getCreateGoalMutationKey, getCreateGoalMutationOptions, getCreateGoalUrl, getCreateLevelMutationKey, getCreateLevelMutationOptions, getCreateLevelUrl, getCreateSubjectMutationKey, getCreateSubjectMutationOptions, getCreateSubjectUrl, getListAllRequestsQueryKey, getListAllRequestsQueryOptions, getListAllRequestsUrl, getListExpiringDocumentsQueryKey, getListExpiringDocumentsQueryOptions, getListExpiringDocumentsUrl, getListFeedbackQueryKey, getListFeedbackQueryOptions, getListFeedbackUrl, getListPractitionerDocumentsQueryKey, getListPractitionerDocumentsQueryOptions, getListPractitionerDocumentsUrl, getListPractitionersQueryKey, getListPractitionersQueryOptions, getListPractitionersUrl, getModerateFeedbackMutationKey, getModerateFeedbackMutationOptions, getModerateFeedbackUrl, getReadDraftQueryKey, getReadDraftQueryOptions, getReadDraftUrl, getReadRequestQueryKey, getReadRequestQueryOptions, getReadRequestUrl, getReviewDraftMutationKey, getReviewDraftMutationOptions, getReviewDraftUrl, listAllRequests, listExpiringDocuments, listFeedback, listPractitionerDocuments, listPractitioners, moderateFeedback, readDraft, readRequest, reviewDraft, useAdminCloseRequest, useAmendGoal, useAmendLevel, useAmendPractitioner, useAmendRequest, useAmendSubject, useCreateGoal, useCreateLevel, useCreateSubject, useListAllRequests, useListExpiringDocuments, useListFeedback, useListPractitionerDocuments, useListPractitioners, useModerateFeedback, useReadDraft, useReadRequest, useReviewDraft };
953
+
954
+ //# sourceMappingURL=admin-tutoring.js.map