-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added function osf_ls_preprints to list all preprints associated with…
… a user (see https://developer.osf.io/#operation/users_preprints_list). Also added back-end function .osf_user_preprints to make the required API call
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#' List preprints from a specific user | ||
#' | ||
#' List the preprints that are associated with a specific user. | ||
#' Note that will return *all* preprints, unlike [osf_ls_nodes()]. | ||
#' | ||
#' @param x one of the following: | ||
#' * An [`osf_tbl_user`] with a single OSF user. | ||
#' @template filter-pattern | ||
#' @template n_max | ||
#' @template verbose | ||
#' | ||
#' @return An [`osf_tbl_node`] with one row for each OSF preprint | ||
#' ordered by modification time. | ||
#' @examples | ||
#' \dontrun{ | ||
#' # List your recent projects and components | ||
#' osf_retrieve_user("me") %>% | ||
#' osf_ls_preprints() | ||
#' } | ||
#' @seealso [`osf_ls_nodes()`] to generate a list of all project components. | ||
#' @export | ||
osf_ls_preprints <- | ||
function(x, | ||
pattern = NULL, | ||
n_max = 10, | ||
verbose = FALSE) { | ||
UseMethod("osf_ls_preprints") | ||
} | ||
|
||
#' @export | ||
osf_ls_preprints.osf_tbl_user <- | ||
function(x, | ||
pattern = NULL, | ||
n_max = 10, | ||
verbose = FALSE) { | ||
|
||
x <- make_single(x) | ||
|
||
out <- .osf_user_preprints( | ||
id = as_id(x), | ||
n_max = n_max, | ||
query = filter_nodes(pattern = pattern), | ||
verbose = verbose | ||
) | ||
|
||
raise_error(out) | ||
as_osf_tbl(out, "osf_tbl_node") | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.