@squonk/account-server-client 1.0.2-rc.3 → 1.0.3-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.
- package/asset/asset.cjs +34 -18
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +16 -16
- package/asset/asset.js +35 -19
- package/asset/asset.js.map +1 -1
- package/{custom-instance-b8075093.d.ts → custom-instance-93fb01eb.d.ts} +22 -20
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +15 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +1 -1
- package/merchant/merchant.js +16 -14
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +18 -6
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +7 -7
- package/organisation/organisation.js +19 -7
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +47 -38
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +10 -10
- package/product/product.js +48 -39
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +73 -87
- package/src/asset/asset.ts +248 -345
- package/src/merchant/merchant.ts +62 -84
- package/src/organisation/organisation.ts +131 -184
- package/src/product/product.ts +279 -422
- package/src/state/state.ts +36 -42
- package/src/unit/unit.ts +218 -301
- package/src/user/user.ts +224 -327
- package/state/state.cjs +9 -9
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +1 -1
- package/state/state.js +10 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +40 -25
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +10 -10
- package/unit/unit.js +41 -26
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +38 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +10 -10
- package/user/user.js +39 -21
- package/user/user.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport {\n useQuery,\n useMutation\n} from 'react-query'\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey\n} from 'react-query'\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetDefaultResponse\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance'\nimport type { ErrorType } from '.././custom-instance'\n\n\n// eslint-disable-next-line\n type 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 all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<OrganisationsGetResponse>(\n {url: `/organisation`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\n \nexport type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>\n\nexport const useGetOrganisations = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisations>>> = ({ signal }) => getOrganisations(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n/**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<OrganisationPostResponse>(\n {url: `/organisation`, method: 'post',\n headers: {'Content-Type': 'application/json', },\n data: organisationPostBodyBody\n },\n options);\n }\n \n\n\n export type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>\n export type CreateOrganisationMutationBody = OrganisationPostBodyBody\n export type CreateOrganisationMutationError = ErrorType<AsError | void>\n\n export const useCreateOrganisation = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisation>>, {data: OrganisationPostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return createOrganisation(data,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof createOrganisation>>, TError, {data: OrganisationPostBodyBody}, TContext>(mutationFn, mutationOptions)\n }\n /**\n * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<void>(\n {url: `/organisation/${orgId}`, method: 'delete'\n },\n options);\n }\n \n\n\n export type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>\n \n export type DeleteOrganisationMutationError = ErrorType<AsError>\n\n export const useDeleteOrganisation = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisation>>, {orgId: string}> = (props) => {\n const {orgId} = props ?? {};\n\n return deleteOrganisation(orgId,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof deleteOrganisation>>, TError, {orgId: string}, TContext>(mutationFn, mutationOptions)\n }\n /**\n * Gets the built-in Default Organisation, used exclusively for Personal Units\n\n * @summary Gets the (built-in) Default Organisation\n */\nexport const getDefaultOrganisation = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetDefaultResponse>(\n {url: `/organisation/default`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetDefaultOrganisationQueryKey = () => [`/organisation/default`];\n\n \nexport type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>\n\nexport const useGetDefaultOrganisation = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getDefaultOrganisation>>> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n"],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAiCA,IAAM,mBAAmB,CAE/B,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAiB,QAAQ;AAAA,MAAO;AAAA,IACxC;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,8BAA8B,MAAM,CAAC,eAAe;AAM1D,IAAM,sBAAsB,CACjC,YAE8D;AAE9D,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEnE,QAAM,YAAW,6CAAc,aAAY,4BAA4B;AAIvE,QAAM,UAAuE,CAAC,EAAE,OAAO,MAAM,iBAAiB,gBAAgB,MAAM;AAEpI,QAAM,QAAQ,SAAsE,UAAU,SAAS,YAAY;AAEnH,QAAM,WAAW;AAEjB,SAAO;AACT;AASO,IAAM,qBAAqB,CAC9B,0BACH,YAAsD;AACjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAiB,QAAQ;AAAA,MAC/B,SAAS,EAAC,gBAAgB,mBAAoB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACE;AAAA,EAAO;AACT;AAQO,IAAM,wBAAwB,CAEjB,YACnB;AACC,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKzE,QAAM,aAAiH,CAAC,UAAU;AAC9H,UAAM,EAAC,KAAI,IAAI,SAAS,CAAC;AAEzB,WAAQ,mBAAmB,MAAK,cAAc;AAAA,EAChD;AAEF,SAAO,YAAgH,YAAY,eAAe;AACpJ;AAQG,IAAM,qBAAqB,CAC9B,OACH,YAAsD;AACjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,iBAAiB;AAAA,MAAS,QAAQ;AAAA,IAC1C;AAAA,IACE;AAAA,EAAO;AACT;AAQO,IAAM,wBAAwB,CAEjB,YACnB;AACC,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKzE,QAAM,aAAgG,CAAC,UAAU;AAC7G,UAAM,EAAC,MAAK,IAAI,SAAS,CAAC;AAE1B,WAAQ,mBAAmB,OAAM,cAAc;AAAA,EACjD;AAEF,SAAO,YAA+F,YAAY,eAAe;AACnI;AAMG,IAAM,yBAAyB,CAErC,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAyB,QAAQ;AAAA,MAAO;AAAA,IAChD;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,oCAAoC,MAAM,CAAC,uBAAuB;AAMxE,IAAM,4BAA4B,CACvC,YAE8D;AAE9D,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEnE,QAAM,YAAW,6CAAc,aAAY,kCAAkC;AAI7E,QAAM,UAA6E,CAAC,EAAE,OAAO,MAAM,uBAAuB,gBAAgB,MAAM;AAEhJ,QAAM,QAAQ,SAA4E,UAAU,SAAS,YAAY;AAEzH,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
package/product/product.cjs
CHANGED
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
|
|
4
4
|
|
|
5
5
|
// src/product/product.ts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
6
9
|
var _reactquery = require('react-query');
|
|
7
10
|
var getProductTypes = (options, signal) => {
|
|
8
11
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
9
|
-
{
|
|
12
|
+
{
|
|
13
|
+
url: `/product-type`,
|
|
14
|
+
method: "get",
|
|
15
|
+
signal
|
|
16
|
+
},
|
|
10
17
|
options
|
|
11
18
|
);
|
|
12
19
|
};
|
|
@@ -14,16 +21,18 @@ var getGetProductTypesQueryKey = () => [`/product-type`];
|
|
|
14
21
|
var useGetProductTypes = (options) => {
|
|
15
22
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
16
23
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductTypesQueryKey()));
|
|
17
|
-
const queryFn = ({
|
|
18
|
-
signal
|
|
19
|
-
}) => getProductTypes(requestOptions, signal);
|
|
24
|
+
const queryFn = ({ signal }) => getProductTypes(requestOptions, signal);
|
|
20
25
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
21
26
|
query.queryKey = queryKey;
|
|
22
27
|
return query;
|
|
23
28
|
};
|
|
24
29
|
var getProducts = (options, signal) => {
|
|
25
30
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
26
|
-
{
|
|
31
|
+
{
|
|
32
|
+
url: `/product`,
|
|
33
|
+
method: "get",
|
|
34
|
+
signal
|
|
35
|
+
},
|
|
27
36
|
options
|
|
28
37
|
);
|
|
29
38
|
};
|
|
@@ -31,22 +40,22 @@ var getGetProductsQueryKey = () => [`/product`];
|
|
|
31
40
|
var useGetProducts = (options) => {
|
|
32
41
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
33
42
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsQueryKey()));
|
|
34
|
-
const queryFn = ({
|
|
35
|
-
signal
|
|
36
|
-
}) => getProducts(requestOptions, signal);
|
|
43
|
+
const queryFn = ({ signal }) => getProducts(requestOptions, signal);
|
|
37
44
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
38
45
|
query.queryKey = queryKey;
|
|
39
46
|
return query;
|
|
40
47
|
};
|
|
41
48
|
var getProductsForOrganisation = (orgId, options, signal) => {
|
|
42
49
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
43
|
-
{
|
|
50
|
+
{
|
|
51
|
+
url: `/product/organisation/${orgId}`,
|
|
52
|
+
method: "get",
|
|
53
|
+
signal
|
|
54
|
+
},
|
|
44
55
|
options
|
|
45
56
|
);
|
|
46
57
|
};
|
|
47
|
-
var getGetProductsForOrganisationQueryKey = (orgId) => [
|
|
48
|
-
`/product/organisation/${orgId}`
|
|
49
|
-
];
|
|
58
|
+
var getGetProductsForOrganisationQueryKey = (orgId) => [`/product/organisation/${orgId}`];
|
|
50
59
|
var useGetProductsForOrganisation = (orgId, options) => {
|
|
51
60
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
52
61
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForOrganisationQueryKey(orgId)));
|
|
@@ -76,50 +85,48 @@ var useCreateUnitProduct = (options) => {
|
|
|
76
85
|
};
|
|
77
86
|
var getProductsForUnit = (unitId, options, signal) => {
|
|
78
87
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
79
|
-
{
|
|
88
|
+
{
|
|
89
|
+
url: `/product/unit/${unitId}`,
|
|
90
|
+
method: "get",
|
|
91
|
+
signal
|
|
92
|
+
},
|
|
80
93
|
options
|
|
81
94
|
);
|
|
82
95
|
};
|
|
83
|
-
var getGetProductsForUnitQueryKey = (unitId) => [
|
|
84
|
-
`/product/unit/${unitId}`
|
|
85
|
-
];
|
|
96
|
+
var getGetProductsForUnitQueryKey = (unitId) => [`/product/unit/${unitId}`];
|
|
86
97
|
var useGetProductsForUnit = (unitId, options) => {
|
|
87
98
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
88
99
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForUnitQueryKey(unitId)));
|
|
89
100
|
const queryFn = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
|
|
90
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, {
|
|
91
|
-
enabled: !!unitId,
|
|
92
|
-
...queryOptions
|
|
93
|
-
});
|
|
101
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
|
|
94
102
|
query.queryKey = queryKey;
|
|
95
103
|
return query;
|
|
96
104
|
};
|
|
97
105
|
var getProduct = (productId, options, signal) => {
|
|
98
106
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
99
|
-
{
|
|
107
|
+
{
|
|
108
|
+
url: `/product/${productId}`,
|
|
109
|
+
method: "get",
|
|
110
|
+
signal
|
|
111
|
+
},
|
|
100
112
|
options
|
|
101
113
|
);
|
|
102
114
|
};
|
|
103
|
-
var getGetProductQueryKey = (productId) => [
|
|
104
|
-
`/product/${productId}`
|
|
105
|
-
];
|
|
115
|
+
var getGetProductQueryKey = (productId) => [`/product/${productId}`];
|
|
106
116
|
var useGetProduct = (productId, options) => {
|
|
107
117
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
108
118
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductQueryKey(productId)));
|
|
109
|
-
const queryFn = ({
|
|
110
|
-
|
|
111
|
-
}) => getProduct(productId, requestOptions, signal);
|
|
112
|
-
const query = _reactquery.useQuery.call(void 0,
|
|
113
|
-
queryKey,
|
|
114
|
-
queryFn,
|
|
115
|
-
{ enabled: !!productId, ...queryOptions }
|
|
116
|
-
);
|
|
119
|
+
const queryFn = ({ signal }) => getProduct(productId, requestOptions, signal);
|
|
120
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!productId, ...queryOptions });
|
|
117
121
|
query.queryKey = queryKey;
|
|
118
122
|
return query;
|
|
119
123
|
};
|
|
120
124
|
var deleteProduct = (productId, options) => {
|
|
121
125
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
122
|
-
{
|
|
126
|
+
{
|
|
127
|
+
url: `/product/${productId}`,
|
|
128
|
+
method: "delete"
|
|
129
|
+
},
|
|
123
130
|
options
|
|
124
131
|
);
|
|
125
132
|
};
|
|
@@ -152,7 +159,12 @@ var usePatchProduct = (options) => {
|
|
|
152
159
|
};
|
|
153
160
|
var getProductCharges = (productId, params, options, signal) => {
|
|
154
161
|
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
155
|
-
{
|
|
162
|
+
{
|
|
163
|
+
url: `/product/${productId}/charges`,
|
|
164
|
+
method: "get",
|
|
165
|
+
params,
|
|
166
|
+
signal
|
|
167
|
+
},
|
|
156
168
|
options
|
|
157
169
|
);
|
|
158
170
|
};
|
|
@@ -161,10 +173,7 @@ var useGetProductCharges = (productId, params, options) => {
|
|
|
161
173
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
162
174
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductChargesQueryKey(productId, params)));
|
|
163
175
|
const queryFn = ({ signal }) => getProductCharges(productId, params, requestOptions, signal);
|
|
164
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, {
|
|
165
|
-
enabled: !!productId,
|
|
166
|
-
...queryOptions
|
|
167
|
-
});
|
|
176
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!productId, ...queryOptions });
|
|
168
177
|
query.queryKey = queryKey;
|
|
169
178
|
return query;
|
|
170
179
|
};
|
package/product/product.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAoC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SA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CAAC,UAAU;AACb,UAAM,EAAE,WAAW,KAAK,IAAI,SAAS,CAAC;AAEtC,WAAO,aAAa,WAAW,MAAM,cAAc;AAAA,EACrD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAWO,IAAM,oBAAoB,CAC/B,WACA,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,qBAAqB,QAAQ,OAAO,QAAQ,OAAO;AAAA,IACtE;AAAA,EACF;AACF;AAEO,IAAM,+BAA+B,CAC1C,WACA,WACG,CAAC,YAAY,qBAAqB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAO3D,IAAM,uBAAuB,CAIlC,WACA,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,6BAA6B,WAAW,MAAM;AAE1E,QAAM,UAEF,CAAC,EAAE,OAAO,MACZ,kBAAkB,WAAW,QAAQ,gBAAgB,MAAM;AAE7D,QAAM,QAAQ,SAIZ,UAAU,SAAS;AAAA,IACnB,SAAS,CAAC,CAAC;AAAA,IACX,GAAG;AAAA,EACL,CAAC;AAED,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery, useMutation } from \"react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n ProductChargesGetResponse,\n GetProductChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) => [\n `/product/organisation/${orgId}`,\n];\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof createUnitProduct>>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createUnitProduct>>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >(queryKey, queryFn, {\n enabled: !!unitId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) => [\n `/product/${productId}`,\n];\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!productId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteProduct>>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchProduct>>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`.\n\nYou need **admin** rights to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n { url: `/product/${productId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams\n) => [`/product/${productId}/charges`, ...(params ? [params] : [])];\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductCharges = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductCharges>>\n > = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >(queryKey, queryFn, {\n enabled: !!productId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAqCA,IAAM,kBAAkB,CAE9B,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,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C,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKzE,QAAM,aAAyH,CAAC,UAAU;AACtI,UAAM,EAAC,WAAU,KAAI,IAAI,SAAS,CAAC;AAEnC,WAAQ,aAAa,WAAU,MAAK,cAAc;AAAA,EACpD;AAEF,SAAO,YAAwH,YAAY,eAAe;AAC5J;AAWG,IAAM,oBAAoB,CAC7B,WACA,QACH,SAAiD,WAC7C;AACC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,YAAY;AAAA,MAAqB,QAAQ;AAAA,MAC7C;AAAA,MAAQ;AAAA,IACZ;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,+BAA+B,CAAC,WACzC,WAAsC,CAAC,YAAY,qBAAqB,GAAI,SAAS,CAAC,MAAM,IAAG,CAAC,CAAE;AAM/F,IAAM,uBAAuB,CACnC,WACG,QAAkC,YAE0B;AAE9D,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEnE,QAAM,YAAW,6CAAc,aAAY,6BAA6B,WAAU,MAAM;AAIxF,QAAM,UAAwE,CAAC,EAAE,OAAO,MAAM,kBAAkB,WAAU,QAAQ,gBAAgB,MAAM;AAExJ,QAAM,QAAQ,SAAuE,UAAU,SAAS,EAAC,SAAS,CAAC,CAAE,WAAY,GAAG,aAAY,CAAC;AAEjJ,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport {\n useQuery,\n useMutation\n} from 'react-query'\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey\n} from 'react-query'\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n ProductChargesGetResponse,\n GetProductChargesParams\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance'\nimport type { ErrorType } from '.././custom-instance'\n\n\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n {url: `/product-type`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\n \nexport type GetProductTypesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductTypes>>>\nexport type GetProductTypesQueryError = ErrorType<AsError | void>\n\nexport const useGetProductTypes = <TData = Awaited<ReturnType<typeof getProductTypes>>, TError = ErrorType<AsError | void>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({ signal }) => getProductTypes(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n {url: `/product`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetProductsQueryKey = () => [`/product`];\n\n \nexport type GetProductsQueryResult = NonNullable<Awaited<ReturnType<typeof getProducts>>>\nexport type GetProductsQueryError = ErrorType<AsError | void>\n\nexport const useGetProducts = <TData = Awaited<ReturnType<typeof getProducts>>, TError = ErrorType<AsError | void>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({ signal }) => getProducts(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProducts>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n {url: `/product/organisation/${orgId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string,) => [`/product/organisation/${orgId}`];\n\n \nexport type GetProductsForOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForOrganisation>>>\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>\n\nexport const useGetProductsForOrganisation = <TData = Awaited<ReturnType<typeof getProductsForOrganisation>>, TError = ErrorType<void | AsError>>(\n orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForOrganisation>>> = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>(queryKey, queryFn, {enabled: !!(orgId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<UnitProductPostResponse>(\n {url: `/product/unit/${unitId}`, method: 'post',\n headers: {'Content-Type': 'application/json', },\n data: unitProductPostBodyBody\n },\n options);\n }\n \n\n\n export type CreateUnitProductMutationResult = NonNullable<Awaited<ReturnType<typeof createUnitProduct>>>\n export type CreateUnitProductMutationBody = UnitProductPostBodyBody\n export type CreateUnitProductMutationError = ErrorType<AsError | void>\n\n export const useCreateUnitProduct = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createUnitProduct>>, TError,{unitId: string;data: UnitProductPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createUnitProduct>>, {unitId: string;data: UnitProductPostBodyBody}> = (props) => {\n const {unitId,data} = props ?? {};\n\n return createUnitProduct(unitId,data,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof createUnitProduct>>, TError, {unitId: string;data: UnitProductPostBodyBody}, TContext>(mutationFn, mutationOptions)\n }\n /**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n {url: `/product/unit/${unitId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetProductsForUnitQueryKey = (unitId: string,) => [`/product/unit/${unitId}`];\n\n \nexport type GetProductsForUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForUnit>>>\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>\n\nexport const useGetProductsForUnit = <TData = Awaited<ReturnType<typeof getProductsForUnit>>, TError = ErrorType<void | AsError>>(\n unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForUnit>>> = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>(queryKey, queryFn, {enabled: !!(unitId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n {url: `/product/${productId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetProductQueryKey = (productId: string,) => [`/product/${productId}`];\n\n \nexport type GetProductQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct>>>\nexport type GetProductQueryError = ErrorType<AsError | void>\n\nexport const useGetProduct = <TData = Awaited<ReturnType<typeof getProduct>>, TError = ErrorType<AsError | void>>(\n productId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({ signal }) => getProduct(productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(queryKey, queryFn, {enabled: !!(productId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<void>(\n {url: `/product/${productId}`, method: 'delete'\n },\n options);\n }\n \n\n\n export type DeleteProductMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProduct>>>\n \n export type DeleteProductMutationError = ErrorType<AsError>\n\n export const useDeleteProduct = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProduct>>, TError,{productId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteProduct>>, {productId: string}> = (props) => {\n const {productId} = props ?? {};\n\n return deleteProduct(productId,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof deleteProduct>>, TError, {productId: string}, TContext>(mutationFn, mutationOptions)\n }\n /**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n return customInstance<void>(\n {url: `/product/${productId}`, method: 'patch',\n headers: {'Content-Type': 'application/json', },\n data: productPatchBodyBody\n },\n options);\n }\n \n\n\n export type PatchProductMutationResult = NonNullable<Awaited<ReturnType<typeof patchProduct>>>\n export type PatchProductMutationBody = ProductPatchBodyBody\n export type PatchProductMutationError = ErrorType<AsError>\n\n export const usePatchProduct = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchProduct>>, TError,{productId: string;data: ProductPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {}\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchProduct>>, {productId: string;data: ProductPatchBodyBody}> = (props) => {\n const {productId,data} = props ?? {};\n\n return patchProduct(productId,data,requestOptions)\n }\n\n return useMutation<Awaited<ReturnType<typeof patchProduct>>, TError, {productId: string;data: ProductPatchBodyBody}, TContext>(mutationFn, mutationOptions)\n }\n /**\n * Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`.\n\nYou need **admin** rights to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n {url: `/product/${productId}/charges`, method: 'get',\n params, signal\n },\n options);\n }\n \n\nexport const getGetProductChargesQueryKey = (productId: string,\n params?: GetProductChargesParams,) => [`/product/${productId}/charges`, ...(params ? [params]: [])];\n\n \nexport type GetProductChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductCharges>>>\nexport type GetProductChargesQueryError = ErrorType<AsError | void>\n\nexport const useGetProductCharges = <TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const {query: queryOptions, request: requestOptions} = options ?? {}\n\n const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductCharges>>> = ({ signal }) => getProductCharges(productId,params, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>(queryKey, queryFn, {enabled: !!(productId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n}\n\n"]}
|
package/product/product.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_query from 'react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
-
import { ak as customInstance, a0 as ProductsGetTypesResponse, al as ErrorType, ag as AsError, a2 as ProductsGetResponse, i as UnitProductPostBodyBody, Z as UnitProductPostResponse, $ as ProductUnitGetResponse, P as ProductPatchBodyBody, G as GetProductChargesParams, a4 as ProductChargesGetResponse } from '../custom-instance-
|
|
3
|
+
import { ak as customInstance, a0 as ProductsGetTypesResponse, al as ErrorType, ag as AsError, a2 as ProductsGetResponse, i as UnitProductPostBodyBody, Z as UnitProductPostResponse, $ as ProductUnitGetResponse, P as ProductPatchBodyBody, G as GetProductChargesParams, a4 as ProductChargesGetResponse } from '../custom-instance-93fb01eb.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
6
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
@@ -73,10 +73,10 @@ declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContex
|
|
|
73
73
|
data: UnitProductPostBodyBody;
|
|
74
74
|
}, TContext>;
|
|
75
75
|
/**
|
|
76
|
-
|
|
76
|
+
* Gets products you have access to based on an Organisational Unit
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
* @summary Gets Products for an Organisational Unit
|
|
79
|
+
*/
|
|
80
80
|
declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductsGetResponse>;
|
|
81
81
|
declare const getGetProductsForUnitQueryKey: (unitId: string) => string[];
|
|
82
82
|
declare type GetProductsForUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForUnit>>>;
|
|
@@ -117,10 +117,10 @@ declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown
|
|
|
117
117
|
productId: string;
|
|
118
118
|
}, TContext>;
|
|
119
119
|
/**
|
|
120
|
-
|
|
120
|
+
* Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
* @summary Adjust an existing Product
|
|
123
|
+
*/
|
|
124
124
|
declare const patchProduct: (productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
125
125
|
declare type PatchProductMutationResult = NonNullable<Awaited<ReturnType<typeof patchProduct>>>;
|
|
126
126
|
declare type PatchProductMutationBody = ProductPatchBodyBody;
|
|
@@ -136,15 +136,15 @@ declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>
|
|
|
136
136
|
data: ProductPatchBodyBody;
|
|
137
137
|
}, TContext>;
|
|
138
138
|
/**
|
|
139
|
-
|
|
139
|
+
* Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.
|
|
140
140
|
|
|
141
141
|
Dates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.
|
|
142
142
|
|
|
143
143
|
**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`.
|
|
144
144
|
|
|
145
145
|
You need **admin** rights to use this method
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
* @summary Get charges made against a Product
|
|
147
|
+
*/
|
|
148
148
|
declare const getProductCharges: (productId: string, params?: GetProductChargesParams | undefined, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductChargesGetResponse>;
|
|
149
149
|
declare const getGetProductChargesQueryKey: (productId: string, params?: GetProductChargesParams | undefined) => (string | GetProductChargesParams)[];
|
|
150
150
|
declare type GetProductChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductCharges>>>;
|
package/product/product.js
CHANGED
|
@@ -3,10 +3,17 @@ import {
|
|
|
3
3
|
} from "../chunk-3O5KIRV4.js";
|
|
4
4
|
|
|
5
5
|
// src/product/product.ts
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useQuery,
|
|
8
|
+
useMutation
|
|
9
|
+
} from "react-query";
|
|
7
10
|
var getProductTypes = (options, signal) => {
|
|
8
11
|
return customInstance(
|
|
9
|
-
{
|
|
12
|
+
{
|
|
13
|
+
url: `/product-type`,
|
|
14
|
+
method: "get",
|
|
15
|
+
signal
|
|
16
|
+
},
|
|
10
17
|
options
|
|
11
18
|
);
|
|
12
19
|
};
|
|
@@ -14,16 +21,18 @@ var getGetProductTypesQueryKey = () => [`/product-type`];
|
|
|
14
21
|
var useGetProductTypes = (options) => {
|
|
15
22
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
16
23
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductTypesQueryKey();
|
|
17
|
-
const queryFn = ({
|
|
18
|
-
signal
|
|
19
|
-
}) => getProductTypes(requestOptions, signal);
|
|
24
|
+
const queryFn = ({ signal }) => getProductTypes(requestOptions, signal);
|
|
20
25
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
21
26
|
query.queryKey = queryKey;
|
|
22
27
|
return query;
|
|
23
28
|
};
|
|
24
29
|
var getProducts = (options, signal) => {
|
|
25
30
|
return customInstance(
|
|
26
|
-
{
|
|
31
|
+
{
|
|
32
|
+
url: `/product`,
|
|
33
|
+
method: "get",
|
|
34
|
+
signal
|
|
35
|
+
},
|
|
27
36
|
options
|
|
28
37
|
);
|
|
29
38
|
};
|
|
@@ -31,22 +40,22 @@ var getGetProductsQueryKey = () => [`/product`];
|
|
|
31
40
|
var useGetProducts = (options) => {
|
|
32
41
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
33
42
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsQueryKey();
|
|
34
|
-
const queryFn = ({
|
|
35
|
-
signal
|
|
36
|
-
}) => getProducts(requestOptions, signal);
|
|
43
|
+
const queryFn = ({ signal }) => getProducts(requestOptions, signal);
|
|
37
44
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
38
45
|
query.queryKey = queryKey;
|
|
39
46
|
return query;
|
|
40
47
|
};
|
|
41
48
|
var getProductsForOrganisation = (orgId, options, signal) => {
|
|
42
49
|
return customInstance(
|
|
43
|
-
{
|
|
50
|
+
{
|
|
51
|
+
url: `/product/organisation/${orgId}`,
|
|
52
|
+
method: "get",
|
|
53
|
+
signal
|
|
54
|
+
},
|
|
44
55
|
options
|
|
45
56
|
);
|
|
46
57
|
};
|
|
47
|
-
var getGetProductsForOrganisationQueryKey = (orgId) => [
|
|
48
|
-
`/product/organisation/${orgId}`
|
|
49
|
-
];
|
|
58
|
+
var getGetProductsForOrganisationQueryKey = (orgId) => [`/product/organisation/${orgId}`];
|
|
50
59
|
var useGetProductsForOrganisation = (orgId, options) => {
|
|
51
60
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
52
61
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForOrganisationQueryKey(orgId);
|
|
@@ -76,50 +85,48 @@ var useCreateUnitProduct = (options) => {
|
|
|
76
85
|
};
|
|
77
86
|
var getProductsForUnit = (unitId, options, signal) => {
|
|
78
87
|
return customInstance(
|
|
79
|
-
{
|
|
88
|
+
{
|
|
89
|
+
url: `/product/unit/${unitId}`,
|
|
90
|
+
method: "get",
|
|
91
|
+
signal
|
|
92
|
+
},
|
|
80
93
|
options
|
|
81
94
|
);
|
|
82
95
|
};
|
|
83
|
-
var getGetProductsForUnitQueryKey = (unitId) => [
|
|
84
|
-
`/product/unit/${unitId}`
|
|
85
|
-
];
|
|
96
|
+
var getGetProductsForUnitQueryKey = (unitId) => [`/product/unit/${unitId}`];
|
|
86
97
|
var useGetProductsForUnit = (unitId, options) => {
|
|
87
98
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
88
99
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitId);
|
|
89
100
|
const queryFn = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
|
|
90
|
-
const query = useQuery(queryKey, queryFn, {
|
|
91
|
-
enabled: !!unitId,
|
|
92
|
-
...queryOptions
|
|
93
|
-
});
|
|
101
|
+
const query = useQuery(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
|
|
94
102
|
query.queryKey = queryKey;
|
|
95
103
|
return query;
|
|
96
104
|
};
|
|
97
105
|
var getProduct = (productId, options, signal) => {
|
|
98
106
|
return customInstance(
|
|
99
|
-
{
|
|
107
|
+
{
|
|
108
|
+
url: `/product/${productId}`,
|
|
109
|
+
method: "get",
|
|
110
|
+
signal
|
|
111
|
+
},
|
|
100
112
|
options
|
|
101
113
|
);
|
|
102
114
|
};
|
|
103
|
-
var getGetProductQueryKey = (productId) => [
|
|
104
|
-
`/product/${productId}`
|
|
105
|
-
];
|
|
115
|
+
var getGetProductQueryKey = (productId) => [`/product/${productId}`];
|
|
106
116
|
var useGetProduct = (productId, options) => {
|
|
107
117
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
108
118
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductQueryKey(productId);
|
|
109
|
-
const queryFn = ({
|
|
110
|
-
|
|
111
|
-
}) => getProduct(productId, requestOptions, signal);
|
|
112
|
-
const query = useQuery(
|
|
113
|
-
queryKey,
|
|
114
|
-
queryFn,
|
|
115
|
-
{ enabled: !!productId, ...queryOptions }
|
|
116
|
-
);
|
|
119
|
+
const queryFn = ({ signal }) => getProduct(productId, requestOptions, signal);
|
|
120
|
+
const query = useQuery(queryKey, queryFn, { enabled: !!productId, ...queryOptions });
|
|
117
121
|
query.queryKey = queryKey;
|
|
118
122
|
return query;
|
|
119
123
|
};
|
|
120
124
|
var deleteProduct = (productId, options) => {
|
|
121
125
|
return customInstance(
|
|
122
|
-
{
|
|
126
|
+
{
|
|
127
|
+
url: `/product/${productId}`,
|
|
128
|
+
method: "delete"
|
|
129
|
+
},
|
|
123
130
|
options
|
|
124
131
|
);
|
|
125
132
|
};
|
|
@@ -152,7 +159,12 @@ var usePatchProduct = (options) => {
|
|
|
152
159
|
};
|
|
153
160
|
var getProductCharges = (productId, params, options, signal) => {
|
|
154
161
|
return customInstance(
|
|
155
|
-
{
|
|
162
|
+
{
|
|
163
|
+
url: `/product/${productId}/charges`,
|
|
164
|
+
method: "get",
|
|
165
|
+
params,
|
|
166
|
+
signal
|
|
167
|
+
},
|
|
156
168
|
options
|
|
157
169
|
);
|
|
158
170
|
};
|
|
@@ -161,10 +173,7 @@ var useGetProductCharges = (productId, params, options) => {
|
|
|
161
173
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
162
174
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductChargesQueryKey(productId, params);
|
|
163
175
|
const queryFn = ({ signal }) => getProductCharges(productId, params, requestOptions, signal);
|
|
164
|
-
const query = useQuery(queryKey, queryFn, {
|
|
165
|
-
enabled: !!productId,
|
|
166
|
-
...queryOptions
|
|
167
|
-
});
|
|
176
|
+
const query = useQuery(queryKey, queryFn, { enabled: !!productId, ...queryOptions });
|
|
168
177
|
query.queryKey = queryKey;
|
|
169
178
|
return query;
|
|
170
179
|
};
|