use crate::{Color, Locale, Orientation, Size};
use serde::{Deserialize, Serialize};
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PhotoSearchQuery {
query: String,
orientation: Option<Orientation>,
size: Option<Size>,
color: Option<Color>,
locale: Option<Locale>,
page: Option<i64>,
per_page: Option<i64>,
}
impl PhotoSearchQuery {
pub fn new(query: String) -> Self {
Self {
query,
..Default::default()
}
}
pub fn orientation(mut self, orientation: Orientation) -> Self {
self.orientation = Some(orientation);
self
}
pub fn size(mut self, size: Size) -> Self {
self.size = Some(size);
self
}
pub fn color(mut self, color: Color) -> Self {
self.color = Some(color);
self
}
pub fn locale(mut self, locale: Locale) -> Self {
self.locale = Some(locale);
self
}
pub fn page(mut self, page: i64) -> Self {
self.page = Some(page);
self
}
pub fn per_page(mut self, per_page: i64) -> Self {
self.per_page = Some(per_page);
self
}
}