@squonk/account-server-client 2.1.0-rc.1 → 2.1.0-rc.11

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 (78) hide show
  1. package/README.md +1 -1
  2. package/admin/admin.cjs +30 -8
  3. package/admin/admin.cjs.map +1 -1
  4. package/admin/admin.d.cts +50 -0
  5. package/admin/admin.d.ts +26 -6
  6. package/admin/admin.js +30 -8
  7. package/admin/admin.js.map +1 -1
  8. package/asset/asset.cjs +62 -22
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +260 -0
  11. package/asset/asset.d.ts +79 -36
  12. package/asset/asset.js +54 -14
  13. package/asset/asset.js.map +1 -1
  14. package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
  15. package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
  16. package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
  17. package/chunk-TKLTUR4R.cjs.map +1 -0
  18. package/event-stream/event-stream.cjs +64 -19
  19. package/event-stream/event-stream.cjs.map +1 -1
  20. package/event-stream/event-stream.d.cts +142 -0
  21. package/event-stream/event-stream.d.ts +66 -20
  22. package/event-stream/event-stream.js +61 -16
  23. package/event-stream/event-stream.js.map +1 -1
  24. package/index.cjs +10 -10
  25. package/index.cjs.map +1 -1
  26. package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +163 -163
  27. package/index.d.ts +700 -2
  28. package/index.js +9 -9
  29. package/index.js.map +1 -1
  30. package/merchant/merchant.cjs +53 -14
  31. package/merchant/merchant.cjs.map +1 -1
  32. package/merchant/merchant.d.cts +91 -0
  33. package/merchant/merchant.d.ts +48 -8
  34. package/merchant/merchant.js +52 -13
  35. package/merchant/merchant.js.map +1 -1
  36. package/organisation/organisation.cjs +110 -28
  37. package/organisation/organisation.cjs.map +1 -1
  38. package/organisation/organisation.d.cts +271 -0
  39. package/organisation/organisation.d.ts +114 -25
  40. package/organisation/organisation.js +103 -21
  41. package/organisation/organisation.js.map +1 -1
  42. package/package.json +12 -12
  43. package/product/product.cjs +182 -47
  44. package/product/product.cjs.map +1 -1
  45. package/product/product.d.cts +399 -0
  46. package/product/product.d.ts +180 -31
  47. package/product/product.js +172 -37
  48. package/product/product.js.map +1 -1
  49. package/src/account-server-api.schemas.ts +272 -280
  50. package/src/admin/admin.ts +114 -84
  51. package/src/asset/asset.ts +480 -565
  52. package/src/custom-instance.ts +3 -4
  53. package/src/event-stream/event-stream.ts +300 -275
  54. package/src/merchant/merchant.ts +206 -142
  55. package/src/organisation/organisation.ts +549 -490
  56. package/src/product/product.ts +829 -688
  57. package/src/state/state.ts +112 -75
  58. package/src/unit/unit.ts +645 -599
  59. package/src/user/user.ts +489 -469
  60. package/state/state.cjs +29 -8
  61. package/state/state.cjs.map +1 -1
  62. package/state/state.d.cts +46 -0
  63. package/state/state.d.ts +26 -6
  64. package/state/state.js +29 -8
  65. package/state/state.js.map +1 -1
  66. package/unit/unit.cjs +120 -32
  67. package/unit/unit.cjs.map +1 -1
  68. package/unit/unit.d.cts +322 -0
  69. package/unit/unit.d.ts +133 -38
  70. package/unit/unit.js +112 -24
  71. package/unit/unit.js.map +1 -1
  72. package/user/user.cjs +96 -22
  73. package/user/user.cjs.map +1 -1
  74. package/user/user.d.cts +271 -0
  75. package/user/user.d.ts +96 -24
  76. package/user/user.js +90 -16
  77. package/user/user.js.map +1 -1
  78. package/chunk-UZTHSGDT.cjs.map +0 -1
package/user/user.js CHANGED
@@ -1,22 +1,30 @@
1
1
  import {
2
2
  customInstance
3
- } from "../chunk-3RNIDX7T.js";
3
+ } from "../chunk-EBOQPVLG.js";
4
4
 
5
5
  // src/user/user.ts
6
- import { useQuery, useMutation } from "@tanstack/react-query";
6
+ import {
7
+ useMutation,
8
+ useQuery,
9
+ useSuspenseQuery
10
+ } from "@tanstack/react-query";
7
11
  var getUserAccount = (options, signal) => {
8
12
  return customInstance(
9
- { url: `/user/account`, method: "get", signal },
13
+ {
14
+ url: `/user/account`,
15
+ method: "GET",
16
+ signal
17
+ },
10
18
  options
11
19
  );
12
20
  };
13
- var getGetUserAccountQueryKey = () => ["account-server-api", `/user/account`];
21
+ var getGetUserAccountQueryKey = () => {
22
+ return ["account-server-api", `/user/account`];
23
+ };
14
24
  var getGetUserAccountQueryOptions = (options) => {
15
25
  const { query: queryOptions, request: requestOptions } = options ?? {};
16
26
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUserAccountQueryKey();
17
- const queryFn = ({
18
- signal
19
- }) => getUserAccount(requestOptions, signal);
27
+ const queryFn = ({ signal }) => getUserAccount(requestOptions, signal);
20
28
  return { queryKey, queryFn, ...queryOptions };
21
29
  };
22
30
  var useGetUserAccount = (options) => {
@@ -25,13 +33,31 @@ var useGetUserAccount = (options) => {
25
33
  query.queryKey = queryOptions.queryKey;
26
34
  return query;
27
35
  };
36
+ var getGetUserAccountSuspenseQueryOptions = (options) => {
37
+ const { query: queryOptions, request: requestOptions } = options ?? {};
38
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUserAccountQueryKey();
39
+ const queryFn = ({ signal }) => getUserAccount(requestOptions, signal);
40
+ return { queryKey, queryFn, ...queryOptions };
41
+ };
42
+ var useGetUserAccountSuspense = (options) => {
43
+ const queryOptions = getGetUserAccountSuspenseQueryOptions(options);
44
+ const query = useSuspenseQuery(queryOptions);
45
+ query.queryKey = queryOptions.queryKey;
46
+ return query;
47
+ };
28
48
  var getOrganisationUsers = (orgId, options, signal) => {
29
49
  return customInstance(
30
- { url: `/organisation/${orgId}/user`, method: "get", signal },
50
+ {
51
+ url: `/organisation/${orgId}/user`,
52
+ method: "GET",
53
+ signal
54
+ },
31
55
  options
32
56
  );
33
57
  };
34
- var getGetOrganisationUsersQueryKey = (orgId) => ["account-server-api", `/organisation/${orgId}/user`];
58
+ var getGetOrganisationUsersQueryKey = (orgId) => {
59
+ return ["account-server-api", `/organisation/${orgId}/user`];
60
+ };
35
61
  var getGetOrganisationUsersQueryOptions = (orgId, options) => {
36
62
  const { query: queryOptions, request: requestOptions } = options ?? {};
37
63
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUsersQueryKey(orgId);
@@ -44,9 +70,24 @@ var useGetOrganisationUsers = (orgId, options) => {
44
70
  query.queryKey = queryOptions.queryKey;
45
71
  return query;
46
72
  };
73
+ var getGetOrganisationUsersSuspenseQueryOptions = (orgId, options) => {
74
+ const { query: queryOptions, request: requestOptions } = options ?? {};
75
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUsersQueryKey(orgId);
76
+ const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
77
+ return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
78
+ };
79
+ var useGetOrganisationUsersSuspense = (orgId, options) => {
80
+ const queryOptions = getGetOrganisationUsersSuspenseQueryOptions(orgId, options);
81
+ const query = useSuspenseQuery(queryOptions);
82
+ query.queryKey = queryOptions.queryKey;
83
+ return query;
84
+ };
47
85
  var addOrganisationUser = (orgId, userId, options) => {
48
86
  return customInstance(
49
- { url: `/organisation/${orgId}/user/${userId}`, method: "put" },
87
+ {
88
+ url: `/organisation/${orgId}/user/${userId}`,
89
+ method: "PUT"
90
+ },
50
91
  options
51
92
  );
52
93
  };
@@ -64,7 +105,10 @@ var useAddOrganisationUser = (options) => {
64
105
  };
65
106
  var deleteOrganisationUser = (orgId, userId, options) => {
66
107
  return customInstance(
67
- { url: `/organisation/${orgId}/user/${userId}`, method: "delete" },
108
+ {
109
+ url: `/organisation/${orgId}/user/${userId}`,
110
+ method: "DELETE"
111
+ },
68
112
  options
69
113
  );
70
114
  };
@@ -82,11 +126,17 @@ var useDeleteOrganisationUser = (options) => {
82
126
  };
83
127
  var getOrganisationUnitUsers = (unitId, options, signal) => {
84
128
  return customInstance(
85
- { url: `/unit/${unitId}/user`, method: "get", signal },
129
+ {
130
+ url: `/unit/${unitId}/user`,
131
+ method: "GET",
132
+ signal
133
+ },
86
134
  options
87
135
  );
88
136
  };
89
- var getGetOrganisationUnitUsersQueryKey = (unitId) => ["account-server-api", `/unit/${unitId}/user`];
137
+ var getGetOrganisationUnitUsersQueryKey = (unitId) => {
138
+ return ["account-server-api", `/unit/${unitId}/user`];
139
+ };
90
140
  var getGetOrganisationUnitUsersQueryOptions = (unitId, options) => {
91
141
  const { query: queryOptions, request: requestOptions } = options ?? {};
92
142
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitUsersQueryKey(unitId);
@@ -99,9 +149,24 @@ var useGetOrganisationUnitUsers = (unitId, options) => {
99
149
  query.queryKey = queryOptions.queryKey;
100
150
  return query;
101
151
  };
152
+ var getGetOrganisationUnitUsersSuspenseQueryOptions = (unitId, options) => {
153
+ const { query: queryOptions, request: requestOptions } = options ?? {};
154
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitUsersQueryKey(unitId);
155
+ const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
156
+ return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
157
+ };
158
+ var useGetOrganisationUnitUsersSuspense = (unitId, options) => {
159
+ const queryOptions = getGetOrganisationUnitUsersSuspenseQueryOptions(unitId, options);
160
+ const query = useSuspenseQuery(queryOptions);
161
+ query.queryKey = queryOptions.queryKey;
162
+ return query;
163
+ };
102
164
  var addOrganisationUnitUser = (unitId, userId, options) => {
103
165
  return customInstance(
104
- { url: `/unit/${unitId}/user/${userId}`, method: "put" },
166
+ {
167
+ url: `/unit/${unitId}/user/${userId}`,
168
+ method: "PUT"
169
+ },
105
170
  options
106
171
  );
107
172
  };
@@ -119,7 +184,10 @@ var useAddOrganisationUnitUser = (options) => {
119
184
  };
120
185
  var deleteOrganisationUnitUser = (unitId, userId, options) => {
121
186
  return customInstance(
122
- { url: `/unit/${unitId}/user/${userId}`, method: "delete" },
187
+ {
188
+ url: `/unit/${unitId}/user/${userId}`,
189
+ method: "DELETE"
190
+ },
123
191
  options
124
192
  );
125
193
  };
@@ -146,10 +214,13 @@ export {
146
214
  getDeleteOrganisationUserMutationOptions,
147
215
  getGetOrganisationUnitUsersQueryKey,
148
216
  getGetOrganisationUnitUsersQueryOptions,
217
+ getGetOrganisationUnitUsersSuspenseQueryOptions,
149
218
  getGetOrganisationUsersQueryKey,
150
219
  getGetOrganisationUsersQueryOptions,
220
+ getGetOrganisationUsersSuspenseQueryOptions,
151
221
  getGetUserAccountQueryKey,
152
222
  getGetUserAccountQueryOptions,
223
+ getGetUserAccountSuspenseQueryOptions,
153
224
  getOrganisationUnitUsers,
154
225
  getOrganisationUsers,
155
226
  getUserAccount,
@@ -158,7 +229,10 @@ export {
158
229
  useDeleteOrganisationUnitUser,
159
230
  useDeleteOrganisationUser,
160
231
  useGetOrganisationUnitUsers,
232
+ useGetOrganisationUnitUsersSuspense,
161
233
  useGetOrganisationUsers,
162
- useGetUserAccount
234
+ useGetOrganisationUsersSuspense,
235
+ useGetUserAccount,
236
+ useGetUserAccountSuspense
163
237
  };
164
238
  //# sourceMappingURL=user.js.map
package/user/user.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\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: 2.1\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\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<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [\"account-server-api\", `/user/account`] as const;\n\nexport const getGetUserAccountQueryOptions = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({\n signal,\n }) => getUserAccount(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetUserAccountQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUserAccount>>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport const useGetUserAccount = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetUserAccountQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\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 * @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 [\"account-server-api\", `/organisation/${orgId}/user`] as const;\n\nexport const getGetOrganisationUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUsersQueryOptions(orgId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\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 getAddOrganisationUserMutationOptions = <\n TError = ErrorType<AsError>,\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 { mutation: mutationOptions, request: requestOptions } = options ?? {};\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 return { mutationFn, ...mutationOptions };\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUser>>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\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}) => {\n const mutationOptions = getAddOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\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 getDeleteOrganisationUserMutationOptions = <\n TError = ErrorType<AsError>,\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 { mutation: mutationOptions, request: requestOptions } = options ?? {};\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 return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUser>>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\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}) => {\n const mutationOptions = getDeleteOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\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 * @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 [\"account-server-api\", `/unit/${unitId}/user`] as const;\n\nexport const getGetOrganisationUnitUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUnitUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\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>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport const getAddOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError>,\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 { mutation: mutationOptions, request: requestOptions } = options ?? {};\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 return { mutationFn, ...mutationOptions };\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\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}) => {\n const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\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>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError>,\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 { mutation: mutationOptions, request: requestOptions } = options ?? {};\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 return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\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}) => {\n const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AA8B/B,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,sBAAsB,eAAe;AAE9E,IAAM,gCAAgC,CAG3C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAq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CAAwC,QAAQ,OAAO;AAE5E,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAWO,IAAM,0BAA0B,CACrC,QACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,MAAM;AAAA,IACvD;AAAA,EACF;AACF;AAEO,IAAM,4CAA4C,CAGvD,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,OAAO,IAAI,SAAS,CAAC;AAErC,WAAO,wBAAwB,QAAQ,QAAQ,cAAc;AAAA,EAC/D;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,6BAA6B,CAGxC,YAQI;AACJ,QAAM,kBAAkB,0CAA0C,OAAO;AAEzE,SAAO,YAAY,eAAe;AACpC;AAUO,IAAM,6BAA6B,CACxC,QACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,SAAS;AAAA,IAC1D;AAAA,EACF;AACF;AAEO,IAAM,+CAA+C,CAG1D,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,OAAO,IAAI,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,kBAAkB,6CAA6C,OAAO;AAE5E,SAAO,YAAY,eAAe;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.25.0 🍺\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: 2.1\n */\nimport {\n useMutation,\n useQuery,\n useSuspenseQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult,\n UseSuspenseQueryOptions,\n UseSuspenseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n UserAccountDetail,\n UsersGetResponse\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\ntype SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UserAccountDetail>(\n {url: `/user/account`, method: 'GET', signal\n },\n options);\n }\n \n\nexport const getGetUserAccountQueryKey = () => {\n return [\"account-server-api\", `/user/account`] as const;\n }\n\n \nexport const getGetUserAccountQueryOptions = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) => getUserAccount(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>\nexport type GetUserAccountQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Get information about your account\n */\nexport const useGetUserAccount = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetUserAccountQueryOptions(options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetUserAccountSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) => getUserAccount(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetUserAccountSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>\nexport type GetUserAccountSuspenseQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Get information about your account\n */\nexport const useGetUserAccountSuspense = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>(\n options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetUserAccountSuspenseQueryOptions(options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\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 * @summary Gets users in an Organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UsersGetResponse>(\n {url: `/organisation/${orgId}/user`, method: 'GET', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationUsersQueryKey = (orgId: string,) => {\n return [\"account-server-api\", `/organisation/${orgId}/user`] as const;\n }\n\n \nexport const getGetOrganisationUsersQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets users in an Organisation\n */\nexport const useGetOrganisationUsers = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(\n orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationUsersQueryOptions(orgId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetOrganisationUsersSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationUsersSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>\nexport type GetOrganisationUsersSuspenseQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets users in an Organisation\n */\nexport const useGetOrganisationUsersSuspense = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(\n orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationUsersSuspenseQueryOptions(orgId,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\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 \n return customInstance<void>(\n {url: `/organisation/${orgId}/user/${userId}`, method: 'PUT'\n },\n options);\n }\n \n\n\nexport const getAddOrganisationUserMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUser>>, {orgId: string;userId: string}> = (props) => {\n const {orgId,userId} = props ?? {};\n\n return addOrganisationUser(orgId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>\n \n export type AddOrganisationUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Adds a User to an Organisation\n */\nexport const useAddOrganisationUser = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAddOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\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 \n return customInstance<void>(\n {url: `/organisation/${orgId}/user/${userId}`, method: 'DELETE'\n },\n options);\n }\n \n\n\nexport const getDeleteOrganisationUserMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUser>>, {orgId: string;userId: string}> = (props) => {\n const {orgId,userId} = props ?? {};\n\n return deleteOrganisationUser(orgId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>\n \n export type DeleteOrganisationUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes a User from an Organisation\n */\nexport const useDeleteOrganisationUser = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\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 * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UsersGetResponse>(\n {url: `/unit/${unitId}/user`, method: 'GET', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string,) => {\n return [\"account-server-api\", `/unit/${unitId}/user`] as const;\n }\n\n \nexport const getGetOrganisationUnitUsersQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets users in an Organisational Unit\n */\nexport const useGetOrganisationUnitUsers = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(\n unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetOrganisationUnitUsersSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationUnitUsersSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>\nexport type GetOrganisationUnitUsersSuspenseQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets users in an Organisational Unit\n */\nexport const useGetOrganisationUnitUsersSuspense = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(\n unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationUnitUsersSuspenseQueryOptions(unitId,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\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 \n return customInstance<void>(\n {url: `/unit/${unitId}/user/${userId}`, method: 'PUT'\n },\n options);\n }\n \n\n\nexport const getAddOrganisationUnitUserMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {\n const {unitId,userId} = props ?? {};\n\n return addOrganisationUnitUser(unitId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>\n \n export type AddOrganisationUnitUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Adds a user to an Organisational Unit\n */\nexport const useAddOrganisationUnitUser = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\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 \n return customInstance<void>(\n {url: `/unit/${unitId}/user/${userId}`, method: 'DELETE'\n },\n options);\n }\n \n\n\nexport const getDeleteOrganisationUnitUserMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {\n const {unitId,userId} = props ?? {};\n\n return deleteOrganisationUnitUser(unitId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>\n \n export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes a User from an Organisational Unit\n */\nexport const useDeleteOrganisationUnitUser = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n "],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA4BA,IAAM,iBAAiB,CAE7B,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAiB,QAAQ;AAAA,MAAO;AAAA,IACxC;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,4BAA4B,MAAM;AAC3C,SAAO,CAAC,sBAAsB,eAAe;AAC7C;AAGG,IAAM,gCAAgC,CAA0F,YAClI;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,0BAA0B;AAIpE,QAAM,UAAqE,CAAC,EAAE,OAAO,MAAM,eAAe,gBAAgB,MAAM;AAMjI,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,oBAAoB,CAC/B,YAE8D;AAE9D,QAAM,eAAe,8BAA8B,OAAO;AAE1D,QAAM,QAAQ,SAAS,YAAY;A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SAAO,YAAY,eAAe;AACpC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT","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, 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 // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}