R/LastUsedCredentialsInner.r

# Dkube api server
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 2.2.1.11
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' LastUsedCredentialsInner Class
#'
#' @field host 
#' @field credentials 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
LastUsedCredentialsInner <- R6::R6Class(
  'LastUsedCredentialsInner',
  public = list(
    `host` = NULL,
    `credentials` = NULL,
    initialize = function(`host`, `credentials`){
      if (!missing(`host`)) {
        stopifnot(is.character(`host`), length(`host`) == 1)
        self$`host` <- `host`
      }
      if (!missing(`credentials`)) {
        stopifnot(R6::is.R6(`credentials`))
        self$`credentials` <- `credentials`
      }
    },
    toJSON = function() {
      LastUsedCredentialsInnerObject <- list()
      if (!is.null(self$`host`)) {
        LastUsedCredentialsInnerObject[['host']] <- self$`host`
      }
      if (!is.null(self$`credentials`)) {
        LastUsedCredentialsInnerObject[['credentials']] <- self$`credentials`$toJSON()
      }

      LastUsedCredentialsInnerObject
    },
    fromJSON = function(LastUsedCredentialsInnerJson) {
      LastUsedCredentialsInnerObject <- jsonlite::fromJSON(LastUsedCredentialsInnerJson)
      if (!is.null(LastUsedCredentialsInnerObject$`host`)) {
        self$`host` <- LastUsedCredentialsInnerObject$`host`
      }
      if (!is.null(LastUsedCredentialsInnerObject$`credentials`)) {
        credentialsObject <- GitAccessCredentials$new()
        credentialsObject$fromJSON(jsonlite::toJSON(LastUsedCredentialsInnerObject$credentials, auto_unbox = TRUE))
        self$`credentials` <- credentialsObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "host": %s,
           "credentials": %s
        }',
        self$`host`,
        self$`credentials`$toJSON()
      )
    },
    fromJSONString = function(LastUsedCredentialsInnerJson) {
      LastUsedCredentialsInnerObject <- jsonlite::fromJSON(LastUsedCredentialsInnerJson)
      self$`host` <- LastUsedCredentialsInnerObject$`host`
      GitAccessCredentialsObject <- GitAccessCredentials$new()
      self$`credentials` <- GitAccessCredentialsObject$fromJSON(jsonlite::toJSON(LastUsedCredentialsInnerObject$credentials, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.