Commit 4430273b authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

rm write_disk

parent f39957f5
......@@ -8,5 +8,4 @@ export(endpoints_package)
export(endpoints_session)
export(resp_content)
export(resp_status)
export(resp_write_disk)
export(session_key)
......@@ -48,19 +48,3 @@ resp_status <- function(x){
res <- x$status_code
return(res)
}
#' resp_write_disk
#' resp_write_disk
#' @param path path
#' @param overwrite overwrite
#' @keywords alapu
#' @export
#' @examples
#' \dontrun{
#' resp_write_disk()
#' }
resp_write_disk <- function(path, overwrite){
res <- httr::write_disk(path=path, overwrite = overwrite)
return(res)
}
......@@ -33,6 +33,7 @@ alapu_post <- function(api,pkgname=NULL,key=NULL,epoint=NULL,object=NULL,format=
#' @param object object
#' @param format format
#' @param filename filename
#' @param res_path res_path
#' @param ... options for get
#' @keywords alapu
#' @export
......@@ -40,10 +41,15 @@ alapu_post <- function(api,pkgname=NULL,key=NULL,epoint=NULL,object=NULL,format=
#' \dontrun{
#' alapu_get()
#' }
alapu_get <- function(api,pkgname=NULL,key=NULL,epoint=NULL,object=NULL,format=NULL,filename=NULL,...){
alapu_get <- function(api,pkgname=NULL,key=NULL,epoint=NULL,object=NULL,format=NULL,filename=NULL,res_path=NULL,...){
url <- endpoints_alapu(api=api,pkgname=pkgname,key=key,epoint=epoint,object=object,format=format,filename=filename)
res <- httr::GET(url,...)
if (is.null(res_path)) {
res <- httr::GET(url,...)
} else if (!is.null(res_path)) {
res <- httr::GET(url, httr::write_disk(path=res_path, overwrite = FALSE),...)
} else stop("res_path not recognized")
class(res) <- c("alapu_get_res",class(res))
return(res)
}
......@@ -6,7 +6,7 @@
alapu_get}
\usage{
alapu_get(api, pkgname = NULL, key = NULL, epoint = NULL, object = NULL,
format = NULL, filename = NULL, ...)
format = NULL, filename = NULL, res_path = NULL, ...)
}
\arguments{
\item{api}{api endpoint}
......@@ -23,6 +23,8 @@ alapu_get(api, pkgname = NULL, key = NULL, epoint = NULL, object = NULL,
\item{filename}{filename}
\item{res_path}{res_path}
\item{...}{options for get}
}
\description{
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{resp_write_disk}
\alias{resp_write_disk}
\title{resp_write_disk
resp_write_disk}
\usage{
resp_write_disk(path, overwrite)
}
\arguments{
\item{path}{path}
\item{overwrite}{overwrite}
}
\description{
resp_write_disk
resp_write_disk
}
\examples{
\dontrun{
resp_write_disk()
}
}
\keyword{alapu}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment