fireblocks_sdk/models/
notification_attempt.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    crate::models,
11    serde::{Deserialize, Serialize},
12};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct NotificationAttempt {
16    /// The time when the attempt was sent in milliseconds.
17    #[serde(rename = "sentTime")]
18    pub sent_time: i64,
19    /// The duration of the attempt in milliseconds.
20    #[serde(rename = "duration")]
21    pub duration: i32,
22    /// The response code of the attempt, when missing refer to failureReason.
23    #[serde(rename = "responseCode", skip_serializing_if = "Option::is_none")]
24    pub response_code: Option<i32>,
25    /// The request failure reason in case responseCode is missing.
26    #[serde(rename = "failureReason", skip_serializing_if = "Option::is_none")]
27    pub failure_reason: Option<FailureReason>,
28}
29
30impl NotificationAttempt {
31    pub fn new(sent_time: i64, duration: i32) -> NotificationAttempt {
32        NotificationAttempt {
33            sent_time,
34            duration,
35            response_code: None,
36            failure_reason: None,
37        }
38    }
39}
40/// The request failure reason in case responseCode is missing.
41#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
42pub enum FailureReason {
43    #[serde(rename = "TIMED_OUT")]
44    TimedOut,
45    #[serde(rename = "NO_RESPONSE")]
46    NoResponse,
47}
48
49impl Default for FailureReason {
50    fn default() -> FailureReason {
51        Self::TimedOut
52    }
53}