1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use noodles_core::Region;

use super::Format;
use crate::{
    request::{self, Class},
    Response,
};

/// A variants endpoint builder.
pub struct Builder {
    inner: request::Builder,
}

impl Builder {
    pub(crate) fn new(inner: request::Builder) -> Self {
        Self { inner }
    }

    /// Sets the data format.
    pub fn set_format(mut self, format: Format) -> Self {
        self.inner = self.inner.set_format(format.into());
        self
    }

    /// Sets the data steam filter.
    ///
    /// Setting this discards all other options upon send.
    pub fn set_class(mut self, class: Class) -> Self {
        self.inner = self.inner.set_class(class);
        self
    }

    /// Adds a region to query.
    pub fn add_region(mut self, region: Region) -> Self {
        self.inner = self.inner.add_region(region);
        self
    }

    /// Sends the request.
    pub async fn send(self) -> crate::Result<Response> {
        self.inner.send().await
    }
}