R/ResponseFormPOST.r

# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' ResponseFormPOST Class
#'
#' @field metadata 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ResponseFormPOST <- R6::R6Class(
  'ResponseFormPOST',
  public = list(
    `metadata` = NULL,
    initialize = function(`metadata`){
      if (!missing(`metadata`)) {
        stopifnot(R6::is.R6(`metadata`))
        self$`metadata` <- `metadata`
      }
    },
    toJSON = function() {
      ResponseFormPOSTObject <- list()
      if (!is.null(self$`metadata`)) {
        ResponseFormPOSTObject[['metadata']] <- self$`metadata`$toJSON()
      }

      ResponseFormPOSTObject
    },
    fromJSON = function(ResponseFormPOSTJson) {
      ResponseFormPOSTObject <- jsonlite::fromJSON(ResponseFormPOSTJson)
      if (!is.null(ResponseFormPOSTObject$`metadata`)) {
        metadataObject <- Metadata$new()
        metadataObject$fromJSON(jsonlite::toJSON(ResponseFormPOSTObject$metadata, auto_unbox = TRUE, null = "null"))
        self$`metadata` <- metadataObject
      }
    },
    fromJSONObject = function(ResponseFormPOSTObject) {
      if (!is.null(ResponseFormPOSTObject$`metadata`)) {
        metadataObject <- Metadata$new()
        metadataObject$fromJSON(jsonlite::toJSON(ResponseFormPOSTObject$metadata, auto_unbox = TRUE, null = "null"))
        self$`metadata` <- metadataObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "metadata": %s
        }',
        self$`metadata`$toJSON()
      )
    },
    fromJSONString = function(ResponseFormPOSTJson) {
      ResponseFormPOSTObject <- jsonlite::fromJSON(ResponseFormPOSTJson)
      MetadataObject <- Metadata$new()
      self$`metadata` <- MetadataObject$fromJSON(jsonlite::toJSON(ResponseFormPOSTObject$metadata, auto_unbox = TRUE))
    }
  )
)
OpenSILEX/phis-ws-client-r-tool documentation built on Sept. 10, 2020, 8:42 a.m.