-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa5dbf8
commit dd3f8b7
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use crate::api::Success; | ||
use crate::types::hooks::HookResponse; | ||
use crate::Client; | ||
use crate::Result; | ||
use serde_derive::{Deserialize, Serialize}; | ||
|
||
impl Client { | ||
/// Resends all failed webhook notifications. | ||
/// | ||
/// See | ||
/// * [resendWebhooks](https://docs.fireblocks.com/api/swagger-ui/#/Webhooks/resendWebhooks) | ||
#[tracing::instrument(level = "debug", skip(self))] | ||
pub async fn hooks_resend(&self) -> Result<HookResponse> { | ||
let u = self.build_url("webhooks/resend")?.0; | ||
self.post::<HookResponse, ()>(u, None).await | ||
} | ||
|
||
/// Resend a specific transaction by txId | ||
/// | ||
/// See | ||
/// * [resendTransactionWebhooks](https://docs.fireblocks.com/api/swagger-ui/#/Webhooks/resendTransactionWebhooks) | ||
#[tracing::instrument(level = "debug", skip(self))] | ||
pub async fn hooks_resend_tx(&self, tx_id: &str, created: bool, updated: bool) -> Result<Success> { | ||
#[derive(Debug, Deserialize, Serialize, Default)] | ||
#[serde(rename_all = "camelCase")] | ||
struct HookTransaction { | ||
resend_created: bool, | ||
resend_status_updated: bool, | ||
} | ||
let request = HookTransaction { resend_created: created, resend_status_updated: updated }; | ||
let u = self.build_url(format!("webhooks/resend/{tx_id}"))?.0; | ||
self.post::<Success, HookTransaction>(u, Some(request).as_ref()).await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use serde_derive::Deserialize; | ||
|
||
#[derive(Debug, Deserialize, Default)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct HookResponse { | ||
pub message_count: u32, | ||
} |