Skip to main content

AirLibrary/Client/AirServiceProvider/
DownloadUpdate.rs

1//! `AirServiceProvider::DownloadUpdate` - fetch an update package via the
2//! Air daemon's `DownloaderService`. Wraps
3//! [`crate::Client::AirClient::AirClient::DownloadUpdate`] and supplies
4//! an empty header map by default.
5
6use std::collections::HashMap;
7
8use crate::{
9	AirError,
10	Client::{AirClient::FileInfo, AirServiceProvider::AirServiceProvider},
11	dev_log,
12};
13
14impl AirServiceProvider {
15	/// Downloads an update package to `destination_path`. The optional
16	/// `checksum` is forwarded as-is; an empty string skips
17	/// server-side verification.
18	pub async fn DownloadUpdate(
19		&self,
20
21		url:String,
22
23		destination_path:String,
24
25		checksum:String,
26	) -> Result<FileInfo::Struct, AirError> {
27		let RequestID = crate::Utility::GenerateRequestId();
28
29		dev_log!("grpc", "[AirServiceProvider] DownloadUpdate (request_id: {})", RequestID);
30
31		self.client
32			.DownloadUpdate(RequestID, url, destination_path, checksum, HashMap::new())
33			.await
34	}
35}