R/TransferTaskProgressSummary.r

# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' TransferTaskProgressSummary Class
#'
#' This represents a rollup of a data transfer operation.
#'
#' @field averageRate Average transfer rate in bytes/sec
#' @field source The source URL of the transfer operation
#' @field totalActiveTransfers The number of concurrent transfers behind this transfer task
#' @field totalBytes The total number of bytes to be transferred
#' @field totalBytesTransferred The total number of bytes transferred thus far
#' @field totalFiles The total number of files transferred to date
#' @field uuid The id of the transfer task associated with this object
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TransferTaskProgressSummary <- R6::R6Class(
  'TransferTaskProgressSummary',
  public = list(
    `averageRate` = NULL,
    `source` = NULL,
    `totalActiveTransfers` = NULL,
    `totalBytes` = NULL,
    `totalBytesTransferred` = NULL,
    `totalFiles` = NULL,
    `uuid` = NULL,
    initialize = function(`averageRate`, `source`, `totalActiveTransfers`, `totalBytes`, `totalBytesTransferred`, `totalFiles`, `uuid`){
      if (!missing(`averageRate`)) {
        stopifnot(is.numeric(`averageRate`), length(`averageRate`) == 1)
        self$`averageRate` <- `averageRate`
      }
      if (!missing(`source`)) {
        stopifnot(is.character(`source`), length(`source`) == 1)
        self$`source` <- `source`
      }
      if (!missing(`totalActiveTransfers`)) {
        stopifnot(is.numeric(`totalActiveTransfers`), length(`totalActiveTransfers`) == 1)
        self$`totalActiveTransfers` <- `totalActiveTransfers`
      }
      if (!missing(`totalBytes`)) {
        stopifnot(is.numeric(`totalBytes`), length(`totalBytes`) == 1)
        self$`totalBytes` <- `totalBytes`
      }
      if (!missing(`totalBytesTransferred`)) {
        stopifnot(is.numeric(`totalBytesTransferred`), length(`totalBytesTransferred`) == 1)
        self$`totalBytesTransferred` <- `totalBytesTransferred`
      }
      if (!missing(`totalFiles`)) {
        stopifnot(is.numeric(`totalFiles`), length(`totalFiles`) == 1)
        self$`totalFiles` <- `totalFiles`
      }
      if (!missing(`uuid`)) {
        stopifnot(is.character(`uuid`), length(`uuid`) == 1)
        self$`uuid` <- `uuid`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      TransferTaskProgressSummaryObject <- list()
      if (!is.null(self$`averageRate`)) {
        TransferTaskProgressSummaryObject[['averageRate']] <- self$`averageRate`
      }
      else {
        TransferTaskProgressSummaryObject[['averageRate']] <- NULL
      }
      if (!is.null(self$`source`)) {
        TransferTaskProgressSummaryObject[['source']] <- self$`source`
      }
      else {
        TransferTaskProgressSummaryObject[['source']] <- NULL
      }
      if (!is.null(self$`totalActiveTransfers`)) {
        TransferTaskProgressSummaryObject[['totalActiveTransfers']] <- self$`totalActiveTransfers`
      }
      else {
        TransferTaskProgressSummaryObject[['totalActiveTransfers']] <- NULL
      }
      if (!is.null(self$`totalBytes`)) {
        TransferTaskProgressSummaryObject[['totalBytes']] <- self$`totalBytes`
      }
      else {
        TransferTaskProgressSummaryObject[['totalBytes']] <- NULL
      }
      if (!is.null(self$`totalBytesTransferred`)) {
        TransferTaskProgressSummaryObject[['totalBytesTransferred']] <- self$`totalBytesTransferred`
      }
      else {
        TransferTaskProgressSummaryObject[['totalBytesTransferred']] <- NULL
      }
      if (!is.null(self$`totalFiles`)) {
        TransferTaskProgressSummaryObject[['totalFiles']] <- self$`totalFiles`
      }
      else {
        TransferTaskProgressSummaryObject[['totalFiles']] <- NULL
      }
      if (!is.null(self$`uuid`)) {
        TransferTaskProgressSummaryObject[['uuid']] <- self$`uuid`
      }
      else {
        TransferTaskProgressSummaryObject[['uuid']] <- NULL
      }

      TransferTaskProgressSummaryObject
    },
    fromJSON = function(TransferTaskProgressSummaryObject) {
      if (is.character(TransferTaskProgressSummaryObject)) {
        TransferTaskProgressSummaryObject <- jsonlite::fromJSON(TransferTaskProgressSummaryJson)
      }

      if ("result" %in% names(TransferTaskProgressSummaryObject)) {
        TransferTaskProgressSummaryObject <- TransferTaskProgressSummaryObject$result
      }

      if (!is.null(TransferTaskProgressSummaryObject$`averageRate`)) {
        self$`averageRate` <- TransferTaskProgressSummaryObject$`averageRate`
      }
      if (!is.null(TransferTaskProgressSummaryObject$`source`)) {
        self$`source` <- TransferTaskProgressSummaryObject$`source`
      }
      if (!is.null(TransferTaskProgressSummaryObject$`totalActiveTransfers`)) {
        self$`totalActiveTransfers` <- TransferTaskProgressSummaryObject$`totalActiveTransfers`
      }
      if (!is.null(TransferTaskProgressSummaryObject$`totalBytes`)) {
        self$`totalBytes` <- TransferTaskProgressSummaryObject$`totalBytes`
      }
      if (!is.null(TransferTaskProgressSummaryObject$`totalBytesTransferred`)) {
        self$`totalBytesTransferred` <- TransferTaskProgressSummaryObject$`totalBytesTransferred`
      }
      if (!is.null(TransferTaskProgressSummaryObject$`totalFiles`)) {
        self$`totalFiles` <- TransferTaskProgressSummaryObject$`totalFiles`
      }
      if (!is.null(TransferTaskProgressSummaryObject$`uuid`)) {
        self$`uuid` <- TransferTaskProgressSummaryObject$`uuid`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "averageRate": %d,
           "source": %s,
           "totalActiveTransfers": %d,
           "totalBytes": %d,
           "totalBytesTransferred": %d,
           "totalFiles": %d,
           "uuid": %s
        }',
        ifelse( is.null(self$`averageRate`),"null",paste0(c('"', self$`averageRate`, '"'))),
        ifelse( is.null(self$`source`),"null",paste0(c('"', self$`source`, '"'))),
        ifelse( is.null(self$`totalActiveTransfers`),"null",paste0(c('"', self$`totalActiveTransfers`, '"'))),
        ifelse( is.null(self$`totalBytes`),"null",paste0(c('"', self$`totalBytes`, '"'))),
        ifelse( is.null(self$`totalBytesTransferred`),"null",paste0(c('"', self$`totalBytesTransferred`, '"'))),
        ifelse( is.null(self$`totalFiles`),"null",paste0(c('"', self$`totalFiles`, '"'))),
        ifelse( is.null(self$`uuid`),"null",paste0(c('"', self$`uuid`, '"')))
      )
    },
    fromJSONString = function(TransferTaskProgressSummaryJson) {
      TransferTaskProgressSummaryObject <- jsonlite::fromJSON(TransferTaskProgressSummaryJson)
      self::fromJSON(TransferTaskProgressSummaryObject)

    }
  )
)
deardooley/agave-rlang-sdk documentation built on May 17, 2019, 10:12 p.m.