Presenter Service - OpenSlides/OpenSlides GitHub Wiki
The presenter service is the counterpart of the action service: Instead of writing, data can be read. Just a few presenters are available for read-actions that cannot be done by the autoupdate. One example is getting the time of the server with the servertime
presenter.
Exception PresenterException(message: string);
/**
* 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.
*
* @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(payload: Presenter[], user_id: Id): PresenterResult[]
/**
* This interface specifies what presenter is used with the payload for the call.
*/
interface Presenter {
presenter: string;
data: any;
}
/**
* 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`.
*
* TODO: Maybe we do not want to response an error but always throw an exception
* instead.
*/
type PresenterResult = any | PresenterError;
/**
* A common format for errors.
*/
interface PresenterError {
error: object;
}