/** * 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 { HTTPValidationError, ReqGoogleLogin, ReqKakaoLogin, ReqLogin, ReqSignup, ReqUpdateMe, ResLogin, ResMe, ResRefreshToken, } from ".././model"; import { customFetch } from "../../mutator/custom-fetch"; type SecondParameter unknown> = Parameters[1]; /** * id/pw ๋กœ ๋กœ๊ทธ์ธํ•˜๊ณ  JWT ํ† ํฐ์„ ๋ฐœ๊ธ‰ํ•œ๋‹ค. * @summary ๋กœ๊ทธ์ธ */ export const login = ( reqLogin: ReqLogin, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/auth/login`, method: "POST", headers: { "Content-Type": "application/json" }, data: reqLogin, signal, }, options, ); }; export const getLoginMutationOptions = < TError = void | HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqLogin }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { data: ReqLogin }, TContext > => { const mutationKey = ["login"]; 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: ReqLogin } > = (props) => { const { data } = props ?? {}; return login(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type LoginMutationResult = NonNullable< Awaited> >; export type LoginMutationBody = ReqLogin; export type LoginMutationError = void | HTTPValidationError; /** * @summary ๋กœ๊ทธ์ธ */ export const useLogin = < TError = void | HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqLogin }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { data: ReqLogin }, TContext > => { const mutationOptions = getLoginMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * id/pw ๋กœ ๊ฐ€์ž…ํ•œ๋‹ค. ํšŒ์‚ฌ(ํ…Œ๋„ŒํŠธ) 1๊ฐœ๊ฐ€ ํ•จ๊ป˜ ์ƒ๊ธฐ๊ณ , ์„ฑ๊ณตํ•˜๋ฉด ๊ณง๋ฐ”๋กœ ๋กœ๊ทธ์ธ ํ† ํฐ์„ ๋ฐœ๊ธ‰ํ•œ๋‹ค. * @summary ํšŒ์›๊ฐ€์ž… */ export const signup = ( reqSignup: ReqSignup, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/auth/signup`, method: "POST", headers: { "Content-Type": "application/json" }, data: reqSignup, signal, }, options, ); }; export const getSignupMutationOptions = < TError = void | HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqSignup }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { data: ReqSignup }, TContext > => { const mutationKey = ["signup"]; 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: ReqSignup } > = (props) => { const { data } = props ?? {}; return signup(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type SignupMutationResult = NonNullable< Awaited> >; export type SignupMutationBody = ReqSignup; export type SignupMutationError = void | HTTPValidationError; /** * @summary ํšŒ์›๊ฐ€์ž… */ export const useSignup = < TError = void | HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqSignup }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { data: ReqSignup }, TContext > => { const mutationOptions = getSignupMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * ๊ตฌ๊ธ€ ID ํ† ํฐ(GIS credential)์„ ๊ฒ€์ฆํ•˜๊ณ  JWT ํ† ํฐ์„ ๋ฐœ๊ธ‰ํ•œ๋‹ค. ์ฒ˜์Œ ์˜จ ๊ณ„์ •์€ ๊ทธ ์ž๋ฆฌ์—์„œ ๋งŒ๋“ ๋‹ค. * @summary ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ */ export const googleLogin = ( reqGoogleLogin: ReqGoogleLogin, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/auth/google`, method: "POST", headers: { "Content-Type": "application/json" }, data: reqGoogleLogin, signal, }, options, ); }; export const getGoogleLoginMutationOptions = < TError = void | HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqGoogleLogin }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { data: ReqGoogleLogin }, TContext > => { const mutationKey = ["googleLogin"]; 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: ReqGoogleLogin } > = (props) => { const { data } = props ?? {}; return googleLogin(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type GoogleLoginMutationResult = NonNullable< Awaited> >; export type GoogleLoginMutationBody = ReqGoogleLogin; export type GoogleLoginMutationError = void | HTTPValidationError; /** * @summary ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ */ export const useGoogleLogin = < TError = void | HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqGoogleLogin }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { data: ReqGoogleLogin }, TContext > => { const mutationOptions = getGoogleLoginMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * ์นด์นด์˜ค **์ธ๊ฐ€ ์ฝ”๋“œ**๋ฅผ ์„œ๋ฒ„๊ฐ€ ํ† ํฐ์œผ๋กœ ๊ตํ™˜ํ•ด ์‹ ์›์„ ํ™•์ธํ•˜๊ณ  JWT ๋ฅผ ๋ฐœ๊ธ‰ํ•œ๋‹ค. ์ฒ˜์Œ ์˜จ ๊ณ„์ •์€ ๊ทธ ์ž๋ฆฌ์—์„œ ๋งŒ๋“ ๋‹ค. โ˜… ์ฝ”๋“œ๋Š” 1ํšŒ์šฉ์ด๋ผ ๊ฐ™์€ ๊ฐ’์œผ๋กœ ๋‘ ๋ฒˆ ๋ถ€๋ฅด๋ฉด ์‹คํŒจํ•œ๋‹ค. โ˜… ์ฑ—๋ด‡์— ๋ฌผ๋ฆฐ ์•ฑ๊ณผ ๊ฐ™์€ ์•ฑ์ด์–ด์•ผ ํ•œ๋‹ค โ€” ํšŒ์›๋ฒˆํ˜ธ๊ฐ€ ์ฑ—๋ด‡ ์›นํ›…์˜ appUserId ์™€ ๊ฐ™์€ ๊ฐ’์ด๋ผ, ๊ทธ๋ž˜์•ผ ์นดํ†ก ์ฑ„๋„ ๋ฐœํ™”์ž์™€ ์ด ๊ณ„์ •์ด ์ž๋™์œผ๋กœ ์ด์–ด์ง„๋‹ค(docs/AGENT.md). * @summary ์นด์นด์˜ค ๋กœ๊ทธ์ธ */ export const kakaoLogin = ( reqKakaoLogin: ReqKakaoLogin, options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/auth/kakao`, method: "POST", headers: { "Content-Type": "application/json" }, data: reqKakaoLogin, signal, }, options, ); }; export const getKakaoLoginMutationOptions = < TError = void | HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqKakaoLogin }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { data: ReqKakaoLogin }, TContext > => { const mutationKey = ["kakaoLogin"]; 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: ReqKakaoLogin } > = (props) => { const { data } = props ?? {}; return kakaoLogin(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type KakaoLoginMutationResult = NonNullable< Awaited> >; export type KakaoLoginMutationBody = ReqKakaoLogin; export type KakaoLoginMutationError = void | HTTPValidationError; /** * @summary ์นด์นด์˜ค ๋กœ๊ทธ์ธ */ export const useKakaoLogin = < TError = void | HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqKakaoLogin }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { data: ReqKakaoLogin }, TContext > => { const mutationOptions = getKakaoLoginMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * refresh ํ† ํฐ์œผ๋กœ access ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ํ•œ๋‹ค. * @summary ์•ก์„ธ์Šค ํ† ํฐ ๊ฐฑ์‹  */ export const refreshToken = ( options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/auth/refresh_token`, method: "POST", signal }, options, ); }; export const getRefreshTokenMutationOptions = < TError = void, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, void, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, void, TContext > => { const mutationKey = ["refreshToken"]; 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>, void > = () => { return refreshToken(requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type RefreshTokenMutationResult = NonNullable< Awaited> >; export type RefreshTokenMutationError = void; /** * @summary ์•ก์„ธ์Šค ํ† ํฐ ๊ฐฑ์‹  */ export const useRefreshToken = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, void, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, void, TContext > => { const mutationOptions = getRefreshTokenMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * ์œ ํšจํ•œ access ํ† ํฐ์ด ์žˆ์–ด์•ผ ํ˜ธ์ถœ ๊ฐ€๋Šฅ. ํ† ํฐ์˜ ์œ ์ €+ํšŒ์‚ฌ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. * @summary ๋‚ด ์ •๋ณด */ export const me = ( options?: SecondParameter, signal?: AbortSignal, ) => { return customFetch( { url: `/v1/auth/me`, method: "GET", signal }, options, ); }; export const getMeQueryKey = () => { return [`/v1/auth/me`] as const; }; export const getMeQueryOptions = < TData = Awaited>, TError = void, >(options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getMeQueryKey(); const queryFn: QueryFunction>> = ({ signal }) => me(requestOptions, signal); return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type MeQueryResult = NonNullable>>; export type MeQueryError = void; export function useMe>, TError = void>( options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useMe>, TError = void>( options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useMe>, TError = void>( options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary ๋‚ด ์ •๋ณด */ export function useMe>, TError = void>( options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getMeQueryOptions(options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; } /** * ๋ณธ์ธ ์ด๋ฆ„/์ด๋ฉ”์ผ/์—ฐ๋ฝ์ฒ˜/๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ˆ˜์ •ํ•œ๋‹ค(๊ถŒํ•œยท์†Œ์†ยทID ๋ณ€๊ฒฝ ๋ถˆ๊ฐ€). * @summary ๋‚ด ์ •๋ณด ์ˆ˜์ • */ export const updateMe = ( reqUpdateMe: ReqUpdateMe, options?: SecondParameter, ) => { return customFetch( { url: `/v1/auth/me`, method: "PATCH", headers: { "Content-Type": "application/json" }, data: reqUpdateMe, }, options, ); }; export const getUpdateMeMutationOptions = < TError = void | HTTPValidationError, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqUpdateMe }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { data: ReqUpdateMe }, TContext > => { const mutationKey = ["updateMe"]; 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: ReqUpdateMe } > = (props) => { const { data } = props ?? {}; return updateMe(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type UpdateMeMutationResult = NonNullable< Awaited> >; export type UpdateMeMutationBody = ReqUpdateMe; export type UpdateMeMutationError = void | HTTPValidationError; /** * @summary ๋‚ด ์ •๋ณด ์ˆ˜์ • */ export const useUpdateMe = < TError = void | HTTPValidationError, TContext = unknown, >( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: ReqUpdateMe }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { data: ReqUpdateMe }, TContext > => { const mutationOptions = getUpdateMeMutationOptions(options); return useMutation(mutationOptions, queryClient); };