diff options
Diffstat (limited to 'src/helix/namespaces/videos.rs')
-rw-r--r-- | src/helix/namespaces/videos.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/helix/namespaces/videos.rs b/src/helix/namespaces/videos.rs index 75b702e..9f2fd2b 100644 --- a/src/helix/namespaces/videos.rs +++ b/src/helix/namespaces/videos.rs @@ -7,7 +7,7 @@ pub struct Videos {} type VideosNamespace = Namespace<Videos>; impl VideosNamespace { - pub fn by_id(self, ids: Vec<&VideoId>) + pub fn by_id<S: ToString>(self, ids: &[S]) -> IterableApiRequest<PaginationContainer<Video>> { use self::by_id; by_id(self.client, ids) @@ -33,42 +33,42 @@ impl Client { } } -pub fn by_id(client: Client, ids: Vec<&VideoId>) +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 = BTreeMap::new(); + let mut params: ParamList = BTreeMap::new(); for id in ids { - params.insert("id", id.as_ref()); + params.insert("id", id); } IterableApiRequest::new(url, params, client, Method::GET, Some(RatelimitKey::Default)) } -pub fn by_user(client: Client, user_id: &UserId) +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 = BTreeMap::new(); - params.insert("user_id", user_id.as_ref()); + 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(client: Client, game_id: &GameId) +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 = BTreeMap::new(); - params.insert("game_id", game_id.as_ref()); + let mut params: ParamList = BTreeMap::new(); + params.insert("game_id", game_id); IterableApiRequest::new(url, params, client, Method::GET, Some(RatelimitKey::Default)) |