canton-api-client 3.3.0-0.1.2

Canton Ledger API rust client
Documentation
/*
 * JSON Ledger API HTTP endpoints
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 3.3.0-SNAPSHOT
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// JsTransaction : Filtered view of an on-ledger transaction's create and archive events.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct JsTransaction {
    /// Assigned by the server. Useful for correlating logs. Must be a valid LedgerString (as described in ``value.proto``). Required
    #[serde(rename = "updateId")]
    pub update_id: String,
    /// The ID of the command which resulted in this transaction. Missing for everyone except the submitting party. Must be a valid LedgerString (as described in ``value.proto``). Optional
    #[serde(rename = "commandId")]
    pub command_id: String,
    /// The workflow ID used in command submission. Must be a valid LedgerString (as described in ``value.proto``). Optional
    #[serde(rename = "workflowId")]
    pub workflow_id: String,
    /// Ledger effective time. Required
    #[serde(rename = "effectiveAt")]
    pub effective_at: String,
    /// The collection of events. Contains:  - ``CreatedEvent`` or ``ArchivedEvent`` in case of ACS_DELTA transaction shape - ``CreatedEvent`` or ``ExercisedEvent`` in case of LEDGER_EFFECTS transaction shape  Required
    #[serde(rename = "events", skip_serializing_if = "Option::is_none")]
    pub events: Option<Vec<models::Event>>,
    /// The absolute offset. The details of this field are described in ``community/ledger-api/README.md``. Required, it is a valid absolute offset (positive integer).
    #[serde(rename = "offset")]
    pub offset: i64,
    /// A valid synchronizer id. Identifies the synchronizer that synchronized the transaction. Required
    #[serde(rename = "synchronizerId")]
    pub synchronizer_id: String,
    #[serde(rename = "traceContext", skip_serializing_if = "Option::is_none")]
    pub trace_context: Option<Box<models::TraceContext>>,
    /// The time at which the transaction was recorded. The record time refers to the synchronizer which synchronized the transaction. Required
    #[serde(rename = "recordTime")]
    pub record_time: String,
}

impl JsTransaction {
    /// Filtered view of an on-ledger transaction's create and archive events.
    pub fn new(update_id: String, command_id: String, workflow_id: String, effective_at: String, offset: i64, synchronizer_id: String, record_time: String) -> JsTransaction {
        JsTransaction {
            update_id,
            command_id,
            workflow_id,
            effective_at,
            events: None,
            offset,
            synchronizer_id,
            trace_context: None,
            record_time,
        }
    }
}