This function allows you to attach a file to different content types

attachFile(user, object, filepath, caption)

Arguments

user

A labstep user object. Must contain an `api_key` field. Returned from `login` command

object

The labstep object you want to comment on. Can be `protocol`, `experiment` or `resource`

filepath

The path to ther file to attach.

caption

A caption describing your file (optional)

Value

Returns a `comment` object with the file attached

Examples

user <- login("demo@labstep.com","demopassword") expName = 'My First Experiment' expDesc = 'An experiment testing the labstepR library' experiment <- createExperiment(user,expName,expDesc) filepath = 'mydata.RData' save.image(filepath) caption = 'The R workspace after running this script' file <- attachFile(user,experiment,filepath,caption) print(file)
#> $locked_at #> NULL #> #> $id #> [1] 54767 #> #> $created_at #> [1] "2020-01-30T16:39:26+00:00" #> #> $updated_at #> [1] "2020-01-30T16:39:26+00:00" #> #> $deleted_at #> NULL #> #> $body #> [1] "The R workspace after running this script" #> #> $author #> $author$id #> [1] 4524 #> #> $author$username #> [1] "demo@labstep.com" #> #> $author$name #> [1] "Demo Labstep" #> #> $author$first_name #> [1] "Demo" #> #> $author$last_name #> [1] "Labstep" #> #> $author$profile #> $author$profile$id #> [1] 5751 #> #> $author$profile$photo #> NULL #> #> #> #> $thread #> $thread$all_comment_count #> [1] 1 #> #> $thread$comment_count #> [1] 1 #> #> $thread$id #> [1] 673385 #> #> #> $resource #> NULL #> #> $comment_molecule #> NULL #> #> $comment_post #> NULL #> #> $comment_table #> NULL #> #> $files #> $files[[1]] #> $files[[1]]$filetype #> [1] "rdata" #> #> $files[[1]]$parent_type #> [1] "comment" #> #> $files[[1]]$id #> [1] 106916 #> #> $files[[1]]$created_at #> [1] "2020-01-30T16:39:26+00:00" #> #> $files[[1]]$deleted_at #> NULL #> #> $files[[1]]$is_external #> [1] FALSE #> #> $files[[1]]$is_link #> [1] FALSE #> #> $files[[1]]$is_snapgene #> [1] FALSE #> #> $files[[1]]$is_snapgene_processing #> [1] FALSE #> #> $files[[1]]$name #> [1] "mydata.RData" #> #> $files[[1]]$path #> [1] "2020/01/30/php2bZVad.RData" #> #> $files[[1]]$link_source #> NULL #> #> $files[[1]]$size #> [1] 2586 #> #> $files[[1]]$mime_type #> [1] "application/x-gzip" #> #> $files[[1]]$snapgene_output_png #> NULL #> #> $files[[1]]$snapgene_output_svg #> NULL #> #> $files[[1]]$owner #> $files[[1]]$owner$id #> [1] 6867 #> #> $files[[1]]$owner$name #> [1] "Demo Labstep workspace" #> #> $files[[1]]$owner$created_at #> [1] "2019-08-06T20:34:00+00:00" #> #> $files[[1]]$owner$deleted_at #> NULL #> #> $files[[1]]$owner$description #> NULL #> #> $files[[1]]$owner$profile #> $files[[1]]$owner$profile$id #> [1] 19084 #> #> $files[[1]]$owner$profile$photo #> NULL #> #> #> $files[[1]]$owner$is_home #> [1] TRUE #> #> #> $files[[1]]$permissions #> $files[[1]]$permissions$view #> [1] TRUE #> #> $files[[1]]$permissions$edit #> [1] TRUE #> #> $files[[1]]$permissions$owner #> [1] TRUE #> #> #> #> #> $permissions #> $permissions$view #> [1] TRUE #> #> $permissions$edit #> [1] TRUE #> #> $permissions$owner #> [1] TRUE #> #>