Breezex.People (breezex v0.1.0) View Source

Module implementing the Breeze people API.

Link to this section Summary

Functions

Add a person to Breeze.

Delete a person by ID

Returns all names and IDs in Breeze

Returns a list of people, paginated based on options, and filtered based on filter.

List all profile fields that have been configured in Breeze.

Show a person by ID

Update a person.

Link to this section Functions

Link to this function

add(config, first, last, params \\ %{})

View Source

Specs

Add a person to Breeze.

First and last names are required. Other fields can be included in a map where field IDs are keys.

Link to this function

add!(config, first, last, params \\ %{})

View Source

Specs

add!(map(), String.t(), String.t(), map() | nil) ::
  {map(), list()} | no_return()

Specs

Delete a person by ID

Specs

delete!(map(), String.t()) :: {map(), list()} | no_return()

Specs

Returns all names and IDs in Breeze

Link to this function

list(config, options, filter)

View Source

Specs

Returns a list of people, paginated based on options, and filtered based on filter.

Options is a map of shape

%{
  details: 1,
  limit: 50,
  offset: 0
}
When details is 1 (default), just get names. When 0, get all data (slower).
Limit and offset are for pagination. Both default to 0. With no limit or 0, all people are returned.

Filter is a map. The keys are profile field IDs. The values are the values to search for.

Specs

list!(map()) :: {map(), list()} | no_return()
Link to this function

list!(config, options, params)

View Source

Specs

list!(map(), map(), map()) :: {map(), list()} | no_return()
Link to this function

list_profile_fields(config)

View Source

Specs

list_profile_fields(map()) :: Breezex.Client.client_response()

List all profile fields that have been configured in Breeze.

The most useful thing in the output is going to be the field_id (since it's used in querying and updating people) and name. With those two, you can find a field and query on it.

Link to this function

list_profile_fields!(config)

View Source

Specs

list_profile_fields!(map()) :: {map(), list()} | no_return()

Specs

show(Breezex.Map, any()) :: {:error, map()} | {:ok, map(), [any()]}

Show a person by ID

Specs

show!(Breezex.Map, any()) :: {any(), any()}
Link to this function

update(config, id, params)

View Source

Specs

update(Breezex.Map, any(), list()) :: {:error, map()} | {:ok, map(), [any()]}

Update a person.

The person's ID is required. For the params, pass in a list of structs. Most structs should have the shape %{field_id: field_id, field_type: field_type, response: new_value}. All values are strings.

Field type options are:

  • text
  • radio -- used for both multiple choice and dropdown
  • checkbox
  • date -- formatted MM/DD/YYYY
  • textarea
  • birthdate -- format MM/DD/YYYY *

Special structs: Email:

%{
  field_id: "",
  field_type: "email",
  response: true,
  details: %{address: ""}
}

Phones:

%{
  field_id: "",
  field_type: "phone",
  response: true,
  details: %{phone_mobile: ""} # or `phone_home` or `phone_work`
}

Address:

%{
  field_id: "",
  field_type: "address",
  response: true,
  details: %{
    street_addres: "",
    city: "",
    state: "", # 2-letter abbreviation
    zip: ""
  }
}

Family role:

%{
  field_id: "",
  field_type: "family_role",
  response: undefined,
  details: [
    person_id: 123,
    role_id: 1
  ]
}

Note: role_id is numeric and can be 1 (Unassigned), 2 (Child), 3 (Adult), 4 (Head of Household), or 5 (Spouse)

Link to this function

update!(config, id, params)

View Source

Specs

update!(map(), String.t(), list()) :: {map(), list()} | no_return()