vapi_client/models/
backoff_plan.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BackoffPlan {
17    /// This is the maximum number of retries to attempt if the request fails. Defaults to 0 (no retries).  @default 0
18    #[serde(rename = "maxRetries")]
19    pub max_retries: f64,
20    /// This is the type of backoff plan to use. Defaults to fixed.  @default fixed
21    #[serde(rename = "type")]
22    pub r#type: Type,
23    /// This is the base delay in seconds. For linear backoff, this is the delay between each retry. For exponential backoff, this is the initial delay.
24    #[serde(rename = "baseDelaySeconds")]
25    pub base_delay_seconds: f64,
26}
27
28impl BackoffPlan {
29    pub fn new(max_retries: f64, r#type: Type, base_delay_seconds: f64) -> BackoffPlan {
30        BackoffPlan {
31            max_retries,
32            r#type,
33            base_delay_seconds,
34        }
35    }
36}
37/// This is the type of backoff plan to use. Defaults to fixed.  @default fixed
38#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
39pub enum Type {
40    #[serde(rename = "fixed")]
41    Fixed,
42    #[serde(rename = "exponential")]
43    Exponential,
44}
45
46impl Default for Type {
47    fn default() -> Type {
48        Self::Fixed
49    }
50}