stasis_app_mailbox.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2014, Digium, Inc.
  5. *
  6. * Jonathan Rose <jrose@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. #ifndef _ASTERISK_STASIS_APP_MAILBOX_H
  19. #define _ASTERISK_STASIS_APP_MAILBOX_H
  20. /*! \file
  21. *
  22. * \brief Stasis Application Mailbox API. See \ref res_stasis "Stasis
  23. * Application API" for detailed documentation.
  24. *
  25. * \author Jonathan Rose <kharwell@digium.com>
  26. * \since 12
  27. */
  28. #include "asterisk/app.h"
  29. #include "asterisk/stasis_app.h"
  30. /*! @{ */
  31. /*! Stasis mailbox operation result codes */
  32. enum stasis_mailbox_result {
  33. /*! Mailbox operation completed successfully */
  34. STASIS_MAILBOX_OK,
  35. /*! Mailbox of the requested name does not exist */
  36. STASIS_MAILBOX_MISSING,
  37. /*! Mailbox operation failed internally */
  38. STASIS_MAILBOX_ERROR,
  39. };
  40. /*!
  41. * \brief Convert mailbox to JSON
  42. *
  43. * \param name the name of the mailbox
  44. * \param json If the query is successful, this pointer at this address will
  45. * be set to the JSON representation of the mailbox
  46. *
  47. * \return stasis mailbox result code indicating success or failure and cause
  48. * \return \c NULL on error.
  49. */
  50. enum stasis_mailbox_result stasis_app_mailbox_to_json(const char *name, struct ast_json **json);
  51. /*!
  52. * brief Convert mailboxes to json array
  53. *
  54. * \return JSON representation of the mailboxes
  55. * \return \c NULL on error.
  56. */
  57. struct ast_json *stasis_app_mailboxes_to_json(void);
  58. /*!
  59. * \brief Changes the state of a mailbox.
  60. *
  61. * \note Implicitly creates the mailbox.
  62. *
  63. * \param name The name of the ARI controlled mailbox
  64. * \param old_messages count of old (read) messages in the mailbox
  65. * \param new_messages count of new (unread) messages in the mailbox
  66. *
  67. * \return 0 if successful
  68. * \return -1 on internal error.
  69. */
  70. int stasis_app_mailbox_update(
  71. const char *name, int old_messages, int new_messages);
  72. /*!
  73. * \brief Delete a mailbox controlled by ARI.
  74. *
  75. * \param name the name of the ARI controlled mailbox
  76. *
  77. * \return a stasis mailbox application result
  78. */
  79. enum stasis_mailbox_result stasis_app_mailbox_delete(
  80. const char *name);
  81. #endif /* _ASTERISK_STASIS_APP_MAILBOX_H */