ImController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Generated\Controllers\V1;
  3. use App\Generated\V1\Messages\Im\DeleteMessage;
  4. use App\Generated\V1\Messages\Im\GetUsersLatestsMessage;
  5. use App\Generated\V1\Messages\Im\MarkUserMessagesReadMessage;
  6. use App\Http\Controllers\Controller;
  7. use App\Generated\V1\Messages\Im\RevokeMessage;
  8. use App\Http\Services\V1\ImService;
  9. use App\Generated\V1\Messages\Im\SendMessage;
  10. use DB;
  11. class ImController extends Controller
  12. {
  13. public $handler;
  14. public function __construct(ImService $handler)
  15. {
  16. $this->handler = $handler;
  17. }
  18. public function markUserMessagesRead(MarkUserMessagesReadMessage $message)
  19. {
  20. $message->validateInput();
  21. $this->handler->markUserMessagesRead($message);
  22. $message->validateOutput();
  23. return $message->getResponse();
  24. }
  25. public function delete(DeleteMessage $message)
  26. {
  27. $message->validateInput();
  28. $this->handler->delete($message);
  29. $message->validateOutput();
  30. return $message->getResponse();
  31. }
  32. public function revoke(RevokeMessage $message)
  33. {
  34. $message->validateInput();
  35. $this->handler->revoke($message);
  36. $message->validateOutput();
  37. return $message->getResponse();
  38. }
  39. public function send(SendMessage $message)
  40. {
  41. $message->validateInput();
  42. $this->handler->send($message);
  43. $message->validateOutput();
  44. return $message->getResponse();
  45. }
  46. public function getUsersLatests(GetUsersLatestsMessage $message)
  47. {
  48. $message->validateInput();
  49. $this->handler->getUsersLatests($message);
  50. $message->validateOutput();
  51. return $message->getResponse();
  52. }
  53. }