matrix_sdk_crypto/types/requests/
mod.rs

1// Copyright 2020 The Matrix.org Foundation C.I.C.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Modules containing customized request types.
16
17use std::sync::Arc;
18
19use ruma::{OwnedTransactionId, TransactionId};
20
21mod enums;
22mod keys_backup;
23mod keys_query;
24mod room_message;
25mod signing_keys;
26mod to_device;
27mod verification;
28
29pub use enums::*;
30pub use keys_backup::*;
31pub use keys_query::*;
32pub use room_message::*;
33pub use signing_keys::*;
34pub use to_device::*;
35pub use verification::*;
36
37/// Outgoing request type, holds the unique ID of the request and the actual
38/// request.
39#[derive(Debug, Clone)]
40pub struct OutgoingRequest {
41    /// The unique id of a request, needs to be passed when receiving a
42    /// response.
43    pub(crate) request_id: OwnedTransactionId,
44    /// The underlying outgoing request.
45    pub(crate) request: Arc<AnyOutgoingRequest>,
46}
47
48impl OutgoingRequest {
49    /// Get the unique id of this request.
50    pub fn request_id(&self) -> &TransactionId {
51        &self.request_id
52    }
53
54    /// Get the underlying outgoing request.
55    pub fn request(&self) -> &AnyOutgoingRequest {
56        &self.request
57    }
58}