Asterisk - The Open Source Telephony Project  21.4.1
stasis_app_mailbox.h
Go to the documentation of this file.
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 
19 #ifndef _ASTERISK_STASIS_APP_MAILBOX_H
20 #define _ASTERISK_STASIS_APP_MAILBOX_H
21 
22 /*! \file
23  *
24  * \brief Stasis Application Mailbox API. See \ref res_stasis "Stasis
25  * Application API" for detailed documentation.
26  *
27  * \author Jonathan Rose <kharwell@digium.com>
28  * \since 12
29  */
30 
31 #include "asterisk/app.h"
32 #include "asterisk/stasis_app.h"
33 
34 /*! Stasis mailbox operation result codes */
36  /*! Mailbox operation completed successfully */
38  /*! Mailbox of the requested name does not exist */
40  /*! Mailbox operation failed internally */
42 };
43 
44 /*!
45  * \brief Convert mailbox to JSON
46  *
47  * \param name the name of the mailbox
48  * \param json If the query is successful, this pointer at this address will
49  * be set to the JSON representation of the mailbox
50  *
51  * \return stasis mailbox result code indicating success or failure and cause
52  * \retval NULL on error.
53  */
54 enum stasis_mailbox_result stasis_app_mailbox_to_json(const char *name, struct ast_json **json);
55 
56 /*!
57  * \brief Convert mailboxes to json array
58  *
59  * \return JSON representation of the mailboxes
60  * \retval NULL on error.
61  */
63 
64 /*!
65  * \brief Changes the state of a mailbox.
66  *
67  * \note Implicitly creates the mailbox.
68  *
69  * \param name The name of the ARI controlled mailbox
70  * \param old_messages count of old (read) messages in the mailbox
71  * \param new_messages count of new (unread) messages in the mailbox
72  *
73  * \retval 0 if successful
74  * \retval -1 on internal error.
75  */
77  const char *name, int old_messages, int new_messages);
78 
79 /*!
80  * \brief Delete a mailbox controlled by ARI.
81  *
82  * \param name the name of the ARI controlled mailbox
83  *
84  * \return a stasis mailbox application result
85  */
87  const char *name);
88 
89 #endif /* _ASTERISK_STASIS_APP_MAILBOX_H */
enum stasis_mailbox_result stasis_app_mailbox_to_json(const char *name, struct ast_json **json)
Convert mailbox to JSON.
enum stasis_mailbox_result stasis_app_mailbox_delete(const char *name)
Delete a mailbox controlled by ARI.
stasis_mailbox_result
struct ast_json * stasis_app_mailboxes_to_json(void)
Convert mailboxes to json array.
const ast_string_field name
Abstract JSON element (object, array, string, int, ...).
Stasis Application API. See Stasis Application API for detailed documentation.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
int stasis_app_mailbox_update(const char *name, int old_messages, int new_messages)
Changes the state of a mailbox.