termii_rust/common/switch/
campaign.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug)]
4pub struct PhoneBookListResponse {
5 pub data: Vec<PhoneBookItem>,
6 pub links: Links,
7 pub meta: Meta,
8}
9
10#[derive(Serialize, Deserialize, Debug)]
11pub struct PhoneBookItem {
12 pub id: String,
13 pub name: String,
14 pub total_number_of_contacts: i64,
15 pub date_created: String,
16 pub last_updated: String,
17}
18
19#[derive(Serialize, Deserialize, Debug)]
20pub struct Links {
21 pub first: String,
22 pub last: String,
23 pub prev: Option<String>,
24 pub next: Option<String>,
25}
26
27#[derive(Serialize, Deserialize, Debug)]
28pub struct Meta {
29 pub current_page: i64,
30 pub from: Option<i64>,
31 pub last_page: i64,
32 pub path: String,
33 pub per_page: i64,
34 pub to: Option<i64>,
35 pub total: i64,
36}
37
38#[derive(Serialize, Deserialize, Debug)]
39pub struct PhoneBookCreateUpdateDeleteResponse {
40 pub message: String,
41}
42
43#[derive(Serialize, Deserialize, Debug)]
44pub struct PhoneBookCreateUpdateRequest {
45 pub phonebook_name: String,
46 pub description: String,
47 pub api_key: Option<String>,
48}
49
50impl PhoneBookCreateUpdateRequest {
51 pub fn new(phonebook_name: String, description: String) -> PhoneBookCreateUpdateRequest {
52 PhoneBookCreateUpdateRequest {
53 phonebook_name,
54 description,
55 api_key: None,
56 }
57 }
58
59 pub(crate) fn set_api_key(&mut self, api_key: &str) {
60 self.api_key = Some(api_key.to_string());
61 }
62}