@squonk/account-server-client 2.0.3 → 2.0.4-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/admin/admin.cjs +8 -6
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.ts +4 -4
  4. package/admin/admin.js +7 -5
  5. package/admin/admin.js.map +1 -1
  6. package/asset/asset.cjs +15 -13
  7. package/asset/asset.cjs.map +1 -1
  8. package/asset/asset.d.ts +20 -20
  9. package/asset/asset.js +7 -5
  10. package/asset/asset.js.map +1 -1
  11. package/{chunk-3O5KIRV4.js → chunk-3RNIDX7T.js} +1 -1
  12. package/{chunk-3O5KIRV4.js.map → chunk-3RNIDX7T.js.map} +1 -1
  13. package/chunk-7XN3IQYV.cjs +13 -0
  14. package/chunk-7XN3IQYV.cjs.map +1 -0
  15. package/{chunk-IUEU2LYC.cjs → chunk-UZTHSGDT.cjs} +1 -1
  16. package/chunk-UZTHSGDT.cjs.map +1 -0
  17. package/chunk-YEX2SGER.js +13 -0
  18. package/chunk-YEX2SGER.js.map +1 -0
  19. package/{custom-instance-dad9d28e.d.ts → custom-instance-85497958.d.ts} +110 -48
  20. package/index.cjs +2 -2
  21. package/index.cjs.map +1 -1
  22. package/index.d.ts +1 -1
  23. package/index.js +1 -1
  24. package/index.js.map +1 -1
  25. package/merchant/merchant.cjs +12 -9
  26. package/merchant/merchant.cjs.map +1 -1
  27. package/merchant/merchant.d.ts +6 -6
  28. package/merchant/merchant.js +10 -7
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +48 -16
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.ts +37 -16
  33. package/organisation/organisation.js +42 -10
  34. package/organisation/organisation.js.map +1 -1
  35. package/package.json +12 -12
  36. package/product/product.cjs +35 -33
  37. package/product/product.cjs.map +1 -1
  38. package/product/product.d.ts +24 -24
  39. package/product/product.js +25 -23
  40. package/product/product.js.map +1 -1
  41. package/src/account-server-api.schemas.ts +85 -17
  42. package/src/admin/admin.ts +6 -5
  43. package/src/asset/asset.ts +6 -5
  44. package/src/merchant/merchant.ts +10 -9
  45. package/src/organisation/organisation.ts +83 -19
  46. package/src/product/product.ts +30 -32
  47. package/src/queryMutator.ts +12 -0
  48. package/src/state/state.ts +6 -5
  49. package/src/unit/unit.ts +83 -19
  50. package/src/user/user.ts +14 -15
  51. package/state/state.cjs +8 -6
  52. package/state/state.cjs.map +1 -1
  53. package/state/state.d.ts +4 -4
  54. package/state/state.js +7 -5
  55. package/state/state.js.map +1 -1
  56. package/unit/unit.cjs +50 -25
  57. package/unit/unit.cjs.map +1 -1
  58. package/unit/unit.d.ts +42 -21
  59. package/unit/unit.js +42 -17
  60. package/unit/unit.js.map +1 -1
  61. package/user/user.cjs +20 -17
  62. package/user/user.cjs.map +1 -1
  63. package/user/user.d.ts +16 -16
  64. package/user/user.js +13 -10
  65. package/user/user.js.map +1 -1
  66. package/chunk-IUEU2LYC.cjs.map +0 -1
package/src/user/user.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.10.0 🍺
2
+ * Generated by orval v6.12.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -24,6 +24,7 @@ import type {
24
24
  } from "../account-server-api.schemas";
25
25
  import { customInstance } from ".././custom-instance";
26
26
  import type { ErrorType } from ".././custom-instance";
27
+ import { queryMutator } from ".././queryMutator";
27
28
 
28
29
  // eslint-disable-next-line
29
30
  type SecondParameter<T extends (...args: any) => any> = T extends (
@@ -74,15 +75,15 @@ export const useGetUserAccount = <
74
75
  signal,
75
76
  }) => getUserAccount(requestOptions, signal);
76
77
 
78
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
79
+
77
80
  const query = useQuery<
78
81
  Awaited<ReturnType<typeof getUserAccount>>,
79
82
  TError,
80
83
  TData
81
- >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
82
- queryKey: QueryKey;
83
- };
84
+ >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
84
85
 
85
- query.queryKey = queryKey;
86
+ query.queryKey = customOptions.queryKey;
86
87
 
87
88
  return query;
88
89
  };
@@ -135,16 +136,15 @@ export const useGetOrganisationUsers = <
135
136
  Awaited<ReturnType<typeof getOrganisationUsers>>
136
137
  > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
137
138
 
139
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
140
+
138
141
  const query = useQuery<
139
142
  Awaited<ReturnType<typeof getOrganisationUsers>>,
140
143
  TError,
141
144
  TData
142
- >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<
143
- TData,
144
- TError
145
- > & { queryKey: QueryKey };
145
+ >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
146
146
 
147
- query.queryKey = queryKey;
147
+ query.queryKey = customOptions.queryKey;
148
148
 
149
149
  return query;
150
150
  };
@@ -301,16 +301,15 @@ export const useGetOrganisationUnitUsers = <
301
301
  Awaited<ReturnType<typeof getOrganisationUnitUsers>>
302
302
  > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
303
303
 
304
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
305
+
304
306
  const query = useQuery<
305
307
  Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
306
308
  TError,
307
309
  TData
308
- >(queryKey, queryFn, {
309
- enabled: !!unitId,
310
- ...queryOptions,
311
- }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
310
+ >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
312
311
 
313
- query.queryKey = queryKey;
312
+ query.queryKey = customOptions.queryKey;
314
313
 
315
314
  return query;
316
315
  };
package/state/state.cjs CHANGED
@@ -1,11 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
3
+ var _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
4
+
5
+
6
+ var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
4
7
 
5
8
  // src/state/state.ts
6
9
  var _reactquery = require('@tanstack/react-query');
7
10
  var getVersion = (options, signal) => {
8
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
11
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
9
12
  { url: `/version`, method: "get", signal },
10
13
  options
11
14
  );
@@ -17,12 +20,11 @@ var useGetVersion = (options) => {
17
20
  const queryFn = ({
18
21
  signal
19
22
  }) => getVersion(requestOptions, signal);
23
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
20
24
  const query = _reactquery.useQuery.call(void 0,
21
- queryKey,
22
- queryFn,
23
- queryOptions
25
+ customOptions
24
26
  );
25
- query.queryKey = queryKey;
27
+ query.queryKey = customOptions.queryKey;
26
28
  return query;
27
29
  };
28
30
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.10.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 **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;;;;AAUA,SAAS,gBAAgB;AA0BlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ;AAAA,IACZ;AAAA,EACF;AAEA,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.12.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"]}
package/state/state.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { UseQueryOptions, QueryKey, UseQueryResult } from '@tanstack/react-query';
2
- import { aC as customInstance, au as StateGetVersionResponse, aD as ErrorType, ay as AsError } from '../custom-instance-dad9d28e.js';
2
+ import { aE as customInstance, aw as StateGetVersionResponse, aF as ErrorType, aA as AsError } from '../custom-instance-85497958.js';
3
3
  import 'axios';
4
4
 
5
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
5
+ type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
6
6
  /**
7
7
  * @summary Gets the Account Server version
8
8
  */
9
9
  declare const getVersion: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<StateGetVersionResponse>;
10
10
  declare const getGetVersionQueryKey: () => string[];
11
- declare type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>;
12
- declare type GetVersionQueryError = ErrorType<AsError | void>;
11
+ type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>;
12
+ type GetVersionQueryError = ErrorType<AsError | void>;
13
13
  declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorType<void | AsError>>(options?: {
14
14
  query?: UseQueryOptions<StateGetVersionResponse, TError, TData, QueryKey> | undefined;
15
15
  request?: SecondParameter<typeof customInstance>;
package/state/state.js CHANGED
@@ -1,6 +1,9 @@
1
+ import {
2
+ queryMutator
3
+ } from "../chunk-YEX2SGER.js";
1
4
  import {
2
5
  customInstance
3
- } from "../chunk-3O5KIRV4.js";
6
+ } from "../chunk-3RNIDX7T.js";
4
7
 
5
8
  // src/state/state.ts
6
9
  import { useQuery } from "@tanstack/react-query";
@@ -17,12 +20,11 @@ var useGetVersion = (options) => {
17
20
  const queryFn = ({
18
21
  signal
19
22
  }) => getVersion(requestOptions, signal);
23
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
20
24
  const query = useQuery(
21
- queryKey,
22
- queryFn,
23
- queryOptions
25
+ customOptions
24
26
  );
25
- query.queryKey = queryKey;
27
+ query.queryKey = customOptions.queryKey;
26
28
  return query;
27
29
  };
28
30
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.10.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 **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.12.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\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 * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;;;;AAUA,SAAS,gBAAgB;AA0BlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ;AAAA,IACZ;AAAA,EACF;AAEA,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT;","names":[]}
package/unit/unit.cjs CHANGED
@@ -1,11 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
3
+ var _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
4
+
5
+
6
+ var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
4
7
 
5
8
  // src/unit/unit.ts
6
9
  var _reactquery = require('@tanstack/react-query');
7
10
  var getOrganisationUnits = (orgId, options, signal) => {
8
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
11
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
9
12
  { url: `/organisation/${orgId}/unit`, method: "get", signal },
10
13
  options
11
14
  );
@@ -17,12 +20,13 @@ var useGetOrganisationUnits = (orgId, options) => {
17
20
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
18
21
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
19
22
  const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
20
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
21
- query.queryKey = queryKey;
23
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
24
+ const query = _reactquery.useQuery.call(void 0, customOptions);
25
+ query.queryKey = customOptions.queryKey;
22
26
  return query;
23
27
  };
24
28
  var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
25
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
29
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
26
30
  {
27
31
  url: `/organisation/${orgId}/unit`,
28
32
  method: "post",
@@ -41,7 +45,7 @@ var useCreateOrganisationUnit = (options) => {
41
45
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
42
46
  };
43
47
  var getUnit = (unitId, options, signal) => {
44
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
48
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
45
49
  { url: `/unit/${unitId}`, method: "get", signal },
46
50
  options
47
51
  );
@@ -53,16 +57,38 @@ var useGetUnit = (unitId, options) => {
53
57
  const queryFn = ({
54
58
  signal
55
59
  }) => getUnit(unitId, requestOptions, signal);
60
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
56
61
  const query = _reactquery.useQuery.call(void 0,
57
- queryKey,
58
- queryFn,
59
- { enabled: !!unitId, ...queryOptions }
62
+ customOptions
60
63
  );
61
- query.queryKey = queryKey;
64
+ query.queryKey = customOptions.queryKey;
62
65
  return query;
63
66
  };
67
+ var patchUnit = (unitId, unitPatchBodyBody, options) => {
68
+ const formData = new FormData();
69
+ if (unitPatchBodyBody.name !== void 0) {
70
+ formData.append("name", unitPatchBodyBody.name);
71
+ }
72
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
73
+ {
74
+ url: `/unit/${unitId}`,
75
+ method: "patch",
76
+ headers: { "Content-Type": "multipart/form-data" },
77
+ data: formData
78
+ },
79
+ options
80
+ );
81
+ };
82
+ var usePatchUnit = (options) => {
83
+ const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
84
+ const mutationFn = (props) => {
85
+ const { unitId, data } = _nullishCoalesce(props, () => ( {}));
86
+ return patchUnit(unitId, data, requestOptions);
87
+ };
88
+ return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
89
+ };
64
90
  var deleteOrganisationUnit = (unitId, options) => {
65
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
91
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
66
92
  { url: `/unit/${unitId}`, method: "delete" },
67
93
  options
68
94
  );
@@ -76,7 +102,7 @@ var useDeleteOrganisationUnit = (options) => {
76
102
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
77
103
  };
78
104
  var getUnits = (options, signal) => {
79
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
105
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
80
106
  { url: `/unit`, method: "get", signal },
81
107
  options
82
108
  );
@@ -88,16 +114,15 @@ var useGetUnits = (options) => {
88
114
  const queryFn = ({
89
115
  signal
90
116
  }) => getUnits(requestOptions, signal);
117
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
91
118
  const query = _reactquery.useQuery.call(void 0,
92
- queryKey,
93
- queryFn,
94
- queryOptions
119
+ customOptions
95
120
  );
96
- query.queryKey = queryKey;
121
+ query.queryKey = customOptions.queryKey;
97
122
  return query;
98
123
  };
99
124
  var createDefaultUnit = (personalUnitPutBodyBody, options) => {
100
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
125
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
101
126
  {
102
127
  url: `/unit`,
103
128
  method: "put",
@@ -116,7 +141,7 @@ var useCreateDefaultUnit = (options) => {
116
141
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
117
142
  };
118
143
  var deleteDefaultUnit = (options) => {
119
- return _chunkIUEU2LYCcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
144
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
120
145
  };
121
146
  var useDeleteDefaultUnit = (options) => {
122
147
  const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
@@ -126,7 +151,7 @@ var useDeleteDefaultUnit = (options) => {
126
151
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
127
152
  };
128
153
  var getUnitCharges = (unitId, params, options, signal) => {
129
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
154
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
130
155
  { url: `/unit/${unitId}/charges`, method: "get", params, signal },
131
156
  options
132
157
  );
@@ -138,11 +163,9 @@ var useGetUnitCharges = (unitId, params, options) => {
138
163
  const queryFn = ({
139
164
  signal
140
165
  }) => getUnitCharges(unitId, params, requestOptions, signal);
141
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, {
142
- enabled: !!unitId,
143
- ...queryOptions
144
- });
145
- query.queryKey = queryKey;
166
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
167
+ const query = _reactquery.useQuery.call(void 0, customOptions);
168
+ query.queryKey = customOptions.queryKey;
146
169
  return query;
147
170
  };
148
171
 
@@ -166,5 +189,7 @@ var useGetUnitCharges = (unitId, params, options) => {
166
189
 
167
190
 
168
191
 
169
- exports.createDefaultUnit = createDefaultUnit; exports.createOrganisationUnit = createOrganisationUnit; exports.deleteDefaultUnit = deleteDefaultUnit; exports.deleteOrganisationUnit = deleteOrganisationUnit; exports.getGetOrganisationUnitsQueryKey = getGetOrganisationUnitsQueryKey; exports.getGetUnitChargesQueryKey = getGetUnitChargesQueryKey; exports.getGetUnitQueryKey = getGetUnitQueryKey; exports.getGetUnitsQueryKey = getGetUnitsQueryKey; exports.getOrganisationUnits = getOrganisationUnits; exports.getUnit = getUnit; exports.getUnitCharges = getUnitCharges; exports.getUnits = getUnits; exports.useCreateDefaultUnit = useCreateDefaultUnit; exports.useCreateOrganisationUnit = useCreateOrganisationUnit; exports.useDeleteDefaultUnit = useDeleteDefaultUnit; exports.useDeleteOrganisationUnit = useDeleteOrganisationUnit; exports.useGetOrganisationUnits = useGetOrganisationUnits; exports.useGetUnit = useGetUnit; exports.useGetUnitCharges = useGetUnitCharges; exports.useGetUnits = useGetUnits;
192
+
193
+
194
+ exports.createDefaultUnit = createDefaultUnit; exports.createOrganisationUnit = createOrganisationUnit; exports.deleteDefaultUnit = deleteDefaultUnit; exports.deleteOrganisationUnit = deleteOrganisationUnit; exports.getGetOrganisationUnitsQueryKey = getGetOrganisationUnitsQueryKey; exports.getGetUnitChargesQueryKey = getGetUnitChargesQueryKey; exports.getGetUnitQueryKey = getGetUnitQueryKey; exports.getGetUnitsQueryKey = getGetUnitsQueryKey; exports.getOrganisationUnits = getOrganisationUnits; exports.getUnit = getUnit; exports.getUnitCharges = getUnitCharges; exports.getUnits = getUnits; exports.patchUnit = patchUnit; exports.useCreateDefaultUnit = useCreateDefaultUnit; exports.useCreateOrganisationUnit = useCreateOrganisationUnit; exports.useDeleteDefaultUnit = useDeleteDefaultUnit; exports.useDeleteOrganisationUnit = useDeleteOrganisationUnit; exports.useGetOrganisationUnits = useGetOrganisationUnits; exports.useGetUnit = useGetUnit; exports.useGetUnitCharges = useGetUnitCharges; exports.useGetUnits = useGetUnits; exports.usePatchUnit = usePatchUnit;
170
195
  //# sourceMappingURL=unit.cjs.map
package/unit/unit.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa,CAAC;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,KAAK,IAAI,SAAS,CAAC;AAElC,WAAO,uBAAuB,OAAO,MAAM,cAAc;AAA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I/B,QACA,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,0BAA0B,QAAQ,MAAM;AAEpE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,QAAQ,QAAQ,gBAAgB,MAAM;AAE3D,QAAM,QAAQ,SAIZ,UAAU,SAAS;AAAA,IACnB,SAAS,CAAC,CAAC;AAAA,IACX,GAAG;AAAA,EACL,CAAC;AAED,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.10.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 **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\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 OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n PersonalUnitPutBodyBody,\n UnitChargesGetResponse,\n GetUnitChargesParams,\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 * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Personal Unit\n */\nexport const createDefaultUnit = (\n personalUnitPutBodyBody: PersonalUnitPutBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n {\n url: `/unit`,\n method: \"put\",\n headers: { \"Content-Type\": \"application/json\" },\n data: personalUnitPutBodyBody,\n },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\nexport type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n { data: PersonalUnitPutBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createDefaultUnit(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Get the charges made against a Unit with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Unit\n */\nexport const getUnitCharges = (\n unitId: string,\n params?: GetUnitChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitChargesGetResponse>(\n { url: `/unit/${unitId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetUnitChargesQueryKey = (\n unitId: string,\n params?: GetUnitChargesParams\n) => [`/unit/${unitId}/charges`, ...(params ? [params] : [])];\n\nexport type GetUnitChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnitCharges>>\n>;\nexport type GetUnitChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetUnitCharges = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({\n signal,\n }) => getUnitCharges(unitId, params, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >(queryKey, queryFn, {\n enabled: !!unitId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"]}
1
+ {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;;;;AAUA,SAAS,UAAU,mBAAmB;AAuC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,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5B,QACA,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,kBAAkB,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAChE;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,CACvC,QACA,WACG,CAAC,SAAS,kBAAkB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAOrD,IAAM,oBAAoB,CAI/B,QACA,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,0BAA0B,QAAQ,MAAM;AAEpE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,QAAQ,QAAQ,gBAAgB,MAAM;AAE3D,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.12.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\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 OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitPatchBodyBody,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n PersonalUnitPutBodyBody,\n UnitChargesGetResponse,\n GetUnitChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\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 * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Used to update existing **Unit**.\n\nYou have to be the Unit owner (or an administrator) to patch a Unit.\n\n * @summary Adjust an existing Unit\n */\nexport const patchUnit = (\n unitId: string,\n unitPatchBodyBody: UnitPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (unitPatchBodyBody.name !== undefined) {\n formData.append(\"name\", unitPatchBodyBody.name);\n }\n\n return customInstance<void>(\n {\n url: `/unit/${unitId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type PatchUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchUnit>>\n>;\nexport type PatchUnitMutationBody = UnitPatchBodyBody;\nexport type PatchUnitMutationError = ErrorType<AsError>;\n\nexport const usePatchUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchUnit>>,\n { unitId: string; data: UnitPatchBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return patchUnit(unitId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Personal Unit\n */\nexport const createDefaultUnit = (\n personalUnitPutBodyBody: PersonalUnitPutBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n {\n url: `/unit`,\n method: \"put\",\n headers: { \"Content-Type\": \"application/json\" },\n data: personalUnitPutBodyBody,\n },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\nexport type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n { data: PersonalUnitPutBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createDefaultUnit(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Get the charges made against a Unit with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Unit\n */\nexport const getUnitCharges = (\n unitId: string,\n params?: GetUnitChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitChargesGetResponse>(\n { url: `/unit/${unitId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetUnitChargesQueryKey = (\n unitId: string,\n params?: GetUnitChargesParams\n) => [`/unit/${unitId}/charges`, ...(params ? [params] : [])];\n\nexport type GetUnitChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnitCharges>>\n>;\nexport type GetUnitChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetUnitCharges = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({\n signal,\n }) => getUnitCharges(unitId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"]}
package/unit/unit.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { aC as customInstance, an as OrganisationUnitsGetResponse, aD as ErrorType, ay as AsError, O as OrganisationUnitPostBodyBody, aq as OrganisationUnitPostResponse, u as UnitDetail, a2 as UnitsGetResponse, n as PersonalUnitPutBodyBody, ap as PersonalUnitPutResponse, G as GetUnitChargesParams, a9 as UnitChargesGetResponse } from '../custom-instance-dad9d28e.js';
1
+ import { aE as customInstance, ap as OrganisationUnitsGetResponse, aF as ErrorType, aA as AsError, o as OrganisationUnitPostBodyBody, as as OrganisationUnitPostResponse, w as UnitDetail, n as UnitPatchBodyBody, a4 as UnitsGetResponse, p as PersonalUnitPutBodyBody, ar as PersonalUnitPutResponse, k as GetUnitChargesParams, ab as UnitChargesGetResponse } from '../custom-instance-85497958.js';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
4
4
  import 'axios';
5
5
 
6
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
6
+ type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
7
  /**
8
8
  * Gets Organisational Units you have access to or that are public
9
9
 
@@ -11,8 +11,8 @@ declare type SecondParameter<T extends (...args: any) => any> = T extends (confi
11
11
  */
12
12
  declare const getOrganisationUnits: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationUnitsGetResponse>;
13
13
  declare const getGetOrganisationUnitsQueryKey: (orgId: string) => string[];
14
- declare type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>;
15
- declare type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
14
+ type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>;
15
+ type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
16
16
  declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
17
17
  query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
18
18
  request?: SecondParameter<typeof customInstance>;
@@ -25,9 +25,9 @@ declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TE
25
25
  * @summary Create a new Organisational Unit
26
26
  */
27
27
  declare const createOrganisationUnit: (orgId: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
28
- declare type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>;
29
- declare type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
30
- declare type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
28
+ type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>;
29
+ type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
30
+ type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
31
31
  declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
32
32
  mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
33
33
  orgId: string;
@@ -45,22 +45,43 @@ declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TC
45
45
  */
46
46
  declare const getUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitDetail>;
47
47
  declare const getGetUnitQueryKey: (unitId: string) => string[];
48
- declare type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
49
- declare type GetUnitQueryError = ErrorType<void | AsError>;
48
+ type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
49
+ type GetUnitQueryError = ErrorType<void | AsError>;
50
50
  declare const useGetUnit: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
51
51
  query?: UseQueryOptions<UnitDetail, TError, TData, QueryKey> | undefined;
52
52
  request?: SecondParameter<typeof customInstance>;
53
53
  } | undefined) => UseQueryResult<TData, TError> & {
54
54
  queryKey: QueryKey;
55
55
  };
56
+ /**
57
+ * Used to update existing **Unit**.
58
+
59
+ You have to be the Unit owner (or an administrator) to patch a Unit.
60
+
61
+ * @summary Adjust an existing Unit
62
+ */
63
+ declare const patchUnit: (unitId: string, unitPatchBodyBody: UnitPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
64
+ type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>;
65
+ type PatchUnitMutationBody = UnitPatchBodyBody;
66
+ type PatchUnitMutationError = ErrorType<AsError>;
67
+ declare const usePatchUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
68
+ mutation?: UseMutationOptions<void, TError, {
69
+ unitId: string;
70
+ data: UnitPatchBodyBody;
71
+ }, TContext> | undefined;
72
+ request?: SecondParameter<typeof customInstance>;
73
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
74
+ unitId: string;
75
+ data: UnitPatchBodyBody;
76
+ }, TContext>;
56
77
  /**
57
78
  * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products
58
79
 
59
80
  * @summary Deletes an Organisational Unit
60
81
  */
61
82
  declare const deleteOrganisationUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
62
- declare type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>;
63
- declare type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
83
+ type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>;
84
+ type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
64
85
  declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
65
86
  mutation?: UseMutationOptions<void, TError, {
66
87
  unitId: string;
@@ -76,8 +97,8 @@ declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext
76
97
  */
77
98
  declare const getUnits: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitsGetResponse>;
78
99
  declare const getGetUnitsQueryKey: () => string[];
79
- declare type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
80
- declare type GetUnitsQueryError = ErrorType<void | AsError>;
100
+ type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
101
+ type GetUnitsQueryError = ErrorType<void | AsError>;
81
102
  declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
82
103
  query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
83
104
  request?: SecondParameter<typeof customInstance>;
@@ -90,9 +111,9 @@ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void |
90
111
  * @summary Create a new Personal Unit
91
112
  */
92
113
  declare const createDefaultUnit: (personalUnitPutBodyBody: PersonalUnitPutBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
93
- declare type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
94
- declare type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
95
- declare type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
114
+ type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
115
+ type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
116
+ type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
96
117
  declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
97
118
  mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, {
98
119
  data: PersonalUnitPutBodyBody;
@@ -107,8 +128,8 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TContex
107
128
  * @summary Deletes a Personal Unit
108
129
  */
109
130
  declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
110
- declare type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
111
- declare type DeleteDefaultUnitMutationError = ErrorType<AsError>;
131
+ type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
132
+ type DeleteDefaultUnitMutationError = ErrorType<AsError>;
112
133
  declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
113
134
  mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
114
135
  request?: SecondParameter<typeof customInstance>;
@@ -125,8 +146,8 @@ You need to be part of the **Unit** or **Organisation** to use this method
125
146
  */
126
147
  declare const getUnitCharges: (unitId: string, params?: GetUnitChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitChargesGetResponse>;
127
148
  declare const getGetUnitChargesQueryKey: (unitId: string, params?: GetUnitChargesParams) => (string | GetUnitChargesParams)[];
128
- declare type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>;
129
- declare type GetUnitChargesQueryError = ErrorType<AsError | void>;
149
+ type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>;
150
+ type GetUnitChargesQueryError = ErrorType<AsError | void>;
130
151
  declare const useGetUnitCharges: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
131
152
  query?: UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> | undefined;
132
153
  request?: SecondParameter<typeof customInstance>;
@@ -134,4 +155,4 @@ declare const useGetUnitCharges: <TData = UnitChargesGetResponse, TError = Error
134
155
  queryKey: QueryKey;
135
156
  };
136
157
 
137
- export { CreateDefaultUnitMutationBody, CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitChargesQueryError, GetUnitChargesQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitChargesQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnitCharges, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnitCharges, useGetUnits };
158
+ export { CreateDefaultUnitMutationBody, CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitChargesQueryError, GetUnitChargesQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, PatchUnitMutationBody, PatchUnitMutationError, PatchUnitMutationResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitChargesQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnitCharges, getUnits, patchUnit, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnitCharges, useGetUnits, usePatchUnit };