Spaces:
Runtime error
Runtime error
| /** | |
| * Generated by orval v8.9.1 🍺 | |
| * Do not edit manually. | |
| * Api | |
| * Design Studio OS API | |
| * OpenAPI spec version: 0.1.0 | |
| */ | |
| import { | |
| useMutation, | |
| useQuery | |
| } from '@tanstack/react-query'; | |
| import type { | |
| MutationFunction, | |
| QueryFunction, | |
| QueryKey, | |
| UseMutationOptions, | |
| UseMutationResult, | |
| UseQueryOptions, | |
| UseQueryResult | |
| } from '@tanstack/react-query'; | |
| import type { | |
| ActivityItem, | |
| Brief, | |
| Client, | |
| CreateBriefBody, | |
| CreateClientBody, | |
| CreateProjectBody, | |
| CreateTaskBody, | |
| CreateTimeEntryBody, | |
| DashboardStats, | |
| GetRecentActivityParams, | |
| HealthStatus, | |
| ListProjectsParams, | |
| ListTasksParams, | |
| ListTimeEntriesParams, | |
| Project, | |
| Task, | |
| TimeEntry, | |
| UpdateBriefBody, | |
| UpdateClientBody, | |
| UpdateProjectBody, | |
| UpdateTaskBody | |
| } from './api.schemas'; | |
| import { customFetch } from '../custom-fetch'; | |
| import type { ErrorType , BodyType } from '../custom-fetch'; | |
| type AwaitedInput<T> = PromiseLike<T> | T; | |
| type Awaited<O> = O extends AwaitedInput<infer T> ? T : never; | |
| type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1]; | |
| export const getHealthCheckUrl = () => { | |
| return `/api/healthz` | |
| } | |
| /** | |
| * @summary Health check | |
| */ | |
| export const healthCheck = async ( options?: RequestInit): Promise<HealthStatus> => { | |
| return customFetch<HealthStatus>(getHealthCheckUrl(), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getHealthCheckQueryKey = () => { | |
| return [ | |
| `/api/healthz` | |
| ] as const; | |
| } | |
| export const getHealthCheckQueryOptions = <TData = Awaited<ReturnType<typeof healthCheck>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof healthCheck>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getHealthCheckQueryKey(); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof healthCheck>>> = ({ signal }) => healthCheck({ signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof healthCheck>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type HealthCheckQueryResult = NonNullable<Awaited<ReturnType<typeof healthCheck>>> | |
| export type HealthCheckQueryError = ErrorType<unknown> | |
| /** | |
| * @summary Health check | |
| */ | |
| export function useHealthCheck<TData = Awaited<ReturnType<typeof healthCheck>>, TError = ErrorType<unknown>>( | |
| options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof healthCheck>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getHealthCheckQueryOptions(options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getListProjectsUrl = (params?: ListProjectsParams,) => { | |
| const normalizedParams = new URLSearchParams(); | |
| Object.entries(params || {}).forEach(([key, value]) => { | |
| if (value !== undefined) { | |
| normalizedParams.append(key, value === null ? 'null' : value.toString()) | |
| } | |
| }); | |
| const stringifiedParams = normalizedParams.toString(); | |
| return stringifiedParams.length > 0 ? `/api/projects?${stringifiedParams}` : `/api/projects` | |
| } | |
| /** | |
| * @summary List all projects | |
| */ | |
| export const listProjects = async (params?: ListProjectsParams, options?: RequestInit): Promise<Project[]> => { | |
| return customFetch<Project[]>(getListProjectsUrl(params), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getListProjectsQueryKey = (params?: ListProjectsParams,) => { | |
| return [ | |
| `/api/projects`, ...(params ? [params] : []) | |
| ] as const; | |
| } | |
| export const getListProjectsQueryOptions = <TData = Awaited<ReturnType<typeof listProjects>>, TError = ErrorType<unknown>>(params?: ListProjectsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listProjects>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getListProjectsQueryKey(params); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof listProjects>>> = ({ signal }) => listProjects(params, { signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listProjects>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type ListProjectsQueryResult = NonNullable<Awaited<ReturnType<typeof listProjects>>> | |
| export type ListProjectsQueryError = ErrorType<unknown> | |
| /** | |
| * @summary List all projects | |
| */ | |
| export function useListProjects<TData = Awaited<ReturnType<typeof listProjects>>, TError = ErrorType<unknown>>( | |
| params?: ListProjectsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listProjects>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getListProjectsQueryOptions(params,options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getCreateProjectUrl = () => { | |
| return `/api/projects` | |
| } | |
| /** | |
| * @summary Create a new project | |
| */ | |
| export const createProject = async (createProjectBody: CreateProjectBody, options?: RequestInit): Promise<Project> => { | |
| return customFetch<Project>(getCreateProjectUrl(), | |
| { | |
| ...options, | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| createProjectBody,) | |
| } | |
| );} | |
| export const getCreateProjectMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProject>>, TError,{data: BodyType<CreateProjectBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof createProject>>, TError,{data: BodyType<CreateProjectBody>}, TContext> => { | |
| const mutationKey = ['createProject']; | |
| 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<typeof createProject>>, {data: BodyType<CreateProjectBody>}> = (props) => { | |
| const {data} = props ?? {}; | |
| return createProject(data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type CreateProjectMutationResult = NonNullable<Awaited<ReturnType<typeof createProject>>> | |
| export type CreateProjectMutationBody = BodyType<CreateProjectBody> | |
| export type CreateProjectMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Create a new project | |
| */ | |
| export const useCreateProject = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProject>>, TError,{data: BodyType<CreateProjectBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof createProject>>, | |
| TError, | |
| {data: BodyType<CreateProjectBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getCreateProjectMutationOptions(options)); | |
| } | |
| export const getGetProjectUrl = (id: number,) => { | |
| return `/api/projects/${id}` | |
| } | |
| /** | |
| * @summary Get a project by ID | |
| */ | |
| export const getProject = async (id: number, options?: RequestInit): Promise<Project> => { | |
| return customFetch<Project>(getGetProjectUrl(id), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getGetProjectQueryKey = (id: number,) => { | |
| return [ | |
| `/api/projects/${id}` | |
| ] as const; | |
| } | |
| export const getGetProjectQueryOptions = <TData = Awaited<ReturnType<typeof getProject>>, TError = ErrorType<unknown>>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProject>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getGetProjectQueryKey(id); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof getProject>>> = ({ signal }) => getProject(id, { signal, ...requestOptions }); | |
| return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProject>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type GetProjectQueryResult = NonNullable<Awaited<ReturnType<typeof getProject>>> | |
| export type GetProjectQueryError = ErrorType<unknown> | |
| /** | |
| * @summary Get a project by ID | |
| */ | |
| export function useGetProject<TData = Awaited<ReturnType<typeof getProject>>, TError = ErrorType<unknown>>( | |
| id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProject>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getGetProjectQueryOptions(id,options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getUpdateProjectUrl = (id: number,) => { | |
| return `/api/projects/${id}` | |
| } | |
| /** | |
| * @summary Update a project | |
| */ | |
| export const updateProject = async (id: number, | |
| updateProjectBody: UpdateProjectBody, options?: RequestInit): Promise<Project> => { | |
| return customFetch<Project>(getUpdateProjectUrl(id), | |
| { | |
| ...options, | |
| method: 'PATCH', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| updateProjectBody,) | |
| } | |
| );} | |
| export const getUpdateProjectMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProject>>, TError,{id: number;data: BodyType<UpdateProjectBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof updateProject>>, TError,{id: number;data: BodyType<UpdateProjectBody>}, TContext> => { | |
| const mutationKey = ['updateProject']; | |
| 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<typeof updateProject>>, {id: number;data: BodyType<UpdateProjectBody>}> = (props) => { | |
| const {id,data} = props ?? {}; | |
| return updateProject(id,data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type UpdateProjectMutationResult = NonNullable<Awaited<ReturnType<typeof updateProject>>> | |
| export type UpdateProjectMutationBody = BodyType<UpdateProjectBody> | |
| export type UpdateProjectMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Update a project | |
| */ | |
| export const useUpdateProject = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProject>>, TError,{id: number;data: BodyType<UpdateProjectBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof updateProject>>, | |
| TError, | |
| {id: number;data: BodyType<UpdateProjectBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getUpdateProjectMutationOptions(options)); | |
| } | |
| export const getDeleteProjectUrl = (id: number,) => { | |
| return `/api/projects/${id}` | |
| } | |
| /** | |
| * @summary Delete a project | |
| */ | |
| export const deleteProject = async (id: number, options?: RequestInit): Promise<void> => { | |
| return customFetch<void>(getDeleteProjectUrl(id), | |
| { | |
| ...options, | |
| method: 'DELETE' | |
| } | |
| );} | |
| export const getDeleteProjectMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProject>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof deleteProject>>, TError,{id: number}, TContext> => { | |
| const mutationKey = ['deleteProject']; | |
| 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<typeof deleteProject>>, {id: number}> = (props) => { | |
| const {id} = props ?? {}; | |
| return deleteProject(id,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type DeleteProjectMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProject>>> | |
| export type DeleteProjectMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Delete a project | |
| */ | |
| export const useDeleteProject = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProject>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof deleteProject>>, | |
| TError, | |
| {id: number}, | |
| TContext | |
| > => { | |
| return useMutation(getDeleteProjectMutationOptions(options)); | |
| } | |
| export const getListClientsUrl = () => { | |
| return `/api/clients` | |
| } | |
| /** | |
| * @summary List all clients | |
| */ | |
| export const listClients = async ( options?: RequestInit): Promise<Client[]> => { | |
| return customFetch<Client[]>(getListClientsUrl(), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getListClientsQueryKey = () => { | |
| return [ | |
| `/api/clients` | |
| ] as const; | |
| } | |
| export const getListClientsQueryOptions = <TData = Awaited<ReturnType<typeof listClients>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listClients>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getListClientsQueryKey(); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof listClients>>> = ({ signal }) => listClients({ signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listClients>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type ListClientsQueryResult = NonNullable<Awaited<ReturnType<typeof listClients>>> | |
| export type ListClientsQueryError = ErrorType<unknown> | |
| /** | |
| * @summary List all clients | |
| */ | |
| export function useListClients<TData = Awaited<ReturnType<typeof listClients>>, TError = ErrorType<unknown>>( | |
| options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listClients>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getListClientsQueryOptions(options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getCreateClientUrl = () => { | |
| return `/api/clients` | |
| } | |
| /** | |
| * @summary Create a client | |
| */ | |
| export const createClient = async (createClientBody: CreateClientBody, options?: RequestInit): Promise<Client> => { | |
| return customFetch<Client>(getCreateClientUrl(), | |
| { | |
| ...options, | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| createClientBody,) | |
| } | |
| );} | |
| export const getCreateClientMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createClient>>, TError,{data: BodyType<CreateClientBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof createClient>>, TError,{data: BodyType<CreateClientBody>}, TContext> => { | |
| const mutationKey = ['createClient']; | |
| 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<typeof createClient>>, {data: BodyType<CreateClientBody>}> = (props) => { | |
| const {data} = props ?? {}; | |
| return createClient(data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type CreateClientMutationResult = NonNullable<Awaited<ReturnType<typeof createClient>>> | |
| export type CreateClientMutationBody = BodyType<CreateClientBody> | |
| export type CreateClientMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Create a client | |
| */ | |
| export const useCreateClient = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createClient>>, TError,{data: BodyType<CreateClientBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof createClient>>, | |
| TError, | |
| {data: BodyType<CreateClientBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getCreateClientMutationOptions(options)); | |
| } | |
| export const getGetClientUrl = (id: number,) => { | |
| return `/api/clients/${id}` | |
| } | |
| /** | |
| * @summary Get a client by ID | |
| */ | |
| export const getClient = async (id: number, options?: RequestInit): Promise<Client> => { | |
| return customFetch<Client>(getGetClientUrl(id), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getGetClientQueryKey = (id: number,) => { | |
| return [ | |
| `/api/clients/${id}` | |
| ] as const; | |
| } | |
| export const getGetClientQueryOptions = <TData = Awaited<ReturnType<typeof getClient>>, TError = ErrorType<unknown>>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getClient>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getGetClientQueryKey(id); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof getClient>>> = ({ signal }) => getClient(id, { signal, ...requestOptions }); | |
| return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getClient>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type GetClientQueryResult = NonNullable<Awaited<ReturnType<typeof getClient>>> | |
| export type GetClientQueryError = ErrorType<unknown> | |
| /** | |
| * @summary Get a client by ID | |
| */ | |
| export function useGetClient<TData = Awaited<ReturnType<typeof getClient>>, TError = ErrorType<unknown>>( | |
| id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getClient>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getGetClientQueryOptions(id,options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getUpdateClientUrl = (id: number,) => { | |
| return `/api/clients/${id}` | |
| } | |
| /** | |
| * @summary Update a client | |
| */ | |
| export const updateClient = async (id: number, | |
| updateClientBody: UpdateClientBody, options?: RequestInit): Promise<Client> => { | |
| return customFetch<Client>(getUpdateClientUrl(id), | |
| { | |
| ...options, | |
| method: 'PATCH', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| updateClientBody,) | |
| } | |
| );} | |
| export const getUpdateClientMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateClient>>, TError,{id: number;data: BodyType<UpdateClientBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof updateClient>>, TError,{id: number;data: BodyType<UpdateClientBody>}, TContext> => { | |
| const mutationKey = ['updateClient']; | |
| 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<typeof updateClient>>, {id: number;data: BodyType<UpdateClientBody>}> = (props) => { | |
| const {id,data} = props ?? {}; | |
| return updateClient(id,data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type UpdateClientMutationResult = NonNullable<Awaited<ReturnType<typeof updateClient>>> | |
| export type UpdateClientMutationBody = BodyType<UpdateClientBody> | |
| export type UpdateClientMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Update a client | |
| */ | |
| export const useUpdateClient = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateClient>>, TError,{id: number;data: BodyType<UpdateClientBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof updateClient>>, | |
| TError, | |
| {id: number;data: BodyType<UpdateClientBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getUpdateClientMutationOptions(options)); | |
| } | |
| export const getDeleteClientUrl = (id: number,) => { | |
| return `/api/clients/${id}` | |
| } | |
| /** | |
| * @summary Delete a client | |
| */ | |
| export const deleteClient = async (id: number, options?: RequestInit): Promise<void> => { | |
| return customFetch<void>(getDeleteClientUrl(id), | |
| { | |
| ...options, | |
| method: 'DELETE' | |
| } | |
| );} | |
| export const getDeleteClientMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteClient>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof deleteClient>>, TError,{id: number}, TContext> => { | |
| const mutationKey = ['deleteClient']; | |
| 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<typeof deleteClient>>, {id: number}> = (props) => { | |
| const {id} = props ?? {}; | |
| return deleteClient(id,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type DeleteClientMutationResult = NonNullable<Awaited<ReturnType<typeof deleteClient>>> | |
| export type DeleteClientMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Delete a client | |
| */ | |
| export const useDeleteClient = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteClient>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof deleteClient>>, | |
| TError, | |
| {id: number}, | |
| TContext | |
| > => { | |
| return useMutation(getDeleteClientMutationOptions(options)); | |
| } | |
| export const getListTasksUrl = (params?: ListTasksParams,) => { | |
| const normalizedParams = new URLSearchParams(); | |
| Object.entries(params || {}).forEach(([key, value]) => { | |
| if (value !== undefined) { | |
| normalizedParams.append(key, value === null ? 'null' : value.toString()) | |
| } | |
| }); | |
| const stringifiedParams = normalizedParams.toString(); | |
| return stringifiedParams.length > 0 ? `/api/tasks?${stringifiedParams}` : `/api/tasks` | |
| } | |
| /** | |
| * @summary List tasks | |
| */ | |
| export const listTasks = async (params?: ListTasksParams, options?: RequestInit): Promise<Task[]> => { | |
| return customFetch<Task[]>(getListTasksUrl(params), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getListTasksQueryKey = (params?: ListTasksParams,) => { | |
| return [ | |
| `/api/tasks`, ...(params ? [params] : []) | |
| ] as const; | |
| } | |
| export const getListTasksQueryOptions = <TData = Awaited<ReturnType<typeof listTasks>>, TError = ErrorType<unknown>>(params?: ListTasksParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listTasks>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getListTasksQueryKey(params); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof listTasks>>> = ({ signal }) => listTasks(params, { signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listTasks>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type ListTasksQueryResult = NonNullable<Awaited<ReturnType<typeof listTasks>>> | |
| export type ListTasksQueryError = ErrorType<unknown> | |
| /** | |
| * @summary List tasks | |
| */ | |
| export function useListTasks<TData = Awaited<ReturnType<typeof listTasks>>, TError = ErrorType<unknown>>( | |
| params?: ListTasksParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listTasks>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getListTasksQueryOptions(params,options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getCreateTaskUrl = () => { | |
| return `/api/tasks` | |
| } | |
| /** | |
| * @summary Create a task | |
| */ | |
| export const createTask = async (createTaskBody: CreateTaskBody, options?: RequestInit): Promise<Task> => { | |
| return customFetch<Task>(getCreateTaskUrl(), | |
| { | |
| ...options, | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| createTaskBody,) | |
| } | |
| );} | |
| export const getCreateTaskMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTask>>, TError,{data: BodyType<CreateTaskBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof createTask>>, TError,{data: BodyType<CreateTaskBody>}, TContext> => { | |
| const mutationKey = ['createTask']; | |
| 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<typeof createTask>>, {data: BodyType<CreateTaskBody>}> = (props) => { | |
| const {data} = props ?? {}; | |
| return createTask(data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type CreateTaskMutationResult = NonNullable<Awaited<ReturnType<typeof createTask>>> | |
| export type CreateTaskMutationBody = BodyType<CreateTaskBody> | |
| export type CreateTaskMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Create a task | |
| */ | |
| export const useCreateTask = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTask>>, TError,{data: BodyType<CreateTaskBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof createTask>>, | |
| TError, | |
| {data: BodyType<CreateTaskBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getCreateTaskMutationOptions(options)); | |
| } | |
| export const getUpdateTaskUrl = (id: number,) => { | |
| return `/api/tasks/${id}` | |
| } | |
| /** | |
| * @summary Update a task | |
| */ | |
| export const updateTask = async (id: number, | |
| updateTaskBody: UpdateTaskBody, options?: RequestInit): Promise<Task> => { | |
| return customFetch<Task>(getUpdateTaskUrl(id), | |
| { | |
| ...options, | |
| method: 'PATCH', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| updateTaskBody,) | |
| } | |
| );} | |
| export const getUpdateTaskMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateTask>>, TError,{id: number;data: BodyType<UpdateTaskBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof updateTask>>, TError,{id: number;data: BodyType<UpdateTaskBody>}, TContext> => { | |
| const mutationKey = ['updateTask']; | |
| 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<typeof updateTask>>, {id: number;data: BodyType<UpdateTaskBody>}> = (props) => { | |
| const {id,data} = props ?? {}; | |
| return updateTask(id,data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type UpdateTaskMutationResult = NonNullable<Awaited<ReturnType<typeof updateTask>>> | |
| export type UpdateTaskMutationBody = BodyType<UpdateTaskBody> | |
| export type UpdateTaskMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Update a task | |
| */ | |
| export const useUpdateTask = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateTask>>, TError,{id: number;data: BodyType<UpdateTaskBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof updateTask>>, | |
| TError, | |
| {id: number;data: BodyType<UpdateTaskBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getUpdateTaskMutationOptions(options)); | |
| } | |
| export const getDeleteTaskUrl = (id: number,) => { | |
| return `/api/tasks/${id}` | |
| } | |
| /** | |
| * @summary Delete a task | |
| */ | |
| export const deleteTask = async (id: number, options?: RequestInit): Promise<void> => { | |
| return customFetch<void>(getDeleteTaskUrl(id), | |
| { | |
| ...options, | |
| method: 'DELETE' | |
| } | |
| );} | |
| export const getDeleteTaskMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTask>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof deleteTask>>, TError,{id: number}, TContext> => { | |
| const mutationKey = ['deleteTask']; | |
| 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<typeof deleteTask>>, {id: number}> = (props) => { | |
| const {id} = props ?? {}; | |
| return deleteTask(id,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type DeleteTaskMutationResult = NonNullable<Awaited<ReturnType<typeof deleteTask>>> | |
| export type DeleteTaskMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Delete a task | |
| */ | |
| export const useDeleteTask = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTask>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof deleteTask>>, | |
| TError, | |
| {id: number}, | |
| TContext | |
| > => { | |
| return useMutation(getDeleteTaskMutationOptions(options)); | |
| } | |
| export const getListTimeEntriesUrl = (params?: ListTimeEntriesParams,) => { | |
| const normalizedParams = new URLSearchParams(); | |
| Object.entries(params || {}).forEach(([key, value]) => { | |
| if (value !== undefined) { | |
| normalizedParams.append(key, value === null ? 'null' : value.toString()) | |
| } | |
| }); | |
| const stringifiedParams = normalizedParams.toString(); | |
| return stringifiedParams.length > 0 ? `/api/time-entries?${stringifiedParams}` : `/api/time-entries` | |
| } | |
| /** | |
| * @summary List time entries | |
| */ | |
| export const listTimeEntries = async (params?: ListTimeEntriesParams, options?: RequestInit): Promise<TimeEntry[]> => { | |
| return customFetch<TimeEntry[]>(getListTimeEntriesUrl(params), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getListTimeEntriesQueryKey = (params?: ListTimeEntriesParams,) => { | |
| return [ | |
| `/api/time-entries`, ...(params ? [params] : []) | |
| ] as const; | |
| } | |
| export const getListTimeEntriesQueryOptions = <TData = Awaited<ReturnType<typeof listTimeEntries>>, TError = ErrorType<unknown>>(params?: ListTimeEntriesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listTimeEntries>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getListTimeEntriesQueryKey(params); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof listTimeEntries>>> = ({ signal }) => listTimeEntries(params, { signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listTimeEntries>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type ListTimeEntriesQueryResult = NonNullable<Awaited<ReturnType<typeof listTimeEntries>>> | |
| export type ListTimeEntriesQueryError = ErrorType<unknown> | |
| /** | |
| * @summary List time entries | |
| */ | |
| export function useListTimeEntries<TData = Awaited<ReturnType<typeof listTimeEntries>>, TError = ErrorType<unknown>>( | |
| params?: ListTimeEntriesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listTimeEntries>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getListTimeEntriesQueryOptions(params,options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getCreateTimeEntryUrl = () => { | |
| return `/api/time-entries` | |
| } | |
| /** | |
| * @summary Log time entry | |
| */ | |
| export const createTimeEntry = async (createTimeEntryBody: CreateTimeEntryBody, options?: RequestInit): Promise<TimeEntry> => { | |
| return customFetch<TimeEntry>(getCreateTimeEntryUrl(), | |
| { | |
| ...options, | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| createTimeEntryBody,) | |
| } | |
| );} | |
| export const getCreateTimeEntryMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTimeEntry>>, TError,{data: BodyType<CreateTimeEntryBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof createTimeEntry>>, TError,{data: BodyType<CreateTimeEntryBody>}, TContext> => { | |
| const mutationKey = ['createTimeEntry']; | |
| 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<typeof createTimeEntry>>, {data: BodyType<CreateTimeEntryBody>}> = (props) => { | |
| const {data} = props ?? {}; | |
| return createTimeEntry(data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type CreateTimeEntryMutationResult = NonNullable<Awaited<ReturnType<typeof createTimeEntry>>> | |
| export type CreateTimeEntryMutationBody = BodyType<CreateTimeEntryBody> | |
| export type CreateTimeEntryMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Log time entry | |
| */ | |
| export const useCreateTimeEntry = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createTimeEntry>>, TError,{data: BodyType<CreateTimeEntryBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof createTimeEntry>>, | |
| TError, | |
| {data: BodyType<CreateTimeEntryBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getCreateTimeEntryMutationOptions(options)); | |
| } | |
| export const getDeleteTimeEntryUrl = (id: number,) => { | |
| return `/api/time-entries/${id}` | |
| } | |
| /** | |
| * @summary Delete a time entry | |
| */ | |
| export const deleteTimeEntry = async (id: number, options?: RequestInit): Promise<void> => { | |
| return customFetch<void>(getDeleteTimeEntryUrl(id), | |
| { | |
| ...options, | |
| method: 'DELETE' | |
| } | |
| );} | |
| export const getDeleteTimeEntryMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTimeEntry>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof deleteTimeEntry>>, TError,{id: number}, TContext> => { | |
| const mutationKey = ['deleteTimeEntry']; | |
| 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<typeof deleteTimeEntry>>, {id: number}> = (props) => { | |
| const {id} = props ?? {}; | |
| return deleteTimeEntry(id,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type DeleteTimeEntryMutationResult = NonNullable<Awaited<ReturnType<typeof deleteTimeEntry>>> | |
| export type DeleteTimeEntryMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Delete a time entry | |
| */ | |
| export const useDeleteTimeEntry = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteTimeEntry>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof deleteTimeEntry>>, | |
| TError, | |
| {id: number}, | |
| TContext | |
| > => { | |
| return useMutation(getDeleteTimeEntryMutationOptions(options)); | |
| } | |
| export const getListBriefsUrl = () => { | |
| return `/api/briefs` | |
| } | |
| /** | |
| * @summary List brief templates | |
| */ | |
| export const listBriefs = async ( options?: RequestInit): Promise<Brief[]> => { | |
| return customFetch<Brief[]>(getListBriefsUrl(), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getListBriefsQueryKey = () => { | |
| return [ | |
| `/api/briefs` | |
| ] as const; | |
| } | |
| export const getListBriefsQueryOptions = <TData = Awaited<ReturnType<typeof listBriefs>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listBriefs>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getListBriefsQueryKey(); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof listBriefs>>> = ({ signal }) => listBriefs({ signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listBriefs>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type ListBriefsQueryResult = NonNullable<Awaited<ReturnType<typeof listBriefs>>> | |
| export type ListBriefsQueryError = ErrorType<unknown> | |
| /** | |
| * @summary List brief templates | |
| */ | |
| export function useListBriefs<TData = Awaited<ReturnType<typeof listBriefs>>, TError = ErrorType<unknown>>( | |
| options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof listBriefs>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getListBriefsQueryOptions(options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getCreateBriefUrl = () => { | |
| return `/api/briefs` | |
| } | |
| /** | |
| * @summary Create a brief template | |
| */ | |
| export const createBrief = async (createBriefBody: CreateBriefBody, options?: RequestInit): Promise<Brief> => { | |
| return customFetch<Brief>(getCreateBriefUrl(), | |
| { | |
| ...options, | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| createBriefBody,) | |
| } | |
| );} | |
| export const getCreateBriefMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createBrief>>, TError,{data: BodyType<CreateBriefBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof createBrief>>, TError,{data: BodyType<CreateBriefBody>}, TContext> => { | |
| const mutationKey = ['createBrief']; | |
| 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<typeof createBrief>>, {data: BodyType<CreateBriefBody>}> = (props) => { | |
| const {data} = props ?? {}; | |
| return createBrief(data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type CreateBriefMutationResult = NonNullable<Awaited<ReturnType<typeof createBrief>>> | |
| export type CreateBriefMutationBody = BodyType<CreateBriefBody> | |
| export type CreateBriefMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Create a brief template | |
| */ | |
| export const useCreateBrief = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createBrief>>, TError,{data: BodyType<CreateBriefBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof createBrief>>, | |
| TError, | |
| {data: BodyType<CreateBriefBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getCreateBriefMutationOptions(options)); | |
| } | |
| export const getUpdateBriefUrl = (id: number,) => { | |
| return `/api/briefs/${id}` | |
| } | |
| /** | |
| * @summary Update a brief | |
| */ | |
| export const updateBrief = async (id: number, | |
| updateBriefBody: UpdateBriefBody, options?: RequestInit): Promise<Brief> => { | |
| return customFetch<Brief>(getUpdateBriefUrl(id), | |
| { | |
| ...options, | |
| method: 'PATCH', | |
| headers: { 'Content-Type': 'application/json', ...options?.headers }, | |
| body: JSON.stringify( | |
| updateBriefBody,) | |
| } | |
| );} | |
| export const getUpdateBriefMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateBrief>>, TError,{id: number;data: BodyType<UpdateBriefBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof updateBrief>>, TError,{id: number;data: BodyType<UpdateBriefBody>}, TContext> => { | |
| const mutationKey = ['updateBrief']; | |
| 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<typeof updateBrief>>, {id: number;data: BodyType<UpdateBriefBody>}> = (props) => { | |
| const {id,data} = props ?? {}; | |
| return updateBrief(id,data,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type UpdateBriefMutationResult = NonNullable<Awaited<ReturnType<typeof updateBrief>>> | |
| export type UpdateBriefMutationBody = BodyType<UpdateBriefBody> | |
| export type UpdateBriefMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Update a brief | |
| */ | |
| export const useUpdateBrief = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateBrief>>, TError,{id: number;data: BodyType<UpdateBriefBody>}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof updateBrief>>, | |
| TError, | |
| {id: number;data: BodyType<UpdateBriefBody>}, | |
| TContext | |
| > => { | |
| return useMutation(getUpdateBriefMutationOptions(options)); | |
| } | |
| export const getDeleteBriefUrl = (id: number,) => { | |
| return `/api/briefs/${id}` | |
| } | |
| /** | |
| * @summary Delete a brief | |
| */ | |
| export const deleteBrief = async (id: number, options?: RequestInit): Promise<void> => { | |
| return customFetch<void>(getDeleteBriefUrl(id), | |
| { | |
| ...options, | |
| method: 'DELETE' | |
| } | |
| );} | |
| export const getDeleteBriefMutationOptions = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteBrief>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationOptions<Awaited<ReturnType<typeof deleteBrief>>, TError,{id: number}, TContext> => { | |
| const mutationKey = ['deleteBrief']; | |
| 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<typeof deleteBrief>>, {id: number}> = (props) => { | |
| const {id} = props ?? {}; | |
| return deleteBrief(id,requestOptions) | |
| } | |
| return { mutationFn, ...mutationOptions }} | |
| export type DeleteBriefMutationResult = NonNullable<Awaited<ReturnType<typeof deleteBrief>>> | |
| export type DeleteBriefMutationError = ErrorType<unknown> | |
| /** | |
| * @summary Delete a brief | |
| */ | |
| export const useDeleteBrief = <TError = ErrorType<unknown>, | |
| TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteBrief>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customFetch>} | |
| ): UseMutationResult< | |
| Awaited<ReturnType<typeof deleteBrief>>, | |
| TError, | |
| {id: number}, | |
| TContext | |
| > => { | |
| return useMutation(getDeleteBriefMutationOptions(options)); | |
| } | |
| export const getGetDashboardStatsUrl = () => { | |
| return `/api/dashboard/stats` | |
| } | |
| /** | |
| * @summary Get dashboard statistics | |
| */ | |
| export const getDashboardStats = async ( options?: RequestInit): Promise<DashboardStats> => { | |
| return customFetch<DashboardStats>(getGetDashboardStatsUrl(), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getGetDashboardStatsQueryKey = () => { | |
| return [ | |
| `/api/dashboard/stats` | |
| ] as const; | |
| } | |
| export const getGetDashboardStatsQueryOptions = <TData = Awaited<ReturnType<typeof getDashboardStats>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDashboardStats>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getGetDashboardStatsQueryKey(); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof getDashboardStats>>> = ({ signal }) => getDashboardStats({ signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getDashboardStats>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type GetDashboardStatsQueryResult = NonNullable<Awaited<ReturnType<typeof getDashboardStats>>> | |
| export type GetDashboardStatsQueryError = ErrorType<unknown> | |
| /** | |
| * @summary Get dashboard statistics | |
| */ | |
| export function useGetDashboardStats<TData = Awaited<ReturnType<typeof getDashboardStats>>, TError = ErrorType<unknown>>( | |
| options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDashboardStats>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getGetDashboardStatsQueryOptions(options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getGetRecentActivityUrl = (params?: GetRecentActivityParams,) => { | |
| const normalizedParams = new URLSearchParams(); | |
| Object.entries(params || {}).forEach(([key, value]) => { | |
| if (value !== undefined) { | |
| normalizedParams.append(key, value === null ? 'null' : value.toString()) | |
| } | |
| }); | |
| const stringifiedParams = normalizedParams.toString(); | |
| return stringifiedParams.length > 0 ? `/api/dashboard/activity?${stringifiedParams}` : `/api/dashboard/activity` | |
| } | |
| /** | |
| * @summary Get recent activity feed | |
| */ | |
| export const getRecentActivity = async (params?: GetRecentActivityParams, options?: RequestInit): Promise<ActivityItem[]> => { | |
| return customFetch<ActivityItem[]>(getGetRecentActivityUrl(params), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getGetRecentActivityQueryKey = (params?: GetRecentActivityParams,) => { | |
| return [ | |
| `/api/dashboard/activity`, ...(params ? [params] : []) | |
| ] as const; | |
| } | |
| export const getGetRecentActivityQueryOptions = <TData = Awaited<ReturnType<typeof getRecentActivity>>, TError = ErrorType<unknown>>(params?: GetRecentActivityParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getRecentActivity>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getGetRecentActivityQueryKey(params); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof getRecentActivity>>> = ({ signal }) => getRecentActivity(params, { signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getRecentActivity>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type GetRecentActivityQueryResult = NonNullable<Awaited<ReturnType<typeof getRecentActivity>>> | |
| export type GetRecentActivityQueryError = ErrorType<unknown> | |
| /** | |
| * @summary Get recent activity feed | |
| */ | |
| export function useGetRecentActivity<TData = Awaited<ReturnType<typeof getRecentActivity>>, TError = ErrorType<unknown>>( | |
| params?: GetRecentActivityParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getRecentActivity>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getGetRecentActivityQueryOptions(params,options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |
| export const getGetUpcomingDeadlinesUrl = () => { | |
| return `/api/dashboard/deadlines` | |
| } | |
| /** | |
| * @summary Get upcoming deadlines | |
| */ | |
| export const getUpcomingDeadlines = async ( options?: RequestInit): Promise<Project[]> => { | |
| return customFetch<Project[]>(getGetUpcomingDeadlinesUrl(), | |
| { | |
| ...options, | |
| method: 'GET' | |
| } | |
| );} | |
| export const getGetUpcomingDeadlinesQueryKey = () => { | |
| return [ | |
| `/api/dashboard/deadlines` | |
| ] as const; | |
| } | |
| export const getGetUpcomingDeadlinesQueryOptions = <TData = Awaited<ReturnType<typeof getUpcomingDeadlines>>, TError = ErrorType<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUpcomingDeadlines>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ) => { | |
| const {query: queryOptions, request: requestOptions} = options ?? {}; | |
| const queryKey = queryOptions?.queryKey ?? getGetUpcomingDeadlinesQueryKey(); | |
| const queryFn: QueryFunction<Awaited<ReturnType<typeof getUpcomingDeadlines>>> = ({ signal }) => getUpcomingDeadlines({ signal, ...requestOptions }); | |
| return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUpcomingDeadlines>>, TError, TData> & { queryKey: QueryKey } | |
| } | |
| export type GetUpcomingDeadlinesQueryResult = NonNullable<Awaited<ReturnType<typeof getUpcomingDeadlines>>> | |
| export type GetUpcomingDeadlinesQueryError = ErrorType<unknown> | |
| /** | |
| * @summary Get upcoming deadlines | |
| */ | |
| export function useGetUpcomingDeadlines<TData = Awaited<ReturnType<typeof getUpcomingDeadlines>>, TError = ErrorType<unknown>>( | |
| options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUpcomingDeadlines>>, TError, TData>, request?: SecondParameter<typeof customFetch>} | |
| ): UseQueryResult<TData, TError> & { queryKey: QueryKey } { | |
| const queryOptions = getGetUpcomingDeadlinesQueryOptions(options) | |
| const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey }; | |
| return { ...query, queryKey: queryOptions.queryKey }; | |
| } | |