@squonk/account-server-client 0.1.13-rc.1 → 0.1.14-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 (43) hide show
  1. package/chunk-3DXYUDZH.cjs +46 -0
  2. package/chunk-3DXYUDZH.cjs.map +1 -0
  3. package/chunk-JR7F532L.js +46 -0
  4. package/chunk-JR7F532L.js.map +1 -0
  5. package/{custom-instance-108ca7f1.d.ts → custom-instance-7503296b.d.ts} +16 -16
  6. package/index.cjs +15 -79
  7. package/index.cjs.map +1 -7
  8. package/index.d.ts +1 -1
  9. package/index.js +7 -37
  10. package/index.js.map +1 -7
  11. package/organisation/organisation.cjs +24 -80
  12. package/organisation/organisation.cjs.map +1 -7
  13. package/organisation/organisation.d.ts +1 -1
  14. package/organisation/organisation.js +6 -34
  15. package/organisation/organisation.js.map +1 -7
  16. package/package.json +8 -8
  17. package/product/product.cjs +46 -111
  18. package/product/product.cjs.map +1 -7
  19. package/product/product.d.ts +1 -1
  20. package/product/product.js +5 -33
  21. package/product/product.js.map +1 -7
  22. package/service/service.cjs +22 -78
  23. package/service/service.cjs.map +1 -7
  24. package/service/service.d.ts +2 -2
  25. package/service/service.js +5 -33
  26. package/service/service.js.map +1 -7
  27. package/src/account-server-api.schemas.ts +17 -17
  28. package/src/custom-instance.ts +1 -2
  29. package/src/organisation/organisation.ts +4 -2
  30. package/src/product/product.ts +3 -1
  31. package/src/service/service.ts +3 -1
  32. package/src/unit/unit.ts +57 -11
  33. package/src/user/user.ts +7 -17
  34. package/unit/unit.cjs +58 -107
  35. package/unit/unit.cjs.map +1 -7
  36. package/unit/unit.d.ts +15 -2
  37. package/unit/unit.js +26 -40
  38. package/unit/unit.js.map +1 -7
  39. package/user/user.cjs +40 -115
  40. package/user/user.cjs.map +1 -7
  41. package/user/user.d.ts +1 -1
  42. package/user/user.js +9 -49
  43. package/user/user.js.map +1 -7
@@ -1,100 +1,44 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
- var __export = (target, all) => {
26
- __markAsModule(target);
27
- for (var name in all)
28
- __defProp(target, name, { get: all[name], enumerable: true });
29
- };
30
- var __reExport = (target, module2, desc) => {
31
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
- for (let key of __getOwnPropNames(module2))
33
- if (!__hasOwnProp.call(target, key) && key !== "default")
34
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
35
- }
36
- return target;
37
- };
38
- var __toModule = (module2) => {
39
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
40
- };
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
41
2
 
42
- // src/service/service.ts
43
- __export(exports, {
44
- getGetServiceQueryKey: () => getGetServiceQueryKey,
45
- getGetServicesQueryKey: () => getGetServicesQueryKey,
46
- getService: () => getService,
47
- getServices: () => getServices,
48
- useGetService: () => useGetService,
49
- useGetServices: () => useGetServices
50
- });
51
- var import_react_query = __toModule(require("react-query"));
52
3
 
53
- // src/custom-instance.ts
54
- var import_axios = __toModule(require("axios"));
55
- var AXIOS_INSTANCE = import_axios.default.create({ baseURL: "" });
56
- var customInstance = (config, options) => {
57
- const source = import_axios.default.CancelToken.source();
58
- const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
59
- promise.cancel = () => {
60
- source.cancel("Query was cancelled by React Query");
61
- };
62
- return promise;
63
- };
4
+ var _chunk3DXYUDZHcjs = require('../chunk-3DXYUDZH.cjs');
64
5
 
65
6
  // src/service/service.ts
7
+
8
+
9
+ var _reactquery = require('react-query');
66
10
  var getServices = (options) => {
67
- return customInstance({ url: `/service`, method: "get" }, options);
11
+ return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/service`, method: "get" }, options);
68
12
  };
69
13
  var getGetServicesQueryKey = () => [`/service`];
70
14
  var useGetServices = (options) => {
71
15
  const { query: queryOptions, request: requestOptions } = options || {};
72
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServicesQueryKey();
16
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServicesQueryKey()));
73
17
  const queryFn = () => getServices(requestOptions);
74
- const query = (0, import_react_query.useQuery)(queryKey, queryFn, queryOptions);
75
- return __spreadValues({
18
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
19
+ return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
76
20
  queryKey
77
21
  }, query);
78
22
  };
79
23
  var getService = (svcid, options) => {
80
- return customInstance({ url: `/service/${svcid}`, method: "get" }, options);
24
+ return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/service/${svcid}`, method: "get" }, options);
81
25
  };
82
26
  var getGetServiceQueryKey = (svcid) => [`/service/${svcid}`];
83
27
  var useGetService = (svcid, options) => {
84
28
  const { query: queryOptions, request: requestOptions } = options || {};
85
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServiceQueryKey(svcid);
29
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServiceQueryKey(svcid)));
86
30
  const queryFn = () => getService(svcid, requestOptions);
87
- const query = (0, import_react_query.useQuery)(queryKey, queryFn, __spreadValues({ enabled: !!svcid }, queryOptions));
88
- return __spreadValues({
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, {
89
33
  queryKey
90
34
  }, query);
91
35
  };
92
- // Annotate the CommonJS export names for ESM import in node:
93
- 0 && (module.exports = {
94
- getGetServiceQueryKey,
95
- getGetServicesQueryKey,
96
- getService,
97
- getServices,
98
- useGetService,
99
- useGetServices
100
- });
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ exports.getGetServiceQueryKey = getGetServiceQueryKey; exports.getGetServicesQueryKey = getGetServicesQueryKey; exports.getService = getService; exports.getServices = getServices; exports.useGetService = useGetService; exports.useGetServices = useGetServices;
44
+ //# sourceMappingURL=service.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/service/service.ts", "../../src/custom-instance.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\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\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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", "/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,yBAMO;;;ACNP,mBAAsD;AAG/C,IAAM,iBAAiB,qBAAM,OAAO,EAAE,SAAS;AAmB/C,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,qBAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;;;ADNF,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,iCACZ,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,iCACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU;AAGzB,SAAO;AAAA,IACL;AAAA,KACG;AAAA;",
6
- "names": []
7
- }
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,9 +1,9 @@
1
1
  import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
2
- import { K as customInstance, f as ServicesGetResponse, L as ErrorType, G as AsError, S as ServiceGetResponse } from '../custom-instance-108ca7f1';
2
+ import { K as customInstance, e as ServicesGetResponse, L as ErrorType, G as AsError, S as ServiceGetResponse } from '../custom-instance-7503296b';
3
3
  import 'axios';
4
4
 
5
5
  /**
6
- * Generated by orval v6.4.2 🍺
6
+ * Generated by orval v6.6.0 🍺
7
7
  * Do not edit manually.
8
8
  * Account Server API
9
9
  * The Informatics Matters Account Server API.
@@ -1,41 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1
+ import {
2
+ __spreadValues,
3
+ customInstance
4
+ } from "../chunk-JR7F532L.js";
20
5
 
21
6
  // src/service/service.ts
22
7
  import {
23
8
  useQuery
24
9
  } from "react-query";
25
-
26
- // src/custom-instance.ts
27
- import Axios from "axios";
28
- var AXIOS_INSTANCE = Axios.create({ baseURL: "" });
29
- var customInstance = (config, options) => {
30
- const source = Axios.CancelToken.source();
31
- const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
32
- promise.cancel = () => {
33
- source.cancel("Query was cancelled by React Query");
34
- };
35
- return promise;
36
- };
37
-
38
- // src/service/service.ts
39
10
  var getServices = (options) => {
40
11
  return customInstance({ url: `/service`, method: "get" }, options);
41
12
  };
@@ -70,3 +41,4 @@ export {
70
41
  useGetService,
71
42
  useGetServices
72
43
  };
44
+ //# sourceMappingURL=service.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/service/service.ts", "../../src/custom-instance.ts"],
4
- "sourcesContent": ["/**\n * Generated by orval v6.4.2 \uD83C\uDF7A\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\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\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", "/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\n// ? Need the baseUrl or does it default to ''?\nexport const AXIOS_INSTANCE = Axios.create({ baseURL: '' });\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAUA;AAAA;AAAA;;;ACAA;AAGO,IAAM,iBAAiB,MAAM,OAAO,EAAE,SAAS;AAmB/C,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;;;ADNF,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;",
6
- "names": []
7
- }
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,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.4.2 🍺
2
+ * Generated by orval v6.6.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -88,12 +88,6 @@ export interface UserDetail {
88
88
  id: string;
89
89
  }
90
90
 
91
- export interface UnitDetail {
92
- id: string;
93
- name: string;
94
- owner_id?: string;
95
- }
96
-
97
91
  export interface ServiceGetResponse {
98
92
  id: number;
99
93
  kind: string;
@@ -218,10 +212,22 @@ export interface ProductDmStorageDetail {
218
212
  coins: ProductDmStorageDetailCoins;
219
213
  }
220
214
 
215
+ export interface UnitsGetResponse {
216
+ /** A list of Units
217
+ */
218
+ units: OrganisationUnitsGetResponse[];
219
+ }
220
+
221
+ export interface UnitGetResponse {
222
+ id: string;
223
+ name: string;
224
+ owner_id?: string;
225
+ }
226
+
221
227
  export interface ProductDmProjectTier {
222
228
  product: ProductDetail;
223
229
  organisation: OrganisationDetail;
224
- unit: UnitDetail;
230
+ unit: UnitGetResponse;
225
231
  storage: ProductDmStorageDetail;
226
232
  coins: ProductCoinsDetail;
227
233
  instance: ProductInstanceDetail;
@@ -231,17 +237,11 @@ export interface ProductDmProjectTier {
231
237
  export interface ProductDmStorage {
232
238
  product: ProductDetail;
233
239
  organisation: OrganisationDetail;
234
- unit: UnitDetail;
240
+ unit: UnitGetResponse;
235
241
  storage: ProductDmStorageDetail;
236
242
  coins: ProductCoinsDetail;
237
243
  }
238
244
 
239
- export interface UnitsGetResponse {
240
- /** A list of Units
241
- */
242
- units: OrganisationUnitsGetResponse[];
243
- }
244
-
245
245
  export interface UnitProductPostResponse {
246
246
  /** The products's unique ID */
247
247
  id: string;
@@ -282,7 +282,7 @@ export interface OrganisationUnitsGetResponse {
282
282
  organisation: OrganisationDetail;
283
283
  /** A list of Units
284
284
  */
285
- units: UnitDetail[];
285
+ units: UnitGetResponse[];
286
286
  }
287
287
 
288
288
  export interface OrganisationUnitPostResponse {
@@ -292,7 +292,7 @@ export interface OrganisationUnitPostResponse {
292
292
 
293
293
  export interface UsersGetResponse {
294
294
  organisation?: OrganisationDetail;
295
- unit?: UnitDetail;
295
+ unit?: UnitGetResponse;
296
296
  /** The list of Organisation Users
297
297
  */
298
298
  users: UserDetail[];
@@ -10,8 +10,7 @@
10
10
 
11
11
  import Axios, { AxiosError, AxiosRequestConfig } from 'axios';
12
12
 
13
- // ? Need the baseUrl or does it default to ''?
14
- export const AXIOS_INSTANCE = Axios.create({ baseURL: '' });
13
+ export const AXIOS_INSTANCE = Axios.create();
15
14
 
16
15
  /**
17
16
  * Set the access token to be added as the `Authorization: Bearer 'token'` header
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.4.2 🍺
2
+ * Generated by orval v6.6.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -26,12 +26,14 @@ import type {
26
26
  } from "../account-server-api.schemas";
27
27
  import { customInstance, ErrorType } from ".././custom-instance";
28
28
 
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
30
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
30
31
  ...args: any
31
32
  ) => Promise<infer R>
32
33
  ? R
33
34
  : any;
34
35
 
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
37
  type SecondParameter<T extends (...args: any) => any> = T extends (
36
38
  config: any,
37
39
  args: infer P
@@ -144,7 +146,7 @@ export const deleteOrganisation = (
144
146
  options?: SecondParameter<typeof customInstance>
145
147
  ) => {
146
148
  return customInstance<void>(
147
- { url: `/organisation/${orgid}`, method: "delete", data: undefined },
149
+ { url: `/organisation/${orgid}`, method: "delete" },
148
150
  options
149
151
  );
150
152
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.4.2 🍺
2
+ * Generated by orval v6.6.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -29,12 +29,14 @@ import type {
29
29
  } from "../account-server-api.schemas";
30
30
  import { customInstance, ErrorType } from ".././custom-instance";
31
31
 
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
33
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
33
34
  ...args: any
34
35
  ) => Promise<infer R>
35
36
  ? R
36
37
  : any;
37
38
 
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
40
  type SecondParameter<T extends (...args: any) => any> = T extends (
39
41
  config: any,
40
42
  args: infer P
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.4.2 🍺
2
+ * Generated by orval v6.6.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -22,12 +22,14 @@ import type {
22
22
  } from "../account-server-api.schemas";
23
23
  import { customInstance, ErrorType } from ".././custom-instance";
24
24
 
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
26
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
26
27
  ...args: any
27
28
  ) => Promise<infer R>
28
29
  ? R
29
30
  : any;
30
31
 
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
33
  type SecondParameter<T extends (...args: any) => any> = T extends (
32
34
  config: any,
33
35
  args: infer P
package/src/unit/unit.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.4.2 🍺
2
+ * Generated by orval v6.6.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -23,16 +23,19 @@ import type {
23
23
  AsError,
24
24
  OrganisationUnitPostResponse,
25
25
  OrganisationUnitPostBodyBody,
26
+ UnitGetResponse,
26
27
  UnitsGetResponse,
27
28
  } from "../account-server-api.schemas";
28
29
  import { customInstance, ErrorType } from ".././custom-instance";
29
30
 
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
32
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
31
33
  ...args: any
32
34
  ) => Promise<infer R>
33
35
  ? R
34
36
  : any;
35
37
 
38
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
39
  type SecondParameter<T extends (...args: any) => any> = T extends (
37
40
  config: any,
38
41
  args: infer P
@@ -144,6 +147,56 @@ export const useCreateOrganisationUnit = <
144
147
  TContext
145
148
  >(mutationFn, mutationOptions);
146
149
  };
150
+ /**
151
+ * Gets the Unit, assuming you are a member of it. Admin users can see all Units
152
+
153
+ * @summary Gets a Unit
154
+ */
155
+ export const getUnit = (
156
+ orgid: string,
157
+ unitid: string,
158
+ options?: SecondParameter<typeof customInstance>
159
+ ) => {
160
+ return customInstance<UnitGetResponse>(
161
+ { url: `/organisation/${orgid}/unit/${unitid}`, method: "get" },
162
+ options
163
+ );
164
+ };
165
+
166
+ export const getGetUnitQueryKey = (orgid: string, unitid: string) => [
167
+ `/organisation/${orgid}/unit/${unitid}`,
168
+ ];
169
+
170
+ export const useGetUnit = <
171
+ TData = AsyncReturnType<typeof getUnit>,
172
+ TError = ErrorType<void | AsError>
173
+ >(
174
+ orgid: string,
175
+ unitid: string,
176
+ options?: {
177
+ query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;
178
+ request?: SecondParameter<typeof customInstance>;
179
+ }
180
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
181
+ const { query: queryOptions, request: requestOptions } = options || {};
182
+
183
+ const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgid, unitid);
184
+
185
+ const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>
186
+ getUnit(orgid, unitid, requestOptions);
187
+
188
+ const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(
189
+ queryKey,
190
+ queryFn,
191
+ { enabled: !!(orgid && unitid), ...queryOptions }
192
+ );
193
+
194
+ return {
195
+ queryKey,
196
+ ...query,
197
+ };
198
+ };
199
+
147
200
  /**
148
201
  * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products
149
202
 
@@ -155,11 +208,7 @@ export const deleteOrganisationUnit = (
155
208
  options?: SecondParameter<typeof customInstance>
156
209
  ) => {
157
210
  return customInstance<void>(
158
- {
159
- url: `/organisation/${orgid}/unit/${unitid}`,
160
- method: "delete",
161
- data: undefined,
162
- },
211
+ { url: `/organisation/${orgid}/unit/${unitid}`, method: "delete" },
163
212
  options
164
213
  );
165
214
  };
@@ -243,7 +292,7 @@ export const createDefaultUnit = (
243
292
  options?: SecondParameter<typeof customInstance>
244
293
  ) => {
245
294
  return customInstance<OrganisationUnitPostResponse>(
246
- { url: `/unit`, method: "put", data: undefined },
295
+ { url: `/unit`, method: "put" },
247
296
  options
248
297
  );
249
298
  };
@@ -285,10 +334,7 @@ export const useCreateDefaultUnit = <
285
334
  export const deleteDefaultUnit = (
286
335
  options?: SecondParameter<typeof customInstance>
287
336
  ) => {
288
- return customInstance<void>(
289
- { url: `/unit`, method: "delete", data: undefined },
290
- options
291
- );
337
+ return customInstance<void>({ url: `/unit`, method: "delete" }, options);
292
338
  };
293
339
 
294
340
  export const useDeleteDefaultUnit = <
package/src/user/user.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.4.2 🍺
2
+ * Generated by orval v6.6.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -21,12 +21,14 @@ import {
21
21
  import type { UsersGetResponse, AsError } from "../account-server-api.schemas";
22
22
  import { customInstance, ErrorType } from ".././custom-instance";
23
23
 
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
25
26
  ...args: any
26
27
  ) => Promise<infer R>
27
28
  ? R
28
29
  : any;
29
30
 
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
32
  type SecondParameter<T extends (...args: any) => any> = T extends (
31
33
  config: any,
32
34
  args: infer P
@@ -99,11 +101,7 @@ export const addOrganisationUser = (
99
101
  options?: SecondParameter<typeof customInstance>
100
102
  ) => {
101
103
  return customInstance<void>(
102
- {
103
- url: `/organisation/${orgid}/user/${userid}`,
104
- method: "put",
105
- data: undefined,
106
- },
104
+ { url: `/organisation/${orgid}/user/${userid}`, method: "put" },
107
105
  options
108
106
  );
109
107
  };
@@ -149,11 +147,7 @@ export const deleteOrganisationUser = (
149
147
  options?: SecondParameter<typeof customInstance>
150
148
  ) => {
151
149
  return customInstance<void>(
152
- {
153
- url: `/organisation/${orgid}/user/${userid}`,
154
- method: "delete",
155
- data: undefined,
156
- },
150
+ { url: `/organisation/${orgid}/user/${userid}`, method: "delete" },
157
151
  options
158
152
  );
159
153
  };
@@ -253,7 +247,7 @@ export const addOrganisationUnitUser = (
253
247
  options?: SecondParameter<typeof customInstance>
254
248
  ) => {
255
249
  return customInstance<void>(
256
- { url: `/unit/${unitid}/user/${userid}`, method: "put", data: undefined },
250
+ { url: `/unit/${unitid}/user/${userid}`, method: "put" },
257
251
  options
258
252
  );
259
253
  };
@@ -299,11 +293,7 @@ export const deleteOrganisationUnitUser = (
299
293
  options?: SecondParameter<typeof customInstance>
300
294
  ) => {
301
295
  return customInstance<void>(
302
- {
303
- url: `/unit/${unitid}/user/${userid}`,
304
- method: "delete",
305
- data: undefined,
306
- },
296
+ { url: `/unit/${unitid}/user/${userid}`, method: "delete" },
307
297
  options
308
298
  );
309
299
  };