R/Restriction.r

# Altana Atlas API
#
# Altana Atlas for Regulatory Risk and Trade Compliance
#
# OpenAPI spec version: {{ version or \"v0.0.1\" }}
# Contact: engineering@altanatech.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git

#' Restriction Class
#'
#' @field type 
#' @field description 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Restriction <- R6::R6Class(
  'Restriction',
  public = list(
    `type` = NULL,
    `description` = NULL,
    initialize = function(`type`, `description`){
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
    },
    toJSON = function() {
      RestrictionObject <- list()
      if (!is.null(self$`type`)) {
        RestrictionObject[['type']] <- self$`type`
      }
      if (!is.null(self$`description`)) {
        RestrictionObject[['description']] <- self$`description`
      }

      RestrictionObject
    },
    fromJSON = function(RestrictionJson) {
      RestrictionObject <- jsonlite::fromJSON(RestrictionJson)
      if (!is.null(RestrictionObject$`type`)) {
        self$`type` <- RestrictionObject$`type`
      }
      if (!is.null(RestrictionObject$`description`)) {
        self$`description` <- RestrictionObject$`description`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "type": %s,
           "description": %s
        }',
        self$`type`,
        self$`description`
      )
    },
    fromJSONString = function(RestrictionJson) {
      RestrictionObject <- jsonlite::fromJSON(RestrictionJson)
      self$`type` <- RestrictionObject$`type`
      self$`description` <- RestrictionObject$`description`
    }
  )
)
altana-tech/atlas-api-r-sdk documentation built on Dec. 19, 2021, 1:36 a.m.