Skip to main content

refget_model/
service_info.rs

1//! GA4GH service-info types.
2
3use serde::{Deserialize, Serialize};
4
5/// GA4GH service type descriptor.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct ServiceType {
8    pub group: String,
9    pub artifact: String,
10    pub version: String,
11}
12
13/// GA4GH service-info response.
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct ServiceInfo {
16    pub id: String,
17    pub name: String,
18    pub description: String,
19    #[serde(rename = "type")]
20    pub service_type: ServiceType,
21    pub version: String,
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub organization: Option<serde_json::Value>,
24}
25
26/// Extended service-info for the refget Sequences API.
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct SequenceServiceInfo {
29    #[serde(flatten)]
30    pub service: ServiceInfo,
31    pub refget: RefgetServiceDetails,
32}
33
34/// Details specific to refget service-info.
35#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct RefgetServiceDetails {
37    /// Whether circular sequence retrieval is supported.
38    pub circular_supported: bool,
39    /// Supported hash algorithms (e.g. `["md5", "ga4gh"]`).
40    pub algorithms: Vec<String>,
41    /// Supported identifier types (e.g. `["ga4gh", "md5"]`).
42    pub identifier_types: Vec<String>,
43    /// Maximum length of a subsequence request. 0 means no limit.
44    #[serde(default)]
45    pub subsequence_limit: u64,
46    /// API versions supported by this server (e.g. `["2.0.0"]`).
47    #[serde(default)]
48    pub supported_api_versions: Vec<String>,
49}