Drives
This document describes the Create, Read, Update, and Delete (CRUD) operations and other methods for drives. The options parameter in all the following methods specifies additional request configurations. For more information, see AxiosRequestConfig.
getQuota method
This method is supported only in standard mode (Enterprise Edition only).
This method is not supported in hosted mode.
For the Enterprise Edition with limited space, you can use this API to retrieve the remaining space.
const result = await client.getQuota(options)Example
const {
size_quota,
size_used,
user_count_quota,
user_count_used
} = await client.getQuota()Parameters
Field | Type | Required | Description |
options | AxiosRequestConfig | Other configuration items. |
Returns
Field | Type | Required | Description |
result | IQuotaRes | The result. |
IQuotaRes
Field | Type | Description |
size_quota | number | The total purchased space. |
size_used | number | The used space. |
user_count_quota | number | The total number of purchased users. |
user_count_used | number | The number of existing users. |
createDrive method
This method is supported in both standard and hosted modes.
Creates a drive.
const result = await client.createDrive(params, options)Example
const { drive_id } = await client.createDrive({
drive_name: 'my_drive', // The drive name
owner: 'xxxxx', // The user ID
});Parameters
Field | Type | Required | Description |
params | ICreateDriveReq | Yes | The parameters to create a drive. |
options | AxiosRequestConfig | Other configuration items. |
ICreateDriveReq
Field | Type | Required | Description |
default | boolean | (Valid only in standard mode) Specifies whether to set the drive as the default drive. A user can have only one default drive. Default: | |
drive_name | string | Yes | The drive name. |
owner | string | Yes | The |
owner_type | string | Valid values: | |
description | string | The description. | |
total_size | number | Yes | The drive size in |
store_id | string | (Required in hosted mode) | The storage space ID. |
relative_path | string | (Required in hosted mode) | The relative path of the drive storage based on the |
Return value
Field | Type | Required | Description |
result | ICreateDriveRes | Yes | The information returned after the drive is created. |
ICreateDriveRes
Field | Type | Required | Description |
drive_id | string | Yes | The drive ID. |
domain_id | string | Yes | The Domain ID. |
updateDrive method
This method is supported in both standard and hosted modes.
Updates drive information.
const result = await client.updateDrive(params, options)Parameters
Field | Type | Required | Description |
params | IUpdateDriveReq | Yes | The parameters to update a drive. |
options | AxiosRequestConfig | Other configuration items. |
IUpdateDriveReq
Field | Type | Required | Description |
drive_id | string | Yes | The ID of the drive to update. |
description | string | The description. | |
total_size | string | The updated drive size in | |
drive_name | string | The drive name. | |
status | string | The drive status. Valid values: enabled and Default: |
Return value
Field | Type | Required | Description |
result | IDriveItem | Yes | The updated drive information. |
IDriveItem
Field | Type | Required | Description |
drive_id | string | Yes | The drive ID. |
domain_id | string | Yes | The ID of the domain. |
creator | string | Yes | The user_id of the creator. |
drive_name | string | Yes | The drive name. |
owner_type | string | Yes | The value can be |
drive_type | string | Yes | The drive type. Valid values: |
owner | string | Yes | The |
relative_path | string | (Required in hosted mode) | The relative path of the drive storage based on the store. |
status | string | Yes | The drive status. Valid values: enabled and |
store_id | string | (Required in hosted mode) | The storage space ID. |
total_size | number | Yes | The total size in |
used_size | number | Yes | The used size in |
description | string | Yes | The description. |
created_at | Date | Yes | The creation time. |
subdomain_id | string | The ID of the subdomain. This parameter is available only for domains that have subdomains enabled. |
deleteDrive method
This method is supported in both standard and hosted modes.
Deletes a drive.
await client.deleteDrive(params, options)Parameters
Field | Type | Required | Description |
params | object | Yes | The ID of the drive to delete. For example, |
options | AxiosRequestConfig | No | Other configuration items. |
params
Field | Type | Required | Description |
drive_id | string | Yes | The ID of the drive to delete. |
Return value
This method does not return a value upon successful deletion. If the deletion fails, an exception is thrown. You can analyze the exception information to identify the cause.
getDrive method
This method is supported in both standard and hosted modes.
Retrieves the details of a drive based on its ID.
const result = await client.getDrive(params, options)Example
const drive_id = '123'
const result = await client.getDrive({drive_id})
assert(result.drive_id==drive_id) // trueParameters
Field | Type | Required | Description |
params | object | Yes | The ID of the drive to query. For example, |
options | AxiosRequestConfig | Other configuration items. |
Returns
Field | Type | Required | Description |
result | IDriveItem | Yes | The drive information. |
searchDrives method
This method is supported in standard mode.
This method is not supported in hosted mode.
Searches for drive information based on specific fields using a fuzzy search.
const result = await client.searchDrives(params, options)Parameters
Field | Type | Required | Description |
params | ISearchDrivesReq | The query parameters. The default is {}. | |
options | AxiosRequestConfig | Other configuration items. |
ISearchDriveReq
Field | Type | Required | Description |
drive_name | string | Query by drive name. | |
limit | number | The maximum number of entries to return. Valid values: 1 to 100. Default: 100. | |
marker | string | The query start marker. | |
owner_type | string | Valid values: |
Return value
Field | Type | Required | Description |
result | IListRes | Yes | The result. |
IListRes
Field | Type | Required | Description |
items | IDriveItemRes[] | Yes | A list of the queried drive information. |
next_marker | string | The marker for the next page of results. |
listDrives method
This method is supported in both standard and hosted modes.
Retrieves a list of user drives.
const result = await client.listDrives(params, options)Parameters
Field | Type | Required | Description |
params | IListDrivesReq | The query parameters. The default is {}. | |
options | AxiosRequestConfig | Other configuration items. |
IListDrivesReq
Field | Type | Required | Description |
limit | string | The maximum number of entries to return. Valid values: 1 to 100. Default: 100. | |
marker | string | The query start marker. | |
owner_type | string | Valid values: | |
owner | string | The |
Return value
Field | Type | Required | Description |
result | IListRes | Yes | The result. |
IListRes
Field | Type | Required | Description |
items | IDriveItemRes[] | Yes | A list of the queried drive information. For the specific fields of each item in |
next_marker | string | The marker for the next page of results. |
listMyDrives method
This method is supported in both standard and hosted modes.
Retrieves a list of the current user's drives.
const result = await client.listMyDrives(params, options)Parameters
Field | Type | Required | Description |
params | object | The query parameters. The default is {}. | |
options | AxiosRequestConfig | Other configuration items. |
params
Field | Type | Required | Description |
limit | string | The maximum number of entries to return. Valid values: 1 to 100. Default: 100. | |
marker | string | The query start marker. |
Return value
Field | Type | Required | Description |
result | IListRes | Yes | The result. |
IListRes
Field | Type | Required | Description |
items | IDriveItemRes[] | Yes | A list of the queried drive information. |
next_marker | string | The marker for the next page of results. |
listMyGroupDrives method
This method is supported only in standard mode.
This method is not supported in hosted mode.
Retrieves a list of the current user's group drives.
const result = await client.listMyGroupDrives(params, options) Parameters
Field | Type | Required | Description |
params | IListReq | The query parameters. The default is {}. | |
options | AxiosRequestConfig | Other configuration items. |
IListReq
Field | Type | Required | Description |
limit | string | The maximum number of entries to return. Valid values: 1 to 100. Default: 100. | |
marker | string | The query start marker. |
Return value
Field | Type | Required | Description |
result | IListRes | Yes | The result. |
IListRes
Field | Type | Required | Description |
items | IDriveItemRes[] | Yes | A list of the queried drive information. |
next_marker | string | The marker for the next page of results. |