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

/// 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,
        }
    }
}