Polyjuice Client v0.4.4 Polyjuice.Client.Filter View Source
Build filters.
https://matrix.org/docs/spec/client_server/r0.5.0#filtering
The functions in this module can be chained to create more complex filters.
Examples:
iex> Polyjuice.Client.Filter.include_state_types(["m.room.member"])
...> |> Polyjuice.Client.Filter.limit_timeline_events(10)
...> |> Polyjuice.Client.Filter.lazy_loading()
%{
"room" => %{
"state" => %{
"types" => ["m.room.member"],
"lazy_load_members" => true
},
"timeline" => %{
"lazy_load_members" => true,
"limit" => 10
}
}
}
Link to this section Summary
Functions
Update the ephemeral filter using a function.
Don't allow certain types of ephemeral room events.
Don't allow certain types of presence events.
Don't allow certain types of state events.
Don't allow certain types of timeline events.
Allow certain types of ephemeral room events to be included.
Allow certain types of presence events to be included.
Allow certain types of state events to be included.
Allow certain types of timeline events to be included.
Set the maximum number of timeline events.
Update the presence filter using a function.
Set the value in a filter.
Update the state filter using a function.
Update the timeline filter using a function.
Update the value in a filter.
Link to this section Functions
Update the ephemeral filter using a function.
Don't allow certain types of ephemeral room events.
Don't allow certain types of presence events.
Don't allow certain types of state events.
Don't allow certain types of timeline events.
Allow certain types of ephemeral room events to be included.
Allow certain types of presence events to be included.
Allow certain types of state events to be included.
Allow certain types of timeline events to be included.
Set the maximum number of timeline events.
Update the presence filter using a function.
Set the value in a filter.
The key_path
is a list of keys to traverse to find the element to update.
The initial
and func
arguments are like the corresponding arguments to
Map.update
.
iex> Polyjuice.Client.Filter.put(
...> %{
...> "presence" => %{
...> "not_senders" => ["@alice:example.com"]
...> }
...> },
...> ["presence", "not_senders"],
...> ["@bob:example.com"]
...> )
%{
"presence" => %{
"not_senders" => ["@bob:example.com"]
}
}
Update the state filter using a function.
Update the timeline filter using a function.
Update the value in a filter.
The key_path
is a list of keys to traverse to find the element to update.
The initial
and func
arguments are like the corresponding arguments to
Map.update
.
Examples:
iex> Polyjuice.Client.Filter.update(
...> %{
...> "presence" => %{
...> "not_senders" => ["@alice:example.com"]
...> }
...> },
...> ["presence", "not_senders"],
...> ["@bob:example.com"],
...> &Enum.concat(&1, ["@bob:example.com"])
...> )
%{
"presence" => %{
"not_senders" => ["@alice:example.com", "@bob:example.com"]
}
}
iex> Polyjuice.Client.Filter.update(
...> %{
...> "presence" => %{
...> "not_senders" => ["@alice:example.com"]
...> }
...> },
...> ["presence", "senders"],
...> ["@bob:example.com"],
...> &Enum.concat(&1, ["@bob:example.com"])
...> )
%{
"presence" => %{
"not_senders" => ["@alice:example.com"],
"senders" => ["@bob:example.com"]
}
}