The first step in evaluating a request is to capture and parse the
information it contains. The resulting object has class prequery
for those requiring further processing or query for those that don't.
A prequery object shows the basic structure of what has been requested by
a user in a given galah_call().
Usage
capture(x, ...)
# S3 method for class 'data_request'
capture(x, mint_doi = FALSE, ...)
# S3 method for class 'metadata_request'
capture(x, ...)
# S3 method for class 'files_request'
capture(x, thumbnail = FALSE, ...)
# S3 method for class 'list'
capture(x, ...)Arguments
- x
A
_requestobject to convert to aprequery.- ...
Other arguments, currently ignored
- mint_doi
Logical: should a DOI be minted for this download? Only applies to
type = "occurrences"when atlas chosen is "ALA".- thumbnail
Logical: should thumbnail-size images be returned? Defaults to
FALSE, indicating full-size images are required.
Value
Either an object of class prequery when further processing is
required; or query when it is not. Both classes are structurally identical,
being list-like and containing at the following slots:
type: The type of query, serves as a lookup to the corresponding field inshow_all(apis)url: Either:a length-1 character giving the API to be queried; or
a
tibble()containing at least the fieldurland optionally others
request: captures the preceeding_requestobject (seegalah_call())
Details
galah uses an object-based pipeline to convert piped requests into
valid queries, and to enact those queries with the specified organisation.
Typically, requests open with galah_call() - though request_metadata()
and request_files() are also valid - and end with
collect(). Under the hood,
the sequence of functions is as follows:
capture() → compound() →
collapse() →
compute() →
collect()
capture() is the first of the galah_call() workflow, and it parses the
basic structure of a user request, returned as a prequery object.
A prequery object shows what has been requested, before those
calls are built by compound() and evaluated by
collapse().
For simple cases, this gives the same result as running
collapse() while the run_checks
argument of galah_config() is set to FALSE, but is slightly faster.
In complex cases, it is simply a precursor to compound().
See also
To open a piped query, see galah_call(). For alternative
operations on _request objects, see compound(),
collapse(),
compute() or
collect().
