pushover_api: Issue a command using the Pushover API

Description Usage Arguments Value Examples

View source: R/pushover_api.R

Description

pushover_api() allows commands to be issued using the Pushover API. This is a generic function that is meant to be used by higher level functions. In most instances, more specific functions should be used (e.g., pushover()).

Usage

1

Arguments

verb

Name of verb to use.

url

the url of the page to retrieve

...

Arguments passed on to httr::VERB

config

Additional configuration settings such as http authentication (authenticate()), additional headers (add_headers()), cookies (set_cookies()) etc. See config() for full details and list of helpers.

body

One of the following:

  • FALSE: No body. This is typically not used with POST, PUT, or PATCH, but can be useful if you need to send a bodyless request (like GET) with VERB().

  • NULL: An empty body

  • "": A length 0 body

  • upload_file("path/"): The contents of a file. The mime type will be guessed from the extension, or can be supplied explicitly as the second argument to upload_file()

  • A character or raw vector: sent as is in body. Use content_type() to tell the server what sort of data you are sending.

  • A named list: See details for encode.

encode

If the body is a named list, how should it be encoded? Can be one of form (application/x-www-form-urlencoded), multipart, (multipart/form-data), or json (application/json).

For "multipart", list elements can be strings or objects created by upload_file(). For "form", elements are coerced to strings and escaped, use I() to prevent double-escaping. For "json", parameters are automatically "unboxed" (i.e. length 1 vectors are converted to scalars). To preserve a length 1 vector as a vector, wrap in I(). For "raw", either a character or raw vector. You'll need to make sure to set the content_type() yourself.

handle

The handle to use with this request. If not supplied, will be retrieved and reused from the handle_pool() based on the scheme, hostname and port of the url. By default httr requests to the same scheme/host/port combo. This substantially reduces connection time, and ensures that cookies are maintained over multiple requests to the same host. See handle_pool() for more details.

Value

a list containing the following fields and any other fields related to the specific API call:

Examples

1
2
3
4
5
6
7
8
## Not run: 
pushover_api(
  verb = "GET",
  url = "https://api.pushover.net/1/sounds.json",
  query = list(token = "azGDORePK8gMaC0QOYAMyEEuzJnyUi")
)

## End(Not run)

pushoverr documentation built on Nov. 16, 2021, 9:17 a.m.