aboutsummaryrefslogtreecommitdiff
path: root/aero-dav/src/synctypes.rs
blob: 2a14221d2aa6dc69863aef360b446d06553e9a1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use super::types as dav;
use super::versioningtypes as vers;

// RFC 6578
// https://datatracker.ietf.org/doc/html/rfc6578

#[derive(Debug, PartialEq, Clone)]
pub enum PropertyRequest {
    SyncToken,
}

#[derive(Debug, PartialEq, Clone)]
pub enum Property {
    SyncToken(SyncToken),
}

#[derive(Debug, PartialEq, Clone)]
pub enum ReportTypeName {
    SyncCollection,
}

#[derive(Debug, PartialEq, Clone)]
pub struct Multistatus {
    pub sync_token: SyncToken,
}

//@FIXME add SyncToken to Multistatus

///  Name:  sync-collection
///
/// Namespace:  DAV:
///
/// Purpose:  WebDAV report used to synchronize data between client and
/// server.
///
/// Description:  See Section 3.
///
/// <!ELEMENT sync-collection (sync-token, sync-level, limit?, prop)>
///
/// <!-- DAV:limit defined in RFC 5323, Section 5.17 -->
/// <!-- DAV:prop defined in RFC 4918, Section 14.18 -->

#[derive(Debug, PartialEq, Clone)]
pub struct SyncCollection<E: dav::Extension> {
    pub sync_token: SyncTokenRequest,
    pub sync_level: SyncLevel,
    pub limit: Option<vers::Limit>,
    pub prop: dav::PropName<E>,
}

/// Name:  sync-token
///
/// Namespace:  DAV:
///
/// Purpose:  The synchronization token provided by the server and
/// returned by the client.
///
/// Description:  See Section 3.
///
/// <!ELEMENT sync-token CDATA>
///
/// <!-- Text MUST be a URI -->
/// Used by multistatus
#[derive(Debug, PartialEq, Clone)]
pub struct SyncToken(pub String);

/// Used by propfind and report sync-collection
#[derive(Debug, PartialEq, Clone)]
pub enum SyncTokenRequest {
    InitialSync,
    IncrementalSync(String),
}

/// Name:  sync-level
///
/// Namespace:  DAV:
///
/// Purpose:  Indicates the "scope" of the synchronization report
/// request.
///
/// Description:  See Section 3.3.
#[derive(Debug, PartialEq, Clone)]
pub enum SyncLevel {
    One,
    Infinite,
}