@@ -24,6 +24,8 @@ import type {
2424 AddImageLayerResponse ,
2525 AppConfig ,
2626 AppEvent ,
27+ ImportTranslationsRequest ,
28+ ImportTranslationsResponse ,
2729 CodexAuthStatus ,
2830 CodexDeviceLogin ,
2931 CodexImageGenerationOptions ,
@@ -3310,6 +3312,83 @@ export const useImportProject = <TError = unknown, TContext = unknown>(
33103312) : UseMutationResult < Awaited < ReturnType < typeof importProject > > , TError , void , TContext > => {
33113313 return useMutation ( getImportProjectMutationOptions ( options ) , queryClient )
33123314}
3315+ export const getImportTranslationsUrl = ( ) => {
3316+ return `/api/v1/projects/current/import-translations`
3317+ }
3318+
3319+ export const importTranslations = async (
3320+ importTranslationsRequest : ImportTranslationsRequest ,
3321+ options ?: RequestInit ,
3322+ ) : Promise < ImportTranslationsResponse > => {
3323+ return fetchApi < ImportTranslationsResponse > ( getImportTranslationsUrl ( ) , {
3324+ ...options ,
3325+ method : 'POST' ,
3326+ headers : { 'Content-Type' : 'application/json' , ...options ?. headers } ,
3327+ body : JSON . stringify ( importTranslationsRequest ) ,
3328+ } )
3329+ }
3330+
3331+ export const getImportTranslationsMutationOptions = <
3332+ TError = unknown ,
3333+ TContext = unknown ,
3334+ > ( options ?: {
3335+ mutation ?: UseMutationOptions <
3336+ Awaited < ReturnType < typeof importTranslations > > ,
3337+ TError ,
3338+ { data : ImportTranslationsRequest } ,
3339+ TContext
3340+ >
3341+ request ?: SecondParameter < typeof fetchApi >
3342+ } ) : UseMutationOptions <
3343+ Awaited < ReturnType < typeof importTranslations > > ,
3344+ TError ,
3345+ { data : ImportTranslationsRequest } ,
3346+ TContext
3347+ > => {
3348+ const mutationKey = [ 'importTranslations' ]
3349+ const { mutation : mutationOptions , request : requestOptions } = options
3350+ ? options . mutation && 'mutationKey' in options . mutation && options . mutation . mutationKey
3351+ ? options
3352+ : { ...options , mutation : { ...options . mutation , mutationKey } }
3353+ : { mutation : { mutationKey } , request : undefined }
3354+
3355+ const mutationFn : MutationFunction <
3356+ Awaited < ReturnType < typeof importTranslations > > ,
3357+ { data : ImportTranslationsRequest }
3358+ > = ( props ) => {
3359+ const { data } = props ?? { }
3360+
3361+ return importTranslations ( data , requestOptions )
3362+ }
3363+
3364+ return { mutationFn, ...mutationOptions }
3365+ }
3366+
3367+ export type ImportTranslationsMutationResult = NonNullable <
3368+ Awaited < ReturnType < typeof importTranslations > >
3369+ >
3370+ export type ImportTranslationsMutationBody = ImportTranslationsRequest
3371+ export type ImportTranslationsMutationError = unknown
3372+
3373+ export const useImportTranslations = < TError = unknown , TContext = unknown > (
3374+ options ?: {
3375+ mutation ?: UseMutationOptions <
3376+ Awaited < ReturnType < typeof importTranslations > > ,
3377+ TError ,
3378+ { data : ImportTranslationsRequest } ,
3379+ TContext
3380+ >
3381+ request ?: SecondParameter < typeof fetchApi >
3382+ } ,
3383+ queryClient ?: QueryClient ,
3384+ ) : UseMutationResult <
3385+ Awaited < ReturnType < typeof importTranslations > > ,
3386+ TError ,
3387+ { data : ImportTranslationsRequest } ,
3388+ TContext
3389+ > => {
3390+ return useMutation ( getImportTranslationsMutationOptions ( options ) , queryClient )
3391+ }
33133392export const getDeleteProjectUrl = ( id : string ) => {
33143393 return `/api/v1/projects/${ id } `
33153394}
0 commit comments