R/method_repo_method.R

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

#' @docType class
#' @title MethodRepoMethod
#'
#' @description MethodRepoMethod Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field methodNamespace  character 
#'
#' @field methodName  character 
#'
#' @field methodVersion  integer 
#'
#' @field methodPath  character [optional]
#'
#' @field sourceRepo  character [optional]
#'
#' @field methodUri  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
MethodRepoMethod <- R6::R6Class(
  'MethodRepoMethod',
  public = list(
    `methodNamespace` = NULL,
    `methodName` = NULL,
    `methodVersion` = NULL,
    `methodPath` = NULL,
    `sourceRepo` = NULL,
    `methodUri` = NULL,
    initialize = function(
        `methodNamespace`, `methodName`, `methodVersion`, `methodPath`=NULL, `sourceRepo`=NULL, `methodUri`=NULL, ...
    ) {
      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`
      }
      if (!is.null(`methodPath`)) {
        stopifnot(is.character(`methodPath`), length(`methodPath`) == 1)
        self$`methodPath` <- `methodPath`
      }
      if (!is.null(`sourceRepo`)) {
        stopifnot(is.character(`sourceRepo`), length(`sourceRepo`) == 1)
        self$`sourceRepo` <- `sourceRepo`
      }
      if (!is.null(`methodUri`)) {
        stopifnot(is.character(`methodUri`), length(`methodUri`) == 1)
        self$`methodUri` <- `methodUri`
      }
    },
    toJSON = function() {
      MethodRepoMethodObject <- list()
      if (!is.null(self$`methodNamespace`)) {
        MethodRepoMethodObject[['methodNamespace']] <-
          self$`methodNamespace`
      }
      if (!is.null(self$`methodName`)) {
        MethodRepoMethodObject[['methodName']] <-
          self$`methodName`
      }
      if (!is.null(self$`methodVersion`)) {
        MethodRepoMethodObject[['methodVersion']] <-
          self$`methodVersion`
      }
      if (!is.null(self$`methodPath`)) {
        MethodRepoMethodObject[['methodPath']] <-
          self$`methodPath`
      }
      if (!is.null(self$`sourceRepo`)) {
        MethodRepoMethodObject[['sourceRepo']] <-
          self$`sourceRepo`
      }
      if (!is.null(self$`methodUri`)) {
        MethodRepoMethodObject[['methodUri']] <-
          self$`methodUri`
      }

      MethodRepoMethodObject
    },
    fromJSON = function(MethodRepoMethodJson) {
      MethodRepoMethodObject <- jsonlite::fromJSON(MethodRepoMethodJson)
      if (!is.null(MethodRepoMethodObject$`methodNamespace`)) {
        self$`methodNamespace` <- MethodRepoMethodObject$`methodNamespace`
      }
      if (!is.null(MethodRepoMethodObject$`methodName`)) {
        self$`methodName` <- MethodRepoMethodObject$`methodName`
      }
      if (!is.null(MethodRepoMethodObject$`methodVersion`)) {
        self$`methodVersion` <- MethodRepoMethodObject$`methodVersion`
      }
      if (!is.null(MethodRepoMethodObject$`methodPath`)) {
        self$`methodPath` <- MethodRepoMethodObject$`methodPath`
      }
      if (!is.null(MethodRepoMethodObject$`sourceRepo`)) {
        self$`sourceRepo` <- MethodRepoMethodObject$`sourceRepo`
      }
      if (!is.null(MethodRepoMethodObject$`methodUri`)) {
        self$`methodUri` <- MethodRepoMethodObject$`methodUri`
      }
      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`
        )},
        if (!is.null(self$`methodPath`)) {
        sprintf(
        '"methodPath":
          "%s"
                ',
        self$`methodPath`
        )},
        if (!is.null(self$`sourceRepo`)) {
        sprintf(
        '"sourceRepo":
          "%s"
                ',
        self$`sourceRepo`
        )},
        if (!is.null(self$`methodUri`)) {
        sprintf(
        '"methodUri":
          "%s"
                ',
        self$`methodUri`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(MethodRepoMethodJson) {
      MethodRepoMethodObject <- jsonlite::fromJSON(MethodRepoMethodJson)
      self$`methodNamespace` <- MethodRepoMethodObject$`methodNamespace`
      self$`methodName` <- MethodRepoMethodObject$`methodName`
      self$`methodVersion` <- MethodRepoMethodObject$`methodVersion`
      self$`methodPath` <- MethodRepoMethodObject$`methodPath`
      self$`sourceRepo` <- MethodRepoMethodObject$`sourceRepo`
      self$`methodUri` <- MethodRepoMethodObject$`methodUri`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.