Moved all classes from RefClass OOP model to R6 and made improvements
[arvados.git] / sdk / R / README
index 011735803996aa2ee07fb4d0afee26407ada8583..6f4e31ebb6597af2659ec678af72a6d191c716e1 100644 (file)
@@ -4,62 +4,79 @@ Examples of usage:
 
 --------------------------------------------------------------------------------------------------------------------------------
 
-Get collection:
+#Initialize API:
 
-arv <- Arvados("insert_token", "insert_host_name")
-arv$collection_get("uuid")
+arv <- Arvados$new("insert_token", "insert_host_name")
 
 --------------------------------------------------------------------------------------------------------------------------------
 
-List collections:
+#Get collection:
 
-collectionList <- arv$collection_list(list("uuid", "=" "aaaaa-bbbbb-ccccccccccccccc"), limit = 10, offset = 2)
+arv$getCollection("uuid")
 
 --------------------------------------------------------------------------------------------------------------------------------
 
-Delete collection:
+#List collections:
 
-deletedCollection <- arv$collection_delete("uuid")
+collectionList <- arv$listCollections(list("uuid", "=" "aaaaa-bbbbb-ccccccccccccccc"), limit = 10, offset = 2)
 
 --------------------------------------------------------------------------------------------------------------------------------
 
-Update collection:
+#Delete collection:
 
-updatedCollection <- arv$collection_update("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
+deletedCollection <- arv$deleteCollection("uuid")
 
 --------------------------------------------------------------------------------------------------------------------------------
 
-Create collection:
+#Update collection:
 
-updatedCollection <- arv$collection_update("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
+updatedCollection <- arv$updateCollection("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
+
+--------------------------------------------------------------------------------------------------------------------------------
+
+#Create collection:
+
+updatedCollection <- arv$createCollection("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
 
 --------------------------------------------------------------------------------------------------------------------------------
 
 --------------------------------------------------------------------------------------------------------------------------------
 
-Things I'm currently working on and are not finished.
+#Collection manipulation:
 
-Collection manipulation:
+--------------------------------------------------------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------------------------------------------------------
 
-arv <- Arvados("insert_token", "insert_host_name")
+#Create collection object:
 
-//This will be removed
-arv$setWebDavToken("webdav_token")
-arv$setWebDavHostName("full_path_to_the_collection_on_webdav_server")
+arv <- Arvados$new("insert_token", "insert_host_name")
+collection <- Collection$new(arv, "uuid")
 
-collection <- Collection(arv, "uuid")
 --------------------------------------------------------------------------------------------------------------------------------
-This will return all files in collection as character vector.
 
-listOfFilesInCollection <- collection$items
+#Print content of the collection
+
+collection$printFileContent()
+
+#of if you just want a list of relative paths:
+
+collection$printFileContent(pretty = FALSE)
+
 --------------------------------------------------------------------------------------------------------------------------------
 
-This will return ArvadosFile or Subcollection from internal tree-like structure.
+#This will return ArvadosFile or Subcollection from internal tree-like structure.
+
+arvadosFile <- collection$get("location/to/my/file.cpp")
 
-collection <- Collection(arv, "uuid")
+#or
 
-arvadosFile <- collection.get("location/to/my/file.exe")
 arvadosSubcollection <- collection.get("location/to/my/directory/")
 
+--------------------------------------------------------------------------------------------------------------------------------
+
+#Read whole file or just a portion of it.
+
+arvadosFile$read(offset = 1024, length = 512)
 
 --------------------------------------------------------------------------------------------------------------------------------