From 482b5ed0e3f81f85ab4e4ea5b6c2311d0ec09477 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 1 Oct 2017 21:25:59 +0300 Subject: [PATCH] Add mark_sent to the API --- app/Http/Controllers/BaseAPIController.php | 6 +++++- docs/api.rst | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/BaseAPIController.php b/app/Http/Controllers/BaseAPIController.php index 190debf96139..47473467460d 100644 --- a/app/Http/Controllers/BaseAPIController.php +++ b/app/Http/Controllers/BaseAPIController.php @@ -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); diff --git a/docs/api.rst b/docs/api.rst index 95b8dfdcae99..b67bb606619a 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -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 """""""""""""""""