Smee.Filter (Smee v0.6.0)

Copy Markdown View Source

Process a stream of entities to include or exclude entity structs matching the specified criteria.

These functions are intended to be used with streams but should also work with simple lists too - but using lists to process larger metadata files is strongly discouraged.

By default these functions include matching entities and exclude those that do not match, but this an be reversed. By default Smee.Filter.idp/2 will exclude entities that are no IdPs. But by specifying false as the third parameter the filter will be inverted and exclude entities that have an IdP role.

Summary

Functions

Filters a stream of entities to include or exclude those that have the specified assurance profile certification URI.

Filters a stream of entities to include or exclude those that were registered within the specified number of days.

Filters a stream of entities to include or exclude those that have the specified entity category URI.

Filters a stream of entities to include or exclude those that have the specified entity category support URI.

Filters a stream of entities to include or exclude those that were registered within the last 7 days.

Filters a stream of entities to include or exclude those that have an IdP role.

Filters a stream of entities to include or exclude those that were registered after the specified date.

Filters a stream of entities to include or exclude those that were registered before the specified date.

Filters a stream of entities to include or exclude those that were registered at a particular federation, using the specified URI.

Filters a stream of entities to include or exclude those that have an SP role.

Filters a stream of entities to include or exclude those that have the specified tag.

Filters a stream of entities to include or exclude those that have a trustiness equal or less than the specified number.

Filters a stream of entities to include or exclude those that have one of the specified IDs.

Functions

assurance(enum, certification, bool \\ true)

@spec assurance(enum :: Enumerable.t(), certification :: binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that have the specified assurance profile certification URI.

The filter is positive by default but can be inverted by specifying false

days(enum, days, bool \\ true)

@spec days(enum :: Enumerable.t(), days :: integer(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that were registered within the specified number of days.

Entities without a date will be included in the inverted results.

The filter is positive by default but can be inverted by specifying false

entity_category(enum, category, bool \\ true)

@spec entity_category(enum :: Enumerable.t(), category :: binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that have the specified entity category URI.

The filter is positive by default but can be inverted by specifying false

entity_category_support(enum, category, bool \\ true)

@spec entity_category_support(
  enum :: Enumerable.t(),
  category :: binary(),
  bool :: boolean()
) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that have the specified entity category support URI.

The filter is positive by default but can be inverted by specifying false

fresh(enum, bool \\ true)

@spec fresh(enum :: Enumerable.t(), bool :: boolean()) :: Enumerable.t()

Filters a stream of entities to include or exclude those that were registered within the last 7 days.

Entities without a date will be included in the inverted results.

The filter is positive by default but can be inverted by specifying false

idp(enum, bool \\ true)

@spec idp(enum :: Enumerable.t(), bool :: boolean()) :: Enumerable.t()

Filters a stream of entities to include or exclude those that have an IdP role.

The filter is positive by default but can be inverted by specifying false

registered_after(enum, date, bool \\ true)

@spec registered_after(
  enum :: Enumerable.t(),
  date :: Date.t() | binary(),
  bool :: boolean()
) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that were registered after the specified date.

Dates can be Date structs or binary strings in the format "YYYY-MM-DD"

Entities without a date will be included in the inverted results.

The filter is positive by default but can be inverted by specifying false

registered_before(enum, date, bool \\ true)

@spec registered_before(
  enum :: Enumerable.t(),
  date :: Date.t() | binary(),
  bool :: boolean()
) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that were registered before the specified date.

Dates can be Date structs or binary strings in the format "YYYY-MM-DD"

Entities without a date will be included in the inverted results.

The filter is positive by default but can be inverted by specifying false

registered_by(enum, registrar, bool \\ true)

@spec registered_by(enum :: Enumerable.t(), registrar :: binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that were registered at a particular federation, using the specified URI.

The filter is positive by default but can be inverted by specifying false

sp(enum, bool \\ true)

@spec sp(enum :: Enumerable.t(), bool :: boolean()) :: Enumerable.t()

Filters a stream of entities to include or exclude those that have an SP role.

The filter is positive by default but can be inverted by specifying false

tag(enum, tag, bool \\ true)

@spec tag(enum :: Enumerable.t(), tag :: binary() | atom(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that have the specified tag.

It's best to provide the tag as a string.

The filter is positive by default but can be inverted by specifying false

trustiness(enum, trustiness \\ 0.7, bool \\ true)

@spec trustiness(enum :: Enumerable.t(), trustiness :: float(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that have a trustiness equal or less than the specified number.

Trustiness values are between 0.0 and 0.9.

The filter is positive by default but can be inverted by specifying false

uri(enum, uris, bool \\ true)

@spec uri(enum :: Enumerable.t(), uris :: list() | binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of entities to include or exclude those that have one of the specified IDs.

The filter is positive by default but can be inverted by specifying false