// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// One attempt of an api_call (initial + retries).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ApiCallAttempt {
    /// 0-based attempt index
    pub attempt_number: i64,
    pub request_method: String,
    pub request_url: String,
    /// Defaults to `{}`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub request_headers: Option<std::collections::HashMap<String, String>>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub request_body: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub response_status: Option<i64>,
    /// Defaults to `{}`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub response_headers: Option<std::collections::HashMap<String, String>>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub response_body: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub duration_ms: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<ErrorDetails>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub started_at: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub completed_at: Option<String>,
}
impl ApiCallAttempt {
    /// Construct a new `ApiCallAttempt` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        attempt_number: i64,
        request_method: impl Into<String>,
        request_url: impl Into<String>,
    ) -> Self {
        Self {
            attempt_number,
            request_method: request_method.into(),
            request_url: request_url.into(),
            request_headers: Default::default(),
            request_body: Default::default(),
            response_status: Default::default(),
            response_headers: Default::default(),
            response_body: Default::default(),
            duration_ms: Default::default(),
            error: Default::default(),
            started_at: Default::default(),
            completed_at: Default::default(),
        }
    }
}
