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
|
|
|
|
#include "matrix-types.h"
|
2016-01-15 16:59:45 +00:00
|
|
|
|
#include "matrix-enumtypes.h"
|
2016-03-04 07:58:56 +00:00
|
|
|
|
#include "matrix-glib.h"
|
2016-01-06 13:12:57 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2016-01-25 10:39:49 +00:00
|
|
|
|
* SECTION:matrix-types
|
2016-01-06 13:12:57 +00:00
|
|
|
|
* @title: Generic types
|
2016-01-25 10:39:49 +00:00
|
|
|
|
* @short_description: Generic types for Matrix GLib SDK calls
|
2016-01-06 13:12:57 +00:00
|
|
|
|
*
|
2016-01-25 10:39:49 +00:00
|
|
|
|
* These are the generic types used by many SDK calls for
|
2016-01-06 13:12:57 +00:00
|
|
|
|
* communication with the homeserver.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-01-11 09:41:28 +00:00
|
|
|
|
/**
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* MatrixError:
|
|
|
|
|
* @MATRIX_ERROR_NONE: no error
|
|
|
|
|
* @MATRIX_ERROR_COMMUNICATION_ERROR: there was a problem in
|
|
|
|
|
* communication (e.g. connection
|
|
|
|
|
* error)
|
|
|
|
|
* @MATRIX_ERROR_INCOMPLETE: the passed/generated data is incomplete
|
|
|
|
|
* @MATRIX_ERROR_BAD_REQUEST: the request is invalid
|
|
|
|
|
* @MATRIX_ERROR_BAD_RESPONSE: malformed response, or the response is
|
|
|
|
|
* not a JSON object
|
|
|
|
|
* @MATRIX_ERROR_INVALID_ROOM_ID: the provided string doesn’t contain
|
|
|
|
|
* a valid room ID
|
2016-02-02 12:03:17 +00:00
|
|
|
|
* @MATRIX_ERROR_INVALID_TYPE: the provided type is invalid
|
|
|
|
|
* @MATRIX_ERROR_UNSUPPORTED: the operation is unsupported
|
|
|
|
|
* @MATRIX_ERROR_INVALID_FORMAT: the format of the JSON node is
|
|
|
|
|
* invalid (e.g. it is an array instead
|
|
|
|
|
* of an object)
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* @MATRIX_ERROR_UNKNOWN_VALUE: the response from the Matrix.org
|
|
|
|
|
* server contains a value unknown to
|
|
|
|
|
* this library. These should be reported
|
|
|
|
|
* to the Matrix GLib SDK developers
|
2016-02-03 17:19:10 +00:00
|
|
|
|
* @MATRIX_ERROR_M_MISSING_TOKEN: authorization token is missing from
|
|
|
|
|
* the request
|
|
|
|
|
* @MATRIX_ERROR_M_FORBIDDEN: access was forbidden (e.g. due to a
|
|
|
|
|
* missing/invalid token, or using a bad
|
|
|
|
|
* password during login)
|
|
|
|
|
* @MATRIX_ERROR_M_UNKNOWN: an error unknown to the Matrix homeserver
|
|
|
|
|
* @MATRIX_ERROR_M_UNKNOWN_TOKEN: the token provided is not known for
|
|
|
|
|
* the homeserver
|
|
|
|
|
* @MATRIX_ERROR_M_NOT_JSON: illegal request, the content is not valid
|
|
|
|
|
* JSON
|
|
|
|
|
* @MATRIX_ERROR_M_UNRECOGNIZED: the homeserver didn't understand the
|
|
|
|
|
* request
|
2016-02-02 12:03:17 +00:00
|
|
|
|
* @MATRIX_ERROR_M_UNAUTHORIZED: the request is unauthorized
|
|
|
|
|
* @MATRIX_ERROR_M_BAD_JSON: the JSON data is not in the required
|
|
|
|
|
* format
|
|
|
|
|
* @MATRIX_ERROR_M_USER_IN_USE: the specified username is in use
|
|
|
|
|
* @MATRIX_ERROR_M_ROOM_IN_USE: the specified room is in use
|
|
|
|
|
* @MATRIX_ERROR_M_BAD_PAGINATION: invalid pagination parameters
|
|
|
|
|
* @MATRIX_ERROR_M_BAD_STATE: invalid state event
|
|
|
|
|
* @MATRIX_ERROR_M_NOT_FOUND: the requested resource is not found
|
|
|
|
|
* @MATRIX_ERROR_M_GUEST_ACCESS_FORBIDDEN: guest access was requested,
|
|
|
|
|
* but it is forbidden
|
|
|
|
|
* @MATRIX_ERROR_M_LIMIT_EXCEEDED: the request was rate limited
|
|
|
|
|
* @MATRIX_ERROR_M_CAPTCHA_NEEDED: a captcha is needed to continue
|
|
|
|
|
* @MATRIX_ERROR_M_CAPTCHA_INVALID: the provided captcha is invalid
|
|
|
|
|
* @MATRIX_ERROR_M_MISSING_PARAM: a parameter is missing from the
|
|
|
|
|
* request
|
|
|
|
|
* @MATRIX_ERROR_M_TOO_LARGE: the request data is too large
|
|
|
|
|
* @MATRIX_ERROR_M_EXCLUSIVE: the desired user ID is in an exclusive
|
|
|
|
|
* namespace claimed by an application
|
|
|
|
|
* server
|
|
|
|
|
* @MATRIX_ERROR_M_THREEPID_AUTH_FAILED: 3rd party authentication
|
|
|
|
|
* failed
|
|
|
|
|
* @MATRIX_ERROR_M_THREEPID_IN_USE: the provided 3rd party ID is
|
|
|
|
|
* already in use
|
|
|
|
|
* @MATRIX_ERROR_M_INVALID_USERNAME: the given username is invalid
|
2016-02-03 17:19:10 +00:00
|
|
|
|
* @MATRIX_ERROR_UNSPECIFIED: no error code was sent by the
|
|
|
|
|
* homeserver. If you see this error, that
|
|
|
|
|
* usually indicates a homeserver bug
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* @MATRIX_ERROR_UNKNOWN_ERROR: an error unknown to this library
|
2016-01-11 09:41:28 +00:00
|
|
|
|
*
|
|
|
|
|
* Value mappings from Matrix.org API error codes
|
|
|
|
|
* (e.g. <code>M_MISSING_TOKEN</code>). They should be set
|
|
|
|
|
* automatically by API calls, if the response contains an error code.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* MATRIX_ERROR:
|
2016-01-11 09:41:28 +00:00
|
|
|
|
*
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* Error domain for Matrix GLib SDK. See #GError for more information
|
|
|
|
|
* on error domains.
|
2016-01-11 09:41:28 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* matrix_error_quark:
|
2016-01-11 09:41:28 +00:00
|
|
|
|
*
|
2016-01-25 11:17:44 +00:00
|
|
|
|
* Gets the Matrix error #GQuark
|
2016-01-11 09:41:28 +00:00
|
|
|
|
*/
|
2016-01-25 11:17:44 +00:00
|
|
|
|
G_DEFINE_QUARK(matrix-error-quark, matrix_error);
|