# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#'
#'
#' Read more about the Tag API in the [Agave Developer's Guide](http://docs.agaveplatform.org/#/tag)
#'
#' @title Agave Tag API operations
#' @description
#' TagApi Class
#'
#' @section Arguments:
#' \describe{
#'
#' `apiClient` a [rAgave::ApiClient] instance preconfigured to speak to the Agave Platform.
#'
#' `cache` an [rAgave::AgaveCache] instance pointing to the persistent auth cache file on disk.
#'
#' `responseType` the default object type methods of this class should return. Valid values are:
#' * **raw**: the raw JSON string response from the API. You may optionally include
#' `pretty=TRUE` in the method call to receive pretty printed JSON.
#' * **list**: a standard R list object. This is the default value.
#' * **dt**: a data table
#'
#' }
#'
#' @usage
#' tag <- TagApi$new( apiClient = ApiClient$new(), cache = AgaveCache$new() )
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' `$addTag()` Creat a new tag
#'
#' **Usage**
#'
#' ```
#' tag$addTag$listTag(body, naked, )
#' ```
#'
#'
#' `$addTagResource()` Add resources to tag
#'
#' **Usage**
#'
#' ```
#' tag$addTagResource$listTag(tagId, body, naked, )
#' ```
#'
#'
#' `$clearTagPermissions()` Clear tag permissions
#'
#' **Usage**
#'
#' ```
#' tag$clearTagPermissions$listTag(tagId, naked, )
#' ```
#'
#'
#' `$clearTagResources()` Clear all tagged resources
#'
#' **Usage**
#'
#' ```
#' tag$clearTagResources$listTag(tagId, naked, )
#' ```
#'
#'
#' `$deleteTag()` Delete tag
#'
#' **Usage**
#'
#' ```
#' tag$deleteTag$listTag(tagId, naked, )
#' ```
#'
#'
#' `$deleteTagPermissionForUser()` Remove user tag permission
#'
#' **Usage**
#'
#' ```
#' tag$deleteTagPermissionForUser$listTag(tagId, username, naked, )
#' ```
#'
#'
#' `$getTagDetails()` Tag Details
#'
#' **Usage**
#'
#' ```
#' tag$getTagDetails$listTag(tagId, naked, search, )
#' tag$getTagDetails$listTag(search=list("foo"="bar"))
#' ```
#'
#'
#' `$getTagPermissionForUser()` List tag permissions for a user
#'
#' **Usage**
#'
#' ```
#' tag$getTagPermissionForUser$listTag(tagId, username, naked, )
#' ```
#'
#'
#' `$getTaggedResource()` Get tagged item details
#'
#' **Usage**
#'
#' ```
#' tag$getTaggedResource$listTag(tagId, uuid, naked, )
#' ```
#'
#'
#' `$listTagHistory()` Tag history
#'
#' **Usage**
#'
#' ```
#' tag$listTagHistory$listTag(tagId, naked, limit, offset, search, )
#' tag$listTagHistory$listTag(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listTagPermissions()` List permissionss set for a given tag id
#'
#' **Usage**
#'
#' ```
#' tag$listTagPermissions$listTag(tagId, naked, limit, offset, search, )
#' tag$listTagPermissions$listTag(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listTagResources()` Tagged items
#'
#' **Usage**
#'
#' ```
#' tag$listTagResources$listTag(tagId, naked, limit, offset, search, )
#' tag$listTagResources$listTag(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listTags()` Available tags
#'
#' **Usage**
#'
#' ```
#' tag$listTags$listTag(name, resourceType, resourceId, lastModified, created, naked, limit, offset, search, )
#' tag$listTags$listTag(search=list("foo"="bar"))
#' ```
#'
#'
#' `$removeTagResource()` Remove resource from tag
#'
#' **Usage**
#'
#' ```
#' tag$removeTagResource$listTag(tagId, uuid, naked, )
#' ```
#'
#'
#' `$updateTag()` Update tag
#'
#' **Usage**
#'
#' ```
#' tag$updateTag$listTag(tagId, body, naked, )
#' ```
#'
#'
#' `$updateTagPermission()` Grant permission
#'
#' **Usage**
#'
#' ```
#' tag$updateTagPermission$listTag(tagId, body, naked, )
#' ```
#'
#'
#' `$updateTagPermissionForUser()` Update user permission on tag
#'
#' **Usage**
#'
#' ```
#' tag$updateTagPermissionForUser$listTag(tagId, username, body, naked, )
#' ```
#'
#'
#' `$updateTagResource()` Add resource to tag
#'
#' **Usage**
#'
#' ```
#' tag$updateTagResource$listTag(tagId, uuid, body, naked, )
#' ```
#'
#' }
#'
#' @name TagApi
#' @seealso [rAgave::ApiClient] [rAgave::Agave] [rAgave::Permission][rAgave::Tag][rAgave::TagHistory][rAgave::TagResource][rAgave::TagSummary]
#' @export
TagApi <- R6::R6Class(
'TagApi',
private = list(
userAgent = "Agave-SDK/0.2.0/r",
apiClient = NULL,
responseType = "list",
formatResponse = function(resp, args=list()) {
# read the args from the unnamed request args
if ("responseType" %in% names(args)) {
responseType = args$responseType
}
else {
responseType = NULL
}
if (is.null(responseType) || nchar(responseType) == 0) {
responseType = private$responseType
}
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
logger.debug(jsonlite::toJSON(httr::content(resp,stringsAsFactors = FALSE), auto_unbox=TRUE, null="null", na="null"))
if (responseType == "raw") {
# check for the undeclared pretty attibute to pretty-print the json response
prettyPrint <- ("pretty" %in% names(args) && isTRUE(args$pretty))
jsonlite::toJSON(httr::content(resp, stringsAsFactors = FALSE), auto_unbox=TRUE, null="null", na="null", pretty=prettyPrint)
}
else {
jsonResp <- httr::content(resp)
if ("result" %in% names(jsonResp)) {
jsonResp <- jsonResp$result
}
if ((responseType == "df" || responseType == "dataframe") && length(jsonResp) > 0) {
# lookup properties of object. if null, it's a list. if not null, it's an object
colNames <- names(jsonResp)
if (is.null(colNames)) {
# convert to a list of dataframes
do.call("rbind", lapply(jsonResp, as.data.frame, col.names=factor(names(jsonResp[[1]]))))
}
else {
# convert object to single data frame
as.data.frame(jsonResp)
}
}
else {
jsonResp
}
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
logger.warn(jsonlite::toJSON(httr::content(resp, "text", encoding="UTF-8"), auto_unbox=TRUE, null="null", na="null"))
httr::content(resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
logger.warn(jsonlite::toJSON(httr::content(resp, "text", encoding="UTF-8"), auto_unbox=TRUE, null="null", na="null"))
httr::content(resp)
}
}
),
public = list(
initialize = function(apiClient, responseType){
if (!missing(apiClient)) {
private$apiClient <- apiClient
}
else {
private$apiClient <- ApiClient$new()
}
# user can override the global representation in which resources
# responses from this API are returned in when calling methods of
# this class. The same responseType attribute may be passed to any
# public method to override individual calls as well.
if (missing(responseType) || is.null(responseType) || nchar(responseType) == 0) {
# we ignore and use the default
}
else if (responseType != "raw" && responseType != "list" && responseType != "df") {
stop("Invalid responseType. Please specify one of: raw, list, df")
}
else {
# set the response type to the class default to be used
# whenever it is not explicitly set on a request
private$responseType = responseType
}
},
addTag = function(body, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`body`)) {
if (!is.list(`body`)) {
body <- `body`$toJSON()
}
} else {
body <- NULL
}
urlPath <- "/tags/v2"
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
addTagResource = function(tagId, body, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`body`)) {
if (!is.list(`body`)) {
body <- `body`$toJSON()
}
} else {
body <- NULL
}
urlPath <- "/tags/v2/{tagId}/resources"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
clearTagPermissions = function(tagId, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}/pems"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
clearTagResources = function(tagId, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}/resources"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
deleteTag = function(tagId, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
deleteTagPermissionForUser = function(tagId, username, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}/pems/{username}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
if (!missing(`username`)) {
urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
getTagDetails = function(tagId, naked, search, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(search)) {
queryParams <- search
}
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
getTagPermissionForUser = function(tagId, username, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}/pems/{username}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
if (!missing(`username`)) {
urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
getTaggedResource = function(tagId, uuid, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}/resources/{uuid}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
if (!missing(`uuid`)) {
urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
listTagHistory = function(tagId, naked, limit, offset, search, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(search)) {
queryParams <- search
}
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`limit`)) {
queryParams['limit'] <- limit
}
if (!missing(`offset`)) {
queryParams['offset'] <- offset
}
urlPath <- "/tags/v2/{tagId}/history"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
listTagPermissions = function(tagId, naked, limit, offset, search, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(search)) {
queryParams <- search
}
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`limit`)) {
queryParams['limit'] <- limit
}
if (!missing(`offset`)) {
queryParams['offset'] <- offset
}
urlPath <- "/tags/v2/{tagId}/pems"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
listTagResources = function(tagId, naked, limit, offset, search, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(search)) {
queryParams <- search
}
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`limit`)) {
queryParams['limit'] <- limit
}
if (!missing(`offset`)) {
queryParams['offset'] <- offset
}
urlPath <- "/tags/v2/{tagId}/resources"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
listTags = function(name, resourceType, resourceId, lastModified, created, naked, limit, offset, search, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(search)) {
queryParams <- search
}
if (!missing(`name`)) {
queryParams['name'] <- name
}
if (!missing(`resourceType`)) {
queryParams['resourceType'] <- resourceType
}
if (!missing(`resourceId`)) {
queryParams['resourceId'] <- resourceId
}
if (!missing(`lastModified`)) {
queryParams['lastModified'] <- lastModified
}
if (!missing(`created`)) {
queryParams['created'] <- created
}
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`limit`)) {
queryParams['limit'] <- limit
}
if (!missing(`offset`)) {
queryParams['offset'] <- offset
}
urlPath <- "/tags/v2"
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
removeTagResource = function(tagId, uuid, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
urlPath <- "/tags/v2/{tagId}/resources/{uuid}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
if (!missing(`uuid`)) {
urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
updateTag = function(tagId, body, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`body`)) {
if (!is.list(`body`)) {
body <- `body`$toJSON()
}
} else {
body <- NULL
}
urlPath <- "/tags/v2/{tagId}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "PUT",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
updateTagPermission = function(tagId, body, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`body`)) {
if (!is.list(`body`)) {
body <- `body`$toJSON()
}
} else {
body <- NULL
}
urlPath <- "/tags/v2/{tagId}/pems"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
updateTagPermissionForUser = function(tagId, username, body, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`body`)) {
if (!is.list(`body`)) {
body <- `body`$toJSON()
}
} else {
body <- NULL
}
urlPath <- "/tags/v2/{tagId}/pems/{username}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
if (!missing(`username`)) {
urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
},
updateTagResource = function(tagId, uuid, body, naked, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`naked`)) {
queryParams['naked'] <- naked
}
if (!missing(`body`)) {
if (!is.list(`body`)) {
body <- `body`$toJSON()
}
} else {
body <- NULL
}
urlPath <- "/tags/v2/{tagId}/resources/{uuid}"
if (!missing(`tagId`)) {
urlPath <- gsub(paste0("\\{", "tagId", "\\}"), `tagId`, urlPath)
}
if (!missing(`uuid`)) {
urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
}
resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
method = "PUT",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
# Send the response to the common filtering method to marshal the
# response into the format requested by the user in the Agave global
# configuration, API class instance, or individual method invocation.
private$formatResponse(resp, args);
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.