/*
* 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};
/// Completion1 : A completion represents the status of a submitted command on the ledger: it can be successful or failed.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Completion1 {
/// The ID of the succeeded or failed command. Must be a valid LedgerString (as described in ``value.proto``). Required
#[serde(rename = "commandId")]
pub command_id: String,
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Box<models::JsStatus>>,
/// The update_id of the transaction or reassignment that resulted from the command with command_id. Only set for successfully executed commands. Must be a valid LedgerString (as described in ``value.proto``). Optional
#[serde(rename = "updateId", skip_serializing_if = "Option::is_none")]
pub update_id: Option<String>,
/// The user-id that was used for the submission, as described in ``commands.proto``. Must be a valid UserIdString (as described in ``value.proto``). Required
#[serde(rename = "userId")]
pub user_id: String,
/// The set of parties on whose behalf the commands were executed. Contains the ``act_as`` parties from ``commands.proto`` filtered to the requesting parties in CompletionStreamRequest. The order of the parties need not be the same as in the submission. Each element must be a valid PartyIdString (as described in ``value.proto``). Required: must be non-empty
#[serde(rename = "actAs")]
pub act_as: Vec<String>,
/// The submission ID this completion refers to, as described in ``commands.proto``. Must be a valid LedgerString (as described in ``value.proto``). Optional
#[serde(rename = "submissionId", skip_serializing_if = "Option::is_none")]
pub submission_id: Option<String>,
#[serde(rename = "deduplicationPeriod", skip_serializing_if = "Option::is_none")]
pub deduplication_period: Option<Box<models::DeduplicationPeriod1>>,
#[serde(rename = "traceContext", skip_serializing_if = "Option::is_none")]
pub trace_context: Option<Box<models::TraceContext>>,
/// May be used in a subsequent CompletionStreamRequest to resume the consumption of this stream at a later time. Must be a valid absolute offset (positive integer). Required
#[serde(rename = "offset")]
pub offset: i64,
#[serde(rename = "synchronizerTime")]
pub synchronizer_time: Box<models::SynchronizerTime>,
/// The traffic cost paid by this participant node for the confirmation request for the submitted command. Commands whose execution is rejected before their corresponding confirmation request is ordered by the synchronizer will report a paid traffic cost of zero. If a confirmation request is ordered for a command, but the request fails (e.g., due to contention with a concurrent contract archival), the traffic cost is paid and reported on the failed completion for the request. If you want to correlate the traffic cost of a successful completion with the transaction that resulted from the command, you can use the ``offset`` field to retrieve the transaction using ``UpdateService.GetUpdateByOffset`` on the same participant node; or alternatively use the ``update_id`` field to retrieve the transaction using ``UpdateService.GetUpdateById`` on any participant node that sees the transaction. Note: for completions processed before the participant started serving traffic cost on the Ledger API, this field will be set to zero. Additionally, the total cost incurred by the submitting node for the submission of the transaction may be greater than the reported cost, for example if retries were issued due to failed submissions to the synchronizer. The cost reported here is the one paid for ordering the confirmation request. Optional
#[serde(rename = "paidTrafficCost", skip_serializing_if = "Option::is_none")]
pub paid_traffic_cost: Option<i64>,
}
impl Completion1 {
/// A completion represents the status of a submitted command on the ledger: it can be successful or failed.
pub fn new(command_id: String, user_id: String, act_as: Vec<String>, offset: i64, synchronizer_time: models::SynchronizerTime) -> Completion1 {
Completion1 {
command_id,
status: None,
update_id: None,
user_id,
act_as,
submission_id: None,
deduplication_period: None,
trace_context: None,
offset,
synchronizer_time: Box::new(synchronizer_time),
paid_traffic_cost: None,
}
}
}