diff --git a/404.html b/404.html index c27e39d..ae9ae32 100644 --- a/404.html +++ b/404.html @@ -21,7 +21,7 @@ nectar - 0.0.0.9003 + 0.0.0.9004 + + + + + +
+
+
+ +
+

Error messaging for this package.

+
+ +
+

Usage

+
.nectar_abort(
+  message,
+  error_class,
+  ...,
+  call = rlang::caller_env(),
+  .envir = rlang::caller_env()
+)
+
+ +
+

Arguments

+ + +
message
+

It is formatted via a call to cli_bullets().

+ + +
error_class
+

(length-1 character) A short string to identify the +error family.

+ + +
...
+

These dots are for future extensions and must be empty.

+ + +
call
+

(environment) The environment from which a function was called, +e.g. rlang::caller_env() (the default). The environment will be mentioned +in error messages as the source of the error. This argument is particularly +useful for functions that are intended to be called as utilities inside +other functions.

+ + +
.envir
+

Environment to evaluate the glue expressions in.

+ +
+
+

Value

+

An error condition with classes "nectar-condition", +"nectar-error", and "nectar-error-{error_class}".

+
+ +
+ + +
+ + + + + + + diff --git a/reference/dot-nectar_user_agent_append.html b/reference/dot-nectar_user_agent_append.html index 17555a9..753ca66 100644 --- a/reference/dot-nectar_user_agent_append.html +++ b/reference/dot-nectar_user_agent_append.html @@ -9,7 +9,7 @@ nectar - 0.0.0.9003 + 0.0.0.9004 + + + + + +
+
+
+ +
+

This helper function exists to find somewhat variable content types and +attempt to send them to the proper body parser.

+
+ +
+

Usage

+
.resp_body_auto_other(resp)
+
+ +
+

Arguments

+ + +
resp
+

(httr2_response) A single httr2::response() object (as +returned by httr2::req_perform()).

+ +
+
+

Value

+

The parsed response body.

+
+ +
+ + +
+ + + + + + + diff --git a/reference/dot-shared-params.html b/reference/dot-shared-params.html index 47dd2e6..4538343 100644 --- a/reference/dot-shared-params.html +++ b/reference/dot-shared-params.html @@ -7,7 +7,7 @@ nectar - 0.0.0.9003 + 0.0.0.9004 + + + + + +
+
+
+ +
+

Use the Content-Type header (extracted using httr2::resp_content_type()) +of a response to automatically choose and apply a body parser, such as +httr2::resp_body_json() or resp_body_csv().

+
+ +
+

Usage

+
resp_body_auto(resp)
+
+ +
+

Arguments

+ + +
resp
+

(httr2_response) A single httr2::response() object (as +returned by httr2::req_perform()).

+ +
+
+

Value

+

The parsed response body.

+
+ +
+ + +
+ + + + + + + diff --git a/reference/resp_body_csv.html b/reference/resp_body_csv.html new file mode 100644 index 0000000..a23e6ef --- /dev/null +++ b/reference/resp_body_csv.html @@ -0,0 +1,87 @@ + +Extract tabular data from response body — resp_body_csv • nectar + Skip to contents + + +
+
+
+ +
+

Extract tabular data in comma-separated or tab-separated format from a +response body.

+
+ +
+

Usage

+
resp_body_csv(resp, check_type = TRUE)
+
+resp_body_tsv(resp, check_type = TRUE)
+
+ +
+

Arguments

+ + +
resp
+

(httr2_response) A single httr2::response() object (as +returned by httr2::req_perform()).

+ + +
check_type
+

(length-1 logical) Whether to check that the response has +the expected content type. Set to FALSE if the response is not +specifically tagged as the proper type.

+ +
+
+

Value

+

The parsed response body as a data frame.

+
+ +
+ + +
+ + + + + + + diff --git a/reference/resp_body_separate.html b/reference/resp_body_separate.html new file mode 100644 index 0000000..b3a5437 --- /dev/null +++ b/reference/resp_body_separate.html @@ -0,0 +1,82 @@ + +Extract response body into list — resp_body_separate • nectar + Skip to contents + + +
+
+
+ +
+

Extract response body into list

+
+ +
+

Usage

+
resp_body_separate(resp, resp_body_fn = resp_body_auto)
+
+ +
+

Arguments

+ + +
resp
+

(httr2_response) A single httr2::response() object (as +returned by httr2::req_perform()).

+ + +
resp_body_fn
+

A function to extract the body of the response. Default: +resp_body_auto().

+ +
+
+

Value

+

The parsed response body wrapped in a list(). This is useful for +things like raw vectors that you wish to parse with httr2::resps_data().

+
+ +
+ + +
+ + + + + + + diff --git a/reference/resp_body_tsv.html b/reference/resp_body_tsv.html new file mode 100644 index 0000000..601f84e --- /dev/null +++ b/reference/resp_body_tsv.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/reference/resp_parse.html b/reference/resp_parse.html index 9d0aa31..9930916 100644 --- a/reference/resp_parse.html +++ b/reference/resp_parse.html @@ -1,15 +1,23 @@ -Parse one or more responses — resp_parse • nectar +Parse one or more responses — resp_parse • nectar Skip to contents @@ -17,7 +25,7 @@ nectar - 0.0.0.9003 + 0.0.0.9004 + + + + + +
+
+
+ +
+

API responses generally follow a structured format. Use this function to +extract the relevant portion of a response, and wrangle it into a desired +format. This function is most useful when the response was fetched with a +request that includes a tidying policy (more information about this coming +soon).

+
+ +
+

Usage

+
resp_tidy(resps)
+
+ +
+

Arguments

+ + +
resps
+

(httr2_response, nectar_responses, or list) A single +httr2::response() object (as returned by httr2::req_perform()) or a +list of such objects (as returned by req_perform_opinionated() or +httr2::req_perform_iterative()).

+ +
+
+

Value

+

The extracted and cleaned response, or, for a list of responses, +those responses cleaned then concatenated via httr2::resps_data(). By +default, the response is processed with resp_body_auto().

+
+
+

See also

+

resp_tidy_json() for an opinionated response parser for JSON +responses, resp_body_auto() (etc) for a family of response parsers that +attempts to automatically select the appropriate parser based on the +response content type, httr2::resp_body_raw() (etc) for the underlying +httr2 response parsers, and resp_parse() for an alternative approach to +dealing with responses (particularly useful if the request does not include +a resp_tidy policy).

+
+ +
+ + +
+ + + + + + + diff --git a/reference/resp_tidy_json.html b/reference/resp_tidy_json.html new file mode 100644 index 0000000..a4f2e09 --- /dev/null +++ b/reference/resp_tidy_json.html @@ -0,0 +1,100 @@ + +Title — resp_tidy_json • nectar + Skip to contents + + +
+
+
+ +
+

Title

+
+ +
+

Usage

+
resp_tidy_json(resp, spec = NULL, unspecified = "list", subset_path = NULL)
+
+ +
+

Arguments

+ + +
resp
+

(httr2_response) A single httr2::response() object (as +returned by httr2::req_perform()).

+ + +
spec
+

(tspec or NULL) A specification used by +tibblify::tibblify() to parse the extracted body of resp. When spec +is NULL (the default), tibblify::tibblify() will attempt to guess a +spec.

+ + +
unspecified
+

(length-1 character) A string that describes what +happens if the extracted body of resp contains fields that are not +specified in spec. While tibblify::tibblify() defaults to NULL for +this value, we set it to list so that the body will still parse when +resp contains extra data without throwing errors.

+ + +
subset_path
+

(character) An optional vector indicating the path to +the "real" object within the body of resp. For example, many APIs return +a body with information about the status of the response, cache +information, perhaps pagination information, and then the actual data in a +field such as data. If the desired part of the response body is in +data$objects, the value of this argument should be c("data", "object").

+ +
+
+

Value

+

The tibblified response body.

+
+ +
+ + +
+ + + + + + + diff --git a/reference/stabilize_string.html b/reference/stabilize_string.html index 51be888..46b0edd 100644 --- a/reference/stabilize_string.html +++ b/reference/stabilize_string.html @@ -15,7 +15,7 @@ nectar - 0.0.0.9003 + 0.0.0.9004