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

View File

@ -1,27 +1,25 @@
# 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 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 { interface Action {
name: string; action: string;
data: object; data: object[]; # An array of action specific data. See JSON schema defintions.
} }
interface ActionError { interface ActionResult {
error: string; success: boolean;
argumens: string[]; 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)[]