platform: add rustdoc to various methods
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic4d2bd6f3baf97ce30dbf8709331f6f66a6a6964
This commit is contained in:
parent
e19df15ae5
commit
20ea3c680b
5 changed files with 33 additions and 0 deletions
|
|
@ -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(
|
||||
&self,
|
||||
hashes: &[String],
|
||||
|
|
|
|||
|
|
@ -414,6 +414,20 @@ impl PlatformClient for GitHubPlatform {
|
|||
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
|
||||
|
|
|
|||
|
|
@ -277,6 +277,8 @@ impl PlatformClient for ModrinthPlatform {
|
|||
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(
|
||||
&self,
|
||||
hashes: &[String],
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
&self,
|
||||
hashes: &[String],
|
||||
|
|
|
|||
|
|
@ -37,4 +37,17 @@ pub trait PlatformClient: Send + Sync {
|
|||
&self,
|
||||
slug: &str,
|
||||
) -> 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>>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue