Skip to content

Commit

Permalink
refget: Update to v2.0.0 specs (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangehring authored Jul 18, 2023
1 parent f79b122 commit eb8be3d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions noodles-refget/src/sequence/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde::Deserialize;
#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
pub struct Metadata {
md5: String,
trunc512: Option<String>,
ga4gh: Option<String>,
length: u32,
aliases: Vec<Alias>,
}
Expand All @@ -21,9 +21,9 @@ impl Metadata {
&self.md5
}

/// Returns the TRUNC512 digest in hexadecimal.
pub fn trunc512(&self) -> Option<&str> {
self.trunc512.as_deref()
/// Returns the ga4gh digest in hexadecimal.
pub fn ga4gh(&self) -> Option<&str> {
self.ga4gh.as_deref()
}

/// Returns the length.
Expand Down
14 changes: 7 additions & 7 deletions noodles-refget/src/sequence/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use serde::Deserialize;
pub struct Service {
circular_supported: bool,
algorithms: Vec<String>,
identifier_types: Vec<String>,
subsequence_limit: Option<u32>,
supported_api_version: Vec<String>,
}

impl Service {
Expand All @@ -24,15 +24,15 @@ impl Service {
&self.algorithms
}

/// Returns a list of supported sequence type identifiers.
pub fn identifier_types(&self) -> &[String] {
&self.identifier_types
}

/// Returns the maximum length of an interval.
///
/// If missing, there is no limit.
/// If missing or smaller than 1, there is no limit.
pub fn subsequence_limit(&self) -> Option<u32> {
self.subsequence_limit
}

/// Returns a list of supported refget versions.
pub fn supported_api_versions(&self) -> &[String] {
&self.supported_api_version
}
}
4 changes: 2 additions & 2 deletions noodles-refget/src/sequence/service/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ impl Builder {
response
.json()
.await
.map(|data: ServiceInfoResponse| data.service)
.map(|data: ServiceInfoResponse| data.refget)
.map_err(Error::Request)
}
}

#[derive(Deserialize)]
struct ServiceInfoResponse {
service: Service,
refget: Service,
}

0 comments on commit eb8be3d

Please sign in to comment.