diff options
author | David Blajda <blajda@hotmail.com> | 2018-12-10 19:34:05 +0000 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2018-12-10 19:34:05 +0000 |
commit | 7e60a4edcef897c3810fb4ae0564228fe853bf00 (patch) | |
tree | 47ee1e8f2155413cac2ec2d209683894ef6c70ff | |
parent | 9b4da6dadd78a422fed21429f65c5e5590023a10 (diff) |
Add models
-rw-r--r-- | src/models.rs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/models.rs b/src/models.rs new file mode 100644 index 0000000..6aec705 --- /dev/null +++ b/src/models.rs @@ -0,0 +1,54 @@ +extern crate serde_json; + +#[derive(Debug, Deserialize)] +pub struct DataContainer<T> { + pub data: Vec<T> +} + +#[derive(Debug, Deserialize)] +pub struct Cursor { + cursor: String +} + +#[derive(Debug, Deserialize)] +pub struct PaginationContainer<T> { + pub data: Vec<T>, + pub pagination: Option<Cursor> +} + +#[derive(Debug, Deserialize)] +pub struct Video { + pub id: String, + pub user_id: String, + pub user_name: String, + pub title: String, + pub description: String, + //Should be converted to a DateTime + pub created_at: String, + pub published_at: String, + //Should be converted to a URL + pub url: String, + thumbnail_url: String, + viewable: String, + view_count: i32, + language: String, + #[serde(rename = "type")] + video_type: String, + //Should be converted to a Duration + duration: String, +} + +#[derive(Debug, Deserialize)] +pub struct User { + pub id: String, + pub login: String, + pub display_name: String, + #[serde(rename = "type")] + pub user_type: String, + pub broadcaster_type: String, + pub description: String, + pub profile_image_url: String, + pub offline_image_url: String, + pub view_count: u32, + pub email: Option<String>, +} |