@squonk/account-server-client 0.1.23 → 0.1.26

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 (51) hide show
  1. package/{custom-instance-86dd5ce6.d.ts → account-server-api.schemas-078442c3.d.ts} +4 -22
  2. package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
  3. package/chunk-GWBPVOL2.js.map +1 -0
  4. package/chunk-N3RLW53G.cjs +25 -0
  5. package/chunk-N3RLW53G.cjs.map +1 -0
  6. package/index.cjs +21 -5
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +20 -2
  9. package/index.js +21 -5
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +20 -65
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +18 -58
  14. package/organisation/organisation.js +20 -65
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +14 -14
  17. package/product/product.cjs +32 -107
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +24 -84
  20. package/product/product.js +32 -107
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +11 -38
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +9 -31
  25. package/service/service.js +11 -38
  26. package/service/service.js.map +1 -1
  27. package/src/account-server-api.schemas.ts +3 -3
  28. package/src/organisation/organisation.ts +43 -191
  29. package/src/product/product.ts +87 -294
  30. package/src/service/service.ts +17 -101
  31. package/src/state/state.ts +17 -66
  32. package/src/unit/unit.ts +71 -315
  33. package/src/user/user.ts +68 -330
  34. package/state/state.cjs +8 -22
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +7 -16
  37. package/state/state.js +8 -22
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +30 -109
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +25 -92
  42. package/unit/unit.js +30 -109
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +30 -107
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +20 -118
  47. package/user/user.js +30 -107
  48. package/user/user.js.map +1 -1
  49. package/chunk-3DXYUDZH.cjs +0 -46
  50. package/chunk-3DXYUDZH.cjs.map +0 -1
  51. package/chunk-JR7F532L.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.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: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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 product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport const useGetProductTypes = <\n TData = AsyncReturnType<typeof getProductTypes>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductTypes>,\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 ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProductTypes>> = () =>\n getProductTypes(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport const useGetProducts = <\n TData = AsyncReturnType<typeof getProducts>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, 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 ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProducts>> = () =>\n getProducts(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProducts>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitid: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitid}`,\n method: \"post\",\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitid: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createUnitProduct>,\n { unitid: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitid, data } = props || {};\n\n return createUnitProduct(unitid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitid: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitid: string) => [\n `/product/unit/${unitid}`,\n];\n\nexport const useGetProductsForUnit = <\n TData = AsyncReturnType<typeof getProductsForUnit>,\n TError = ErrorType<void | AsError>\n>(\n unitid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductsForUnit>,\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 ?? getGetProductsForUnitQueryKey(unitid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getProductsForUnit>\n > = () => getProductsForUnit(unitid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const getProduct = (\n unitid: string,\n productid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/unit/${unitid}/product/${productid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductQueryKey = (unitid: string, productid: string) => [\n `/product/unit/${unitid}/product/${productid}`,\n];\n\nexport const useGetProduct = <\n TData = AsyncReturnType<typeof getProduct>,\n TError = ErrorType<AsError | void>\n>(\n unitid: string,\n productid: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProduct>, 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 =\n queryOptions?.queryKey ?? getGetProductQueryKey(unitid, productid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProduct>> = () =>\n getProduct(unitid, productid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProduct>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(unitid && productid), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. Curerntly you can only patch storage Products\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n unitid: string,\n productid: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/unit/${unitid}/product/${productid}`,\n method: \"patch\",\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitid: string; productid: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchProduct>,\n { unitid: string; productid: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitid, productid, data } = props || {};\n\n return patchProduct(unitid, productid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitid: string; productid: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":"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","names":[]}
1
+ {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ProductsGetTypesResponse,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\nexport const getProduct = () => {\n /**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\n const appApiProductGetTypes = <\n TData = AxiosResponse<ProductsGetTypesResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product-type`, options);\n };\n /**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\n const appApiProductGet = <TData = AxiosResponse<ProductsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product`, options);\n };\n /**\n * @summary Creates a Product for an Organisational Unit\n */\n const appApiProductPost = <TData = AxiosResponse<UnitProductPostResponse>>(\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n };\n /**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\n const appApiProductGetForUnit = <TData = AxiosResponse<ProductsGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}`, options);\n };\n /**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\n const appApiProductGetUnitProduct = <\n TData = AxiosResponse<ProductUnitGetResponse>\n >(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n };\n /**\n * @summary Deletes an existing Product\n */\n const appApiProductDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(\n `/product/unit/${unitId}/product/${productId}`,\n options\n );\n };\n /**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\n const appApiProductPatch = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n };\n return {\n appApiProductGetTypes,\n appApiProductGet,\n appApiProductPost,\n appApiProductGetForUnit,\n appApiProductGetUnitProduct,\n appApiProductDelete,\n appApiProductPatch,\n };\n};\nexport type AppApiProductGetTypesResult =\n AxiosResponse<ProductsGetTypesResponse>;\nexport type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;\nexport type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductGetUnitProductResult =\n AxiosResponse<ProductUnitGetResponse>;\nexport type AppApiProductDeleteResult = AxiosResponse<void>;\nexport type AppApiProductPatchResult = AxiosResponse<void>;\n"],"mappings":";;;AAUA;AAUO,IAAM,aAAa,MAAM;AAM9B,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAIA,QAAM,oBAAoB,CACxB,QACA,yBACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,UACjB,yBACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,UAAU,OAAO;AAAA,EACrD;AAMA,QAAM,8BAA8B,CAGlC,QACA,WACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,kBAAkB,aAAa,OAAO;AAAA,EAC1E;AAIA,QAAM,sBAAsB,CAC1B,QACA,WACA,YACmB;AACnB,WAAO,MAAM,OACX,iBAAiB,kBAAkB,aACnC,OACF;AAAA,EACF;AAMA,QAAM,qBAAqB,CACzB,QACA,WACA,sBACA,YACmB;AACnB,WAAO,MAAM,MACX,iBAAiB,kBAAkB,aACnC,sBACA,OACF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,44 +1,17 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
-
4
- var _chunk3DXYUDZHcjs = require('../chunk-3DXYUDZH.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-N3RLW53G.cjs');
5
2
 
6
3
  // src/service/service.ts
7
-
8
-
9
- var _reactquery = require('react-query');
10
- var getServices = (options) => {
11
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/service`, method: "get" }, options);
12
- };
13
- var getGetServicesQueryKey = () => [`/service`];
14
- var useGetServices = (options) => {
15
- const { query: queryOptions, request: requestOptions } = options || {};
16
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServicesQueryKey()));
17
- const queryFn = () => getServices(requestOptions);
18
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
19
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
20
- queryKey
21
- }, query);
22
- };
23
- var getService = (svcid, options) => {
24
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/service/${svcid}`, method: "get" }, options);
4
+ var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
5
+ var getService = () => {
6
+ const appApiServiceGet = (options) => {
7
+ return _axios2.default.get(`/service`, options);
8
+ };
9
+ const appApiServiceGetId = (svcId, options) => {
10
+ return _axios2.default.get(`/service/${svcId}`, options);
11
+ };
12
+ return { appApiServiceGet, appApiServiceGetId };
25
13
  };
26
- var getGetServiceQueryKey = (svcid) => [`/service/${svcid}`];
27
- var useGetService = (svcid, options) => {
28
- const { query: queryOptions, request: requestOptions } = options || {};
29
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServiceQueryKey(svcid)));
30
- const queryFn = () => getService(svcid, requestOptions);
31
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!svcid }, queryOptions));
32
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
33
- queryKey
34
- }, query);
35
- };
36
-
37
-
38
-
39
-
40
-
41
14
 
42
15
 
43
- exports.getGetServiceQueryKey = getGetServiceQueryKey; exports.getGetServicesQueryKey = getGetServicesQueryKey; exports.getService = getService; exports.getServices = getServices; exports.useGetService = useGetService; exports.useGetServices = useGetServices;
16
+ exports.getService = getService;
44
17
  //# sourceMappingURL=service.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,SAC3B;AAAA;AAIG,IAAM,yBAAyB,MAAM,CAAC;AAEtC,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAA8D,MAClE,YAAY;AAEd,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,SACpC;AAAA;AAIG,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY;AAE9D,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAA6D,MACjE,WAAW,OAAO;AAEpB,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU;AAGzB,SAAO;AAAA,IACL;AAAA,KACG;AAAA","sourcesContent":["/**\n * Generated by orval v6.6.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: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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 services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, 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 ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcid: number) => [`/service/${svcid}`];\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcid: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, 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 ?? getGetServiceQueryKey(svcid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcid, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
1
+ {"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;AAUA;AAMO,IAAM,aAAa,MAAM;AAM9B,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAMA,QAAM,qBAAqB,CACzB,OACA,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,SAAS,OAAO;AAAA,EAC/C;AACA,SAAO,EAAE,kBAAkB,mBAAmB;AAChD","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ServicesGetResponse,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getService = () => {\n /**\n * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\n const appApiServiceGet = <TData = AxiosResponse<ServicesGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/service`, options);\n };\n /**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\n const appApiServiceGetId = <TData = AxiosResponse<ServiceGetResponse>>(\n svcId: number,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/service/${svcId}`, options);\n };\n return { appApiServiceGet, appApiServiceGetId };\n};\nexport type AppApiServiceGetResult = AxiosResponse<ServicesGetResponse>;\nexport type AppApiServiceGetIdResult = AxiosResponse<ServiceGetResponse>;\n"]}
@@ -1,9 +1,8 @@
1
- import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
2
- import { V as customInstance, h as ServicesGetResponse, W as ErrorType, N as AsError, g as ServiceGetResponse } from '../custom-instance-86dd5ce6';
3
- import 'axios';
1
+ import { AxiosResponse, AxiosRequestConfig } from 'axios';
2
+ import { h as ServicesGetResponse, g as ServiceGetResponse } from '../account-server-api.schemas-078442c3.js';
4
3
 
5
4
  /**
6
- * Generated by orval v6.6.0 🍺
5
+ * Generated by orval v6.7.1 🍺
7
6
  * Do not edit manually.
8
7
  * Account Server API
9
8
  * The Informatics Matters Account Server API.
@@ -13,32 +12,11 @@ A service that provides access to the Account Server, which gives *registered* u
13
12
  * OpenAPI spec version: 0.1
14
13
  */
15
14
 
16
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
17
- /**
18
- * Gets services known to the Account Server
19
-
20
- * @summary Gets all Services
21
- */
22
- declare const getServices: (options?: SecondParameter<typeof customInstance>) => Promise<ServicesGetResponse>;
23
- declare const getGetServicesQueryKey: () => string[];
24
- declare const useGetServices: <TData = ServicesGetResponse, TError = ErrorType<void | AsError>>(options?: {
25
- query?: UseQueryOptions<ServicesGetResponse, TError, TData, QueryKey> | undefined;
26
- request?: SecondParameter<typeof customInstance>;
27
- } | undefined) => UseQueryResult<TData, TError> & {
28
- queryKey: QueryKey;
29
- };
30
- /**
31
- * Gets a known service
32
-
33
- * @summary Gets a specific Service
34
- */
35
- declare const getService: (svcid: number, options?: SecondParameter<typeof customInstance>) => Promise<ServiceGetResponse>;
36
- declare const getGetServiceQueryKey: (svcid: number) => string[];
37
- declare const useGetService: <TData = ServiceGetResponse, TError = ErrorType<void | AsError>>(svcid: number, options?: {
38
- query?: UseQueryOptions<ServiceGetResponse, TError, TData, QueryKey> | undefined;
39
- request?: SecondParameter<typeof customInstance>;
40
- } | undefined) => UseQueryResult<TData, TError> & {
41
- queryKey: QueryKey;
15
+ declare const getService: () => {
16
+ appApiServiceGet: <TData = AxiosResponse<ServicesGetResponse, any>>(options?: AxiosRequestConfig<any> | undefined) => Promise<TData>;
17
+ appApiServiceGetId: <TData_1 = AxiosResponse<ServiceGetResponse, any>>(svcId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<TData_1>;
42
18
  };
19
+ declare type AppApiServiceGetResult = AxiosResponse<ServicesGetResponse>;
20
+ declare type AppApiServiceGetIdResult = AxiosResponse<ServiceGetResponse>;
43
21
 
44
- export { getGetServiceQueryKey, getGetServicesQueryKey, getService, getServices, useGetService, useGetServices };
22
+ export { AppApiServiceGetIdResult, AppApiServiceGetResult, getService };
@@ -1,44 +1,17 @@
1
- import {
2
- __spreadValues,
3
- customInstance
4
- } from "../chunk-JR7F532L.js";
1
+ import "../chunk-GWBPVOL2.js";
5
2
 
6
3
  // src/service/service.ts
7
- import {
8
- useQuery
9
- } from "react-query";
10
- var getServices = (options) => {
11
- return customInstance({ url: `/service`, method: "get" }, options);
12
- };
13
- var getGetServicesQueryKey = () => [`/service`];
14
- var useGetServices = (options) => {
15
- const { query: queryOptions, request: requestOptions } = options || {};
16
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServicesQueryKey();
17
- const queryFn = () => getServices(requestOptions);
18
- const query = useQuery(queryKey, queryFn, queryOptions);
19
- return __spreadValues({
20
- queryKey
21
- }, query);
22
- };
23
- var getService = (svcid, options) => {
24
- return customInstance({ url: `/service/${svcid}`, method: "get" }, options);
25
- };
26
- var getGetServiceQueryKey = (svcid) => [`/service/${svcid}`];
27
- var useGetService = (svcid, options) => {
28
- const { query: queryOptions, request: requestOptions } = options || {};
29
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServiceQueryKey(svcid);
30
- const queryFn = () => getService(svcid, requestOptions);
31
- const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!svcid }, queryOptions));
32
- return __spreadValues({
33
- queryKey
34
- }, query);
4
+ import axios from "axios";
5
+ var getService = () => {
6
+ const appApiServiceGet = (options) => {
7
+ return axios.get(`/service`, options);
8
+ };
9
+ const appApiServiceGetId = (svcId, options) => {
10
+ return axios.get(`/service/${svcId}`, options);
11
+ };
12
+ return { appApiServiceGet, appApiServiceGetId };
35
13
  };
36
14
  export {
37
- getGetServiceQueryKey,
38
- getGetServicesQueryKey,
39
- getService,
40
- getServices,
41
- useGetService,
42
- useGetServices
15
+ getService
43
16
  };
44
17
  //# sourceMappingURL=service.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/service/service.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.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: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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 services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, 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 ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcid: number) => [`/service/${svcid}`];\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcid: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, 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 ?? getGetServiceQueryKey(svcid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcid, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,SAC3B;AAAA;AAIG,IAAM,yBAAyB,MAAM,CAAC;AAEtC,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAA8D,MAClE,YAAY;AAEd,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,SACpC;AAAA;AAIG,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY;AAE9D,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAA6D,MACjE,WAAW,OAAO;AAEpB,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU;AAGzB,SAAO;AAAA,IACL;AAAA,KACG;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/service/service.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ServicesGetResponse,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\n\nexport const getService = () => {\n /**\n * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\n const appApiServiceGet = <TData = AxiosResponse<ServicesGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/service`, options);\n };\n /**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\n const appApiServiceGetId = <TData = AxiosResponse<ServiceGetResponse>>(\n svcId: number,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/service/${svcId}`, options);\n };\n return { appApiServiceGet, appApiServiceGetId };\n};\nexport type AppApiServiceGetResult = AxiosResponse<ServicesGetResponse>;\nexport type AppApiServiceGetIdResult = AxiosResponse<ServiceGetResponse>;\n"],"mappings":";;;AAUA;AAMO,IAAM,aAAa,MAAM;AAM9B,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAMA,QAAM,qBAAqB,CACzB,OACA,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,SAAS,OAAO;AAAA,EAC/C;AACA,SAAO,EAAE,kBAAkB,mBAAmB;AAChD;","names":[]}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.6.0 🍺
2
+ * Generated by orval v6.7.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -11,9 +11,9 @@ A service that provides access to the Account Server, which gives *registered* u
11
11
  export type ProductPatchBodyBody = {
12
12
  /** The name you want to give the Product */
13
13
  name?: string;
14
- /** The Product's built-in coin allowance. */
14
+ /** The Product's built-in coin allowance. Product allowances cannot be reduced */
15
15
  allowance?: number;
16
- /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used */
16
+ /** The Product's built-in coin limit. If set it must not be less than the allowance. If not set the allowance is used. The existing product limit cannot be reduced */
17
17
  limit?: number;
18
18
  };
19
19
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.6.0 🍺
2
+ * Generated by orval v6.7.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,226 +8,78 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import {
12
- useQuery,
13
- useMutation,
14
- UseQueryOptions,
15
- UseMutationOptions,
16
- QueryFunction,
17
- MutationFunction,
18
- UseQueryResult,
19
- QueryKey,
20
- } from "react-query";
11
+ import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
21
12
  import type {
22
13
  OrganisationsGetResponse,
23
- AsError,
24
14
  OrganisationPostResponse,
25
15
  OrganisationPostBodyBody,
26
16
  OrganisationGetDefaultResponse,
27
17
  } from "../account-server-api.schemas";
28
- import { customInstance, ErrorType } from ".././custom-instance";
29
18
 
30
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
- type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
32
- ...args: any
33
- ) => Promise<infer R>
34
- ? R
35
- : any;
36
-
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- type SecondParameter<T extends (...args: any) => any> = T extends (
39
- config: any,
40
- args: infer P
41
- ) => any
42
- ? P
43
- : never;
44
-
45
- /**
19
+ export const getOrganisation = () => {
20
+ /**
46
21
  * Gets all the Organisations you are a member of. Admin users can see all Organisations
47
22
 
48
23
  * @summary Gets Organisations
49
24
  */
50
- export const getOrganisations = (
51
- options?: SecondParameter<typeof customInstance>
52
- ) => {
53
- return customInstance<OrganisationsGetResponse>(
54
- { url: `/organisation`, method: "get" },
55
- options
56
- );
57
- };
58
-
59
- export const getGetOrganisationsQueryKey = () => [`/organisation`];
60
-
61
- export const useGetOrganisations = <
62
- TData = AsyncReturnType<typeof getOrganisations>,
63
- TError = ErrorType<void | AsError>
64
- >(options?: {
65
- query?: UseQueryOptions<
66
- AsyncReturnType<typeof getOrganisations>,
67
- TError,
68
- TData
69
- >;
70
- request?: SecondParameter<typeof customInstance>;
71
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
72
- const { query: queryOptions, request: requestOptions } = options || {};
73
-
74
- const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
75
-
76
- const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>
77
- getOrganisations(requestOptions);
78
-
79
- const query = useQuery<
80
- AsyncReturnType<typeof getOrganisations>,
81
- TError,
82
- TData
83
- >(queryKey, queryFn, queryOptions);
84
-
85
- return {
86
- queryKey,
87
- ...query,
25
+ const appApiOrganisationGet = <
26
+ TData = AxiosResponse<OrganisationsGetResponse>
27
+ >(
28
+ options?: AxiosRequestConfig
29
+ ): Promise<TData> => {
30
+ return axios.get(`/organisation`, options);
88
31
  };
89
- };
90
-
91
- /**
32
+ /**
92
33
  * Creates a new Organisation
93
34
 
94
35
  You need **admin** rights to use this method
95
36
 
96
37
  * @summary Create a new organisation
97
38
  */
98
- export const createOrganisation = (
99
- organisationPostBodyBody: OrganisationPostBodyBody,
100
- options?: SecondParameter<typeof customInstance>
101
- ) => {
102
- return customInstance<OrganisationPostResponse>(
103
- { url: `/organisation`, method: "post", data: organisationPostBodyBody },
104
- options
105
- );
106
- };
107
-
108
- export const useCreateOrganisation = <
109
- TError = ErrorType<AsError | void>,
110
- TContext = unknown
111
- >(options?: {
112
- mutation?: UseMutationOptions<
113
- AsyncReturnType<typeof createOrganisation>,
114
- TError,
115
- { data: OrganisationPostBodyBody },
116
- TContext
117
- >;
118
- request?: SecondParameter<typeof customInstance>;
119
- }) => {
120
- const { mutation: mutationOptions, request: requestOptions } = options || {};
121
-
122
- const mutationFn: MutationFunction<
123
- AsyncReturnType<typeof createOrganisation>,
124
- { data: OrganisationPostBodyBody }
125
- > = (props) => {
126
- const { data } = props || {};
127
-
128
- return createOrganisation(data, requestOptions);
39
+ const appApiOrganisationPost = <
40
+ TData = AxiosResponse<OrganisationPostResponse>
41
+ >(
42
+ organisationPostBodyBody: OrganisationPostBodyBody,
43
+ options?: AxiosRequestConfig
44
+ ): Promise<TData> => {
45
+ return axios.post(`/organisation`, organisationPostBodyBody, options);
129
46
  };
130
-
131
- return useMutation<
132
- AsyncReturnType<typeof createOrganisation>,
133
- TError,
134
- { data: OrganisationPostBodyBody },
135
- TContext
136
- >(mutationFn, mutationOptions);
137
- };
138
- /**
47
+ /**
139
48
  * Units must first be deleted before an Organisation can be deleted
140
49
 
141
50
  You need **admin** rights to use this method
142
51
 
143
52
  * @summary Deletes an Organisation
144
53
  */
145
- export const deleteOrganisation = (
146
- orgid: string,
147
- options?: SecondParameter<typeof customInstance>
148
- ) => {
149
- return customInstance<void>(
150
- { url: `/organisation/${orgid}`, method: "delete" },
151
- options
152
- );
153
- };
154
-
155
- export const useDeleteOrganisation = <
156
- TError = ErrorType<AsError>,
157
- TContext = unknown
158
- >(options?: {
159
- mutation?: UseMutationOptions<
160
- AsyncReturnType<typeof deleteOrganisation>,
161
- TError,
162
- { orgid: string },
163
- TContext
164
- >;
165
- request?: SecondParameter<typeof customInstance>;
166
- }) => {
167
- const { mutation: mutationOptions, request: requestOptions } = options || {};
168
-
169
- const mutationFn: MutationFunction<
170
- AsyncReturnType<typeof deleteOrganisation>,
171
- { orgid: string }
172
- > = (props) => {
173
- const { orgid } = props || {};
174
-
175
- return deleteOrganisation(orgid, requestOptions);
54
+ const appApiOrganisationDelete = <TData = AxiosResponse<void>>(
55
+ orgId: string,
56
+ options?: AxiosRequestConfig
57
+ ): Promise<TData> => {
58
+ return axios.delete(`/organisation/${orgId}`, options);
176
59
  };
177
-
178
- return useMutation<
179
- AsyncReturnType<typeof deleteOrganisation>,
180
- TError,
181
- { orgid: string },
182
- TContext
183
- >(mutationFn, mutationOptions);
184
- };
185
- /**
60
+ /**
186
61
  * Gets the built-in Default Organisation, used exclusively for Independent Units
187
62
 
188
63
  * @summary Gets the (built-in) Default Organisation
189
64
  */
190
- export const getDefaultOrganisation = (
191
- options?: SecondParameter<typeof customInstance>
192
- ) => {
193
- return customInstance<OrganisationGetDefaultResponse>(
194
- { url: `/organisation/default`, method: "get" },
195
- options
196
- );
197
- };
198
-
199
- export const getGetDefaultOrganisationQueryKey = () => [
200
- `/organisation/default`,
201
- ];
202
-
203
- export const useGetDefaultOrganisation = <
204
- TData = AsyncReturnType<typeof getDefaultOrganisation>,
205
- TError = ErrorType<void | AsError>
206
- >(options?: {
207
- query?: UseQueryOptions<
208
- AsyncReturnType<typeof getDefaultOrganisation>,
209
- TError,
210
- TData
211
- >;
212
- request?: SecondParameter<typeof customInstance>;
213
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
214
- const { query: queryOptions, request: requestOptions } = options || {};
215
-
216
- const queryKey =
217
- queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
218
-
219
- const queryFn: QueryFunction<
220
- AsyncReturnType<typeof getDefaultOrganisation>
221
- > = () => getDefaultOrganisation(requestOptions);
222
-
223
- const query = useQuery<
224
- AsyncReturnType<typeof getDefaultOrganisation>,
225
- TError,
226
- TData
227
- >(queryKey, queryFn, queryOptions);
228
-
65
+ const appApiOrganisationGetDefault = <
66
+ TData = AxiosResponse<OrganisationGetDefaultResponse>
67
+ >(
68
+ options?: AxiosRequestConfig
69
+ ): Promise<TData> => {
70
+ return axios.get(`/organisation/default`, options);
71
+ };
229
72
  return {
230
- queryKey,
231
- ...query,
73
+ appApiOrganisationGet,
74
+ appApiOrganisationPost,
75
+ appApiOrganisationDelete,
76
+ appApiOrganisationGetDefault,
232
77
  };
233
78
  };
79
+ export type AppApiOrganisationGetResult =
80
+ AxiosResponse<OrganisationsGetResponse>;
81
+ export type AppApiOrganisationPostResult =
82
+ AxiosResponse<OrganisationPostResponse>;
83
+ export type AppApiOrganisationDeleteResult = AxiosResponse<void>;
84
+ export type AppApiOrganisationGetDefaultResult =
85
+ AxiosResponse<OrganisationGetDefaultResponse>;