@squonk/account-server-client 4.2.5 → 4.4.0-4-4.2174353771

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 (92) hide show
  1. package/actions/actions.cjs +53 -0
  2. package/actions/actions.cjs.map +1 -0
  3. package/actions/actions.d.cts +72 -0
  4. package/actions/actions.d.ts +72 -0
  5. package/actions/actions.js +53 -0
  6. package/actions/actions.js.map +1 -0
  7. package/actions/package.json +7 -0
  8. package/asset/asset.cjs +99 -126
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +99 -99
  11. package/asset/asset.d.ts +99 -99
  12. package/asset/asset.js +107 -134
  13. package/asset/asset.js.map +1 -1
  14. package/charges/charges.cjs +73 -85
  15. package/charges/charges.cjs.map +1 -1
  16. package/charges/charges.d.cts +47 -47
  17. package/charges/charges.d.ts +47 -47
  18. package/charges/charges.js +78 -90
  19. package/charges/charges.js.map +1 -1
  20. package/chunk-76ADQBHZ.js +25 -0
  21. package/chunk-76ADQBHZ.js.map +1 -0
  22. package/chunk-KHB5TJT7.cjs +25 -0
  23. package/chunk-KHB5TJT7.cjs.map +1 -0
  24. package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
  25. package/chunk-RB2KVIEK.cjs.map +1 -0
  26. package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
  27. package/chunk-XYDLYMQ2.js.map +1 -0
  28. package/event-stream/event-stream.cjs +53 -61
  29. package/event-stream/event-stream.cjs.map +1 -1
  30. package/event-stream/event-stream.d.cts +44 -44
  31. package/event-stream/event-stream.d.ts +44 -44
  32. package/event-stream/event-stream.js +58 -66
  33. package/event-stream/event-stream.js.map +1 -1
  34. package/index.cjs +56 -58
  35. package/index.cjs.map +1 -1
  36. package/index.d.cts +867 -777
  37. package/index.d.ts +867 -777
  38. package/index.js +55 -57
  39. package/index.js.map +1 -1
  40. package/merchant/merchant.cjs +38 -45
  41. package/merchant/merchant.cjs.map +1 -1
  42. package/merchant/merchant.d.cts +25 -25
  43. package/merchant/merchant.d.ts +25 -25
  44. package/merchant/merchant.js +42 -49
  45. package/merchant/merchant.js.map +1 -1
  46. package/organisation/organisation.cjs +77 -87
  47. package/organisation/organisation.cjs.map +1 -1
  48. package/organisation/organisation.d.cts +72 -70
  49. package/organisation/organisation.d.ts +72 -70
  50. package/organisation/organisation.js +83 -93
  51. package/organisation/organisation.js.map +1 -1
  52. package/package.json +15 -18
  53. package/product/product.cjs +143 -153
  54. package/product/product.cjs.map +1 -1
  55. package/product/product.d.cts +100 -100
  56. package/product/product.d.ts +100 -100
  57. package/product/product.js +153 -163
  58. package/product/product.js.map +1 -1
  59. package/src/{account-server-api.schemas.ts → API_TARGET_NAME.schemas.ts} +931 -849
  60. package/src/actions/actions.ts +249 -0
  61. package/src/asset/asset.ts +899 -634
  62. package/src/charges/charges.ts +822 -498
  63. package/src/custom-instance.ts +3 -3
  64. package/src/event-stream/event-stream.ts +530 -344
  65. package/src/index.ts +3 -3
  66. package/src/merchant/merchant.ts +355 -234
  67. package/src/options-mutator.ts +27 -0
  68. package/src/organisation/organisation.ts +812 -504
  69. package/src/product/product.ts +1373 -841
  70. package/src/state/state.ts +174 -127
  71. package/src/unit/unit.ts +1273 -603
  72. package/src/user/user.ts +895 -564
  73. package/state/state.cjs +22 -24
  74. package/state/state.cjs.map +1 -1
  75. package/state/state.d.cts +14 -14
  76. package/state/state.d.ts +14 -14
  77. package/state/state.js +24 -26
  78. package/state/state.js.map +1 -1
  79. package/unit/unit.cjs +171 -106
  80. package/unit/unit.cjs.map +1 -1
  81. package/unit/unit.d.cts +200 -90
  82. package/unit/unit.d.ts +200 -90
  83. package/unit/unit.js +179 -114
  84. package/unit/unit.js.map +1 -1
  85. package/user/user.cjs +94 -110
  86. package/user/user.cjs.map +1 -1
  87. package/user/user.d.cts +77 -77
  88. package/user/user.d.ts +77 -77
  89. package/user/user.js +101 -117
  90. package/user/user.js.map +1 -1
  91. package/chunk-EBOQPVLG.js.map +0 -1
  92. package/chunk-TKLTUR4R.cjs.map +0 -1
package/src/unit/unit.ts CHANGED
@@ -1,24 +1,20 @@
1
- // @ts-nocheck
2
1
  /**
3
- * Generated by orval v7.4.1 🍺
2
+ * Generated by orval v7.10.0 🍺
4
3
  * Do not edit manually.
5
4
  * Account Server API
6
5
  * The Informatics Matters Account Server API.
7
6
 
8
7
  A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
9
8
 
10
- * OpenAPI spec version: 4.2
9
+ * OpenAPI spec version: 4.4
11
10
  */
12
- import {
13
- useMutation,
14
- useQuery,
15
- useSuspenseQuery
16
- } from '@tanstack/react-query'
11
+ import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
17
12
  import type {
18
13
  DataTag,
19
14
  DefinedInitialDataOptions,
20
15
  DefinedUseQueryResult,
21
16
  MutationFunction,
17
+ QueryClient,
22
18
  QueryFunction,
23
19
  QueryKey,
24
20
  UndefinedInitialDataOptions,
@@ -27,8 +23,9 @@ import type {
27
23
  UseQueryOptions,
28
24
  UseQueryResult,
29
25
  UseSuspenseQueryOptions,
30
- UseSuspenseQueryResult
31
- } from '@tanstack/react-query'
26
+ UseSuspenseQueryResult,
27
+ } from "@tanstack/react-query";
28
+
32
29
  import type {
33
30
  AsError,
34
31
  GetUnitsParams,
@@ -39,14 +36,15 @@ import type {
39
36
  PersonalUnitPutResponse,
40
37
  UnitAllDetail,
41
38
  UnitPatchBodyBody,
42
- UnitsGetResponse
43
- } from '../account-server-api.schemas'
44
- import { customInstance } from '.././custom-instance';
45
- import type { ErrorType } from '.././custom-instance';
46
-
39
+ UnitsGetResponse,
40
+ } from "../API_TARGET_NAME.schemas";
47
41
 
48
- type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
42
+ import { customInstance } from ".././custom-instance";
43
+ import type { ErrorType } from ".././custom-instance";
44
+ import { queryMutator } from ".././options-mutator";
45
+ import { mutationMutator } from ".././options-mutator";
49
46
 
47
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
50
48
 
51
49
  /**
52
50
  * Gets Organisational Units you have access to or that are public
@@ -54,143 +52,237 @@ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
54
52
  * @summary Gets Organisational Units
55
53
  */
56
54
  export const getOrganisationUnits = (
57
- orgId: string,
58
- options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
55
+ orgId: string,
56
+ options?: SecondParameter<typeof customInstance>,
57
+ signal?: AbortSignal,
59
58
  ) => {
60
-
61
-
62
- return customInstance<OrganisationUnitsGetResponse>(
63
- {url: `/organisation/${orgId}/unit`, method: 'GET', signal
64
- },
65
- options);
66
- }
67
-
68
-
69
- export const getGetOrganisationUnitsQueryKey = (orgId: string,) => {
70
- return ["account-server-api", `/organisation/${orgId}/unit`] as const;
71
- }
72
-
73
-
74
- export const getGetOrganisationUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
59
+ return customInstance<OrganisationUnitsGetResponse>(
60
+ { url: `/organisation/${orgId}/unit`, method: "GET", signal },
61
+ options,
62
+ );
63
+ };
64
+
65
+ export const getGetOrganisationUnitsQueryKey = (orgId: string) => {
66
+ return [`/organisation/${orgId}/unit`] as const;
67
+ };
68
+
69
+ export const useGetOrganisationUnitsQueryOptions = <
70
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
71
+ TError = ErrorType<void | AsError>,
72
+ >(
73
+ orgId: string,
74
+ options?: {
75
+ query?: Partial<
76
+ UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
77
+ >;
78
+ request?: SecondParameter<typeof customInstance>;
79
+ },
75
80
  ) => {
76
-
77
- const {query: queryOptions, request: requestOptions} = options ?? {};
78
-
79
- const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
80
-
81
-
82
-
83
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
84
-
85
-
86
-
87
-
88
-
89
- return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
90
- }
91
-
92
- export type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>
93
- export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>
94
-
95
-
96
- export function useGetOrganisationUnits<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
97
- orgId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>> & Pick<
81
+ const { query: queryOptions, request: requestOptions } = options ?? {};
82
+
83
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
84
+
85
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) =>
86
+ getOrganisationUnits(orgId, requestOptions, signal);
87
+
88
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
89
+
90
+ return customOptions as UseQueryOptions<
91
+ Awaited<ReturnType<typeof getOrganisationUnits>>,
92
+ TError,
93
+ TData
94
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
95
+ };
96
+
97
+ export type GetOrganisationUnitsQueryResult = NonNullable<
98
+ Awaited<ReturnType<typeof getOrganisationUnits>>
99
+ >;
100
+ export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
101
+
102
+ export function useGetOrganisationUnits<
103
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
104
+ TError = ErrorType<void | AsError>,
105
+ >(
106
+ orgId: string,
107
+ options: {
108
+ query: Partial<
109
+ UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
110
+ > &
111
+ Pick<
98
112
  DefinedInitialDataOptions<
99
113
  Awaited<ReturnType<typeof getOrganisationUnits>>,
100
114
  TError,
101
- TData
102
- > , 'initialData'
103
- >, request?: SecondParameter<typeof customInstance>}
104
-
105
- ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
106
- export function useGetOrganisationUnits<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
107
- orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>> & Pick<
115
+ Awaited<ReturnType<typeof getOrganisationUnits>>
116
+ >,
117
+ "initialData"
118
+ >;
119
+ request?: SecondParameter<typeof customInstance>;
120
+ },
121
+ queryClient?: QueryClient,
122
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
123
+ export function useGetOrganisationUnits<
124
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
125
+ TError = ErrorType<void | AsError>,
126
+ >(
127
+ orgId: string,
128
+ options?: {
129
+ query?: Partial<
130
+ UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
131
+ > &
132
+ Pick<
108
133
  UndefinedInitialDataOptions<
109
134
  Awaited<ReturnType<typeof getOrganisationUnits>>,
110
135
  TError,
111
- TData
112
- > , 'initialData'
113
- >, request?: SecondParameter<typeof customInstance>}
114
-
115
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
116
- export function useGetOrganisationUnits<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
117
- orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
118
-
119
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
136
+ Awaited<ReturnType<typeof getOrganisationUnits>>
137
+ >,
138
+ "initialData"
139
+ >;
140
+ request?: SecondParameter<typeof customInstance>;
141
+ },
142
+ queryClient?: QueryClient,
143
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
144
+ export function useGetOrganisationUnits<
145
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
146
+ TError = ErrorType<void | AsError>,
147
+ >(
148
+ orgId: string,
149
+ options?: {
150
+ query?: Partial<
151
+ UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
152
+ >;
153
+ request?: SecondParameter<typeof customInstance>;
154
+ },
155
+ queryClient?: QueryClient,
156
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
120
157
  /**
121
158
  * @summary Gets Organisational Units
122
159
  */
123
160
 
124
- export function useGetOrganisationUnits<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
125
- orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
126
-
127
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
128
-
129
- const queryOptions = getGetOrganisationUnitsQueryOptions(orgId,options)
130
-
131
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
132
-
133
- query.queryKey = queryOptions.queryKey ;
161
+ export function useGetOrganisationUnits<
162
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
163
+ TError = ErrorType<void | AsError>,
164
+ >(
165
+ orgId: string,
166
+ options?: {
167
+ query?: Partial<
168
+ UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
169
+ >;
170
+ request?: SecondParameter<typeof customInstance>;
171
+ },
172
+ queryClient?: QueryClient,
173
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
174
+ const queryOptions = useGetOrganisationUnitsQueryOptions(orgId, options);
175
+
176
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
177
+ queryKey: DataTag<QueryKey, TData, TError>;
178
+ };
179
+
180
+ query.queryKey = queryOptions.queryKey;
134
181
 
135
182
  return query;
136
183
  }
137
184
 
138
-
139
-
140
- export const getGetOrganisationUnitsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
185
+ export const useGetOrganisationUnitsSuspenseQueryOptions = <
186
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
187
+ TError = ErrorType<void | AsError>,
188
+ >(
189
+ orgId: string,
190
+ options?: {
191
+ query?: Partial<
192
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
193
+ >;
194
+ request?: SecondParameter<typeof customInstance>;
195
+ },
141
196
  ) => {
142
-
143
- const {query: queryOptions, request: requestOptions} = options ?? {};
144
-
145
- const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
146
-
147
-
148
-
149
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
150
-
151
-
152
-
153
-
154
-
155
- return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
156
- }
157
-
158
- export type GetOrganisationUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>
159
- export type GetOrganisationUnitsSuspenseQueryError = ErrorType<void | AsError>
160
-
161
-
162
- export function useGetOrganisationUnitsSuspense<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
163
- orgId: string, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
164
-
165
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
166
- export function useGetOrganisationUnitsSuspense<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
167
- orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
168
-
169
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
170
- export function useGetOrganisationUnitsSuspense<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
171
- orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
172
-
173
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
197
+ const { query: queryOptions, request: requestOptions } = options ?? {};
198
+
199
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
200
+
201
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) =>
202
+ getOrganisationUnits(orgId, requestOptions, signal);
203
+
204
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
205
+
206
+ return customOptions as UseSuspenseQueryOptions<
207
+ Awaited<ReturnType<typeof getOrganisationUnits>>,
208
+ TError,
209
+ TData
210
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
211
+ };
212
+
213
+ export type GetOrganisationUnitsSuspenseQueryResult = NonNullable<
214
+ Awaited<ReturnType<typeof getOrganisationUnits>>
215
+ >;
216
+ export type GetOrganisationUnitsSuspenseQueryError = ErrorType<void | AsError>;
217
+
218
+ export function useGetOrganisationUnitsSuspense<
219
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
220
+ TError = ErrorType<void | AsError>,
221
+ >(
222
+ orgId: string,
223
+ options: {
224
+ query: Partial<
225
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
226
+ >;
227
+ request?: SecondParameter<typeof customInstance>;
228
+ },
229
+ queryClient?: QueryClient,
230
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
231
+ export function useGetOrganisationUnitsSuspense<
232
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
233
+ TError = ErrorType<void | AsError>,
234
+ >(
235
+ orgId: string,
236
+ options?: {
237
+ query?: Partial<
238
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
239
+ >;
240
+ request?: SecondParameter<typeof customInstance>;
241
+ },
242
+ queryClient?: QueryClient,
243
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
244
+ export function useGetOrganisationUnitsSuspense<
245
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
246
+ TError = ErrorType<void | AsError>,
247
+ >(
248
+ orgId: string,
249
+ options?: {
250
+ query?: Partial<
251
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
252
+ >;
253
+ request?: SecondParameter<typeof customInstance>;
254
+ },
255
+ queryClient?: QueryClient,
256
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
174
257
  /**
175
258
  * @summary Gets Organisational Units
176
259
  */
177
260
 
178
- export function useGetOrganisationUnitsSuspense<TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
179
- orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
180
-
181
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
182
-
183
- const queryOptions = getGetOrganisationUnitsSuspenseQueryOptions(orgId,options)
184
-
185
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
186
-
187
- query.queryKey = queryOptions.queryKey ;
261
+ export function useGetOrganisationUnitsSuspense<
262
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
263
+ TError = ErrorType<void | AsError>,
264
+ >(
265
+ orgId: string,
266
+ options?: {
267
+ query?: Partial<
268
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>
269
+ >;
270
+ request?: SecondParameter<typeof customInstance>;
271
+ },
272
+ queryClient?: QueryClient,
273
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
274
+ const queryOptions = useGetOrganisationUnitsSuspenseQueryOptions(orgId, options);
275
+
276
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
277
+ TData,
278
+ TError
279
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
280
+
281
+ query.queryKey = queryOptions.queryKey;
188
282
 
189
283
  return query;
190
284
  }
191
285
 
192
-
193
-
194
286
  /**
195
287
  * Creates a new Organisation Unit.
196
288
 
@@ -201,277 +293,389 @@ You need to be a member of the **Organisation** or have administration rights t
201
293
  * @summary Create a new Organisational Unit
202
294
  */
203
295
  export const createOrganisationUnit = (
204
- orgId: string,
205
- organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,
206
- options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
296
+ orgId: string,
297
+ organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,
298
+ options?: SecondParameter<typeof customInstance>,
299
+ signal?: AbortSignal,
207
300
  ) => {
208
-
209
-
210
- return customInstance<OrganisationUnitPostResponse>(
211
- {url: `/organisation/${orgId}/unit`, method: 'POST',
212
- headers: {'Content-Type': 'application/json', },
213
- data: organisationUnitPostBodyBody, signal
301
+ return customInstance<OrganisationUnitPostResponse>(
302
+ {
303
+ url: `/organisation/${orgId}/unit`,
304
+ method: "POST",
305
+ headers: { "Content-Type": "application/json" },
306
+ data: organisationUnitPostBodyBody,
307
+ signal,
214
308
  },
215
- options);
216
- }
217
-
218
-
219
-
220
- export const getCreateOrganisationUnitMutationOptions = <TData = Awaited<ReturnType<typeof createOrganisationUnit>>, TError = ErrorType<AsError | void>,
221
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
222
- ) => {
223
- const mutationKey = ['createOrganisationUnit'];
224
- const {mutation: mutationOptions, request: requestOptions} = options ?
225
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
226
- options
227
- : {...options, mutation: {...options.mutation, mutationKey}}
228
- : {mutation: { mutationKey, }, request: undefined};
229
-
230
-
231
-
309
+ options,
310
+ );
311
+ };
312
+
313
+ export const useCreateOrganisationUnitMutationOptions = <
314
+ TError = ErrorType<AsError | void>,
315
+ TContext = unknown,
316
+ >(options?: {
317
+ mutation?: UseMutationOptions<
318
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
319
+ TError,
320
+ { orgId: string; data: OrganisationUnitPostBodyBody },
321
+ TContext
322
+ >;
323
+ request?: SecondParameter<typeof customInstance>;
324
+ }): UseMutationOptions<
325
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
326
+ TError,
327
+ { orgId: string; data: OrganisationUnitPostBodyBody },
328
+ TContext
329
+ > => {
330
+ const mutationKey = ["createOrganisationUnit"];
331
+ const { mutation: mutationOptions, request: requestOptions } = options
332
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
333
+ ? options
334
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
335
+ : { mutation: { mutationKey }, request: undefined };
336
+
337
+ const mutationFn: MutationFunction<
338
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
339
+ { orgId: string; data: OrganisationUnitPostBodyBody }
340
+ > = (props) => {
341
+ const { orgId, data } = props ?? {};
342
+
343
+ return createOrganisationUnit(orgId, data, requestOptions);
344
+ };
345
+
346
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
347
+
348
+ return customOptions;
349
+ };
350
+
351
+ export type CreateOrganisationUnitMutationResult = NonNullable<
352
+ Awaited<ReturnType<typeof createOrganisationUnit>>
353
+ >;
354
+ export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
355
+ export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
232
356
 
233
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisationUnit>>, {orgId: string;data: OrganisationUnitPostBodyBody}> = (props) => {
234
- const {orgId,data} = props ?? {};
235
-
236
- return createOrganisationUnit(orgId,data,requestOptions)
237
- }
238
-
239
-
240
-
241
-
242
- return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>}
243
-
244
- export type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>
245
- export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody
246
- export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>
247
-
248
- /**
357
+ /**
249
358
  * @summary Create a new Organisational Unit
250
359
  */
251
- export const useCreateOrganisationUnit = <TData = Awaited<ReturnType<typeof createOrganisationUnit>>, TError = ErrorType<AsError | void>,
252
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
360
+ export const useCreateOrganisationUnit = <TError = ErrorType<AsError | void>, TContext = unknown>(
361
+ options?: {
362
+ mutation?: UseMutationOptions<
363
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
364
+ TError,
365
+ { orgId: string; data: OrganisationUnitPostBodyBody },
366
+ TContext
367
+ >;
368
+ request?: SecondParameter<typeof customInstance>;
369
+ },
370
+ queryClient?: QueryClient,
253
371
  ): UseMutationResult<
254
- TData,
255
- TError,
256
- {orgId: string;data: OrganisationUnitPostBodyBody},
257
- TContext
258
- > => {
259
-
260
- const mutationOptions = getCreateOrganisationUnitMutationOptions(options);
261
-
262
- return useMutation(mutationOptions);
263
- }
264
- /**
372
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
373
+ TError,
374
+ { orgId: string; data: OrganisationUnitPostBodyBody },
375
+ TContext
376
+ > => {
377
+ const mutationOptions = useCreateOrganisationUnitMutationOptions(options);
378
+
379
+ return useMutation(mutationOptions, queryClient);
380
+ };
381
+ /**
265
382
  * Gets a Unit. You can get a Unit if you are a member of it or are its creator. You can also get a Unit if you are a member of its **Organisation**, or its creator or an admin user.
266
383
 
267
384
  * @summary Gets an Organisational Unit
268
385
  */
269
386
  export const getUnit = (
270
- unitId: string,
271
- options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
387
+ unitId: string,
388
+ options?: SecondParameter<typeof customInstance>,
389
+ signal?: AbortSignal,
272
390
  ) => {
273
-
274
-
275
- return customInstance<UnitAllDetail>(
276
- {url: `/unit/${unitId}`, method: 'GET', signal
277
- },
278
- options);
279
- }
280
-
281
-
282
- export const getGetUnitQueryKey = (unitId: string,) => {
283
- return ["account-server-api", `/unit/${unitId}`] as const;
284
- }
285
-
286
-
287
- export const getGetUnitQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
391
+ return customInstance<UnitAllDetail>({ url: `/unit/${unitId}`, method: "GET", signal }, options);
392
+ };
393
+
394
+ export const getGetUnitQueryKey = (unitId: string) => {
395
+ return [`/unit/${unitId}`] as const;
396
+ };
397
+
398
+ export const useGetUnitQueryOptions = <
399
+ TData = Awaited<ReturnType<typeof getUnit>>,
400
+ TError = ErrorType<void | AsError>,
401
+ >(
402
+ unitId: string,
403
+ options?: {
404
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
405
+ request?: SecondParameter<typeof customInstance>;
406
+ },
288
407
  ) => {
408
+ const { query: queryOptions, request: requestOptions } = options ?? {};
289
409
 
290
- const {query: queryOptions, request: requestOptions} = options ?? {};
291
-
292
- const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
410
+ const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
293
411
 
294
-
412
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) =>
413
+ getUnit(unitId, requestOptions, signal);
295
414
 
296
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);
415
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
297
416
 
298
-
417
+ return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & {
418
+ queryKey: DataTag<QueryKey, TData, TError>;
419
+ };
420
+ };
299
421
 
300
-
422
+ export type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
423
+ export type GetUnitQueryError = ErrorType<void | AsError>;
301
424
 
302
- return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
303
- }
304
-
305
- export type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>
306
- export type GetUnitQueryError = ErrorType<void | AsError>
307
-
308
-
309
- export function useGetUnit<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
310
- unitId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>> & Pick<
425
+ export function useGetUnit<
426
+ TData = Awaited<ReturnType<typeof getUnit>>,
427
+ TError = ErrorType<void | AsError>,
428
+ >(
429
+ unitId: string,
430
+ options: {
431
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>> &
432
+ Pick<
311
433
  DefinedInitialDataOptions<
312
434
  Awaited<ReturnType<typeof getUnit>>,
313
435
  TError,
314
- TData
315
- > , 'initialData'
316
- >, request?: SecondParameter<typeof customInstance>}
317
-
318
- ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
319
- export function useGetUnit<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
320
- unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>> & Pick<
436
+ Awaited<ReturnType<typeof getUnit>>
437
+ >,
438
+ "initialData"
439
+ >;
440
+ request?: SecondParameter<typeof customInstance>;
441
+ },
442
+ queryClient?: QueryClient,
443
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
444
+ export function useGetUnit<
445
+ TData = Awaited<ReturnType<typeof getUnit>>,
446
+ TError = ErrorType<void | AsError>,
447
+ >(
448
+ unitId: string,
449
+ options?: {
450
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>> &
451
+ Pick<
321
452
  UndefinedInitialDataOptions<
322
453
  Awaited<ReturnType<typeof getUnit>>,
323
454
  TError,
324
- TData
325
- > , 'initialData'
326
- >, request?: SecondParameter<typeof customInstance>}
327
-
328
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
329
- export function useGetUnit<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
330
- unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
331
-
332
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
455
+ Awaited<ReturnType<typeof getUnit>>
456
+ >,
457
+ "initialData"
458
+ >;
459
+ request?: SecondParameter<typeof customInstance>;
460
+ },
461
+ queryClient?: QueryClient,
462
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
463
+ export function useGetUnit<
464
+ TData = Awaited<ReturnType<typeof getUnit>>,
465
+ TError = ErrorType<void | AsError>,
466
+ >(
467
+ unitId: string,
468
+ options?: {
469
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
470
+ request?: SecondParameter<typeof customInstance>;
471
+ },
472
+ queryClient?: QueryClient,
473
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
333
474
  /**
334
475
  * @summary Gets an Organisational Unit
335
476
  */
336
477
 
337
- export function useGetUnit<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
338
- unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
339
-
340
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
341
-
342
- const queryOptions = getGetUnitQueryOptions(unitId,options)
343
-
344
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
345
-
346
- query.queryKey = queryOptions.queryKey ;
478
+ export function useGetUnit<
479
+ TData = Awaited<ReturnType<typeof getUnit>>,
480
+ TError = ErrorType<void | AsError>,
481
+ >(
482
+ unitId: string,
483
+ options?: {
484
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
485
+ request?: SecondParameter<typeof customInstance>;
486
+ },
487
+ queryClient?: QueryClient,
488
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
489
+ const queryOptions = useGetUnitQueryOptions(unitId, options);
490
+
491
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
492
+ queryKey: DataTag<QueryKey, TData, TError>;
493
+ };
494
+
495
+ query.queryKey = queryOptions.queryKey;
347
496
 
348
497
  return query;
349
498
  }
350
499
 
351
-
352
-
353
- export const getGetUnitSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
500
+ export const useGetUnitSuspenseQueryOptions = <
501
+ TData = Awaited<ReturnType<typeof getUnit>>,
502
+ TError = ErrorType<void | AsError>,
503
+ >(
504
+ unitId: string,
505
+ options?: {
506
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
507
+ request?: SecondParameter<typeof customInstance>;
508
+ },
354
509
  ) => {
355
-
356
- const {query: queryOptions, request: requestOptions} = options ?? {};
357
-
358
- const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
359
-
360
-
361
-
362
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);
363
-
364
-
365
-
366
-
367
-
368
- return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
369
- }
370
-
371
- export type GetUnitSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>
372
- export type GetUnitSuspenseQueryError = ErrorType<void | AsError>
373
-
374
-
375
- export function useGetUnitSuspense<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
376
- unitId: string, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
377
-
378
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
379
- export function useGetUnitSuspense<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
380
- unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
381
-
382
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
383
- export function useGetUnitSuspense<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
384
- unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
385
-
386
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
510
+ const { query: queryOptions, request: requestOptions } = options ?? {};
511
+
512
+ const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
513
+
514
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) =>
515
+ getUnit(unitId, requestOptions, signal);
516
+
517
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
518
+
519
+ return customOptions as UseSuspenseQueryOptions<
520
+ Awaited<ReturnType<typeof getUnit>>,
521
+ TError,
522
+ TData
523
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
524
+ };
525
+
526
+ export type GetUnitSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
527
+ export type GetUnitSuspenseQueryError = ErrorType<void | AsError>;
528
+
529
+ export function useGetUnitSuspense<
530
+ TData = Awaited<ReturnType<typeof getUnit>>,
531
+ TError = ErrorType<void | AsError>,
532
+ >(
533
+ unitId: string,
534
+ options: {
535
+ query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
536
+ request?: SecondParameter<typeof customInstance>;
537
+ },
538
+ queryClient?: QueryClient,
539
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
540
+ export function useGetUnitSuspense<
541
+ TData = Awaited<ReturnType<typeof getUnit>>,
542
+ TError = ErrorType<void | AsError>,
543
+ >(
544
+ unitId: string,
545
+ options?: {
546
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
547
+ request?: SecondParameter<typeof customInstance>;
548
+ },
549
+ queryClient?: QueryClient,
550
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
551
+ export function useGetUnitSuspense<
552
+ TData = Awaited<ReturnType<typeof getUnit>>,
553
+ TError = ErrorType<void | AsError>,
554
+ >(
555
+ unitId: string,
556
+ options?: {
557
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
558
+ request?: SecondParameter<typeof customInstance>;
559
+ },
560
+ queryClient?: QueryClient,
561
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
387
562
  /**
388
563
  * @summary Gets an Organisational Unit
389
564
  */
390
565
 
391
- export function useGetUnitSuspense<TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
392
- unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
393
-
394
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
395
-
396
- const queryOptions = getGetUnitSuspenseQueryOptions(unitId,options)
397
-
398
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
399
-
400
- query.queryKey = queryOptions.queryKey ;
566
+ export function useGetUnitSuspense<
567
+ TData = Awaited<ReturnType<typeof getUnit>>,
568
+ TError = ErrorType<void | AsError>,
569
+ >(
570
+ unitId: string,
571
+ options?: {
572
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>;
573
+ request?: SecondParameter<typeof customInstance>;
574
+ },
575
+ queryClient?: QueryClient,
576
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
577
+ const queryOptions = useGetUnitSuspenseQueryOptions(unitId, options);
578
+
579
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
580
+ TData,
581
+ TError
582
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
583
+
584
+ query.queryKey = queryOptions.queryKey;
401
585
 
402
586
  return query;
403
587
  }
404
588
 
405
-
406
-
407
589
  /**
408
- * Used to update existing Unit.
590
+ * Used to update existing Unit. You can change a Unit's **name** or its **default_product_privacy** (as long as the new privacy does not conflict with the Organisation's value).
409
591
 
410
592
  You have to be a member of the **Unit**, a member of its **Organisation**, or an administrator to patch a Unit.
411
593
 
412
594
  * @summary Adjust an existing Unit
413
595
  */
414
596
  export const patchUnit = (
415
- unitId: string,
416
- unitPatchBodyBody: UnitPatchBodyBody,
417
- options?: SecondParameter<typeof customInstance>,) => {
418
-
419
-
420
- return customInstance<void>(
421
- {url: `/unit/${unitId}`, method: 'PATCH',
422
- headers: {'Content-Type': 'application/json', },
423
- data: unitPatchBodyBody
424
- },
425
- options);
426
- }
427
-
428
-
429
-
430
- export const getPatchUnitMutationOptions = <TData = Awaited<ReturnType<typeof patchUnit>>, TError = ErrorType<void | AsError>,
431
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
597
+ unitId: string,
598
+ unitPatchBodyBody: UnitPatchBodyBody,
599
+ options?: SecondParameter<typeof customInstance>,
432
600
  ) => {
433
- const mutationKey = ['patchUnit'];
434
- const {mutation: mutationOptions, request: requestOptions} = options ?
435
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
436
- options
437
- : {...options, mutation: {...options.mutation, mutationKey}}
438
- : {mutation: { mutationKey, }, request: undefined};
439
-
440
-
441
-
442
-
443
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchUnit>>, {unitId: string;data: UnitPatchBodyBody}> = (props) => {
444
- const {unitId,data} = props ?? {};
445
-
446
- return patchUnit(unitId,data,requestOptions)
447
- }
448
-
449
-
450
-
451
-
452
- return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>}
453
-
454
- export type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>
455
- export type PatchUnitMutationBody = UnitPatchBodyBody
456
- export type PatchUnitMutationError = ErrorType<void | AsError>
601
+ return customInstance<void>(
602
+ {
603
+ url: `/unit/${unitId}`,
604
+ method: "PATCH",
605
+ headers: { "Content-Type": "application/json" },
606
+ data: unitPatchBodyBody,
607
+ },
608
+ options,
609
+ );
610
+ };
611
+
612
+ export const usePatchUnitMutationOptions = <
613
+ TError = ErrorType<void | AsError>,
614
+ TContext = unknown,
615
+ >(options?: {
616
+ mutation?: UseMutationOptions<
617
+ Awaited<ReturnType<typeof patchUnit>>,
618
+ TError,
619
+ { unitId: string; data: UnitPatchBodyBody },
620
+ TContext
621
+ >;
622
+ request?: SecondParameter<typeof customInstance>;
623
+ }): UseMutationOptions<
624
+ Awaited<ReturnType<typeof patchUnit>>,
625
+ TError,
626
+ { unitId: string; data: UnitPatchBodyBody },
627
+ TContext
628
+ > => {
629
+ const mutationKey = ["patchUnit"];
630
+ const { mutation: mutationOptions, request: requestOptions } = options
631
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
632
+ ? options
633
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
634
+ : { mutation: { mutationKey }, request: undefined };
635
+
636
+ const mutationFn: MutationFunction<
637
+ Awaited<ReturnType<typeof patchUnit>>,
638
+ { unitId: string; data: UnitPatchBodyBody }
639
+ > = (props) => {
640
+ const { unitId, data } = props ?? {};
641
+
642
+ return patchUnit(unitId, data, requestOptions);
643
+ };
644
+
645
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
646
+
647
+ return customOptions;
648
+ };
649
+
650
+ export type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>;
651
+ export type PatchUnitMutationBody = UnitPatchBodyBody;
652
+ export type PatchUnitMutationError = ErrorType<void | AsError>;
457
653
 
458
- /**
654
+ /**
459
655
  * @summary Adjust an existing Unit
460
656
  */
461
- export const usePatchUnit = <TData = Awaited<ReturnType<typeof patchUnit>>, TError = ErrorType<void | AsError>,
462
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
657
+ export const usePatchUnit = <TError = ErrorType<void | AsError>, TContext = unknown>(
658
+ options?: {
659
+ mutation?: UseMutationOptions<
660
+ Awaited<ReturnType<typeof patchUnit>>,
661
+ TError,
662
+ { unitId: string; data: UnitPatchBodyBody },
663
+ TContext
664
+ >;
665
+ request?: SecondParameter<typeof customInstance>;
666
+ },
667
+ queryClient?: QueryClient,
463
668
  ): UseMutationResult<
464
- TData,
465
- TError,
466
- {unitId: string;data: UnitPatchBodyBody},
467
- TContext
468
- > => {
469
-
470
- const mutationOptions = getPatchUnitMutationOptions(options);
471
-
472
- return useMutation(mutationOptions);
473
- }
474
- /**
669
+ Awaited<ReturnType<typeof patchUnit>>,
670
+ TError,
671
+ { unitId: string; data: UnitPatchBodyBody },
672
+ TContext
673
+ > => {
674
+ const mutationOptions = usePatchUnitMutationOptions(options);
675
+
676
+ return useMutation(mutationOptions, queryClient);
677
+ };
678
+ /**
475
679
  * Deletes an Organisational Unit you have access to. Units can only be deleted by members of the Unit, its Organisation users or admin users.
476
680
 
477
681
  You cannot delete Units in the **Default Organisation**. These Units are **Personal Units** and need to be deleted using the `DELETE /unit` endpoint.
@@ -481,63 +685,438 @@ You cannot delete a Unit that contains undeleted **Products**
481
685
  * @summary Deletes an Organisational Unit
482
686
  */
483
687
  export const deleteOrganisationUnit = (
484
- unitId: string,
485
- options?: SecondParameter<typeof customInstance>,) => {
486
-
487
-
488
- return customInstance<void>(
489
- {url: `/unit/${unitId}`, method: 'DELETE'
490
- },
491
- options);
492
- }
493
-
494
-
688
+ unitId: string,
689
+ options?: SecondParameter<typeof customInstance>,
690
+ ) => {
691
+ return customInstance<void>({ url: `/unit/${unitId}`, method: "DELETE" }, options);
692
+ };
693
+
694
+ export const useDeleteOrganisationUnitMutationOptions = <
695
+ TError = ErrorType<void | AsError>,
696
+ TContext = unknown,
697
+ >(options?: {
698
+ mutation?: UseMutationOptions<
699
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
700
+ TError,
701
+ { unitId: string },
702
+ TContext
703
+ >;
704
+ request?: SecondParameter<typeof customInstance>;
705
+ }): UseMutationOptions<
706
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
707
+ TError,
708
+ { unitId: string },
709
+ TContext
710
+ > => {
711
+ const mutationKey = ["deleteOrganisationUnit"];
712
+ const { mutation: mutationOptions, request: requestOptions } = options
713
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
714
+ ? options
715
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
716
+ : { mutation: { mutationKey }, request: undefined };
717
+
718
+ const mutationFn: MutationFunction<
719
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
720
+ { unitId: string }
721
+ > = (props) => {
722
+ const { unitId } = props ?? {};
723
+
724
+ return deleteOrganisationUnit(unitId, requestOptions);
725
+ };
726
+
727
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
728
+
729
+ return customOptions;
730
+ };
731
+
732
+ export type DeleteOrganisationUnitMutationResult = NonNullable<
733
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>
734
+ >;
735
+
736
+ export type DeleteOrganisationUnitMutationError = ErrorType<void | AsError>;
495
737
 
496
- export const getDeleteOrganisationUnitMutationOptions = <TData = Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError = ErrorType<void | AsError>,
497
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
738
+ /**
739
+ * @summary Deletes an Organisational Unit
740
+ */
741
+ export const useDeleteOrganisationUnit = <TError = ErrorType<void | AsError>, TContext = unknown>(
742
+ options?: {
743
+ mutation?: UseMutationOptions<
744
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
745
+ TError,
746
+ { unitId: string },
747
+ TContext
748
+ >;
749
+ request?: SecondParameter<typeof customInstance>;
750
+ },
751
+ queryClient?: QueryClient,
752
+ ): UseMutationResult<
753
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
754
+ TError,
755
+ { unitId: string },
756
+ TContext
757
+ > => {
758
+ const mutationOptions = useDeleteOrganisationUnitMutationOptions(options);
759
+
760
+ return useMutation(mutationOptions, queryClient);
761
+ };
762
+ /**
763
+ * @summary Gets your Personal Unit (if you have one)
764
+ */
765
+ export const getPersonalUnit = (
766
+ options?: SecondParameter<typeof customInstance>,
767
+ signal?: AbortSignal,
498
768
  ) => {
499
- const mutationKey = ['deleteOrganisationUnit'];
500
- const {mutation: mutationOptions, request: requestOptions} = options ?
501
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
502
- options
503
- : {...options, mutation: {...options.mutation, mutationKey}}
504
- : {mutation: { mutationKey, }, request: undefined};
769
+ return customInstance<UnitAllDetail>({ url: `/personal-unit`, method: "GET", signal }, options);
770
+ };
771
+
772
+ export const getGetPersonalUnitQueryKey = () => {
773
+ return [`/personal-unit`] as const;
774
+ };
775
+
776
+ export const useGetPersonalUnitQueryOptions = <
777
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
778
+ TError = ErrorType<void | AsError>,
779
+ >(options?: {
780
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>>;
781
+ request?: SecondParameter<typeof customInstance>;
782
+ }) => {
783
+ const { query: queryOptions, request: requestOptions } = options ?? {};
784
+
785
+ const queryKey = queryOptions?.queryKey ?? getGetPersonalUnitQueryKey();
786
+
787
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getPersonalUnit>>> = ({ signal }) =>
788
+ getPersonalUnit(requestOptions, signal);
789
+
790
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
791
+
792
+ return customOptions as UseQueryOptions<
793
+ Awaited<ReturnType<typeof getPersonalUnit>>,
794
+ TError,
795
+ TData
796
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
797
+ };
798
+
799
+ export type GetPersonalUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getPersonalUnit>>>;
800
+ export type GetPersonalUnitQueryError = ErrorType<void | AsError>;
801
+
802
+ export function useGetPersonalUnit<
803
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
804
+ TError = ErrorType<void | AsError>,
805
+ >(
806
+ options: {
807
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>> &
808
+ Pick<
809
+ DefinedInitialDataOptions<
810
+ Awaited<ReturnType<typeof getPersonalUnit>>,
811
+ TError,
812
+ Awaited<ReturnType<typeof getPersonalUnit>>
813
+ >,
814
+ "initialData"
815
+ >;
816
+ request?: SecondParameter<typeof customInstance>;
817
+ },
818
+ queryClient?: QueryClient,
819
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
820
+ export function useGetPersonalUnit<
821
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
822
+ TError = ErrorType<void | AsError>,
823
+ >(
824
+ options?: {
825
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>> &
826
+ Pick<
827
+ UndefinedInitialDataOptions<
828
+ Awaited<ReturnType<typeof getPersonalUnit>>,
829
+ TError,
830
+ Awaited<ReturnType<typeof getPersonalUnit>>
831
+ >,
832
+ "initialData"
833
+ >;
834
+ request?: SecondParameter<typeof customInstance>;
835
+ },
836
+ queryClient?: QueryClient,
837
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
838
+ export function useGetPersonalUnit<
839
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
840
+ TError = ErrorType<void | AsError>,
841
+ >(
842
+ options?: {
843
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>>;
844
+ request?: SecondParameter<typeof customInstance>;
845
+ },
846
+ queryClient?: QueryClient,
847
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
848
+ /**
849
+ * @summary Gets your Personal Unit (if you have one)
850
+ */
505
851
 
506
-
852
+ export function useGetPersonalUnit<
853
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
854
+ TError = ErrorType<void | AsError>,
855
+ >(
856
+ options?: {
857
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>>;
858
+ request?: SecondParameter<typeof customInstance>;
859
+ },
860
+ queryClient?: QueryClient,
861
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
862
+ const queryOptions = useGetPersonalUnitQueryOptions(options);
507
863
 
864
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
865
+ queryKey: DataTag<QueryKey, TData, TError>;
866
+ };
508
867
 
509
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnit>>, {unitId: string}> = (props) => {
510
- const {unitId} = props ?? {};
868
+ query.queryKey = queryOptions.queryKey;
511
869
 
512
- return deleteOrganisationUnit(unitId,requestOptions)
513
- }
870
+ return query;
871
+ }
514
872
 
515
-
873
+ export const useGetPersonalUnitSuspenseQueryOptions = <
874
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
875
+ TError = ErrorType<void | AsError>,
876
+ >(options?: {
877
+ query?: Partial<
878
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>
879
+ >;
880
+ request?: SecondParameter<typeof customInstance>;
881
+ }) => {
882
+ const { query: queryOptions, request: requestOptions } = options ?? {};
883
+
884
+ const queryKey = queryOptions?.queryKey ?? getGetPersonalUnitQueryKey();
885
+
886
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getPersonalUnit>>> = ({ signal }) =>
887
+ getPersonalUnit(requestOptions, signal);
888
+
889
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
890
+
891
+ return customOptions as UseSuspenseQueryOptions<
892
+ Awaited<ReturnType<typeof getPersonalUnit>>,
893
+ TError,
894
+ TData
895
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
896
+ };
897
+
898
+ export type GetPersonalUnitSuspenseQueryResult = NonNullable<
899
+ Awaited<ReturnType<typeof getPersonalUnit>>
900
+ >;
901
+ export type GetPersonalUnitSuspenseQueryError = ErrorType<void | AsError>;
902
+
903
+ export function useGetPersonalUnitSuspense<
904
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
905
+ TError = ErrorType<void | AsError>,
906
+ >(
907
+ options: {
908
+ query: Partial<
909
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>
910
+ >;
911
+ request?: SecondParameter<typeof customInstance>;
912
+ },
913
+ queryClient?: QueryClient,
914
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
915
+ export function useGetPersonalUnitSuspense<
916
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
917
+ TError = ErrorType<void | AsError>,
918
+ >(
919
+ options?: {
920
+ query?: Partial<
921
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>
922
+ >;
923
+ request?: SecondParameter<typeof customInstance>;
924
+ },
925
+ queryClient?: QueryClient,
926
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
927
+ export function useGetPersonalUnitSuspense<
928
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
929
+ TError = ErrorType<void | AsError>,
930
+ >(
931
+ options?: {
932
+ query?: Partial<
933
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>
934
+ >;
935
+ request?: SecondParameter<typeof customInstance>;
936
+ },
937
+ queryClient?: QueryClient,
938
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
939
+ /**
940
+ * @summary Gets your Personal Unit (if you have one)
941
+ */
942
+
943
+ export function useGetPersonalUnitSuspense<
944
+ TData = Awaited<ReturnType<typeof getPersonalUnit>>,
945
+ TError = ErrorType<void | AsError>,
946
+ >(
947
+ options?: {
948
+ query?: Partial<
949
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getPersonalUnit>>, TError, TData>
950
+ >;
951
+ request?: SecondParameter<typeof customInstance>;
952
+ },
953
+ queryClient?: QueryClient,
954
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
955
+ const queryOptions = useGetPersonalUnitSuspenseQueryOptions(options);
956
+
957
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
958
+ TData,
959
+ TError
960
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
961
+
962
+ query.queryKey = queryOptions.queryKey;
516
963
 
964
+ return query;
965
+ }
517
966
 
518
- return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{unitId: string}, TContext>}
967
+ /**
968
+ * Creates a Personal Unit for a User. The unit will belong to the built-in **Default Organisation**.
519
969
 
520
- export type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>
521
-
522
- export type DeleteOrganisationUnitMutationError = ErrorType<void | AsError>
970
+ Users can only create one Personal unit and you cannot add other Users to a Personal Unit.
523
971
 
524
- /**
525
- * @summary Deletes an Organisational Unit
972
+ * @summary Create a new Personal Unit
973
+ */
974
+ export const createPersonalUnit = (
975
+ personalUnitPutBodyBody: PersonalUnitPutBodyBody,
976
+ options?: SecondParameter<typeof customInstance>,
977
+ ) => {
978
+ return customInstance<PersonalUnitPutResponse>(
979
+ {
980
+ url: `/personal-unit`,
981
+ method: "PUT",
982
+ headers: { "Content-Type": "application/json" },
983
+ data: personalUnitPutBodyBody,
984
+ },
985
+ options,
986
+ );
987
+ };
988
+
989
+ export const useCreatePersonalUnitMutationOptions = <
990
+ TError = ErrorType<AsError | void>,
991
+ TContext = unknown,
992
+ >(options?: {
993
+ mutation?: UseMutationOptions<
994
+ Awaited<ReturnType<typeof createPersonalUnit>>,
995
+ TError,
996
+ { data: PersonalUnitPutBodyBody },
997
+ TContext
998
+ >;
999
+ request?: SecondParameter<typeof customInstance>;
1000
+ }): UseMutationOptions<
1001
+ Awaited<ReturnType<typeof createPersonalUnit>>,
1002
+ TError,
1003
+ { data: PersonalUnitPutBodyBody },
1004
+ TContext
1005
+ > => {
1006
+ const mutationKey = ["createPersonalUnit"];
1007
+ const { mutation: mutationOptions, request: requestOptions } = options
1008
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
1009
+ ? options
1010
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
1011
+ : { mutation: { mutationKey }, request: undefined };
1012
+
1013
+ const mutationFn: MutationFunction<
1014
+ Awaited<ReturnType<typeof createPersonalUnit>>,
1015
+ { data: PersonalUnitPutBodyBody }
1016
+ > = (props) => {
1017
+ const { data } = props ?? {};
1018
+
1019
+ return createPersonalUnit(data, requestOptions);
1020
+ };
1021
+
1022
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
1023
+
1024
+ return customOptions;
1025
+ };
1026
+
1027
+ export type CreatePersonalUnitMutationResult = NonNullable<
1028
+ Awaited<ReturnType<typeof createPersonalUnit>>
1029
+ >;
1030
+ export type CreatePersonalUnitMutationBody = PersonalUnitPutBodyBody;
1031
+ export type CreatePersonalUnitMutationError = ErrorType<AsError | void>;
1032
+
1033
+ /**
1034
+ * @summary Create a new Personal Unit
526
1035
  */
527
- export const useDeleteOrganisationUnit = <TData = Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError = ErrorType<void | AsError>,
528
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
1036
+ export const useCreatePersonalUnit = <TError = ErrorType<AsError | void>, TContext = unknown>(
1037
+ options?: {
1038
+ mutation?: UseMutationOptions<
1039
+ Awaited<ReturnType<typeof createPersonalUnit>>,
1040
+ TError,
1041
+ { data: PersonalUnitPutBodyBody },
1042
+ TContext
1043
+ >;
1044
+ request?: SecondParameter<typeof customInstance>;
1045
+ },
1046
+ queryClient?: QueryClient,
529
1047
  ): UseMutationResult<
530
- TData,
531
- TError,
532
- {unitId: string},
533
- TContext
534
- > => {
1048
+ Awaited<ReturnType<typeof createPersonalUnit>>,
1049
+ TError,
1050
+ { data: PersonalUnitPutBodyBody },
1051
+ TContext
1052
+ > => {
1053
+ const mutationOptions = useCreatePersonalUnitMutationOptions(options);
1054
+
1055
+ return useMutation(mutationOptions, queryClient);
1056
+ };
1057
+ /**
1058
+ * Deletes a Personal Unit. The Unit is *your* Unit, and belongs to the **Default Organisation**
535
1059
 
536
- const mutationOptions = getDeleteOrganisationUnitMutationOptions(options);
1060
+ * @summary Deletes a Personal Unit
1061
+ */
1062
+ export const deletePersonalUnit = (options?: SecondParameter<typeof customInstance>) => {
1063
+ return customInstance<void>({ url: `/personal-unit`, method: "DELETE" }, options);
1064
+ };
1065
+
1066
+ export const useDeletePersonalUnitMutationOptions = <
1067
+ TError = ErrorType<void | AsError>,
1068
+ TContext = unknown,
1069
+ >(options?: {
1070
+ mutation?: UseMutationOptions<
1071
+ Awaited<ReturnType<typeof deletePersonalUnit>>,
1072
+ TError,
1073
+ void,
1074
+ TContext
1075
+ >;
1076
+ request?: SecondParameter<typeof customInstance>;
1077
+ }): UseMutationOptions<Awaited<ReturnType<typeof deletePersonalUnit>>, TError, void, TContext> => {
1078
+ const mutationKey = ["deletePersonalUnit"];
1079
+ const { mutation: mutationOptions, request: requestOptions } = options
1080
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
1081
+ ? options
1082
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
1083
+ : { mutation: { mutationKey }, request: undefined };
1084
+
1085
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deletePersonalUnit>>, void> = () => {
1086
+ return deletePersonalUnit(requestOptions);
1087
+ };
1088
+
1089
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
1090
+
1091
+ return customOptions;
1092
+ };
1093
+
1094
+ export type DeletePersonalUnitMutationResult = NonNullable<
1095
+ Awaited<ReturnType<typeof deletePersonalUnit>>
1096
+ >;
1097
+
1098
+ export type DeletePersonalUnitMutationError = ErrorType<void | AsError>;
537
1099
 
538
- return useMutation(mutationOptions);
539
- }
540
- /**
1100
+ /**
1101
+ * @summary Deletes a Personal Unit
1102
+ */
1103
+ export const useDeletePersonalUnit = <TError = ErrorType<void | AsError>, TContext = unknown>(
1104
+ options?: {
1105
+ mutation?: UseMutationOptions<
1106
+ Awaited<ReturnType<typeof deletePersonalUnit>>,
1107
+ TError,
1108
+ void,
1109
+ TContext
1110
+ >;
1111
+ request?: SecondParameter<typeof customInstance>;
1112
+ },
1113
+ queryClient?: QueryClient,
1114
+ ): UseMutationResult<Awaited<ReturnType<typeof deletePersonalUnit>>, TError, void, TContext> => {
1115
+ const mutationOptions = useDeletePersonalUnitMutationOptions(options);
1116
+
1117
+ return useMutation(mutationOptions, queryClient);
1118
+ };
1119
+ /**
541
1120
  * Gets all the Units that you are a member of, or a specific Unit by name.
542
1121
 
543
1122
  You can see a Unit if you are a member of it, the owner (creator) of it, or a member or creator of the Unit's Organisation, or if you are an admin user.
@@ -545,270 +1124,361 @@ You can see a Unit if you are a member of it, the owner (creator) of it, or a me
545
1124
  * @summary Gets Units
546
1125
  */
547
1126
  export const getUnits = (
548
- params?: GetUnitsParams,
549
- options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
1127
+ params?: GetUnitsParams,
1128
+ options?: SecondParameter<typeof customInstance>,
1129
+ signal?: AbortSignal,
550
1130
  ) => {
551
-
552
-
553
- return customInstance<UnitsGetResponse>(
554
- {url: `/unit`, method: 'GET',
555
- params, signal
556
- },
557
- options);
558
- }
559
-
560
-
561
- export const getGetUnitsQueryKey = (params?: GetUnitsParams,) => {
562
- return ["account-server-api", `/unit`, ...(params ? [params]: [])] as const;
563
- }
564
-
565
-
566
- export const getGetUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(params?: GetUnitsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
1131
+ return customInstance<UnitsGetResponse>({ url: `/unit`, method: "GET", params, signal }, options);
1132
+ };
1133
+
1134
+ export const getGetUnitsQueryKey = (params?: GetUnitsParams) => {
1135
+ return [`/unit`, ...(params ? [params] : [])] as const;
1136
+ };
1137
+
1138
+ export const useGetUnitsQueryOptions = <
1139
+ TData = Awaited<ReturnType<typeof getUnits>>,
1140
+ TError = ErrorType<void | AsError>,
1141
+ >(
1142
+ params?: GetUnitsParams,
1143
+ options?: {
1144
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1145
+ request?: SecondParameter<typeof customInstance>;
1146
+ },
567
1147
  ) => {
1148
+ const { query: queryOptions, request: requestOptions } = options ?? {};
568
1149
 
569
- const {query: queryOptions, request: requestOptions} = options ?? {};
570
-
571
- const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey(params);
572
-
573
-
1150
+ const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey(params);
574
1151
 
575
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(params, requestOptions, signal);
1152
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) =>
1153
+ getUnits(params, requestOptions, signal);
576
1154
 
577
-
578
-
579
-
580
-
581
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
582
- }
1155
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
583
1156
 
584
- export type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>
585
- export type GetUnitsQueryError = ErrorType<void | AsError>
1157
+ return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & {
1158
+ queryKey: DataTag<QueryKey, TData, TError>;
1159
+ };
1160
+ };
586
1161
 
1162
+ export type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
1163
+ export type GetUnitsQueryError = ErrorType<void | AsError>;
587
1164
 
588
- export function useGetUnits<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
589
- params: undefined | GetUnitsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>> & Pick<
1165
+ export function useGetUnits<
1166
+ TData = Awaited<ReturnType<typeof getUnits>>,
1167
+ TError = ErrorType<void | AsError>,
1168
+ >(
1169
+ params: undefined | GetUnitsParams,
1170
+ options: {
1171
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>> &
1172
+ Pick<
590
1173
  DefinedInitialDataOptions<
591
1174
  Awaited<ReturnType<typeof getUnits>>,
592
1175
  TError,
593
- TData
594
- > , 'initialData'
595
- >, request?: SecondParameter<typeof customInstance>}
596
-
597
- ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
598
- export function useGetUnits<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
599
- params?: GetUnitsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>> & Pick<
1176
+ Awaited<ReturnType<typeof getUnits>>
1177
+ >,
1178
+ "initialData"
1179
+ >;
1180
+ request?: SecondParameter<typeof customInstance>;
1181
+ },
1182
+ queryClient?: QueryClient,
1183
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
1184
+ export function useGetUnits<
1185
+ TData = Awaited<ReturnType<typeof getUnits>>,
1186
+ TError = ErrorType<void | AsError>,
1187
+ >(
1188
+ params?: GetUnitsParams,
1189
+ options?: {
1190
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>> &
1191
+ Pick<
600
1192
  UndefinedInitialDataOptions<
601
1193
  Awaited<ReturnType<typeof getUnits>>,
602
1194
  TError,
603
- TData
604
- > , 'initialData'
605
- >, request?: SecondParameter<typeof customInstance>}
606
-
607
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
608
- export function useGetUnits<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
609
- params?: GetUnitsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
610
-
611
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
1195
+ Awaited<ReturnType<typeof getUnits>>
1196
+ >,
1197
+ "initialData"
1198
+ >;
1199
+ request?: SecondParameter<typeof customInstance>;
1200
+ },
1201
+ queryClient?: QueryClient,
1202
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
1203
+ export function useGetUnits<
1204
+ TData = Awaited<ReturnType<typeof getUnits>>,
1205
+ TError = ErrorType<void | AsError>,
1206
+ >(
1207
+ params?: GetUnitsParams,
1208
+ options?: {
1209
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1210
+ request?: SecondParameter<typeof customInstance>;
1211
+ },
1212
+ queryClient?: QueryClient,
1213
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
612
1214
  /**
613
1215
  * @summary Gets Units
614
1216
  */
615
1217
 
616
- export function useGetUnits<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
617
- params?: GetUnitsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
618
-
619
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
620
-
621
- const queryOptions = getGetUnitsQueryOptions(params,options)
622
-
623
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
624
-
625
- query.queryKey = queryOptions.queryKey ;
1218
+ export function useGetUnits<
1219
+ TData = Awaited<ReturnType<typeof getUnits>>,
1220
+ TError = ErrorType<void | AsError>,
1221
+ >(
1222
+ params?: GetUnitsParams,
1223
+ options?: {
1224
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1225
+ request?: SecondParameter<typeof customInstance>;
1226
+ },
1227
+ queryClient?: QueryClient,
1228
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
1229
+ const queryOptions = useGetUnitsQueryOptions(params, options);
1230
+
1231
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
1232
+ queryKey: DataTag<QueryKey, TData, TError>;
1233
+ };
1234
+
1235
+ query.queryKey = queryOptions.queryKey;
626
1236
 
627
1237
  return query;
628
1238
  }
629
1239
 
630
-
631
-
632
- export const getGetUnitsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(params?: GetUnitsParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
1240
+ export const useGetUnitsSuspenseQueryOptions = <
1241
+ TData = Awaited<ReturnType<typeof getUnits>>,
1242
+ TError = ErrorType<void | AsError>,
1243
+ >(
1244
+ params?: GetUnitsParams,
1245
+ options?: {
1246
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1247
+ request?: SecondParameter<typeof customInstance>;
1248
+ },
633
1249
  ) => {
634
-
635
- const {query: queryOptions, request: requestOptions} = options ?? {};
636
-
637
- const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey(params);
638
-
639
-
640
-
641
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(params, requestOptions, signal);
642
-
643
-
644
-
645
-
646
-
647
- return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
648
- }
649
-
650
- export type GetUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>
651
- export type GetUnitsSuspenseQueryError = ErrorType<void | AsError>
652
-
653
-
654
- export function useGetUnitsSuspense<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
655
- params: undefined | GetUnitsParams, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
656
-
657
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
658
- export function useGetUnitsSuspense<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
659
- params?: GetUnitsParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
660
-
661
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
662
- export function useGetUnitsSuspense<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
663
- params?: GetUnitsParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
664
-
665
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
1250
+ const { query: queryOptions, request: requestOptions } = options ?? {};
1251
+
1252
+ const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey(params);
1253
+
1254
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) =>
1255
+ getUnits(params, requestOptions, signal);
1256
+
1257
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
1258
+
1259
+ return customOptions as UseSuspenseQueryOptions<
1260
+ Awaited<ReturnType<typeof getUnits>>,
1261
+ TError,
1262
+ TData
1263
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
1264
+ };
1265
+
1266
+ export type GetUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
1267
+ export type GetUnitsSuspenseQueryError = ErrorType<void | AsError>;
1268
+
1269
+ export function useGetUnitsSuspense<
1270
+ TData = Awaited<ReturnType<typeof getUnits>>,
1271
+ TError = ErrorType<void | AsError>,
1272
+ >(
1273
+ params: undefined | GetUnitsParams,
1274
+ options: {
1275
+ query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1276
+ request?: SecondParameter<typeof customInstance>;
1277
+ },
1278
+ queryClient?: QueryClient,
1279
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
1280
+ export function useGetUnitsSuspense<
1281
+ TData = Awaited<ReturnType<typeof getUnits>>,
1282
+ TError = ErrorType<void | AsError>,
1283
+ >(
1284
+ params?: GetUnitsParams,
1285
+ options?: {
1286
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1287
+ request?: SecondParameter<typeof customInstance>;
1288
+ },
1289
+ queryClient?: QueryClient,
1290
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
1291
+ export function useGetUnitsSuspense<
1292
+ TData = Awaited<ReturnType<typeof getUnits>>,
1293
+ TError = ErrorType<void | AsError>,
1294
+ >(
1295
+ params?: GetUnitsParams,
1296
+ options?: {
1297
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1298
+ request?: SecondParameter<typeof customInstance>;
1299
+ },
1300
+ queryClient?: QueryClient,
1301
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
666
1302
  /**
667
1303
  * @summary Gets Units
668
1304
  */
669
1305
 
670
- export function useGetUnitsSuspense<TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
671
- params?: GetUnitsParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
672
-
673
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
674
-
675
- const queryOptions = getGetUnitsSuspenseQueryOptions(params,options)
676
-
677
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
678
-
679
- query.queryKey = queryOptions.queryKey ;
1306
+ export function useGetUnitsSuspense<
1307
+ TData = Awaited<ReturnType<typeof getUnits>>,
1308
+ TError = ErrorType<void | AsError>,
1309
+ >(
1310
+ params?: GetUnitsParams,
1311
+ options?: {
1312
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>;
1313
+ request?: SecondParameter<typeof customInstance>;
1314
+ },
1315
+ queryClient?: QueryClient,
1316
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
1317
+ const queryOptions = useGetUnitsSuspenseQueryOptions(params, options);
1318
+
1319
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
1320
+ TData,
1321
+ TError
1322
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
1323
+
1324
+ query.queryKey = queryOptions.queryKey;
680
1325
 
681
1326
  return query;
682
1327
  }
683
1328
 
684
-
685
-
686
1329
  /**
687
1330
  * Creates a Personal Unit for a User. The unit will belong to the built-in **Default Organisation**.
688
1331
 
689
1332
  Users can only create one Personal unit and you cannot add other Users to a Personal Unit.
690
1333
 
1334
+ This endpoint is DECREMENTED and will be removed in a future release. Please use **PUT** at `/personal-unit`.
1335
+
691
1336
  * @summary Create a new Personal Unit
692
1337
  */
693
1338
  export const createDefaultUnit = (
694
- personalUnitPutBodyBody: PersonalUnitPutBodyBody,
695
- options?: SecondParameter<typeof customInstance>,) => {
696
-
697
-
698
- return customInstance<PersonalUnitPutResponse>(
699
- {url: `/unit`, method: 'PUT',
700
- headers: {'Content-Type': 'application/json', },
701
- data: personalUnitPutBodyBody
702
- },
703
- options);
704
- }
705
-
706
-
707
-
708
- export const getCreateDefaultUnitMutationOptions = <TData = Awaited<ReturnType<typeof createDefaultUnit>>, TError = ErrorType<AsError | void>,
709
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
1339
+ personalUnitPutBodyBody: PersonalUnitPutBodyBody,
1340
+ options?: SecondParameter<typeof customInstance>,
710
1341
  ) => {
711
- const mutationKey = ['createDefaultUnit'];
712
- const {mutation: mutationOptions, request: requestOptions} = options ?
713
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
714
- options
715
- : {...options, mutation: {...options.mutation, mutationKey}}
716
- : {mutation: { mutationKey, }, request: undefined};
717
-
718
-
719
-
720
-
721
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDefaultUnit>>, {data: PersonalUnitPutBodyBody}> = (props) => {
722
- const {data} = props ?? {};
723
-
724
- return createDefaultUnit(data,requestOptions)
725
- }
726
-
727
-
728
-
729
-
730
- return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{data: PersonalUnitPutBodyBody}, TContext>}
731
-
732
- export type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>
733
- export type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody
734
- export type CreateDefaultUnitMutationError = ErrorType<AsError | void>
1342
+ return customInstance<PersonalUnitPutResponse>(
1343
+ {
1344
+ url: `/unit`,
1345
+ method: "PUT",
1346
+ headers: { "Content-Type": "application/json" },
1347
+ data: personalUnitPutBodyBody,
1348
+ },
1349
+ options,
1350
+ );
1351
+ };
1352
+
1353
+ export const useCreateDefaultUnitMutationOptions = <
1354
+ TError = ErrorType<AsError | void>,
1355
+ TContext = unknown,
1356
+ >(options?: {
1357
+ mutation?: UseMutationOptions<
1358
+ Awaited<ReturnType<typeof createDefaultUnit>>,
1359
+ TError,
1360
+ { data: PersonalUnitPutBodyBody },
1361
+ TContext
1362
+ >;
1363
+ request?: SecondParameter<typeof customInstance>;
1364
+ }): UseMutationOptions<
1365
+ Awaited<ReturnType<typeof createDefaultUnit>>,
1366
+ TError,
1367
+ { data: PersonalUnitPutBodyBody },
1368
+ TContext
1369
+ > => {
1370
+ const mutationKey = ["createDefaultUnit"];
1371
+ const { mutation: mutationOptions, request: requestOptions } = options
1372
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
1373
+ ? options
1374
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
1375
+ : { mutation: { mutationKey }, request: undefined };
1376
+
1377
+ const mutationFn: MutationFunction<
1378
+ Awaited<ReturnType<typeof createDefaultUnit>>,
1379
+ { data: PersonalUnitPutBodyBody }
1380
+ > = (props) => {
1381
+ const { data } = props ?? {};
1382
+
1383
+ return createDefaultUnit(data, requestOptions);
1384
+ };
1385
+
1386
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
1387
+
1388
+ return customOptions;
1389
+ };
1390
+
1391
+ export type CreateDefaultUnitMutationResult = NonNullable<
1392
+ Awaited<ReturnType<typeof createDefaultUnit>>
1393
+ >;
1394
+ export type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
1395
+ export type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
735
1396
 
736
- /**
1397
+ /**
737
1398
  * @summary Create a new Personal Unit
738
1399
  */
739
- export const useCreateDefaultUnit = <TData = Awaited<ReturnType<typeof createDefaultUnit>>, TError = ErrorType<AsError | void>,
740
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
1400
+ export const useCreateDefaultUnit = <TError = ErrorType<AsError | void>, TContext = unknown>(
1401
+ options?: {
1402
+ mutation?: UseMutationOptions<
1403
+ Awaited<ReturnType<typeof createDefaultUnit>>,
1404
+ TError,
1405
+ { data: PersonalUnitPutBodyBody },
1406
+ TContext
1407
+ >;
1408
+ request?: SecondParameter<typeof customInstance>;
1409
+ },
1410
+ queryClient?: QueryClient,
741
1411
  ): UseMutationResult<
742
- TData,
743
- TError,
744
- {data: PersonalUnitPutBodyBody},
745
- TContext
746
- > => {
747
-
748
- const mutationOptions = getCreateDefaultUnitMutationOptions(options);
749
-
750
- return useMutation(mutationOptions);
751
- }
752
- /**
1412
+ Awaited<ReturnType<typeof createDefaultUnit>>,
1413
+ TError,
1414
+ { data: PersonalUnitPutBodyBody },
1415
+ TContext
1416
+ > => {
1417
+ const mutationOptions = useCreateDefaultUnitMutationOptions(options);
1418
+
1419
+ return useMutation(mutationOptions, queryClient);
1420
+ };
1421
+ /**
753
1422
  * Deletes a Personal Unit. The Unit is *your* Unit, and belongs to the **Default Organisation**
754
1423
 
1424
+ This endpoint is DECREMENTED and will be removed in a future release. Please use **DELETE** at `/personal-unit`.
1425
+
755
1426
  * @summary Deletes a Personal Unit
756
1427
  */
757
- export const deleteDefaultUnit = (
758
-
759
- options?: SecondParameter<typeof customInstance>,) => {
760
-
761
-
762
- return customInstance<void>(
763
- {url: `/unit`, method: 'DELETE'
764
- },
765
- options);
766
- }
767
-
768
-
1428
+ export const deleteDefaultUnit = (options?: SecondParameter<typeof customInstance>) => {
1429
+ return customInstance<void>({ url: `/unit`, method: "DELETE" }, options);
1430
+ };
1431
+
1432
+ export const useDeleteDefaultUnitMutationOptions = <
1433
+ TError = ErrorType<void | AsError>,
1434
+ TContext = unknown,
1435
+ >(options?: {
1436
+ mutation?: UseMutationOptions<
1437
+ Awaited<ReturnType<typeof deleteDefaultUnit>>,
1438
+ TError,
1439
+ void,
1440
+ TContext
1441
+ >;
1442
+ request?: SecondParameter<typeof customInstance>;
1443
+ }): UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError, void, TContext> => {
1444
+ const mutationKey = ["deleteDefaultUnit"];
1445
+ const { mutation: mutationOptions, request: requestOptions } = options
1446
+ ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
1447
+ ? options
1448
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
1449
+ : { mutation: { mutationKey }, request: undefined };
1450
+
1451
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, void> = () => {
1452
+ return deleteDefaultUnit(requestOptions);
1453
+ };
1454
+
1455
+ const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
1456
+
1457
+ return customOptions;
1458
+ };
1459
+
1460
+ export type DeleteDefaultUnitMutationResult = NonNullable<
1461
+ Awaited<ReturnType<typeof deleteDefaultUnit>>
1462
+ >;
1463
+
1464
+ export type DeleteDefaultUnitMutationError = ErrorType<void | AsError>;
769
1465
 
770
- export const getDeleteDefaultUnitMutationOptions = <TData = Awaited<ReturnType<typeof deleteDefaultUnit>>, TError = ErrorType<void | AsError>,
771
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
772
- ) => {
773
- const mutationKey = ['deleteDefaultUnit'];
774
- const {mutation: mutationOptions, request: requestOptions} = options ?
775
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
776
- options
777
- : {...options, mutation: {...options.mutation, mutationKey}}
778
- : {mutation: { mutationKey, }, request: undefined};
779
-
780
-
781
-
782
-
783
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, void> = () => {
784
-
785
-
786
- return deleteDefaultUnit(requestOptions)
787
- }
788
-
789
-
790
-
791
-
792
- return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,void, TContext>}
793
-
794
- export type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>
795
-
796
- export type DeleteDefaultUnitMutationError = ErrorType<void | AsError>
797
-
798
- /**
1466
+ /**
799
1467
  * @summary Deletes a Personal Unit
800
1468
  */
801
- export const useDeleteDefaultUnit = <TData = Awaited<ReturnType<typeof deleteDefaultUnit>>, TError = ErrorType<void | AsError>,
802
- TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
803
- ): UseMutationResult<
804
- TData,
805
- TError,
806
- void,
807
- TContext
808
- > => {
809
-
810
- const mutationOptions = getDeleteDefaultUnitMutationOptions(options);
811
-
812
- return useMutation(mutationOptions);
813
- }
814
-
1469
+ export const useDeleteDefaultUnit = <TError = ErrorType<void | AsError>, TContext = unknown>(
1470
+ options?: {
1471
+ mutation?: UseMutationOptions<
1472
+ Awaited<ReturnType<typeof deleteDefaultUnit>>,
1473
+ TError,
1474
+ void,
1475
+ TContext
1476
+ >;
1477
+ request?: SecondParameter<typeof customInstance>;
1478
+ },
1479
+ queryClient?: QueryClient,
1480
+ ): UseMutationResult<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError, void, TContext> => {
1481
+ const mutationOptions = useDeleteDefaultUnitMutationOptions(options);
1482
+
1483
+ return useMutation(mutationOptions, queryClient);
1484
+ };