-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflywire_fetch.Rd
80 lines (70 loc) · 2.82 KB
/
flywire_fetch.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flywire-fetch.R
\name{flywire_fetch}
\alias{flywire_fetch}
\title{GET/POST from flywire (graphene) servers with appropriate authorisation token}
\usage{
flywire_fetch(
url,
body = NULL,
config = NULL,
token = NULL,
return = c("parsed", "text", "response"),
cache = FALSE,
retry = 0L,
include_headers = FALSE,
simplifyVector = TRUE,
...
)
}
\arguments{
\item{url}{Full URL for brainmaps API endpoint}
\item{body}{an R list with parameters that will be converted with
\code{jsonlite::\link{toJSON}} and then passed on to \code{\link{POST}}.
You can also pass a \code{JSON} character vector to have more control of
the \code{JSON} encoding.}
\item{config}{(optional) curl options, see \code{httr::\link[httr]{config}}
for details.}
\item{token}{Optional chunkedgraph token (otherwise the default one for the
current segmentation will be used). Use \code{NA} to suppress use of a
token.}
\item{return}{One of "parsed", "text" (for raw JSON), or "response"}
\item{cache}{Whether or not to cache responses (default \code{FALSE})}
\item{retry}{The number of times to retry the operation (default 0,
\code{FALSE}=>\code{0} and \code{TRUE}=>3). See the documentation of the
\code{times} argument of \code{httr::\link{RETRY}} for further details.}
\item{include_headers}{Whether to include basic headers from the http request
as attributes on the parsed JSON object (default \code{TRUE}) when
\code{parse.json=TRUE}.}
\item{simplifyVector}{Whether to use \code{jsonlite::simplifyVector}}
\item{...}{additional arguments passed to the \code{httr::{RETRY}} function.
This may include a \code{\link[httr]{config}} list other named parameters
etc.}
}
\value{
Either an R object based on parsing returned JSON, a character vector
containing the raw JSON or a \code{httr::\link[httr]{response}} object,
depending on the value of \code{return}.
}
\description{
GET/POST from flywire (graphene) servers with appropriate authorisation token
}
\section{authorisation}{
Your authorisation will be based on a chunked graph
token normally stored at
\code{~/.cloudvolume/secrets/cave-secret.json}. See
\url{https://github.com/seung-lab/cloud-volume#cave-secretjson} for
the format. You will need to generate the token as advised by the FlyWire
team. Search or ask for help \code{#help_software} in the FlyWire slack if
you can't find the information. For more details see article on
\href{http://natverse.org/fafbseg/articles/articles/accessing-graphene-server.html}{accessing-graphene-server}.
}
\examples{
\donttest{
# convert a flywire state URL into a parsed neuroglancer scene information
# but see also flywire_expandurl
json=flywire_fetch("https://globalv1.flywire-daf.com/nglstate/5747205470158848",
return="text")
ngl_segments(ngl_decode_scene(json), as_character = TRUE)
}
}