@squonk/account-server-client 0.1.27-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 (50) 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-e6c5f956.d.ts → custom-instance-13412a15.d.ts} +19 -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 +35 -30
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +33 -32
  14. package/organisation/organisation.js +42 -37
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +1 -1
  17. package/product/product.cjs +65 -53
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +55 -54
  20. package/product/product.js +76 -64
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +21 -23
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +18 -17
  25. package/service/service.js +23 -25
  26. package/service/service.js.map +1 -1
  27. package/src/organisation/organisation.ts +93 -69
  28. package/src/product/product.ts +165 -146
  29. package/src/service/service.ts +59 -57
  30. package/src/state/state.ts +34 -28
  31. package/src/unit/unit.ts +145 -130
  32. package/src/user/user.ts +148 -120
  33. package/state/state.cjs +12 -12
  34. package/state/state.cjs.map +1 -1
  35. package/state/state.d.ts +11 -10
  36. package/state/state.js +13 -13
  37. package/state/state.js.map +1 -1
  38. package/unit/unit.cjs +55 -50
  39. package/unit/unit.cjs.map +1 -1
  40. package/unit/unit.d.ts +54 -53
  41. package/unit/unit.js +66 -61
  42. package/unit/unit.js.map +1 -1
  43. package/user/user.cjs +50 -50
  44. package/user/user.cjs.map +1 -1
  45. package/user/user.d.ts +53 -52
  46. package/user/user.js +61 -61
  47. package/user/user.js.map +1 -1
  48. package/chunk-GWBPVOL2.js.map +0 -1
  49. package/chunk-N3RLW53G.cjs +0 -25
  50. package/chunk-N3RLW53G.cjs.map +0 -1
@@ -1,46 +1,44 @@
1
1
  import {
2
- __spreadValues
3
- } from "../chunk-GWBPVOL2.js";
2
+ __spreadValues,
3
+ customInstance
4
+ } from "../chunk-6EEIAH4R.js";
4
5
 
5
6
  // src/service/service.ts
6
- import axios from "axios";
7
7
  import {
8
8
  useQuery
9
9
  } from "react-query";
10
- var appApiServiceGet = (options) => {
11
- return axios.get(`/service`, options);
10
+ var getServices = (options) => {
11
+ return customInstance({ url: `/service`, method: "get" }, options);
12
12
  };
13
- var getAppApiServiceGetQueryKey = () => [`/service`];
14
- var useAppApiServiceGet = (options) => {
15
- const { query: queryOptions, axios: axiosOptions } = options || {};
16
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiServiceGetQueryKey();
17
- const queryFn = () => appApiServiceGet(axiosOptions);
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
18
  const query = useQuery(queryKey, queryFn, queryOptions);
19
19
  return __spreadValues({
20
20
  queryKey
21
21
  }, query);
22
22
  };
23
- var appApiServiceGetId = (svcId, options) => {
24
- return axios.get(`/service/${svcId}`, options);
23
+ var getService = (svcId, options) => {
24
+ return customInstance({ url: `/service/${svcId}`, method: "get" }, options);
25
25
  };
26
- var getAppApiServiceGetIdQueryKey = (svcId) => [
27
- `/service/${svcId}`
28
- ];
29
- var useAppApiServiceGetId = (svcId, options) => {
30
- const { query: queryOptions, axios: axiosOptions } = options || {};
31
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiServiceGetIdQueryKey(svcId);
32
- const queryFn = () => appApiServiceGetId(svcId, axiosOptions);
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);
33
31
  const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!svcId }, queryOptions));
34
32
  return __spreadValues({
35
33
  queryKey
36
34
  }, query);
37
35
  };
38
36
  export {
39
- appApiServiceGet,
40
- appApiServiceGetId,
41
- getAppApiServiceGetIdQueryKey,
42
- getAppApiServiceGetQueryKey,
43
- useAppApiServiceGet,
44
- useAppApiServiceGetId
37
+ getGetServiceQueryKey,
38
+ getGetServicesQueryKey,
39
+ getService,
40
+ getServices,
41
+ useGetService,
42
+ useGetServices
45
43
  };
46
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, AxiosError } from \"axios\";\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\";\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/**\n * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const appApiServiceGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ServicesGetResponse>> => {\n return axios.get(`/service`, options);\n};\n\nexport const getAppApiServiceGetQueryKey = () => [`/service`];\n\nexport type AppApiServiceGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiServiceGet>\n>;\nexport type AppApiServiceGetQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiServiceGet = <\n TData = AsyncReturnType<typeof appApiServiceGet>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiServiceGet>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiServiceGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiServiceGet>> = () =>\n appApiServiceGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiServiceGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\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 appApiServiceGetId = (\n svcId: number,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ServiceGetResponse>> => {\n return axios.get(`/service/${svcId}`, options);\n};\n\nexport const getAppApiServiceGetIdQueryKey = (svcId: number) => [\n `/service/${svcId}`,\n];\n\nexport type AppApiServiceGetIdQueryResult = NonNullable<\n AsyncReturnType<typeof appApiServiceGetId>\n>;\nexport type AppApiServiceGetIdQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiServiceGetId = <\n TData = AsyncReturnType<typeof appApiServiceGetId>,\n TError = AxiosError<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiServiceGetId>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiServiceGetIdQueryKey(svcId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiServiceGetId>\n > = () => appApiServiceGetId(svcId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiServiceGetId>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!svcId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAyBO,IAAM,mBAAmB,CAC9B,YACgD;AAChD,SAAO,MAAM,IAAI,YAAY,OAAO;AACtC;AAEO,IAAM,8BAA8B,MAAM,CAAC,UAAU;AAOrD,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAAmE,MACvE,iBAAiB,YAAY;AAE/B,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,qBAAqB,CAChC,OACA,YAC+C;AAC/C,SAAO,MAAM,IAAI,YAAY,SAAS,OAAO;AAC/C;AAEO,IAAM,gCAAgC,CAAC,UAAkB;AAAA,EAC9D,YAAY;AACd;AAOO,IAAM,wBAAwB,CAInC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WACJ,8CAAc,aAAY,8BAA8B,KAAK;AAE/D,QAAM,UAEF,MAAM,mBAAmB,OAAO,YAAY;AAEhD,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","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":[]}
@@ -8,7 +8,6 @@ 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 axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from "axios";
12
11
  import {
13
12
  useQuery,
14
13
  useMutation,
@@ -26,6 +25,7 @@ import type {
26
25
  OrganisationPostBodyBody,
27
26
  OrganisationGetDefaultResponse,
28
27
  } from "../account-server-api.schemas";
28
+ import { customInstance, ErrorType } from ".././custom-instance";
29
29
 
30
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
31
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
@@ -34,45 +34,55 @@ type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
34
34
  ? R
35
35
  : any;
36
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
+
37
45
  /**
38
46
  * Gets all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations
39
47
 
40
48
  * @summary Gets Organisations
41
49
  */
42
- export const appApiOrganisationGet = (
43
- options?: AxiosRequestConfig
44
- ): Promise<AxiosResponse<OrganisationsGetResponse>> => {
45
- return axios.get(`/organisation`, options);
50
+ export const getOrganisations = (
51
+ options?: SecondParameter<typeof customInstance>
52
+ ) => {
53
+ return customInstance<OrganisationsGetResponse>(
54
+ { url: `/organisation`, method: "get" },
55
+ options
56
+ );
46
57
  };
47
58
 
48
- export const getAppApiOrganisationGetQueryKey = () => [`/organisation`];
59
+ export const getGetOrganisationsQueryKey = () => [`/organisation`];
49
60
 
50
- export type AppApiOrganisationGetQueryResult = NonNullable<
51
- AsyncReturnType<typeof appApiOrganisationGet>
61
+ export type GetOrganisationsQueryResult = NonNullable<
62
+ AsyncReturnType<typeof getOrganisations>
52
63
  >;
53
- export type AppApiOrganisationGetQueryError = AxiosError<void | AsError>;
64
+ export type GetOrganisationsQueryError = ErrorType<void | AsError>;
54
65
 
55
- export const useAppApiOrganisationGet = <
56
- TData = AsyncReturnType<typeof appApiOrganisationGet>,
57
- TError = AxiosError<void | AsError>
66
+ export const useGetOrganisations = <
67
+ TData = AsyncReturnType<typeof getOrganisations>,
68
+ TError = ErrorType<void | AsError>
58
69
  >(options?: {
59
70
  query?: UseQueryOptions<
60
- AsyncReturnType<typeof appApiOrganisationGet>,
71
+ AsyncReturnType<typeof getOrganisations>,
61
72
  TError,
62
73
  TData
63
74
  >;
64
- axios?: AxiosRequestConfig;
75
+ request?: SecondParameter<typeof customInstance>;
65
76
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
66
- const { query: queryOptions, axios: axiosOptions } = options || {};
77
+ const { query: queryOptions, request: requestOptions } = options || {};
67
78
 
68
- const queryKey = queryOptions?.queryKey ?? getAppApiOrganisationGetQueryKey();
79
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
69
80
 
70
- const queryFn: QueryFunction<
71
- AsyncReturnType<typeof appApiOrganisationGet>
72
- > = () => appApiOrganisationGet(axiosOptions);
81
+ const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>
82
+ getOrganisations(requestOptions);
73
83
 
74
84
  const query = useQuery<
75
- AsyncReturnType<typeof appApiOrganisationGet>,
85
+ AsyncReturnType<typeof getOrganisations>,
76
86
  TError,
77
87
  TData
78
88
  >(queryKey, queryFn, queryOptions);
@@ -90,44 +100,52 @@ You need **admin** rights to use this method
90
100
 
91
101
  * @summary Create a new organisation
92
102
  */
93
- export const appApiOrganisationPost = (
103
+ export const createOrganisation = (
94
104
  organisationPostBodyBody: OrganisationPostBodyBody,
95
- options?: AxiosRequestConfig
96
- ): Promise<AxiosResponse<OrganisationPostResponse>> => {
97
- return axios.post(`/organisation`, organisationPostBodyBody, options);
105
+ options?: SecondParameter<typeof customInstance>
106
+ ) => {
107
+ return customInstance<OrganisationPostResponse>(
108
+ {
109
+ url: `/organisation`,
110
+ method: "post",
111
+ headers: { "Content-Type": "application/json" },
112
+ data: organisationPostBodyBody,
113
+ },
114
+ options
115
+ );
98
116
  };
99
117
 
100
- export type AppApiOrganisationPostMutationResult = NonNullable<
101
- AsyncReturnType<typeof appApiOrganisationPost>
118
+ export type CreateOrganisationMutationResult = NonNullable<
119
+ AsyncReturnType<typeof createOrganisation>
102
120
  >;
103
- export type AppApiOrganisationPostMutationBody = OrganisationPostBodyBody;
104
- export type AppApiOrganisationPostMutationError = AxiosError<AsError | void>;
121
+ export type CreateOrganisationMutationBody = OrganisationPostBodyBody;
122
+ export type CreateOrganisationMutationError = ErrorType<AsError | void>;
105
123
 
106
- export const useAppApiOrganisationPost = <
107
- TError = AxiosError<AsError | void>,
124
+ export const useCreateOrganisation = <
125
+ TError = ErrorType<AsError | void>,
108
126
  TContext = unknown
109
127
  >(options?: {
110
128
  mutation?: UseMutationOptions<
111
- AsyncReturnType<typeof appApiOrganisationPost>,
129
+ AsyncReturnType<typeof createOrganisation>,
112
130
  TError,
113
131
  { data: OrganisationPostBodyBody },
114
132
  TContext
115
133
  >;
116
- axios?: AxiosRequestConfig;
134
+ request?: SecondParameter<typeof customInstance>;
117
135
  }) => {
118
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
136
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
119
137
 
120
138
  const mutationFn: MutationFunction<
121
- AsyncReturnType<typeof appApiOrganisationPost>,
139
+ AsyncReturnType<typeof createOrganisation>,
122
140
  { data: OrganisationPostBodyBody }
123
141
  > = (props) => {
124
142
  const { data } = props || {};
125
143
 
126
- return appApiOrganisationPost(data, axiosOptions);
144
+ return createOrganisation(data, requestOptions);
127
145
  };
128
146
 
129
147
  return useMutation<
130
- AsyncReturnType<typeof appApiOrganisationPost>,
148
+ AsyncReturnType<typeof createOrganisation>,
131
149
  TError,
132
150
  { data: OrganisationPostBodyBody },
133
151
  TContext
@@ -140,44 +158,47 @@ You need **admin** rights to use this method
140
158
 
141
159
  * @summary Deletes an Organisation
142
160
  */
143
- export const appApiOrganisationDelete = (
161
+ export const deleteOrganisation = (
144
162
  orgId: string,
145
- options?: AxiosRequestConfig
146
- ): Promise<AxiosResponse<void>> => {
147
- return axios.delete(`/organisation/${orgId}`, options);
163
+ options?: SecondParameter<typeof customInstance>
164
+ ) => {
165
+ return customInstance<void>(
166
+ { url: `/organisation/${orgId}`, method: "delete" },
167
+ options
168
+ );
148
169
  };
149
170
 
150
- export type AppApiOrganisationDeleteMutationResult = NonNullable<
151
- AsyncReturnType<typeof appApiOrganisationDelete>
171
+ export type DeleteOrganisationMutationResult = NonNullable<
172
+ AsyncReturnType<typeof deleteOrganisation>
152
173
  >;
153
174
 
154
- export type AppApiOrganisationDeleteMutationError = AxiosError<AsError>;
175
+ export type DeleteOrganisationMutationError = ErrorType<AsError>;
155
176
 
156
- export const useAppApiOrganisationDelete = <
157
- TError = AxiosError<AsError>,
177
+ export const useDeleteOrganisation = <
178
+ TError = ErrorType<AsError>,
158
179
  TContext = unknown
159
180
  >(options?: {
160
181
  mutation?: UseMutationOptions<
161
- AsyncReturnType<typeof appApiOrganisationDelete>,
182
+ AsyncReturnType<typeof deleteOrganisation>,
162
183
  TError,
163
184
  { orgId: string },
164
185
  TContext
165
186
  >;
166
- axios?: AxiosRequestConfig;
187
+ request?: SecondParameter<typeof customInstance>;
167
188
  }) => {
168
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
189
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
169
190
 
170
191
  const mutationFn: MutationFunction<
171
- AsyncReturnType<typeof appApiOrganisationDelete>,
192
+ AsyncReturnType<typeof deleteOrganisation>,
172
193
  { orgId: string }
173
194
  > = (props) => {
174
195
  const { orgId } = props || {};
175
196
 
176
- return appApiOrganisationDelete(orgId, axiosOptions);
197
+ return deleteOrganisation(orgId, requestOptions);
177
198
  };
178
199
 
179
200
  return useMutation<
180
- AsyncReturnType<typeof appApiOrganisationDelete>,
201
+ AsyncReturnType<typeof deleteOrganisation>,
181
202
  TError,
182
203
  { orgId: string },
183
204
  TContext
@@ -188,43 +209,46 @@ export const useAppApiOrganisationDelete = <
188
209
 
189
210
  * @summary Gets the (built-in) Default Organisation
190
211
  */
191
- export const appApiOrganisationGetDefault = (
192
- options?: AxiosRequestConfig
193
- ): Promise<AxiosResponse<OrganisationGetDefaultResponse>> => {
194
- return axios.get(`/organisation/default`, options);
212
+ export const getDefaultOrganisation = (
213
+ options?: SecondParameter<typeof customInstance>
214
+ ) => {
215
+ return customInstance<OrganisationGetDefaultResponse>(
216
+ { url: `/organisation/default`, method: "get" },
217
+ options
218
+ );
195
219
  };
196
220
 
197
- export const getAppApiOrganisationGetDefaultQueryKey = () => [
221
+ export const getGetDefaultOrganisationQueryKey = () => [
198
222
  `/organisation/default`,
199
223
  ];
200
224
 
201
- export type AppApiOrganisationGetDefaultQueryResult = NonNullable<
202
- AsyncReturnType<typeof appApiOrganisationGetDefault>
225
+ export type GetDefaultOrganisationQueryResult = NonNullable<
226
+ AsyncReturnType<typeof getDefaultOrganisation>
203
227
  >;
204
- export type AppApiOrganisationGetDefaultQueryError = AxiosError<void | AsError>;
228
+ export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
205
229
 
206
- export const useAppApiOrganisationGetDefault = <
207
- TData = AsyncReturnType<typeof appApiOrganisationGetDefault>,
208
- TError = AxiosError<void | AsError>
230
+ export const useGetDefaultOrganisation = <
231
+ TData = AsyncReturnType<typeof getDefaultOrganisation>,
232
+ TError = ErrorType<void | AsError>
209
233
  >(options?: {
210
234
  query?: UseQueryOptions<
211
- AsyncReturnType<typeof appApiOrganisationGetDefault>,
235
+ AsyncReturnType<typeof getDefaultOrganisation>,
212
236
  TError,
213
237
  TData
214
238
  >;
215
- axios?: AxiosRequestConfig;
239
+ request?: SecondParameter<typeof customInstance>;
216
240
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
217
- const { query: queryOptions, axios: axiosOptions } = options || {};
241
+ const { query: queryOptions, request: requestOptions } = options || {};
218
242
 
219
243
  const queryKey =
220
- queryOptions?.queryKey ?? getAppApiOrganisationGetDefaultQueryKey();
244
+ queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
221
245
 
222
246
  const queryFn: QueryFunction<
223
- AsyncReturnType<typeof appApiOrganisationGetDefault>
224
- > = () => appApiOrganisationGetDefault(axiosOptions);
247
+ AsyncReturnType<typeof getDefaultOrganisation>
248
+ > = () => getDefaultOrganisation(requestOptions);
225
249
 
226
250
  const query = useQuery<
227
- AsyncReturnType<typeof appApiOrganisationGetDefault>,
251
+ AsyncReturnType<typeof getDefaultOrganisation>,
228
252
  TError,
229
253
  TData
230
254
  >(queryKey, queryFn, queryOptions);