Merge pull request #5181 from normanjaeckel/ActionDev

Updated action spec.
This commit is contained in:
Finn Stutzenstein 2020-02-05 06:52:52 +01:00 committed by GitHub
commit f7a18cef65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 14 deletions

View File

@ -1,27 +1,25 @@
# Action Service Interface
// TODO: More Exceptions?
Exception ActionNotFound(name: string);
Exception ActionException(message: string);
/**
* Executes multiple actions in the conext of the user given by the user_id.
* All actions are processed independently.
*
* @throws ActionNotFound
* TODO: Check if we need an interface or flag to process actions all together.
*
*
* @throws ActionException
*/
execute(actions: Action[], user_id: number): ExecuteResult;
handle_request (payload: Action[], user_id: number): ActionResult[]
interface Action {
name: string;
data: object;
action: string;
data: object[]; # An array of action specific data. See JSON schema defintions.
}
interface ActionError {
error: string;
argumens: string[];
interface ActionResult {
success: boolean;
message: 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)[]