Skip to content

Commit

Permalink
Merge pull request #21 from flowr-analysis/20-add-function-for-lineag…
Browse files Browse the repository at this point in the history
…e-request

Added wrapper for lineage request
  • Loading branch information
EagleoutIce authored Sep 1, 2024
2 parents 945ecd6 + a04f639 commit 7d8cbc7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(get_default_node_base_dir)
export(install_flowr)
export(install_node)
export(request_file_analysis)
export(request_lineage)
export(request_repl)
export(request_slice)
export(send_request)
Expand Down
29 changes: 29 additions & 0 deletions R/lineage.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#' Sends a ["request-lineage"](https://github.com/flowr-analysis/flowr/wiki/Interface#the-lineage-request) request
#'
#' @param con The connection to the server
#' @param filetoken The filetoken retrieved by a previous "file-analysis"
#' request
#' @param criterion The criterion pointing to the object whose lineage should be
#' determined
#' @param id The id of the request
#' @return A list containing the id and the response
#'
#' @seealso [request_file_analysis()]
#' @seealso [connect()]
#'
#' @export
request_lineage <- function(con, filetoken, criterion, id = get_new_id()) {
request <- list(
type = "request-lineage",
id = id,
filetoken = filetoken,
criterion = criterion
)
res <- send_request(con, request)

if (res$type == "error") {
return(list(error = res$reason))
}

return(list(id = id, res = res))
}
30 changes: 30 additions & 0 deletions man/request_lineage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7d8cbc7

Please sign in to comment.