R/method_id.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title MethodID
#'
#' @description MethodID Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field methodNamespace  character 
#'
#' @field methodName  character 
#'
#' @field methodVersion  integer 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
MethodID <- R6::R6Class(
  'MethodID',
  public = list(
    `methodNamespace` = NULL,
    `methodName` = NULL,
    `methodVersion` = NULL,
    initialize = function(
        `methodNamespace`, `methodName`, `methodVersion`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`methodNamespace`)) {
        stopifnot(is.character(`methodNamespace`), length(`methodNamespace`) == 1)
        self$`methodNamespace` <- `methodNamespace`
      }
      if (!missing(`methodName`)) {
        stopifnot(is.character(`methodName`), length(`methodName`) == 1)
        self$`methodName` <- `methodName`
      }
      if (!missing(`methodVersion`)) {
        stopifnot(is.numeric(`methodVersion`), length(`methodVersion`) == 1)
        self$`methodVersion` <- `methodVersion`
      }
    },
    toJSON = function() {
      MethodIDObject <- list()
      if (!is.null(self$`methodNamespace`)) {
        MethodIDObject[['methodNamespace']] <-
          self$`methodNamespace`
      }
      if (!is.null(self$`methodName`)) {
        MethodIDObject[['methodName']] <-
          self$`methodName`
      }
      if (!is.null(self$`methodVersion`)) {
        MethodIDObject[['methodVersion']] <-
          self$`methodVersion`
      }

      MethodIDObject
    },
    fromJSON = function(MethodIDJson) {
      MethodIDObject <- jsonlite::fromJSON(MethodIDJson)
      if (!is.null(MethodIDObject$`methodNamespace`)) {
        self$`methodNamespace` <- MethodIDObject$`methodNamespace`
      }
      if (!is.null(MethodIDObject$`methodName`)) {
        self$`methodName` <- MethodIDObject$`methodName`
      }
      if (!is.null(MethodIDObject$`methodVersion`)) {
        self$`methodVersion` <- MethodIDObject$`methodVersion`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`methodNamespace`)) {
        sprintf(
        '"methodNamespace":
          "%s"
                ',
        self$`methodNamespace`
        )},
        if (!is.null(self$`methodName`)) {
        sprintf(
        '"methodName":
          "%s"
                ',
        self$`methodName`
        )},
        if (!is.null(self$`methodVersion`)) {
        sprintf(
        '"methodVersion":
          %d
                ',
        self$`methodVersion`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(MethodIDJson) {
      MethodIDObject <- jsonlite::fromJSON(MethodIDJson)
      self$`methodNamespace` <- MethodIDObject$`methodNamespace`
      self$`methodName` <- MethodIDObject$`methodName`
      self$`methodVersion` <- MethodIDObject$`methodVersion`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.