/** * 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, ListCardsParams, ReqCreateCard, ReqUpdateCard, ResCard, ResCardList, ResDeleteCard } from '.././model'; import { customFetch } from '../../mutator/custom-fetch'; type SecondParameter unknown> = Parameters[1]; /** * @summary ν˜‘μƒμΉ΄λ“œ λͺ©λ‘ */ export const listCards = ( params?: ListCardsParams, options?: SecondParameter,signal?: AbortSignal ) => { return customFetch( {url: `/v1/card/list`, method: 'GET', params, signal }, options); } export const getListCardsQueryKey = (params?: ListCardsParams,) => { return [ `/v1/card/list`, ...(params ? [params]: []) ] as const; } export const getListCardsQueryOptions = >, TError = void | HTTPValidationError>(params?: ListCardsParams, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} ) => { const {query: queryOptions, request: requestOptions} = options ?? {}; const queryKey = queryOptions?.queryKey ?? getListCardsQueryKey(params); const queryFn: QueryFunction>> = ({ signal }) => listCards(params, requestOptions, signal); return { queryKey, queryFn, ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag } } export type ListCardsQueryResult = NonNullable>> export type ListCardsQueryError = void | HTTPValidationError export function useListCards>, TError = void | HTTPValidationError>( params: undefined | ListCardsParams, options: { query:Partial>, TError, TData>> & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> > , 'initialData' >, request?: SecondParameter} , queryClient?: QueryClient ): DefinedUseQueryResult & { queryKey: DataTag } export function useListCards>, TError = void | HTTPValidationError>( params?: ListCardsParams, options?: { query?:Partial>, TError, TData>> & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> > , 'initialData' >, request?: SecondParameter} , queryClient?: QueryClient ): UseQueryResult & { queryKey: DataTag } export function useListCards>, TError = void | HTTPValidationError>( params?: ListCardsParams, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} , queryClient?: QueryClient ): UseQueryResult & { queryKey: DataTag } /** * @summary ν˜‘μƒμΉ΄λ“œ λͺ©λ‘ */ export function useListCards>, TError = void | HTTPValidationError>( params?: ListCardsParams, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} , queryClient?: QueryClient ): UseQueryResult & { queryKey: DataTag } { const queryOptions = getListCardsQueryOptions(params,options) const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey ; return query; } /** * @summary ν˜‘μƒμΉ΄λ“œ 등둝 */ export const createCard = ( reqCreateCard: ReqCreateCard, options?: SecondParameter,signal?: AbortSignal ) => { return customFetch( {url: `/v1/card/create`, method: 'POST', headers: {'Content-Type': 'application/json', }, data: reqCreateCard, signal }, options); } export const getCreateCardMutationOptions = (options?: { mutation?:UseMutationOptions>, TError,{data: ReqCreateCard}, TContext>, request?: SecondParameter} ): UseMutationOptions>, TError,{data: ReqCreateCard}, TContext> => { const mutationKey = ['createCard']; 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>, {data: ReqCreateCard}> = (props) => { const {data} = props ?? {}; return createCard(data,requestOptions) } return { mutationFn, ...mutationOptions }} export type CreateCardMutationResult = NonNullable>> export type CreateCardMutationBody = ReqCreateCard export type CreateCardMutationError = void | HTTPValidationError /** * @summary ν˜‘μƒμΉ΄λ“œ 등둝 */ export const useCreateCard = (options?: { mutation?:UseMutationOptions>, TError,{data: ReqCreateCard}, TContext>, request?: SecondParameter} , queryClient?: QueryClient): UseMutationResult< Awaited>, TError, {data: ReqCreateCard}, TContext > => { const mutationOptions = getCreateCardMutationOptions(options); return useMutation(mutationOptions, queryClient); } /** * @summary ν˜‘μƒμΉ΄λ“œ 쑰회 */ export const getCard = ( cardId: string, options?: SecondParameter,signal?: AbortSignal ) => { return customFetch( {url: `/v1/card/${cardId}`, method: 'GET', signal }, options); } export const getGetCardQueryKey = (cardId?: string,) => { return [ `/v1/card/${cardId}` ] as const; } export const getGetCardQueryOptions = >, TError = void | HTTPValidationError>(cardId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} ) => { const {query: queryOptions, request: requestOptions} = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetCardQueryKey(cardId); const queryFn: QueryFunction>> = ({ signal }) => getCard(cardId, requestOptions, signal); return { queryKey, queryFn, enabled: !!(cardId), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag } } export type GetCardQueryResult = NonNullable>> export type GetCardQueryError = void | HTTPValidationError export function useGetCard>, TError = void | HTTPValidationError>( cardId: string, options: { query:Partial>, TError, TData>> & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> > , 'initialData' >, request?: SecondParameter} , queryClient?: QueryClient ): DefinedUseQueryResult & { queryKey: DataTag } export function useGetCard>, TError = void | HTTPValidationError>( cardId: string, options?: { query?:Partial>, TError, TData>> & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> > , 'initialData' >, request?: SecondParameter} , queryClient?: QueryClient ): UseQueryResult & { queryKey: DataTag } export function useGetCard>, TError = void | HTTPValidationError>( cardId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} , queryClient?: QueryClient ): UseQueryResult & { queryKey: DataTag } /** * @summary ν˜‘μƒμΉ΄λ“œ 쑰회 */ export function useGetCard>, TError = void | HTTPValidationError>( cardId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} , queryClient?: QueryClient ): UseQueryResult & { queryKey: DataTag } { const queryOptions = getGetCardQueryOptions(cardId,options) const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey ; return query; } /** * @summary ν˜‘μƒμΉ΄λ“œ μˆ˜μ • */ export const updateCard = ( cardId: string, reqUpdateCard: ReqUpdateCard, options?: SecondParameter,) => { return customFetch( {url: `/v1/card/update/${cardId}`, method: 'PATCH', headers: {'Content-Type': 'application/json', }, data: reqUpdateCard }, options); } export const getUpdateCardMutationOptions = (options?: { mutation?:UseMutationOptions>, TError,{cardId: string;data: ReqUpdateCard}, TContext>, request?: SecondParameter} ): UseMutationOptions>, TError,{cardId: string;data: ReqUpdateCard}, TContext> => { const mutationKey = ['updateCard']; 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>, {cardId: string;data: ReqUpdateCard}> = (props) => { const {cardId,data} = props ?? {}; return updateCard(cardId,data,requestOptions) } return { mutationFn, ...mutationOptions }} export type UpdateCardMutationResult = NonNullable>> export type UpdateCardMutationBody = ReqUpdateCard export type UpdateCardMutationError = void | HTTPValidationError /** * @summary ν˜‘μƒμΉ΄λ“œ μˆ˜μ • */ export const useUpdateCard = (options?: { mutation?:UseMutationOptions>, TError,{cardId: string;data: ReqUpdateCard}, TContext>, request?: SecondParameter} , queryClient?: QueryClient): UseMutationResult< Awaited>, TError, {cardId: string;data: ReqUpdateCard}, TContext > => { const mutationOptions = getUpdateCardMutationOptions(options); return useMutation(mutationOptions, queryClient); } /** * @summary ν˜‘μƒμΉ΄λ“œ μ‚­μ œ */ export const deleteCard = ( cardId: string, options?: SecondParameter,) => { return customFetch( {url: `/v1/card/delete/${cardId}`, method: 'DELETE' }, options); } export const getDeleteCardMutationOptions = (options?: { mutation?:UseMutationOptions>, TError,{cardId: string}, TContext>, request?: SecondParameter} ): UseMutationOptions>, TError,{cardId: string}, TContext> => { const mutationKey = ['deleteCard']; 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>, {cardId: string}> = (props) => { const {cardId} = props ?? {}; return deleteCard(cardId,requestOptions) } return { mutationFn, ...mutationOptions }} export type DeleteCardMutationResult = NonNullable>> export type DeleteCardMutationError = void | HTTPValidationError /** * @summary ν˜‘μƒμΉ΄λ“œ μ‚­μ œ */ export const useDeleteCard = (options?: { mutation?:UseMutationOptions>, TError,{cardId: string}, TContext>, request?: SecondParameter} , queryClient?: QueryClient): UseMutationResult< Awaited>, TError, {cardId: string}, TContext > => { const mutationOptions = getDeleteCardMutationOptions(options); return useMutation(mutationOptions, queryClient); }