collectionURL <- paste0(private$host, "collections")
headers <- list(Authorization = paste("OAuth2", private$token))
+ names(filters) <- c("collection")
+
serverResponse <- private$http$GET(collectionURL, headers, filters, limit, offset)
collection <- private$httpParser$parseJSONResponse(serverResponse)
headers <- list("Authorization" = paste("OAuth2", private$token),
"Content-Type" = "application/json")
+ names(body) <- c("collection")
body <- jsonlite::toJSON(body, auto_unbox = T)
serverResponse <- private$http$PUT(collectionURL, headers, body)
collectionURL <- paste0(private$host, "collections")
headers <- list("Authorization" = paste("OAuth2", private$token),
"Content-Type" = "application/json")
+
+ names(body) <- c("collection")
body <- jsonlite::toJSON(body, auto_unbox = T)
serverResponse <- private$http$POST(collectionURL, headers, body)
stop(collection$errors)
collection
- }
+ },
+
+ getProject = function(uuid)
+ {
+ projectURL <- paste0(private$host, "groups/", uuid)
+ headers <- list(Authorization = paste("OAuth2", private$token))
+
+ serverResponse <- private$http$GET(projectURL, headers)
+
+ project <- private$httpParser$parseJSONResponse(serverResponse)
+
+ if(!is.null(project$errors))
+ stop(project$errors)
+
+ project
+ },
+
+ createProject = function(body)
+ {
+ projectURL <- paste0(private$host, "groups")
+ headers <- list("Authorization" = paste("OAuth2", private$token),
+ "Content-Type" = "application/json")
+
+ names(body) <- c("group")
+ body <- jsonlite::toJSON(body, auto_unbox = T)
+
+ serverResponse <- private$http$POST(projectURL, headers, body)
+
+ project <- private$httpParser$parseJSONResponse(serverResponse)
+
+ if(!is.null(project$errors))
+ stop(project$errors)
+
+ project
+ },
+
+ updateProject = function(uuid, body)
+ {
+ projectURL <- paste0(private$host, "groups/", uuid)
+ headers <- list("Authorization" = paste("OAuth2", private$token),
+ "Content-Type" = "application/json")
+
+ names(body) <- c("group")
+ body <- jsonlite::toJSON(body, auto_unbox = T)
+
+ serverResponse <- private$http$PUT(projectURL, headers, body)
+
+ project <- private$httpParser$parseJSONResponse(serverResponse)
+
+ if(!is.null(project$errors))
+ stop(project$errors)
+
+ project
+ },
+
+ listProjects = function(filters = NULL, limit = 100, offset = 0)
+ {
+ projectURL <- paste0(private$host, "groups")
+ headers <- list(Authorization = paste("OAuth2", private$token))
+
+ names(filters) <- c("groups")
+ serverResponse <- private$http$GET(projectURL, headers, filters, limit, offset)
+ projects <- private$httpParser$parseJSONResponse(serverResponse)
+
+ if(!is.null(projects$errors))
+ stop(projects$errors)
+
+ projects
+ },
+
+ deleteProject = function(uuid)
+ {
+ projectURL <- paste0(private$host, "groups/", uuid)
+ headers <- list("Authorization" = paste("OAuth2", private$token),
+ "Content-Type" = "application/json")
+
+ serverResponse <- private$http$DELETE(projectURL, headers)
+
+ project <- private$httpParser$parseJSONResponse(serverResponse)
+
+ if(!is.null(project$errors))
+ stop(project$errors)
+
+ project
+ }
),
private = list(
#Update collection:
-updatedCollection <- arv$updateCollection("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
+updatedCollection <- arv$updateCollection("uuid", list((name = "new_name", description = "new_desciption")))
--------------------------------------------------------------------------------------------------------------------------------
#Create collection:
-updatedCollection <- arv$createCollection("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
+cratedCollection <- arv$createCollection(list(list(name = "new_name", description = "new_desciption")))
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
-#Collection manipulation:
+#Collection content manipulation:
--------------------------------------------------------------------------------------------------------------------------------
collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
--------------------------------------------------------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------------------------------------------------------
+
+#Get project:
+
+arv$getProject("uuid")
+
+--------------------------------------------------------------------------------------------------------------------------------
+
+#List projects:
+
+projects <- arv$listProjects(list("uuid", "=" "aaaaa-bbbbb-ccccccccccccccc"), limit = 10, offset = 2)
+
+--------------------------------------------------------------------------------------------------------------------------------
+
+#Delete project:
+
+deletedProject <- arv$deleteProject("uuid")
+
+--------------------------------------------------------------------------------------------------------------------------------
+
+#Update project:
+
+updatedProject <- arv$updateProject("uuid", list((name = "new_name", description = "new_desciption")))
+
+--------------------------------------------------------------------------------------------------------------------------------
+
+#Create project:
+
+cratedProject <- arv$createProject(list(list(name = "project_name", description = "project_desciption")))
+
+--------------------------------------------------------------------------------------------------------------------------------