Constructs an instance of this service.
This method handles incoming events from third-party
data providers such as Strava or Apple Health.
After a successful execution of processing an incoming event,
this method will fire an internal event with the identifier:
oauth.activity.created
. This event can be caught to use
the fulfilled (completed) activity details in other places.
The OAuth provider name. This is the name of the third-party data provider, e.g. "strava".
The dHealth Address of the account that belongs to the activity owner.
The activity's headers. Importantly, Strava does not share full activity details here.
The created document that was added to activities
.
This method serves as an event listener for the internal
event with identifier oauth.activity.created
. The main
purpose of this listener is to request activity details from
a data provider.
An example activity detail DTO can be found on the Strava
documentation: https://developers.strava.com/docs/reference/#api-Activities-getActivityById
Note that we do not store all fields that are returned by
the /activities/:id
endpoint. More fields may be interpreted
in the future.
Note that event listeners do not specify a return type. This
is because their execution is asynchronous.
The internal app event as triggered by eventHandler.
No return is specified for an event listener to permit asynchronous behaviour.
Helper method that executes error handling. It prints the error
message in the logs and updates the activities
document's
processingState
field to ProcessingState.Failed.
A logger instance to use only one and the same.
The activity that produced an error.
The error message.
(Optional) An optional error stack trace.
Helper method that executes a database update of the activities
document's processingState
field to ProcessingState.Failed.
This method is called internally on failure of the activity
details download process.
The activity that produced an error.
The updated activities
document.
Helper method that executes a database update of the activities
document's processingState
field to ProcessingState.Processed.
This method is called internally on success of the activity
details download process.
The activity document that is being updated.
The activity data document that will be attached to the activity.
The updated activities
document.
Generated using TypeDoc
Abstraction layer for webhooks that are executed from third-party data providers. This class contains methods to validate, process and format activities that are completed remotely, e.g. in Strava.
Note that this draft implementation is only compatible with Strava activities and a further iteration shall abstract out the events handling using OAuth Drivers.
v0.3.2