#' Synapse REST API
#'
#' No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
#'
#' The version of the OpenAPI document: v1
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title DockerAuthorizationServices operations
#' @description DockerAuthorizationServicesApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ GetDockerV1BearerToken } \emph{ }
#'
#' \itemize{
#' \item \emph{ @param } service character
#' \item \emph{ @param } synapse_authorization character
#' \item \emph{ @param } scope list( character )
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDockerDockerAuthorizationToken} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDockerDockerAuthorizationToken
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### GetDockerV1BearerToken ####################
#'
#' library(synclient)
#' var_service <- "service_example" # character |
#' var_synapse_authorization <- "synapse_authorization_example" # character | (Optional)
#' var_scope <- c("inner_example") # array[character] | (Optional)
#'
#' api_instance <- DockerAuthorizationServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$GetDockerV1BearerToken(var_service, synapse_authorization = var_synapse_authorization, scope = var_scopedata_file = "result.txt")
#' result <- api_instance$GetDockerV1BearerToken(var_service, synapse_authorization = var_synapse_authorization, scope = var_scope)
#' dput(result)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
DockerAuthorizationServicesApi <- R6::R6Class(
"DockerAuthorizationServicesApi",
public = list(
api_client = NULL,
#' Initialize a new DockerAuthorizationServicesApi.
#'
#' @description
#' Initialize a new DockerAuthorizationServicesApi.
#'
#' @param api_client An instance of API client.
#' @export
initialize = function(api_client) {
if (!missing(api_client)) {
self$api_client <- api_client
} else {
self$api_client <- ApiClient$new()
}
},
#'
#'
#' @description
#'
#'
#' @param service
#' @param synapse_authorization (optional) No description
#' @param scope (optional) No description
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return OrgSagebionetworksRepoModelDockerDockerAuthorizationToken
#' @export
GetDockerV1BearerToken = function(service, synapse_authorization = NULL, scope = NULL, data_file = NULL, ...) {
local_var_response <- self$GetDockerV1BearerTokenWithHttpInfo(service, synapse_authorization, scope, data_file = data_file, ...)
if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
local_var_response$content
} else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
local_var_response
} else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
local_var_response
} else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
local_var_response
}
},
#'
#'
#' @description
#'
#'
#' @param service
#' @param synapse_authorization (optional) No description
#' @param scope (optional) No description
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return API response (OrgSagebionetworksRepoModelDockerDockerAuthorizationToken) with additional information such as HTTP status code, headers
#' @export
GetDockerV1BearerTokenWithHttpInfo = function(service, synapse_authorization = NULL, scope = NULL, data_file = NULL, ...) {
args <- list(...)
query_params <- list()
header_params <- c()
form_params <- list()
file_params <- list()
local_var_body <- NULL
oauth_scopes <- NULL
is_oauth <- FALSE
if (missing(`service`)) {
stop("Missing required parameter `service`.")
}
header_params["Synapse-Authorization"] <- `synapse_authorization`
query_params[["service"]] <- `service`
# explore
for (query_item in `scope`) {
query_params[["scope"]] <- c(query_params[["scope"]], list(`scope` = query_item))
}
local_var_url_path <- "/docker/v1/bearerToken"
# Bearer token
if (!is.null(self$api_client$bearer_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
}
# The Accept request HTTP header
local_var_accepts <- list("application/json")
# The Content-Type representation header
local_var_content_types <- list()
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
method = "GET",
query_params = query_params,
header_params = header_params,
form_params = form_params,
file_params = file_params,
accepts = local_var_accepts,
content_types = local_var_content_types,
body = local_var_body,
is_oauth = is_oauth,
oauth_scopes = oauth_scopes,
...)
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
# save response in a file
if (!is.null(data_file)) {
write(local_var_resp$response, data_file)
}
deserialized_resp_obj <- tryCatch(
self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDockerDockerAuthorizationToken", loadNamespace("synclient")),
error = function(e) {
stop("Failed to deserialize response")
}
)
local_var_resp$content <- deserialized_resp_obj
local_var_resp
} else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
} else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
ApiResponse$new("API client error", local_var_resp)
} else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
if (is.null(local_var_resp$response) || local_var_resp$response == "") {
local_var_resp$response <- "API server error"
}
local_var_resp
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.