fcm_service/domain/
apns_config.rs

1use std::{collections::HashMap, hash::RandomState};
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// Configuration for Apple Push Notification Service (APNs).
7 #[derive(Clone, Debug, Serialize, Deserialize, Default)]
8pub struct ApnsConfig {
9    headers: Option<HashMap<String, String>>,
10    payload: Option<HashMap<String, serde_json::Value>>,
11}
12
13impl ApnsConfig {
14    #[must_use]
15    pub fn new() -> Self {
16        Self {
17            ..Default::default()
18        }
19    }
20
21    #[must_use]
22    pub fn headers(&self) -> Option<&HashMap<String, String, RandomState>> {
23        self.headers.as_ref()
24    }
25
26    #[must_use]
27    pub fn payload(&self) -> Option<&HashMap<String, Value, RandomState>> {
28        self.payload.as_ref()
29    }
30
31    pub fn set_headers(&mut self, headers: Option<HashMap<String, String>>) {
32        self.headers = headers;
33    }
34
35    pub fn set_payload(&mut self, payload: Option<HashMap<String, serde_json::Value>>) {
36        self.payload = payload;
37    }
38}