/** * Generated by orval v7.21.0 ๐Ÿบ * Do not edit manually. * Web4Ai API * 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 { GetGuideParams, GetWeatherParams, HTTPValidationError, ListContentsParams, ReqHidePlaceContent, ReqPublishLocalContent, ReqUpdateLocalContent, ResLocalContentList, ResLocalGuide, ResPlaceContentList, ResSyncPlace, ResWeather, } from ".././model"; import { customFetch } from "../../mutator/custom-fetch"; type SecondParameter unknown> = Parameters[1]; /** * @summary ์—…์žฅ ์ฃผ๋ณ€์ •๋ณด ๋ชฉ๋ก (์ˆจ๊น€ ํฌํ•จ) */ export const listPlaceContents = ( placeId: string, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/admin/local-content/place/${placeId}`, method: "GET", signal }, options, ); }; export const getListPlaceContentsQueryKey = (placeId?: string) => { return [`/v1/admin/local-content/place/${placeId}`] as const; }; export const getListPlaceContentsQueryOptions = < TData = Awaited>, TError = HTTPValidationError, >( placeId: string, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getListPlaceContentsQueryKey(placeId); const queryFn: QueryFunction< Awaited> > = ({ signal }) => listPlaceContents(placeId, requestOptions, signal); return { queryKey, queryFn, enabled: !!placeId, ...queryOptions, } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type ListPlaceContentsQueryResult = NonNullable< Awaited> >; export type ListPlaceContentsQueryError = HTTPValidationError; export function useListPlaceContents< TData = Awaited>, TError = HTTPValidationError, >( placeId: string, options: { query: Partial< UseQueryOptions< Awaited>, TError, TData > > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useListPlaceContents< TData = Awaited>, TError = HTTPValidationError, >( placeId: string, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useListPlaceContents< TData = Awaited>, TError = HTTPValidationError, >( placeId: string, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary ์—…์žฅ ์ฃผ๋ณ€์ •๋ณด ๋ชฉ๋ก (์ˆจ๊น€ ํฌํ•จ) */ export function useListPlaceContents< TData = Awaited>, TError = HTTPValidationError, >( placeId: string, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getListPlaceContentsQueryOptions(placeId, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; } /** * ๋นŒ๋“œ๊ฐ€ ๋งค๋ฒˆ ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€ ์ˆ˜์ง‘์„ ์šด์˜์ž๊ฐ€ ์ง์ ‘ ๋ˆ„๋ฅธ๋‹ค. * @summary ์—…์žฅ ์ฃผ๋ณ€์ •๋ณด ์žฌ์ˆ˜์ง‘ (TourAPI ๋ฐ˜๊ฒฝ) */ export const syncPlace = ( placeId: string, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/admin/local-content/place/${placeId}/sync`, method: "POST", signal, }, options, ); }; export const getSyncPlaceMutationOptions = < TError = HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { placeId: string }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { placeId: string }, TContext > => { const mutationKey = ["syncPlace"]; 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>, { placeId: string } > = (props) => { const { placeId } = props ?? {}; return syncPlace(placeId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type SyncPlaceMutationResult = NonNullable< Awaited> >; export type SyncPlaceMutationError = HTTPValidationError; /** * @summary ์—…์žฅ ์ฃผ๋ณ€์ •๋ณด ์žฌ์ˆ˜์ง‘ (TourAPI ๋ฐ˜๊ฒฝ) */ export const useSyncPlace = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { placeId: string }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { placeId: string }, TContext > => { const mutationOptions = getSyncPlaceMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * ์ˆจ๊ธด ํ•ญ๋ชฉ์€ ์žฌ์ˆ˜์ง‘์ด ๋˜์‚ด๋ฆฌ์ง€ ์•Š๋Š”๋‹ค. * @summary ์ฃผ๋ณ€์ •๋ณด ์ˆจ๊น€/ํ•ด์ œ */ export const hidePlaceContent = ( placeContentId: string, reqHidePlaceContent: ReqHidePlaceContent, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/admin/local-content/place-content/${placeContentId}/hide`, method: "POST", headers: { "Content-Type": "application/json" }, data: reqHidePlaceContent, signal, }, options, ); }; export const getHidePlaceContentMutationOptions = < TError = HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { placeContentId: string; data: ReqHidePlaceContent }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { placeContentId: string; data: ReqHidePlaceContent }, TContext > => { const mutationKey = ["hidePlaceContent"]; 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>, { placeContentId: string; data: ReqHidePlaceContent } > = (props) => { const { placeContentId, data } = props ?? {}; return hidePlaceContent(placeContentId, data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type HidePlaceContentMutationResult = NonNullable< Awaited> >; export type HidePlaceContentMutationBody = ReqHidePlaceContent; export type HidePlaceContentMutationError = HTTPValidationError; /** * @summary ์ฃผ๋ณ€์ •๋ณด ์ˆจ๊น€/ํ•ด์ œ */ export const useHidePlaceContent = < TError = HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { placeContentId: string; data: ReqHidePlaceContent }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { placeContentId: string; data: ReqHidePlaceContent }, TContext > => { const mutationOptions = getHidePlaceContentMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary List Contents */ export const listContents = ( params?: ListContentsParams, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/admin/local-content`, method: "GET", params, signal }, options, ); }; export const getListContentsQueryKey = (params?: ListContentsParams) => { return [`/v1/admin/local-content`, ...(params ? [params] : [])] as const; }; export const getListContentsQueryOptions = < TData = Awaited>, TError = HTTPValidationError, >( params?: ListContentsParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getListContentsQueryKey(params); const queryFn: QueryFunction>> = ({ signal, }) => listContents(params, requestOptions, signal); return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type ListContentsQueryResult = NonNullable< Awaited> >; export type ListContentsQueryError = HTTPValidationError; export function useListContents< TData = Awaited>, TError = HTTPValidationError, >( params: undefined | ListContentsParams, options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useListContents< TData = Awaited>, TError = HTTPValidationError, >( params?: ListContentsParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useListContents< TData = Awaited>, TError = HTTPValidationError, >( params?: ListContentsParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary List Contents */ export function useListContents< TData = Awaited>, TError = HTTPValidationError, >( params?: ListContentsParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getListContentsQueryOptions(params, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; } /** * @summary Publish */ export const publish = ( reqPublishLocalContent: ReqPublishLocalContent, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/admin/local-content/publish`, method: "POST", headers: { "Content-Type": "application/json" }, data: reqPublishLocalContent, signal, }, options, ); }; export const getPublishMutationOptions = < TError = HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqPublishLocalContent }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { data: ReqPublishLocalContent }, TContext > => { const mutationKey = ["publish"]; 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: ReqPublishLocalContent } > = (props) => { const { data } = props ?? {}; return publish(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type PublishMutationResult = NonNullable< Awaited> >; export type PublishMutationBody = ReqPublishLocalContent; export type PublishMutationError = HTTPValidationError; /** * @summary Publish */ export const usePublish = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqPublishLocalContent }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { data: ReqPublishLocalContent }, TContext > => { const mutationOptions = getPublishMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary Update Content */ export const updateContent = ( contentId: string, reqUpdateLocalContent: ReqUpdateLocalContent, options?: SecondParameter, ) => { return customFetch( { url: `/v1/admin/local-content/${contentId}`, method: "PATCH", headers: { "Content-Type": "application/json" }, data: reqUpdateLocalContent, }, options, ); }; export const getUpdateContentMutationOptions = < TError = HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { contentId: string; data: ReqUpdateLocalContent }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { contentId: string; data: ReqUpdateLocalContent }, TContext > => { const mutationKey = ["updateContent"]; 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>, { contentId: string; data: ReqUpdateLocalContent } > = (props) => { const { contentId, data } = props ?? {}; return updateContent(contentId, data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type UpdateContentMutationResult = NonNullable< Awaited> >; export type UpdateContentMutationBody = ReqUpdateLocalContent; export type UpdateContentMutationError = HTTPValidationError; /** * @summary Update Content */ export const useUpdateContent = < TError = HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { contentId: string; data: ReqUpdateLocalContent }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { contentId: string; data: ReqUpdateLocalContent }, TContext > => { const mutationOptions = getUpdateContentMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary End Content */ export const endContent = ( contentId: string, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/admin/local-content/${contentId}/end`, method: "POST", signal }, options, ); }; export const getEndContentMutationOptions = < TError = HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { contentId: string }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { contentId: string }, TContext > => { const mutationKey = ["endContent"]; 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>, { contentId: string } > = (props) => { const { contentId } = props ?? {}; return endContent(contentId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type EndContentMutationResult = NonNullable< Awaited> >; export type EndContentMutationError = HTTPValidationError; /** * @summary End Content */ export const useEndContent = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { contentId: string }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { contentId: string }, TContext > => { const mutationOptions = getEndContentMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary ํ˜„์žฌ ๋‚ ์”จ ์กฐํšŒ (cache-aside) */ export const getWeather = ( params: GetWeatherParams, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/local/weather`, method: "GET", params, signal }, options, ); }; export const getGetWeatherQueryKey = (params?: GetWeatherParams) => { return [`/v1/local/weather`, ...(params ? [params] : [])] as const; }; export const getGetWeatherQueryOptions = < TData = Awaited>, TError = HTTPValidationError, >( params: GetWeatherParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetWeatherQueryKey(params); const queryFn: QueryFunction>> = ({ signal, }) => getWeather(params, requestOptions, signal); return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type GetWeatherQueryResult = NonNullable< Awaited> >; export type GetWeatherQueryError = HTTPValidationError; export function useGetWeather< TData = Awaited>, TError = HTTPValidationError, >( params: GetWeatherParams, options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetWeather< TData = Awaited>, TError = HTTPValidationError, >( params: GetWeatherParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetWeather< TData = Awaited>, TError = HTTPValidationError, >( params: GetWeatherParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary ํ˜„์žฌ ๋‚ ์”จ ์กฐํšŒ (cache-aside) */ export function useGetWeather< TData = Awaited>, TError = HTTPValidationError, >( params: GetWeatherParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetWeatherQueryOptions(params, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; } /** * ๋‚ ์”จ์™€ ๊ฐ™์€ ๊ณต๊ฐœ ์กฐํšŒ๋‹ค โ€” ์šด์˜์ž๊ฐ€ ์ˆจ๊ธฐ์ง€ ์•Š์€ ๊ณต๊ณต๋ฐ์ดํ„ฐ๋งŒ ๋‚˜๊ฐ€๋ฏ€๋กœ ์ธ์ฆ์„ ์š”๊ตฌํ•˜์ง€ ์•Š๋Š”๋‹ค. * @summary ์—…์žฅ ์ฃผ๋ณ€ ๊ฐ€์ด๋“œ(๋ง›์ง‘ยท๋ช…์†Œยท์ถ•์ œยท์ฝ”์Šค) โ€” ์—๋””ํ„ฐ ์บ”๋ฒ„์Šค์šฉ */ export const getGuide = ( params: GetGuideParams, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/local/guide`, method: "GET", params, signal }, options, ); }; export const getGetGuideQueryKey = (params?: GetGuideParams) => { return [`/v1/local/guide`, ...(params ? [params] : [])] as const; }; export const getGetGuideQueryOptions = < TData = Awaited>, TError = HTTPValidationError, >( params: GetGuideParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetGuideQueryKey(params); const queryFn: QueryFunction>> = ({ signal, }) => getGuide(params, requestOptions, signal); return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type GetGuideQueryResult = NonNullable< Awaited> >; export type GetGuideQueryError = HTTPValidationError; export function useGetGuide< TData = Awaited>, TError = HTTPValidationError, >( params: GetGuideParams, options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetGuide< TData = Awaited>, TError = HTTPValidationError, >( params: GetGuideParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetGuide< TData = Awaited>, TError = HTTPValidationError, >( params: GetGuideParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary ์—…์žฅ ์ฃผ๋ณ€ ๊ฐ€์ด๋“œ(๋ง›์ง‘ยท๋ช…์†Œยท์ถ•์ œยท์ฝ”์Šค) โ€” ์—๋””ํ„ฐ ์บ”๋ฒ„์Šค์šฉ */ export function useGetGuide< TData = Awaited>, TError = HTTPValidationError, >( params: GetGuideParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetGuideQueryOptions(params, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; }