santati 0.2.0

Official Rust SDK for the Santati audit-log API
Documentation
/*
 * Santati
 *
 * Santati's HTTP API. Operations under `/api/v0/` take a team API key in `Authorization: Api-Key <key>`; a missing, invalid or under-scoped key is answered with `403`, never `401`. Errors on `/api/v0/` use one of three bodies: `ErrorDetail` (`{\"detail\": ...}`), `FieldErrors` (messages keyed by request field) or `ErrorEnvelope` (`{\"error\": {\"code\", \"message\", \"field\"}}`, returned by event ingestion and log stream quota checks). Lists on `/api/v0/` are cursor-paginated: follow `next` until it is `null`.
 *
 * The version of the OpenAPI document: 0.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// ErrorBody : One rejection, in the shape contracts §7 reserves for event ingestion.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ErrorBody {
    /// Reserved failure code, one of: `invalid_envelope`, `unknown_field`, `invalid_actor_type`, `metadata_limit_exceeded`, `too_many_targets`, `unknown_action`, `schema_validation_failed`, `unknown_organization`, `quota_exceeded`, `rate_limited`, `trail_not_allowed`, `payload_too_large`. New codes are additive.
    #[serde(rename = "code")]
    pub code: String,
    /// Human-readable explanation of this particular failure.
    #[serde(rename = "message")]
    pub message: String,
    /// The request field at fault, or null when no single field is.
    #[serde(rename = "field", deserialize_with = "Option::deserialize")]
    pub field: Option<String>,
}

impl ErrorBody {
    /// One rejection, in the shape contracts §7 reserves for event ingestion.
    pub fn new(code: String, message: String, field: Option<String>) -> ErrorBody {
        ErrorBody {
            code,
            message,
            field,
        }
    }
}