# TileDB Storage Platform API
#
# TileDB Storage Platform REST API
#
# The version of the OpenAPI document: 2.2.19
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title Sql operations
#' @description tiledbcloud.Sql
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ RunSQL } \emph{ }
#' Run a sql query
#'
#' \itemize{
#' \item \emph{ @param } namespace character
#' \item \emph{ @param } sql \link{SQLParameters}
#' \item \emph{ @param } accept.encoding character
#'
#'
#' \item status code : 200 | JSON results in array of objects form, if the query returns results
#'
#' \item return type : array[object]
#' \item response headers :
#'
#' \tabular{ll}{
#' X-TILEDB-CLOUD-TASK-ID \tab Task ID for just completed request \cr
#' }
#' \item status code : 204 | SQL executed successfully
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' X-TILEDB-CLOUD-TASK-ID \tab Task ID for just completed request \cr
#' }
#' \item status code : 0 | error response
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### RunSQL ####################
#'
#' library(tiledbcloud)
#' var.namespace <- 'namespace_example' # character | namespace to run task under is in (an organization name or user's username)
#' var.sql <- SQLParameters$new() # SQLParameters | sql being submitted
#' var.accept.encoding <- 'accept.encoding_example' # character | Encoding to use
#'
#' api.instance <- SqlApi$new()
#'
#' #Configure API key authorization: ApiKeyAuth
#' api.instance$apiClient$apiKeys['X-TILEDB-REST-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' #Configure HTTP basic authorization: BasicAuth
#' # provide your username in the user-serial format
#' api.instance$apiClient$username <- '<user-serial>';
#' # provide your api key generated using the developer portal
#' api.instance$apiClient$password <- '<api_key>';
#'
#' result <- api.instance$RunSQL(var.namespace, var.sql, accept.encoding=var.accept.encoding)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
SqlApi <- R6::R6Class(
'SqlApi',
public = list(
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
RunSQL = function(namespace, sql, accept.encoding=NULL, ...){
apiResponse <- self$RunSQLWithHttpInfo(namespace, sql, accept.encoding, ...)
resp <- apiResponse$response
# MANUAL EDIT AFTER OPENAPI AUTOGEN
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else {
apiResponse
}
},
RunSQLWithHttpInfo = function(namespace, sql, accept.encoding=NULL, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`namespace`)) {
stop("Missing required parameter `namespace`.")
}
if (missing(`sql`)) {
stop("Missing required parameter `sql`.")
}
headerParams['Accept-Encoding'] <- `accept.encoding`
if (!missing(`sql`)) {
body <- `sql`$toJSONString()
} else {
body <- NULL
}
urlPath <- "/sql/{namespace}"
if (!missing(`namespace`)) {
urlPath <- gsub(paste0("\\{", "namespace", "\\}"), URLencode(as.character(`namespace`), reserved = TRUE), urlPath)
}
# API key authentication
if ("X-TILEDB-REST-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]) > 0) {
headerParams['X-TILEDB-REST-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-TILEDB-REST-API-KEY"]), collapse='')
}
# HTTP basic auth
headerParams['Authorization'] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$apiClient$username, self$apiClient$password, sep=":"))))
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# MANUAL EDIT AFTER OPENAPI AUTOGEN
.wrap_as_api_response(resp)
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.