Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workspaces catalog trees api #361

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 71 additions & 2 deletions src/dtable-web-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,74 @@ class DTableWebAPI {
return this.req.delete(url);
}

// folder structure api
Michael18811380328 marked this conversation as resolved.
Show resolved Hide resolved
listFolderStructure(workspaceID, path) {
const url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/folders/?path=' + path;
return this.req.get(url);
}

createFolderStructure(workspaceID, parentFolderPath, newFolderName) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/folders/';
let form = new FormData();
form.append('dst_parent_folder', parentFolderPath);
form.append('new_folder_name', newFolderName);
return this._sendPostRequest(url, form);
}

renameFolderStructure(workspaceID, folderName, newFolderName, parentFolderPath) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/folders/';
let form = new FormData();
form.append('folder_name', folderName);
form.append('new_folder_name', newFolderName);
form.append('src_parent_folder', parentFolderPath);
return this.req.put(url, form);
}

moveFolderStructure(workspaceID, folderName, srcParentFolder, dstParentFolder) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/folders/';
let form = new FormData();
form.append('folder_name', folderName);
form.append('src_parent_folder', srcParentFolder);
form.append('dst_parent_folder', dstParentFolder);
return this.req.put(url, form);
}

deleteFolderStructure(workspaceID, folderName, parentFolderPath) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/folders/';
let params = {
folder_name: folderName,
src_parent_folder: parentFolderPath,
};
return this.req.delete(url, {data: params});
}

// base structure api
createBaseStructure(workspaceID, baseName, parentFolderName) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/bases/';
let form = new FormData();
form.append('base_name', baseName);
form.append('dst_parent_folder', parentFolderName);
return this._sendPostRequest(url, form);
}

moveBaseStructure(workspaceID, baseName, srcParentFolder, dstParentFolder) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/bases/';
let form = new FormData();
form.append('base_name', baseName);
form.append('src_parent_folder', srcParentFolder);
form.append('dst_parent_folder', dstParentFolder);
return this.req.put(url, form);
}

deleteBaseStructure(workspaceID, baseName, srcParentFolder) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/structure/bases/';
let params = {
base_name: baseName,
src_parent_folder: srcParentFolder,
};
return this.req.delete(url, {data: params});
}

// ---- dTable api
createTable(name, owner, dtableIcon, dtableColor, textColor, folderID) {
const url = this.server + '/api/v2.1/dtables/';
Expand Down Expand Up @@ -961,9 +1029,10 @@ class DTableWebAPI {
return this.req.put(url, form);
}

deleteFolder(workspaceID, folderID) {
deleteFolder(workspaceID, folderID, srcParentFolder) {
let url = this.server + '/api/v2.1/workspace/' + workspaceID + '/folders/' + folderID +'/';
return this.req.delete(url);
let params = {src_parent_folder: srcParentFolder};
return this.req.delete(url, {data: params});
}

moveFolderItem(workspaceID, itemType, itemID, moveFrom, moveTo) {
Expand Down