@@ -73,6 +73,7 @@ export interface MultinetAxiosInstance extends AxiosInstance {
7373 updateSession ( workspace : string , sessionId : number , type : 'network' | 'table' , state : object ) : AxiosPromise < any > ;
7474 renameSession ( workspace : string , sessionId : number , type : 'network' | 'table' , name : string ) : AxiosPromise < any > ;
7575 getSession ( workspace : string , sessionId : number , type : 'network' | 'table' ) : AxiosPromise < any > ;
76+ generateAltText ( verbosity : string , level : number , explain : string , data : object , title ?: string ) : AxiosPromise < any > ;
7677}
7778
7879export function multinetAxiosInstance ( config : AxiosRequestConfig ) : MultinetAxiosInstance {
@@ -268,5 +269,23 @@ export function multinetAxiosInstance(config: AxiosRequestConfig): MultinetAxios
268269 return this . get ( `workspaces/${ workspace } /sessions/${ type } /${ sessionId } /` ) ;
269270 } ;
270271
272+ Proto . generateAltText = function ( verbosity : string , level : number , explain : string , data : object , title ?: string ) : AxiosPromise < any > {
273+ const jsonString = JSON . stringify ( data ) ;
274+ const blob = new Blob ( [ jsonString ] , { type : 'application/json' } ) ;
275+ const file = new File ( [ blob ] , 'data.json' ) ;
276+
277+ const formData = new FormData ( ) ;
278+
279+ formData . append ( 'verbosity' , verbosity ) ;
280+ formData . append ( 'level' , level . toString ( ) ) ;
281+ formData . append ( 'explain' , explain ) ;
282+ formData . append ( 'data' , file ) ;
283+ if ( title ) {
284+ formData . append ( 'title' , title ) ;
285+ }
286+
287+ return this . post ( `alttxt/` , formData ) ;
288+ } ;
289+
271290 return axiosInstance as MultinetAxiosInstance ;
272291}
0 commit comments