fix for file.list api pagination
This commit is contained in:
@ -17,10 +17,26 @@ class FilesApiCreateResponse:
|
||||
id: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FilesApiListResponse:
|
||||
count: int
|
||||
next: str | None
|
||||
previous: str | None
|
||||
results: list[File]
|
||||
|
||||
|
||||
class FilesApi(BaseApi):
|
||||
ENTRYPOINT: Final[str] = "v3/files/"
|
||||
FALLBACK_MIMETYPE: Final[str] = "application/octet-stream"
|
||||
|
||||
def list(self, folder_id: str, page_num: int) -> FilesApiListResponse:
|
||||
url = self.ENTRYPOINT
|
||||
token_check(self.connection)
|
||||
params: dict[str, str | int] = {"folder_id": folder_id, "page": page_num}
|
||||
response = self.connection.get(url, params=params)
|
||||
self._raise_response_error(response)
|
||||
return TypeAdapter(FilesApiListResponse).validate_python(response.json())
|
||||
|
||||
def retrieve(self, id: str) -> File:
|
||||
# print(self.__class__.__name__ + "::" + sys._getframe().f_code.co_name)
|
||||
url = self.ENTRYPOINT + id + "/"
|
||||
|
Reference in New Issue
Block a user