Learn R Programming

galah (version 2.2.0)

collapse.data_request: Generate a query

Description

Constructs a query so it can be inspected before being sent. collapse() can be called at the end of a pipe that begins with galah_call() to return the constructed user query generated by the user's data request (a query object). Objects of class data_request (created using request_data()), metadata_request (from request_metadata()) or files_request (from request_files()) are all supported.

Usage

# S3 method for data_request
collapse(x, ...)

# S3 method for metadata_request collapse(x, ...)

# S3 method for files_request collapse(x, ...)

# S3 method for prequery collapse(x, ...)

# S3 method for query collapse(x, ...)

# S3 method for query_set collapse(x, ...)

Value

An object of class query, which is a list-like object containing two or more of the following slots:

  • type: The type of query, serves as a lookup to the corresponding field in show_all(apis)

  • url: Either:

    • a length-1 character giving the API to be queried; or

    • a tibble containing at least the field url and optionally others

  • headers: headers to be sent with the API call

  • body: body section of the API call

  • options: options section of the API call

  • request: captures the supplied _request object (see galah_call())

Arguments

x

An object to run collapse() on. Classes supported by galah include data_request, metadata_request and files_request for building queries; and prequery, query or query_set once constructed (via capture() or compound()).

...

Arguments passed on to capture().

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()

collapse() constructs a complete user query, ready to be sent by compute(). Information required to construct a complete user query are provided by capture() and compound(), preceding functions to parse and combine all required API calls necessary to build a user's query.

See Also

To open a piped query, see galah_call(). For alternative operations on _request objects, see capture(), compound(), compute() or collect().