@squonk/account-server-client 0.1.26-rc.1 → 0.1.28-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 (51) hide show
  1. package/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
  2. package/chunk-6EEIAH4R.js.map +1 -0
  3. package/chunk-NGBTCJWS.cjs +46 -0
  4. package/chunk-NGBTCJWS.cjs.map +1 -0
  5. package/{account-server-api.schemas-078442c3.d.ts → custom-instance-13412a15.d.ts} +32 -1
  6. package/index.cjs +5 -21
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +2 -20
  9. package/index.js +5 -21
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +70 -20
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +68 -18
  14. package/organisation/organisation.js +70 -20
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +1 -1
  17. package/product/product.cjs +121 -31
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +115 -24
  20. package/product/product.js +121 -31
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +38 -11
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +35 -8
  25. package/service/service.js +38 -11
  26. package/service/service.js.map +1 -1
  27. package/src/account-server-api.schemas.ts +13 -0
  28. package/src/organisation/organisation.ts +219 -44
  29. package/src/product/product.ts +375 -84
  30. package/src/service/service.ts +110 -16
  31. package/src/state/state.ts +70 -16
  32. package/src/unit/unit.ts +354 -74
  33. package/src/user/user.ts +368 -67
  34. package/state/state.cjs +22 -8
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +18 -6
  37. package/state/state.js +22 -8
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +110 -30
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +108 -25
  42. package/unit/unit.js +110 -30
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +107 -30
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +133 -20
  47. package/user/user.js +107 -30
  48. package/user/user.js.map +1 -1
  49. package/chunk-GWBPVOL2.js.map +0 -1
  50. package/chunk-N3RLW53G.cjs +0 -25
  51. package/chunk-N3RLW53G.cjs.map +0 -1
@@ -1,40 +1,130 @@
1
- import "../chunk-GWBPVOL2.js";
1
+ import {
2
+ __spreadValues,
3
+ customInstance
4
+ } from "../chunk-6EEIAH4R.js";
2
5
 
3
6
  // src/product/product.ts
4
- import axios from "axios";
5
- var getProduct = () => {
6
- const appApiProductGetTypes = (options) => {
7
- return axios.get(`/product-type`, options);
8
- };
9
- const appApiProductGet = (options) => {
10
- return axios.get(`/product`, options);
11
- };
12
- const appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
13
- return axios.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
14
- };
15
- const appApiProductGetForUnit = (unitId, options) => {
16
- return axios.get(`/product/unit/${unitId}`, options);
17
- };
18
- const appApiProductGetUnitProduct = (unitId, productId, options) => {
19
- return axios.get(`/product/unit/${unitId}/product/${productId}`, options);
20
- };
21
- const appApiProductDelete = (unitId, productId, options) => {
22
- return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);
7
+ import {
8
+ useQuery,
9
+ useMutation
10
+ } from "react-query";
11
+ var getProductTypes = (options) => {
12
+ return customInstance({ url: `/product-type`, method: "get" }, options);
13
+ };
14
+ var getGetProductTypesQueryKey = () => [`/product-type`];
15
+ var useGetProductTypes = (options) => {
16
+ const { query: queryOptions, request: requestOptions } = options || {};
17
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductTypesQueryKey();
18
+ const queryFn = () => getProductTypes(requestOptions);
19
+ const query = useQuery(queryKey, queryFn, queryOptions);
20
+ return __spreadValues({
21
+ queryKey
22
+ }, query);
23
+ };
24
+ var getProducts = (options) => {
25
+ return customInstance({ url: `/product`, method: "get" }, options);
26
+ };
27
+ var getGetProductsQueryKey = () => [`/product`];
28
+ var useGetProducts = (options) => {
29
+ const { query: queryOptions, request: requestOptions } = options || {};
30
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsQueryKey();
31
+ const queryFn = () => getProducts(requestOptions);
32
+ const query = useQuery(queryKey, queryFn, queryOptions);
33
+ return __spreadValues({
34
+ queryKey
35
+ }, query);
36
+ };
37
+ var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
38
+ return customInstance({
39
+ url: `/product/unit/${unitId}`,
40
+ method: "post",
41
+ headers: { "Content-Type": "application/json" },
42
+ data: unitProductPostBodyBody
43
+ }, options);
44
+ };
45
+ var useCreateUnitProduct = (options) => {
46
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
47
+ const mutationFn = (props) => {
48
+ const { unitId, data } = props || {};
49
+ return createUnitProduct(unitId, data, requestOptions);
23
50
  };
24
- const appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
25
- return axios.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
51
+ return useMutation(mutationFn, mutationOptions);
52
+ };
53
+ var getProductsForUnit = (unitId, options) => {
54
+ return customInstance({ url: `/product/unit/${unitId}`, method: "get" }, options);
55
+ };
56
+ var getGetProductsForUnitQueryKey = (unitId) => [
57
+ `/product/unit/${unitId}`
58
+ ];
59
+ var useGetProductsForUnit = (unitId, options) => {
60
+ const { query: queryOptions, request: requestOptions } = options || {};
61
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitId);
62
+ const queryFn = () => getProductsForUnit(unitId, requestOptions);
63
+ const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
64
+ return __spreadValues({
65
+ queryKey
66
+ }, query);
67
+ };
68
+ var getProduct = (unitId, productId, options) => {
69
+ return customInstance({ url: `/product/unit/${unitId}/product/${productId}`, method: "get" }, options);
70
+ };
71
+ var getGetProductQueryKey = (unitId, productId) => [
72
+ `/product/unit/${unitId}/product/${productId}`
73
+ ];
74
+ var useGetProduct = (unitId, productId, options) => {
75
+ const { query: queryOptions, request: requestOptions } = options || {};
76
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductQueryKey(unitId, productId);
77
+ const queryFn = () => getProduct(unitId, productId, requestOptions);
78
+ const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitId && productId) }, queryOptions));
79
+ return __spreadValues({
80
+ queryKey
81
+ }, query);
82
+ };
83
+ var deleteProduct = (unitId, productId, options) => {
84
+ return customInstance({ url: `/product/unit/${unitId}/product/${productId}`, method: "delete" }, options);
85
+ };
86
+ var useDeleteProduct = (options) => {
87
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
88
+ const mutationFn = (props) => {
89
+ const { unitId, productId } = props || {};
90
+ return deleteProduct(unitId, productId, requestOptions);
26
91
  };
27
- return {
28
- appApiProductGetTypes,
29
- appApiProductGet,
30
- appApiProductPost,
31
- appApiProductGetForUnit,
32
- appApiProductGetUnitProduct,
33
- appApiProductDelete,
34
- appApiProductPatch
92
+ return useMutation(mutationFn, mutationOptions);
93
+ };
94
+ var patchProduct = (unitId, productId, productPatchBodyBody, options) => {
95
+ return customInstance({
96
+ url: `/product/unit/${unitId}/product/${productId}`,
97
+ method: "patch",
98
+ headers: { "Content-Type": "application/json" },
99
+ data: productPatchBodyBody
100
+ }, options);
101
+ };
102
+ var usePatchProduct = (options) => {
103
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
104
+ const mutationFn = (props) => {
105
+ const { unitId, productId, data } = props || {};
106
+ return patchProduct(unitId, productId, data, requestOptions);
35
107
  };
108
+ return useMutation(mutationFn, mutationOptions);
36
109
  };
37
110
  export {
38
- getProduct
111
+ createUnitProduct,
112
+ deleteProduct,
113
+ getGetProductQueryKey,
114
+ getGetProductTypesQueryKey,
115
+ getGetProductsForUnitQueryKey,
116
+ getGetProductsQueryKey,
117
+ getProduct,
118
+ getProductTypes,
119
+ getProducts,
120
+ getProductsForUnit,
121
+ patchProduct,
122
+ useCreateUnitProduct,
123
+ useDeleteProduct,
124
+ useGetProduct,
125
+ useGetProductTypes,
126
+ useGetProducts,
127
+ useGetProductsForUnit,
128
+ usePatchProduct
39
129
  };
40
130
  //# sourceMappingURL=product.js.map
@@ -1 +1 @@
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
+ {"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 {\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 type GetProductTypesQueryResult = NonNullable<\n AsyncReturnType<typeof getProductTypes>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\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 type GetProductsQueryResult = NonNullable<\n AsyncReturnType<typeof getProducts>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\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 headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n AsyncReturnType<typeof createUnitProduct>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\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 type GetProductsForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof getProductsForUnit>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\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 type GetProductQueryResult = NonNullable<\n AsyncReturnType<typeof getProduct>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\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 * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n AsyncReturnType<typeof deleteProduct>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteProduct>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return deleteProduct(unitId, productId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\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 */\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 headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchProductMutationResult = NonNullable<\n AsyncReturnType<typeof patchProduct>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\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,17 +1,44 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-N3RLW53G.cjs');
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 _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
2
5
 
3
6
  // src/service/service.ts
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 };
7
+
8
+
9
+ var _reactquery = require('react-query');
10
+ var getServices = (options) => {
11
+ return _chunkNGBTCJWScjs.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 _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
20
+ queryKey
21
+ }, query);
22
+ };
23
+ var getService = (svcId, options) => {
24
+ return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/service/${svcId}`, method: "get" }, options);
13
25
  };
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, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!svcId }, queryOptions));
32
+ return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
33
+ queryKey
34
+ }, query);
35
+ };
36
+
37
+
38
+
39
+
40
+
14
41
 
15
42
 
16
- exports.getService = getService;
43
+ exports.getGetServiceQueryKey = getGetServiceQueryKey; exports.getGetServicesQueryKey = getGetServicesQueryKey; exports.getService = getService; exports.getServices = getServices; exports.useGetService = useGetService; exports.useGetServices = useGetServices;
17
44
  //# sourceMappingURL=service.cjs.map
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,MAAM,GAC1C,OACF;AACF;AAEO,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY,OAAO;AAOrE,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB,KAAK;AAEtE,QAAM,UAA6D,MACjE,WAAW,OAAO,cAAc;AAElC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP","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 {\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 type GetServicesQueryResult = NonNullable<\n AsyncReturnType<typeof getServices>\n>;\nexport type GetServicesQueryError = ErrorType<AsError | void>;\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 type GetServiceQueryResult = NonNullable<\n AsyncReturnType<typeof getService>\n>;\nexport type GetServiceQueryError = ErrorType<AsError | void>;\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,5 +1,6 @@
1
- import { AxiosResponse, AxiosRequestConfig } from 'axios';
2
- import { h as ServicesGetResponse, g as ServiceGetResponse } from '../account-server-api.schemas-078442c3.js';
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-13412a15.js';
3
+ import 'axios';
3
4
 
4
5
  /**
5
6
  * Generated by orval v6.7.1 🍺
@@ -12,11 +13,37 @@ A service that provides access to the Account Server, which gives *registered* u
12
13
  * OpenAPI spec version: 0.1
13
14
  */
14
15
 
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>;
16
+ declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
17
+ declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
18
+ /**
19
+ * Gets services known to the Account Server
20
+
21
+ * @summary Gets all Services
22
+ */
23
+ declare const getServices: (options?: SecondParameter<typeof customInstance>) => Promise<ServicesGetResponse>;
24
+ declare const getGetServicesQueryKey: () => string[];
25
+ declare type GetServicesQueryResult = NonNullable<AsyncReturnType<typeof getServices>>;
26
+ declare type GetServicesQueryError = ErrorType<AsError | void>;
27
+ declare const useGetServices: <TData = ServicesGetResponse, TError = ErrorType<void | AsError>>(options?: {
28
+ query?: UseQueryOptions<ServicesGetResponse, TError, TData, QueryKey> | undefined;
29
+ request?: SecondParameter<typeof customInstance>;
30
+ } | undefined) => UseQueryResult<TData, TError> & {
31
+ queryKey: QueryKey;
32
+ };
33
+ /**
34
+ * Gets a known service
35
+
36
+ * @summary Gets a specific Service
37
+ */
38
+ declare const getService: (svcId: number, options?: SecondParameter<typeof customInstance>) => Promise<ServiceGetResponse>;
39
+ declare const getGetServiceQueryKey: (svcId: number) => string[];
40
+ declare type GetServiceQueryResult = NonNullable<AsyncReturnType<typeof getService>>;
41
+ declare type GetServiceQueryError = ErrorType<AsError | void>;
42
+ declare const useGetService: <TData = ServiceGetResponse, TError = ErrorType<void | AsError>>(svcId: number, options?: {
43
+ query?: UseQueryOptions<ServiceGetResponse, TError, TData, QueryKey> | undefined;
44
+ request?: SecondParameter<typeof customInstance>;
45
+ } | undefined) => UseQueryResult<TData, TError> & {
46
+ queryKey: QueryKey;
18
47
  };
19
- declare type AppApiServiceGetResult = AxiosResponse<ServicesGetResponse>;
20
- declare type AppApiServiceGetIdResult = AxiosResponse<ServiceGetResponse>;
21
48
 
22
- export { AppApiServiceGetIdResult, AppApiServiceGetResult, getService };
49
+ export { GetServiceQueryError, GetServiceQueryResult, GetServicesQueryError, GetServicesQueryResult, getGetServiceQueryKey, getGetServicesQueryKey, getService, getServices, useGetService, useGetServices };
@@ -1,17 +1,44 @@
1
- import "../chunk-GWBPVOL2.js";
1
+ import {
2
+ __spreadValues,
3
+ customInstance
4
+ } from "../chunk-6EEIAH4R.js";
2
5
 
3
6
  // src/service/service.ts
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 };
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);
13
35
  };
14
36
  export {
15
- getService
37
+ getGetServiceQueryKey,
38
+ getGetServicesQueryKey,
39
+ getService,
40
+ getServices,
41
+ useGetService,
42
+ useGetServices
16
43
  };
17
44
  //# sourceMappingURL=service.js.map
@@ -1 +1 @@
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
+ {"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 {\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 type GetServicesQueryResult = NonNullable<\n AsyncReturnType<typeof getServices>\n>;\nexport type GetServicesQueryError = ErrorType<AsError | void>;\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 type GetServiceQueryResult = NonNullable<\n AsyncReturnType<typeof getService>\n>;\nexport type GetServiceQueryError = ErrorType<AsError | void>;\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,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,MAAM,GAC1C,OACF;AACF;AAEO,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY,OAAO;AAOrE,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB,KAAK;AAEtE,QAAM,UAA6D,MACjE,WAAW,OAAO,cAAc;AAElC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
@@ -94,12 +94,16 @@ export interface UserAccountDetail {
94
94
  }
95
95
 
96
96
  export interface UnitDetail {
97
+ /** Whether the user making the API call is a member of the Unit */
98
+ caller_is_member: boolean;
97
99
  /** The Unit's unique identity */
98
100
  id: string;
99
101
  /** The Unit's name */
100
102
  name: string;
101
103
  /** The Unit's owner (a username) */
102
104
  owner_id: string;
105
+ /** True if the Unit is private */
106
+ private: boolean;
103
107
  }
104
108
 
105
109
  /**
@@ -128,12 +132,16 @@ export interface ServicesGetResponse {
128
132
  }
129
133
 
130
134
  export interface OrganisationDetail {
135
+ /** Whether the user making the API call is a member of the Unit */
136
+ caller_is_member: boolean;
131
137
  /** The Organisation's unique ID */
132
138
  id: string;
133
139
  /** The Organisation's name */
134
140
  name: string;
135
141
  /** The username of the Organisation's owner. Not all Organisations have an owner. The Default Organisation has no owner. */
136
142
  owner_id?: string;
143
+ /** True if the Unit is private */
144
+ private: boolean;
137
145
  }
138
146
 
139
147
  export interface ProductType {
@@ -349,12 +357,17 @@ export interface OrganisationUnitPostResponse {
349
357
  }
350
358
 
351
359
  export interface OrganisationGetDefaultResponse {
360
+ /** Whether the user making the API call is a member of the Default Organisation. Only admin users are members of the Default organisation */
361
+ caller_is_member: boolean;
352
362
  /** The Default Organisation ID
353
363
  */
354
364
  id: string;
355
365
  /** The Default Organisation Name
356
366
  */
357
367
  name: string;
368
+ /** True if the Organisation is private. The Default organisation is always public, although it does not contain a membership (unless you're admin) and only houses Personal Units
369
+ */
370
+ private: boolean;
358
371
  }
359
372
 
360
373
  export interface UsersGetResponse {