Add mark_sent to the API

This commit is contained in:
Hillel Coren 2017-10-01 21:25:59 +03:00
parent d37e2b90a0
commit 482b5ed0e3
2 changed files with 7 additions and 1 deletions

View File

@ -74,10 +74,14 @@ class BaseAPIController extends Controller
$entity = $request->entity();
$action = $request->action;
if (! in_array($action, ['archive', 'delete', 'restore'])) {
if (! in_array($action, ['archive', 'delete', 'restore', 'mark_sent'])) {
return $this->errorResponse("Action [$action] is not supported");
}
if ($action == 'mark_sent') {
$action = 'markSent';
}
$repo = Utils::toCamelCase($this->entityType) . 'Repo';
$this->$repo->$action($entity);

View File

@ -115,6 +115,8 @@ You can archive, delete or restore an entity by setting ``action`` in the reques
curl -X PUT ninja.dev/api/v1/invoices/1?action=archive \
-H "X-Ninja-Token: TOKEN"
.. TIP:: For invoices use `mark_sent` to manually mark the invoice as sent
Emailing Invoices
"""""""""""""""""