platform: add rustdoc to various methods

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic4d2bd6f3baf97ce30dbf8709331f6f66a6a6964
This commit is contained in:
raf 2026-04-19 00:33:20 +03:00
commit 20ea3c680b
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 33 additions and 0 deletions

View file

@ -404,6 +404,8 @@ impl PlatformClient for CurseForgePlatform {
} }
} }
/// Uses CurseForge's `/fingerprints/432` endpoint to resolve projects by
/// their hashes in batch.
async fn request_projects_from_hashes( async fn request_projects_from_hashes(
&self, &self,
hashes: &[String], hashes: &[String],

View file

@ -414,6 +414,20 @@ impl PlatformClient for GitHubPlatform {
Err(e) => Err(e), Err(e) => Err(e),
} }
} }
/// GitHub does not support hash-based batch lookup. Returns an empty list.
async fn request_projects_from_hashes(
&self,
hashes: &[String],
algorithm: &str,
) -> Result<Vec<Project>> {
log::debug!(
"GitHub does not support batch hash lookup ({} hashes, algorithm={})",
hashes.len(),
algorithm
);
Ok(Vec::new())
}
} }
// GitHub API models // GitHub API models

View file

@ -277,6 +277,8 @@ impl PlatformClient for ModrinthPlatform {
Ok(Some(self.convert_project(mr_project))) Ok(Some(self.convert_project(mr_project)))
} }
/// Uses Modrinth's `/v2/version_files` endpoint to resolve projects by
/// their hashes in batch.
async fn request_projects_from_hashes( async fn request_projects_from_hashes(
&self, &self,
hashes: &[String], hashes: &[String],

View file

@ -203,6 +203,8 @@ impl PlatformClient for MultiplatformPlatform {
} }
} }
/// Delegates to both CurseForge and Modrinth in parallel, then deduplicates
/// results.
async fn request_projects_from_hashes( async fn request_projects_from_hashes(
&self, &self,
hashes: &[String], hashes: &[String],

View file

@ -37,4 +37,17 @@ pub trait PlatformClient: Send + Sync {
&self, &self,
slug: &str, slug: &str,
) -> Result<Option<Project>>; ) -> Result<Option<Project>>;
/// Request multiple projects by their hashes (Modrinth) or bytes
/// (CurseForge).
///
/// # Returns
///
/// A list of projects found. Platforms that do not support hash-based
/// lookup return an empty list.
async fn request_projects_from_hashes(
&self,
hashes: &[String],
algorithm: &str,
) -> Result<Vec<Project>>;
} }