@squonk/account-server-client 4.3.1 → 4.4.0-4-4.2174798239

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 (184) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/api/actions/actions.cjs +85 -0
  3. package/dist/api/actions/actions.cjs.map +1 -0
  4. package/dist/api/actions/actions.d.cts +74 -0
  5. package/dist/api/actions/actions.d.cts.map +1 -0
  6. package/dist/api/actions/actions.d.ts +74 -0
  7. package/dist/api/actions/actions.d.ts.map +1 -0
  8. package/dist/api/actions/actions.js +79 -0
  9. package/dist/api/actions/actions.js.map +1 -0
  10. package/dist/api/api.schemas.cjs +142 -0
  11. package/dist/api/api.schemas.cjs.map +1 -0
  12. package/dist/api/api.schemas.d.cts +1032 -0
  13. package/dist/api/api.schemas.d.cts.map +1 -0
  14. package/dist/api/api.schemas.d.ts +1032 -0
  15. package/dist/api/api.schemas.d.ts.map +1 -0
  16. package/dist/api/api.schemas.js +118 -0
  17. package/dist/api/api.schemas.js.map +1 -0
  18. package/dist/api/asset/asset.cjs +464 -0
  19. package/dist/api/asset/asset.cjs.map +1 -0
  20. package/{asset → dist/api/asset}/asset.d.cts +132 -130
  21. package/dist/api/asset/asset.d.cts.map +1 -0
  22. package/{asset → dist/api/asset}/asset.d.ts +132 -130
  23. package/dist/api/asset/asset.d.ts.map +1 -0
  24. package/dist/api/asset/asset.js +431 -0
  25. package/dist/api/asset/asset.js.map +1 -0
  26. package/dist/api/charges/charges.cjs +272 -0
  27. package/dist/api/charges/charges.cjs.map +1 -0
  28. package/{charges → dist/api/charges}/charges.d.cts +106 -104
  29. package/dist/api/charges/charges.d.cts.map +1 -0
  30. package/{charges → dist/api/charges}/charges.d.ts +106 -104
  31. package/dist/api/charges/charges.d.ts.map +1 -0
  32. package/dist/api/charges/charges.js +248 -0
  33. package/dist/api/charges/charges.js.map +1 -0
  34. package/dist/api/event-stream/event-stream.cjs +230 -0
  35. package/dist/api/event-stream/event-stream.cjs.map +1 -0
  36. package/{event-stream → dist/api/event-stream}/event-stream.d.cts +75 -73
  37. package/dist/api/event-stream/event-stream.d.cts.map +1 -0
  38. package/{event-stream → dist/api/event-stream}/event-stream.d.ts +75 -73
  39. package/dist/api/event-stream/event-stream.d.ts.map +1 -0
  40. package/dist/api/event-stream/event-stream.js +212 -0
  41. package/dist/api/event-stream/event-stream.js.map +1 -0
  42. package/dist/api/merchant/merchant.cjs +139 -0
  43. package/dist/api/merchant/merchant.cjs.map +1 -0
  44. package/{merchant → dist/api/merchant}/merchant.d.cts +56 -54
  45. package/dist/api/merchant/merchant.d.cts.map +1 -0
  46. package/{merchant → dist/api/merchant}/merchant.d.ts +56 -54
  47. package/dist/api/merchant/merchant.d.ts.map +1 -0
  48. package/dist/api/merchant/merchant.js +127 -0
  49. package/dist/api/merchant/merchant.js.map +1 -0
  50. package/dist/api/organisation/organisation.cjs +341 -0
  51. package/dist/api/organisation/organisation.cjs.map +1 -0
  52. package/{organisation → dist/api/organisation}/organisation.d.cts +112 -110
  53. package/dist/api/organisation/organisation.d.cts.map +1 -0
  54. package/{organisation → dist/api/organisation}/organisation.d.ts +112 -110
  55. package/dist/api/organisation/organisation.d.ts.map +1 -0
  56. package/dist/api/organisation/organisation.js +314 -0
  57. package/dist/api/organisation/organisation.js.map +1 -0
  58. package/dist/api/product/product.cjs +513 -0
  59. package/dist/api/product/product.cjs.map +1 -0
  60. package/{product → dist/api/product}/product.d.cts +188 -186
  61. package/dist/api/product/product.d.cts.map +1 -0
  62. package/{product → dist/api/product}/product.d.ts +188 -186
  63. package/dist/api/product/product.d.ts.map +1 -0
  64. package/dist/api/product/product.js +468 -0
  65. package/dist/api/product/product.js.map +1 -0
  66. package/dist/api/state/state.cjs +76 -0
  67. package/dist/api/state/state.cjs.map +1 -0
  68. package/dist/api/state/state.d.cts +66 -0
  69. package/dist/api/state/state.d.cts.map +1 -0
  70. package/dist/api/state/state.d.ts +66 -0
  71. package/dist/api/state/state.d.ts.map +1 -0
  72. package/dist/api/state/state.js +70 -0
  73. package/dist/api/state/state.js.map +1 -0
  74. package/dist/api/unit/unit.cjs +568 -0
  75. package/dist/api/unit/unit.cjs.map +1 -0
  76. package/{unit → dist/api/unit}/unit.d.cts +167 -165
  77. package/dist/api/unit/unit.d.cts.map +1 -0
  78. package/{unit → dist/api/unit}/unit.d.ts +167 -165
  79. package/dist/api/unit/unit.d.ts.map +1 -0
  80. package/dist/api/unit/unit.js +523 -0
  81. package/dist/api/unit/unit.js.map +1 -0
  82. package/dist/api/user/user.cjs +380 -0
  83. package/dist/api/user/user.cjs.map +1 -0
  84. package/{user → dist/api/user}/user.d.cts +129 -127
  85. package/dist/api/user/user.d.cts.map +1 -0
  86. package/{user → dist/api/user}/user.d.ts +129 -127
  87. package/dist/api/user/user.d.ts.map +1 -0
  88. package/dist/api/user/user.js +350 -0
  89. package/dist/api/user/user.js.map +1 -0
  90. package/dist/custom-instance.cjs +49 -0
  91. package/dist/custom-instance.cjs.map +1 -0
  92. package/dist/custom-instance.d.cts +22 -0
  93. package/dist/custom-instance.d.cts.map +1 -0
  94. package/dist/custom-instance.d.ts +22 -0
  95. package/dist/custom-instance.d.ts.map +1 -0
  96. package/dist/custom-instance.js +44 -0
  97. package/dist/custom-instance.js.map +1 -0
  98. package/dist/index.cjs +31 -0
  99. package/dist/index.d.cts +3 -0
  100. package/dist/index.d.ts +3 -0
  101. package/dist/index.js +4 -0
  102. package/dist/options-mutator.cjs +24 -0
  103. package/dist/options-mutator.cjs.map +1 -0
  104. package/dist/options-mutator.js +23 -0
  105. package/dist/options-mutator.js.map +1 -0
  106. package/orval.config.ts +24 -0
  107. package/package.json +163 -16
  108. package/pnpm-workspace.yaml +3 -0
  109. package/src/api/actions/actions.ts +249 -0
  110. package/src/{account-server-api.schemas.ts → api/api.schemas.ts} +82 -2
  111. package/src/{asset → api/asset}/asset.ts +8 -8
  112. package/src/{charges → api/charges}/charges.ts +9 -9
  113. package/src/{event-stream → api/event-stream}/event-stream.ts +7 -7
  114. package/src/{merchant → api/merchant}/merchant.ts +7 -7
  115. package/src/{organisation → api/organisation}/organisation.ts +8 -8
  116. package/src/{product → api/product}/product.ts +10 -10
  117. package/src/{state → api/state}/state.ts +6 -6
  118. package/src/{unit → api/unit}/unit.ts +9 -9
  119. package/src/{user → api/user}/user.ts +9 -9
  120. package/src/index.ts +2 -2
  121. package/src/options-mutator.ts +2 -2
  122. package/tsconfig.json +29 -0
  123. package/tsdown.config.ts +52 -0
  124. package/asset/asset.cjs +0 -281
  125. package/asset/asset.cjs.map +0 -1
  126. package/asset/asset.js +0 -281
  127. package/asset/asset.js.map +0 -1
  128. package/asset/package.json +0 -7
  129. package/charges/charges.cjs +0 -176
  130. package/charges/charges.cjs.map +0 -1
  131. package/charges/charges.js +0 -176
  132. package/charges/charges.js.map +0 -1
  133. package/charges/package.json +0 -7
  134. package/chunk-3WKSNKHE.js +0 -25
  135. package/chunk-3WKSNKHE.js.map +0 -1
  136. package/chunk-NY2VJJG7.cjs +0 -25
  137. package/chunk-NY2VJJG7.cjs.map +0 -1
  138. package/chunk-RB2KVIEK.cjs +0 -27
  139. package/chunk-RB2KVIEK.cjs.map +0 -1
  140. package/chunk-XYDLYMQ2.js +0 -27
  141. package/chunk-XYDLYMQ2.js.map +0 -1
  142. package/event-stream/event-stream.cjs +0 -144
  143. package/event-stream/event-stream.cjs.map +0 -1
  144. package/event-stream/event-stream.js +0 -144
  145. package/event-stream/event-stream.js.map +0 -1
  146. package/event-stream/package.json +0 -7
  147. package/index.cjs +0 -142
  148. package/index.cjs.map +0 -1
  149. package/index.d.cts +0 -979
  150. package/index.d.ts +0 -979
  151. package/index.js +0 -142
  152. package/index.js.map +0 -1
  153. package/merchant/merchant.cjs +0 -91
  154. package/merchant/merchant.cjs.map +0 -1
  155. package/merchant/merchant.js +0 -91
  156. package/merchant/merchant.js.map +0 -1
  157. package/merchant/package.json +0 -7
  158. package/organisation/organisation.cjs +0 -213
  159. package/organisation/organisation.cjs.map +0 -1
  160. package/organisation/organisation.js +0 -213
  161. package/organisation/organisation.js.map +0 -1
  162. package/organisation/package.json +0 -7
  163. package/product/package.json +0 -7
  164. package/product/product.cjs +0 -341
  165. package/product/product.cjs.map +0 -1
  166. package/product/product.js +0 -341
  167. package/product/product.js.map +0 -1
  168. package/state/package.json +0 -7
  169. package/state/state.cjs +0 -53
  170. package/state/state.cjs.map +0 -1
  171. package/state/state.d.cts +0 -64
  172. package/state/state.d.ts +0 -64
  173. package/state/state.js +0 -53
  174. package/state/state.js.map +0 -1
  175. package/unit/package.json +0 -7
  176. package/unit/unit.cjs +0 -339
  177. package/unit/unit.cjs.map +0 -1
  178. package/unit/unit.js +0 -339
  179. package/unit/unit.js.map +0 -1
  180. package/user/package.json +0 -7
  181. package/user/user.cjs +0 -226
  182. package/user/user.cjs.map +0 -1
  183. package/user/user.js +0 -226
  184. package/user/user.js.map +0 -1
@@ -0,0 +1,350 @@
1
+ import { customInstance } from "../../custom-instance.js";
2
+ import { mutationMutator, queryMutator } from "../../options-mutator.js";
3
+ import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
4
+
5
+ //#region src/api/user/user.ts
6
+ /**
7
+ * Generated by orval v7.16.1 🍺
8
+ * Do not edit manually.
9
+ * Account Server API
10
+ * The Informatics Matters Account Server API.
11
+
12
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
13
+
14
+ * OpenAPI spec version: 4.4
15
+ */
16
+ /**
17
+ * Returns a summary of your account
18
+
19
+ * @summary Get information about your account
20
+ */
21
+ const getUserAccount = (options, signal) => {
22
+ return customInstance({
23
+ url: `/user/account`,
24
+ method: "GET",
25
+ signal
26
+ }, options);
27
+ };
28
+ const getGetUserAccountQueryKey = () => {
29
+ return [`/user/account`];
30
+ };
31
+ const useGetUserAccountQueryOptions = (options) => {
32
+ const { query: queryOptions, request: requestOptions } = options ?? {};
33
+ const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
34
+ const queryFn = ({ signal }) => getUserAccount(requestOptions, signal);
35
+ return queryMutator({
36
+ ...queryOptions,
37
+ queryKey,
38
+ queryFn
39
+ });
40
+ };
41
+ /**
42
+ * @summary Get information about your account
43
+ */
44
+ function useGetUserAccount(options, queryClient) {
45
+ const queryOptions = useGetUserAccountQueryOptions(options);
46
+ const query = useQuery(queryOptions, queryClient);
47
+ query.queryKey = queryOptions.queryKey;
48
+ return query;
49
+ }
50
+ const useGetUserAccountSuspenseQueryOptions = (options) => {
51
+ const { query: queryOptions, request: requestOptions } = options ?? {};
52
+ const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
53
+ const queryFn = ({ signal }) => getUserAccount(requestOptions, signal);
54
+ return queryMutator({
55
+ ...queryOptions,
56
+ queryKey,
57
+ queryFn
58
+ });
59
+ };
60
+ /**
61
+ * @summary Get information about your account
62
+ */
63
+ function useGetUserAccountSuspense(options, queryClient) {
64
+ const queryOptions = useGetUserAccountSuspenseQueryOptions(options);
65
+ const query = useSuspenseQuery(queryOptions, queryClient);
66
+ query.queryKey = queryOptions.queryKey;
67
+ return query;
68
+ }
69
+ /**
70
+ * Gets Users in an Organisation.
71
+
72
+ You have to be a member of the Organisation or an admin user to use this endpoint
73
+
74
+ **WARNING**: This endpoint is **DEPRECATED** and will be removed in a future release. Please use the `GET /organisation/{org_id}` endpoint instead.
75
+
76
+ * @summary Gets users in an Organisation
77
+ */
78
+ const getOrganisationUsers = (orgId, options, signal) => {
79
+ return customInstance({
80
+ url: `/organisation/${orgId}/user`,
81
+ method: "GET",
82
+ signal
83
+ }, options);
84
+ };
85
+ const getGetOrganisationUsersQueryKey = (orgId) => {
86
+ return [`/organisation/${orgId}/user`];
87
+ };
88
+ const useGetOrganisationUsersQueryOptions = (orgId, options) => {
89
+ const { query: queryOptions, request: requestOptions } = options ?? {};
90
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
91
+ const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
92
+ return queryMutator({
93
+ ...queryOptions,
94
+ queryKey,
95
+ queryFn
96
+ });
97
+ };
98
+ /**
99
+ * @summary Gets users in an Organisation
100
+ */
101
+ function useGetOrganisationUsers(orgId, options, queryClient) {
102
+ const queryOptions = useGetOrganisationUsersQueryOptions(orgId, options);
103
+ const query = useQuery(queryOptions, queryClient);
104
+ query.queryKey = queryOptions.queryKey;
105
+ return query;
106
+ }
107
+ const useGetOrganisationUsersSuspenseQueryOptions = (orgId, options) => {
108
+ const { query: queryOptions, request: requestOptions } = options ?? {};
109
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
110
+ const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
111
+ return queryMutator({
112
+ ...queryOptions,
113
+ queryKey,
114
+ queryFn
115
+ });
116
+ };
117
+ /**
118
+ * @summary Gets users in an Organisation
119
+ */
120
+ function useGetOrganisationUsersSuspense(orgId, options, queryClient) {
121
+ const queryOptions = useGetOrganisationUsersSuspenseQueryOptions(orgId, options);
122
+ const query = useSuspenseQuery(queryOptions, queryClient);
123
+ query.queryKey = queryOptions.queryKey;
124
+ return query;
125
+ }
126
+ /**
127
+ * Adds a User to an **Organisation**.
128
+
129
+ You have to be in the Organisation or an admin user to use this endpoint
130
+
131
+ * @summary Adds a User to an Organisation
132
+ */
133
+ const addOrganisationUser = (orgId, userId, options) => {
134
+ return customInstance({
135
+ url: `/organisation/${orgId}/user/${userId}`,
136
+ method: "PUT"
137
+ }, options);
138
+ };
139
+ const useAddOrganisationUserMutationOptions = (options) => {
140
+ const mutationKey = ["addOrganisationUser"];
141
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
142
+ ...options,
143
+ mutation: {
144
+ ...options.mutation,
145
+ mutationKey
146
+ }
147
+ } : {
148
+ mutation: { mutationKey },
149
+ request: void 0
150
+ };
151
+ const mutationFn = (props) => {
152
+ const { orgId, userId } = props ?? {};
153
+ return addOrganisationUser(orgId, userId, requestOptions);
154
+ };
155
+ return mutationMutator({
156
+ ...mutationOptions,
157
+ mutationFn
158
+ });
159
+ };
160
+ /**
161
+ * @summary Adds a User to an Organisation
162
+ */
163
+ const useAddOrganisationUser = (options, queryClient) => {
164
+ return useMutation(useAddOrganisationUserMutationOptions(options), queryClient);
165
+ };
166
+ /**
167
+ * Removes a User from an **Organisation**.
168
+
169
+ You have to be in the Organisation or an admin user to use this endpoint
170
+
171
+ * @summary Deletes a User from an Organisation
172
+ */
173
+ const deleteOrganisationUser = (orgId, userId, options) => {
174
+ return customInstance({
175
+ url: `/organisation/${orgId}/user/${userId}`,
176
+ method: "DELETE"
177
+ }, options);
178
+ };
179
+ const useDeleteOrganisationUserMutationOptions = (options) => {
180
+ const mutationKey = ["deleteOrganisationUser"];
181
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
182
+ ...options,
183
+ mutation: {
184
+ ...options.mutation,
185
+ mutationKey
186
+ }
187
+ } : {
188
+ mutation: { mutationKey },
189
+ request: void 0
190
+ };
191
+ const mutationFn = (props) => {
192
+ const { orgId, userId } = props ?? {};
193
+ return deleteOrganisationUser(orgId, userId, requestOptions);
194
+ };
195
+ return mutationMutator({
196
+ ...mutationOptions,
197
+ mutationFn
198
+ });
199
+ };
200
+ /**
201
+ * @summary Deletes a User from an Organisation
202
+ */
203
+ const useDeleteOrganisationUser = (options, queryClient) => {
204
+ return useMutation(useDeleteOrganisationUserMutationOptions(options), queryClient);
205
+ };
206
+ /**
207
+ * Gets users in an Organisational Unit.
208
+
209
+ You have to be in the Organisation or Unit or an Admin user to use this endpoint
210
+
211
+ **WARNING**: This endpoint is **DEPRECATED** and will be removed in a future release. Please use the `GET /unit/{unit_id}` endpoint instead.
212
+
213
+ * @summary Gets users in an Organisational Unit
214
+ */
215
+ const getOrganisationUnitUsers = (unitId, options, signal) => {
216
+ return customInstance({
217
+ url: `/unit/${unitId}/user`,
218
+ method: "GET",
219
+ signal
220
+ }, options);
221
+ };
222
+ const getGetOrganisationUnitUsersQueryKey = (unitId) => {
223
+ return [`/unit/${unitId}/user`];
224
+ };
225
+ const useGetOrganisationUnitUsersQueryOptions = (unitId, options) => {
226
+ const { query: queryOptions, request: requestOptions } = options ?? {};
227
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
228
+ const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
229
+ return queryMutator({
230
+ ...queryOptions,
231
+ queryKey,
232
+ queryFn
233
+ });
234
+ };
235
+ /**
236
+ * @summary Gets users in an Organisational Unit
237
+ */
238
+ function useGetOrganisationUnitUsers(unitId, options, queryClient) {
239
+ const queryOptions = useGetOrganisationUnitUsersQueryOptions(unitId, options);
240
+ const query = useQuery(queryOptions, queryClient);
241
+ query.queryKey = queryOptions.queryKey;
242
+ return query;
243
+ }
244
+ const useGetOrganisationUnitUsersSuspenseQueryOptions = (unitId, options) => {
245
+ const { query: queryOptions, request: requestOptions } = options ?? {};
246
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
247
+ const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
248
+ return queryMutator({
249
+ ...queryOptions,
250
+ queryKey,
251
+ queryFn
252
+ });
253
+ };
254
+ /**
255
+ * @summary Gets users in an Organisational Unit
256
+ */
257
+ function useGetOrganisationUnitUsersSuspense(unitId, options, queryClient) {
258
+ const queryOptions = useGetOrganisationUnitUsersSuspenseQueryOptions(unitId, options);
259
+ const query = useSuspenseQuery(queryOptions, queryClient);
260
+ query.queryKey = queryOptions.queryKey;
261
+ return query;
262
+ }
263
+ /**
264
+ * Adds a user to an Organisational Unit.
265
+
266
+ Users cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).
267
+
268
+ You have to be in the Organisation or Unit or an Admin user to use this endpoint
269
+
270
+ * @summary Adds a user to an Organisational Unit
271
+ */
272
+ const addOrganisationUnitUser = (unitId, userId, options) => {
273
+ return customInstance({
274
+ url: `/unit/${unitId}/user/${userId}`,
275
+ method: "PUT"
276
+ }, options);
277
+ };
278
+ const useAddOrganisationUnitUserMutationOptions = (options) => {
279
+ const mutationKey = ["addOrganisationUnitUser"];
280
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
281
+ ...options,
282
+ mutation: {
283
+ ...options.mutation,
284
+ mutationKey
285
+ }
286
+ } : {
287
+ mutation: { mutationKey },
288
+ request: void 0
289
+ };
290
+ const mutationFn = (props) => {
291
+ const { unitId, userId } = props ?? {};
292
+ return addOrganisationUnitUser(unitId, userId, requestOptions);
293
+ };
294
+ return mutationMutator({
295
+ ...mutationOptions,
296
+ mutationFn
297
+ });
298
+ };
299
+ /**
300
+ * @summary Adds a user to an Organisational Unit
301
+ */
302
+ const useAddOrganisationUnitUser = (options, queryClient) => {
303
+ return useMutation(useAddOrganisationUnitUserMutationOptions(options), queryClient);
304
+ };
305
+ /**
306
+ * Removes a User from an Organisational Unit.
307
+
308
+ Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
309
+
310
+ You have to be in the Organisation or Unit or an Admin user to use this endpoint
311
+
312
+ * @summary Deletes a User from an Organisational Unit
313
+ */
314
+ const deleteOrganisationUnitUser = (unitId, userId, options) => {
315
+ return customInstance({
316
+ url: `/unit/${unitId}/user/${userId}`,
317
+ method: "DELETE"
318
+ }, options);
319
+ };
320
+ const useDeleteOrganisationUnitUserMutationOptions = (options) => {
321
+ const mutationKey = ["deleteOrganisationUnitUser"];
322
+ const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
323
+ ...options,
324
+ mutation: {
325
+ ...options.mutation,
326
+ mutationKey
327
+ }
328
+ } : {
329
+ mutation: { mutationKey },
330
+ request: void 0
331
+ };
332
+ const mutationFn = (props) => {
333
+ const { unitId, userId } = props ?? {};
334
+ return deleteOrganisationUnitUser(unitId, userId, requestOptions);
335
+ };
336
+ return mutationMutator({
337
+ ...mutationOptions,
338
+ mutationFn
339
+ });
340
+ };
341
+ /**
342
+ * @summary Deletes a User from an Organisational Unit
343
+ */
344
+ const useDeleteOrganisationUnitUser = (options, queryClient) => {
345
+ return useMutation(useDeleteOrganisationUnitUserMutationOptions(options), queryClient);
346
+ };
347
+
348
+ //#endregion
349
+ export { addOrganisationUnitUser, addOrganisationUser, deleteOrganisationUnitUser, deleteOrganisationUser, getGetOrganisationUnitUsersQueryKey, getGetOrganisationUsersQueryKey, getGetUserAccountQueryKey, getOrganisationUnitUsers, getOrganisationUsers, getUserAccount, useAddOrganisationUnitUser, useAddOrganisationUnitUserMutationOptions, useAddOrganisationUser, useAddOrganisationUserMutationOptions, useDeleteOrganisationUnitUser, useDeleteOrganisationUnitUserMutationOptions, useDeleteOrganisationUser, useDeleteOrganisationUserMutationOptions, useGetOrganisationUnitUsers, useGetOrganisationUnitUsersQueryOptions, useGetOrganisationUnitUsersSuspense, useGetOrganisationUnitUsersSuspenseQueryOptions, useGetOrganisationUsers, useGetOrganisationUsersQueryOptions, useGetOrganisationUsersSuspense, useGetOrganisationUsersSuspenseQueryOptions, useGetUserAccount, useGetUserAccountQueryOptions, useGetUserAccountSuspense, useGetUserAccountSuspenseQueryOptions };
350
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","names":["queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>>","queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>>","mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n { orgId: string; userId: string }\n >","mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n { orgId: string; userId: string }\n >","queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>","mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n { unitId: string; userId: string }\n >","mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n { unitId: string; userId: string }\n >"],"sources":["../../../src/api/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v7.16.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 4.4\n */\nimport { useMutation, useQuery, useSuspenseQuery } 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 UseSuspenseQueryOptions,\n UseSuspenseQueryResult,\n} from \"@tanstack/react-query\";\n\nimport type { AsError, UserAccountDetail, UsersGetResponse } from \"../api.schemas\";\n\nimport { customInstance } from \"../../custom-instance\";\nimport type { ErrorType } from \"../../custom-instance\";\nimport { queryMutator } from \"../../options-mutator\";\nimport { mutationMutator } from \"../../options-mutator\";\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal,\n) => {\n return customInstance<UserAccountDetail>(\n { url: `/user/account`, method: \"GET\", signal },\n options,\n );\n};\n\nexport const getGetUserAccountQueryKey = () => {\n return [`/user/account`] as const;\n};\n\nexport const useGetUserAccountQueryOptions = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) =>\n getUserAccount(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport function useGetUserAccount<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options: {\n query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>> &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n Awaited<ReturnType<typeof getUserAccount>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUserAccount<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>> &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n Awaited<ReturnType<typeof getUserAccount>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUserAccount<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Get information about your account\n */\n\nexport function useGetUserAccount<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetUserAccountQueryOptions(options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetUserAccountSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) =>\n getUserAccount(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetUserAccountSuspenseQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUserAccount>>\n>;\nexport type GetUserAccountSuspenseQueryError = ErrorType<void | AsError>;\n\nexport function useGetUserAccountSuspense<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options: {\n query: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUserAccountSuspense<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUserAccountSuspense<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Get information about your account\n */\n\nexport function useGetUserAccountSuspense<\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>,\n>(\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetUserAccountSuspenseQueryOptions(options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\n/**\n * Gets Users in an Organisation.\n\nYou have to be a member of the Organisation or an admin user to use this endpoint\n\n**WARNING**: This endpoint is **DEPRECATED** and will be removed in a future release. Please use the `GET /organisation/{org_id}` endpoint instead.\n\n * @summary Gets users in an Organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal,\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgId}/user`, method: \"GET\", signal },\n options,\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgId?: string) => {\n return [`/organisation/${orgId}/user`] as const;\n};\n\nexport const useGetOrganisationUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) =>\n getOrganisationUsers(orgId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport function useGetOrganisationUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options: {\n query: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n > &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n Awaited<ReturnType<typeof getOrganisationUsers>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n > &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n Awaited<ReturnType<typeof getOrganisationUsers>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets users in an Organisation\n */\n\nexport function useGetOrganisationUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetOrganisationUsersQueryOptions(orgId, options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetOrganisationUsersSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) =>\n getOrganisationUsers(orgId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetOrganisationUsersSuspenseQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersSuspenseQueryError = ErrorType<AsError | void>;\n\nexport function useGetOrganisationUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options: {\n query: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets users in an Organisation\n */\n\nexport function useGetOrganisationUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n orgId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetOrganisationUsersSuspenseQueryOptions(orgId, options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\n/**\n * Adds a User to an **Organisation**.\n\nYou have to be in the Organisation or an admin user to use this endpoint\n\n * @summary Adds a User to an Organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"PUT\" },\n options,\n );\n};\n\nexport const useAddOrganisationUserMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown,\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const mutationKey = [\"addOrganisationUser\"];\n const { 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 const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return addOrganisationUser(orgId, userId, requestOptions);\n };\n\n const customOptions = mutationMutator({ ...mutationOptions, mutationFn });\n\n return customOptions;\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUser>>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError | void>;\n\n/**\n * @summary Adds a User to an Organisation\n */\nexport const useAddOrganisationUser = <TError = ErrorType<AsError | void>, TContext = unknown>(\n options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseMutationResult<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const mutationOptions = useAddOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions, queryClient);\n};\n/**\n * Removes a User from an **Organisation**.\n\nYou have to be in the Organisation or an admin user to use this endpoint\n\n * @summary Deletes a User from an Organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"DELETE\" },\n options,\n );\n};\n\nexport const useDeleteOrganisationUserMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown,\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const mutationKey = [\"deleteOrganisationUser\"];\n const { 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 const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return deleteOrganisationUser(orgId, userId, requestOptions);\n };\n\n const customOptions = mutationMutator({ ...mutationOptions, mutationFn });\n\n return customOptions;\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUser>>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError | void>;\n\n/**\n * @summary Deletes a User from an Organisation\n */\nexport const useDeleteOrganisationUser = <TError = ErrorType<AsError | void>, TContext = unknown>(\n options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseMutationResult<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const mutationOptions = useDeleteOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions, queryClient);\n};\n/**\n * Gets users in an Organisational Unit.\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n**WARNING**: This endpoint is **DEPRECATED** and will be removed in a future release. Please use the `GET /unit/{unit_id}` endpoint instead.\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal,\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitId}/user`, method: \"GET\", signal },\n options,\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId?: string) => {\n return [`/unit/${unitId}/user`] as const;\n};\n\nexport const useGetOrganisationUnitUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({\n signal,\n }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport function useGetOrganisationUnitUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options: {\n query: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n > &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUnitUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n > &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUnitUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets users in an Organisational Unit\n */\n\nexport function useGetOrganisationUnitUsers<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetOrganisationUnitUsersQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetOrganisationUnitUsersSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({\n signal,\n }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetOrganisationUnitUsersSuspenseQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersSuspenseQueryError = ErrorType<AsError | void>;\n\nexport function useGetOrganisationUnitUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options: {\n query: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUnitUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationUnitUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets users in an Organisational Unit\n */\n\nexport function useGetOrganisationUnitUsersSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetOrganisationUnitUsersSuspenseQueryOptions(unitId, options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,\n) => {\n return customInstance<void>({ url: `/unit/${unitId}/user/${userId}`, method: \"PUT\" }, options);\n};\n\nexport const useAddOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown,\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const mutationKey = [\"addOrganisationUnitUser\"];\n const { 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 const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return addOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n const customOptions = mutationMutator({ ...mutationOptions, mutationFn });\n\n return customOptions;\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError | void>;\n\n/**\n * @summary Adds a user to an Organisational Unit\n */\nexport const useAddOrganisationUnitUser = <TError = ErrorType<AsError | void>, TContext = unknown>(\n options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseMutationResult<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const mutationOptions = useAddOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions, queryClient);\n};\n/**\n * Removes a User from an Organisational Unit.\n\nUsers cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a User from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,\n) => {\n return customInstance<void>({ url: `/unit/${unitId}/user/${userId}`, method: \"DELETE\" }, options);\n};\n\nexport const useDeleteOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown,\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const mutationKey = [\"deleteOrganisationUnitUser\"];\n const { 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 const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return deleteOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n const customOptions = mutationMutator({ ...mutationOptions, mutationFn });\n\n return customOptions;\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError | void>;\n\n/**\n * @summary Deletes a User from an Organisational Unit\n */\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError | void>,\n TContext = unknown,\n>(\n options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseMutationResult<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const mutationOptions = useDeleteOrganisationUnitUserMutationOptions(options);\n\n return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,YAFiB,0CAA0C,QAAQ,EAEtC,YAAY;;;;;;;;;;;AAWlD,MAAa,8BACX,QACA,QACA,YACG;AACH,QAAO,eAAqB;EAAE,KAAK,SAAS,OAAO,QAAQ;EAAU,QAAQ;EAAU,EAAE,QAAQ;;AAGnG,MAAa,gDAGX,YAaG;CACH,MAAM,cAAc,CAAC,6BAA6B;CAClD,MAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,UAC3D,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cACxE,UACA;EAAE,GAAG;EAAS,UAAU;GAAE,GAAG,QAAQ;GAAU;GAAa;EAAE,GAChE;EAAE,UAAU,EAAE,aAAa;EAAE,SAAS;EAAW;CAErD,MAAMC,cAGD,UAAU;EACb,MAAM,EAAE,QAAQ,WAAW,SAAS,EAAE;AAEtC,SAAO,2BAA2B,QAAQ,QAAQ,eAAe;;AAKnE,QAFsB,gBAAgB;EAAE,GAAG;EAAiB;EAAY,CAAC;;;;;AAc3E,MAAa,iCAIX,SASA,gBAMG;AAGH,QAAO,YAFiB,6CAA6C,QAAQ,EAEzC,YAAY"}
@@ -0,0 +1,49 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let axios = require("axios");
3
+ axios = require_rolldown_runtime.__toESM(axios);
4
+
5
+ //#region src/custom-instance.ts
6
+ /** Based off the example custom-instance from Orval docs
7
+ * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts
8
+ *
9
+ * See https://react-query.tanstack.com/guides/query-cancellation
10
+ *
11
+ * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be
12
+ * achieved without changing much using `redaxios`
13
+ * Or use 'ky'
14
+ */
15
+ const AXIOS_INSTANCE = axios.default.create();
16
+ /**
17
+ * Set the access token to be added as the `Authorization: Bearer 'token'` header
18
+ * Useful for client only apps where a proxy API route isn't involved to securely add the access token
19
+ * @param token access token
20
+ */
21
+ const setAuthToken = (token) => {
22
+ AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
23
+ };
24
+ /**
25
+ * Set the url to which request paths are added to.
26
+ * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
27
+ */
28
+ const setBaseUrl = (baseUrl) => {
29
+ AXIOS_INSTANCE.defaults.baseURL = baseUrl;
30
+ };
31
+ const customInstance = (config, options) => {
32
+ const source = axios.default.CancelToken.source();
33
+ const promise = AXIOS_INSTANCE({
34
+ ...config,
35
+ ...options,
36
+ cancelToken: source.token
37
+ }).then(({ data }) => data);
38
+ promise.cancel = () => {
39
+ source.cancel("Query was cancelled");
40
+ };
41
+ return promise;
42
+ };
43
+
44
+ //#endregion
45
+ exports.AXIOS_INSTANCE = AXIOS_INSTANCE;
46
+ exports.customInstance = customInstance;
47
+ exports.setAuthToken = setAuthToken;
48
+ exports.setBaseUrl = setBaseUrl;
49
+ //# sourceMappingURL=custom-instance.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-instance.cjs","names":["Axios"],"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, type AxiosRequestConfig } from \"axios\";\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common[\"Authorization\"] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel(\"Query was cancelled\");\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,iBAAiBA,cAAM,QAAQ;;;;;;AAO5C,MAAa,gBAAgB,UAAkB;AAC7C,gBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;;;;;;AAOtE,MAAa,cAAc,YAAoB;AAC7C,gBAAe,SAAS,UAAU;;AAGpC,MAAa,kBACX,QACA,YACqB;CACrB,MAAM,SAASA,cAAM,YAAY,QAAQ;CAEzC,MAAM,UAAU,eAAe;EAAE,GAAG;EAAQ,GAAG;EAAS,aAAa,OAAO;EAAO,CAAC,CAAC,MAClF,EAAE,WAAW,KACf;AAGD,SAAQ,eAAe;AACrB,SAAO,OAAO,sBAAsB;;AAGtC,QAAO"}
@@ -0,0 +1,22 @@
1
+ import * as axios0 from "axios";
2
+ import { AxiosError, AxiosRequestConfig } from "axios";
3
+
4
+ //#region src/custom-instance.d.ts
5
+
6
+ declare const AXIOS_INSTANCE: axios0.AxiosInstance;
7
+ /**
8
+ * Set the access token to be added as the `Authorization: Bearer 'token'` header
9
+ * Useful for client only apps where a proxy API route isn't involved to securely add the access token
10
+ * @param token access token
11
+ */
12
+ declare const setAuthToken: (token: string) => void;
13
+ /**
14
+ * Set the url to which request paths are added to.
15
+ * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
16
+ */
17
+ declare const setBaseUrl: (baseUrl: string) => void;
18
+ declare const customInstance: <TReturn>(config: AxiosRequestConfig, options?: AxiosRequestConfig) => Promise<TReturn>;
19
+ type ErrorType<TError> = AxiosError<TError>;
20
+ //#endregion
21
+ export { AXIOS_INSTANCE, ErrorType, customInstance, setAuthToken, setBaseUrl };
22
+ //# sourceMappingURL=custom-instance.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-instance.d.cts","names":[],"sources":["../src/custom-instance.ts"],"sourcesContent":[],"mappings":";;;;;AAkCW,cAtBE,cAsBF,EAtBiC,MAAA,CAAjB,aAsBhB;;;AAeX;;;cA9Ba;;;;;cAQA;cAIA,kCACH,8BACE,uBACT,QAAQ;KAeC,oBAAoB,WAAW"}
@@ -0,0 +1,22 @@
1
+ import * as axios0 from "axios";
2
+ import { AxiosError, AxiosRequestConfig } from "axios";
3
+
4
+ //#region src/custom-instance.d.ts
5
+
6
+ declare const AXIOS_INSTANCE: axios0.AxiosInstance;
7
+ /**
8
+ * Set the access token to be added as the `Authorization: Bearer 'token'` header
9
+ * Useful for client only apps where a proxy API route isn't involved to securely add the access token
10
+ * @param token access token
11
+ */
12
+ declare const setAuthToken: (token: string) => void;
13
+ /**
14
+ * Set the url to which request paths are added to.
15
+ * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
16
+ */
17
+ declare const setBaseUrl: (baseUrl: string) => void;
18
+ declare const customInstance: <TReturn>(config: AxiosRequestConfig, options?: AxiosRequestConfig) => Promise<TReturn>;
19
+ type ErrorType<TError> = AxiosError<TError>;
20
+ //#endregion
21
+ export { AXIOS_INSTANCE, ErrorType, customInstance, setAuthToken, setBaseUrl };
22
+ //# sourceMappingURL=custom-instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-instance.d.ts","names":[],"sources":["../src/custom-instance.ts"],"sourcesContent":[],"mappings":";;;;;AAkCW,cAtBE,cAsBF,EAtBiC,MAAA,CAAjB,aAsBhB;;;AAeX;;;cA9Ba;;;;;cAQA;cAIA,kCACH,8BACE,uBACT,QAAQ;KAeC,oBAAoB,WAAW"}
@@ -0,0 +1,44 @@
1
+ import Axios, { AxiosError } from "axios";
2
+
3
+ //#region src/custom-instance.ts
4
+ /** Based off the example custom-instance from Orval docs
5
+ * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts
6
+ *
7
+ * See https://react-query.tanstack.com/guides/query-cancellation
8
+ *
9
+ * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be
10
+ * achieved without changing much using `redaxios`
11
+ * Or use 'ky'
12
+ */
13
+ const AXIOS_INSTANCE = Axios.create();
14
+ /**
15
+ * Set the access token to be added as the `Authorization: Bearer 'token'` header
16
+ * Useful for client only apps where a proxy API route isn't involved to securely add the access token
17
+ * @param token access token
18
+ */
19
+ const setAuthToken = (token) => {
20
+ AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
21
+ };
22
+ /**
23
+ * Set the url to which request paths are added to.
24
+ * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'
25
+ */
26
+ const setBaseUrl = (baseUrl) => {
27
+ AXIOS_INSTANCE.defaults.baseURL = baseUrl;
28
+ };
29
+ const customInstance = (config, options) => {
30
+ const source = Axios.CancelToken.source();
31
+ const promise = AXIOS_INSTANCE({
32
+ ...config,
33
+ ...options,
34
+ cancelToken: source.token
35
+ }).then(({ data }) => data);
36
+ promise.cancel = () => {
37
+ source.cancel("Query was cancelled");
38
+ };
39
+ return promise;
40
+ };
41
+
42
+ //#endregion
43
+ export { AXIOS_INSTANCE, customInstance, setAuthToken, setBaseUrl };
44
+ //# sourceMappingURL=custom-instance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-instance.js","names":[],"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, type AxiosRequestConfig } from \"axios\";\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common[\"Authorization\"] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel(\"Query was cancelled\");\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,iBAAiB,MAAM,QAAQ;;;;;;AAO5C,MAAa,gBAAgB,UAAkB;AAC7C,gBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;;;;;;AAOtE,MAAa,cAAc,YAAoB;AAC7C,gBAAe,SAAS,UAAU;;AAGpC,MAAa,kBACX,QACA,YACqB;CACrB,MAAM,SAAS,MAAM,YAAY,QAAQ;CAEzC,MAAM,UAAU,eAAe;EAAE,GAAG;EAAQ,GAAG;EAAS,aAAa,OAAO;EAAO,CAAC,CAAC,MAClF,EAAE,WAAW,KACf;AAGD,SAAQ,eAAe;AACrB,SAAO,OAAO,sBAAsB;;AAGtC,QAAO"}
package/dist/index.cjs ADDED
@@ -0,0 +1,31 @@
1
+ const require_api_schemas = require('./api/api.schemas.cjs');
2
+ const require_custom_instance = require('./custom-instance.cjs');
3
+
4
+ exports.AXIOS_INSTANCE = require_custom_instance.AXIOS_INSTANCE;
5
+ exports.AssetDetailScope = require_api_schemas.AssetDetailScope;
6
+ exports.AssetPostBodyBodyScope = require_api_schemas.AssetPostBodyBodyScope;
7
+ exports.ChargeSummaryType = require_api_schemas.ChargeSummaryType;
8
+ exports.EventStreamPostBodyBodyFormat = require_api_schemas.EventStreamPostBodyBodyFormat;
9
+ exports.EventStreamVersionGetResponseProtocol = require_api_schemas.EventStreamVersionGetResponseProtocol;
10
+ exports.MerchantDetailKind = require_api_schemas.MerchantDetailKind;
11
+ exports.MerchantSummaryKind = require_api_schemas.MerchantSummaryKind;
12
+ exports.OrganisationAllDetailDefaultProductPrivacy = require_api_schemas.OrganisationAllDetailDefaultProductPrivacy;
13
+ exports.OrganisationDetailDefaultProductPrivacy = require_api_schemas.OrganisationDetailDefaultProductPrivacy;
14
+ exports.OrganisationGetDefaultResponseDefaultProductPrivacy = require_api_schemas.OrganisationGetDefaultResponseDefaultProductPrivacy;
15
+ exports.OrganisationPatchBodyBodyDefaultProductPrivacy = require_api_schemas.OrganisationPatchBodyBodyDefaultProductPrivacy;
16
+ exports.OrganisationPostBodyBodyDefaultProductPrivacy = require_api_schemas.OrganisationPostBodyBodyDefaultProductPrivacy;
17
+ exports.OrganisationUnitPostBodyBodyDefaultProductPrivacy = require_api_schemas.OrganisationUnitPostBodyBodyDefaultProductPrivacy;
18
+ exports.ProcessingChargesMerchantKind = require_api_schemas.ProcessingChargesMerchantKind;
19
+ exports.ProductChargesGetResponseProductType = require_api_schemas.ProductChargesGetResponseProductType;
20
+ exports.ProductDetailFlavour = require_api_schemas.ProductDetailFlavour;
21
+ exports.ProductDetailType = require_api_schemas.ProductDetailType;
22
+ exports.ProductTypeServiceKind = require_api_schemas.ProductTypeServiceKind;
23
+ exports.QFormatParameter = require_api_schemas.QFormatParameter;
24
+ exports.UnitAllDetailDefaultProductPrivacy = require_api_schemas.UnitAllDetailDefaultProductPrivacy;
25
+ exports.UnitDetailDefaultProductPrivacy = require_api_schemas.UnitDetailDefaultProductPrivacy;
26
+ exports.UnitPatchBodyBodyDefaultProductPrivacy = require_api_schemas.UnitPatchBodyBodyDefaultProductPrivacy;
27
+ exports.UnitProductPostBodyBodyFlavour = require_api_schemas.UnitProductPostBodyBodyFlavour;
28
+ exports.UnitProductPostBodyBodyType = require_api_schemas.UnitProductPostBodyBodyType;
29
+ exports.customInstance = require_custom_instance.customInstance;
30
+ exports.setAuthToken = require_custom_instance.setAuthToken;
31
+ exports.setBaseUrl = require_custom_instance.setBaseUrl;