Updated action spec.

This commit is contained in:
Norman Jäckel 2020-01-21 18:05:47 +01:00
parent c187700af2
commit 6054eb76c5

View File

@ -1,27 +1,19 @@
# Action Service Interface # Action Service Interface
// TODO: More Exceptions? Exception ActionException(message: string);
Exception ActionNotFound(name: string);
/** /**
* Executes multiple actions in the conext of the user given by the user_id. * Executes multiple actions in the conext of the user given by the user_id.
* All actions are successful if no exception is thrown, else no action was
* processed.
* *
* @throws ActionNotFound *
* @throws ActionException
*/ */
execute(actions: Action[], user_id: number): ExecuteResult; handle_request (payload: Action[], user_id: number): void
interface Action { interface Action {
name: string; action: string;
data: object; data: object[];
} }
interface ActionError {
error: string;
argumens: string[];
}
// Gives a detailed error, for all failed actions. For some actions, success
// data is returned (the object). If there is no success data, null is given
// for the action. The results index matches to the action index in the request.
Type ExecuteResult = (ActionError | object | null)[]