amazon_spapi/models/services/
error.rs

1/*
2 * Selling Partner API for Services
3 *
4 * With the Services API, you can build applications that help service providers get and modify their service orders and manage their resources.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Error : Error response returned when the request is unsuccessful.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Error {
17    /// An error code that identifies the type of error that occurred.
18    #[serde(rename = "code")]
19    pub code: String,
20    /// A message that describes the error condition.
21    #[serde(rename = "message")]
22    pub message: String,
23    /// Additional details that can help the caller understand or fix the issue.
24    #[serde(rename = "details", skip_serializing_if = "Option::is_none")]
25    pub details: Option<String>,
26    /// The type of error.
27    #[serde(rename = "errorLevel", skip_serializing_if = "Option::is_none")]
28    pub error_level: Option<ErrorLevel>,
29}
30
31impl Error {
32    /// Error response returned when the request is unsuccessful.
33    pub fn new(code: String, message: String) -> Error {
34        Error {
35            code,
36            message,
37            details: None,
38            error_level: None,
39        }
40    }
41}
42/// The type of error.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum ErrorLevel {
45    #[serde(rename = "ERROR")]
46    Error,
47    #[serde(rename = "WARNING")]
48    Warning,
49}
50
51impl Default for ErrorLevel {
52    fn default() -> ErrorLevel {
53        Self::Error
54    }
55}
56