//! # Movie API information //! //! @author Pierre Hubert use serde::Serialize; use crate::data::movie::Movie; use crate::utils::user_data_utils::user_data_url; #[derive(Serialize)] #[allow(non_snake_case)] pub struct MovieAPI { id: u64, uri: String, url: String, userID: u64, name: String, file_type: String, size: usize, } impl MovieAPI { /// Construct a new instance of movie pub fn new(m: &Movie) -> MovieAPI { MovieAPI { id: m.id, uri: m.uri.clone(), url: user_data_url(m.uri.as_str()), userID: m.user_id.id(), name: m.name.clone(), file_type: m.file_type.clone(), size: m.size, } } }