From 0a5892c67fb02e09a621ac8796ac84232935f5c3 Mon Sep 17 00:00:00 2001 From: David Blajda Date: Wed, 30 Jan 2019 20:34:54 +0000 Subject: Use ToString for endpoint params --- src/helix/namespaces/videos.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/helix/namespaces/videos.rs') 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; impl VideosNamespace { - pub fn by_id(self, ids: Vec<&VideoId>) + pub fn by_id(self, ids: &[S]) -> IterableApiRequest> { 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(client: Client, ids: &[S]) -> IterableApiRequest> { 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(client: Client, user_id: &S) -> IterableApiRequest> { 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(client: Client, game_id: &S) -> IterableApiRequest> { 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)) -- cgit v1.2.3