public = list(
- initialize = function(auth_token = NULL, host_name = NULL)
+ initialize = function(auth_token = NULL, host_name = NULL)
{
if(!is.null(host_name))
Sys.setenv(ARVADOS_API_HOST = host_name)
if(!is.null(auth_token))
Sys.setenv(ARVADOS_API_TOKEN = auth_token)
- host <- Sys.getenv("ARVADOS_API_HOST");
+ host_name <- Sys.getenv("ARVADOS_API_HOST");
token <- Sys.getenv("ARVADOS_API_TOKEN");
- if(host == "" | token == "")
+ if(host_name == "" | token == "")
stop(paste0("Please provide host name and authentification token",
" or set ARVADOS_API_HOST and ARVADOS_API_TOKEN",
" environmental variables."))
version <- "v1"
- host <- paste0("https://", host, "/arvados/", version, "/")
+ host <- paste0("https://", host_name, "/arvados/", version, "/")
private$http <- HttpRequest$new()
private$httpParser <- HttpParser$new()
private$webDavHostName
},
- getCollection = function(uuid)
+ getCollection = function(uuid)
{
collectionURL <- paste0(private$host, "collections/", uuid)
headers <- list(Authorization = paste("OAuth2", private$token))
collection <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(collection$errors))
- stop(collection$errors)
+ stop(collection$errors)
collection
},
- listCollections = function(filters = NULL, limit = 100, offset = 0)
+ listCollections = function(filters = NULL, limit = 100, offset = 0)
{
collectionURL <- paste0(private$host, "collections")
headers <- list(Authorization = paste("OAuth2", private$token))
collections <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(collections$errors))
- stop(collections$errors)
+ stop(collections$errors)
collections
},
private$fetchAllItems(collectionURL, filters)
},
- deleteCollection = function(uuid)
+ deleteCollection = function(uuid)
{
collectionURL <- paste0(private$host, "collections/", uuid)
headers <- list("Authorization" = paste("OAuth2", private$token),
collection <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(collection$errors))
- stop(collection$errors)
+ stop(collection$errors)
collection
},
- updateCollection = function(uuid, newContent)
+ updateCollection = function(uuid, newContent)
{
collectionURL <- paste0(private$host, "collections/", uuid)
headers <- list("Authorization" = paste("OAuth2", private$token),
collection <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(collection$errors))
- stop(collection$errors)
+ stop(collection$errors)
collection
},
- createCollection = function(content)
+ createCollection = function(content)
{
collectionURL <- paste0(private$host, "collections")
headers <- list("Authorization" = paste("OAuth2", private$token),
collection <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(collection$errors))
- stop(collection$errors)
+ stop(collection$errors)
collection
},
project <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(project$errors))
- stop(project$errors)
+ stop(project$errors)
project
},
- createProject = function(content)
+ createProject = function(content)
{
projectURL <- paste0(private$host, "groups")
headers <- list("Authorization" = paste("OAuth2", private$token),
project <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(project$errors))
- stop(project$errors)
+ stop(project$errors)
project
},
- updateProject = function(uuid, newContent)
+ updateProject = function(uuid, newContent)
{
projectURL <- paste0(private$host, "groups/", uuid)
headers <- list("Authorization" = paste("OAuth2", private$token),
project <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(project$errors))
- stop(project$errors)
+ stop(project$errors)
project
},
- listProjects = function(filters = NULL, limit = 100, offset = 0)
+ listProjects = function(filters = NULL, limit = 100, offset = 0)
{
projectURL <- paste0(private$host, "groups")
headers <- list(Authorization = paste("OAuth2", private$token))
projects <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(projects$errors))
- stop(projects$errors)
+ stop(projects$errors)
projects
},
private$fetchAllItems(projectURL, filters)
},
- deleteProject = function(uuid)
+ deleteProject = function(uuid)
{
projectURL <- paste0(private$host, "groups/", uuid)
headers <- list("Authorization" = paste("OAuth2", private$token),
project <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(project$errors))
- stop(project$errors)
+ stop(project$errors)
project
}
),
-
+
private = list(
token = NULL,
parsedResponse <- private$httpParser$parseJSONResponse(serverResponse)
if(!is.null(parsedResponse$errors))
- stop(parsedResponse$errors)
+ stop(parsedResponse$errors)
items <- c(items, parsedResponse$items)
offset <- length(items)
items
}
),
-
+
cloneable = FALSE
)