ExAirtable.Airtable.List (ExAirtable v0.2.8) View Source

Struct for an Airtable List of Records.

This should directly match results being sent/returned from the Airtable REST API.

Link to this section Summary

Functions

Filter the records in a list by a given function.

Find all records in a list that are related on a given field matching a given ID

Convert a typical Airtable JSON response into an %ExAirtable.Airtable.List{}.

Link to this section Types

Specs

t() :: %ExAirtable.Airtable.List{
  offset: String.t(),
  records: [ExAirtable.Airtable.Record.t()]
}

Link to this section Functions

Link to this function

filter_records(list, fun)

View Source

Filter the records in a list by a given function.

Returns an array of %ExAirtable.Airtable.Record{} structs.

See Enum.filter for more examples.

Link to this function

filter_relations(list, field, id)

View Source

Find all records in a list that are related on a given field matching a given ID

Examples

iex> filter_relations(list, "Users", "rec1234")
[%Record{fields: %{"Users" => ["rec1234", "rec456"]}}, ...]

iex> filter_relations(list, "Users", "invalid_id")
[]

Convert a typical Airtable JSON response into an %ExAirtable.Airtable.List{}.

Any weird response will return an empty list.