summaryrefslogtreecommitdiff
path: root/src/helix/namespaces/clips.rs
blob: 19293cccb405ed424cce39ee44588dc6f780e17c (plain)
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
use std::collections::BTreeMap;
use super::super::models::{DataContainer, PaginationContainer, User, Video, Clip};
use super::super::Client; 
use super::super::ClientTrait;
use super::super::RatelimitKey;
const API_DOMAIN: &'static str = "api.twitch.tv";
use super::Namespace;

pub struct Clips {}
type ClipsNamespace = Namespace<Clips>;

impl ClipsNamespace {
    pub fn clip(self, id: &str) -> ApiRequest<DataContainer<Clip>> {
        use self::clip;
        clip(self.client, id)
    }
}

impl Client {

    pub fn clips(&self) -> ClipsNamespace {
        ClipsNamespace::new(self)
    }
}

use super::super::ApiRequest;
use reqwest::Method;

pub fn clip(client: Client, id: &str) 
    -> ApiRequest<DataContainer<Clip>>
{
    let url =
        String::from("https://") + 
        client.domain() + "/helix/clips" + "?id=" + id;

    let params  = BTreeMap::new();

    ApiRequest::new(url, params, client, Method::GET, Some(RatelimitKey::Default))
}