diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-03 16:43:13 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-03 16:43:13 -0500 |
commit | a296ba5b18487d312acca2513d461a210a460fae (patch) | |
tree | e5e22ffa7796a9734ec284826dd313219644a539 /doc | |
parent | d578b612ea8853682f65ee74fd08f4893152d87a (diff) |
Improve Automatic Actions plugin api
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api-action-procedures.markdown | 42 | ||||
-rw-r--r-- | doc/automatic-actions.markdown | 66 | ||||
-rw-r--r-- | doc/plugin-registration.markdown | 37 |
3 files changed, 41 insertions, 104 deletions
diff --git a/doc/api-action-procedures.markdown b/doc/api-action-procedures.markdown index 5dd88f4a..67bd85de 100644 --- a/doc/api-action-procedures.markdown +++ b/doc/api-action-procedures.markdown @@ -25,24 +25,24 @@ Response example: "jsonrpc": "2.0", "id": 1217735483, "result": { - "TaskLogMoveAnotherColumn": "Add a comment logging moving the task between columns", - "TaskAssignColorUser": "Assign a color to a specific user", - "TaskAssignColorColumn": "Assign a color when the task is moved to a specific column", - "TaskAssignCategoryColor": "Assign automatically a category based on a color", - "TaskAssignColorCategory": "Assign automatically a color based on a category", - "TaskAssignSpecificUser": "Assign the task to a specific user", - "TaskAssignCurrentUser": "Assign the task to the person who does the action", - "TaskUpdateStartDate": "Automatically update the start date", - "TaskAssignUser": "Change the assignee based on an external username", - "TaskAssignCategoryLabel": "Change the category based on an external label", - "TaskClose": "Close a task", - "CommentCreation": "Create a comment from an external provider", - "TaskCreation": "Create a task from an external provider", - "TaskDuplicateAnotherProject": "Duplicate the task to another project", - "TaskMoveColumnAssigned": "Move the task to another column when assigned to a user", - "TaskMoveColumnUnAssigned": "Move the task to another column when assignee is cleared", - "TaskMoveAnotherProject": "Move the task to another project", - "TaskOpen": "Open a task" + "\Kanboard\Action\TaskLogMoveAnotherColumn": "Add a comment logging moving the task between columns", + "\Kanboard\Action\TaskAssignColorUser": "Assign a color to a specific user", + "\Kanboard\Action\TaskAssignColorColumn": "Assign a color when the task is moved to a specific column", + "\Kanboard\Action\TaskAssignCategoryColor": "Assign automatically a category based on a color", + "\Kanboard\Action\TaskAssignColorCategory": "Assign automatically a color based on a category", + "\Kanboard\Action\TaskAssignSpecificUser": "Assign the task to a specific user", + "\Kanboard\Action\TaskAssignCurrentUser": "Assign the task to the person who does the action", + "\Kanboard\Action\TaskUpdateStartDate": "Automatically update the start date", + "\Kanboard\Action\TaskAssignUser": "Change the assignee based on an external username", + "\Kanboard\Action\TaskAssignCategoryLabel": "Change the category based on an external label", + "\Kanboard\Action\TaskClose": "Close a task", + "\Kanboard\Action\CommentCreation": "Create a comment from an external provider", + "\Kanboard\Action\TaskCreation": "Create a task from an external provider", + "\Kanboard\Action\TaskDuplicateAnotherProject": "Duplicate the task to another project", + "\Kanboard\Action\TaskMoveColumnAssigned": "Move the task to another column when assigned to a user", + "\Kanboard\Action\TaskMoveColumnUnAssigned": "Move the task to another column when assignee is cleared", + "\Kanboard\Action\TaskMoveAnotherProject": "Move the task to another project", + "\Kanboard\Action\TaskOpen": "Open a task" } } ``` @@ -109,7 +109,7 @@ Request example: "method": "getCompatibleActionEvents", "id": 899370297, "params": [ - "TaskClose" + "\Kanboard\Action\TaskClose" ] } ``` @@ -163,7 +163,7 @@ Response example: "id" : "13", "project_id" : "2", "event_name" : "task.move.column", - "action_name" : "TaskAssignSpecificUser", + "action_name" : "\Kanboard\Action\TaskAssignSpecificUser", "params" : { "column_id" : "5", "user_id" : "1" @@ -194,7 +194,7 @@ Request example: "params": { "project_id" : "2", "event_name" : "task.move.column", - "action_name" : "TaskAssignSpecificUser", + "action_name" : "\Kanboard\Action\TaskAssignSpecificUser", "params" : { "column_id" : "3", "user_id" : "2" diff --git a/doc/automatic-actions.markdown b/doc/automatic-actions.markdown index 69352d12..db56ccc0 100644 --- a/doc/automatic-actions.markdown +++ b/doc/automatic-actions.markdown @@ -26,59 +26,33 @@ Add a new action ![Define parameters](http://kanboard.net/screenshots/documentation/project-automatic-action-step3.png) -List of available events ------------------------- - -- Move a task to another column -- Move a task to another position in the same column -- Task modification -- Task creation -- Reopen a task -- Closing a task -- Task creation or modification -- Task assignee change -- Task link created or updated -- Github commit received -- Github issue opened -- Github issue closed -- Github issue reopened -- Github issue assignee change -- Github issue label change -- Github issue comment created -- Gitlab issue opened -- Gitlab issue closed -- Gitlab commit received -- Bitbucket commit received -- Bitbucket issue opened -- Bitbucket issue closed -- Bitbucket issue reopened -- Bitbucket issue assignee change -- Bitbucket issue comment created - List of available actions ------------------------- -- Close the task -- Open a task -- Assign the task to a specific user +- Create a comment from an external provider +- Add a comment log when moving the task between columns +- Assign automatically a category based on a color +- Change the category based on an external label +- Assign automatically a category based on a link +- Assign automatically a color based on a category +- Assign a color when the task is moved to a specific column +- Change task color when using a specific task link +- Assign a color to a specific user - Assign the task to the person who does the action +- Assign the task to the person who does the action when the column is changed +- Assign the task to a specific user +- Change the assignee based on an external username +- Close the task +- Close a task in a specific column +- Create a task from an external provider - Duplicate the task to another project +- Send a task by email to someone - Move the task to another project - Move the task to another column when assigned to a user +- Move the task to another column when the category is changed - Move the task to another column when assignee is cleared -- Assign color when the task is moved to a specific column -- Assign color to a specific user -- Assign automatically a color based on a category -- Assign automatically a category based on a color -- Create a comment from an external provider -- Create a task from an external provider -- Add a comment log when moving the task between columns -- Change the assignee based on an external username -- Change the category based on an external label +- Open a task - Automatically update the start date -- Move the task to another column when the category is changed -- Send a task by email to someone -- Change task color when using a specific task link Examples -------- @@ -87,7 +61,7 @@ Here are some examples used in real life: ### When I move a task to the column "Done", automatically close this task -- Choose action: **Close the task** +- Choose action: **Close a task in a specific column** - Choose the event: **Move a task to another column** - Define action parameter: **Column = Done** (this is the destination column) @@ -99,7 +73,7 @@ Here are some examples used in real life: ### When I move a task to the column "Work in progress", assign this task to the current user -- Choose action: **Assign the task to the person who does the action** +- Choose action: **Assign the task to the person who does the action when the column is changed** - Choose the event: **Move a task to another column** - Define action parameter: **Column = Work in progress** diff --git a/doc/plugin-registration.markdown b/doc/plugin-registration.markdown index 746fa200..37e71f9a 100644 --- a/doc/plugin-registration.markdown +++ b/doc/plugin-registration.markdown @@ -138,40 +138,3 @@ $this->on('app.bootstrap', function($container) { - The first argument is the event name - The second argument is a PHP callable function (closure or class method) - -Extend Automatic Actions ------------------------- - -To define a new automatic action with a plugin, you just need to call the method `extendActions()` from the class `Kanboard\Model\Action`, here an example: - -```php -<?php - -namespace Kanboard\Plugin\AutomaticAction; - -use Kanboard\Core\Plugin\Base; - -class Plugin extends Base -{ - public function initialize() - { - $this->action->extendActions( - '\Kanboard\Plugin\AutomaticAction\Action\DoSomething', // Use absolute namespace - t('Do something when the task color change') - ); - } -} -``` - -- The first argument of the method `extendActions()` is the action class with the complete namespace path. **The namespace path must starts with a backslash** otherwise Kanboard will not be able to load your class. -- The second argument is the description of your automatic action. - -The automatic action class must inherit from the class `Kanboard\Action\Base` and implements all abstract methods: - -- `getCompatibleEvents()` -- `getActionRequiredParameters()` -- `getEventRequiredParameters()` -- `doAction(array $data)` -- `hasRequiredCondition(array $data)` - -For more details you should take a look to existing automatic actions or this [plugin example](https://github.com/kanboard/plugin-example-automatic-action). |