Skip to main content

canton_api_client/models/
js_interface_view.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 for the latest Canton 3.4 patch release. MINIMUM_CANTON_VERSION=3.6.0
5 *
6 * The version of the OpenAPI document: 3.6.0-SNAPSHOT
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// JsInterfaceView : View of a create event matched by an interface filter.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct JsInterfaceView {
17    /// The interface implemented by the matched event. The identifier uses the package-id reference format.  Required
18    #[serde(rename = "interfaceId")]
19    pub interface_id: String,
20    #[serde(rename = "viewStatus")]
21    pub view_status: Box<models::JsStatus>,
22    /// The value of the interface's view method on this event. Set if it was requested in the ``InterfaceFilter`` and it could be successfully computed.  Optional
23    #[serde(rename = "viewValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub view_value: Option<Option<serde_json::Value>>,
25    /// The package defining the interface implementation used to compute the view. Can be different from the package that was used to create the contract itself, as the contract arguments can be upgraded or downgraded using smart-contract upgrading as part of computing the interface view. Populated if the view computation is successful, otherwise empty.  Optional
26    #[serde(rename = "implementationPackageId", skip_serializing_if = "Option::is_none")]
27    pub implementation_package_id: Option<String>,
28}
29
30impl JsInterfaceView {
31    /// View of a create event matched by an interface filter.
32    pub fn new(interface_id: String, view_status: models::JsStatus) -> JsInterfaceView {
33        JsInterfaceView {
34            interface_id,
35            view_status: Box::new(view_status),
36            view_value: None,
37            implementation_package_id: None,
38        }
39    }
40}
41