2016-01-06 13:12:57 +00:00
|
|
|
/*
|
|
|
|
* This file is part of matrix-glib-sdk
|
|
|
|
*
|
|
|
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation, either
|
|
|
|
* version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* matrix-glib-sdk is distributed in the hope that it will be
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with matrix-glib-sdk. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-25 10:39:49 +00:00
|
|
|
#ifndef __MATRIX_TYPES_H__
|
|
|
|
#define __MATRIX_TYPES_H__
|
2016-01-06 13:12:57 +00:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <json-glib/json-glib.h>
|
|
|
|
|
2016-01-07 11:26:24 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2016-01-11 09:41:28 +00:00
|
|
|
typedef enum {
|
2016-01-25 11:17:44 +00:00
|
|
|
MATRIX_ERROR_NONE,
|
|
|
|
MATRIX_ERROR_COMMUNICATION_ERROR,
|
|
|
|
MATRIX_ERROR_INCOMPLETE,
|
|
|
|
MATRIX_ERROR_BAD_REQUEST,
|
|
|
|
MATRIX_ERROR_BAD_RESPONSE,
|
|
|
|
MATRIX_ERROR_INVALID_ROOM_ID,
|
|
|
|
MATRIX_ERROR_UNKNOWN_VALUE,
|
2016-02-02 12:03:17 +00:00
|
|
|
MATRIX_ERROR_INVALID_TYPE,
|
|
|
|
MATRIX_ERROR_UNSUPPORTED,
|
|
|
|
MATRIX_ERROR_INVALID_FORMAT,
|
2016-01-11 14:23:45 +00:00
|
|
|
|
2016-02-03 17:19:10 +00:00
|
|
|
/* Add Matrix-defined error codes under here, prefixing them with
|
|
|
|
* `MATRIX_ERROR_`, i.e. `M_FORBIDDEN` =>
|
|
|
|
* `MATRIX_ERROR_M_FORBIDDEN` */
|
|
|
|
MATRIX_ERROR_M_MISSING_TOKEN = 500,
|
|
|
|
MATRIX_ERROR_M_FORBIDDEN,
|
|
|
|
MATRIX_ERROR_M_UNKNOWN,
|
|
|
|
MATRIX_ERROR_M_UNKNOWN_TOKEN,
|
|
|
|
MATRIX_ERROR_M_NOT_JSON,
|
|
|
|
MATRIX_ERROR_M_UNRECOGNIZED,
|
2016-02-02 12:03:17 +00:00
|
|
|
MATRIX_ERROR_M_UNAUTHORIZED,
|
|
|
|
MATRIX_ERROR_M_BAD_JSON,
|
|
|
|
MATRIX_ERROR_M_USER_IN_USE,
|
|
|
|
MATRIX_ERROR_M_ROOM_IN_USE,
|
|
|
|
MATRIX_ERROR_M_BAD_PAGINATION,
|
|
|
|
MATRIX_ERROR_M_BAD_STATE,
|
|
|
|
MATRIX_ERROR_M_NOT_FOUND,
|
|
|
|
MATRIX_ERROR_M_GUEST_ACCESS_FORBIDDEN,
|
|
|
|
MATRIX_ERROR_M_LIMIT_EXCEEDED,
|
|
|
|
MATRIX_ERROR_M_CAPTCHA_NEEDED,
|
|
|
|
MATRIX_ERROR_M_CAPTCHA_INVALID,
|
|
|
|
MATRIX_ERROR_M_MISSING_PARAM,
|
|
|
|
MATRIX_ERROR_M_TOO_LARGE,
|
|
|
|
MATRIX_ERROR_M_EXCLUSIVE,
|
|
|
|
MATRIX_ERROR_M_THREEPID_AUTH_FAILED,
|
|
|
|
MATRIX_ERROR_M_THREEPID_IN_USE,
|
|
|
|
MATRIX_ERROR_M_INVALID_USERNAME,
|
2016-01-11 14:23:45 +00:00
|
|
|
|
2016-01-11 09:41:28 +00:00
|
|
|
/* Allow for a lot of Matrix.org defined codes
|
|
|
|
Do not define error codes after this! */
|
2016-01-25 11:17:44 +00:00
|
|
|
MATRIX_ERROR_UNSPECIFIED = 16383,
|
|
|
|
MATRIX_ERROR_UNKNOWN_ERROR
|
|
|
|
} MatrixError;
|
2016-01-11 09:41:28 +00:00
|
|
|
|
2016-01-25 11:17:44 +00:00
|
|
|
#define MATRIX_ERROR matrix_error_quark()
|
|
|
|
GQuark matrix_error_quark(void);
|
2016-01-11 09:41:28 +00:00
|
|
|
|
2016-01-11 13:07:27 +00:00
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_ROOM_VISIBILITY_DEFAULT,
|
|
|
|
MATRIX_ROOM_VISIBILITY_PUBLIC,
|
|
|
|
MATRIX_ROOM_VISIBILITY_PRIVATE
|
|
|
|
} MatrixRoomVisibility;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
2016-01-25 15:36:18 +00:00
|
|
|
typedef struct _MatrixStateEvent MatrixStateEvent;
|
|
|
|
|
|
|
|
GType matrix_state_event_get_type(void);
|
|
|
|
#define MATRIX_TYPE_STATE_EVENT (matrix_state_event_get_type())
|
|
|
|
|
|
|
|
MatrixStateEvent *matrix_state_event_new(void);
|
|
|
|
MatrixStateEvent *matrix_state_event_ref(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_unref(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_set_event_type(MatrixStateEvent *event,
|
|
|
|
const gchar *event_type);
|
|
|
|
const gchar *matrix_state_event_get_event_type(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_set_state_key(MatrixStateEvent *event,
|
|
|
|
const gchar *state_key);
|
|
|
|
const gchar *matrix_state_event_get_state_key(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_set_content(MatrixStateEvent *event,
|
|
|
|
const JsonNode *content);
|
|
|
|
const JsonNode *matrix_state_event_get_content(MatrixStateEvent *event);
|
|
|
|
JsonNode *matrix_state_event_get_json_node(MatrixStateEvent *event);
|
|
|
|
gchar *matrix_state_event_get_json_data(MatrixStateEvent *event,
|
|
|
|
gsize *datalen);
|
2016-01-11 12:45:51 +00:00
|
|
|
|
2016-01-07 11:26:24 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2016-01-25 10:39:49 +00:00
|
|
|
#endif /* __MATRIX_TYPES_H__ */
|