summaryrefslogtreecommitdiff
path: root/src/helix/namespaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/helix/namespaces')
-rw-r--r--src/helix/namespaces/auth.rs19
-rw-r--r--src/helix/namespaces/clips.rs32
-rw-r--r--src/helix/namespaces/mod.rs26
-rw-r--r--src/helix/namespaces/users.rs44
-rw-r--r--src/helix/namespaces/videos.rs75
5 files changed, 0 insertions, 196 deletions
diff --git a/src/helix/namespaces/auth.rs b/src/helix/namespaces/auth.rs
deleted file mode 100644
index d006e2f..0000000
--- a/src/helix/namespaces/auth.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use super::*;
-use crate::models::Credentials;
-use crate::namespace::auth;
-
-pub struct Auth {}
-type AuthNamespace = Namespace<Auth>;
-
-impl AuthNamespace {
- pub fn client_credentials(self, secret: &str)
- -> ApiRequest<Credentials> {
- auth::client_credentials(self.client.inner, &secret)
- }
-}
-
-impl Client {
- pub fn auth(&self) -> AuthNamespace {
- AuthNamespace::new(self)
- }
-}
diff --git a/src/helix/namespaces/clips.rs b/src/helix/namespaces/clips.rs
deleted file mode 100644
index c4595ce..0000000
--- a/src/helix/namespaces/clips.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use super::*;
-use super::models::{DataContainer, Clip};
-
-pub struct Clips {}
-type ClipsNamespace = Namespace<Clips>;
-
-impl ClipsNamespace {
- pub fn clip<S: ToString>(self, id: &S) -> ApiRequest<DataContainer<Clip>> {
- use self::clip;
- clip(self.client, id)
- }
-}
-
-impl Client {
- pub fn clips(&self) -> ClipsNamespace {
- ClipsNamespace::new(self)
- }
-}
-
-
-pub fn clip<S: ToString>(client: Client, id: &S)
- -> ApiRequest<DataContainer<Clip>>
-{
- let client = client.inner;
- let url =
- String::from("https://") +
- client.domain() + "/helix/clips" + "?id=" + &id.to_string();
-
- let params : ParamList = BTreeMap::new();
-
- ApiRequest::new(url, params, client, Method::GET, Some(RatelimitKey::Default))
-}
diff --git a/src/helix/namespaces/mod.rs b/src/helix/namespaces/mod.rs
deleted file mode 100644
index 1d4239a..0000000
--- a/src/helix/namespaces/mod.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-use std::marker::PhantomData;
-
-pub use super::Client;
-pub use crate::client::{RatelimitKey, ClientTrait, ApiRequest, IterableApiRequest, ParamList};
-pub use std::collections::BTreeMap;
-pub use reqwest::Method;
-pub use super::models;
-
-pub mod clips;
-pub mod users;
-pub mod videos;
-pub mod auth;
-
-pub struct Namespace<T> {
- client: Client,
- _type: PhantomData<T>
-}
-
-impl<T> Namespace<T> {
- pub fn new(client: &Client) -> Self {
- Namespace {
- client: client.clone(),
- _type: PhantomData,
- }
- }
-}
diff --git a/src/helix/namespaces/users.rs b/src/helix/namespaces/users.rs
deleted file mode 100644
index 2e922d6..0000000
--- a/src/helix/namespaces/users.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-use super::*;
-use super::models::{DataContainer, User};
-use std::string::ToString;
-
-pub struct Users {}
-type UsersNamespace = Namespace<Users>;
-
-impl UsersNamespace {
- pub fn users<S: ToString>(self, ids: &[S], logins: &[S]) -> ApiRequest<DataContainer<User>> {
- use self::users;
- users(self.client, ids, logins)
- }
-}
-
-impl Client {
- pub fn users(&self) -> UsersNamespace {
- UsersNamespace::new(self)
- }
-}
-
-pub fn users<S: ToString>(
- client: Client,
- ids: &[S],
- logins: &[S],
- ) -> ApiRequest<DataContainer<User>> {
- let client = client.inner;
- let url =
- String::from("https://") + client.domain() + &String::from("/helix/users");
-
- let mut params: BTreeMap<&str, &dyn ToString> = BTreeMap::new();
- for id in ids {
- params.insert("id", id);
- }
-
- for login in logins {
- params.insert("login", login);
- }
-
- ApiRequest::new(url, params, client, Method::GET, Some(RatelimitKey::Default))
-}
-
-pub fn authed_as(client: Client) -> ApiRequest<DataContainer<User>> {
- users(client, &[""], &[""])
-}
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))
-}