Manage favorites
This topic describes the methods used to manage favorite files or folders.
The options parameter of the IPDSRequestConfig type is encapsulated based on the request config options of axios. For more information, see AxiosRequestConfig.
listStarredFiles
Queries a list of favorite files or folders.
const result = await client.listStarredFiles(params, options)Request parameters
Parameter | Type | Required | Description |
params | object | Yes | The parameters that are used to query favorite files or folders. For more information, see ICustomIndexKeyReq. |
options | IPDSRequestConfig | No | Other request parameters. |
ICustomIndexKeyReq
Parameter | Type | Required | Description |
drive_id | string | Yes | The drive ID. |
image_thumbnail_process | string | Yes | The rule for processing image thumbnails. |
image_url_process | string | Yes | The image processing rule. |
video_thumbnail_process | string | Yes | The rule for processing video thumbnails. |
custom_index_key | string | Yes | The custom key. |
fields | string | Yes | The file type. If you want to query all types of favorite files or folders, set this parameter to *. |
limit | number | Yes | The number of entries to return. |
marker | string | No | The tags. |
referer | string | No | The address. Valid values: location.origin and undefined. |
order_direction | string | Yes | The order in which the results are sorted. Valid values: DESC and ASC. |
Response parameters
Parameter | Type | Required | Description |
result | IListRes | Yes | The returned results. |
IListRes
Parameter | Type | Required | Description |
items | IFileItem | Yes | The information about the files or folders returned. For more information, see the description of the IFileItem type in the listFiles method. |
next_marker | string | No | The pagination token. |
batchToggleFilesStar
Adds files or folders to or removes files or folders from favorites.
const result = await client.batchToggleFilesStar(fileItems, starred, options)Request parameters
Parameter | Type | Required | Description |
fileItems | IFileItem[] | Yes | For more information, see the description of the IFileItem type in the listFiles method. |
starred | boolean | Specifies whether to add files or folders to favorites. Valid values: true and false. A value of true specifies that files or folders are added to favorites. A value of false specifies that files or folders are removed from favorites. If you do not specify this parameter and the value of the starred parameter is false in the fileItems parameter, the corresponding files or folders are added to favorites by default. Otherwise, the files or folders are removed from favorites. | |
options | IPDSRequestConfig | Other request parameters. |
Response parameters
Parameter | Type | Required | Description |
result | object | Yes | The returned results. |
result
Parameter | Type | Required | Description |
type | string | Yes | The operation type. Valid values: star and unStar. |
changeItems | array | Yes | The files or folders that are not added to favorites. |
successItems | array | Yes | The files or folders that are managed. |
errorItems | array | Yes | The files or folders that failed to be managed. |