Package 'legistarapi'

Title: Access the Legistar Web API
Description: Access public data using the Legistar Web API.
Authors: Eli Pousson [aut, cre, cph]
Maintainer: Eli Pousson <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-10-18 03:29:22 UTC
Source: https://github.com/elipousson/legistarapi

Help Index


Get actions from a Legistar site

Description

legis_get_actions() lists actions and legis_get_action() gets a single action by ID.

Usage

legis_get_actions(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

legis_get_action(
  id,
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

id

Action ID. Required for legis_get_action().


Get bodies from a Legistar site

Description

legis_get_bodies() lists actions and legis_get_body() gets a single body by ID.

Usage

legis_get_bodies(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

legis_get_body(
  body_id,
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

body_id

Body ID. Required for legis_get_body().


Get body types from a Legistar site

Description

Get body types from a Legistar site

Usage

legis_get_body_types(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

legis_get_body_type(
  body_type_id,
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

body_type_id

Body type ID. Required for legis_get_body_type().


Get code sections from a Legistar site

Description

Get code sections from a Legistar site

Usage

legis_get_code_sections(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

legis_get_code_section(
  code_section_id,
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

code_section_id

Code section ID. Required for legis_get_code_section().


Get events from a Legistar site

Description

legis_get_event() also requires event_items, agenda_note, minutes_note, and event_item_attachments parameters. These likely should be optional so the function should be considered non-functional at present.

Usage

legis_get_events(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

legis_get_event(
  event_id,
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

event_id

Event ID. Required for legis_get_event().


Get indexes from a Legistar site

Description

Get indexes from a Legistar site

Usage

legis_get_indexes(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get matter indexes from a Legistar site

Description

Get matter indexes from a Legistar site

Usage

legis_get_matter_indexes(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get matter requesters from a Legistar site

Description

Get matter requesters from a Legistar site

Usage

legis_get_matter_requesters(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get matter statuses from a Legistar site

Description

Get matter statuses from a Legistar site

Usage

legis_get_matter_statuses(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get matter types from a Legistar site

Description

Get matter types from a Legistar site

Usage

legis_get_matter_types(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get matters from a Legistar site

Description

Get matters from a Legistar site

Usage

legis_get_matters(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get office records from a Legistar site

Description

Get office records from a Legistar site

Usage

legis_get_office_records(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Get persons from a Legistar site

Description

See Adding a New Person for more information on persons in Legistar.

Usage

legis_get_persons(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

legis_get_person(
  person_id,
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

person_id

Person ID. Required for legis_get_person().


Get vote types from a Legistar site

Description

Get vote types from a Legistar site

Usage

legis_get_vote_types(
  ...,
  client = getOption("legistarapi.client"),
  simplifyVector = TRUE,
  error_call = caller_env()
)

Arguments

...

Arguments passed on to legistar

top,skip,select,filter,orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count,inlinecount

Currently unsupported.

n_max

Maximum number of records to return. Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


Access data from the Legistar Web API

Description

Review the Legistar Web API documentation for more information. This function is a work in progress. As of May 2024, it returns all results for any query calling itself recursively.

Usage

legistar(
  ...,
  template = "actions",
  client = getOption("legistarapi.client"),
  top = NULL,
  skip = NULL,
  select = NULL,
  filter = NULL,
  orderby = NULL,
  direction = NULL,
  count = NULL,
  inlinecount = NULL,
  .multi = "pipe",
  simplifyVector = TRUE,
  n_max = NULL,
  error_call = caller_env()
)

Arguments

...

Template variables.

template

A template string which consists of a optional HTTP method and a path containing variables labelled like either ⁠:foo⁠ or {foo}.

client

String with Legistar client name. Defaults to getOption("legistarapi.client").

top, skip, select, filter, orderby

Passed to internal req_odata_query() function.

direction

Default NULL. Use "asc" for ascending or "desc" for descending sort order based on orderby argument. Ignored if orderby is not supplied.

count, inlinecount

Currently unsupported.

.multi

Controls what happens when an element of ... is a vector containing multiple values:

  • "error", the default, throws an error.

  • "comma", separates values with a ⁠,⁠, e.g. ⁠?x=1,2⁠.

  • "pipe", separates values with a |, e.g. ?x=1|2.

  • "explode", turns each element into its own parameter, e.g. ?x=1&x=2.

If none of these functions work, you can alternatively supply a function that takes a character vector and returns a string.

simplifyVector

Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors?

n_max

Maximum number of records to return. Currently unsupported.

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

See Also

legistar_template()

Examples

legistar(template = "persons", client = "seattle", top = 5)

legistar(template = "bodies", client = "baltimore", top = 5)

Legistar Client Reference

Description

A data frame of identified Legistar client sites tested to check if client responded to an API request with legis_get_bodies(). Last updated 2024-05-12.

Usage

legistar_clients

Format

A data frame with 286 rows and 2 variables:

client

Client string

api

logical If TRUE, client returned an API response


Legistar API Methods Reference

Description

A data frame with reference information from the Legistar Web API documentation: https://webapi.legistar.com/. Organized in a Google Sheet for use with this package: https://docs.google.com/spreadsheets/d/1Py-Oqyb8kW13x0_BjGJS-fw1EdZzqBeIsjxvQvBV5dM/edit?usp=sharing Last updated 2024-05-12.

Usage

legistar_methods

Format

A data frame with 124 rows and 8 variables:

type

API method type

method

HTTP Request Method

template

Template string

url

Help URL

description

API method description

response

Expected API method response

modelName

Corresponding modelName for response

nm

Snake case method name

Source

https://webapi.legistar.com/