/*
 * Purple Zulip - Zulip Protocol Plugin
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * Purple Zulip is the legal property of its developers, whose names are too
 * numerous to list here. Please refer to the COPYRIGHT file distributed with
 * this source distribution.
 *
 * This plugin is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This plugin 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 General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this plugin; if not, see <https://www.gnu.org/licenses/>.
 */

#ifndef PURPLE_ZULIP_CLIENT_H
#define PURPLE_ZULIP_CLIENT_H

#include <glib.h>
#include <glib-object.h>

#include <json-glib/json-glib.h>

#include <gplugin.h>
#include <gplugin-native.h>

#include <purple.h>

#include "purplezulipresponses.h"

G_BEGIN_DECLS

#define PURPLE_ZULIP_TYPE_CLIENT (purple_zulip_client_get_type())

G_GNUC_INTERNAL
G_DECLARE_FINAL_TYPE(PurpleZulipClient, purple_zulip_client, PURPLE_ZULIP,
                     CLIENT, GObject)

G_GNUC_INTERNAL PurpleAccount *purple_zulip_client_get_account(PurpleZulipClient *client);
G_GNUC_INTERNAL GCancellable *purple_zulip_client_get_cancellable(PurpleZulipClient *client);
G_GNUC_INTERNAL const char *purple_zulip_client_get_server_uri(PurpleZulipClient *client);
G_GNUC_INTERNAL PurpleZulipClient *purple_zulip_client_new(const char *server_uri, GCancellable *cancellable);
G_GNUC_INTERNAL void purple_zulip_client_register(GPluginNativePlugin *plugin);

G_GNUC_INTERNAL void purple_zulip_client_login_async(PurpleZulipClient *client, PurpleAccount *account, GAsyncReadyCallback callback, gpointer data);
G_GNUC_INTERNAL gboolean purple_zulip_client_login_finish(PurpleZulipClient *client, GAsyncResult *result, GError **error);

G_GNUC_INTERNAL void purple_zulip_client_fetch_api_key_async(PurpleZulipClient *client, const char *username, const char *password, gboolean remember, GAsyncReadyCallback callback, gpointer data);
G_GNUC_INTERNAL PurpleZulipFetchApiKeyResponse *purple_zulip_client_fetch_api_key_finish(PurpleZulipClient *client, GAsyncResult *result, GError **error);

G_GNUC_INTERNAL void purple_zulip_client_get_server_settings_async(PurpleZulipClient *client, GAsyncReadyCallback callback, gpointer data);
G_GNUC_INTERNAL PurpleZulipServerSettingsResponse *purple_zulip_client_get_server_settings_finish(PurpleZulipClient *client, GAsyncResult *result, GError **error);

G_GNUC_INTERNAL void purple_zulip_client_get_events_async(PurpleZulipClient *client, const char *queue_id, int last_event_id, GAsyncReadyCallback callback, gpointer data);
G_GNUC_INTERNAL PurpleZulipGetEventsResponse *purple_zulip_client_get_events_finish(PurpleZulipClient *client, GAsyncResult *result, GError **error);

G_GNUC_INTERNAL void purple_zulip_client_delete_event_queue_async(PurpleZulipClient *client, const char *queue_id, GAsyncReadyCallback callback, gpointer data);
G_GNUC_INTERNAL gboolean purple_zulip_client_delete_event_queue_finish(PurpleZulipClient *client, GAsyncResult *result, GError **error);

G_GNUC_INTERNAL void purple_zulip_client_register_event_queue_async(PurpleZulipClient *client, GAsyncReadyCallback callback, gpointer data);
G_GNUC_INTERNAL PurpleZulipRegisterEventQueueResponse *purple_zulip_client_register_event_queue_finish(PurpleZulipClient *client, GAsyncResult *result, GError **error);

G_END_DECLS

#endif
