amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Selling Partner API for Data Kiosk
 *
 * The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
 *
 * The version of the OpenAPI document: 2023-11-15
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// Query : Detailed information about the query.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Query {
    /// The query identifier. This identifier is unique only in combination with a selling partner account ID.
    #[serde(rename = "queryId")]
    pub query_id: String,
    /// The submitted query.
    #[serde(rename = "query")]
    pub query: String,
    /// The date and time when the query was created, in ISO 8601 date time format.
    #[serde(rename = "createdTime")]
    pub created_time: String,
    /// The processing status of the query.
    #[serde(rename = "processingStatus")]
    pub processing_status: ProcessingStatus,
    /// The date and time when the query processing started, in ISO 8601 date time format.
    #[serde(rename = "processingStartTime", skip_serializing_if = "Option::is_none")]
    pub processing_start_time: Option<String>,
    /// The date and time when the query processing completed, in ISO 8601 date time format.
    #[serde(rename = "processingEndTime", skip_serializing_if = "Option::is_none")]
    pub processing_end_time: Option<String>,
    /// The data document identifier. This identifier is only present when there is data available as a result of the query. This identifier is unique only in combination with a selling partner account ID. Pass this identifier into the `getDocument` operation to get the information required to retrieve the data document's contents.
    #[serde(rename = "dataDocumentId", skip_serializing_if = "Option::is_none")]
    pub data_document_id: Option<String>,
    /// The error document identifier. This identifier is only present when an error occurs during query processing. This identifier is unique only in combination with a selling partner account ID. Pass this identifier into the `getDocument` operation to get the information required to retrieve the error document's contents.
    #[serde(rename = "errorDocumentId", skip_serializing_if = "Option::is_none")]
    pub error_document_id: Option<String>,
    #[serde(rename = "pagination", skip_serializing_if = "Option::is_none")]
    pub pagination: Option<Box<models::data_kiosk_2023_11_15::QueryPagination>>,
}

impl Query {
    /// Detailed information about the query.
    pub fn new(query_id: String, query: String, created_time: String, processing_status: ProcessingStatus) -> Query {
        Query {
            query_id,
            query,
            created_time,
            processing_status,
            processing_start_time: None,
            processing_end_time: None,
            data_document_id: None,
            error_document_id: None,
            pagination: None,
        }
    }
}
/// The processing status of the query.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ProcessingStatus {
    #[serde(rename = "CANCELLED")]
    Cancelled,
    #[serde(rename = "DONE")]
    Done,
    #[serde(rename = "FATAL")]
    Fatal,
    #[serde(rename = "IN_PROGRESS")]
    InProgress,
    #[serde(rename = "IN_QUEUE")]
    InQueue,
}

impl Default for ProcessingStatus {
    fn default() -> ProcessingStatus {
        Self::Cancelled
    }
}