194 lines
6.5 KiB
TypeScript
194 lines
6.5 KiB
TypeScript
/**
|
|
* Generated by orval v7.21.0 🍺
|
|
* Do not edit manually.
|
|
* Negodata Api Server
|
|
* OpenAPI spec version: 0.1.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,
|
|
ReqUpdateCompanySettings,
|
|
ResCompanySettings
|
|
} from '.././model';
|
|
|
|
import { customFetch } from '../../mutator/custom-fetch';
|
|
|
|
|
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
|
|
|
|
|
|
/**
|
|
* @summary 회사 커스터마이징 설정 조회
|
|
*/
|
|
export const getSettings = (
|
|
|
|
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customFetch<ResCompanySettings>(
|
|
{url: `/v1/company/settings`, method: 'GET', signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getGetSettingsQueryKey = () => {
|
|
return [
|
|
`/v1/company/settings`
|
|
] as const;
|
|
}
|
|
|
|
|
|
export const getGetSettingsQueryOptions = <TData = Awaited<ReturnType<typeof getSettings>>, TError = void>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSettings>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
|
) => {
|
|
|
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
|
|
const queryKey = queryOptions?.queryKey ?? getGetSettingsQueryKey();
|
|
|
|
|
|
|
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSettings>>> = ({ signal }) => getSettings(requestOptions, signal);
|
|
|
|
|
|
|
|
|
|
|
|
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSettings>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
}
|
|
|
|
export type GetSettingsQueryResult = NonNullable<Awaited<ReturnType<typeof getSettings>>>
|
|
export type GetSettingsQueryError = void
|
|
|
|
|
|
export function useGetSettings<TData = Awaited<ReturnType<typeof getSettings>>, TError = void>(
|
|
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSettings>>, TError, TData>> & Pick<
|
|
DefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof getSettings>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof getSettings>>
|
|
> , 'initialData'
|
|
>, request?: SecondParameter<typeof customFetch>}
|
|
, queryClient?: QueryClient
|
|
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
export function useGetSettings<TData = Awaited<ReturnType<typeof getSettings>>, TError = void>(
|
|
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSettings>>, TError, TData>> & Pick<
|
|
UndefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof getSettings>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof getSettings>>
|
|
> , 'initialData'
|
|
>, request?: SecondParameter<typeof customFetch>}
|
|
, queryClient?: QueryClient
|
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
export function useGetSettings<TData = Awaited<ReturnType<typeof getSettings>>, TError = void>(
|
|
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSettings>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
|
, queryClient?: QueryClient
|
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
/**
|
|
* @summary 회사 커스터마이징 설정 조회
|
|
*/
|
|
|
|
export function useGetSettings<TData = Awaited<ReturnType<typeof getSettings>>, TError = void>(
|
|
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSettings>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
|
, queryClient?: QueryClient
|
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
|
|
const queryOptions = getGetSettingsQueryOptions(options)
|
|
|
|
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
|
|
query.queryKey = queryOptions.queryKey ;
|
|
|
|
return query;
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @summary 회사 커스터마이징 설정 수정(최고관리자)
|
|
*/
|
|
export const updateSettings = (
|
|
reqUpdateCompanySettings: ReqUpdateCompanySettings,
|
|
options?: SecondParameter<typeof customFetch>,) => {
|
|
|
|
|
|
return customFetch<ResCompanySettings>(
|
|
{url: `/v1/company/settings/update`, method: 'PUT',
|
|
headers: {'Content-Type': 'application/json', },
|
|
data: reqUpdateCompanySettings
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getUpdateSettingsMutationOptions = <TError = void | HTTPValidationError,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateSettings>>, TError,{data: ReqUpdateCompanySettings}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof updateSettings>>, TError,{data: ReqUpdateCompanySettings}, TContext> => {
|
|
|
|
const mutationKey = ['updateSettings'];
|
|
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 updateSettings>>, {data: ReqUpdateCompanySettings}> = (props) => {
|
|
const {data} = props ?? {};
|
|
|
|
return updateSettings(data,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type UpdateSettingsMutationResult = NonNullable<Awaited<ReturnType<typeof updateSettings>>>
|
|
export type UpdateSettingsMutationBody = ReqUpdateCompanySettings
|
|
export type UpdateSettingsMutationError = void | HTTPValidationError
|
|
|
|
/**
|
|
* @summary 회사 커스터마이징 설정 수정(최고관리자)
|
|
*/
|
|
export const useUpdateSettings = <TError = void | HTTPValidationError,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateSettings>>, TError,{data: ReqUpdateCompanySettings}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof updateSettings>>,
|
|
TError,
|
|
{data: ReqUpdateCompanySettings},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getUpdateSettingsMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|