Skip to content

Commit

Permalink
Rename revoke_*_cancellation methods to withdraw_*_cancellation for c…
Browse files Browse the repository at this point in the history
…onsistency.
  • Loading branch information
MathiasPius committed Apr 9, 2024
1 parent c8e798a commit affd1b2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## 6.0.0

* ⚠️ `revoke_ip_cancellation` renmaed to `withdraw_ip_cancellation` for consistency.
* ⚠️ `revoke_subnet_cancellation` renamed to `withdraw_subnet_cancellation` for consistency.
* ⚠️ `withdraw_server_cancellation` now returns `()` not `Cancellation`, as defined in the Robot API.
* ⚠️ `cancel_server` now takes an `Option<Date>`, defaulting to *immediate* cancellation.
* ⚠️ `withdraw_server_order` removed. The API endpoint appears to have been silently removed, meaning calls to it will fail.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Detailed API overview.
- [x] **Cancellation.**
- [x] Get cancellation status.
- [x] Cancel server.[^1]
- [x] Revoke cancellation.[^1]
- [x] Withdraw server order.[^1]
- [x] Withdraw cancellation.[^1]
- [x] ~~Withdraw server order.~~[^1] - Deprecated by Hetzner.
- [x] **IP.**
- [x] List IPs.
- [x] Get IP.
Expand All @@ -85,7 +85,7 @@ Detailed API overview.
- [x] **Cancellation.**
- [x] Get cancellation status.
- [x] Cancel IP address[^1]
- [x] Revoke cancellation[^1]
- [x] Withdraw cancellation[^1]
- [x] **Subnet.**
- [x] List subnets.
- [x] Get subnet.
Expand All @@ -96,7 +96,7 @@ Detailed API overview.
- [x] **Cancellation.**[^1]
- [x] Get cancellation status.[^1]
- [x] Cancel subnet.[^1]
- [x] Revoke cancellation.[^1]
- [x] Withdraw cancellation.[^1]
- [x] **Reset**
- [x] List reset options for all servers.
- [x] Get reset options for single server
Expand Down
10 changes: 5 additions & 5 deletions src/api/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn cancel_ip(ip: Ipv4Addr, date: Date) -> UnauthenticatedRequest<Single<Cancelle
.with_serialized_body(format!("cancellation_date={date}"))
}

fn revoke_ip_cancellation(ip: Ipv4Addr) -> UnauthenticatedRequest<Single<Cancellable>> {
fn withdraw_ip_cancellation(ip: Ipv4Addr) -> UnauthenticatedRequest<Single<Cancellable>> {
UnauthenticatedRequest::from(&format!(
"https://robot-ws.your-server.de/ip/{ip}/cancellation"
))
Expand Down Expand Up @@ -239,18 +239,18 @@ impl AsyncRobot {
Ok(self.go(cancel_ip(ip, date)).await?.0)
}

/// Revoke IP address cancellation.
/// Withdraw IP address cancellation.
///
/// # Example
/// ```rust,no_run
/// # #[tokio::main]
/// # async fn main() {
/// let robot = hrobot::AsyncRobot::default();
/// robot.revoke_ip_cancellation("123.123.123.123".parse().unwrap()).await.unwrap();
/// robot.withdraw_ip_cancellation("123.123.123.123".parse().unwrap()).await.unwrap();
/// # }
/// ```
pub async fn revoke_ip_cancellation(&self, ip: Ipv4Addr) -> Result<Cancellable, Error> {
Ok(self.go(revoke_ip_cancellation(ip)).await?.0)
pub async fn withdraw_ip_cancellation(&self, ip: Ipv4Addr) -> Result<Cancellable, Error> {
Ok(self.go(withdraw_ip_cancellation(ip)).await?.0)
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/api/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn cancel_subnet(ip: Ipv4Addr, date: Date) -> UnauthenticatedRequest<Single<Canc
.with_serialized_body(format!("cancellation_date={date}"))
}

fn revoke_subnet_cancellation(ip: Ipv4Addr) -> UnauthenticatedRequest<Single<Cancellable>> {
fn withdraw_subnet_cancellation(ip: Ipv4Addr) -> UnauthenticatedRequest<Single<Cancellable>> {
UnauthenticatedRequest::from(&format!(
"https://robot-ws.your-server.de/subnet/{ip}/cancellation"
))
Expand Down Expand Up @@ -241,7 +241,7 @@ impl AsyncRobot {
Ok(self.go(cancel_subnet(ip, date)).await?.0)
}

/// Revoke subnet cancellation.
/// Withdraw subnet cancellation.
///
/// Note: Only IPv4 subnets can be cancelled.
///
Expand All @@ -250,11 +250,11 @@ impl AsyncRobot {
/// # #[tokio::main]
/// # async fn main() {
/// let robot = hrobot::AsyncRobot::default();
/// robot.revoke_ip_cancellation("123.123.123.123".parse().unwrap()).await.unwrap();
/// robot.withdraw_ip_cancellation("123.123.123.123".parse().unwrap()).await.unwrap();
/// # }
/// ```
pub async fn revoke_subnet_cancellation(&self, ip: Ipv4Addr) -> Result<Cancellable, Error> {
Ok(self.go(revoke_subnet_cancellation(ip)).await?.0)
pub async fn withdraw_subnet_cancellation(&self, ip: Ipv4Addr) -> Result<Cancellable, Error> {
Ok(self.go(withdraw_subnet_cancellation(ip)).await?.0)
}
}

Expand Down

0 comments on commit affd1b2

Please sign in to comment.