diff --git a/NAMESPACE b/NAMESPACE index 3c63ade..942303f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/lineage.R b/R/lineage.R new file mode 100644 index 0000000..2e2ac94 --- /dev/null +++ b/R/lineage.R @@ -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)) +} diff --git a/man/request_lineage.Rd b/man/request_lineage.Rd new file mode 100644 index 0000000..d09170a --- /dev/null +++ b/man/request_lineage.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/lineage.R +\name{request_lineage} +\alias{request_lineage} +\title{Sends a \href{https://github.com/flowr-analysis/flowr/wiki/Interface#the-lineage-request}{"request-lineage"} request} +\usage{ +request_lineage(con, filetoken, criterion, id = get_new_id()) +} +\arguments{ +\item{con}{The connection to the server} + +\item{filetoken}{The filetoken retrieved by a previous "file-analysis" +request} + +\item{criterion}{The criterion pointing to the object whose lineage should be +determined} + +\item{id}{The id of the request} +} +\value{ +A list containing the id and the response +} +\description{ +Sends a \href{https://github.com/flowr-analysis/flowr/wiki/Interface#the-lineage-request}{"request-lineage"} request +} +\seealso{ +\code{\link[=request_file_analysis]{request_file_analysis()}} + +\code{\link[=connect]{connect()}} +}