-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add / change folders #121
Milestone
Comments
Add updateResource() using https://www.activityinfo.org/support/docs/api/reference/updateDatabase.html and providing resourceUpdates with the resource to change. See folder example. |
here's an example I created for my own usage, if it might help: create_folder_activityinfo <- function(folderId = NULL, folderLabel, databaseId, locationId = NULL) {
## if folderId isn't specified, create a folder
if (is.null(folderId)) {
## create new folder
request <- databaseUpdates()
request$resourceUpdates <- list(list(
id = cuid(), ## generate new folder using random new CUID
parentId = databaseId, ## create it at first level of db
type = "FOLDER",
label = folderLabel)
)
result <- activityinfo:::postResource(
sprintf("databases/%s", databaseId),
request,
task = sprintf("Requesting to create folder '%s' with id %s from database %s", folderLabel, folderId, databaseId)
)
} else {
if (is.null(locationId)) stop("Please input a new location ID (folder ID or database ID)")
## move existing folder cwsp8ywlo79hmox3 to another location within db
request <- databaseUpdates()
request$resourceUpdates <- list(list(
id = folderId, ## id of existing folder
parentId = locationId, ## move to NEW location: another folder or back to top database
type = "FOLDER")
)
result <- postResource(
sprintf("databases/%s", databaseId),
request,
task = sprintf("Requesting to move folder '%s' with id %s from database %s", folderLabel, folderId, databaseId)
)
}
} |
Will add a function to the package and add this to the tutorial on how to add and manipulate forms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At the moment, there are no functions in the package to add or change folders. Should we consider this in a future release?
The text was updated successfully, but these errors were encountered: