2020-02-07 00:19:11 +01:00
|
|
|
# Presenter Service Interface
|
|
|
|
|
|
|
|
Exception PresenterException(message: string);
|
|
|
|
|
|
|
|
/**
|
2020-03-17 11:18:55 +01:00
|
|
|
* Executes some presenting function on the server. The term "presenting" means
|
|
|
|
* a non writing (or modifying) idempotent request. There may be some
|
|
|
|
* side-effect allowed (like tracking calls to one presenter), but the main
|
|
|
|
* purpose is to get data of the server, which is not autoupdate-, projector-, or
|
|
|
|
* icc-data.
|
|
|
|
*
|
|
|
|
* Some purposes may be:
|
|
|
|
* - aggregating of login data
|
|
|
|
* - managing of whoami, if additional data is needed, that the auth service
|
|
|
|
* doesn't provide
|
|
|
|
* - To get history points
|
|
|
|
* - To get history data
|
|
|
|
* - To get the installed version
|
|
|
|
* - To query statistics
|
|
|
|
* - To calculate recursive trees (e.g. origins of motions; not possible with
|
|
|
|
* the autoupdate service)
|
|
|
|
* - to synchronize the servertime for countdowns
|
2020-02-07 00:19:11 +01:00
|
|
|
*
|
2020-03-17 11:18:55 +01:00
|
|
|
* @throws PresenterException This exception might be thrown, if there was an
|
|
|
|
* server error (Http-500-equivalent). For user error (e.g. wrong data) use the
|
|
|
|
* PresenterError interface
|
|
|
|
*/
|
|
|
|
handle_request(user_id: Id, payload: Presenter[]): PresenterResult[]
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This interface specifies what presenter is used with the payload for the call
|
2020-02-07 00:19:11 +01:00
|
|
|
*/
|
2020-03-17 11:18:55 +01:00
|
|
|
Interface Presenter {
|
|
|
|
presenter: string;
|
|
|
|
data: any;
|
|
|
|
}
|
2020-02-07 00:19:11 +01:00
|
|
|
|
2020-03-17 11:18:55 +01:00
|
|
|
/**
|
|
|
|
* A presenter may return anything. This is presenter-specific. But if there was
|
|
|
|
* an error (user error, not a PresenterException), the response for this
|
|
|
|
* presenter should follow `PresenterError`.
|
|
|
|
*/
|
|
|
|
type PresenterResult = any | PresenterError;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A common format for errors.
|
|
|
|
*/
|
|
|
|
Interface PresenterError {
|
|
|
|
error: object;
|
2020-02-07 00:19:11 +01:00
|
|
|
}
|
|
|
|
|