mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 16:32:29 +00:00
Add namespaces to propnames
This commit is contained in:
@@ -8,10 +8,10 @@ use rustical_dav::{
|
||||
xml::Resourcetype,
|
||||
};
|
||||
use rustical_store::{auth::User, AddressObject, AddressbookStore};
|
||||
use rustical_xml::{XmlDeserialize, XmlSerialize};
|
||||
use rustical_xml::{EnumVariants, XmlDeserialize, XmlSerialize};
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
use strum::{EnumDiscriminants, EnumString, IntoStaticStr, VariantNames};
|
||||
use strum::{EnumDiscriminants, EnumString, IntoStaticStr};
|
||||
|
||||
use super::methods::{get_object, put_object};
|
||||
|
||||
@@ -20,10 +20,10 @@ pub struct AddressObjectResourceService<AS: AddressbookStore> {
|
||||
addr_store: Arc<AS>,
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone, EnumVariants)]
|
||||
#[strum_discriminants(
|
||||
name(AddressObjectPropName),
|
||||
derive(EnumString, VariantNames, IntoStaticStr),
|
||||
derive(EnumString, IntoStaticStr),
|
||||
strum(serialize_all = "kebab-case")
|
||||
)]
|
||||
pub enum AddressObjectProp {
|
||||
|
||||
@@ -16,14 +16,13 @@ use rustical_dav::resource::{Resource, ResourceService};
|
||||
use rustical_dav::xml::{Resourcetype, ResourcetypeInner};
|
||||
use rustical_store::auth::User;
|
||||
use rustical_store::{Addressbook, AddressbookStore, SubscriptionStore};
|
||||
use rustical_xml::{XmlDeserialize, XmlSerialize};
|
||||
use rustical_xml::{EnumVariants, XmlDeserialize, XmlSerialize};
|
||||
use std::marker::PhantomData;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use strum::{EnumDiscriminants, EnumString, IntoStaticStr, VariantNames};
|
||||
use strum::{EnumDiscriminants, EnumString, IntoStaticStr};
|
||||
|
||||
pub struct AddressbookResourceService<AS: AddressbookStore, S: SubscriptionStore>
|
||||
{
|
||||
pub struct AddressbookResourceService<AS: AddressbookStore, S: SubscriptionStore> {
|
||||
addr_store: Arc<AS>,
|
||||
__phantom_sub: PhantomData<S>,
|
||||
}
|
||||
@@ -37,10 +36,10 @@ impl<A: AddressbookStore, S: SubscriptionStore> AddressbookResourceService<A, S>
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone, EnumVariants)]
|
||||
#[strum_discriminants(
|
||||
name(AddressbookPropName),
|
||||
derive(EnumString, VariantNames, IntoStaticStr),
|
||||
derive(EnumString, IntoStaticStr),
|
||||
strum(serialize_all = "kebab-case")
|
||||
)]
|
||||
pub enum AddressbookProp {
|
||||
@@ -87,8 +86,8 @@ impl Resource for AddressbookResource {
|
||||
|
||||
fn get_resourcetype(&self) -> Resourcetype {
|
||||
Resourcetype(&[
|
||||
ResourcetypeInner(rustical_dav::namespace::NS_DAV, "collection"),
|
||||
ResourcetypeInner(rustical_dav::namespace::NS_CARDDAV, "addressbook"),
|
||||
ResourcetypeInner(Some(rustical_dav::namespace::NS_DAV), "collection"),
|
||||
ResourcetypeInner(Some(rustical_dav::namespace::NS_CARDDAV), "addressbook"),
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ use rustical_dav::resource::{NamedRoute, Resource, ResourceService};
|
||||
use rustical_dav::xml::{HrefElement, Resourcetype, ResourcetypeInner};
|
||||
use rustical_store::auth::User;
|
||||
use rustical_store::AddressbookStore;
|
||||
use rustical_xml::{XmlDeserialize, XmlSerialize};
|
||||
use rustical_xml::{EnumVariants, XmlDeserialize, XmlSerialize};
|
||||
use std::sync::Arc;
|
||||
use strum::{EnumDiscriminants, EnumString, IntoStaticStr, VariantNames};
|
||||
use strum::{EnumDiscriminants, EnumString, IntoStaticStr};
|
||||
|
||||
pub struct PrincipalResourceService<A: AddressbookStore> {
|
||||
addr_store: Arc<A>,
|
||||
@@ -26,10 +26,10 @@ pub struct PrincipalResource {
|
||||
principal: String,
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone, EnumVariants)]
|
||||
#[strum_discriminants(
|
||||
name(PrincipalPropName),
|
||||
derive(EnumString, VariantNames, IntoStaticStr),
|
||||
derive(EnumString, IntoStaticStr),
|
||||
strum(serialize_all = "kebab-case")
|
||||
)]
|
||||
pub enum PrincipalProp {
|
||||
@@ -69,8 +69,8 @@ impl Resource for PrincipalResource {
|
||||
|
||||
fn get_resourcetype(&self) -> Resourcetype {
|
||||
Resourcetype(&[
|
||||
ResourcetypeInner(rustical_dav::namespace::NS_DAV, "collection"),
|
||||
ResourcetypeInner(rustical_dav::namespace::NS_DAV, "principal"),
|
||||
ResourcetypeInner(Some(rustical_dav::namespace::NS_DAV), "collection"),
|
||||
ResourcetypeInner(Some(rustical_dav::namespace::NS_DAV), "principal"),
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user