List the directories that were registered in SewerRat.

listRegisteredDirectories(url, user = NULL)

Arguments

url

String containing the URL of the SewerRat REST API.

user

String containing the name of a user. If supplied, results are filtered to directories registered by this user. If TRUE, this is set to the current user.

Value

List of named lists, where each inner list corresponds to a registered directory and contains:

  • path, string containing a path to the directory.

  • user, string containing the name of the user who registered this directory.

  • time, numeric scalar specifying the the Unix epoch time when this directory was registered.

  • names, a character vector containing the base names of the JSON files to be indexed.

Author

Aaron Lun

Examples

# Starting up an example SewerRat service:
info <- startSewerRat()

# Mocking up a directory of stuff to query.
mydir <- tempfile()
dir.create(mydir)
write(file=file.path(mydir, "metadata.json"), '{ "first": "Aaron", "last": "Lun" }')
dir.create(file.path(mydir, "diet"))
write(file=file.path(mydir, "diet", "metadata.json"), 
   '{ "meal": "lunch", "ingredients": "water" }')

# Registering it:
register(mydir, "metadata.json", url=info$url)

# List the registered directories:
listRegisteredDirectories(url=info$url)
#> [[1]]
#> [[1]]$path
#> [1] "/tmp/RtmpJDU5Vu/file2175ada61e7"
#> 
#> [[1]]$user
#> [1] "root"
#> 
#> [[1]]$time
#> [1] 1727971508
#> 
#> [[1]]$names
#> [[1]]$names[[1]]
#> [1] "metadata.json"
#> 
#> 
#> 
#> [[2]]
#> [[2]]$path
#> [1] "/tmp/RtmpJDU5Vu/file21710624f4c"
#> 
#> [[2]]$user
#> [1] "root"
#> 
#> [[2]]$time
#> [1] 1727971508
#> 
#> [[2]]$names
#> [[2]]$names[[1]]
#> [1] "metadata.json"
#> 
#> 
#> 
listRegisteredDirectories(url=info$url, user=TRUE)
#> [[1]]
#> [[1]]$path
#> [1] "/tmp/RtmpJDU5Vu/file2175ada61e7"
#> 
#> [[1]]$user
#> [1] "root"
#> 
#> [[1]]$time
#> [1] 1727971508
#> 
#> [[1]]$names
#> [[1]]$names[[1]]
#> [1] "metadata.json"
#> 
#> 
#> 
#> [[2]]
#> [[2]]$path
#> [1] "/tmp/RtmpJDU5Vu/file21710624f4c"
#> 
#> [[2]]$user
#> [1] "root"
#> 
#> [[2]]$time
#> [1] 1727971508
#> 
#> [[2]]$names
#> [[2]]$names[[1]]
#> [1] "metadata.json"
#> 
#> 
#>