canton_api_client/models/create_and_exercise_command.rs
1/*
2 * JSON Ledger API HTTP endpoints
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 3.3.0-SNAPSHOT
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CreateAndExerciseCommand : Create a contract and exercise a choice on it in the same transaction.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateAndExerciseCommand {
17 /// 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
18 #[serde(rename = "templateId")]
19 pub template_id: String,
20 /// The arguments required for creating a contract from this template. Required
21 #[serde(rename = "createArguments", deserialize_with = "Option::deserialize")]
22 pub create_arguments: Option<serde_json::Value>,
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 CreateAndExerciseCommand {
32 /// Create a contract and exercise a choice on it in the same transaction.
33 pub fn new(template_id: String, create_arguments: Option<serde_json::Value>, choice: String, choice_argument: Option<serde_json::Value>) -> CreateAndExerciseCommand {
34 CreateAndExerciseCommand {
35 template_id,
36 create_arguments,
37 choice,
38 choice_argument,
39 }
40 }
41}
42