bolt_proto/message/
init.rs

1use std::collections::HashMap;
2
3use bolt_proto_derive::*;
4
5use crate::{impl_try_from_message, message::SIGNATURE_INIT, Value};
6
7#[bolt_structure(SIGNATURE_INIT)]
8#[derive(Debug, Clone, Eq, PartialEq)]
9pub struct Init {
10    pub(crate) user_agent: String,
11    pub(crate) auth_token: HashMap<String, Value>,
12}
13
14impl Init {
15    pub fn new(user_agent: String, auth_token: HashMap<String, Value>) -> Self {
16        Self {
17            user_agent,
18            auth_token,
19        }
20    }
21
22    pub fn user_agent(&self) -> &str {
23        &self.user_agent
24    }
25
26    pub fn auth_token(&self) -> &HashMap<String, Value> {
27        &self.auth_token
28    }
29}
30
31impl_try_from_message!(Init, Init);