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};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct BackoffPlan {
19    /// This is the maximum number of retries to attempt if the request fails. Defaults to 0 (no retries).  @default 0
20    #[serde(rename = "maxRetries")]
21    pub max_retries: f64,
22    /// This is the type of backoff plan to use. Defaults to fixed.  @default fixed
23    #[serde(rename = "type")]
24    pub r#type: Type,
25    /// 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.
26    #[serde(rename = "baseDelaySeconds")]
27    pub base_delay_seconds: f64,
28}
29
30impl BackoffPlan {
31    pub fn new(max_retries: f64, r#type: Type, base_delay_seconds: f64) -> BackoffPlan {
32        BackoffPlan {
33            max_retries,
34            r#type,
35            base_delay_seconds,
36        }
37    }
38}
39/// This is the type of backoff plan to use. Defaults to fixed.  @default fixed
40#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
41pub enum Type {
42    #[serde(rename = "fixed")]
43    Fixed,
44    #[serde(rename = "exponential")]
45    Exponential,
46}
47
48impl Default for Type {
49    fn default() -> Type {
50        Self::Fixed
51    }
52}