Skip to content

Commit

Permalink
add /v2/file/scan
Browse files Browse the repository at this point in the history
  • Loading branch information
lemisky committed Aug 21, 2023
1 parent 367f166 commit 842bc25
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/aligo/core/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
V2_FILE_MOVE = '/v2/file/move'
V2_FILE_COPY = '/v2/file/copy'
V2_FILE_WALK = '/v2/file/walk'
V2_FILE_SCAN = '/v2/file/scan'
V2_FILE_SEARCH = '/v2/file/search'
V2_FILE_CREATE = '/v2/file/create'
V2_FILE_COMPLETE = '/v2/file/complete'
Expand Down
17 changes: 15 additions & 2 deletions src/aligo/core/File.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from typing import Iterator

from aligo.core import BaseAligo
from aligo.core.Config import ADRIVE_V3_FILE_LIST, V2_FILE_WALK
from aligo.core.Config import ADRIVE_V3_FILE_LIST, V2_FILE_WALK, V2_FILE_SCAN
from aligo.request import BatchGetFileRequest, GetFileListRequest, GetFileRequest, BatchRequest, BatchSubRequest
from aligo.response import BatchSubResponse, GetFileListResponse
from aligo.types import BaseFile
from aligo.types.Enum import BaseFileType
from aligo.types.Enum import BaseFileType, BaseFileCategory


class File(BaseAligo):
Expand Down Expand Up @@ -52,3 +52,16 @@ def _core_walk_file(
'url_expire_sec': url_expire_sec,
'limit': limit,
}, GetFileListResponse)

def _core_scan_file(
self,
drive_id: str = None,
category: BaseFileCategory = None,
limit: int = 1000,
) -> Iterator[BaseFile]:
"""..."""
yield from self._list_file(V2_FILE_SCAN, {
'drive_id': drive_id or self.default_drive_id,
'category': category,
'limit': limit,
}, GetFileListResponse)

0 comments on commit 842bc25

Please sign in to comment.