1 source("./R/HttpRequest.R")
2 source("./R/HttpParser.R")
6 #' All Arvados logic is inside this class
8 #' @field token represents user authentification token.
9 #' @field host represents server name we wish to connect to.
11 Arvados <- setRefClass(
22 initialize = function(auth_token, host_name)
24 #Todo(Fudo): Validate token
33 #' Get Arvados collection
35 #' @name collection_get
36 #' @field uuid UUID of the given collection
39 collection_get = function(uuid)
41 collection_relative_url <- paste0("collections/", uuid)
42 http_request <- HttpRequest("GET", token, host, collection_relative_url)
43 server_response <- http_request$execute()
45 httpParser <- HttpParser()
46 collection <- httpParser$parseCollectionGet(server_response)
48 if(!is.null(collection$errors))
49 stop(collection$errors)
51 class(collection) <- "ArvadosCollection"
59 #' List Arvados collections based on filter matching
61 #' @name collection_list
62 #' @field uuid UUID of the given collection
65 collection_list = function(filters = NULL, limit = NULL, offset = NULL)
67 #Todo(Fudo): Implement limit and offset
68 collection_relative_url <- "collections"
69 http_request <- HttpRequest("GET", token, host, collection_relative_url, filters, limit, offset)
70 server_response <- http_request$execute()
72 httpParser <- HttpParser()
73 collection <- httpParser$parseCollectionGet(server_response)
75 if(!is.null(collection$errors))
76 stop(collection$errors)
78 class(collection) <- "ArvadosCollectionList"