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
use crate::api::Endpoint;
use std::borrow::Cow;

#[derive(Clone, Debug)]
pub struct Crate<'a> {
    name: Cow<'a, str>,
}

impl<'a> Crate<'a> {
    pub fn new(name: Cow<'a, str>) -> Self {
        Self { name }
    }
}

impl<'a> Endpoint for Crate<'a> {
    fn method(&self) -> http::Method {
        http::Method::GET
    }

    fn endpoint(&self) -> Cow<'static, str> {
        Cow::Owned(format!("v1/crates/{}", self.name))
    }
}

#[cfg(test)]
mod tests {
    //
    // #[test]
    // fn id() {
    // }
}