R/Query.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


#' Query Class
#'
#' @field id 
#' @field model 
#' @field view 
#' @field fields 
#' @field pivots 
#' @field fill_fields 
#' @field filters 
#' @field filter_expression 
#' @field sorts 
#' @field limit 
#' @field column_limit 
#' @field total 
#' @field row_total 
#' @field runtime 
#' @field vis_config 
#' @field filter_config 
#' @field visible_ui_sections 
#' @field slug 
#' @field dynamic_fields 
#' @field client_id 
#' @field share_url 
#' @field expanded_share_url 
#' @field url 
#' @field query_timezone 
#' @field has_table_calculations 
#' @field can 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Query <- R6::R6Class(
  'Query',
  public = list(
    `id` = NULL,
    `model` = NULL,
    `view` = NULL,
    `fields` = NULL,
    `pivots` = NULL,
    `fill_fields` = NULL,
    `filters` = NULL,
    `filter_expression` = NULL,
    `sorts` = NULL,
    `limit` = NULL,
    `column_limit` = NULL,
    `total` = NULL,
    `row_total` = NULL,
    `runtime` = NULL,
    `vis_config` = NULL,
    `filter_config` = NULL,
    `visible_ui_sections` = NULL,
    `slug` = NULL,
    `dynamic_fields` = NULL,
    `client_id` = NULL,
    `share_url` = NULL,
    `expanded_share_url` = NULL,
    `url` = NULL,
    `query_timezone` = NULL,
    `has_table_calculations` = NULL,
    `can` = NULL,
    initialize = function(`id`, `model`, `view`, `fields`, `pivots`, `fill_fields`, `filters`, `filter_expression`, `sorts`, `limit`, `column_limit`, `total`, `row_total`, `runtime`, `vis_config`, `filter_config`, `visible_ui_sections`, `slug`, `dynamic_fields`, `client_id`, `share_url`, `expanded_share_url`, `url`, `query_timezone`, `has_table_calculations`, `can`){
      if (!missing(`id`)) {
        stopifnot(is.numeric(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`model`)) {
        stopifnot(is.character(`model`), length(`model`) == 1)
        self$`model` <- `model`
      }
      if (!missing(`view`)) {
        stopifnot(is.character(`view`), length(`view`) == 1)
        self$`view` <- `view`
      }
      if (!missing(`fields`)) {
        stopifnot(is.list(`fields`), length(`fields`) != 0)
        lapply(`fields`, function(x) stopifnot(is.character(x)))
        self$`fields` <- `fields`
      }
      if (!missing(`pivots`)) {
        stopifnot(is.list(`pivots`), length(`pivots`) != 0)
        lapply(`pivots`, function(x) stopifnot(is.character(x)))
        self$`pivots` <- `pivots`
      }
      if (!missing(`fill_fields`)) {
        stopifnot(is.list(`fill_fields`), length(`fill_fields`) != 0)
        lapply(`fill_fields`, function(x) stopifnot(is.character(x)))
        self$`fill_fields` <- `fill_fields`
      }
      if (!missing(`filters`)) {
        self$`filters` <- `filters`
      }
      if (!missing(`filter_expression`)) {
        stopifnot(is.character(`filter_expression`), length(`filter_expression`) == 1)
        self$`filter_expression` <- `filter_expression`
      }
      if (!missing(`sorts`)) {
        stopifnot(is.list(`sorts`), length(`sorts`) != 0)
        lapply(`sorts`, function(x) stopifnot(is.character(x)))
        self$`sorts` <- `sorts`
      }
      if (!missing(`limit`)) {
        stopifnot(is.character(`limit`), length(`limit`) == 1)
        self$`limit` <- `limit`
      }
      if (!missing(`column_limit`)) {
        stopifnot(is.character(`column_limit`), length(`column_limit`) == 1)
        self$`column_limit` <- `column_limit`
      }
      if (!missing(`total`)) {
        self$`total` <- `total`
      }
      if (!missing(`row_total`)) {
        stopifnot(is.character(`row_total`), length(`row_total`) == 1)
        self$`row_total` <- `row_total`
      }
      if (!missing(`runtime`)) {
        stopifnot(is.numeric(`runtime`), length(`runtime`) == 1)
        self$`runtime` <- `runtime`
      }
      if (!missing(`vis_config`)) {
        self$`vis_config` <- `vis_config`
      }
      if (!missing(`filter_config`)) {
        self$`filter_config` <- `filter_config`
      }
      if (!missing(`visible_ui_sections`)) {
        stopifnot(is.character(`visible_ui_sections`), length(`visible_ui_sections`) == 1)
        self$`visible_ui_sections` <- `visible_ui_sections`
      }
      if (!missing(`slug`)) {
        stopifnot(is.character(`slug`), length(`slug`) == 1)
        self$`slug` <- `slug`
      }
      if (!missing(`dynamic_fields`)) {
        stopifnot(is.list(`dynamic_fields`), length(`dynamic_fields`) != 0)
        lapply(`dynamic_fields`, function(x) stopifnot(is.character(x)))
        self$`dynamic_fields` <- `dynamic_fields`
      }
      if (!missing(`client_id`)) {
        stopifnot(is.character(`client_id`), length(`client_id`) == 1)
        self$`client_id` <- `client_id`
      }
      if (!missing(`share_url`)) {
        stopifnot(is.character(`share_url`), length(`share_url`) == 1)
        self$`share_url` <- `share_url`
      }
      if (!missing(`expanded_share_url`)) {
        stopifnot(is.character(`expanded_share_url`), length(`expanded_share_url`) == 1)
        self$`expanded_share_url` <- `expanded_share_url`
      }
      if (!missing(`url`)) {
        stopifnot(is.character(`url`), length(`url`) == 1)
        self$`url` <- `url`
      }
      if (!missing(`query_timezone`)) {
        stopifnot(is.character(`query_timezone`), length(`query_timezone`) == 1)
        self$`query_timezone` <- `query_timezone`
      }
      if (!missing(`has_table_calculations`)) {
        self$`has_table_calculations` <- `has_table_calculations`
      }
      if (!missing(`can`)) {
        self$`can` <- `can`
      }
    },
    toJSON = function() {
      QueryObject <- list()
      if (!is.null(self$`id`)) {
        QueryObject[['id']] <- self$`id`
      }
      if (!is.null(self$`model`)) {
        QueryObject[['model']] <- self$`model`
      }
      if (!is.null(self$`view`)) {
        QueryObject[['view']] <- self$`view`
      }
      if (!is.null(self$`fields`)) {
        QueryObject[['fields']] <- self$`fields`
      }
      if (!is.null(self$`pivots`)) {
        QueryObject[['pivots']] <- self$`pivots`
      }
      if (!is.null(self$`fill_fields`)) {
        QueryObject[['fill_fields']] <- self$`fill_fields`
      }
      if (!is.null(self$`filters`)) {
        QueryObject[['filters']] <- self$`filters`
      }
      if (!is.null(self$`filter_expression`)) {
        QueryObject[['filter_expression']] <- self$`filter_expression`
      }
      if (!is.null(self$`sorts`)) {
        QueryObject[['sorts']] <- self$`sorts`
      }
      if (!is.null(self$`limit`)) {
        QueryObject[['limit']] <- self$`limit`
      }
      if (!is.null(self$`column_limit`)) {
        QueryObject[['column_limit']] <- self$`column_limit`
      }
      if (!is.null(self$`total`)) {
        QueryObject[['total']] <- self$`total`
      }
      if (!is.null(self$`row_total`)) {
        QueryObject[['row_total']] <- self$`row_total`
      }
      if (!is.null(self$`runtime`)) {
        QueryObject[['runtime']] <- self$`runtime`
      }
      if (!is.null(self$`vis_config`)) {
        QueryObject[['vis_config']] <- self$`vis_config`
      }
      if (!is.null(self$`filter_config`)) {
        QueryObject[['filter_config']] <- self$`filter_config`
      }
      if (!is.null(self$`visible_ui_sections`)) {
        QueryObject[['visible_ui_sections']] <- self$`visible_ui_sections`
      }
      if (!is.null(self$`slug`)) {
        QueryObject[['slug']] <- self$`slug`
      }
      if (!is.null(self$`dynamic_fields`)) {
        QueryObject[['dynamic_fields']] <- self$`dynamic_fields`
      }
      if (!is.null(self$`client_id`)) {
        QueryObject[['client_id']] <- self$`client_id`
      }
      if (!is.null(self$`share_url`)) {
        QueryObject[['share_url']] <- self$`share_url`
      }
      if (!is.null(self$`expanded_share_url`)) {
        QueryObject[['expanded_share_url']] <- self$`expanded_share_url`
      }
      if (!is.null(self$`url`)) {
        QueryObject[['url']] <- self$`url`
      }
      if (!is.null(self$`query_timezone`)) {
        QueryObject[['query_timezone']] <- self$`query_timezone`
      }
      if (!is.null(self$`has_table_calculations`)) {
        QueryObject[['has_table_calculations']] <- self$`has_table_calculations`
      }
      if (!is.null(self$`can`)) {
        QueryObject[['can']] <- self$`can`
      }

      QueryObject
    },
    fromJSON = function(QueryJson) {
      QueryObject <- jsonlite::fromJSON(QueryJson)
      if (!is.null(QueryObject$`id`)) {
        self$`id` <- QueryObject$`id`
      }
      if (!is.null(QueryObject$`model`)) {
        self$`model` <- QueryObject$`model`
      }
      if (!is.null(QueryObject$`view`)) {
        self$`view` <- QueryObject$`view`
      }
      if (!is.null(QueryObject$`fields`)) {
        self$`fields` <- QueryObject$`fields`
      }
      if (!is.null(QueryObject$`pivots`)) {
        self$`pivots` <- QueryObject$`pivots`
      }
      if (!is.null(QueryObject$`fill_fields`)) {
        self$`fill_fields` <- QueryObject$`fill_fields`
      }
      if (!is.null(QueryObject$`filters`)) {
        self$`filters` <- QueryObject$`filters`
      }
      if (!is.null(QueryObject$`filter_expression`)) {
        self$`filter_expression` <- QueryObject$`filter_expression`
      }
      if (!is.null(QueryObject$`sorts`)) {
        self$`sorts` <- QueryObject$`sorts`
      }
      if (!is.null(QueryObject$`limit`)) {
        self$`limit` <- QueryObject$`limit`
      }
      if (!is.null(QueryObject$`column_limit`)) {
        self$`column_limit` <- QueryObject$`column_limit`
      }
      if (!is.null(QueryObject$`total`)) {
        self$`total` <- QueryObject$`total`
      }
      if (!is.null(QueryObject$`row_total`)) {
        self$`row_total` <- QueryObject$`row_total`
      }
      if (!is.null(QueryObject$`runtime`)) {
        self$`runtime` <- QueryObject$`runtime`
      }
      if (!is.null(QueryObject$`vis_config`)) {
        self$`vis_config` <- QueryObject$`vis_config`
      }
      if (!is.null(QueryObject$`filter_config`)) {
        self$`filter_config` <- QueryObject$`filter_config`
      }
      if (!is.null(QueryObject$`visible_ui_sections`)) {
        self$`visible_ui_sections` <- QueryObject$`visible_ui_sections`
      }
      if (!is.null(QueryObject$`slug`)) {
        self$`slug` <- QueryObject$`slug`
      }
      if (!is.null(QueryObject$`dynamic_fields`)) {
        self$`dynamic_fields` <- QueryObject$`dynamic_fields`
      }
      if (!is.null(QueryObject$`client_id`)) {
        self$`client_id` <- QueryObject$`client_id`
      }
      if (!is.null(QueryObject$`share_url`)) {
        self$`share_url` <- QueryObject$`share_url`
      }
      if (!is.null(QueryObject$`expanded_share_url`)) {
        self$`expanded_share_url` <- QueryObject$`expanded_share_url`
      }
      if (!is.null(QueryObject$`url`)) {
        self$`url` <- QueryObject$`url`
      }
      if (!is.null(QueryObject$`query_timezone`)) {
        self$`query_timezone` <- QueryObject$`query_timezone`
      }
      if (!is.null(QueryObject$`has_table_calculations`)) {
        self$`has_table_calculations` <- QueryObject$`has_table_calculations`
      }
      if (!is.null(QueryObject$`can`)) {
        self$`can` <- QueryObject$`can`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "id": %d,
           "model": %s,
           "view": %s,
           "fields": [%s],
           "pivots": [%s],
           "fill_fields": [%s],
           "filters": %s,
           "filter_expression": %s,
           "sorts": [%s],
           "limit": %s,
           "column_limit": %s,
           "total": %s,
           "row_total": %s,
           "runtime": %d,
           "vis_config": %s,
           "filter_config": %s,
           "visible_ui_sections": %s,
           "slug": %s,
           "dynamic_fields": [%s],
           "client_id": %s,
           "share_url": %s,
           "expanded_share_url": %s,
           "url": %s,
           "query_timezone": %s,
           "has_table_calculations": %s,
           "can": %s
        }',
        self$`id`,
        self$`model`,
        self$`view`,
        lapply(self$`fields`, function(x) paste(paste0('"', x, '"'), sep=",")),
        lapply(self$`pivots`, function(x) paste(paste0('"', x, '"'), sep=",")),
        lapply(self$`fill_fields`, function(x) paste(paste0('"', x, '"'), sep=",")),
        self$`filters`,
        self$`filter_expression`,
        lapply(self$`sorts`, function(x) paste(paste0('"', x, '"'), sep=",")),
        self$`limit`,
        self$`column_limit`,
        self$`total`,
        self$`row_total`,
        self$`runtime`,
        self$`vis_config`,
        self$`filter_config`,
        self$`visible_ui_sections`,
        self$`slug`,
        lapply(self$`dynamic_fields`, function(x) paste(paste0('"', x, '"'), sep=",")),
        self$`client_id`,
        self$`share_url`,
        self$`expanded_share_url`,
        self$`url`,
        self$`query_timezone`,
        self$`has_table_calculations`,
        self$`can`
      )
    },
    fromJSONString = function(QueryJson) {
      QueryObject <- jsonlite::fromJSON(QueryJson)
      self$`id` <- QueryObject$`id`
      self$`model` <- QueryObject$`model`
      self$`view` <- QueryObject$`view`
      self$`fields` <- QueryObject$`fields`
      self$`pivots` <- QueryObject$`pivots`
      self$`fill_fields` <- QueryObject$`fill_fields`
      self$`filters` <- QueryObject$`filters`
      self$`filter_expression` <- QueryObject$`filter_expression`
      self$`sorts` <- QueryObject$`sorts`
      self$`limit` <- QueryObject$`limit`
      self$`column_limit` <- QueryObject$`column_limit`
      self$`total` <- QueryObject$`total`
      self$`row_total` <- QueryObject$`row_total`
      self$`runtime` <- QueryObject$`runtime`
      self$`vis_config` <- QueryObject$`vis_config`
      self$`filter_config` <- QueryObject$`filter_config`
      self$`visible_ui_sections` <- QueryObject$`visible_ui_sections`
      self$`slug` <- QueryObject$`slug`
      self$`dynamic_fields` <- QueryObject$`dynamic_fields`
      self$`client_id` <- QueryObject$`client_id`
      self$`share_url` <- QueryObject$`share_url`
      self$`expanded_share_url` <- QueryObject$`expanded_share_url`
      self$`url` <- QueryObject$`url`
      self$`query_timezone` <- QueryObject$`query_timezone`
      self$`has_table_calculations` <- QueryObject$`has_table_calculations`
      self$`can` <- QueryObject$`can`
    }
  )
)
haarthi/R_sdk documentation built on May 18, 2019, 11:28 p.m.