From cf2c9b90cba708ed7e5d367011b2d5a99c199b56 Mon Sep 17 00:00:00 2001 From: Darren Walker Date: Thu, 13 Jun 2024 16:51:47 +0100 Subject: [PATCH] update gui to match latest changes to api --- .../proposalCycle/availableResourcesTable.tsx | 8 +- .../src/generated/proposalToolComponents.ts | 831 +++++++++++++++--- 2 files changed, 733 insertions(+), 106 deletions(-) diff --git a/src/main/webui/src/ProposalManagerView/proposalCycle/availableResourcesTable.tsx b/src/main/webui/src/ProposalManagerView/proposalCycle/availableResourcesTable.tsx index 7206cbde..58751279 100644 --- a/src/main/webui/src/ProposalManagerView/proposalCycle/availableResourcesTable.tsx +++ b/src/main/webui/src/ProposalManagerView/proposalCycle/availableResourcesTable.tsx @@ -1,6 +1,8 @@ import {ReactElement} from "react"; import {Table} from "@mantine/core"; -import {useAvailableResourcesResourceGetCycleResources} from "../../generated/proposalToolComponents.ts"; +import { + useAvailableResourcesResourceGetCycleAvailableResources +} from "../../generated/proposalToolComponents.ts"; import {notifyError} from "../../commonPanel/notifications.tsx"; import getErrorMessage from "../../errorHandling/getErrorMessage.tsx"; @@ -11,7 +13,7 @@ import getErrorMessage from "../../errorHandling/getErrorMessage.tsx"; export default function AvailableResourcesTable(selectedCycleCode: number) : ReactElement { - const availableResources = useAvailableResourcesResourceGetCycleResources( + const availableResources = useAvailableResourcesResourceGetCycleAvailableResources( {pathParams: {cycleCode: selectedCycleCode}} ) @@ -38,7 +40,7 @@ export default function AvailableResourcesTable(selectedCycleCode: number) : Rea const AvailableResourcesTableBody = () : ReactElement => { return ( - {availableResources.data?.map((ar) =>( + {availableResources.data?.resources?.map((ar) =>( {ar.type?.name} {ar.type?.unit} diff --git a/src/main/webui/src/generated/proposalToolComponents.ts b/src/main/webui/src/generated/proposalToolComponents.ts index e89e984b..e46810d2 100644 --- a/src/main/webui/src/generated/proposalToolComponents.ts +++ b/src/main/webui/src/generated/proposalToolComponents.ts @@ -4127,6 +4127,81 @@ export const useAllocatedBlockResourceAddAllocatedBlock = ( }); }; +export type AllocatedBlockResourceGetAllocatedBlockPathParams = { + /** + * @format int64 + */ + allocatedId: number; + /** + * @format int64 + */ + blockId: number; + /** + * @format int64 + */ + cycleCode: number; +}; + +export type AllocatedBlockResourceGetAllocatedBlockError = + Fetcher.ErrorWrapper; + +export type AllocatedBlockResourceGetAllocatedBlockVariables = { + pathParams: AllocatedBlockResourceGetAllocatedBlockPathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchAllocatedBlockResourceGetAllocatedBlock = ( + variables: AllocatedBlockResourceGetAllocatedBlockVariables, + signal?: AbortSignal +) => + proposalToolFetch< + Schemas.AllocatedBlock, + AllocatedBlockResourceGetAllocatedBlockError, + undefined, + {}, + {}, + AllocatedBlockResourceGetAllocatedBlockPathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/allocatedProposals/{allocatedId}/allocatedBlock/{blockId}", + method: "get", + ...variables, + signal, + }); + +export const useAllocatedBlockResourceGetAllocatedBlock = < + TData = Schemas.AllocatedBlock +>( + variables: AllocatedBlockResourceGetAllocatedBlockVariables, + options?: Omit< + reactQuery.UseQueryOptions< + Schemas.AllocatedBlock, + AllocatedBlockResourceGetAllocatedBlockError, + TData + >, + "queryKey" | "queryFn" | "initialData" + > +) => { + const { fetcherOptions, queryOptions, queryKeyFn } = + useProposalToolContext(options); + return reactQuery.useQuery< + Schemas.AllocatedBlock, + AllocatedBlockResourceGetAllocatedBlockError, + TData + >({ + queryKey: queryKeyFn({ + path: "/pst/api/proposalCycles/{cycleCode}/allocatedProposals/{allocatedId}/allocatedBlock/{blockId}", + operationId: "allocatedBlockResourceGetAllocatedBlock", + variables, + }), + queryFn: ({ signal }) => + fetchAllocatedBlockResourceGetAllocatedBlock( + { ...fetcherOptions, ...variables }, + signal + ), + ...options, + ...queryOptions, + }); +}; + export type AllocatedBlockResourceRemoveAllocatedBlockPathParams = { /** * @format int64 @@ -4194,6 +4269,203 @@ export const useAllocatedBlockResourceRemoveAllocatedBlock = ( }); }; +export type AllocatedBlockResourceUpdateGradePathParams = { + /** + * @format int64 + */ + allocatedId: number; + /** + * @format int64 + */ + blockId: number; + /** + * @format int64 + */ + cycleCode: number; +}; + +export type AllocatedBlockResourceUpdateGradeError = + Fetcher.ErrorWrapper; + +export type AllocatedBlockResourceUpdateGradeVariables = { + pathParams: AllocatedBlockResourceUpdateGradePathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchAllocatedBlockResourceUpdateGrade = ( + variables: AllocatedBlockResourceUpdateGradeVariables, + signal?: AbortSignal +) => + proposalToolFetch< + undefined, + AllocatedBlockResourceUpdateGradeError, + undefined, + {}, + {}, + AllocatedBlockResourceUpdateGradePathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/allocatedProposals/{allocatedId}/allocatedBlock/{blockId}/grade", + method: "put", + ...variables, + signal, + }); + +export const useAllocatedBlockResourceUpdateGrade = ( + options?: Omit< + reactQuery.UseMutationOptions< + undefined, + AllocatedBlockResourceUpdateGradeError, + AllocatedBlockResourceUpdateGradeVariables + >, + "mutationFn" + > +) => { + const { fetcherOptions } = useProposalToolContext(); + return reactQuery.useMutation< + undefined, + AllocatedBlockResourceUpdateGradeError, + AllocatedBlockResourceUpdateGradeVariables + >({ + mutationFn: (variables: AllocatedBlockResourceUpdateGradeVariables) => + fetchAllocatedBlockResourceUpdateGrade({ + ...fetcherOptions, + ...variables, + }), + ...options, + }); +}; + +export type AllocatedBlockResourceChangeObservingModePathParams = { + /** + * @format int64 + */ + allocatedId: number; + /** + * @format int64 + */ + blockId: number; + /** + * @format int64 + */ + cycleCode: number; +}; + +export type AllocatedBlockResourceChangeObservingModeError = + Fetcher.ErrorWrapper; + +export type AllocatedBlockResourceChangeObservingModeVariables = { + pathParams: AllocatedBlockResourceChangeObservingModePathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchAllocatedBlockResourceChangeObservingMode = ( + variables: AllocatedBlockResourceChangeObservingModeVariables, + signal?: AbortSignal +) => + proposalToolFetch< + undefined, + AllocatedBlockResourceChangeObservingModeError, + undefined, + {}, + {}, + AllocatedBlockResourceChangeObservingModePathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/allocatedProposals/{allocatedId}/allocatedBlock/{blockId}/observingMode", + method: "put", + ...variables, + signal, + }); + +export const useAllocatedBlockResourceChangeObservingMode = ( + options?: Omit< + reactQuery.UseMutationOptions< + undefined, + AllocatedBlockResourceChangeObservingModeError, + AllocatedBlockResourceChangeObservingModeVariables + >, + "mutationFn" + > +) => { + const { fetcherOptions } = useProposalToolContext(); + return reactQuery.useMutation< + undefined, + AllocatedBlockResourceChangeObservingModeError, + AllocatedBlockResourceChangeObservingModeVariables + >({ + mutationFn: ( + variables: AllocatedBlockResourceChangeObservingModeVariables + ) => + fetchAllocatedBlockResourceChangeObservingMode({ + ...fetcherOptions, + ...variables, + }), + ...options, + }); +}; + +export type AllocatedBlockResourceUpdateResourcePathParams = { + /** + * @format int64 + */ + allocatedId: number; + /** + * @format int64 + */ + blockId: number; + /** + * @format int64 + */ + cycleCode: number; +}; + +export type AllocatedBlockResourceUpdateResourceError = + Fetcher.ErrorWrapper; + +export type AllocatedBlockResourceUpdateResourceVariables = { + pathParams: AllocatedBlockResourceUpdateResourcePathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchAllocatedBlockResourceUpdateResource = ( + variables: AllocatedBlockResourceUpdateResourceVariables, + signal?: AbortSignal +) => + proposalToolFetch< + undefined, + AllocatedBlockResourceUpdateResourceError, + undefined, + {}, + {}, + AllocatedBlockResourceUpdateResourcePathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/allocatedProposals/{allocatedId}/allocatedBlock/{blockId}/resourceAmount", + method: "put", + ...variables, + signal, + }); + +export const useAllocatedBlockResourceUpdateResource = ( + options?: Omit< + reactQuery.UseMutationOptions< + undefined, + AllocatedBlockResourceUpdateResourceError, + AllocatedBlockResourceUpdateResourceVariables + >, + "mutationFn" + > +) => { + const { fetcherOptions } = useProposalToolContext(); + return reactQuery.useMutation< + undefined, + AllocatedBlockResourceUpdateResourceError, + AllocatedBlockResourceUpdateResourceVariables + >({ + mutationFn: (variables: AllocatedBlockResourceUpdateResourceVariables) => + fetchAllocatedBlockResourceUpdateResource({ + ...fetcherOptions, + ...variables, + }), + ...options, + }); +}; + export type AvailableResourcesResourceGetCycleAvailableResourcesPathParams = { /** * @format int64 @@ -4261,49 +4533,109 @@ export const useAvailableResourcesResourceGetCycleAvailableResources = < }); }; -export type AvailableResourcesResourceGetCycleResourcesPathParams = { +export type AvailableResourcesResourceAddCycleResourcePathParams = { /** * @format int64 */ cycleCode: number; }; -export type AvailableResourcesResourceGetCycleResourcesError = +export type AvailableResourcesResourceAddCycleResourceError = Fetcher.ErrorWrapper; -export type AvailableResourcesResourceGetCycleResourcesResponse = - Schemas.Resource[]; +export type AvailableResourcesResourceAddCycleResourceVariables = { + body?: Schemas.Resource; + pathParams: AvailableResourcesResourceAddCycleResourcePathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchAvailableResourcesResourceAddCycleResource = ( + variables: AvailableResourcesResourceAddCycleResourceVariables, + signal?: AbortSignal +) => + proposalToolFetch< + Schemas.Resource, + AvailableResourcesResourceAddCycleResourceError, + Schemas.Resource, + {}, + {}, + AvailableResourcesResourceAddCycleResourcePathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/availableResources", + method: "post", + ...variables, + signal, + }); + +export const useAvailableResourcesResourceAddCycleResource = ( + options?: Omit< + reactQuery.UseMutationOptions< + Schemas.Resource, + AvailableResourcesResourceAddCycleResourceError, + AvailableResourcesResourceAddCycleResourceVariables + >, + "mutationFn" + > +) => { + const { fetcherOptions } = useProposalToolContext(); + return reactQuery.useMutation< + Schemas.Resource, + AvailableResourcesResourceAddCycleResourceError, + AvailableResourcesResourceAddCycleResourceVariables + >({ + mutationFn: ( + variables: AvailableResourcesResourceAddCycleResourceVariables + ) => + fetchAvailableResourcesResourceAddCycleResource({ + ...fetcherOptions, + ...variables, + }), + ...options, + }); +}; -export type AvailableResourcesResourceGetCycleResourcesVariables = { - pathParams: AvailableResourcesResourceGetCycleResourcesPathParams; +export type AvailableResourcesResourceGetCycleResourceTypesPathParams = { + /** + * @format int64 + */ + cycleCode: number; +}; + +export type AvailableResourcesResourceGetCycleResourceTypesError = + Fetcher.ErrorWrapper; + +export type AvailableResourcesResourceGetCycleResourceTypesResponse = + Schemas.ObjectIdentifier[]; + +export type AvailableResourcesResourceGetCycleResourceTypesVariables = { + pathParams: AvailableResourcesResourceGetCycleResourceTypesPathParams; } & ProposalToolContext["fetcherOptions"]; -export const fetchAvailableResourcesResourceGetCycleResources = ( - variables: AvailableResourcesResourceGetCycleResourcesVariables, +export const fetchAvailableResourcesResourceGetCycleResourceTypes = ( + variables: AvailableResourcesResourceGetCycleResourceTypesVariables, signal?: AbortSignal ) => proposalToolFetch< - AvailableResourcesResourceGetCycleResourcesResponse, - AvailableResourcesResourceGetCycleResourcesError, + AvailableResourcesResourceGetCycleResourceTypesResponse, + AvailableResourcesResourceGetCycleResourceTypesError, undefined, {}, {}, - AvailableResourcesResourceGetCycleResourcesPathParams + AvailableResourcesResourceGetCycleResourceTypesPathParams >({ - url: "/pst/api/proposalCycles/{cycleCode}/availableResources/resources", + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/types", method: "get", ...variables, signal, }); -export const useAvailableResourcesResourceGetCycleResources = < - TData = AvailableResourcesResourceGetCycleResourcesResponse +export const useAvailableResourcesResourceGetCycleResourceTypes = < + TData = AvailableResourcesResourceGetCycleResourceTypesResponse >( - variables: AvailableResourcesResourceGetCycleResourcesVariables, + variables: AvailableResourcesResourceGetCycleResourceTypesVariables, options?: Omit< reactQuery.UseQueryOptions< - AvailableResourcesResourceGetCycleResourcesResponse, - AvailableResourcesResourceGetCycleResourcesError, + AvailableResourcesResourceGetCycleResourceTypesResponse, + AvailableResourcesResourceGetCycleResourceTypesError, TData >, "queryKey" | "queryFn" | "initialData" @@ -4312,17 +4644,17 @@ export const useAvailableResourcesResourceGetCycleResources = < const { fetcherOptions, queryOptions, queryKeyFn } = useProposalToolContext(options); return reactQuery.useQuery< - AvailableResourcesResourceGetCycleResourcesResponse, - AvailableResourcesResourceGetCycleResourcesError, + AvailableResourcesResourceGetCycleResourceTypesResponse, + AvailableResourcesResourceGetCycleResourceTypesError, TData >({ queryKey: queryKeyFn({ - path: "/pst/api/proposalCycles/{cycleCode}/availableResources/resources", - operationId: "availableResourcesResourceGetCycleResources", + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/types", + operationId: "availableResourcesResourceGetCycleResourceTypes", variables, }), queryFn: ({ signal }) => - fetchAvailableResourcesResourceGetCycleResources( + fetchAvailableResourcesResourceGetCycleResourceTypes( { ...fetcherOptions, ...variables }, signal ), @@ -4331,63 +4663,74 @@ export const useAvailableResourcesResourceGetCycleResources = < }); }; -export type AvailableResourcesResourceAddCycleResourcePathParams = { +export type AvailableResourcesResourceGetCycleResourceTypePathParams = { /** * @format int64 */ cycleCode: number; + /** + * @format int64 + */ + typeId: number; }; -export type AvailableResourcesResourceAddCycleResourceError = +export type AvailableResourcesResourceGetCycleResourceTypeError = Fetcher.ErrorWrapper; -export type AvailableResourcesResourceAddCycleResourceVariables = { - body?: Schemas.Resource; - pathParams: AvailableResourcesResourceAddCycleResourcePathParams; +export type AvailableResourcesResourceGetCycleResourceTypeVariables = { + pathParams: AvailableResourcesResourceGetCycleResourceTypePathParams; } & ProposalToolContext["fetcherOptions"]; -export const fetchAvailableResourcesResourceAddCycleResource = ( - variables: AvailableResourcesResourceAddCycleResourceVariables, +export const fetchAvailableResourcesResourceGetCycleResourceType = ( + variables: AvailableResourcesResourceGetCycleResourceTypeVariables, signal?: AbortSignal ) => proposalToolFetch< - Schemas.Resource, - AvailableResourcesResourceAddCycleResourceError, - Schemas.Resource, + Schemas.ResourceType, + AvailableResourcesResourceGetCycleResourceTypeError, + undefined, {}, {}, - AvailableResourcesResourceAddCycleResourcePathParams + AvailableResourcesResourceGetCycleResourceTypePathParams >({ - url: "/pst/api/proposalCycles/{cycleCode}/availableResources/resources", - method: "post", + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/types/{typeId}", + method: "get", ...variables, signal, }); -export const useAvailableResourcesResourceAddCycleResource = ( +export const useAvailableResourcesResourceGetCycleResourceType = < + TData = Schemas.ResourceType +>( + variables: AvailableResourcesResourceGetCycleResourceTypeVariables, options?: Omit< - reactQuery.UseMutationOptions< - Schemas.Resource, - AvailableResourcesResourceAddCycleResourceError, - AvailableResourcesResourceAddCycleResourceVariables + reactQuery.UseQueryOptions< + Schemas.ResourceType, + AvailableResourcesResourceGetCycleResourceTypeError, + TData >, - "mutationFn" + "queryKey" | "queryFn" | "initialData" > ) => { - const { fetcherOptions } = useProposalToolContext(); - return reactQuery.useMutation< - Schemas.Resource, - AvailableResourcesResourceAddCycleResourceError, - AvailableResourcesResourceAddCycleResourceVariables + const { fetcherOptions, queryOptions, queryKeyFn } = + useProposalToolContext(options); + return reactQuery.useQuery< + Schemas.ResourceType, + AvailableResourcesResourceGetCycleResourceTypeError, + TData >({ - mutationFn: ( - variables: AvailableResourcesResourceAddCycleResourceVariables - ) => - fetchAvailableResourcesResourceAddCycleResource({ - ...fetcherOptions, - ...variables, - }), + queryKey: queryKeyFn({ + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/types/{typeId}", + operationId: "availableResourcesResourceGetCycleResourceType", + variables, + }), + queryFn: ({ signal }) => + fetchAvailableResourcesResourceGetCycleResourceType( + { ...fetcherOptions, ...variables }, + signal + ), ...options, + ...queryOptions, }); }; @@ -4421,7 +4764,7 @@ export const fetchAvailableResourcesResourceRemoveCycleResource = ( {}, AvailableResourcesResourceRemoveCycleResourcePathParams >({ - url: "/pst/api/proposalCycles/{cycleCode}/availableResources/resources/{resourceId}", + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceId}", method: "delete", ...variables, signal, @@ -4484,7 +4827,7 @@ export const fetchAvailableResourcesResourceUpdateCycleResourceAmount = ( {}, AvailableResourcesResourceUpdateCycleResourceAmountPathParams >({ - url: "/pst/api/proposalCycles/{cycleCode}/availableResources/resources/{resourceId}/amount", + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceId}/amount", method: "put", ...variables, signal, @@ -4517,49 +4860,115 @@ export const useAvailableResourcesResourceUpdateCycleResourceAmount = ( }); }; -export type AvailableResourcesResourceGetCycleResourceTypesPathParams = { +export type AvailableResourcesResourceGetCycleAvailableResourcePathParams = { /** * @format int64 */ cycleCode: number; + resourceName: string; }; -export type AvailableResourcesResourceGetCycleResourceTypesError = +export type AvailableResourcesResourceGetCycleAvailableResourceError = Fetcher.ErrorWrapper; -export type AvailableResourcesResourceGetCycleResourceTypesResponse = - Schemas.ObjectIdentifier[]; +export type AvailableResourcesResourceGetCycleAvailableResourceVariables = { + pathParams: AvailableResourcesResourceGetCycleAvailableResourcePathParams; +} & ProposalToolContext["fetcherOptions"]; -export type AvailableResourcesResourceGetCycleResourceTypesVariables = { - pathParams: AvailableResourcesResourceGetCycleResourceTypesPathParams; +export const fetchAvailableResourcesResourceGetCycleAvailableResource = ( + variables: AvailableResourcesResourceGetCycleAvailableResourceVariables, + signal?: AbortSignal +) => + proposalToolFetch< + Schemas.Resource, + AvailableResourcesResourceGetCycleAvailableResourceError, + undefined, + {}, + {}, + AvailableResourcesResourceGetCycleAvailableResourcePathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}", + method: "get", + ...variables, + signal, + }); + +export const useAvailableResourcesResourceGetCycleAvailableResource = < + TData = Schemas.Resource +>( + variables: AvailableResourcesResourceGetCycleAvailableResourceVariables, + options?: Omit< + reactQuery.UseQueryOptions< + Schemas.Resource, + AvailableResourcesResourceGetCycleAvailableResourceError, + TData + >, + "queryKey" | "queryFn" | "initialData" + > +) => { + const { fetcherOptions, queryOptions, queryKeyFn } = + useProposalToolContext(options); + return reactQuery.useQuery< + Schemas.Resource, + AvailableResourcesResourceGetCycleAvailableResourceError, + TData + >({ + queryKey: queryKeyFn({ + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}", + operationId: "availableResourcesResourceGetCycleAvailableResource", + variables, + }), + queryFn: ({ signal }) => + fetchAvailableResourcesResourceGetCycleAvailableResource( + { ...fetcherOptions, ...variables }, + signal + ), + ...options, + ...queryOptions, + }); +}; + +export type AvailableResourcesResourceGetCycleResourceUsedPathParams = { + /** + * @format int64 + */ + cycleCode: number; + resourceName: string; +}; + +export type AvailableResourcesResourceGetCycleResourceUsedError = + Fetcher.ErrorWrapper; + +export type AvailableResourcesResourceGetCycleResourceUsedVariables = { + pathParams: AvailableResourcesResourceGetCycleResourceUsedPathParams; } & ProposalToolContext["fetcherOptions"]; -export const fetchAvailableResourcesResourceGetCycleResourceTypes = ( - variables: AvailableResourcesResourceGetCycleResourceTypesVariables, +export const fetchAvailableResourcesResourceGetCycleResourceUsed = ( + variables: AvailableResourcesResourceGetCycleResourceUsedVariables, signal?: AbortSignal ) => proposalToolFetch< - AvailableResourcesResourceGetCycleResourceTypesResponse, - AvailableResourcesResourceGetCycleResourceTypesError, + number, + AvailableResourcesResourceGetCycleResourceUsedError, undefined, {}, {}, - AvailableResourcesResourceGetCycleResourceTypesPathParams + AvailableResourcesResourceGetCycleResourceUsedPathParams >({ - url: "/pst/api/proposalCycles/{cycleCode}/availableResources/types", + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/allocated", method: "get", ...variables, signal, }); -export const useAvailableResourcesResourceGetCycleResourceTypes = < - TData = AvailableResourcesResourceGetCycleResourceTypesResponse +export const useAvailableResourcesResourceGetCycleResourceUsed = < + TData = number >( - variables: AvailableResourcesResourceGetCycleResourceTypesVariables, + variables: AvailableResourcesResourceGetCycleResourceUsedVariables, options?: Omit< reactQuery.UseQueryOptions< - AvailableResourcesResourceGetCycleResourceTypesResponse, - AvailableResourcesResourceGetCycleResourceTypesError, + number, + AvailableResourcesResourceGetCycleResourceUsedError, TData >, "queryKey" | "queryFn" | "initialData" @@ -4568,17 +4977,17 @@ export const useAvailableResourcesResourceGetCycleResourceTypes = < const { fetcherOptions, queryOptions, queryKeyFn } = useProposalToolContext(options); return reactQuery.useQuery< - AvailableResourcesResourceGetCycleResourceTypesResponse, - AvailableResourcesResourceGetCycleResourceTypesError, + number, + AvailableResourcesResourceGetCycleResourceUsedError, TData >({ queryKey: queryKeyFn({ - path: "/pst/api/proposalCycles/{cycleCode}/availableResources/types", - operationId: "availableResourcesResourceGetCycleResourceTypes", + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/allocated", + operationId: "availableResourcesResourceGetCycleResourceUsed", variables, }), queryFn: ({ signal }) => - fetchAvailableResourcesResourceGetCycleResourceTypes( + fetchAvailableResourcesResourceGetCycleResourceUsed( { ...fetcherOptions, ...variables }, signal ), @@ -4587,50 +4996,115 @@ export const useAvailableResourcesResourceGetCycleResourceTypes = < }); }; -export type AvailableResourcesResourceGetCycleResourceTypePathParams = { +export type AvailableResourcesResourceGetCycleResourceRemainingPathParams = { /** * @format int64 */ cycleCode: number; + resourceName: string; +}; + +export type AvailableResourcesResourceGetCycleResourceRemainingError = + Fetcher.ErrorWrapper; + +export type AvailableResourcesResourceGetCycleResourceRemainingVariables = { + pathParams: AvailableResourcesResourceGetCycleResourceRemainingPathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchAvailableResourcesResourceGetCycleResourceRemaining = ( + variables: AvailableResourcesResourceGetCycleResourceRemainingVariables, + signal?: AbortSignal +) => + proposalToolFetch< + number, + AvailableResourcesResourceGetCycleResourceRemainingError, + undefined, + {}, + {}, + AvailableResourcesResourceGetCycleResourceRemainingPathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/remaining", + method: "get", + ...variables, + signal, + }); + +export const useAvailableResourcesResourceGetCycleResourceRemaining = < + TData = number +>( + variables: AvailableResourcesResourceGetCycleResourceRemainingVariables, + options?: Omit< + reactQuery.UseQueryOptions< + number, + AvailableResourcesResourceGetCycleResourceRemainingError, + TData + >, + "queryKey" | "queryFn" | "initialData" + > +) => { + const { fetcherOptions, queryOptions, queryKeyFn } = + useProposalToolContext(options); + return reactQuery.useQuery< + number, + AvailableResourcesResourceGetCycleResourceRemainingError, + TData + >({ + queryKey: queryKeyFn({ + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/remaining", + operationId: "availableResourcesResourceGetCycleResourceRemaining", + variables, + }), + queryFn: ({ signal }) => + fetchAvailableResourcesResourceGetCycleResourceRemaining( + { ...fetcherOptions, ...variables }, + signal + ), + ...options, + ...queryOptions, + }); +}; + +export type AvailableResourcesResourceGetCycleResourceTotalPathParams = { /** * @format int64 */ - typeId: number; + cycleCode: number; + resourceName: string; }; -export type AvailableResourcesResourceGetCycleResourceTypeError = +export type AvailableResourcesResourceGetCycleResourceTotalError = Fetcher.ErrorWrapper; -export type AvailableResourcesResourceGetCycleResourceTypeVariables = { - pathParams: AvailableResourcesResourceGetCycleResourceTypePathParams; +export type AvailableResourcesResourceGetCycleResourceTotalVariables = { + pathParams: AvailableResourcesResourceGetCycleResourceTotalPathParams; } & ProposalToolContext["fetcherOptions"]; -export const fetchAvailableResourcesResourceGetCycleResourceType = ( - variables: AvailableResourcesResourceGetCycleResourceTypeVariables, +export const fetchAvailableResourcesResourceGetCycleResourceTotal = ( + variables: AvailableResourcesResourceGetCycleResourceTotalVariables, signal?: AbortSignal ) => proposalToolFetch< - Schemas.ResourceType, - AvailableResourcesResourceGetCycleResourceTypeError, + number, + AvailableResourcesResourceGetCycleResourceTotalError, undefined, {}, {}, - AvailableResourcesResourceGetCycleResourceTypePathParams + AvailableResourcesResourceGetCycleResourceTotalPathParams >({ - url: "/pst/api/proposalCycles/{cycleCode}/availableResources/types/{typeId}", + url: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/total", method: "get", ...variables, signal, }); -export const useAvailableResourcesResourceGetCycleResourceType = < - TData = Schemas.ResourceType +export const useAvailableResourcesResourceGetCycleResourceTotal = < + TData = number >( - variables: AvailableResourcesResourceGetCycleResourceTypeVariables, + variables: AvailableResourcesResourceGetCycleResourceTotalVariables, options?: Omit< reactQuery.UseQueryOptions< - Schemas.ResourceType, - AvailableResourcesResourceGetCycleResourceTypeError, + number, + AvailableResourcesResourceGetCycleResourceTotalError, TData >, "queryKey" | "queryFn" | "initialData" @@ -4639,17 +5113,17 @@ export const useAvailableResourcesResourceGetCycleResourceType = < const { fetcherOptions, queryOptions, queryKeyFn } = useProposalToolContext(options); return reactQuery.useQuery< - Schemas.ResourceType, - AvailableResourcesResourceGetCycleResourceTypeError, + number, + AvailableResourcesResourceGetCycleResourceTotalError, TData >({ queryKey: queryKeyFn({ - path: "/pst/api/proposalCycles/{cycleCode}/availableResources/types/{typeId}", - operationId: "availableResourcesResourceGetCycleResourceType", + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/total", + operationId: "availableResourcesResourceGetCycleResourceTotal", variables, }), queryFn: ({ signal }) => - fetchAvailableResourcesResourceGetCycleResourceType( + fetchAvailableResourcesResourceGetCycleResourceTotal( { ...fetcherOptions, ...variables }, signal ), @@ -5298,6 +5772,132 @@ export const useProposalCyclesResourceReplaceCycleAllocationGradeName = ( }); }; +export type ProposalCyclesResourceGetProposalCycleObservatoryPathParams = { + /** + * @format int64 + */ + cycleCode: number; +}; + +export type ProposalCyclesResourceGetProposalCycleObservatoryError = + Fetcher.ErrorWrapper; + +export type ProposalCyclesResourceGetProposalCycleObservatoryVariables = { + pathParams: ProposalCyclesResourceGetProposalCycleObservatoryPathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchProposalCyclesResourceGetProposalCycleObservatory = ( + variables: ProposalCyclesResourceGetProposalCycleObservatoryVariables, + signal?: AbortSignal +) => + proposalToolFetch< + Schemas.Observatory, + ProposalCyclesResourceGetProposalCycleObservatoryError, + undefined, + {}, + {}, + ProposalCyclesResourceGetProposalCycleObservatoryPathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/observatory", + method: "get", + ...variables, + signal, + }); + +export const useProposalCyclesResourceGetProposalCycleObservatory = < + TData = Schemas.Observatory +>( + variables: ProposalCyclesResourceGetProposalCycleObservatoryVariables, + options?: Omit< + reactQuery.UseQueryOptions< + Schemas.Observatory, + ProposalCyclesResourceGetProposalCycleObservatoryError, + TData + >, + "queryKey" | "queryFn" | "initialData" + > +) => { + const { fetcherOptions, queryOptions, queryKeyFn } = + useProposalToolContext(options); + return reactQuery.useQuery< + Schemas.Observatory, + ProposalCyclesResourceGetProposalCycleObservatoryError, + TData + >({ + queryKey: queryKeyFn({ + path: "/pst/api/proposalCycles/{cycleCode}/observatory", + operationId: "proposalCyclesResourceGetProposalCycleObservatory", + variables, + }), + queryFn: ({ signal }) => + fetchProposalCyclesResourceGetProposalCycleObservatory( + { ...fetcherOptions, ...variables }, + signal + ), + ...options, + ...queryOptions, + }); +}; + +export type ProposalCyclesResourceReplaceCycleObservatoryPathParams = { + /** + * @format int64 + */ + cycleCode: number; +}; + +export type ProposalCyclesResourceReplaceCycleObservatoryError = + Fetcher.ErrorWrapper; + +export type ProposalCyclesResourceReplaceCycleObservatoryVariables = { + pathParams: ProposalCyclesResourceReplaceCycleObservatoryPathParams; +} & ProposalToolContext["fetcherOptions"]; + +export const fetchProposalCyclesResourceReplaceCycleObservatory = ( + variables: ProposalCyclesResourceReplaceCycleObservatoryVariables, + signal?: AbortSignal +) => + proposalToolFetch< + undefined, + ProposalCyclesResourceReplaceCycleObservatoryError, + undefined, + {}, + {}, + ProposalCyclesResourceReplaceCycleObservatoryPathParams + >({ + url: "/pst/api/proposalCycles/{cycleCode}/observatory", + method: "put", + ...variables, + signal, + }); + +export const useProposalCyclesResourceReplaceCycleObservatory = ( + options?: Omit< + reactQuery.UseMutationOptions< + undefined, + ProposalCyclesResourceReplaceCycleObservatoryError, + ProposalCyclesResourceReplaceCycleObservatoryVariables + >, + "mutationFn" + > +) => { + const { fetcherOptions } = useProposalToolContext(); + return reactQuery.useMutation< + undefined, + ProposalCyclesResourceReplaceCycleObservatoryError, + ProposalCyclesResourceReplaceCycleObservatoryVariables + >({ + mutationFn: ( + variables: ProposalCyclesResourceReplaceCycleObservatoryVariables + ) => + fetchProposalCyclesResourceReplaceCycleObservatory({ + ...fetcherOptions, + ...variables, + }), + ...options, + }); +}; + export type SubmittedProposalResourceGetSubmittedProposalsPathParams = { /** * @format int64 @@ -11326,16 +11926,16 @@ export type QueryOperation = operationId: "allocatedBlockResourceGetAllocatedBlocks"; variables: AllocatedBlockResourceGetAllocatedBlocksVariables; } + | { + path: "/pst/api/proposalCycles/{cycleCode}/allocatedProposals/{allocatedId}/allocatedBlock/{blockId}"; + operationId: "allocatedBlockResourceGetAllocatedBlock"; + variables: AllocatedBlockResourceGetAllocatedBlockVariables; + } | { path: "/pst/api/proposalCycles/{cycleCode}/availableResources"; operationId: "availableResourcesResourceGetCycleAvailableResources"; variables: AvailableResourcesResourceGetCycleAvailableResourcesVariables; } - | { - path: "/pst/api/proposalCycles/{cycleCode}/availableResources/resources"; - operationId: "availableResourcesResourceGetCycleResources"; - variables: AvailableResourcesResourceGetCycleResourcesVariables; - } | { path: "/pst/api/proposalCycles/{cycleCode}/availableResources/types"; operationId: "availableResourcesResourceGetCycleResourceTypes"; @@ -11346,6 +11946,26 @@ export type QueryOperation = operationId: "availableResourcesResourceGetCycleResourceType"; variables: AvailableResourcesResourceGetCycleResourceTypeVariables; } + | { + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}"; + operationId: "availableResourcesResourceGetCycleAvailableResource"; + variables: AvailableResourcesResourceGetCycleAvailableResourceVariables; + } + | { + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/allocated"; + operationId: "availableResourcesResourceGetCycleResourceUsed"; + variables: AvailableResourcesResourceGetCycleResourceUsedVariables; + } + | { + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/remaining"; + operationId: "availableResourcesResourceGetCycleResourceRemaining"; + variables: AvailableResourcesResourceGetCycleResourceRemainingVariables; + } + | { + path: "/pst/api/proposalCycles/{cycleCode}/availableResources/{resourceName}/total"; + operationId: "availableResourcesResourceGetCycleResourceTotal"; + variables: AvailableResourcesResourceGetCycleResourceTotalVariables; + } | { path: "/pst/api/proposalCycles/{cycleCode}/dates"; operationId: "proposalCyclesResourceGetProposalCycleDates"; @@ -11361,6 +11981,11 @@ export type QueryOperation = operationId: "proposalCyclesResourceGetCycleAllocatedGrade"; variables: ProposalCyclesResourceGetCycleAllocatedGradeVariables; } + | { + path: "/pst/api/proposalCycles/{cycleCode}/observatory"; + operationId: "proposalCyclesResourceGetProposalCycleObservatory"; + variables: ProposalCyclesResourceGetProposalCycleObservatoryVariables; + } | { path: "/pst/api/proposalCycles/{cycleCode}/submittedProposals"; operationId: "submittedProposalResourceGetSubmittedProposals";