Skip to content

Commit 32be300

Browse files
committed
Removed deprecated renewWhoisPrivacy
Removes the deprecated `get_whois_privacy` and `renew_whois_privacy` endpoints along with the `WhoisPrivacyRenewal` struct. See: dnsimple/dnsimple-developer#919
1 parent 29fe8e6 commit 32be300

File tree

7 files changed

+3
-229
lines changed

7 files changed

+3
-229
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
44

55
## main
66

7+
- REMOVED: Removed deprecated `get_whois_privacy` (dnsimple/dnsimple-developer#919)
8+
- REMOVED: Removed deprecated `renew_whois_privacy` (dnsimple/dnsimple-developer#919)
9+
710
## 4.0.0 - 2025-08-20
811

912
- CHANGED: Removed `from` and `to` fields in `EmailForward`. Please use `alias_email` and `destination_email` instead.

src/dnsimple/registrar_whois_privacy.rs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,13 @@ pub struct WhoisPrivacy {
2121
pub updated_at: String,
2222
}
2323

24-
/// Represents the whois privacy renewal data
25-
#[derive(Debug, Deserialize)]
26-
pub struct WhoisPrivacyRenewal {
27-
/// The renewal id in DNSimple
28-
pub id: u64,
29-
/// The associated domain ID.
30-
pub domain_id: u64,
31-
/// The associated WHOIS Privacy ID.
32-
pub whois_privacy_id: u64,
33-
/// The WHOIS Privacy order state.
34-
pub state: String,
35-
/// The date the WHOIS Privacy will expire on.
36-
pub expires_on: String,
37-
/// Whether the WHOIS Privacy is enabled for the domain.
38-
pub enabled: bool,
39-
/// When the WHOIS Privacy was created in DNSimple.
40-
pub created_at: String,
41-
/// When the WHOIS Privacy was last updated in DNSimple.
42-
pub updated_at: String,
43-
}
44-
4524
struct WhoisPrivacyEndpoint;
4625

4726
impl Endpoint for WhoisPrivacyEndpoint {
4827
type Output = WhoisPrivacy;
4928
}
5029

51-
struct WhoisPrivacyRenewalEndpoint;
52-
53-
impl Endpoint for WhoisPrivacyRenewalEndpoint {
54-
type Output = WhoisPrivacyRenewal;
55-
}
56-
5730
impl Registrar<'_> {
58-
/// Retrieve the domain WHOIS privacy
59-
///
60-
/// # Arguments
61-
///
62-
/// `account_id`: The account ID
63-
/// `domain`: The domain name or id
64-
pub fn get_whois_privacy(
65-
&self,
66-
account_id: u64,
67-
domain: String,
68-
) -> Result<DNSimpleResponse<WhoisPrivacy>, DNSimpleError> {
69-
let path = format!("/{}/registrar/domains/{}/whois_privacy", account_id, domain);
70-
71-
self.client.get::<WhoisPrivacyEndpoint>(&path, None)
72-
}
73-
7431
/// Enable WHOIS privacy
7532
///
7633
/// # Arguments
@@ -103,21 +60,4 @@ impl Registrar<'_> {
10360
self.client
10461
.delete_with_response::<WhoisPrivacyEndpoint>(&path)
10562
}
106-
107-
/// Renew WHOIS privacy
108-
///
109-
/// # Arguments
110-
///
111-
/// `account_id`: The account ID
112-
/// `domain`: The domain name or id
113-
pub fn renew_whois_privacy(
114-
&self,
115-
account_id: u64,
116-
domain: String,
117-
) -> Result<DNSimpleResponse<WhoisPrivacyRenewal>, DNSimpleError> {
118-
let path = format!("/{}/registrar/domains/{}/whois_privacy", account_id, domain);
119-
120-
self.client
121-
.post::<WhoisPrivacyRenewalEndpoint>(&path, Value::Null)
122-
}
12363
}

tests/fixtures/v2/api/getWhoisPrivacy/success.http

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/fixtures/v2/api/renewWhoisPrivacy/success.http

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-duplicated-order.http

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-not-found.http

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,6 @@
11
use crate::common::setup_mock_for;
22
mod common;
33

4-
#[test]
5-
fn get_whois_privacy_test() {
6-
let setup = setup_mock_for(
7-
"/1385/registrar/domains/example.com/whois_privacy",
8-
"getWhoisPrivacy/success",
9-
"GET",
10-
);
11-
let client = setup.0;
12-
let account_id = 1385;
13-
let domain = "example.com";
14-
15-
let whois_privacy = client
16-
.registrar()
17-
.get_whois_privacy(account_id, String::from(domain))
18-
.unwrap()
19-
.data
20-
.unwrap();
21-
22-
assert_eq!(1, whois_privacy.id);
23-
assert_eq!(2, whois_privacy.domain_id);
24-
assert_eq!("2017-02-13", whois_privacy.expires_on.unwrap());
25-
assert!(whois_privacy.enabled.unwrap());
26-
assert_eq!("2016-02-13T14:34:50Z", whois_privacy.created_at);
27-
assert_eq!("2016-02-13T14:34:52Z", whois_privacy.updated_at);
28-
}
29-
304
#[test]
315
fn enable_whois_privacy_test() {
326
let setup = setup_mock_for(
@@ -101,74 +75,3 @@ fn disable_whois_privacy_test() {
10175
assert_eq!("2016-02-13T14:34:50Z", whois_privacy.created_at);
10276
assert_eq!("2016-02-13T14:36:38Z", whois_privacy.updated_at);
10377
}
104-
105-
#[test]
106-
fn renew_whois_privacy_test() {
107-
let setup = setup_mock_for(
108-
"/1385/registrar/domains/example.com/whois_privacy",
109-
"renewWhoisPrivacy/success",
110-
"POST",
111-
);
112-
let client = setup.0;
113-
let account_id = 1385;
114-
let domain = "example.com";
115-
116-
let response = client
117-
.registrar()
118-
.renew_whois_privacy(account_id, String::from(domain))
119-
.unwrap();
120-
121-
assert_eq!(201, response.status);
122-
123-
let whois_privacy_renewal = response.data.unwrap();
124-
125-
assert_eq!(1, whois_privacy_renewal.id);
126-
assert_eq!(100, whois_privacy_renewal.domain_id);
127-
assert_eq!(999, whois_privacy_renewal.whois_privacy_id);
128-
assert_eq!("new", whois_privacy_renewal.state);
129-
assert_eq!("2020-01-10", whois_privacy_renewal.expires_on);
130-
assert!(whois_privacy_renewal.enabled);
131-
assert_eq!("2019-01-10T12:12:48Z", whois_privacy_renewal.created_at);
132-
assert_eq!("2019-01-10T12:12:48Z", whois_privacy_renewal.updated_at);
133-
}
134-
135-
#[test]
136-
fn renew_whois_privacy_duplicated_order_test() {
137-
let setup = setup_mock_for(
138-
"/1385/registrar/domains/example.com/whois_privacy",
139-
"renewWhoisPrivacy/whois-privacy-duplicated-order",
140-
"POST",
141-
);
142-
let client = setup.0;
143-
let account_id = 1385;
144-
let domain = "example.com";
145-
146-
let response = client
147-
.registrar()
148-
.renew_whois_privacy(account_id, String::from(domain));
149-
let errors = response.unwrap_err();
150-
151-
assert_eq!("The whois privacy for example.com has just been renewed, a new renewal cannot be started at this time", errors.to_string());
152-
}
153-
154-
#[test]
155-
fn renew_whois_privacy_not_found_test() {
156-
let setup = setup_mock_for(
157-
"/1385/registrar/domains/example.com/whois_privacy",
158-
"renewWhoisPrivacy/whois-privacy-not-found",
159-
"POST",
160-
);
161-
let client = setup.0;
162-
let account_id = 1385;
163-
let domain = "example.com";
164-
165-
let response = client
166-
.registrar()
167-
.renew_whois_privacy(account_id, String::from(domain));
168-
let errors = response.unwrap_err();
169-
170-
assert_eq!(
171-
"WHOIS privacy not found for example.com",
172-
errors.to_string()
173-
);
174-
}

0 commit comments

Comments
 (0)