canton-api-client 3.6.0-0.1.0

Canton Ledger API rust client
Documentation
/*
 * JSON Ledger API HTTP endpoints
 *
 * This specification version fixes the API inconsistencies where certain fields marked as required in the spec are in fact optional. If you use code generation tool based on this file, you might need to adjust the existing application code to handle those fields as optional. If you do not want to change your client code, continue using the OpenAPI specification for the latest Canton 3.4 patch release. MINIMUM_CANTON_VERSION=3.6.0
 *
 * The version of the OpenAPI document: 3.6.0-SNAPSHOT
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct JsCantonError {
    #[serde(rename = "code")]
    pub code: String,
    #[serde(rename = "cause")]
    pub cause: String,
    #[serde(rename = "correlationId", skip_serializing_if = "Option::is_none")]
    pub correlation_id: Option<String>,
    #[serde(rename = "traceId", skip_serializing_if = "Option::is_none")]
    pub trace_id: Option<String>,
    #[serde(rename = "context")]
    pub context: std::collections::HashMap<String, String>,
    #[serde(rename = "resources", skip_serializing_if = "Option::is_none")]
    pub resources: Option<Vec<Vec<String>>>,
    #[serde(rename = "errorCategory")]
    pub error_category: i32,
    #[serde(rename = "grpcCodeValue", skip_serializing_if = "Option::is_none")]
    pub grpc_code_value: Option<i32>,
    #[serde(rename = "retryInfo", skip_serializing_if = "Option::is_none")]
    pub retry_info: Option<String>,
    #[serde(rename = "definiteAnswer", skip_serializing_if = "Option::is_none")]
    pub definite_answer: Option<bool>,
}

impl JsCantonError {
    pub fn new(code: String, cause: String, context: std::collections::HashMap<String, String>, error_category: i32) -> JsCantonError {
        JsCantonError {
            code,
            cause,
            correlation_id: None,
            trace_id: None,
            context,
            resources: None,
            error_category,
            grpc_code_value: None,
            retry_info: None,
            definite_answer: None,
        }
    }
}