openiap_proto/
workitem.rs

1#![warn(missing_docs)]
2use super::openiap::{
3    Envelope, PushWorkitemRequest, PushWorkitemsRequest, PopWorkitemRequest, UpdateWorkitemRequest, DeleteWorkitemRequest,
4    AddWorkItemQueueRequest, UpdateWorkItemQueueRequest, DeleteWorkItemQueueRequest
5};
6
7impl PushWorkitemRequest {
8    /// Creates a new `PushWorkitemRequest` with the given `workitem`.
9    pub fn to_envelope(&self) -> Envelope {
10        let any_message = prost_types::Any {
11            type_url: "type.googleapis.com/openiap.PushWorkitemRequest".to_string(),
12            value: {
13                let mut buf = Vec::new();
14                prost::Message::encode(self, &mut buf).unwrap_or(());
15                buf
16            },
17        };
18        Envelope {
19            command: "pushworkitem".into(),
20            data: Some(any_message.clone()),
21            ..Default::default() 
22        }
23    }
24}
25impl PushWorkitemsRequest {
26    /// Creates a new `PushWorkitemsRequest` with the given `workitem`.
27    pub fn to_envelope(&self) -> Envelope {
28        let any_message = prost_types::Any {
29            type_url: "type.googleapis.com/openiap.PushWorkitemsRequest".to_string(),
30            value: {
31                let mut buf = Vec::new();
32                prost::Message::encode(self, &mut buf).unwrap_or(());
33                buf
34            },
35        };
36        Envelope {
37            command: "pushworkitems".into(),
38            data: Some(any_message.clone()),
39            ..Default::default() 
40        }
41    }
42}
43impl PopWorkitemRequest {
44    /// Creates a new `PopWorkitemRequest` with the given `wiq`.
45    pub fn bywiq(wiq: &str) -> Self {
46        Self {
47            wiq: wiq.to_string(),
48            compressed: false,
49            includefiles: false,
50            wiqid: "".to_string(),
51        }
52    }
53    /// Creates a new `PopWorkitemRequest` with the given `wiqid`.
54    pub fn bywiqid(wiqid: &str) -> Self {
55        Self {
56            wiqid: wiqid.to_string(),
57            compressed: false,
58            includefiles: false,
59            wiq: "".to_string(),
60        }
61    }
62    /// Creates a new `PopWorkitemRequest` with the given `workitem`.
63    pub fn to_envelope(&self) -> Envelope {
64        let any_message = prost_types::Any {
65            type_url: "type.googleapis.com/openiap.PopWorkitemRequest".to_string(),
66            value: {
67                let mut buf = Vec::new();
68                prost::Message::encode(self, &mut buf).unwrap_or(());
69                buf
70            },
71        };
72        Envelope {
73            command: "popworkitem".into(),
74            data: Some(any_message.clone()),
75            ..Default::default() 
76        }
77    }
78}
79impl UpdateWorkitemRequest {
80    /// Creates a new `UpdateWorkitemRequest` with the given `workitem`.
81    pub fn to_envelope(&self) -> Envelope {
82        let any_message = prost_types::Any {
83            type_url: "type.googleapis.com/openiap.UpdateWorkitemRequest".to_string(),
84            value: {
85                let mut buf = Vec::new();
86                prost::Message::encode(self, &mut buf).unwrap_or(());
87                buf
88            },
89        };
90        Envelope {
91            command: "updateworkitem".into(),
92            data: Some(any_message.clone()),
93            ..Default::default() 
94        }
95    }    
96}
97impl DeleteWorkitemRequest {
98    /// Creates a new `DeleteWorkitemRequest` with the given `workitem`.
99    pub fn to_envelope(&self) -> Envelope {
100        let any_message = prost_types::Any {
101            type_url: "type.googleapis.com/openiap.DeleteWorkitemRequest".to_string(),
102            value: {
103                let mut buf = Vec::new();
104                prost::Message::encode(self, &mut buf).unwrap_or(());
105                buf
106            },
107        };
108        Envelope {
109            command: "deleteworkitem".into(),
110            data: Some(any_message.clone()),
111            ..Default::default() 
112        }
113    }
114}
115impl AddWorkItemQueueRequest {
116    /// Creates a new `AddWorkItemQueueRequest` with the given `workitem`.
117    pub fn to_envelope(&self) -> Envelope {
118        let any_message = prost_types::Any {
119            type_url: "type.googleapis.com/openiap.AddWorkItemQueueRequest".to_string(),
120            value: {
121                let mut buf = Vec::new();
122                prost::Message::encode(self, &mut buf).unwrap_or(());
123                buf
124            },
125        };
126        Envelope {
127            command: "addworkitemqueue".into(),
128            data: Some(any_message.clone()),
129            ..Default::default() 
130        }
131    }
132}
133impl UpdateWorkItemQueueRequest {
134    /// Creates a new `UpdateWorkItemQueueRequest` with the given `workitem`.
135    pub fn to_envelope(&self) -> Envelope {
136        let any_message = prost_types::Any {
137            type_url: "type.googleapis.com/openiap.UpdateWorkItemQueueRequest".to_string(),
138            value: {
139                let mut buf = Vec::new();
140                prost::Message::encode(self, &mut buf).unwrap_or(());
141                buf
142            },
143        };
144        Envelope {
145            command: "updateworkitemqueue".into(),
146            data: Some(any_message.clone()),
147            ..Default::default() 
148        }
149    }
150}
151impl DeleteWorkItemQueueRequest {
152    /// Creates a new `DeleteWorkItemQueueRequest` with the given `workitem`.
153    pub fn to_envelope(&self) -> Envelope {
154        let any_message = prost_types::Any {
155            type_url: "type.googleapis.com/openiap.DeleteWorkItemQueueRequest".to_string(),
156            value: {
157                let mut buf = Vec::new();
158                prost::Message::encode(self, &mut buf).unwrap_or(());
159                buf
160            },
161        };
162        Envelope {
163            command: "deleteworkitemqueue".into(),
164            data: Some(any_message.clone()),
165            ..Default::default() 
166        }
167    }
168}