R/Stakeholder.r

# PharmaTrace Supply Chain Information Network API
#
# The PharmaTrace SCIN API provides network members a resource and process oriented access to the blockchain backed market and inventory information. It represents a layer of abstraction above the Hyperledger network to facilitate a business focused development of clients and integration systems without the need to directly connect to Hyperledger nodes.
#
# OpenAPI spec version: 0.0.1
# Contact: api@pharmatrace.io
# Generated by: https://openapi-generator.tech


#' Stakeholder Class
#'
#' @field trade_id 
#' @field trade_id_type 
#' @field display_name 
#' @field stakeholder_role 
#' @field wallet_id 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Stakeholder <- R6::R6Class(
  'Stakeholder',
  public = list(
    `trade_id` = NULL,
    `trade_id_type` = NULL,
    `display_name` = NULL,
    `stakeholder_role` = NULL,
    `wallet_id` = NULL,
    initialize = function(`trade_id`, `trade_id_type`, `display_name`, `stakeholder_role`, `wallet_id`){
      if (!missing(`trade_id`)) {
                stopifnot(is.character(`trade_id`), length(`trade_id`) == 1)
        self$`trade_id` <- `trade_id`
      }
      if (!missing(`trade_id_type`)) {
                stopifnot(is.character(`trade_id_type`), length(`trade_id_type`) == 1)
        self$`trade_id_type` <- `trade_id_type`
      }
      if (!missing(`display_name`)) {
                stopifnot(is.character(`display_name`), length(`display_name`) == 1)
        self$`display_name` <- `display_name`
      }
      if (!missing(`stakeholder_role`)) {
                stopifnot(is.character(`stakeholder_role`), length(`stakeholder_role`) == 1)
        self$`stakeholder_role` <- `stakeholder_role`
      }
      if (!missing(`wallet_id`)) {
                stopifnot(is.character(`wallet_id`), length(`wallet_id`) == 1)
        self$`wallet_id` <- `wallet_id`
      }
    },
    toJSON = function() {
      StakeholderObject <- list()
      if (!is.null(self$`trade_id`)) {
        StakeholderObject[['trade_id']] <-
                self$`trade_id`
      }
      if (!is.null(self$`trade_id_type`)) {
        StakeholderObject[['trade_id_type']] <-
                self$`trade_id_type`
      }
      if (!is.null(self$`display_name`)) {
        StakeholderObject[['display_name']] <-
                self$`display_name`
      }
      if (!is.null(self$`stakeholder_role`)) {
        StakeholderObject[['stakeholder_role']] <-
                self$`stakeholder_role`
      }
      if (!is.null(self$`wallet_id`)) {
        StakeholderObject[['wallet_id']] <-
                self$`wallet_id`
      }

      StakeholderObject
    },
    fromJSON = function(StakeholderJson) {
      StakeholderObject <- jsonlite::fromJSON(StakeholderJson)
      if (!is.null(StakeholderObject$`trade_id`)) {
                self$`trade_id` <- StakeholderObject$`trade_id`
      }
      if (!is.null(StakeholderObject$`trade_id_type`)) {
                self$`trade_id_type` <- StakeholderObject$`trade_id_type`
      }
      if (!is.null(StakeholderObject$`display_name`)) {
                self$`display_name` <- StakeholderObject$`display_name`
      }
      if (!is.null(StakeholderObject$`stakeholder_role`)) {
                self$`stakeholder_role` <- StakeholderObject$`stakeholder_role`
      }
      if (!is.null(StakeholderObject$`wallet_id`)) {
                self$`wallet_id` <- StakeholderObject$`wallet_id`
      }
    },
    toJSONString = function() {
       outstring <- sprintf(
        '{
           "trade_id":
                      
                      "%s"
                  
              ,
           "trade_id_type":
                      
                      "%s"
                  
              ,
           "display_name":
                      
                      "%s"
                  
              ,
           "stakeholder_role":
                      
                      "%s"
                  
              ,
           "wallet_id":
                      
                      "%s"
                  
              
        }',
                self$`trade_id`,
                self$`trade_id_type`,
                self$`display_name`,
                self$`stakeholder_role`,
                self$`wallet_id`
      )
      gsub("[\r\n]| ", "", outstring)
    },
    fromJSONString = function(StakeholderJson) {
      StakeholderObject <- jsonlite::fromJSON(StakeholderJson)
              self$`trade_id` <- StakeholderObject$`trade_id`
              self$`trade_id_type` <- StakeholderObject$`trade_id_type`
              self$`display_name` <- StakeholderObject$`display_name`
              self$`stakeholder_role` <- StakeholderObject$`stakeholder_role`
              self$`wallet_id` <- StakeholderObject$`wallet_id`
    }
  )
)
Pharmatrace/rPtApiClient documentation built on May 21, 2019, 4:04 a.m.