R/Space.r

# Looker API 3.0 Reference
# 
# ### Authorization  The Looker API uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. Pass API3 credentials to the **/login** endpoint to obtain a temporary access_token. Include that access_token in the Authorization header of Looker API requests. For details, see [Looker API Authorization](https://looker.com/docs/r/api/authorization)  ### Client SDKs  The Looker API is a RESTful system that should be usable by any programming language capable of making HTTPS requests. Client SDKs for a variety of programming languages can be generated from the Looker API's Swagger JSON metadata to streamline use of the Looker API in your applications. A client SDK for Ruby is available as an example. For more information, see [Looker API Client SDKs](https://looker.com/docs/r/api/client_sdks)  ### Try It Out!  The 'api-docs' page served by the Looker instance includes 'Try It Out!' buttons for each API method. After logging in with API3 credentials, you can use the \"Try It Out!\" buttons to call the API directly from the documentation page to interactively explore API features and responses.  ### Versioning  Future releases of Looker will expand this API release-by-release to securely expose more and more of the core power of Looker to API client applications. API endpoints marked as \"beta\" may receive breaking changes without warning. Stable (non-beta) API endpoints should not receive breaking changes in future releases. For more information, see [Looker API Versioning](https://looker.com/docs/r/api/versioning) 
# 
# OpenAPI spec version: 3.0.0
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' Space Class
#'
#' @field id 
#' @field content_metadata_id 
#' @field creator_id 
#' @field name 
#' @field is_personal 
#' @field is_personal_descendant 
#' @field is_shared_root 
#' @field is_root 
#' @field is_users_root 
#' @field is_user_root 
#' @field is_embed 
#' @field is_embed_shared_root 
#' @field is_embed_users_root 
#' @field external_id 
#' @field parent_id 
#' @field looks 
#' @field dashboards 
#' @field can 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Space <- R6::R6Class(
  'Space',
  public = list(
    `id` = NULL,
    `content_metadata_id` = NULL,
    `creator_id` = NULL,
    `name` = NULL,
    `is_personal` = NULL,
    `is_personal_descendant` = NULL,
    `is_shared_root` = NULL,
    `is_root` = NULL,
    `is_users_root` = NULL,
    `is_user_root` = NULL,
    `is_embed` = NULL,
    `is_embed_shared_root` = NULL,
    `is_embed_users_root` = NULL,
    `external_id` = NULL,
    `parent_id` = NULL,
    `looks` = NULL,
    `dashboards` = NULL,
    `can` = NULL,
    initialize = function(`id`, `content_metadata_id`, `creator_id`, `name`, `is_personal`, `is_personal_descendant`, `is_shared_root`, `is_root`, `is_users_root`, `is_user_root`, `is_embed`, `is_embed_shared_root`, `is_embed_users_root`, `external_id`, `parent_id`, `looks`, `dashboards`, `can`){
      if (!missing(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`content_metadata_id`)) {
        stopifnot(is.numeric(`content_metadata_id`), length(`content_metadata_id`) == 1)
        self$`content_metadata_id` <- `content_metadata_id`
      }
      if (!missing(`creator_id`)) {
        stopifnot(is.numeric(`creator_id`), length(`creator_id`) == 1)
        self$`creator_id` <- `creator_id`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`is_personal`)) {
        self$`is_personal` <- `is_personal`
      }
      if (!missing(`is_personal_descendant`)) {
        self$`is_personal_descendant` <- `is_personal_descendant`
      }
      if (!missing(`is_shared_root`)) {
        self$`is_shared_root` <- `is_shared_root`
      }
      if (!missing(`is_root`)) {
        self$`is_root` <- `is_root`
      }
      if (!missing(`is_users_root`)) {
        self$`is_users_root` <- `is_users_root`
      }
      if (!missing(`is_user_root`)) {
        self$`is_user_root` <- `is_user_root`
      }
      if (!missing(`is_embed`)) {
        self$`is_embed` <- `is_embed`
      }
      if (!missing(`is_embed_shared_root`)) {
        self$`is_embed_shared_root` <- `is_embed_shared_root`
      }
      if (!missing(`is_embed_users_root`)) {
        self$`is_embed_users_root` <- `is_embed_users_root`
      }
      if (!missing(`external_id`)) {
        stopifnot(is.character(`external_id`), length(`external_id`) == 1)
        self$`external_id` <- `external_id`
      }
      if (!missing(`parent_id`)) {
        stopifnot(is.numeric(`parent_id`), length(`parent_id`) == 1)
        self$`parent_id` <- `parent_id`
      }
      if (!missing(`looks`)) {
        stopifnot(is.list(`looks`), length(`looks`) != 0)
        lapply(`looks`, function(x) stopifnot(R6::is.R6(x)))
        self$`looks` <- `looks`
      }
      if (!missing(`dashboards`)) {
        stopifnot(is.list(`dashboards`), length(`dashboards`) != 0)
        lapply(`dashboards`, function(x) stopifnot(R6::is.R6(x)))
        self$`dashboards` <- `dashboards`
      }
      if (!missing(`can`)) {
        self$`can` <- `can`
      }
    },
    toJSON = function() {
      SpaceObject <- list()
      if (!is.null(self$`id`)) {
        SpaceObject[['id']] <- self$`id`
      }
      if (!is.null(self$`content_metadata_id`)) {
        SpaceObject[['content_metadata_id']] <- self$`content_metadata_id`
      }
      if (!is.null(self$`creator_id`)) {
        SpaceObject[['creator_id']] <- self$`creator_id`
      }
      if (!is.null(self$`name`)) {
        SpaceObject[['name']] <- self$`name`
      }
      if (!is.null(self$`is_personal`)) {
        SpaceObject[['is_personal']] <- self$`is_personal`
      }
      if (!is.null(self$`is_personal_descendant`)) {
        SpaceObject[['is_personal_descendant']] <- self$`is_personal_descendant`
      }
      if (!is.null(self$`is_shared_root`)) {
        SpaceObject[['is_shared_root']] <- self$`is_shared_root`
      }
      if (!is.null(self$`is_root`)) {
        SpaceObject[['is_root']] <- self$`is_root`
      }
      if (!is.null(self$`is_users_root`)) {
        SpaceObject[['is_users_root']] <- self$`is_users_root`
      }
      if (!is.null(self$`is_user_root`)) {
        SpaceObject[['is_user_root']] <- self$`is_user_root`
      }
      if (!is.null(self$`is_embed`)) {
        SpaceObject[['is_embed']] <- self$`is_embed`
      }
      if (!is.null(self$`is_embed_shared_root`)) {
        SpaceObject[['is_embed_shared_root']] <- self$`is_embed_shared_root`
      }
      if (!is.null(self$`is_embed_users_root`)) {
        SpaceObject[['is_embed_users_root']] <- self$`is_embed_users_root`
      }
      if (!is.null(self$`external_id`)) {
        SpaceObject[['external_id']] <- self$`external_id`
      }
      if (!is.null(self$`parent_id`)) {
        SpaceObject[['parent_id']] <- self$`parent_id`
      }
      if (!is.null(self$`looks`)) {
        SpaceObject[['looks']] <- lapply(self$`looks`, function(x) x$toJSON())
      }
      if (!is.null(self$`dashboards`)) {
        SpaceObject[['dashboards']] <- lapply(self$`dashboards`, function(x) x$toJSON())
      }
      if (!is.null(self$`can`)) {
        SpaceObject[['can']] <- self$`can`
      }

      SpaceObject
    },
    fromJSON = function(SpaceJson) {
      SpaceObject <- jsonlite::fromJSON(SpaceJson)
      if (!is.null(SpaceObject$`id`)) {
        self$`id` <- SpaceObject$`id`
      }
      if (!is.null(SpaceObject$`content_metadata_id`)) {
        self$`content_metadata_id` <- SpaceObject$`content_metadata_id`
      }
      if (!is.null(SpaceObject$`creator_id`)) {
        self$`creator_id` <- SpaceObject$`creator_id`
      }
      if (!is.null(SpaceObject$`name`)) {
        self$`name` <- SpaceObject$`name`
      }
      if (!is.null(SpaceObject$`is_personal`)) {
        self$`is_personal` <- SpaceObject$`is_personal`
      }
      if (!is.null(SpaceObject$`is_personal_descendant`)) {
        self$`is_personal_descendant` <- SpaceObject$`is_personal_descendant`
      }
      if (!is.null(SpaceObject$`is_shared_root`)) {
        self$`is_shared_root` <- SpaceObject$`is_shared_root`
      }
      if (!is.null(SpaceObject$`is_root`)) {
        self$`is_root` <- SpaceObject$`is_root`
      }
      if (!is.null(SpaceObject$`is_users_root`)) {
        self$`is_users_root` <- SpaceObject$`is_users_root`
      }
      if (!is.null(SpaceObject$`is_user_root`)) {
        self$`is_user_root` <- SpaceObject$`is_user_root`
      }
      if (!is.null(SpaceObject$`is_embed`)) {
        self$`is_embed` <- SpaceObject$`is_embed`
      }
      if (!is.null(SpaceObject$`is_embed_shared_root`)) {
        self$`is_embed_shared_root` <- SpaceObject$`is_embed_shared_root`
      }
      if (!is.null(SpaceObject$`is_embed_users_root`)) {
        self$`is_embed_users_root` <- SpaceObject$`is_embed_users_root`
      }
      if (!is.null(SpaceObject$`external_id`)) {
        self$`external_id` <- SpaceObject$`external_id`
      }
      if (!is.null(SpaceObject$`parent_id`)) {
        self$`parent_id` <- SpaceObject$`parent_id`
      }
      if (!is.null(SpaceObject$`looks`)) {
        self$`looks` <- lapply(SpaceObject$`looks`, function(x) {
          looksObject <- LookWithDashboards$new()
          looksObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          looksObject
        })
      }
      if (!is.null(SpaceObject$`dashboards`)) {
        self$`dashboards` <- lapply(SpaceObject$`dashboards`, function(x) {
          dashboardsObject <- DashboardBase$new()
          dashboardsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          dashboardsObject
        })
      }
      if (!is.null(SpaceObject$`can`)) {
        self$`can` <- SpaceObject$`can`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "id": %s,
           "content_metadata_id": %d,
           "creator_id": %d,
           "name": %s,
           "is_personal": %s,
           "is_personal_descendant": %s,
           "is_shared_root": %s,
           "is_root": %s,
           "is_users_root": %s,
           "is_user_root": %s,
           "is_embed": %s,
           "is_embed_shared_root": %s,
           "is_embed_users_root": %s,
           "external_id": %s,
           "parent_id": %d,
           "looks": [%s],
           "dashboards": [%s],
           "can": %s
        }',
        self$`id`,
        self$`content_metadata_id`,
        self$`creator_id`,
        self$`name`,
        self$`is_personal`,
        self$`is_personal_descendant`,
        self$`is_shared_root`,
        self$`is_root`,
        self$`is_users_root`,
        self$`is_user_root`,
        self$`is_embed`,
        self$`is_embed_shared_root`,
        self$`is_embed_users_root`,
        self$`external_id`,
        self$`parent_id`,
        lapply(self$`looks`, function(x) paste(x$toJSON(), sep=",")),
        lapply(self$`dashboards`, function(x) paste(x$toJSON(), sep=",")),
        self$`can`
      )
    },
    fromJSONString = function(SpaceJson) {
      SpaceObject <- jsonlite::fromJSON(SpaceJson)
      self$`id` <- SpaceObject$`id`
      self$`content_metadata_id` <- SpaceObject$`content_metadata_id`
      self$`creator_id` <- SpaceObject$`creator_id`
      self$`name` <- SpaceObject$`name`
      self$`is_personal` <- SpaceObject$`is_personal`
      self$`is_personal_descendant` <- SpaceObject$`is_personal_descendant`
      self$`is_shared_root` <- SpaceObject$`is_shared_root`
      self$`is_root` <- SpaceObject$`is_root`
      self$`is_users_root` <- SpaceObject$`is_users_root`
      self$`is_user_root` <- SpaceObject$`is_user_root`
      self$`is_embed` <- SpaceObject$`is_embed`
      self$`is_embed_shared_root` <- SpaceObject$`is_embed_shared_root`
      self$`is_embed_users_root` <- SpaceObject$`is_embed_users_root`
      self$`external_id` <- SpaceObject$`external_id`
      self$`parent_id` <- SpaceObject$`parent_id`
      self$`looks` <- lapply(SpaceObject$`looks`, function(x) LookWithDashboards$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`dashboards` <- lapply(SpaceObject$`dashboards`, function(x) DashboardBase$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`can` <- SpaceObject$`can`
    }
  )
)
haarthi/R_sdk documentation built on May 18, 2019, 11:28 p.m.