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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
use super::*;
use super::models::{PaginationContainer, Video};
use crate::types::{UserId, GameId, VideoId};
pub struct Videos {}
type VideosNamespace = Namespace<Videos>;
impl VideosNamespace {
pub fn by_id(self, ids: Vec<&VideoId>)
-> IterableApiRequest<PaginationContainer<Video>> {
use self::by_id;
by_id(self.client, ids)
}
pub fn by_user(self, user_id: &UserId)
-> IterableApiRequest<PaginationContainer<Video>> {
use self::by_user;
by_user(self.client, user_id)
}
pub fn for_game(self, game_id: &GameId)
-> IterableApiRequest<PaginationContainer<Video>> {
use self::for_game;
for_game(self.client, game_id)
}
}
impl Client {
pub fn videos(&self) -> VideosNamespace {
VideosNamespace::new(self)
}
}
pub fn by_id(client: Client, ids: Vec<&VideoId>)
-> IterableApiRequest<PaginationContainer<Video>> {
let client = client.inner;
let url =
String::from("https://") + client.domain() + &String::from("/helix/videos");
let mut params = BTreeMap::new();
for id in ids {
params.insert("id", id.as_ref());
}
IterableApiRequest::new(url, params, client,
Method::GET, Some(RatelimitKey::Default))
}
pub fn by_user(client: Client, user_id: &UserId)
-> IterableApiRequest<PaginationContainer<Video>> {
let client = client.inner;
let url =
String::from("https://") + client.domain() + &String::from("/helix/videos");
let mut params = BTreeMap::new();
params.insert("user_id", user_id.as_ref());
IterableApiRequest::new(url, params, client,
Method::GET, Some(RatelimitKey::Default))
}
pub fn for_game(client: Client, game_id: &GameId)
-> IterableApiRequest<PaginationContainer<Video>> {
let client = client.inner;
let url =
String::from("https://") + client.domain() + &String::from("/helix/videos");
let mut params = BTreeMap::new();
params.insert("game_id", game_id.as_ref());
IterableApiRequest::new(url, params, client,
Method::GET, Some(RatelimitKey::Default))
}
|