檔案授權和共用的一些操作方法。
請求參數中的 options: IPDSRequestConfig 基於 axios 的 request config 封裝,詳情請看:AxiosRequestConfig。
listSharingFiles 方法
查詢我的共用檔案清單
const result = await client.listSharingFiles(params, options)參數說明
欄位 | 類型 | 必選 | 說明 |
params | IListReq | 否 | 預設為 {} |
options | IPDSRequestConfig | 否 | 其它配置項 |
IListReq
欄位 | 類型 | 必選 | 說明 |
limit | number | 是 | 一次查詢多少條資料 |
marker | string | 是 | 標記 |
返回
欄位 | 類型 | 必選 | 說明 |
result | IListRes<IFileItem> | 是 | 返回結果 |
IListRes
欄位 | 類型 | 必選 | 說明 |
items | array | 是 | 查詢到的檔案資訊列表,items 中每一項的具體欄位可查看 IFileItem 的說明 |
next_marker | string | 是 | 分頁標記 |
punished_file_count | number | 否 | 檔案夾會返回 |
IFileItem
欄位 | 類型 | 必選 | 說明 |
action_list | string[] | 否 | 許可權列表 |
created_at | Date | 是 | 建立時間 |
creator_id | string | 否 | 建立人的id |
creator_name | string | 否 | 建立人的名稱 |
creator_type | string | 否 | 建立人的類型 |
domain_id | string | 是 | domain ID |
drive_id | string | 是 | 雲端硬碟id |
encrypt_mode | string | 否 | 是否以加密形式分享 |
file_id | string | 否 | 檔案id |
hidden | boolean | 否 | 顯示隱藏 |
last_modifier_id | string | 否 | 修改人的id |
last_modifier_name | string | 否 | 修改人的名稱 |
last_modifier_type | string | 否 | 修改人的類型 |
name | string | 否 | 檔案名稱 |
parent_file_id | string | 否 | 上一級目錄id |
revision_id | string | 否 | 版本 |
starred | boolean | 否 | 是否收藏, true 是 |
status | string | 是 | 檔案狀態, available | enabled |
type | string | 否 | 檔案類型 folder |
updated_at | Date | 是 | 檔案更新時間 |
listReceivedFiles 方法
查詢收到的共用檔案資訊。
const result = await client.listReceivedFiles(params, options)參數說明
欄位 | 類型 | 必選 | 說明 |
params | IListReq | 否 | 預設為 {} |
options | IPDSRequestConfig | 否 | 其它配置項 |
IListReq
欄位 | 類型 | 必選 | 說明 |
limit | number | 否 | 一次查詢多少條資料 |
marker | string | 否 | 標記 |
返回
欄位 | 類型 | 必選 | 說明 |
result | IListRes<IFileItem> | 是 | 返回結果 |
IListRes
欄位 | 類型 | 必選 | 說明 |
items | array | 是 | 查詢到的檔案資訊列表,items 中每一項的具體欄位可參考關於 IFileItem 的說明 |
next_marker | string | 否 | 分頁標記 |
punished_file_count | number | 否 | 檔案夾會返回 |
addFilePermission 方法
添加檔案授權資訊 (建立共用更新共用)
const result = await client.addFilePermission(params, options)參數說明
欄位 | 類型 | 必選 | 說明 |
params | IAddFilePermissionReq | 是 | 建立共用的資訊 |
options | IPDSRequestConfig | 否 | 其它配置項 |
IAddFilePermissionReq
欄位 | 類型 | 必選 | 說明 |
drive_id | string | 是 | 雲端硬碟id |
file_id | string | 否 | 共用檔案的ID |
member_list | array | 否 | 要共用給的使用者物件集合,數組每一項請參考 IPermissionStandard 說明 |
IPermissionStandard
欄位 | 類型 | 必選 | 說明 |
identity | object | 是 | 包含 identity_type 和 identity_id 兩個欄位 |
expire_time | number | 是 | 時間戳記 |
role_id | string | 是 | 角色id |
disinherit_sub_group | boolean | 是 | 是否繼承子團隊 |
傳回值
StandardMode 模式下建立成功,沒有傳回值,失敗則拋出異常資訊。
removeFilePermission 方法
移除檔案許可權(刪除共用)。
await client.removeFilePermission(params, options)參數說明
欄位 | 類型 | 必選 | 說明 |
params | IAddFilePermissionReq | 是 | 要刪除的共用檔案 |
options | IPDSRequestConfig | 否 | 其它配置項 |
傳回值
刪除成功,沒有傳回值,失敗則拋出異常資訊。
listFilePermissions 方法
列舉檔案的許可權。
const result = await client.listFilePermission(params, options)參數說明
欄位 | 類型 | 必選 | 說明 |
params | IListPermissionReq | 是 | 查詢參數 |
options | IPDSRequestConfig | 否 | 其它配置項 |
IListPermissionReq
欄位 | 類型 | 必選 | 說明 |
drive_id | string | 是 | 雲端硬碟id |
file_id | string | 是 | 檔案id |
返回
欄位 | 類型 | 必選 | 說明 |
result | array | 是 | 返回結果, 其中每一項請查看關於 IPermissionStandard 的說明 |
IPermissionStandard
欄位 | 類型 | 必選 | 說明 |
identity | object | 是 | 包含identity_name, identity_type 和 identity_id 欄位 |
expire_time | number | 是 | 時間戳記 |
role_id | string | 是 | 角色id |
disinherit_sub_group | boolean | 是 | 是否繼承子團隊 |