Storage-file-CRUD

2020-08-10  本文已影响0人  Orange_____

存储下文件的文件相关API声明

1.list文件 (GET /api/v0/storage/{id}/files;directory={directory})

1.1 demo

request -> /api/v0/storage/1/directories;directory=/home/test

response ->

{
    "content": [{
        "storageId": 1,
        "storageType": "NAS",
        "protocol": "NFS",
        "name": "Video",
        "isDirectory": true,
        "hasChildren": true,
        "parentDirectory": "/home/test",
        "path": "/home/test/Video",
        "modifiedAt": "2012-02-33",
        "size": "--",
        "owner": "test",
        "children": []
    }, {
        "storageId": 1,
        "storageType": "NAS",
        "protocol": "NFS",
        "name": ".bashrc",
        "isDirectory": false,
        "hasChildren": false,
        "parentDirectory": "/home/test",
        "path": "/home/test/.bashrc",
        "modifiedAt": "2012-02-33",
        "size": "60KB",
        "owner": "test",
        "children": []
    }],
    "pageable": {
        "sort": {
            "unsorted": false,
            "sorted": true,
            "empty": false
        },
        "pageNumber": 0,
        "pageSize": 1000,
        "offset": 0,
        "paged": true,
        "unpaged": false
    },
    "totalPages": 1,
    "totalElements": 6,
    "last": true,
    "first": true,
    "number": 0,
    "sort": {
        "unsorted": false,
        "sorted": true,
        "empty": false
    },
    "numberOfElements": 6,
    "size": 1000,
    "empty": false
}

2. 创建空文件夹 (POST /api/v0/storage/{id}/directories)

2.1 demo

request -> /api/v0/storage/1/directories

{
    "parentDirectory": "/home",
    "name": "foo"
}

3. 删除文件(file/directory) (DELETE /api/v0/storage/{id}/files;path={/test/a.txt})

4. 上传文件(only file) (PUT /api/v0/storage/{id}/files/blob;path={/test/a.txt})

5. 下载文件(only file) (GET /api/v0/storage/{id}/files/blob;path={/test/a.txt})

上一篇下一篇

猜你喜欢

热点阅读