@@ -992,6 +992,80 @@ def download_file(
992992 )
993993
994994
995+ def download_project_file (
996+ project_name : str ,
997+ file_id : str ,
998+ filepath : str ,
999+ * ,
1000+ chunk_size : Optional [int ] = None ,
1001+ progress : Optional [TransferProgress ] = None ,
1002+ ) -> TransferProgress :
1003+ """Download project file to filepath.
1004+
1005+ Project files are usually binary files, such as images, videos,
1006+ or other media files that can be accessed via api endpoint
1007+ '{server url}/api/projects/{project_name}/files/{file_id}'.
1008+
1009+ Args:
1010+ project_name (str): Project name.
1011+ file_id (str): File id.
1012+ filepath (str): Path where file will be downloaded.
1013+ chunk_size (Optional[int]): Size of chunks that are received
1014+ in single loop.
1015+ progress (Optional[TransferProgress]): Object that gives ability
1016+ to track download progress.
1017+
1018+ Returns:
1019+ TransferProgress: Progress object.
1020+
1021+ """
1022+ con = get_server_api_connection ()
1023+ return con .download_project_file (
1024+ project_name = project_name ,
1025+ file_id = file_id ,
1026+ filepath = filepath ,
1027+ chunk_size = chunk_size ,
1028+ progress = progress ,
1029+ )
1030+
1031+
1032+ def download_project_file_to_stream (
1033+ project_name : str ,
1034+ file_id : str ,
1035+ stream : StreamType ,
1036+ * ,
1037+ chunk_size : Optional [int ] = None ,
1038+ progress : Optional [TransferProgress ] = None ,
1039+ ) -> TransferProgress :
1040+ """Download project file to a stream.
1041+
1042+ Project files are usually binary files, such as images, videos,
1043+ or other media files that can be accessed via api endpoint
1044+ '{server url}/api/projects/{project_name}/files/{file_id}'.
1045+
1046+ Args:
1047+ project_name (str): Project name.
1048+ file_id (str): File id.
1049+ stream (StreamType): Stream where output will be stored.
1050+ chunk_size (Optional[int]): Size of chunks that are received
1051+ in single loop.
1052+ progress (Optional[TransferProgress]): Object that gives ability
1053+ to track download progress.
1054+
1055+ Returns:
1056+ TransferProgress: Progress object.
1057+
1058+ """
1059+ con = get_server_api_connection ()
1060+ return con .download_project_file_to_stream (
1061+ project_name = project_name ,
1062+ file_id = file_id ,
1063+ stream = stream ,
1064+ chunk_size = chunk_size ,
1065+ progress = progress ,
1066+ )
1067+
1068+
9951069def upload_file_from_stream (
9961070 endpoint : str ,
9971071 stream : StreamType ,
0 commit comments