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
use crate::Request;
use serde::{Deserialize, Serialize};
#[derive(Default, Clone, Serialize)]
pub struct UnsubscribeRequest {
#[serde(skip_serializing_if = "Option::is_none")]
streams: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
accounts: Option<Vec<String>>,
}
impl Request for UnsubscribeRequest {
type Response = UnsubscribeResponse;
fn method(&self) -> String {
"unsubscribe".to_owned()
}
}
impl UnsubscribeRequest {
pub fn new() -> Self {
Self::default()
}
pub fn streams(streams: &[&str]) -> Self {
let streams = streams.iter().map(|s| s.to_string()).collect();
Self {
streams: Some(streams),
..Default::default()
}
}
pub fn accounts(accounts: &[&str]) -> Self {
let accounts = accounts.iter().map(|a| a.to_string()).collect();
Self {
accounts: Some(accounts),
..Default::default()
}
}
}
#[derive(Debug, Deserialize)]
pub struct UnsubscribeResponse {}