diff --git a/frontend/orval.config.ts b/frontend/orval.config.ts index 16b24c38..f786730e 100644 --- a/frontend/orval.config.ts +++ b/frontend/orval.config.ts @@ -9,7 +9,7 @@ export default defineConfig({ mode: "tags-split", target: "src/api/generated/index.ts", schemas: "src/api/generated/model", - client: "fetch", + client: "react-query", prettier: true, override: { mutator: { diff --git a/frontend/src/api/generated/activities/activities.ts b/frontend/src/api/generated/activities/activities.ts index ceb8c79a..f651dcf8 100644 --- a/frontend/src/api/generated/activities/activities.ts +++ b/frontend/src/api/generated/activities/activities.ts @@ -4,6 +4,19 @@ * OpenClaw Agency API * OpenAPI spec version: 0.3.0 */ +import { useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + import type { HTTPValidationError, ListActivitiesActivitiesGetParams, @@ -11,6 +24,8 @@ import type { import { customFetch } from "../../mutator"; +type SecondParameter unknown> = Parameters[1]; + /** * @summary List Activities */ @@ -67,3 +82,156 @@ export const listActivitiesActivitiesGet = async ( }, ); }; + +export const getListActivitiesActivitiesGetQueryKey = ( + params?: ListActivitiesActivitiesGetParams, +) => { + return [`/activities`, ...(params ? [params] : [])] as const; +}; + +export const getListActivitiesActivitiesGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivitiesActivitiesGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListActivitiesActivitiesGetQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listActivitiesActivitiesGet(params, { signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListActivitiesActivitiesGetQueryResult = NonNullable< + Awaited> +>; +export type ListActivitiesActivitiesGetQueryError = HTTPValidationError; + +export function useListActivitiesActivitiesGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: undefined | ListActivitiesActivitiesGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListActivitiesActivitiesGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivitiesActivitiesGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListActivitiesActivitiesGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivitiesActivitiesGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Activities + */ + +export function useListActivitiesActivitiesGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivitiesActivitiesGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListActivitiesActivitiesGetQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} diff --git a/frontend/src/api/generated/default/default.ts b/frontend/src/api/generated/default/default.ts index cf6faab9..af937169 100644 --- a/frontend/src/api/generated/default/default.ts +++ b/frontend/src/api/generated/default/default.ts @@ -4,8 +4,23 @@ * OpenClaw Agency API * OpenAPI spec version: 0.3.0 */ +import { useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + import { customFetch } from "../../mutator"; +type SecondParameter unknown> = Parameters[1]; + /** * @summary Health */ @@ -31,3 +46,138 @@ export const healthHealthGet = async ( method: "GET", }); }; + +export const getHealthHealthGetQueryKey = () => { + return [`/health`] as const; +}; + +export const getHealthHealthGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getHealthHealthGetQueryKey(); + + const queryFn: QueryFunction>> = ({ + signal, + }) => healthHealthGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type HealthHealthGetQueryResult = NonNullable< + Awaited> +>; +export type HealthHealthGetQueryError = unknown; + +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Health + */ + +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getHealthHealthGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} diff --git a/frontend/src/api/generated/hr/hr.ts b/frontend/src/api/generated/hr/hr.ts index eeda8981..b29d44e4 100644 --- a/frontend/src/api/generated/hr/hr.ts +++ b/frontend/src/api/generated/hr/hr.ts @@ -4,6 +4,22 @@ * OpenClaw Agency API * OpenAPI spec version: 0.3.0 */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + import type { EmploymentAction, EmploymentActionCreate, @@ -15,6 +31,8 @@ import type { import { customFetch } from "../../mutator"; +type SecondParameter unknown> = Parameters[1]; + /** * @summary List Headcount Requests */ @@ -46,6 +64,148 @@ export const listHeadcountRequestsHrHeadcountGet = async ( ); }; +export const getListHeadcountRequestsHrHeadcountGetQueryKey = () => { + return [`/hr/headcount`] as const; +}; + +export const getListHeadcountRequestsHrHeadcountGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListHeadcountRequestsHrHeadcountGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listHeadcountRequestsHrHeadcountGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListHeadcountRequestsHrHeadcountGetQueryResult = NonNullable< + Awaited> +>; +export type ListHeadcountRequestsHrHeadcountGetQueryError = unknown; + +export function useListHeadcountRequestsHrHeadcountGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListHeadcountRequestsHrHeadcountGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListHeadcountRequestsHrHeadcountGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Headcount Requests + */ + +export function useListHeadcountRequestsHrHeadcountGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getListHeadcountRequestsHrHeadcountGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Headcount Request */ @@ -91,6 +251,80 @@ export const createHeadcountRequestHrHeadcountPost = async ( ); }; +export const getCreateHeadcountRequestHrHeadcountPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: HeadcountRequestCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: HeadcountRequestCreate }, + TContext +> => { + const mutationKey = ["createHeadcountRequestHrHeadcountPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: HeadcountRequestCreate } + > = (props) => { + const { data } = props ?? {}; + + return createHeadcountRequestHrHeadcountPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateHeadcountRequestHrHeadcountPostMutationResult = NonNullable< + Awaited> +>; +export type CreateHeadcountRequestHrHeadcountPostMutationBody = + HeadcountRequestCreate; +export type CreateHeadcountRequestHrHeadcountPostMutationError = + HTTPValidationError; + +/** + * @summary Create Headcount Request + */ +export const useCreateHeadcountRequestHrHeadcountPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: HeadcountRequestCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: HeadcountRequestCreate }, + TContext +> => { + return useMutation( + getCreateHeadcountRequestHrHeadcountPostMutationOptions(options), + queryClient, + ); +}; /** * @summary Update Headcount Request */ @@ -139,6 +373,89 @@ export const updateHeadcountRequestHrHeadcountRequestIdPatch = async ( ); }; +export const getUpdateHeadcountRequestHrHeadcountRequestIdPatchMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { requestId: number; data: HeadcountRequestUpdate }, + TContext + >; + request?: SecondParameter; + }): UseMutationOptions< + Awaited>, + TError, + { requestId: number; data: HeadcountRequestUpdate }, + TContext + > => { + const mutationKey = ["updateHeadcountRequestHrHeadcountRequestIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType + >, + { requestId: number; data: HeadcountRequestUpdate } + > = (props) => { + const { requestId, data } = props ?? {}; + + return updateHeadcountRequestHrHeadcountRequestIdPatch( + requestId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type UpdateHeadcountRequestHrHeadcountRequestIdPatchMutationResult = + NonNullable< + Awaited> + >; +export type UpdateHeadcountRequestHrHeadcountRequestIdPatchMutationBody = + HeadcountRequestUpdate; +export type UpdateHeadcountRequestHrHeadcountRequestIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Headcount Request + */ +export const useUpdateHeadcountRequestHrHeadcountRequestIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { requestId: number; data: HeadcountRequestUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { requestId: number; data: HeadcountRequestUpdate }, + TContext +> => { + return useMutation( + getUpdateHeadcountRequestHrHeadcountRequestIdPatchMutationOptions(options), + queryClient, + ); +}; /** * @summary List Employment Actions */ @@ -170,6 +487,148 @@ export const listEmploymentActionsHrActionsGet = async ( ); }; +export const getListEmploymentActionsHrActionsGetQueryKey = () => { + return [`/hr/actions`] as const; +}; + +export const getListEmploymentActionsHrActionsGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListEmploymentActionsHrActionsGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listEmploymentActionsHrActionsGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListEmploymentActionsHrActionsGetQueryResult = NonNullable< + Awaited> +>; +export type ListEmploymentActionsHrActionsGetQueryError = unknown; + +export function useListEmploymentActionsHrActionsGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListEmploymentActionsHrActionsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListEmploymentActionsHrActionsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Employment Actions + */ + +export function useListEmploymentActionsHrActionsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getListEmploymentActionsHrActionsGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Employment Action */ @@ -214,3 +673,78 @@ export const createEmploymentActionHrActionsPost = async ( }, ); }; + +export const getCreateEmploymentActionHrActionsPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: EmploymentActionCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: EmploymentActionCreate }, + TContext +> => { + const mutationKey = ["createEmploymentActionHrActionsPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: EmploymentActionCreate } + > = (props) => { + const { data } = props ?? {}; + + return createEmploymentActionHrActionsPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateEmploymentActionHrActionsPostMutationResult = NonNullable< + Awaited> +>; +export type CreateEmploymentActionHrActionsPostMutationBody = + EmploymentActionCreate; +export type CreateEmploymentActionHrActionsPostMutationError = + HTTPValidationError; + +/** + * @summary Create Employment Action + */ +export const useCreateEmploymentActionHrActionsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: EmploymentActionCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: EmploymentActionCreate }, + TContext +> => { + return useMutation( + getCreateEmploymentActionHrActionsPostMutationOptions(options), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/org/org.ts b/frontend/src/api/generated/org/org.ts index 152717bc..359bbb3d 100644 --- a/frontend/src/api/generated/org/org.ts +++ b/frontend/src/api/generated/org/org.ts @@ -4,6 +4,22 @@ * OpenClaw Agency API * OpenAPI spec version: 0.3.0 */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + import type { Department, DepartmentCreate, @@ -16,6 +32,8 @@ import type { import { customFetch } from "../../mutator"; +type SecondParameter unknown> = Parameters[1]; + /** * @summary List Departments */ @@ -47,6 +65,147 @@ export const listDepartmentsDepartmentsGet = async ( ); }; +export const getListDepartmentsDepartmentsGetQueryKey = () => { + return [`/departments`] as const; +}; + +export const getListDepartmentsDepartmentsGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListDepartmentsDepartmentsGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listDepartmentsDepartmentsGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListDepartmentsDepartmentsGetQueryResult = NonNullable< + Awaited> +>; +export type ListDepartmentsDepartmentsGetQueryError = unknown; + +export function useListDepartmentsDepartmentsGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListDepartmentsDepartmentsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListDepartmentsDepartmentsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Departments + */ + +export function useListDepartmentsDepartmentsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListDepartmentsDepartmentsGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Department */ @@ -92,6 +251,78 @@ export const createDepartmentDepartmentsPost = async ( ); }; +export const getCreateDepartmentDepartmentsPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: DepartmentCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: DepartmentCreate }, + TContext +> => { + const mutationKey = ["createDepartmentDepartmentsPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: DepartmentCreate } + > = (props) => { + const { data } = props ?? {}; + + return createDepartmentDepartmentsPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateDepartmentDepartmentsPostMutationResult = NonNullable< + Awaited> +>; +export type CreateDepartmentDepartmentsPostMutationBody = DepartmentCreate; +export type CreateDepartmentDepartmentsPostMutationError = HTTPValidationError; + +/** + * @summary Create Department + */ +export const useCreateDepartmentDepartmentsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: DepartmentCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: DepartmentCreate }, + TContext +> => { + return useMutation( + getCreateDepartmentDepartmentsPostMutationOptions(options), + queryClient, + ); +}; /** * @summary Update Department */ @@ -140,6 +371,85 @@ export const updateDepartmentDepartmentsDepartmentIdPatch = async ( ); }; +export const getUpdateDepartmentDepartmentsDepartmentIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { departmentId: number; data: DepartmentUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { departmentId: number; data: DepartmentUpdate }, + TContext +> => { + const mutationKey = ["updateDepartmentDepartmentsDepartmentIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { departmentId: number; data: DepartmentUpdate } + > = (props) => { + const { departmentId, data } = props ?? {}; + + return updateDepartmentDepartmentsDepartmentIdPatch( + departmentId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateDepartmentDepartmentsDepartmentIdPatchMutationResult = + NonNullable< + Awaited> + >; +export type UpdateDepartmentDepartmentsDepartmentIdPatchMutationBody = + DepartmentUpdate; +export type UpdateDepartmentDepartmentsDepartmentIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Department + */ +export const useUpdateDepartmentDepartmentsDepartmentIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { departmentId: number; data: DepartmentUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { departmentId: number; data: DepartmentUpdate }, + TContext +> => { + return useMutation( + getUpdateDepartmentDepartmentsDepartmentIdPatchMutationOptions(options), + queryClient, + ); +}; /** * @summary List Employees */ @@ -171,6 +481,146 @@ export const listEmployeesEmployeesGet = async ( ); }; +export const getListEmployeesEmployeesGetQueryKey = () => { + return [`/employees`] as const; +}; + +export const getListEmployeesEmployeesGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListEmployeesEmployeesGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => listEmployeesEmployeesGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListEmployeesEmployeesGetQueryResult = NonNullable< + Awaited> +>; +export type ListEmployeesEmployeesGetQueryError = unknown; + +export function useListEmployeesEmployeesGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListEmployeesEmployeesGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListEmployeesEmployeesGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Employees + */ + +export function useListEmployeesEmployeesGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListEmployeesEmployeesGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Employee */ @@ -216,6 +666,78 @@ export const createEmployeeEmployeesPost = async ( ); }; +export const getCreateEmployeeEmployeesPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: EmployeeCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: EmployeeCreate }, + TContext +> => { + const mutationKey = ["createEmployeeEmployeesPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: EmployeeCreate } + > = (props) => { + const { data } = props ?? {}; + + return createEmployeeEmployeesPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateEmployeeEmployeesPostMutationResult = NonNullable< + Awaited> +>; +export type CreateEmployeeEmployeesPostMutationBody = EmployeeCreate; +export type CreateEmployeeEmployeesPostMutationError = HTTPValidationError; + +/** + * @summary Create Employee + */ +export const useCreateEmployeeEmployeesPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: EmployeeCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: EmployeeCreate }, + TContext +> => { + return useMutation( + getCreateEmployeeEmployeesPostMutationOptions(options), + queryClient, + ); +}; /** * @summary Update Employee */ @@ -263,3 +785,81 @@ export const updateEmployeeEmployeesEmployeeIdPatch = async ( }, ); }; + +export const getUpdateEmployeeEmployeesEmployeeIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { employeeId: number; data: EmployeeUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { employeeId: number; data: EmployeeUpdate }, + TContext +> => { + const mutationKey = ["updateEmployeeEmployeesEmployeeIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { employeeId: number; data: EmployeeUpdate } + > = (props) => { + const { employeeId, data } = props ?? {}; + + return updateEmployeeEmployeesEmployeeIdPatch( + employeeId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateEmployeeEmployeesEmployeeIdPatchMutationResult = NonNullable< + Awaited> +>; +export type UpdateEmployeeEmployeesEmployeeIdPatchMutationBody = EmployeeUpdate; +export type UpdateEmployeeEmployeesEmployeeIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Employee + */ +export const useUpdateEmployeeEmployeesEmployeeIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { employeeId: number; data: EmployeeUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { employeeId: number; data: EmployeeUpdate }, + TContext +> => { + return useMutation( + getUpdateEmployeeEmployeesEmployeeIdPatchMutationOptions(options), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/projects/projects.ts b/frontend/src/api/generated/projects/projects.ts index 33c56884..489b332d 100644 --- a/frontend/src/api/generated/projects/projects.ts +++ b/frontend/src/api/generated/projects/projects.ts @@ -4,6 +4,22 @@ * OpenClaw Agency API * OpenAPI spec version: 0.3.0 */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + import type { HTTPValidationError, Project, @@ -13,6 +29,8 @@ import type { import { customFetch } from "../../mutator"; +type SecondParameter unknown> = Parameters[1]; + /** * @summary List Projects */ @@ -44,6 +62,146 @@ export const listProjectsProjectsGet = async ( ); }; +export const getListProjectsProjectsGetQueryKey = () => { + return [`/projects`] as const; +}; + +export const getListProjectsProjectsGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListProjectsProjectsGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => listProjectsProjectsGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListProjectsProjectsGetQueryResult = NonNullable< + Awaited> +>; +export type ListProjectsProjectsGetQueryError = unknown; + +export function useListProjectsProjectsGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListProjectsProjectsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListProjectsProjectsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Projects + */ + +export function useListProjectsProjectsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListProjectsProjectsGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Project */ @@ -89,6 +247,78 @@ export const createProjectProjectsPost = async ( ); }; +export const getCreateProjectProjectsPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: ProjectCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: ProjectCreate }, + TContext +> => { + const mutationKey = ["createProjectProjectsPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: ProjectCreate } + > = (props) => { + const { data } = props ?? {}; + + return createProjectProjectsPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateProjectProjectsPostMutationResult = NonNullable< + Awaited> +>; +export type CreateProjectProjectsPostMutationBody = ProjectCreate; +export type CreateProjectProjectsPostMutationError = HTTPValidationError; + +/** + * @summary Create Project + */ +export const useCreateProjectProjectsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: ProjectCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: ProjectCreate }, + TContext +> => { + return useMutation( + getCreateProjectProjectsPostMutationOptions(options), + queryClient, + ); +}; /** * @summary Update Project */ @@ -136,3 +366,77 @@ export const updateProjectProjectsProjectIdPatch = async ( }, ); }; + +export const getUpdateProjectProjectsProjectIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { projectId: number; data: ProjectUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { projectId: number; data: ProjectUpdate }, + TContext +> => { + const mutationKey = ["updateProjectProjectsProjectIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { projectId: number; data: ProjectUpdate } + > = (props) => { + const { projectId, data } = props ?? {}; + + return updateProjectProjectsProjectIdPatch(projectId, data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateProjectProjectsProjectIdPatchMutationResult = NonNullable< + Awaited> +>; +export type UpdateProjectProjectsProjectIdPatchMutationBody = ProjectUpdate; +export type UpdateProjectProjectsProjectIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Project + */ +export const useUpdateProjectProjectsProjectIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { projectId: number; data: ProjectUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { projectId: number; data: ProjectUpdate }, + TContext +> => { + return useMutation( + getUpdateProjectProjectsProjectIdPatchMutationOptions(options), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/work/work.ts b/frontend/src/api/generated/work/work.ts index 2a8d454b..6ad2a479 100644 --- a/frontend/src/api/generated/work/work.ts +++ b/frontend/src/api/generated/work/work.ts @@ -4,6 +4,22 @@ * OpenClaw Agency API * OpenAPI spec version: 0.3.0 */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + import type { HTTPValidationError, ListTaskCommentsTaskCommentsGetParams, @@ -17,6 +33,8 @@ import type { import { customFetch } from "../../mutator"; +type SecondParameter unknown> = Parameters[1]; + /** * @summary List Tasks */ @@ -70,6 +88,155 @@ export const listTasksTasksGet = async ( ); }; +export const getListTasksTasksGetQueryKey = ( + params?: ListTasksTasksGetParams, +) => { + return [`/tasks`, ...(params ? [params] : [])] as const; +}; + +export const getListTasksTasksGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListTasksTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListTasksTasksGetQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => listTasksTasksGet(params, { signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListTasksTasksGetQueryResult = NonNullable< + Awaited> +>; +export type ListTasksTasksGetQueryError = HTTPValidationError; + +export function useListTasksTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: undefined | ListTasksTasksGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListTasksTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListTasksTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListTasksTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListTasksTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Tasks + */ + +export function useListTasksTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListTasksTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListTasksTasksGetQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Task */ @@ -112,6 +279,78 @@ export const createTaskTasksPost = async ( }); }; +export const getCreateTaskTasksPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: TaskCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: TaskCreate }, + TContext +> => { + const mutationKey = ["createTaskTasksPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: TaskCreate } + > = (props) => { + const { data } = props ?? {}; + + return createTaskTasksPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateTaskTasksPostMutationResult = NonNullable< + Awaited> +>; +export type CreateTaskTasksPostMutationBody = TaskCreate; +export type CreateTaskTasksPostMutationError = HTTPValidationError; + +/** + * @summary Create Task + */ +export const useCreateTaskTasksPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: TaskCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: TaskCreate }, + TContext +> => { + return useMutation( + getCreateTaskTasksPostMutationOptions(options), + queryClient, + ); +}; /** * @summary Update Task */ @@ -158,6 +397,78 @@ export const updateTaskTasksTaskIdPatch = async ( ); }; +export const getUpdateTaskTasksTaskIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { taskId: number; data: TaskUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { taskId: number; data: TaskUpdate }, + TContext +> => { + const mutationKey = ["updateTaskTasksTaskIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { taskId: number; data: TaskUpdate } + > = (props) => { + const { taskId, data } = props ?? {}; + + return updateTaskTasksTaskIdPatch(taskId, data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateTaskTasksTaskIdPatchMutationResult = NonNullable< + Awaited> +>; +export type UpdateTaskTasksTaskIdPatchMutationBody = TaskUpdate; +export type UpdateTaskTasksTaskIdPatchMutationError = HTTPValidationError; + +/** + * @summary Update Task + */ +export const useUpdateTaskTasksTaskIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { taskId: number; data: TaskUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { taskId: number; data: TaskUpdate }, + TContext +> => { + return useMutation( + getUpdateTaskTasksTaskIdPatchMutationOptions(options), + queryClient, + ); +}; /** * @summary Delete Task */ @@ -201,6 +512,78 @@ export const deleteTaskTasksTaskIdDelete = async ( ); }; +export const getDeleteTaskTasksTaskIdDeleteMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { taskId: number }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { taskId: number }, + TContext +> => { + const mutationKey = ["deleteTaskTasksTaskIdDelete"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { taskId: number } + > = (props) => { + const { taskId } = props ?? {}; + + return deleteTaskTasksTaskIdDelete(taskId, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type DeleteTaskTasksTaskIdDeleteMutationResult = NonNullable< + Awaited> +>; + +export type DeleteTaskTasksTaskIdDeleteMutationError = HTTPValidationError; + +/** + * @summary Delete Task + */ +export const useDeleteTaskTasksTaskIdDelete = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { taskId: number }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { taskId: number }, + TContext +> => { + return useMutation( + getDeleteTaskTasksTaskIdDeleteMutationOptions(options), + queryClient, + ); +}; /** * @summary List Task Comments */ @@ -258,6 +641,160 @@ export const listTaskCommentsTaskCommentsGet = async ( ); }; +export const getListTaskCommentsTaskCommentsGetQueryKey = ( + params?: ListTaskCommentsTaskCommentsGetParams, +) => { + return [`/task-comments`, ...(params ? [params] : [])] as const; +}; + +export const getListTaskCommentsTaskCommentsGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params: ListTaskCommentsTaskCommentsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getListTaskCommentsTaskCommentsGetQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listTaskCommentsTaskCommentsGet(params, { signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListTaskCommentsTaskCommentsGetQueryResult = NonNullable< + Awaited> +>; +export type ListTaskCommentsTaskCommentsGetQueryError = HTTPValidationError; + +export function useListTaskCommentsTaskCommentsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: ListTaskCommentsTaskCommentsGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListTaskCommentsTaskCommentsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: ListTaskCommentsTaskCommentsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListTaskCommentsTaskCommentsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: ListTaskCommentsTaskCommentsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Task Comments + */ + +export function useListTaskCommentsTaskCommentsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: ListTaskCommentsTaskCommentsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListTaskCommentsTaskCommentsGetQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + /** * @summary Create Task Comment */ @@ -302,3 +839,77 @@ export const createTaskCommentTaskCommentsPost = async ( }, ); }; + +export const getCreateTaskCommentTaskCommentsPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: TaskCommentCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: TaskCommentCreate }, + TContext +> => { + const mutationKey = ["createTaskCommentTaskCommentsPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: TaskCommentCreate } + > = (props) => { + const { data } = props ?? {}; + + return createTaskCommentTaskCommentsPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateTaskCommentTaskCommentsPostMutationResult = NonNullable< + Awaited> +>; +export type CreateTaskCommentTaskCommentsPostMutationBody = TaskCommentCreate; +export type CreateTaskCommentTaskCommentsPostMutationError = + HTTPValidationError; + +/** + * @summary Create Task Comment + */ +export const useCreateTaskCommentTaskCommentsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: TaskCommentCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: TaskCommentCreate }, + TContext +> => { + return useMutation( + getCreateTaskCommentTaskCommentsPostMutationOptions(options), + queryClient, + ); +};