From a73e6ff18016b7b299dfaf2dd26de382bd90529b Mon Sep 17 00:00:00 2001 From: Jack Wilburn Date: Tue, 9 Jan 2024 16:23:16 -0700 Subject: [PATCH] Make the multinetjs library work with the structured data --- src/axios.ts | 7 +++---- src/index.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/axios.ts b/src/axios.ts index 87833fe..dd442cb 100644 --- a/src/axios.ts +++ b/src/axios.ts @@ -73,7 +73,7 @@ export interface MultinetAxiosInstance extends AxiosInstance { updateSession(workspace: string, sessionId: number, type: 'network' | 'table', state: object): AxiosPromise; renameSession(workspace: string, sessionId: number, type: 'network' | 'table', name: string): AxiosPromise; getSession(workspace: string, sessionId: number, type: 'network' | 'table'): AxiosPromise; - generateAltText(verbosity: string, level: number, explain: string, data: object, title?: string): AxiosPromise; + generateAltText(level: number, structured: boolean, data: object, title?: string): AxiosPromise; networkBuildRequests(workspace: string): AxiosPromise; } @@ -270,16 +270,15 @@ export function multinetAxiosInstance(config: AxiosRequestConfig): MultinetAxios return this.get(`workspaces/${workspace}/sessions/${type}/${sessionId}/`); }; - Proto.generateAltText = function(verbosity: string, level: number, explain: string, data: object, title?: string): AxiosPromise { + Proto.generateAltText = function(level: number, structured: boolean, data: object, title?: string): AxiosPromise { const jsonString = JSON.stringify(data); const blob = new Blob([jsonString], { type: 'application/json' }); const file = new File([blob], 'data.json'); const formData = new FormData(); - formData.append('verbosity', verbosity); + formData.append('structured', structured.toString()); formData.append('level', level.toString()); - formData.append('explain', explain); formData.append('data', file); if (title) { formData.append('title', title); diff --git a/src/index.ts b/src/index.ts index 7c7ad87..0a36394 100644 --- a/src/index.ts +++ b/src/index.ts @@ -285,8 +285,8 @@ class MultinetAPI { return (await this.axios.getSession(workspace, sessionId, type)).data; } - public async generateAltText(verbosity: string, level: number, explain: string, data: object, title?: string): Promise { - return (await this.axios.generateAltText(verbosity, level, explain, data, title)).data; + public async generateAltText(level: number, structured: boolean, data: object, title?: string): Promise { + return (await this.axios.generateAltText(level, structured, data, title)).data; } public async networkBuildRequests(workspace: string): Promise {