Call SDK methods to create, update, query, and delete drives in Drive and Photo Service.
The options parameter of the IPDSRequestConfig type is encapsulated based on the request config options of axios. For more information, see AxiosRequestConfig.
getQuota method
Returns storage quota details for the domain.
const result = await client.getQuota(options)
Example
const {
size_quota,
size_used,
user_count_quota,
user_count_used
} = await client.getQuota()
Request parameters
|
Parameter |
Type |
Required |
Description |
|
options |
IPDSRequestConfig |
Other request parameters. |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IQuotaRes |
The returned result. |
IQuotaRes parameters
|
Parameter |
Type |
Description |
|
size_quota |
number |
Total purchased storage, in bytes. |
|
size_used |
number |
Storage currently in use, in bytes. |
|
user_count_quota |
number |
Maximum number of users allowed on this drive. |
|
user_count_used |
number |
Number of existing users. |
createDrive method
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.
})
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
ICreateDriveReq |
Yes |
Parameters for creating the drive. |
|
options |
IPDSRequestConfig |
Other request parameters. |
ICreateDriveReq parameters
|
Parameter |
Type |
Required |
Description |
|
default |
boolean |
Whether to set this drive as the default drive. Takes effect only in standard mode. Each user can have one default drive. Default value: |
|
|
drive_name |
string |
Yes |
The drive name. |
|
owner |
string |
Yes |
The ID of the |
|
owner_type |
string |
The type of the drive owner. Valid values: |
|
|
description |
string |
The drive description. |
|
|
total_size |
number |
Yes |
Total storage size of the drive, in bytes. Set to -1 for unlimited storage. |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
ICreateDriveRes |
Yes |
The result returned after the drive is created. |
ICreateDriveRes parameters
|
Parameter |
Type |
Required |
Description |
|
drive_id |
string |
Yes |
The drive ID. |
|
domain_id |
string |
Yes |
The domain ID. |
updateDrive method
Updates drive information.
const result = await client.updateDrive(params, options)
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
IUpdateDriveReq |
Yes |
Parameters for updating the drive. |
|
options |
IPDSRequestConfig |
Other request parameters. |
IUpdateDriveReq parameters
|
Parameter |
Type |
Required |
Description |
|
drive_id |
string |
Yes |
The ID of the drive to update. |
|
description |
string |
The drive description. |
|
|
total_size |
string |
Total storage size to set for the drive, in bytes. Set to -1 for unlimited storage. |
|
|
drive_name |
string |
The drive name. |
|
|
status |
string |
The drive status. Valid values: |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IDriveItem |
Yes |
The updated drive information. |
IDriveItem parameters
|
Parameter |
Type |
Required |
Description |
|
drive_id |
string |
Yes |
The drive ID. |
|
domain_id |
string |
Yes |
The ID of the domain the drive belongs to. |
|
creator |
string |
Yes |
The ID of the user who created the drive. |
|
drive_name |
string |
Yes |
The drive name. |
|
owner_type |
string |
Yes |
The type of the drive owner. Valid values: |
|
drive_type |
string |
Yes |
The drive type. Valid values: |
|
owner |
string |
Yes |
The ID of the |
|
status |
string |
Yes |
The drive status. Valid values: |
|
total_size |
number |
Yes |
Total storage size of the drive, in bytes. |
|
used_size |
number |
Yes |
Storage currently in use, in bytes. |
|
description |
string |
Yes |
The drive description. |
|
created_at |
Date |
Yes |
The time when the drive was created. |
|
subdomain_id |
string |
The subdomain ID. Available only if the domain has a subdomain. |
deleteDrive method
Deletes a drive.
await client.deleteDrive(params, options)
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
object |
Yes |
The ID of the drive to delete. Example: |
|
options |
IPDSRequestConfig |
No |
Other request parameters. |
params parameter
|
Parameter |
Type |
Required |
Description |
|
drive_id |
string |
Yes |
The ID of the drive to delete. |
Response parameter
Returns nothing on success. If the deletion fails, an exception is thrown with details about the cause.
getDrive method
Returns details of a drive by drive 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) // true
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
object |
Yes |
The ID of the drive to query. Example: |
|
options |
IPDSRequestConfig |
Other request parameters. |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IDriveItem |
Yes |
The returned drive details. |
searchDrives method
Searches for drives using fuzzy matching on specific fields.
const result = await client.searchDrives(params, options)
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
ISearchDrivesReq |
Search parameters. Default value: {}. |
|
|
options |
IPDSRequestConfig |
Other request parameters. |
ISearchDriveReq parameters
|
Parameter |
Type |
Required |
Description |
|
drive_name |
string |
The drive name to search for. |
|
|
limit |
number |
Maximum number of entries to return. Valid values: 1 to 100. Default value: 100. |
|
|
marker |
string |
The pagination marker from the previous response. |
|
|
owner_type |
string |
The type of the drive owner. Valid values: |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IListRes |
Yes |
The returned result. |
IListRes parameters
|
Parameter |
Type |
Required |
Description |
|
items |
IDriveItemRes[] |
Yes |
The list of matching drives. |
|
next_marker |
string |
Marker for retrieving the next page. Empty if no more pages exist. |
listDrives method
Lists all drives owned by a specific user or group.
const result = await client.listDrives(params, options)
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
IListDrivesReq |
Query parameters. Default value: {}. |
|
|
options |
IPDSRequestConfig |
Other request parameters. |
IListDrivesReq parameters
|
Parameter |
Type |
Required |
Description |
|
limit |
string |
Maximum number of entries to return. Valid values: 1 to 100. Default value: 100. |
|
|
marker |
string |
The pagination marker from the previous response. |
|
|
owner_type |
string |
The type of the drive owner. Valid values: |
|
|
owner |
string |
The ID of the |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IListRes |
Yes |
The returned result. |
IListRes parameters
|
Parameter |
Type |
Required |
Description |
|
items |
IDriveItemRes[] |
Yes |
The list of drives. For field details, see |
|
next_marker |
string |
Marker for retrieving the next page. Empty if no more pages exist. |
listMyDrives method
Lists all drives owned by the current user.
const result = await client.listMyDrives(params, options)
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
object |
Query parameters. Default value: {}. |
|
|
options |
IPDSRequestConfig |
Other request parameters. |
params parameters
|
Parameter |
Type |
Required |
Description |
|
limit |
string |
Maximum number of entries to return. Valid values: 1 to 100. Default value: 100. |
|
|
marker |
string |
The pagination marker from the previous response. |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IListRes |
Yes |
The returned result. |
IListRes parameters
|
Parameter |
Type |
Required |
Description |
|
items |
IDriveItemRes[] |
Yes |
The list of drives. |
|
next_marker |
string |
Marker for retrieving the next page. Empty if no more pages exist. |
listMyGroupDrives method
Lists drives belonging to the groups that the current user is a member of.
const result = await client.listMyGroupDrives(params, options)
Request parameters
|
Parameter |
Type |
Required |
Description |
|
params |
IListReq |
Query parameters. Default value: {}. |
|
|
options |
IPDSRequestConfig |
Other request parameters. |
IListReq parameters
|
Parameter |
Type |
Required |
Description |
|
limit |
string |
Maximum number of entries to return. Valid values: 1 to 100. Default value: 100. |
|
|
marker |
string |
The pagination marker from the previous response. |
Response parameter
|
Parameter |
Type |
Required |
Description |
|
result |
IListRes |
Yes |
The returned result. |
IListRes parameters
|
Parameter |
Type |
Required |
Description |
|
items |
IDriveItemRes[] |
Yes |
The list of group drives. |
|
next_marker |
string |
Marker for retrieving the next page. Empty if no more pages exist. |