aboutsummaryrefslogtreecommitdiff
path: root/src/call/nameserver.rs
blob: 178ac6f900bca3ef266bf806c546fa9c82dde64b (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use crate::response::nameserver::RecordInfo as RecordInfoResponse;
use super::*;

use serde_derive::{Deserialize, Serialize};

/// Optional search constraints to find nameserver records
/// the account has access to.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RecordInfo {
    #[serde(rename = "domain")]
    pub domain_name: Option<String>,
    #[serde(rename = "roId")]
    pub domain_id: Option<i32>,
    #[serde(rename = "recordId")]
    pub record_id: Option<i32>,
    #[serde(rename = "type")]
    pub record_type: Option<String>,
    pub name: Option<String>,
    pub content: Option<String>,
    pub ttl: Option<i32>,
    #[serde(rename = "prio")]
    pub priority: Option<i32>,
}

impl Call for RecordInfo {
    fn method_name(&self) -> String {
        String::from("nameserver.info")
    }

    fn expected(&self) -> Vec<i32> {
        vec![1000]
    }
}

impl Response<RecordInfoResponse> for RecordInfo {}

/// Update the records with the specified IDs.
/// Any `None` variants will remain unchanged.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RecordUpdate {
    #[serde(rename = "id")]
    pub ids: Vec<i32>,
    pub name: Option<String>,
    #[serde(rename = "type")]
    pub record_type: Option<String>,
    pub content: Option<String>,
    pub ttl: Option<i32>,
    #[serde(rename = "prio")]
    pub priority: Option<i32>,
    #[serde(rename = "urlRedirectType")]
    pub url_rdr_type: Option<String>,
    #[serde(rename = "urlRedirectTitle")]
    pub url_rdr_title: Option<String>,
    #[serde(rename = "urlRedirectDescription")]
    pub url_rdr_desc: Option<String>,
    #[serde(rename = "urlRedirectKeywords")]
    pub url_rdr_keywords: Option<String>,
    #[serde(rename = "urlRedirectFavIcon")]
    pub url_rdr_favicon: Option<String>,
    #[serde(rename = "urlAppend")]
    pub url_append: Option<bool>,
    #[serde(rename = "testing")]
    pub testing_mode: bool,
}

impl Call for RecordUpdate {
    fn method_name(&self) -> String {
        String::from("nameserver.updateRecord")
    }

    fn expected(&self) -> Vec<i32> {
        vec![1000]
    }
}

impl Response<()> for RecordUpdate {}