Create the MatrixHTTPClient skeleton
This commit is contained in:
parent
c56dee6c56
commit
66813be539
@ -20,6 +20,7 @@
|
|||||||
<title>Matrix Client</title>
|
<title>Matrix Client</title>
|
||||||
<xi:include href="xml/matrix-types.xml"/>
|
<xi:include href="xml/matrix-types.xml"/>
|
||||||
<xi:include href="xml/matrix-client.xml"/>
|
<xi:include href="xml/matrix-client.xml"/>
|
||||||
|
<xi:include href="xml/matrix-http-client.xml"/>
|
||||||
<xi:include href="xml/matrix-api.xml"/>
|
<xi:include href="xml/matrix-api.xml"/>
|
||||||
<xi:include href="xml/matrix-http-api.xml"/>
|
<xi:include href="xml/matrix-http-api.xml"/>
|
||||||
<xi:include href="xml/matrix-version.xml"/>
|
<xi:include href="xml/matrix-version.xml"/>
|
||||||
|
@ -17,6 +17,23 @@ MATRIX_TYPE_CLIENT
|
|||||||
matrix_client_get_type
|
matrix_client_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>matrix-http-client</FILE>
|
||||||
|
<TITLE>MatrixHTTPClient</TITLE>
|
||||||
|
MatrixHTTPClient
|
||||||
|
matrix_http_client_new
|
||||||
|
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
MATRIX_HTTP_CLIENT
|
||||||
|
MATRIX_HTTP_CLIENT_CLASS
|
||||||
|
MATRIX_HTTP_CLIENT_GET_CLASS
|
||||||
|
MATRIX_IS_HTTP_CLIENT
|
||||||
|
MATRIX_IS_HTTP_CLIENT_CLASS
|
||||||
|
MATRIX_TYPE_HTTP_CLIENT
|
||||||
|
MatrixHTTPClientClass
|
||||||
|
matrix_http_client_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>matrix-types</FILE>
|
<FILE>matrix-types</FILE>
|
||||||
<TITLE>Fundamental types for the Matrix GLib SDK</TITLE>
|
<TITLE>Fundamental types for the Matrix GLib SDK</TITLE>
|
||||||
|
@ -8,6 +8,7 @@ INST_H_SRC_FILES = \
|
|||||||
matrix-api.h \
|
matrix-api.h \
|
||||||
matrix-http-api.h \
|
matrix-http-api.h \
|
||||||
matrix-client.h \
|
matrix-client.h \
|
||||||
|
matrix-http-client.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
INST_H_BUILT_FILES = \
|
INST_H_BUILT_FILES = \
|
||||||
@ -29,6 +30,7 @@ libmatrix_glib_0_0_la_SOURCES = \
|
|||||||
utils.c \
|
utils.c \
|
||||||
matrix-marshalers.c \
|
matrix-marshalers.c \
|
||||||
matrix-client.c \
|
matrix-client.c \
|
||||||
|
matrix-http-client.c \
|
||||||
$(INST_H_SRC_FILES) \
|
$(INST_H_SRC_FILES) \
|
||||||
$(INST_H_BUILT_FILES) \
|
$(INST_H_BUILT_FILES) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
94
src/matrix-http-client.c
Normal file
94
src/matrix-http-client.c
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "matrix-http-client.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:matrix-http-client
|
||||||
|
* @short_description: A HTTP based Matrix.org client
|
||||||
|
* @title: MatrixHTTPClient
|
||||||
|
* @stability: Unstable
|
||||||
|
*
|
||||||
|
* An event-driven client class to communicate with HTTP based
|
||||||
|
* Matrix.org servers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixHTTPClient:
|
||||||
|
*
|
||||||
|
* The client instance definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixHTTPClientClass:
|
||||||
|
*
|
||||||
|
* Class definition for #MatrixHTTPClient.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_BASE_URL = 1,
|
||||||
|
PROP_VALIDATE_CERTIFICATE,
|
||||||
|
N_PROPERTIES
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *obj_properties[N_PROPERTIES] = {NULL,};
|
||||||
|
|
||||||
|
static void matrix_http_client_matrix_client_init(MatrixClientInterface *iface);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_CODE(MatrixHTTPClient, matrix_http_client, MATRIX_TYPE_HTTP_API,
|
||||||
|
G_IMPLEMENT_INTERFACE(MATRIX_TYPE_CLIENT,
|
||||||
|
matrix_http_client_matrix_client_init));
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_http_client_matrix_client_init(MatrixClientInterface *iface)
|
||||||
|
{
|
||||||
|
iface->login_with_password = NULL;
|
||||||
|
iface->register_with_password = NULL;
|
||||||
|
iface->logout = NULL;
|
||||||
|
iface->begin_polling = NULL;
|
||||||
|
iface->stop_polling = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_http_client_init(MatrixHTTPClient *client)
|
||||||
|
{}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_http_client_class_init(MatrixHTTPClientClass *klass)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* matrix_http_client_new:
|
||||||
|
* @base_url: the base URL to use for API communication
|
||||||
|
*
|
||||||
|
* Creates a new #MatrixHTTPClient object.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a new #MatrixHTTPClient. The object is
|
||||||
|
* cast to #MatrixClient for easier interface usage.
|
||||||
|
*/
|
||||||
|
MatrixClient *
|
||||||
|
matrix_http_client_new(const gchar *base_url)
|
||||||
|
{
|
||||||
|
MatrixHTTPClient *client;
|
||||||
|
|
||||||
|
client = g_object_new(MATRIX_TYPE_HTTP_CLIENT,
|
||||||
|
"base-url", base_url,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
return MATRIX_CLIENT(client);
|
||||||
|
}
|
52
src/matrix-http-client.h
Normal file
52
src/matrix-http-client.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MATRIX_HTTP_CLIENT_H__
|
||||||
|
#define __MATRIX_HTTP_CLIENT_H__
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include "matrix-client.h"
|
||||||
|
#include "matrix-http-api.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define MATRIX_TYPE_HTTP_CLIENT (matrix_http_client_get_type())
|
||||||
|
#define MATRIX_HTTP_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_HTTP_CLIENT, MatrixHTTPClient))
|
||||||
|
#define MATRIX_HTTP_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_HTTP_CLIENT, MatrixHTTPClientClass))
|
||||||
|
#define MATRIX_IS_HTTP_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_HTTP_CLIENT))
|
||||||
|
#define MATRIX_IS_HTTP_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_HTTP_CLIENT))
|
||||||
|
#define MATRIX_HTTP_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_HTTP_CLIENT, MatrixHTTPClientClass))
|
||||||
|
|
||||||
|
typedef struct _MatrixHTTPClient MatrixHTTPClient;
|
||||||
|
typedef struct _MatrixHTTPClientClass MatrixHTTPClientClass;
|
||||||
|
|
||||||
|
struct _MatrixHTTPClient {
|
||||||
|
GObject parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MatrixHTTPClientClass {
|
||||||
|
GObjectClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType matrix_http_client_get_type(void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
MatrixClient *matrix_http_client_new(const gchar *base_url);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __MATRIX_HTTP_CLIENT_H__ */
|
Loading…
Reference in New Issue
Block a user