全部產品
Search
文件中心

Drive and Photo Service:共用

更新時間:Dec 23, 2025

僅適用於託管模式(HostingMode)。提供檔案分享權限設定的一些操作方法,有建立共用、更新共用、刪除共用、查詢共用等。以下所有方法中的 options 參數是額外請求配置,詳見 AxiosRequestConfig

listShares 方法

警告

標準模式不支援

重要

託管模式支援

擷取共用列表 。

const result = await client.listShares(params, options)

參數說明

欄位

類型

必選

說明

params

IListSharesReq

預設為 {}

options

AxiosRequestConfig

其它配置項

IListSharesReq

欄位

類型

必選

說明

limit

number

一次查詢多少條資料, 0-100

marker

string

標記

creator

string

按共用者查詢

owner

string

按共用接收者查詢

欄位

類型

必選

說明

result

IListRes

返回結果

IListRes

欄位

類型

必選

說明

items

IShareItem[]

查詢到的檔案資訊列表,items 中每一項的具體欄位可查看下面關於 IShareItem 的說明

next_marker

string

下一頁標記

IShareItem

欄位

類型

必選

說明

drive_id

string

雲端硬碟id

domain_id

string

domain ID

created_at

Date

檔案建立時間

updated_at

Date

檔案更新時間

status

string

檔案狀態, available | enabled

creator

string

建立人

description

string

描述資訊

expiration

Date

到期時間

expired

boolean

是否到期

owner

string

共用人id

owner_type

string

共用人類型

permissions

string[]

許可權列表

share_file_path

string

共用檔案路徑

share_id

string

共用id

share_name

string

共用檔案的名稱

share_policy

array

共用給他人時具有的操作許可權列表

listReceivedShares 方法

警告

標準模式不支援

重要

託管模式支援

查詢收到的共用檔案資訊。

const result = await client.listReceivedShares(params, options)

參數

欄位

類型

必選

說明

params

IListReceivedSharedsReq

預設為 {}

options

AxiosRequestConfig

其它配置項

IListReceivedSharedsReq

欄位

類型

必選

說明

limit

number

一次查詢多少條資料, 0-100

marker

string

標記

owner

string

使用者ID

返回

欄位

類型

必選

說明

result

IListRes

返回結果

IListRes

欄位

類型

必選

說明

items

IShareItem[]

查詢到的檔案資訊列表,items 中每一項的具體欄位可參考關於 IShareItem 的說明

next_marker

string

分頁標記

createShare 方法

警告

標準模式不支援

重要

託管模式支援

建立共用

const result = await client.createShare(params, options)

參數

欄位

類型

必選

說明

params

ICreateShareReq

建立共用的資訊

options

AxiosRequestConfig

其它配置項

ICreateShareReq

欄位

類型

必選

說明

drive_id

string

雲端硬碟 id

description

string

描述資訊

expiration

Date

到期時間

owner

string

共用者

permissions

string[]

許可權列表

share_file_path

string

共用的檔案路徑,

share_name

string

共用的檔案名稱

status

string

狀態 enabled

返回

欄位

類型

必選

說明

result

ICreateShareRes

建立成功的返回資訊

ICreateShareRes

欄位

類型

必選

說明

share_id

string

建立成功的共用 id

domain_id

string

domain ID

updateShare 方法

警告

標準模式不支援

重要

託管模式支援

更新共用

const result = await client.updateShare(params, options)

參數

欄位

類型

必選

說明

params

IUpdateShareReq

參數格式請查看 IUpdateShareReq

options

AxiosRequestConfig

其它配置項

IUpdateShareReq

欄位

類型

必選

說明

share_id

string

Share ID

description

string

描述資訊

expiration

Date

到期時間

permissions

string[]

許可權列表

share_name

string

共用的檔案名稱

status

string

狀態 enabled

share_policy

TSharePolicyItem[]

附加許可權配置

TSharePolicyItem

欄位

類型

必選

說明

file_path

string

附加許可權檔案路徑,可以為目錄或檔案的路徑

permission_list

string[]

具體許可權列表。

premission_type

string

權限類別型,取值範圍:allow, deny

permission_inheritable

boolean

是否繼承父級目錄的許可權

返回

欄位

類型

必選

說明

result

IShareItem

更新成功的返回資訊

deleteShare 方法

警告

標準模式不支援

重要

託管模式支援

刪除/不共用

await client.deleteShare(params, options)

參數

欄位

類型

必選

說明

params

IDeleteShareReq

要刪除的檔案資訊

options

AxiosRequestConfig

其它配置項

IDeleteShareReq

欄位

類型

必選

說明

share_id

string

共用id

返回

刪除成功,沒有傳回值,失敗則拋出異常資訊。

getShare 方法

警告

標準模式不支援

重要

託管模式支援

根據共用 id 擷取共用資訊

const result = await client.getShare(params, options)

參數

欄位

類型

必選

說明

params

IGetShareReq

需要查詢的id, 例: { share_id: '123' }

options

AxiosRequestConfig

其它配置項

IGetShareReq

欄位

類型

必選

說明

share_id

string

共用id

返回

欄位

類型

必選

說明

result

IShareItem

返回結果