@squonk/account-server-client 0.1.24-rc.1 → 0.1.27-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/{custom-instance-4a108741.d.ts → account-server-api.schemas-e6c5f956.d.ts} +15 -20
  2. package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
  3. package/chunk-GWBPVOL2.js.map +1 -0
  4. package/chunk-N3RLW53G.cjs +25 -0
  5. package/chunk-N3RLW53G.cjs.map +1 -0
  6. package/index.cjs +21 -5
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +20 -2
  9. package/index.js +21 -5
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +31 -31
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +37 -28
  14. package/organisation/organisation.js +38 -38
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +14 -14
  17. package/product/product.cjs +64 -61
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +70 -40
  20. package/product/product.js +75 -72
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +23 -21
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +19 -15
  25. package/service/service.js +26 -24
  26. package/service/service.js.map +1 -1
  27. package/src/account-server-api.schemas.ts +14 -1
  28. package/src/organisation/organisation.ts +86 -83
  29. package/src/product/product.ts +210 -145
  30. package/src/service/service.ts +64 -56
  31. package/src/state/state.ts +31 -32
  32. package/src/unit/unit.ts +170 -149
  33. package/src/user/user.ts +171 -160
  34. package/state/state.cjs +12 -12
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +12 -10
  37. package/state/state.js +13 -13
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +54 -58
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +64 -49
  42. package/unit/unit.js +67 -71
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +56 -56
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +69 -55
  47. package/user/user.js +69 -69
  48. package/user/user.js.map +1 -1
  49. package/chunk-3DXYUDZH.cjs +0 -46
  50. package/chunk-3DXYUDZH.cjs.map +0 -1
  51. package/chunk-JR7F532L.js.map +0 -1
@@ -1,44 +1,46 @@
1
1
  import {
2
- __spreadValues,
3
- customInstance
4
- } from "../chunk-JR7F532L.js";
2
+ __spreadValues
3
+ } from "../chunk-GWBPVOL2.js";
5
4
 
6
5
  // src/service/service.ts
6
+ import axios from "axios";
7
7
  import {
8
8
  useQuery
9
9
  } from "react-query";
10
- var getServices = (options) => {
11
- return customInstance({ url: `/service`, method: "get" }, options);
10
+ var appApiServiceGet = (options) => {
11
+ return axios.get(`/service`, options);
12
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);
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);
18
18
  const query = useQuery(queryKey, queryFn, queryOptions);
19
19
  return __spreadValues({
20
20
  queryKey
21
21
  }, query);
22
22
  };
23
- var getService = (svcid, options) => {
24
- return customInstance({ url: `/service/${svcid}`, method: "get" }, options);
23
+ var appApiServiceGetId = (svcId, options) => {
24
+ return axios.get(`/service/${svcId}`, options);
25
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));
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);
33
+ const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!svcId }, queryOptions));
32
34
  return __spreadValues({
33
35
  queryKey
34
36
  }, query);
35
37
  };
36
38
  export {
37
- getGetServiceQueryKey,
38
- getGetServicesQueryKey,
39
- getService,
40
- getServices,
41
- useGetService,
42
- useGetServices
39
+ appApiServiceGet,
40
+ appApiServiceGetId,
41
+ getAppApiServiceGetIdQueryKey,
42
+ getAppApiServiceGetQueryKey,
43
+ useAppApiServiceGet,
44
+ useAppApiServiceGetId
43
45
  };
44
46
  //# sourceMappingURL=service.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/service/service.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcid: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcid: number) => [`/service/${svcid}`];\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcid: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(svcid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcid, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,SAC3B;AAAA;AAIG,IAAM,yBAAyB,MAAM,CAAC;AAEtC,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAA8D,MAClE,YAAY;AAEd,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,SACpC;AAAA;AAIG,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY;AAE9D,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAA6D,MACjE,WAAW,OAAO;AAEpB,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU;AAGzB,SAAO;AAAA,IACL;AAAA,KACG;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/service/service.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, 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,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.6.0 🍺
2
+ * Generated by orval v6.7.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -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 {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.6.0 🍺
2
+ * Generated by orval v6.7.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,6 +8,7 @@ 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";
11
12
  import {
12
13
  useQuery,
13
14
  useMutation,
@@ -25,7 +26,6 @@ import type {
25
26
  OrganisationPostBodyBody,
26
27
  OrganisationGetDefaultResponse,
27
28
  } 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,50 +34,45 @@ 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
-
45
37
  /**
46
- * Gets all the Organisations you are a member of. Admin users can see all Organisations
38
+ * 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
47
39
 
48
40
  * @summary Gets Organisations
49
41
  */
50
- export const getOrganisations = (
51
- options?: SecondParameter<typeof customInstance>
52
- ) => {
53
- return customInstance<OrganisationsGetResponse>(
54
- { url: `/organisation`, method: "get" },
55
- options
56
- );
42
+ export const appApiOrganisationGet = (
43
+ options?: AxiosRequestConfig
44
+ ): Promise<AxiosResponse<OrganisationsGetResponse>> => {
45
+ return axios.get(`/organisation`, options);
57
46
  };
58
47
 
59
- export const getGetOrganisationsQueryKey = () => [`/organisation`];
48
+ export const getAppApiOrganisationGetQueryKey = () => [`/organisation`];
60
49
 
61
- export const useGetOrganisations = <
62
- TData = AsyncReturnType<typeof getOrganisations>,
63
- TError = ErrorType<void | AsError>
50
+ export type AppApiOrganisationGetQueryResult = NonNullable<
51
+ AsyncReturnType<typeof appApiOrganisationGet>
52
+ >;
53
+ export type AppApiOrganisationGetQueryError = AxiosError<void | AsError>;
54
+
55
+ export const useAppApiOrganisationGet = <
56
+ TData = AsyncReturnType<typeof appApiOrganisationGet>,
57
+ TError = AxiosError<void | AsError>
64
58
  >(options?: {
65
59
  query?: UseQueryOptions<
66
- AsyncReturnType<typeof getOrganisations>,
60
+ AsyncReturnType<typeof appApiOrganisationGet>,
67
61
  TError,
68
62
  TData
69
63
  >;
70
- request?: SecondParameter<typeof customInstance>;
64
+ axios?: AxiosRequestConfig;
71
65
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
72
- const { query: queryOptions, request: requestOptions } = options || {};
66
+ const { query: queryOptions, axios: axiosOptions } = options || {};
73
67
 
74
- const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
68
+ const queryKey = queryOptions?.queryKey ?? getAppApiOrganisationGetQueryKey();
75
69
 
76
- const queryFn: QueryFunction<AsyncReturnType<typeof getOrganisations>> = () =>
77
- getOrganisations(requestOptions);
70
+ const queryFn: QueryFunction<
71
+ AsyncReturnType<typeof appApiOrganisationGet>
72
+ > = () => appApiOrganisationGet(axiosOptions);
78
73
 
79
74
  const query = useQuery<
80
- AsyncReturnType<typeof getOrganisations>,
75
+ AsyncReturnType<typeof appApiOrganisationGet>,
81
76
  TError,
82
77
  TData
83
78
  >(queryKey, queryFn, queryOptions);
@@ -95,41 +90,44 @@ You need **admin** rights to use this method
95
90
 
96
91
  * @summary Create a new organisation
97
92
  */
98
- export const createOrganisation = (
93
+ export const appApiOrganisationPost = (
99
94
  organisationPostBodyBody: OrganisationPostBodyBody,
100
- options?: SecondParameter<typeof customInstance>
101
- ) => {
102
- return customInstance<OrganisationPostResponse>(
103
- { url: `/organisation`, method: "post", data: organisationPostBodyBody },
104
- options
105
- );
95
+ options?: AxiosRequestConfig
96
+ ): Promise<AxiosResponse<OrganisationPostResponse>> => {
97
+ return axios.post(`/organisation`, organisationPostBodyBody, options);
106
98
  };
107
99
 
108
- export const useCreateOrganisation = <
109
- TError = ErrorType<AsError | void>,
100
+ export type AppApiOrganisationPostMutationResult = NonNullable<
101
+ AsyncReturnType<typeof appApiOrganisationPost>
102
+ >;
103
+ export type AppApiOrganisationPostMutationBody = OrganisationPostBodyBody;
104
+ export type AppApiOrganisationPostMutationError = AxiosError<AsError | void>;
105
+
106
+ export const useAppApiOrganisationPost = <
107
+ TError = AxiosError<AsError | void>,
110
108
  TContext = unknown
111
109
  >(options?: {
112
110
  mutation?: UseMutationOptions<
113
- AsyncReturnType<typeof createOrganisation>,
111
+ AsyncReturnType<typeof appApiOrganisationPost>,
114
112
  TError,
115
113
  { data: OrganisationPostBodyBody },
116
114
  TContext
117
115
  >;
118
- request?: SecondParameter<typeof customInstance>;
116
+ axios?: AxiosRequestConfig;
119
117
  }) => {
120
- const { mutation: mutationOptions, request: requestOptions } = options || {};
118
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
121
119
 
122
120
  const mutationFn: MutationFunction<
123
- AsyncReturnType<typeof createOrganisation>,
121
+ AsyncReturnType<typeof appApiOrganisationPost>,
124
122
  { data: OrganisationPostBodyBody }
125
123
  > = (props) => {
126
124
  const { data } = props || {};
127
125
 
128
- return createOrganisation(data, requestOptions);
126
+ return appApiOrganisationPost(data, axiosOptions);
129
127
  };
130
128
 
131
129
  return useMutation<
132
- AsyncReturnType<typeof createOrganisation>,
130
+ AsyncReturnType<typeof appApiOrganisationPost>,
133
131
  TError,
134
132
  { data: OrganisationPostBodyBody },
135
133
  TContext
@@ -142,86 +140,91 @@ You need **admin** rights to use this method
142
140
 
143
141
  * @summary Deletes an Organisation
144
142
  */
145
- export const deleteOrganisation = (
146
- orgid: string,
147
- options?: SecondParameter<typeof customInstance>
148
- ) => {
149
- return customInstance<void>(
150
- { url: `/organisation/${orgid}`, method: "delete" },
151
- options
152
- );
143
+ export const appApiOrganisationDelete = (
144
+ orgId: string,
145
+ options?: AxiosRequestConfig
146
+ ): Promise<AxiosResponse<void>> => {
147
+ return axios.delete(`/organisation/${orgId}`, options);
153
148
  };
154
149
 
155
- export const useDeleteOrganisation = <
156
- TError = ErrorType<AsError>,
150
+ export type AppApiOrganisationDeleteMutationResult = NonNullable<
151
+ AsyncReturnType<typeof appApiOrganisationDelete>
152
+ >;
153
+
154
+ export type AppApiOrganisationDeleteMutationError = AxiosError<AsError>;
155
+
156
+ export const useAppApiOrganisationDelete = <
157
+ TError = AxiosError<AsError>,
157
158
  TContext = unknown
158
159
  >(options?: {
159
160
  mutation?: UseMutationOptions<
160
- AsyncReturnType<typeof deleteOrganisation>,
161
+ AsyncReturnType<typeof appApiOrganisationDelete>,
161
162
  TError,
162
- { orgid: string },
163
+ { orgId: string },
163
164
  TContext
164
165
  >;
165
- request?: SecondParameter<typeof customInstance>;
166
+ axios?: AxiosRequestConfig;
166
167
  }) => {
167
- const { mutation: mutationOptions, request: requestOptions } = options || {};
168
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
168
169
 
169
170
  const mutationFn: MutationFunction<
170
- AsyncReturnType<typeof deleteOrganisation>,
171
- { orgid: string }
171
+ AsyncReturnType<typeof appApiOrganisationDelete>,
172
+ { orgId: string }
172
173
  > = (props) => {
173
- const { orgid } = props || {};
174
+ const { orgId } = props || {};
174
175
 
175
- return deleteOrganisation(orgid, requestOptions);
176
+ return appApiOrganisationDelete(orgId, axiosOptions);
176
177
  };
177
178
 
178
179
  return useMutation<
179
- AsyncReturnType<typeof deleteOrganisation>,
180
+ AsyncReturnType<typeof appApiOrganisationDelete>,
180
181
  TError,
181
- { orgid: string },
182
+ { orgId: string },
182
183
  TContext
183
184
  >(mutationFn, mutationOptions);
184
185
  };
185
186
  /**
186
- * Gets the built-in Default Organisation, used exclusively for Independent Units
187
+ * Gets the built-in Default Organisation, used exclusively for Personal Units
187
188
 
188
189
  * @summary Gets the (built-in) Default Organisation
189
190
  */
190
- export const getDefaultOrganisation = (
191
- options?: SecondParameter<typeof customInstance>
192
- ) => {
193
- return customInstance<OrganisationGetDefaultResponse>(
194
- { url: `/organisation/default`, method: "get" },
195
- options
196
- );
191
+ export const appApiOrganisationGetDefault = (
192
+ options?: AxiosRequestConfig
193
+ ): Promise<AxiosResponse<OrganisationGetDefaultResponse>> => {
194
+ return axios.get(`/organisation/default`, options);
197
195
  };
198
196
 
199
- export const getGetDefaultOrganisationQueryKey = () => [
197
+ export const getAppApiOrganisationGetDefaultQueryKey = () => [
200
198
  `/organisation/default`,
201
199
  ];
202
200
 
203
- export const useGetDefaultOrganisation = <
204
- TData = AsyncReturnType<typeof getDefaultOrganisation>,
205
- TError = ErrorType<void | AsError>
201
+ export type AppApiOrganisationGetDefaultQueryResult = NonNullable<
202
+ AsyncReturnType<typeof appApiOrganisationGetDefault>
203
+ >;
204
+ export type AppApiOrganisationGetDefaultQueryError = AxiosError<void | AsError>;
205
+
206
+ export const useAppApiOrganisationGetDefault = <
207
+ TData = AsyncReturnType<typeof appApiOrganisationGetDefault>,
208
+ TError = AxiosError<void | AsError>
206
209
  >(options?: {
207
210
  query?: UseQueryOptions<
208
- AsyncReturnType<typeof getDefaultOrganisation>,
211
+ AsyncReturnType<typeof appApiOrganisationGetDefault>,
209
212
  TError,
210
213
  TData
211
214
  >;
212
- request?: SecondParameter<typeof customInstance>;
215
+ axios?: AxiosRequestConfig;
213
216
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
214
- const { query: queryOptions, request: requestOptions } = options || {};
217
+ const { query: queryOptions, axios: axiosOptions } = options || {};
215
218
 
216
219
  const queryKey =
217
- queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
220
+ queryOptions?.queryKey ?? getAppApiOrganisationGetDefaultQueryKey();
218
221
 
219
222
  const queryFn: QueryFunction<
220
- AsyncReturnType<typeof getDefaultOrganisation>
221
- > = () => getDefaultOrganisation(requestOptions);
223
+ AsyncReturnType<typeof appApiOrganisationGetDefault>
224
+ > = () => appApiOrganisationGetDefault(axiosOptions);
222
225
 
223
226
  const query = useQuery<
224
- AsyncReturnType<typeof getDefaultOrganisation>,
227
+ AsyncReturnType<typeof appApiOrganisationGetDefault>,
225
228
  TError,
226
229
  TData
227
230
  >(queryKey, queryFn, queryOptions);