Skip to main content

canton_api_client/models/
exercise_command.rs

1/*
2 * JSON Ledger API HTTP endpoints
3 *
4 * 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 from the previous Canton 3.4 patch release. MINIMUM_CANTON_VERSION=3.4.12
5 *
6 * The version of the OpenAPI document: 3.4.12-SNAPSHOT
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ExerciseCommand : Exercise a choice on an existing contract.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ExerciseCommand {
17    /// The template or interface of the 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. To exercise a choice on an interface, specify the interface identifier in the template_id field.  Required
18    #[serde(rename = "templateId")]
19    pub template_id: String,
20    /// The ID of the contract the client wants to exercise upon. Must be a valid LedgerString (as described in ``value.proto``).  Required
21    #[serde(rename = "contractId")]
22    pub contract_id: String,
23    /// The name of the choice the client wants to exercise. Must be a valid NameString (as described in ``value.proto``)  Required
24    #[serde(rename = "choice")]
25    pub choice: String,
26    /// The argument for this choice.  Required
27    #[serde(rename = "choiceArgument", deserialize_with = "Option::deserialize")]
28    pub choice_argument: Option<serde_json::Value>,
29}
30
31impl ExerciseCommand {
32    /// Exercise a choice on an existing contract.
33    pub fn new(template_id: String, contract_id: String, choice: String, choice_argument: Option<serde_json::Value>) -> ExerciseCommand {
34        ExerciseCommand {
35            template_id,
36            contract_id,
37            choice,
38            choice_argument,
39        }
40    }
41}
42