Streamex v0.3.0 Streamex.Activity
The module Streamex.Activity
contains logic to wrap
raw API results into Streamex.Activity
structs.
Methods in the module Streamex.Activities
must be called
with Maps
, but will return Streamex.Activity
structs.
GetStream activities submitted to the API must always contain the following fields:
actor
- the actor performing the activityverb
- the verb of the activityobject
- the object of the activity
A number of other fields are normally present in GetStream
responses and those are mapped to fields in Streamex.Activity
structs.
Any other custom attributes may be present when submitting
new activities; custom attributes will be set as keys
of an activity’s custom_field
Map
.
Examples
Valid activity:
%{"actor" => "Tony", "verb" => "like", "object" => "Elixir"}
Valid activity with custom field:
%{"actor" => "Tony", "verb" => "like", "object" => "Elixir", "field" => "value"}
# client will return..
%Streamex.Activity{..., custom_fields: %{"field" => "value"}}
Invalid activity, missing required fields:
%{"actor" => "Tony", "object" => "Elixir"}
Summary
Functions
Converts a Map
of attributes to a Streamex.Activity
struct
Types
t :: %Streamex.Activity{actor: term, custom_fields: term, foreign_id: term, id: term, object: term, origin: term, target: term, time: term, to: term, verb: term}
Functions
Converts a Map
of attributes to a Streamex.Activity
struct.