| 400 | } |
| 401 | |
| 402 | auto ApiWrap::fileRequest(const Data::FileLocation &location, int64 offset) { |
| 403 | Expects(location.dcId != 0 |
| 404 | || location.data.type() == mtpc_inputTakeoutFileLocation); |
| 405 | Expects(_takeoutId.has_value()); |
| 406 | Expects(_fileProcess->requestId == 0); |
| 407 | |
| 408 | return std::move(_mtp.request(MTPInvokeWithTakeout<MTPupload_GetFile>( |
| 409 | MTP_long(*_takeoutId), |
| 410 | MTPupload_GetFile( |
| 411 | MTP_flags(0), |
| 412 | location.data, |
| 413 | MTP_long(offset), |
| 414 | MTP_int(kFileChunkSize)) |
| 415 | )).fail([=](const MTP::Error &result) { |
| 416 | _fileProcess->requestId = 0; |
| 417 | if (result.type() == u"TAKEOUT_FILE_EMPTY"_q |
| 418 | && _otherDataProcess != nullptr) { |
| 419 | filePartDone( |
| 420 | 0, |
| 421 | MTP_upload_file( |
| 422 | MTP_storage_filePartial(), |
| 423 | MTP_int(0), |
| 424 | MTP_bytes())); |
| 425 | } else if (result.type() == u"LOCATION_INVALID"_q |
| 426 | || result.type() == u"VERSION_INVALID"_q |
| 427 | || result.type() == u"LOCATION_NOT_AVAILABLE"_q) { |
| 428 | filePartUnavailable(); |
| 429 | } else if (result.code() == 400 |
| 430 | && result.type().startsWith(u"FILE_REFERENCE_"_q)) { |
| 431 | filePartRefreshReference(offset); |
| 432 | } else { |
| 433 | error(std::move(result)); |
| 434 | } |
| 435 | }).toDC(MTP::ShiftDcId(location.dcId, MTP::kExportMediaDcShift))); |
| 436 | } |
| 437 | |
| 438 | ApiWrap::ApiWrap( |
| 439 | base::weak_qptr<MTP::Instance> weak, |
nothing calls this directly
no test coverage detected