openai-client-base 0.16.0

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct WebhookEndpointTestResultResource {
    /// The object type, which is always webhook_endpoint.test.
    #[serde(rename = "object")]
    pub object: Object,
    /// The ID of the webhook endpoint that received the test.
    #[serde(rename = "webhook_endpoint_id")]
    pub webhook_endpoint_id: String,
    /// The event type sent in the test.
    #[serde(rename = "event_type")]
    pub event_type: String,
    /// The HTTP status code returned by the endpoint.
    #[serde(rename = "status_code")]
    pub status_code: i32,
    /// Whether the test request completed. Always true for returned results; use status_code to determine the endpoint response.
    #[serde(rename = "success")]
    pub success: Success,
}

impl WebhookEndpointTestResultResource {
    pub fn new(
        object: Object,
        webhook_endpoint_id: String,
        event_type: String,
        status_code: i32,
        success: Success,
    ) -> WebhookEndpointTestResultResource {
        WebhookEndpointTestResultResource {
            object,
            webhook_endpoint_id,
            event_type,
            status_code,
            success,
        }
    }
}
/// The object type, which is always webhook_endpoint.test.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "webhook_endpoint.test")]
    WebhookEndpointTest,
}

impl Default for Object {
    fn default() -> Object {
        Self::WebhookEndpointTest
    }
}
/// Whether the test request completed. Always true for returned results; use status_code to determine the endpoint response.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Success {
    #[serde(rename = "true")]
    True,
}

impl Default for Success {
    fn default() -> Success {
        Self::True
    }
}

impl std::fmt::Display for WebhookEndpointTestResultResource {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}