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 binstalk_downloader::remote;
|
||||||
use compact_str::{format_compact, CompactString};
|
use compact_str::{format_compact, CompactString};
|
||||||
use tokio::sync::OnceCell;
|
use tokio::sync::OnceCell;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -210,7 +211,7 @@ impl GhApiClient {
|
||||||
release,
|
release,
|
||||||
artifact_name,
|
artifact_name,
|
||||||
}: GhReleaseArtifact,
|
}: GhReleaseArtifact,
|
||||||
) -> Result<Option<CompactString>, GhApiError> {
|
) -> Result<Option<Url>, GhApiError> {
|
||||||
let once_cell = self.0.release_artifacts.get(release.clone());
|
let once_cell = self.0.release_artifacts.get(release.clone());
|
||||||
let res = once_cell
|
let res = once_cell
|
||||||
.get_or_try_init(|| {
|
.get_or_try_init(|| {
|
||||||
|
|
|
@ -9,6 +9,7 @@ use std::{
|
||||||
use binstalk_downloader::remote::{self};
|
use binstalk_downloader::remote::{self};
|
||||||
use compact_str::{CompactString, ToCompactString};
|
use compact_str::{CompactString, ToCompactString};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
common::{issue_graphql_query, issue_restful_api},
|
common::{issue_graphql_query, issue_restful_api},
|
||||||
|
@ -20,7 +21,7 @@ use super::{
|
||||||
#[derive(Eq, Deserialize, Debug)]
|
#[derive(Eq, Deserialize, Debug)]
|
||||||
struct Artifact {
|
struct Artifact {
|
||||||
name: CompactString,
|
name: CompactString,
|
||||||
url: CompactString,
|
url: Url,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually implement PartialEq and Hash to ensure it will always produce the
|
// Manually implement PartialEq and Hash to ensure it will always produce the
|
||||||
|
@ -59,7 +60,7 @@ pub(super) struct Artifacts {
|
||||||
|
|
||||||
impl Artifacts {
|
impl Artifacts {
|
||||||
/// get url for downloading the artifact using GitHub API (for private repository).
|
/// 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
|
self.assets
|
||||||
.get(artifact_name)
|
.get(artifact_name)
|
||||||
.map(|artifact| artifact.url.clone())
|
.map(|artifact| artifact.url.clone())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue