R/library_bulk_index_response.R

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

#' @docType class
#' @title LibraryBulkIndexResponse
#'
#' @description LibraryBulkIndexResponse Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field totalCount  integer [optional]
#'
#' @field hasFailures  character [optional]
#'
#' @field failureMessages  named list( character ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
LibraryBulkIndexResponse <- R6::R6Class(
  'LibraryBulkIndexResponse',
  public = list(
    `totalCount` = NULL,
    `hasFailures` = NULL,
    `failureMessages` = NULL,
    initialize = function(
        `totalCount`=NULL, `hasFailures`=FALSE, `failureMessages`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`totalCount`)) {
        stopifnot(is.numeric(`totalCount`), length(`totalCount`) == 1)
        self$`totalCount` <- `totalCount`
      }
      if (!is.null(`hasFailures`)) {
        self$`hasFailures` <- `hasFailures`
      }
      if (!is.null(`failureMessages`)) {
        stopifnot(is.vector(`failureMessages`), length(`failureMessages`) != 0)
        sapply(`failureMessages`, function(x) stopifnot(is.character(x)))
        self$`failureMessages` <- `failureMessages`
      }
    },
    toJSON = function() {
      LibraryBulkIndexResponseObject <- list()
      if (!is.null(self$`totalCount`)) {
        LibraryBulkIndexResponseObject[['totalCount']] <-
          self$`totalCount`
      }
      if (!is.null(self$`hasFailures`)) {
        LibraryBulkIndexResponseObject[['hasFailures']] <-
          self$`hasFailures`
      }
      if (!is.null(self$`failureMessages`)) {
        LibraryBulkIndexResponseObject[['failureMessages']] <-
          self$`failureMessages`
      }

      LibraryBulkIndexResponseObject
    },
    fromJSON = function(LibraryBulkIndexResponseJson) {
      LibraryBulkIndexResponseObject <- jsonlite::fromJSON(LibraryBulkIndexResponseJson)
      if (!is.null(LibraryBulkIndexResponseObject$`totalCount`)) {
        self$`totalCount` <- LibraryBulkIndexResponseObject$`totalCount`
      }
      if (!is.null(LibraryBulkIndexResponseObject$`hasFailures`)) {
        self$`hasFailures` <- LibraryBulkIndexResponseObject$`hasFailures`
      }
      if (!is.null(LibraryBulkIndexResponseObject$`failureMessages`)) {
        self$`failureMessages` <- ApiClient$new()$deserializeObj(LibraryBulkIndexResponseObject$`failureMessages`, "map(character)", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`totalCount`)) {
        sprintf(
        '"totalCount":
          %d
                ',
        self$`totalCount`
        )},
        if (!is.null(self$`hasFailures`)) {
        sprintf(
        '"hasFailures":
          "%s"
                ',
        self$`hasFailures`
        )},
        if (!is.null(self$`failureMessages`)) {
        sprintf(
        '"failureMessages":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`failureMessages`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(LibraryBulkIndexResponseJson) {
      LibraryBulkIndexResponseObject <- jsonlite::fromJSON(LibraryBulkIndexResponseJson)
      self$`totalCount` <- LibraryBulkIndexResponseObject$`totalCount`
      self$`hasFailures` <- LibraryBulkIndexResponseObject$`hasFailures`
      self$`failureMessages` <- ApiClient$new()$deserializeObj(LibraryBulkIndexResponseObject$`failureMessages`, "map(character)", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.