use http::Method;
use crate::{
api::{locales::LocaleCode, ProjectId},
auth::Authenticated,
query::DefaultModel,
Endpoint,
};
#[derive(Clone, Debug, Eq, Ord, Hash, PartialEq, PartialOrd)]
pub struct DeleteLocale {
pub project_id: ProjectId,
pub locale: LocaleCode,
}
impl DeleteLocale {
#[must_use]
pub const fn new(project_id: ProjectId, locale: LocaleCode) -> Self {
Self { project_id, locale }
}
}
impl Endpoint for DeleteLocale {
type AccessControl = Authenticated;
fn method(&self) -> Method {
Method::DELETE
}
fn endpoint(&self) -> std::borrow::Cow<'static, str> {
format!("projects/{}/translations/{}", self.project_id, self.locale).into()
}
}
impl DefaultModel for DeleteLocale {
type Model = ();
fn map(data: serde_json::Value) -> Result<Self::Model, serde_json::Error> {
serde_json::from_value(data)
}
}