canton_api_client/models/js_transaction.rs
1/*
2 * JSON Ledger API HTTP endpoints
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 3.3.0-SNAPSHOT
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// JsTransaction : Filtered view of an on-ledger transaction's create and archive events.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct JsTransaction {
17 /// Assigned by the server. Useful for correlating logs. Must be a valid LedgerString (as described in ``value.proto``). Required
18 #[serde(rename = "updateId")]
19 pub update_id: String,
20 /// 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
21 #[serde(rename = "commandId")]
22 pub command_id: String,
23 /// The workflow ID used in command submission. Must be a valid LedgerString (as described in ``value.proto``). Optional
24 #[serde(rename = "workflowId")]
25 pub workflow_id: String,
26 /// Ledger effective time. Required
27 #[serde(rename = "effectiveAt")]
28 pub effective_at: String,
29 /// 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
30 #[serde(rename = "events", skip_serializing_if = "Option::is_none")]
31 pub events: Option<Vec<models::Event>>,
32 /// 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).
33 #[serde(rename = "offset")]
34 pub offset: i64,
35 /// A valid synchronizer id. Identifies the synchronizer that synchronized the transaction. Required
36 #[serde(rename = "synchronizerId")]
37 pub synchronizer_id: String,
38 #[serde(rename = "traceContext", skip_serializing_if = "Option::is_none")]
39 pub trace_context: Option<Box<models::TraceContext>>,
40 /// The time at which the transaction was recorded. The record time refers to the synchronizer which synchronized the transaction. Required
41 #[serde(rename = "recordTime")]
42 pub record_time: String,
43}
44
45impl JsTransaction {
46 /// Filtered view of an on-ledger transaction's create and archive events.
47 pub fn new(update_id: String, command_id: String, workflow_id: String, effective_at: String, offset: i64, synchronizer_id: String, record_time: String) -> JsTransaction {
48 JsTransaction {
49 update_id,
50 command_id,
51 workflow_id,
52 effective_at,
53 events: None,
54 offset,
55 synchronizer_id,
56 trace_context: None,
57 record_time,
58 }
59 }
60}
61