canton-api-client 3.3.0-0.1.1

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};

/// ExerciseCommand : Exercise a choice on an existing contract.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ExerciseCommand {
    /// The template of contract the client wants to exercise. Both package-name and package-id reference identifier formats for the template-id are supported. Note: The package-id reference identifier format is deprecated. We plan to end support for this format in version 3.4.  Required
    #[serde(rename = "templateId")]
    pub template_id: String,
    /// The ID of the contract the client wants to exercise upon. Must be a valid LedgerString (as described in ``value.proto``). Required
    #[serde(rename = "contractId")]
    pub contract_id: String,
    /// The name of the choice the client wants to exercise. Must be a valid NameString (as described in ``value.proto``) Required
    #[serde(rename = "choice")]
    pub choice: String,
    /// The argument for this choice. Required
    #[serde(rename = "choiceArgument", deserialize_with = "Option::deserialize")]
    pub choice_argument: Option<serde_json::Value>,
}

impl ExerciseCommand {
    /// Exercise a choice on an existing contract.
    pub fn new(template_id: String, contract_id: String, choice: String, choice_argument: Option<serde_json::Value>) -> ExerciseCommand {
        ExerciseCommand {
            template_id,
            contract_id,
            choice,
            choice_argument,
        }
    }
}