Rename uploadFile/cancelUploadFile for clarity.

This commit is contained in:
levlam 2022-07-18 14:07:50 +03:00
parent 1a2d1adb0c
commit 2064034364
4 changed files with 16 additions and 15 deletions

View File

@ -5537,14 +5537,14 @@ cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok;
//@description Returns suggested name for saving a file in a given directory @file_id Identifier of the file @directory Directory in which the file is supposed to be saved
getSuggestedFileName file_id:int32 directory:string = Text;
//@description Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message
//@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message
//@file File to upload
//@file_type File type; pass null if unknown
//@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first
uploadFile file:InputFile file_type:FileType priority:int32 = File;
//@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first
preliminaryUploadFile file:InputFile file_type:FileType priority:int32 = File;
//@description Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined @file_id Identifier of the file to stop uploading
cancelUploadFile file_id:int32 = Ok;
//@description Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined @file_id Identifier of the file to stop uploading
cancelPreliminaryUploadFile file_id:int32 = Ok;
//@description Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file
//@generation_id The identifier of the generation process @offset The offset from which to write the data to the file @data The data to write

View File

@ -6588,7 +6588,7 @@ void Td::on_request(uint64 id, const td_api::getSuggestedFileName &request) {
send_closure(actor_id(this), &Td::send_result, id, td_api::make_object<td_api::text>(r_file_name.ok()));
}
void Td::on_request(uint64 id, td_api::uploadFile &request) {
void Td::on_request(uint64 id, td_api::preliminaryUploadFile &request) {
auto priority = request.priority_;
if (!(1 <= priority && priority <= 32)) {
return send_error_raw(id, 400, "Upload priority must be between 1 and 32");
@ -6610,7 +6610,7 @@ void Td::on_request(uint64 id, td_api::uploadFile &request) {
send_closure(actor_id(this), &Td::send_result, id, file_manager_->get_file_object(upload_file_id, false));
}
void Td::on_request(uint64 id, const td_api::cancelUploadFile &request) {
void Td::on_request(uint64 id, const td_api::cancelPreliminaryUploadFile &request) {
file_manager_->cancel_upload(FileId(request.file_id_, 0));
send_closure(actor_id(this), &Td::send_result, id, make_tl_object<td_api::ok>());

View File

@ -947,9 +947,9 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::getSuggestedFileName &request);
void on_request(uint64 id, td_api::uploadFile &request);
void on_request(uint64 id, td_api::preliminaryUploadFile &request);
void on_request(uint64 id, const td_api::cancelUploadFile &request);
void on_request(uint64 id, const td_api::cancelPreliminaryUploadFile &request);
void on_request(uint64 id, td_api::writeGeneratedFilePart &request);

View File

@ -3005,17 +3005,18 @@ class CliClient final : public Actor {
if (op == "ufse") {
type = td_api::make_object<td_api::fileTypeSecure>();
}
send_request(td_api::make_object<td_api::uploadFile>(as_input_file(file_path), std::move(type), priority));
send_request(
td_api::make_object<td_api::preliminaryUploadFile>(as_input_file(file_path), std::move(type), priority));
} else if (op == "ufg") {
string file_path;
string conversion;
get_args(args, file_path, conversion);
send_request(td_api::make_object<td_api::uploadFile>(as_generated_file(file_path, conversion),
td_api::make_object<td_api::fileTypePhoto>(), 1));
send_request(td_api::make_object<td_api::preliminaryUploadFile>(as_generated_file(file_path, conversion),
td_api::make_object<td_api::fileTypePhoto>(), 1));
} else if (op == "cuf") {
FileId file_id;
get_args(args, file_id);
send_request(td_api::make_object<td_api::cancelUploadFile>(file_id));
send_request(td_api::make_object<td_api::cancelPreliminaryUploadFile>(file_id));
} else if (op == "delf" || op == "DeleteFile") {
FileId file_id;
get_args(args, file_id);
@ -3928,8 +3929,8 @@ class CliClient final : public Actor {
string document_conversion;
get_args(args, chat_id, document_path, document_conversion);
if (op == "sdgu") {
send_request(
td_api::make_object<td_api::uploadFile>(as_generated_file(document_path, document_conversion), nullptr, 1));
send_request(td_api::make_object<td_api::preliminaryUploadFile>(
as_generated_file(document_path, document_conversion), nullptr, 1));
}
send_message(chat_id, td_api::make_object<td_api::inputMessageDocument>(
as_generated_file(document_path, document_conversion), nullptr, false,