diff options
author | David Blajda <blajda@hotmail.com> | 2019-05-08 15:38:37 +0000 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2019-05-08 15:38:37 +0000 |
commit | 98fb79b85e3cfbb547e5340b30623511daf09ef5 (patch) | |
tree | a03bd7a95c86a92eb7510409429f50433056d7ab /src/helix/namespaces/videos.rs | |
parent | 0e09c2c06fc0b81f11d12985a4172c815233db17 (diff) |
:WIP: Move types to a different crate
Diffstat (limited to 'src/helix/namespaces/videos.rs')
-rw-r--r-- | src/helix/namespaces/videos.rs | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/helix/namespaces/videos.rs b/src/helix/namespaces/videos.rs deleted file mode 100644 index b603b8f..0000000 --- a/src/helix/namespaces/videos.rs +++ /dev/null @@ -1,75 +0,0 @@ -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<S: ToString>(self, ids: &[S]) - -> IterableApiRequest<PaginationContainer<Video>> { - use self::by_id; - by_id(self.client, ids) - } - - pub fn by_user<S: ToString>(self, user_id: &S) - -> IterableApiRequest<PaginationContainer<Video>> { - use self::by_user; - by_user(self.client, user_id) - } - - pub fn for_game<S: ToString>(self, game_id: &S) - -> 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<S: ToString>(client: Client, ids: &[S]) - -> IterableApiRequest<PaginationContainer<Video>> { - let client = client.inner; - let url = - String::from("https://") + client.domain() + &String::from("/helix/videos"); - - let mut params: ParamList = BTreeMap::new(); - for id in ids { - params.insert("id", id); - } - - IterableApiRequest::new(url, params, client, - Method::GET, Some(RatelimitKey::Default)) -} - -pub fn by_user<S: ToString>(client: Client, user_id: &S) - -> IterableApiRequest<PaginationContainer<Video>> { - let client = client.inner; - let url = - String::from("https://") + client.domain() + &String::from("/helix/videos"); - - let mut params: ParamList = BTreeMap::new(); - params.insert("user_id", user_id); - - IterableApiRequest::new(url, params, client, - Method::GET, Some(RatelimitKey::Default)) -} - -pub fn for_game<S: ToString>(client: Client, game_id: &S) - -> IterableApiRequest<PaginationContainer<Video>> { - let client = client.inner; - let url = - String::from("https://") + client.domain() + &String::from("/helix/videos"); - - let mut params: ParamList = BTreeMap::new(); - params.insert("game_id", game_id); - - IterableApiRequest::new(url, params, client, - Method::GET, Some(RatelimitKey::Default)) -} |