@learnorama/mozaik-sdk 0.1.0
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/README.md +94 -0
- package/dist/api/account.d.ts +75 -0
- package/dist/api/account.js +117 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/admin-catalogue.d.ts +68 -0
- package/dist/api/admin-catalogue.js +155 -0
- package/dist/api/admin-catalogue.js.map +1 -0
- package/dist/api/admin-consumption.d.ts +27 -0
- package/dist/api/admin-consumption.js +55 -0
- package/dist/api/admin-consumption.js.map +1 -0
- package/dist/api/admin-licenses.d.ts +21 -0
- package/dist/api/admin-licenses.js +34 -0
- package/dist/api/admin-licenses.js.map +1 -0
- package/dist/api/admin-patrons.d.ts +36 -0
- package/dist/api/admin-patrons.js +76 -0
- package/dist/api/admin-patrons.js.map +1 -0
- package/dist/api/admin-reviews.d.ts +30 -0
- package/dist/api/admin-reviews.js +63 -0
- package/dist/api/admin-reviews.js.map +1 -0
- package/dist/api/admin-roles.d.ts +34 -0
- package/dist/api/admin-roles.js +62 -0
- package/dist/api/admin-roles.js.map +1 -0
- package/dist/api/admin-support.d.ts +68 -0
- package/dist/api/admin-support.js +116 -0
- package/dist/api/admin-support.js.map +1 -0
- package/dist/api/admin-tenants.d.ts +33 -0
- package/dist/api/admin-tenants.js +68 -0
- package/dist/api/admin-tenants.js.map +1 -0
- package/dist/api/admin-tutoring.d.ts +159 -0
- package/dist/api/admin-tutoring.js +455 -0
- package/dist/api/admin-tutoring.js.map +1 -0
- package/dist/api/auth.d.ts +92 -0
- package/dist/api/auth.js +192 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/biblio-catalogue.d.ts +122 -0
- package/dist/api/biblio-catalogue.js +223 -0
- package/dist/api/biblio-catalogue.js.map +1 -0
- package/dist/api/biblio-home.d.ts +18 -0
- package/dist/api/biblio-home.js +31 -0
- package/dist/api/biblio-home.js.map +1 -0
- package/dist/api/biblio-library.d.ts +94 -0
- package/dist/api/biblio-library.js +187 -0
- package/dist/api/biblio-library.js.map +1 -0
- package/dist/api/biblio-nextory.d.ts +43 -0
- package/dist/api/biblio-nextory.js +65 -0
- package/dist/api/biblio-nextory.js.map +1 -0
- package/dist/api/biblio-press.d.ts +38 -0
- package/dist/api/biblio-press.js +70 -0
- package/dist/api/biblio-press.js.map +1 -0
- package/dist/api/biblio-search.d.ts +17 -0
- package/dist/api/biblio-search.js +30 -0
- package/dist/api/biblio-search.js.map +1 -0
- package/dist/api/biblio-telemetry.d.ts +28 -0
- package/dist/api/biblio-telemetry.js +49 -0
- package/dist/api/biblio-telemetry.js.map +1 -0
- package/dist/api/consumption.d.ts +30 -0
- package/dist/api/consumption.js +45 -0
- package/dist/api/consumption.js.map +1 -0
- package/dist/api/cvs-app.d.ts +39 -0
- package/dist/api/cvs-app.js +72 -0
- package/dist/api/cvs-app.js.map +1 -0
- package/dist/api/cvs-documents.d.ts +106 -0
- package/dist/api/cvs-documents.js +208 -0
- package/dist/api/cvs-documents.js.map +1 -0
- package/dist/api/cvs-favorites.d.ts +53 -0
- package/dist/api/cvs-favorites.js +82 -0
- package/dist/api/cvs-favorites.js.map +1 -0
- package/dist/api/cvs-loans.d.ts +59 -0
- package/dist/api/cvs-loans.js +106 -0
- package/dist/api/cvs-loans.js.map +1 -0
- package/dist/api/cvs-streaming.d.ts +40 -0
- package/dist/api/cvs-streaming.js +68 -0
- package/dist/api/cvs-streaming.js.map +1 -0
- package/dist/api/index.d.ts +34 -0
- package/dist/api/index.js +34 -0
- package/dist/api/partner-catalogue.d.ts +77 -0
- package/dist/api/partner-catalogue.js +125 -0
- package/dist/api/partner-catalogue.js.map +1 -0
- package/dist/api/partner-reader.d.ts +56 -0
- package/dist/api/partner-reader.js +103 -0
- package/dist/api/partner-reader.js.map +1 -0
- package/dist/api/profiles.d.ts +64 -0
- package/dist/api/profiles.js +126 -0
- package/dist/api/profiles.js.map +1 -0
- package/dist/api/tutoring-catalogue.d.ts +32 -0
- package/dist/api/tutoring-catalogue.js +59 -0
- package/dist/api/tutoring-catalogue.js.map +1 -0
- package/dist/api/tutoring-chat.d.ts +31 -0
- package/dist/api/tutoring-chat.js +71 -0
- package/dist/api/tutoring-chat.js.map +1 -0
- package/dist/api/tutoring-dispatch.d.ts +37 -0
- package/dist/api/tutoring-dispatch.js +83 -0
- package/dist/api/tutoring-dispatch.js.map +1 -0
- package/dist/api/tutoring-practitioner.d.ts +55 -0
- package/dist/api/tutoring-practitioner.js +110 -0
- package/dist/api/tutoring-practitioner.js.map +1 -0
- package/dist/api/tutoring-requests.d.ts +86 -0
- package/dist/api/tutoring-requests.js +176 -0
- package/dist/api/tutoring-requests.js.map +1 -0
- package/dist/client-BDwBZYB0.d.ts +28 -0
- package/dist/client-D3kMOcIr.js +61 -0
- package/dist/client-D3kMOcIr.js.map +1 -0
- package/dist/index-wL_20vR8.d.ts +4566 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +3 -0
- package/dist/models.js +175 -0
- package/dist/models.js.map +1 -0
- package/dist/react/account.d.ts +163 -0
- package/dist/react/account.js +240 -0
- package/dist/react/account.js.map +1 -0
- package/dist/react/admin-catalogue.d.ts +196 -0
- package/dist/react/admin-catalogue.js +336 -0
- package/dist/react/admin-catalogue.js.map +1 -0
- package/dist/react/admin-consumption.d.ts +75 -0
- package/dist/react/admin-consumption.js +127 -0
- package/dist/react/admin-consumption.js.map +1 -0
- package/dist/react/admin-licenses.d.ts +50 -0
- package/dist/react/admin-licenses.js +78 -0
- package/dist/react/admin-licenses.js.map +1 -0
- package/dist/react/admin-patrons.d.ts +111 -0
- package/dist/react/admin-patrons.js +173 -0
- package/dist/react/admin-patrons.js.map +1 -0
- package/dist/react/admin-reviews.d.ts +78 -0
- package/dist/react/admin-reviews.js +135 -0
- package/dist/react/admin-reviews.js.map +1 -0
- package/dist/react/admin-roles.d.ts +82 -0
- package/dist/react/admin-roles.js +135 -0
- package/dist/react/admin-roles.js.map +1 -0
- package/dist/react/admin-support.d.ts +123 -0
- package/dist/react/admin-support.js +208 -0
- package/dist/react/admin-support.js.map +1 -0
- package/dist/react/admin-tenants.d.ts +108 -0
- package/dist/react/admin-tenants.js +165 -0
- package/dist/react/admin-tenants.js.map +1 -0
- package/dist/react/admin-tutoring.d.ts +556 -0
- package/dist/react/admin-tutoring.js +954 -0
- package/dist/react/admin-tutoring.js.map +1 -0
- package/dist/react/auth.d.ts +220 -0
- package/dist/react/auth.js +372 -0
- package/dist/react/auth.js.map +1 -0
- package/dist/react/biblio-catalogue.d.ts +374 -0
- package/dist/react/biblio-catalogue.js +498 -0
- package/dist/react/biblio-catalogue.js.map +1 -0
- package/dist/react/biblio-home.d.ts +47 -0
- package/dist/react/biblio-home.js +75 -0
- package/dist/react/biblio-home.js.map +1 -0
- package/dist/react/biblio-library.d.ts +285 -0
- package/dist/react/biblio-library.js +411 -0
- package/dist/react/biblio-library.js.map +1 -0
- package/dist/react/biblio-nextory.d.ts +100 -0
- package/dist/react/biblio-nextory.js +163 -0
- package/dist/react/biblio-nextory.js.map +1 -0
- package/dist/react/biblio-press.d.ts +121 -0
- package/dist/react/biblio-press.js +163 -0
- package/dist/react/biblio-press.js.map +1 -0
- package/dist/react/biblio-search.d.ts +46 -0
- package/dist/react/biblio-search.js +74 -0
- package/dist/react/biblio-search.js.map +1 -0
- package/dist/react/biblio-telemetry.d.ts +49 -0
- package/dist/react/biblio-telemetry.js +85 -0
- package/dist/react/biblio-telemetry.js.map +1 -0
- package/dist/react/consumption.d.ts +66 -0
- package/dist/react/consumption.js +109 -0
- package/dist/react/consumption.js.map +1 -0
- package/dist/react/cvs-app.d.ts +86 -0
- package/dist/react/cvs-app.js +144 -0
- package/dist/react/cvs-app.js.map +1 -0
- package/dist/react/cvs-documents.d.ts +254 -0
- package/dist/react/cvs-documents.js +418 -0
- package/dist/react/cvs-documents.js.map +1 -0
- package/dist/react/cvs-favorites.d.ts +143 -0
- package/dist/react/cvs-favorites.js +206 -0
- package/dist/react/cvs-favorites.js.map +1 -0
- package/dist/react/cvs-loans.d.ts +140 -0
- package/dist/react/cvs-loans.js +234 -0
- package/dist/react/cvs-loans.js.map +1 -0
- package/dist/react/cvs-streaming.d.ts +87 -0
- package/dist/react/cvs-streaming.js +141 -0
- package/dist/react/cvs-streaming.js.map +1 -0
- package/dist/react/index.d.ts +34 -0
- package/dist/react/index.js +34 -0
- package/dist/react/partner-catalogue.d.ts +223 -0
- package/dist/react/partner-catalogue.js +301 -0
- package/dist/react/partner-catalogue.js.map +1 -0
- package/dist/react/partner-reader.d.ts +159 -0
- package/dist/react/partner-reader.js +226 -0
- package/dist/react/partner-reader.js.map +1 -0
- package/dist/react/profiles.d.ts +174 -0
- package/dist/react/profiles.js +279 -0
- package/dist/react/profiles.js.map +1 -0
- package/dist/react/tutoring-catalogue.d.ts +115 -0
- package/dist/react/tutoring-catalogue.js +151 -0
- package/dist/react/tutoring-catalogue.js.map +1 -0
- package/dist/react/tutoring-chat.d.ts +96 -0
- package/dist/react/tutoring-chat.js +172 -0
- package/dist/react/tutoring-chat.js.map +1 -0
- package/dist/react/tutoring-dispatch.d.ts +102 -0
- package/dist/react/tutoring-dispatch.js +183 -0
- package/dist/react/tutoring-dispatch.js.map +1 -0
- package/dist/react/tutoring-practitioner.d.ts +129 -0
- package/dist/react/tutoring-practitioner.js +230 -0
- package/dist/react/tutoring-practitioner.js.map +1 -0
- package/dist/react/tutoring-requests.d.ts +233 -0
- package/dist/react/tutoring-requests.js +385 -0
- package/dist/react/tutoring-requests.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
import { $ as ReadPatronLicenseParams, Gn as HTTPExceptionResponse, R as StaffLicenseRead, t as ValidationErrorResponse } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/admin-licenses/admin-licenses.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getReadPatronLicenseUrl: (params: ReadPatronLicenseParams) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Report one account's licence state. Never allocates, never repairs.
|
|
10
|
+
*
|
|
11
|
+
* Scoped like every other staff read: an agent who cannot see the account gets
|
|
12
|
+
* ``404``, the same answer as for an address nobody holds, so the endpoint
|
|
13
|
+
* cannot be used to test whether a member exists elsewhere.
|
|
14
|
+
*
|
|
15
|
+
* ``partner_active`` is ``None`` when the partner could not be reached. That is
|
|
16
|
+
* deliberately distinct from ``False`` — "we could not ask" and "they said the
|
|
17
|
+
* subscription is closed" lead a support agent to different actions, and
|
|
18
|
+
* collapsing them is how a working account gets re-provisioned.
|
|
19
|
+
* @summary Read Patron License
|
|
20
|
+
*/
|
|
21
|
+
export declare const readPatronLicense: (params: ReadPatronLicenseParams, options?: Parameters<typeof request>[1]) => Promise<StaffLicenseRead>;
|
|
22
|
+
export declare const getReadPatronLicenseQueryKey: (params?: ReadPatronLicenseParams) => readonly ["/admin/nextory-licenses", ...ReadPatronLicenseParams[]];
|
|
23
|
+
export declare const getReadPatronLicenseQueryOptions: <TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: ReadPatronLicenseParams, options?: {
|
|
24
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>;
|
|
25
|
+
request?: SecondParameter<typeof request>;
|
|
26
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData> & {
|
|
27
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
28
|
+
};
|
|
29
|
+
export type ReadPatronLicenseQueryResult = NonNullable<Awaited<ReturnType<typeof readPatronLicense>>>;
|
|
30
|
+
export type ReadPatronLicenseQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
31
|
+
export declare function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: ReadPatronLicenseParams, options: {
|
|
32
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, Awaited<ReturnType<typeof readPatronLicense>>>, 'initialData'>;
|
|
33
|
+
request?: SecondParameter<typeof request>;
|
|
34
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
35
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
36
|
+
};
|
|
37
|
+
export declare function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: ReadPatronLicenseParams, options?: {
|
|
38
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, Awaited<ReturnType<typeof readPatronLicense>>>, 'initialData'>;
|
|
39
|
+
request?: SecondParameter<typeof request>;
|
|
40
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
41
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
42
|
+
};
|
|
43
|
+
export declare function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: ReadPatronLicenseParams, options?: {
|
|
44
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>;
|
|
45
|
+
request?: SecondParameter<typeof request>;
|
|
46
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
47
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
//# sourceMappingURL=admin-licenses.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/admin-licenses/admin-licenses.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getReadPatronLicenseUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
+
});
|
|
29
|
+
const stringifiedParams = normalizedParams.toString();
|
|
30
|
+
return stringifiedParams.length > 0 ? `/admin/nextory-licenses?${stringifiedParams}` : `/admin/nextory-licenses`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Report one account's licence state. Never allocates, never repairs.
|
|
34
|
+
*
|
|
35
|
+
* Scoped like every other staff read: an agent who cannot see the account gets
|
|
36
|
+
* ``404``, the same answer as for an address nobody holds, so the endpoint
|
|
37
|
+
* cannot be used to test whether a member exists elsewhere.
|
|
38
|
+
*
|
|
39
|
+
* ``partner_active`` is ``None`` when the partner could not be reached. That is
|
|
40
|
+
* deliberately distinct from ``False`` — "we could not ask" and "they said the
|
|
41
|
+
* subscription is closed" lead a support agent to different actions, and
|
|
42
|
+
* collapsing them is how a working account gets re-provisioned.
|
|
43
|
+
* @summary Read Patron License
|
|
44
|
+
*/
|
|
45
|
+
const readPatronLicense = async (params, options) => {
|
|
46
|
+
return request(getReadPatronLicenseUrl(params), {
|
|
47
|
+
...options,
|
|
48
|
+
method: "GET"
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const getReadPatronLicenseQueryKey = (params) => {
|
|
52
|
+
return [`/admin/nextory-licenses`, ...params ? [params] : []];
|
|
53
|
+
};
|
|
54
|
+
const getReadPatronLicenseQueryOptions = (params, options) => {
|
|
55
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
56
|
+
const queryKey = queryOptions?.queryKey ?? getReadPatronLicenseQueryKey(params);
|
|
57
|
+
const queryFn = ({ signal }) => readPatronLicense(params, {
|
|
58
|
+
signal,
|
|
59
|
+
...requestOptions
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
queryKey,
|
|
63
|
+
queryFn,
|
|
64
|
+
...queryOptions
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* @summary Read Patron License
|
|
69
|
+
*/
|
|
70
|
+
function useReadPatronLicense(params, options, queryClient) {
|
|
71
|
+
const queryOptions = getReadPatronLicenseQueryOptions(params, options);
|
|
72
|
+
const query = useQuery(queryOptions, queryClient);
|
|
73
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { getReadPatronLicenseQueryKey, getReadPatronLicenseQueryOptions, getReadPatronLicenseUrl, readPatronLicense, useReadPatronLicense };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=admin-licenses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-licenses.js","names":[],"sources":["../../src/react/admin-licenses/admin-licenses.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ReadPatronLicenseParams,\n StaffLicenseRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getReadPatronLicenseUrl = (params: ReadPatronLicenseParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/admin/nextory-licenses?${stringifiedParams}` : `/admin/nextory-licenses`\n}\n\n/**\n * Report one account's licence state. Never allocates, never repairs.\n *\n * Scoped like every other staff read: an agent who cannot see the account gets\n * ``404``, the same answer as for an address nobody holds, so the endpoint\n * cannot be used to test whether a member exists elsewhere.\n *\n * ``partner_active`` is ``None`` when the partner could not be reached. That is\n * deliberately distinct from ``False`` — \"we could not ask\" and \"they said the\n * subscription is closed\" lead a support agent to different actions, and\n * collapsing them is how a working account gets re-provisioned.\n * @summary Read Patron License\n */\nexport const readPatronLicense = async (params: ReadPatronLicenseParams, options?: Parameters<typeof request>[1]): Promise<StaffLicenseRead> => {\n\n return request<StaffLicenseRead>(getReadPatronLicenseUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPatronLicenseQueryKey = (params?: ReadPatronLicenseParams,) => {\n return [\n `/admin/nextory-licenses`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getReadPatronLicenseQueryOptions = <TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPatronLicenseQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPatronLicense>>> = ({ signal }) => readPatronLicense(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPatronLicenseQueryResult = NonNullable<Awaited<ReturnType<typeof readPatronLicense>>>\nexport type ReadPatronLicenseQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatronLicense>>,\n TError,\n Awaited<ReturnType<typeof readPatronLicense>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatronLicense>>,\n TError,\n Awaited<ReturnType<typeof readPatronLicense>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Patron License\n */\n\nexport function useReadPatronLicense<TData = Awaited<ReturnType<typeof readPatronLicense>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: ReadPatronLicenseParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatronLicense>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPatronLicenseQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\n"],"mappings":";;;;;;;;;;;AAqCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,2BAA2B,WAAqC;CAC3E,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,2BAA2B,sBAAsB;AACzF;;;;;;;;;;;;;;AAeA,MAAa,oBAAoB,OAAO,QAAiC,YAAuE;CAE9I,OAAO,QAA0B,wBAAwB,MAAM,GAC/D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC,WAAsC;CAC/E,OAAO,CACP,2BAA2B,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CACpD;AACA;AAGJ,MAAa,oCAAgK,QAAiC,YACzM;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,6BAA6B,MAAM;CAI7E,MAAM,WAAyE,EAAE,aAAa,kBAAkB,QAAQ;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMtJ,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,qBACf,QAAiC,SAC/B,aACiF;CAElF,MAAM,eAAe,iCAAiC,QAAO,OAAO;CAEpE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
import { Ft as PatronDetailRead, Gn as HTTPExceptionResponse, Mt as PatronUpdateWrite, Nt as PatronPage, pn as ListPatronsParams, t as ValidationErrorResponse } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/admin-patrons/admin-patrons.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getListPatronsUrl: (params?: ListPatronsParams) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Patrons of the libraries this caller administers.
|
|
10
|
+
*
|
|
11
|
+
* ``q`` matches login, name and email with a prefix-friendly ``ILIKE``.
|
|
12
|
+
* Deliberately not a full-text search: an operator looking somebody up has a
|
|
13
|
+
* surname or a card number, and ranking would only make the exact match harder
|
|
14
|
+
* to find.
|
|
15
|
+
* @summary List Patrons
|
|
16
|
+
*/
|
|
17
|
+
export declare const listPatrons: (params?: ListPatronsParams, options?: Parameters<typeof request>[1]) => Promise<PatronPage>;
|
|
18
|
+
export declare const getListPatronsQueryKey: (params?: ListPatronsParams) => readonly ["/admin/patrons", ...ListPatronsParams[]];
|
|
19
|
+
export declare const getListPatronsQueryOptions: <TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListPatronsParams, options?: {
|
|
20
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>;
|
|
21
|
+
request?: SecondParameter<typeof request>;
|
|
22
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData> & {
|
|
23
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
24
|
+
};
|
|
25
|
+
export type ListPatronsQueryResult = NonNullable<Awaited<ReturnType<typeof listPatrons>>>;
|
|
26
|
+
export type ListPatronsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
27
|
+
export declare function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | ListPatronsParams, options: {
|
|
28
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listPatrons>>, TError, Awaited<ReturnType<typeof listPatrons>>>, 'initialData'>;
|
|
29
|
+
request?: SecondParameter<typeof request>;
|
|
30
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
31
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
32
|
+
};
|
|
33
|
+
export declare function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListPatronsParams, options?: {
|
|
34
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listPatrons>>, TError, Awaited<ReturnType<typeof listPatrons>>>, 'initialData'>;
|
|
35
|
+
request?: SecondParameter<typeof request>;
|
|
36
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
37
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
38
|
+
};
|
|
39
|
+
export declare function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListPatronsParams, options?: {
|
|
40
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>;
|
|
41
|
+
request?: SecondParameter<typeof request>;
|
|
42
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
43
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
44
|
+
};
|
|
45
|
+
export declare const getReadPatronUrl: (patronId: number) => string;
|
|
46
|
+
/**
|
|
47
|
+
* One patron, including the email the listing withholds.
|
|
48
|
+
* @summary Read Patron
|
|
49
|
+
*/
|
|
50
|
+
export declare const readPatron: (patronId: number, options?: Parameters<typeof request>[1]) => Promise<PatronDetailRead>;
|
|
51
|
+
export declare const getReadPatronQueryKey: (patronId: number) => readonly [`/admin/patrons/${number}`];
|
|
52
|
+
export declare const getReadPatronQueryOptions: <TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options?: {
|
|
53
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>;
|
|
54
|
+
request?: SecondParameter<typeof request>;
|
|
55
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData> & {
|
|
56
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
57
|
+
};
|
|
58
|
+
export type ReadPatronQueryResult = NonNullable<Awaited<ReturnType<typeof readPatron>>>;
|
|
59
|
+
export type ReadPatronQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
60
|
+
export declare function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options: {
|
|
61
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readPatron>>, TError, Awaited<ReturnType<typeof readPatron>>>, 'initialData'>;
|
|
62
|
+
request?: SecondParameter<typeof request>;
|
|
63
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
64
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
65
|
+
};
|
|
66
|
+
export declare function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options?: {
|
|
67
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readPatron>>, TError, Awaited<ReturnType<typeof readPatron>>>, 'initialData'>;
|
|
68
|
+
request?: SecondParameter<typeof request>;
|
|
69
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
70
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
71
|
+
};
|
|
72
|
+
export declare function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options?: {
|
|
73
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>;
|
|
74
|
+
request?: SecondParameter<typeof request>;
|
|
75
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
76
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
77
|
+
};
|
|
78
|
+
export declare const getUpdatePatronUrl: (patronId: number) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Change what staff may change about a patron.
|
|
81
|
+
*
|
|
82
|
+
* Audited, because these are the changes somebody may have to account for:
|
|
83
|
+
* suspending an account, raising an access level, extending a subscription past
|
|
84
|
+
* what was paid for. The legacy records none of them.
|
|
85
|
+
*
|
|
86
|
+
* Nothing here can move a patron between tenants — see
|
|
87
|
+
* :class:`~app.datamodels.admin.patrons.PatronUpdateWrite`.
|
|
88
|
+
* @summary Update Patron
|
|
89
|
+
*/
|
|
90
|
+
export declare const updatePatron: (patronId: number, patronUpdateWrite: PatronUpdateWrite, options?: Parameters<typeof request>[1]) => Promise<PatronDetailRead>;
|
|
91
|
+
export declare const getUpdatePatronMutationKey: () => readonly ['updatePatron'];
|
|
92
|
+
export declare const getUpdatePatronMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
93
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError, UpdatePatronMutationVariables, TContext>;
|
|
94
|
+
request?: SecondParameter<typeof request>;
|
|
95
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError, UpdatePatronMutationVariables, TContext>;
|
|
96
|
+
export type UpdatePatronMutationResult = NonNullable<Awaited<ReturnType<typeof updatePatron>>>;
|
|
97
|
+
export type UpdatePatronMutationBody = BodyType<PatronUpdateWrite>;
|
|
98
|
+
export type UpdatePatronMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
99
|
+
export type UpdatePatronMutationVariables = {
|
|
100
|
+
patronId: number;
|
|
101
|
+
data: BodyType<PatronUpdateWrite>;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @summary Update Patron
|
|
105
|
+
*/
|
|
106
|
+
export declare const useUpdatePatron: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
107
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError, UpdatePatronMutationVariables, TContext>;
|
|
108
|
+
request?: SecondParameter<typeof request>;
|
|
109
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof updatePatron>>, TError, UpdatePatronMutationVariables, TContext>;
|
|
110
|
+
//#endregion
|
|
111
|
+
//# sourceMappingURL=admin-patrons.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/admin-patrons/admin-patrons.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getListPatronsUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
+
});
|
|
29
|
+
const stringifiedParams = normalizedParams.toString();
|
|
30
|
+
return stringifiedParams.length > 0 ? `/admin/patrons?${stringifiedParams}` : `/admin/patrons`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Patrons of the libraries this caller administers.
|
|
34
|
+
*
|
|
35
|
+
* ``q`` matches login, name and email with a prefix-friendly ``ILIKE``.
|
|
36
|
+
* Deliberately not a full-text search: an operator looking somebody up has a
|
|
37
|
+
* surname or a card number, and ranking would only make the exact match harder
|
|
38
|
+
* to find.
|
|
39
|
+
* @summary List Patrons
|
|
40
|
+
*/
|
|
41
|
+
const listPatrons = async (params, options) => {
|
|
42
|
+
return request(getListPatronsUrl(params), {
|
|
43
|
+
...options,
|
|
44
|
+
method: "GET"
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const getListPatronsQueryKey = (params) => {
|
|
48
|
+
return [`/admin/patrons`, ...params ? [params] : []];
|
|
49
|
+
};
|
|
50
|
+
const getListPatronsQueryOptions = (params, options) => {
|
|
51
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
52
|
+
const queryKey = queryOptions?.queryKey ?? getListPatronsQueryKey(params);
|
|
53
|
+
const queryFn = ({ signal }) => listPatrons(params, {
|
|
54
|
+
signal,
|
|
55
|
+
...requestOptions
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
queryKey,
|
|
59
|
+
queryFn,
|
|
60
|
+
...queryOptions
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @summary List Patrons
|
|
65
|
+
*/
|
|
66
|
+
function useListPatrons(params, options, queryClient) {
|
|
67
|
+
const queryOptions = getListPatronsQueryOptions(params, options);
|
|
68
|
+
const query = useQuery(queryOptions, queryClient);
|
|
69
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
70
|
+
}
|
|
71
|
+
const getReadPatronUrl = (patronId) => {
|
|
72
|
+
return `/admin/patrons/${patronId}`;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* One patron, including the email the listing withholds.
|
|
76
|
+
* @summary Read Patron
|
|
77
|
+
*/
|
|
78
|
+
const readPatron = async (patronId, options) => {
|
|
79
|
+
return request(getReadPatronUrl(patronId), {
|
|
80
|
+
...options,
|
|
81
|
+
method: "GET"
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const getReadPatronQueryKey = (patronId) => {
|
|
85
|
+
return [`/admin/patrons/${patronId}`];
|
|
86
|
+
};
|
|
87
|
+
const getReadPatronQueryOptions = (patronId, options) => {
|
|
88
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
89
|
+
const queryKey = queryOptions?.queryKey ?? getReadPatronQueryKey(patronId);
|
|
90
|
+
const queryFn = ({ signal }) => readPatron(patronId, {
|
|
91
|
+
signal,
|
|
92
|
+
...requestOptions
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
queryKey,
|
|
96
|
+
queryFn,
|
|
97
|
+
enabled: patronId !== null && patronId !== void 0,
|
|
98
|
+
...queryOptions
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* @summary Read Patron
|
|
103
|
+
*/
|
|
104
|
+
function useReadPatron(patronId, options, queryClient) {
|
|
105
|
+
const queryOptions = getReadPatronQueryOptions(patronId, options);
|
|
106
|
+
const query = useQuery(queryOptions, queryClient);
|
|
107
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
108
|
+
}
|
|
109
|
+
const getUpdatePatronUrl = (patronId) => {
|
|
110
|
+
return `/admin/patrons/${patronId}`;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Change what staff may change about a patron.
|
|
114
|
+
*
|
|
115
|
+
* Audited, because these are the changes somebody may have to account for:
|
|
116
|
+
* suspending an account, raising an access level, extending a subscription past
|
|
117
|
+
* what was paid for. The legacy records none of them.
|
|
118
|
+
*
|
|
119
|
+
* Nothing here can move a patron between tenants — see
|
|
120
|
+
* :class:`~app.datamodels.admin.patrons.PatronUpdateWrite`.
|
|
121
|
+
* @summary Update Patron
|
|
122
|
+
*/
|
|
123
|
+
const updatePatron = async (patronId, patronUpdateWrite, options) => {
|
|
124
|
+
const getHeaders = (h) => {
|
|
125
|
+
if (!h) return {};
|
|
126
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
127
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
128
|
+
const headers = {};
|
|
129
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
130
|
+
return headers;
|
|
131
|
+
};
|
|
132
|
+
return request(getUpdatePatronUrl(patronId), {
|
|
133
|
+
...options,
|
|
134
|
+
method: "PATCH",
|
|
135
|
+
headers: {
|
|
136
|
+
"Content-Type": "application/json",
|
|
137
|
+
...getHeaders(options?.headers)
|
|
138
|
+
},
|
|
139
|
+
body: JSON.stringify(patronUpdateWrite)
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
const getUpdatePatronMutationKey = () => ["updatePatron"];
|
|
143
|
+
const getUpdatePatronMutationOptions = (options) => {
|
|
144
|
+
const mutationKey = getUpdatePatronMutationKey();
|
|
145
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
146
|
+
...options,
|
|
147
|
+
mutation: {
|
|
148
|
+
...options.mutation,
|
|
149
|
+
mutationKey
|
|
150
|
+
}
|
|
151
|
+
} : {
|
|
152
|
+
mutation: { mutationKey },
|
|
153
|
+
request: void 0
|
|
154
|
+
};
|
|
155
|
+
const mutationFn = (props) => {
|
|
156
|
+
const { patronId, data } = props ?? {};
|
|
157
|
+
return updatePatron(patronId, data, requestOptions);
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
mutationFn,
|
|
161
|
+
...mutationOptions
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* @summary Update Patron
|
|
166
|
+
*/
|
|
167
|
+
const useUpdatePatron = (options, queryClient) => {
|
|
168
|
+
return useMutation(getUpdatePatronMutationOptions(options), queryClient);
|
|
169
|
+
};
|
|
170
|
+
//#endregion
|
|
171
|
+
export { getListPatronsQueryKey, getListPatronsQueryOptions, getListPatronsUrl, getReadPatronQueryKey, getReadPatronQueryOptions, getReadPatronUrl, getUpdatePatronMutationKey, getUpdatePatronMutationOptions, getUpdatePatronUrl, listPatrons, readPatron, updatePatron, useListPatrons, useReadPatron, useUpdatePatron };
|
|
172
|
+
|
|
173
|
+
//# sourceMappingURL=admin-patrons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-patrons.js","names":[],"sources":["../../src/react/admin-patrons/admin-patrons.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ListPatronsParams,\n PatronDetailRead,\n PatronPage,\n PatronUpdateWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListPatronsUrl = (params?: ListPatronsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/admin/patrons?${stringifiedParams}` : `/admin/patrons`\n}\n\n/**\n * Patrons of the libraries this caller administers.\n *\n * ``q`` matches login, name and email with a prefix-friendly ``ILIKE``.\n * Deliberately not a full-text search: an operator looking somebody up has a\n * surname or a card number, and ranking would only make the exact match harder\n * to find.\n * @summary List Patrons\n */\nexport const listPatrons = async (params?: ListPatronsParams, options?: Parameters<typeof request>[1]): Promise<PatronPage> => {\n\n return request<PatronPage>(getListPatronsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListPatronsQueryKey = (params?: ListPatronsParams,) => {\n return [\n `/admin/patrons`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListPatronsQueryOptions = <TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListPatronsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listPatrons>>> = ({ signal }) => listPatrons(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListPatronsQueryResult = NonNullable<Awaited<ReturnType<typeof listPatrons>>>\nexport type ListPatronsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListPatronsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPatrons>>,\n TError,\n Awaited<ReturnType<typeof listPatrons>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listPatrons>>,\n TError,\n Awaited<ReturnType<typeof listPatrons>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Patrons\n */\n\nexport function useListPatrons<TData = Awaited<ReturnType<typeof listPatrons>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListPatronsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listPatrons>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListPatronsQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getReadPatronUrl = (patronId: number,) => {\n\n\n\n\n return `/admin/patrons/${patronId}`\n}\n\n/**\n * One patron, including the email the listing withholds.\n * @summary Read Patron\n */\nexport const readPatron = async (patronId: number, options?: Parameters<typeof request>[1]): Promise<PatronDetailRead> => {\n\n return request<PatronDetailRead>(getReadPatronUrl(patronId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getReadPatronQueryKey = (patronId: number,) => {\n return [\n `/admin/patrons/${patronId}`\n ] as const;\n }\n\n\nexport const getReadPatronQueryOptions = <TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getReadPatronQueryKey(patronId);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof readPatron>>> = ({ signal }) => readPatron(patronId, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, enabled: patronId !== null && patronId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ReadPatronQueryResult = NonNullable<Awaited<ReturnType<typeof readPatron>>>\nexport type ReadPatronQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatron>>,\n TError,\n Awaited<ReturnType<typeof readPatron>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof readPatron>>,\n TError,\n Awaited<ReturnType<typeof readPatron>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Read Patron\n */\n\nexport function useReadPatron<TData = Awaited<ReturnType<typeof readPatron>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n patronId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof readPatron>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getReadPatronQueryOptions(patronId,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getUpdatePatronUrl = (patronId: number,) => {\n\n\n\n\n return `/admin/patrons/${patronId}`\n}\n\n/**\n * Change what staff may change about a patron.\n *\n * Audited, because these are the changes somebody may have to account for:\n * suspending an account, raising an access level, extending a subscription past\n * what was paid for. The legacy records none of them.\n *\n * Nothing here can move a patron between tenants — see\n * :class:`~app.datamodels.admin.patrons.PatronUpdateWrite`.\n * @summary Update Patron\n */\nexport const updatePatron = async (patronId: number,\n patronUpdateWrite: PatronUpdateWrite, options?: Parameters<typeof request>[1]): Promise<PatronDetailRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<PatronDetailRead>(getUpdatePatronUrl(patronId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(patronUpdateWrite)\n }\n);}\n\n\n\n\n\nexport const getUpdatePatronMutationKey = () => ['updatePatron'] as const;\n\nexport const getUpdatePatronMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext> => {\n\nconst mutationKey = getUpdatePatronMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof updatePatron>>, UpdatePatronMutationVariables> = (props) => {\n const {patronId,data} = props ?? {};\n\n return updatePatron(patronId,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type UpdatePatronMutationResult = NonNullable<Awaited<ReturnType<typeof updatePatron>>>\n export type UpdatePatronMutationBody = BodyType<PatronUpdateWrite>\n export type UpdatePatronMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type UpdatePatronMutationVariables = {patronId: number;data: BodyType<PatronUpdateWrite>}\n\n /**\n * @summary Update Patron\n */\nexport const useUpdatePatron = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updatePatron>>, TError,UpdatePatronMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof updatePatron>>,\n TError,\n UpdatePatronMutationVariables,\n TContext\n > => {\n return useMutation(getUpdatePatronMutationOptions(options), queryClient);\n }\n"],"mappings":"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"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
import { Gn as HTTPExceptionResponse, J as ReviewModerationRead, Jt as ModerationWrite, cn as ListReviewsParams, q as ReviewPage, t as ValidationErrorResponse } from "../index-wL_20vR8.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../client-BDwBZYB0.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/admin-reviews/admin-reviews.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getListReviewsUrl: (params?: ListReviewsParams) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Reviews awaiting a decision, oldest first.
|
|
10
|
+
*
|
|
11
|
+
* Oldest first on purpose: a moderation queue sorted newest-first starves its
|
|
12
|
+
* tail, and the review that has waited longest is the one whose author is
|
|
13
|
+
* wondering what happened.
|
|
14
|
+
* @summary List Reviews
|
|
15
|
+
*/
|
|
16
|
+
export declare const listReviews: (params?: ListReviewsParams, options?: Parameters<typeof request>[1]) => Promise<ReviewPage>;
|
|
17
|
+
export declare const getListReviewsQueryKey: (params?: ListReviewsParams) => readonly ["/admin/reviews", ...ListReviewsParams[]];
|
|
18
|
+
export declare const getListReviewsQueryOptions: <TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListReviewsParams, options?: {
|
|
19
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>>;
|
|
20
|
+
request?: SecondParameter<typeof request>;
|
|
21
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData> & {
|
|
22
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
23
|
+
};
|
|
24
|
+
export type ListReviewsQueryResult = NonNullable<Awaited<ReturnType<typeof listReviews>>>;
|
|
25
|
+
export type ListReviewsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
26
|
+
export declare function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | ListReviewsParams, options: {
|
|
27
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listReviews>>, TError, Awaited<ReturnType<typeof listReviews>>>, 'initialData'>;
|
|
28
|
+
request?: SecondParameter<typeof request>;
|
|
29
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
30
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
31
|
+
};
|
|
32
|
+
export declare function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListReviewsParams, options?: {
|
|
33
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listReviews>>, TError, Awaited<ReturnType<typeof listReviews>>>, 'initialData'>;
|
|
34
|
+
request?: SecondParameter<typeof request>;
|
|
35
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
36
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
37
|
+
};
|
|
38
|
+
export declare function useListReviews<TData = Awaited<ReturnType<typeof listReviews>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListReviewsParams, options?: {
|
|
39
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listReviews>>, TError, TData>>;
|
|
40
|
+
request?: SecondParameter<typeof request>;
|
|
41
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
42
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
43
|
+
};
|
|
44
|
+
export declare const getModerateReviewUrl: (reviewId: number) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Publish or reject one review.
|
|
47
|
+
*
|
|
48
|
+
* ``PUT`` on a moderation sub-resource rather than ``POST /approve`` and
|
|
49
|
+
* ``POST /reject``: the outcome is a state the review is *in*, not two different
|
|
50
|
+
* events, and a repeated decision must be harmless.
|
|
51
|
+
*
|
|
52
|
+
* Rejecting requires a reason. The author is owed one, and the moderator is the
|
|
53
|
+
* only person who has it — the audit row is where it survives after the queue
|
|
54
|
+
* has moved on.
|
|
55
|
+
* @summary Moderate Review
|
|
56
|
+
*/
|
|
57
|
+
export declare const moderateReview: (reviewId: number, moderationWrite: ModerationWrite, options?: Parameters<typeof request>[1]) => Promise<ReviewModerationRead>;
|
|
58
|
+
export declare const getModerateReviewMutationKey: () => readonly ['moderateReview'];
|
|
59
|
+
export declare const getModerateReviewMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
60
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof moderateReview>>, TError, ModerateReviewMutationVariables, TContext>;
|
|
61
|
+
request?: SecondParameter<typeof request>;
|
|
62
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof moderateReview>>, TError, ModerateReviewMutationVariables, TContext>;
|
|
63
|
+
export type ModerateReviewMutationResult = NonNullable<Awaited<ReturnType<typeof moderateReview>>>;
|
|
64
|
+
export type ModerateReviewMutationBody = BodyType<ModerationWrite>;
|
|
65
|
+
export type ModerateReviewMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
66
|
+
export type ModerateReviewMutationVariables = {
|
|
67
|
+
reviewId: number;
|
|
68
|
+
data: BodyType<ModerationWrite>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* @summary Moderate Review
|
|
72
|
+
*/
|
|
73
|
+
export declare const useModerateReview: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
74
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof moderateReview>>, TError, ModerateReviewMutationVariables, TContext>;
|
|
75
|
+
request?: SecondParameter<typeof request>;
|
|
76
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof moderateReview>>, TError, ModerateReviewMutationVariables, TContext>;
|
|
77
|
+
//#endregion
|
|
78
|
+
//# sourceMappingURL=admin-reviews.d.ts.map
|