mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-17 08:06:38 +00:00
Return Url
in GhApiClient::has_release_artifact
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
eb77ad762b
commit
4da2f0e64f
2 changed files with 5 additions and 3 deletions
|
@ -12,6 +12,7 @@ use std::{
|
|||
use binstalk_downloader::remote;
|
||||
use compact_str::{format_compact, CompactString};
|
||||
use tokio::sync::OnceCell;
|
||||
use url::Url;
|
||||
|
||||
mod common;
|
||||
mod error;
|
||||
|
@ -210,7 +211,7 @@ impl GhApiClient {
|
|||
release,
|
||||
artifact_name,
|
||||
}: GhReleaseArtifact,
|
||||
) -> Result<Option<CompactString>, GhApiError> {
|
||||
) -> Result<Option<Url>, GhApiError> {
|
||||
let once_cell = self.0.release_artifacts.get(release.clone());
|
||||
let res = once_cell
|
||||
.get_or_try_init(|| {
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::{
|
|||
use binstalk_downloader::remote::{self};
|
||||
use compact_str::{CompactString, ToCompactString};
|
||||
use serde::Deserialize;
|
||||
use url::Url;
|
||||
|
||||
use super::{
|
||||
common::{issue_graphql_query, issue_restful_api},
|
||||
|
@ -20,7 +21,7 @@ use super::{
|
|||
#[derive(Eq, Deserialize, Debug)]
|
||||
struct Artifact {
|
||||
name: CompactString,
|
||||
url: CompactString,
|
||||
url: Url,
|
||||
}
|
||||
|
||||
// Manually implement PartialEq and Hash to ensure it will always produce the
|
||||
|
@ -59,7 +60,7 @@ pub(super) struct Artifacts {
|
|||
|
||||
impl Artifacts {
|
||||
/// get url for downloading the artifact using GitHub API (for private repository).
|
||||
pub(super) fn get_artifact_url(&self, artifact_name: &str) -> Option<CompactString> {
|
||||
pub(super) fn get_artifact_url(&self, artifact_name: &str) -> Option<Url> {
|
||||
self.assets
|
||||
.get(artifact_name)
|
||||
.map(|artifact| artifact.url.clone())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue