openiap_proto/
queue.rs

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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#![warn(missing_docs)]
use super::protos::{Envelope, RegisterQueueRequest, UnRegisterQueueRequest, RegisterExchangeRequest, 
    WatchRequest, UnWatchRequest, QueueMessageRequest
};

impl RegisterQueueRequest {
    /// Creates a new `RegisterQueueRequest` with the given `queuename`.
    pub fn byqueuename(queuename: &str) -> Self {
        Self {
            queuename: queuename.to_string()
        }
    }
    /// Converts the `RegisterQueueRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.RegisterQueueRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "registerqueue".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }
}
impl RegisterExchangeRequest {
    /// Creates a new `RegisterExchangeRequest` with the given `exchangename`.
    pub fn byexchangename(exchangename: &str) -> Self {
        Self {
            exchangename: exchangename.to_string(),
            addqueue: true,
            ..Default::default()
        }
    }
    /// Converts the `RegisterExchangeRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.RegisterExchangeRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "registerexchange".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }
}
impl  UnRegisterQueueRequest {
    /// Creates a new `UnRegisterQueueRequest` with the given `queuename`.
    pub fn byqueuename(queuename: &str) -> Self {
        Self {
            queuename: queuename.to_string()
        }
    }
    /// Converts the `UnRegisterQueueRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.UnRegisterQueueRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "unregisterqueue".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }
    
}
impl WatchRequest {
    /// Creates a new `WatchRequest` with the given `collectionname` and `paths`.
    pub fn new(collectionname: &str, paths: Vec<String>) -> Self {
        Self {
            collectionname: collectionname.to_string(),
            paths
        }
    }
    /// Converts the `WatchRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.WatchRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "watch".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }
}
impl UnWatchRequest {
    /// Creates a new `UnWatchRequest` with the given `id`.
    pub fn byid(id: &str) -> Self {
        Self {
            id: id.to_string()
        }
    }
    /// Converts the `UnWatchRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.UnWatchRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "unwatch".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }
}
impl  QueueMessageRequest {
    /// Creates a new `QueueMessageRequest` with the given `queuename`, `data` and `striptoken`.
    pub fn byqueuename(queuename: &str, data: &str, striptoken: bool) -> Self {
        Self {
            queuename: queuename.to_string(),
            data: data.to_string(),
            striptoken,
            ..Default::default()
        }
    }
    /// Creates a new `QueueMessageRequest` with the given `exchangename`, `data` and `striptoken`.
    pub fn byexchangename(exchangename: &str, data: &str, striptoken: bool) -> Self {
        Self {
            exchangename: exchangename.to_string(),
            data: data.to_string(),
            striptoken,
            ..Default::default()
        }
    }
    /// Converts the `QueueMessageRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.QueueMessageRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "queuemessage".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}