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

/// CreateAndExerciseCommand : Create a contract and exercise a choice on it in the same transaction.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateAndExerciseCommand {
    /// The template of the contract the client wants to create. 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 arguments required for creating a contract from this template.  Required
    #[serde(rename = "createArguments", deserialize_with = "Option::deserialize")]
    pub create_arguments: Option<serde_json::Value>,
    /// 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 CreateAndExerciseCommand {
    /// Create a contract and exercise a choice on it in the same transaction.
    pub fn new(template_id: String, create_arguments: Option<serde_json::Value>, choice: String, choice_argument: Option<serde_json::Value>) -> CreateAndExerciseCommand {
        CreateAndExerciseCommand {
            template_id,
            create_arguments,
            choice,
            choice_argument,
        }
    }
}