/* Notification.c generated by valac 0.52.4, the Vala compiler
 * generated from Notification.vala, do not modify */

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <json-glib/json-glib.h>
#include <stdlib.h>
#include <string.h>
#include <libsoup/soup.h>
#include <gee.h>

#define TOOTLE_TYPE_WIDGETIZABLE (tootle_widgetizable_get_type ())
#define TOOTLE_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizable))
#define TOOTLE_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_WIDGETIZABLE))
#define TOOTLE_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizableIface))

typedef struct _TootleWidgetizable TootleWidgetizable;
typedef struct _TootleWidgetizableIface TootleWidgetizableIface;

#define TOOTLE_TYPE_ENTITY (tootle_entity_get_type ())
#define TOOTLE_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ENTITY, TootleEntity))
#define TOOTLE_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ENTITY, TootleEntityClass))
#define TOOTLE_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ENTITY))
#define TOOTLE_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ENTITY))
#define TOOTLE_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ENTITY, TootleEntityClass))

typedef struct _TootleEntity TootleEntity;
typedef struct _TootleEntityClass TootleEntityClass;

#define TOOTLE_API_TYPE_ACCOUNT (tootle_api_account_get_type ())
#define TOOTLE_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccount))
#define TOOTLE_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))
#define TOOTLE_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))

typedef struct _TootleAPIAccount TootleAPIAccount;
typedef struct _TootleAPIAccountClass TootleAPIAccountClass;

#define TOOTLE_TYPE_INSTANCE_ACCOUNT (tootle_instance_account_get_type ())
#define TOOTLE_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount))
#define TOOTLE_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))
#define TOOTLE_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))

typedef struct _TootleInstanceAccount TootleInstanceAccount;
typedef struct _TootleInstanceAccountClass TootleInstanceAccountClass;
typedef struct _TootleEntityPrivate TootleEntityPrivate;

#define TOOTLE_API_TYPE_NOTIFICATION (tootle_api_notification_get_type ())
#define TOOTLE_API_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotification))
#define TOOTLE_API_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotificationClass))
#define TOOTLE_API_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_NOTIFICATION))
#define TOOTLE_API_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_NOTIFICATION))
#define TOOTLE_API_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotificationClass))

typedef struct _TootleAPINotification TootleAPINotification;
typedef struct _TootleAPINotificationClass TootleAPINotificationClass;
typedef struct _TootleAPINotificationPrivate TootleAPINotificationPrivate;
typedef enum  {
	TOOTLE_API_NOTIFICATION_TYPE_MENTION,
	TOOTLE_API_NOTIFICATION_TYPE_REBLOG,
	TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER,
	TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE,
	TOOTLE_API_NOTIFICATION_TYPE_FOLLOW,
	TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST,
	TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST
} TootleAPINotificationType;

#define TOOTLE_API_TYPE_NOTIFICATION_TYPE (tootle_api_notification_type_get_type ())

#define TOOTLE_API_TYPE_STATUS (tootle_api_status_get_type ())
#define TOOTLE_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatus))
#define TOOTLE_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))
#define TOOTLE_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))

typedef struct _TootleAPIStatus TootleAPIStatus;
typedef struct _TootleAPIStatusClass TootleAPIStatusClass;
enum  {
	TOOTLE_API_NOTIFICATION_0_PROPERTY,
	TOOTLE_API_NOTIFICATION_ID_PROPERTY,
	TOOTLE_API_NOTIFICATION_ACCOUNT_PROPERTY,
	TOOTLE_API_NOTIFICATION_KIND_PROPERTY,
	TOOTLE_API_NOTIFICATION_CREATED_AT_PROPERTY,
	TOOTLE_API_NOTIFICATION_STATUS_PROPERTY,
	TOOTLE_API_NOTIFICATION_NUM_PROPERTIES
};
static GParamSpec* tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TOOTLE_WIDGETS_TYPE_STATUS (tootle_widgets_status_get_type ())
#define TOOTLE_WIDGETS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_STATUS, TootleWidgetsStatus))
#define TOOTLE_WIDGETS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_STATUS, TootleWidgetsStatusClass))
#define TOOTLE_WIDGETS_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_STATUS))
#define TOOTLE_WIDGETS_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_STATUS))
#define TOOTLE_WIDGETS_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_STATUS, TootleWidgetsStatusClass))

typedef struct _TootleWidgetsStatus TootleWidgetsStatus;
typedef struct _TootleWidgetsStatusClass TootleWidgetsStatusClass;

#define TOOTLE_WIDGETS_TYPE_NOTIFICATION (tootle_widgets_notification_get_type ())
#define TOOTLE_WIDGETS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_NOTIFICATION, TootleWidgetsNotification))
#define TOOTLE_WIDGETS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_NOTIFICATION, TootleWidgetsNotificationClass))
#define TOOTLE_WIDGETS_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_NOTIFICATION))
#define TOOTLE_WIDGETS_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_NOTIFICATION))
#define TOOTLE_WIDGETS_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_NOTIFICATION, TootleWidgetsNotificationClass))

typedef struct _TootleWidgetsNotification TootleWidgetsNotification;
typedef struct _TootleWidgetsNotificationClass TootleWidgetsNotificationClass;

#define TOOTLE_TYPE_ACCOUNTS (tootle_accounts_get_type ())
#define TOOTLE_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccounts))
#define TOOTLE_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))
#define TOOTLE_IS_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_IS_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_ACCOUNTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))

typedef struct _TootleAccounts TootleAccounts;
typedef struct _TootleAccountsClass TootleAccountsClass;

#define TOOTLE_TYPE_REQUEST (tootle_request_get_type ())
#define TOOTLE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_REQUEST, TootleRequest))
#define TOOTLE_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_REQUEST, TootleRequestClass))
#define TOOTLE_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_REQUEST))
#define TOOTLE_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_REQUEST))
#define TOOTLE_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_REQUEST, TootleRequestClass))

typedef struct _TootleRequest TootleRequest;
typedef struct _TootleRequestClass TootleRequestClass;

typedef enum  {
	TOOTLE_OOPSIE_USER,
	TOOTLE_OOPSIE_PARSING,
	TOOTLE_OOPSIE_INSTANCE,
	TOOTLE_OOPSIE_INTERNAL
} TootleOopsie;
#define TOOTLE_OOPSIE tootle_oopsie_quark ()
struct _TootleWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TootleWidgetizable* self, GError** error);
	void (*open) (TootleWidgetizable* self);
	void (*resolve_open) (TootleWidgetizable* self, TootleInstanceAccount* account);
};

struct _TootleEntity {
	GObject parent_instance;
	TootleEntityPrivate * priv;
};

struct _TootleEntityClass {
	GObjectClass parent_class;
	gboolean (*is_local) (TootleEntity* self, TootleInstanceAccount* account);
};

struct _TootleAPINotification {
	TootleEntity parent_instance;
	TootleAPINotificationPrivate * priv;
};

struct _TootleAPINotificationClass {
	TootleEntityClass parent_class;
};

struct _TootleAPINotificationPrivate {
	gchar* _id;
	TootleAPIAccount* _account;
	TootleAPINotificationType _kind;
	gchar* _created_at;
	TootleAPIStatus* _status;
};

static gint TootleAPINotification_private_offset;
static gpointer tootle_api_notification_parent_class = NULL;
extern TootleAccounts* tootle_accounts;
static TootleWidgetizableIface * tootle_api_notification_tootle_widgetizable_parent_iface = NULL;

GQuark tootle_oopsie_quark (void);
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
GType tootle_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAccount, g_object_unref)
GType tootle_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleInstanceAccount, g_object_unref)
GType tootle_widgetizable_get_type (void) G_GNUC_CONST ;
GType tootle_api_notification_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPINotification, g_object_unref)
GType tootle_api_notification_type_get_type (void) G_GNUC_CONST ;
GType tootle_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIStatus, g_object_unref)
static GtkWidget* tootle_api_notification_real_to_widget (TootleWidgetizable* base,
                                                   GError** error);
TootleWidgetsNotification* tootle_widgets_notification_new (TootleAPINotification* obj);
TootleWidgetsNotification* tootle_widgets_notification_construct (GType object_type,
                                                                  TootleAPINotification* obj);
GType tootle_widgets_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsStatus, g_object_unref)
GType tootle_widgets_notification_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsNotification, g_object_unref)
SoupMessage* tootle_api_notification_dismiss (TootleAPINotification* self);
TootleAPINotificationType tootle_api_notification_get_kind (TootleAPINotification* self);
GType tootle_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAccounts, g_object_unref)
TootleInstanceAccount* tootle_accounts_get_active (TootleAccounts* self);
GeeArrayList* tootle_instance_account_get_cached_notifications (TootleInstanceAccount* self);
void tootle_accounts_save (TootleAccounts* self,
                           gboolean overwrite);
SoupMessage* tootle_api_notification_reject_follow_request (TootleAPINotification* self);
GType tootle_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleRequest, g_object_unref)
TootleRequest* tootle_request_new_POST (const gchar* url);
TootleRequest* tootle_request_construct_POST (GType object_type,
                                              const gchar* url);
TootleRequest* tootle_request_with_account (TootleRequest* self,
                                            TootleInstanceAccount* account);
TootleRequest* tootle_request_with_param (TootleRequest* self,
                                          const gchar* name,
                                          const gchar* val);
const gchar* tootle_api_notification_get_id (TootleAPINotification* self);
TootleRequest* tootle_request_exec (TootleRequest* self);
SoupMessage* tootle_api_notification_accept_follow_request (TootleAPINotification* self);
TootleAPIAccount* tootle_api_notification_get_account (TootleAPINotification* self);
const gchar* tootle_api_account_get_id (TootleAPIAccount* self);
TootleAPINotification* tootle_api_notification_new (void);
TootleAPINotification* tootle_api_notification_construct (GType object_type);
TootleEntity* tootle_entity_new (void);
TootleEntity* tootle_entity_construct (GType object_type);
void tootle_api_notification_set_id (TootleAPINotification* self,
                                     const gchar* value);
void tootle_api_notification_set_account (TootleAPINotification* self,
                                          TootleAPIAccount* value);
void tootle_api_notification_set_kind (TootleAPINotification* self,
                                       TootleAPINotificationType value);
const gchar* tootle_api_notification_get_created_at (TootleAPINotification* self);
void tootle_api_notification_set_created_at (TootleAPINotification* self,
                                             const gchar* value);
TootleAPIStatus* tootle_api_notification_get_status (TootleAPINotification* self);
void tootle_api_notification_set_status (TootleAPINotification* self,
                                         TootleAPIStatus* value);
GtkWidget* tootle_widgetizable_to_widget (TootleWidgetizable* self,
                                          GError** error);
static void tootle_api_notification_finalize (GObject * obj);
static GType tootle_api_notification_get_type_once (void);
static void _vala_tootle_api_notification_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_tootle_api_notification_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_api_notification_get_instance_private (TootleAPINotification* self)
{
	return G_STRUCT_MEMBER_P (self, TootleAPINotification_private_offset);
}

static GtkWidget*
tootle_api_notification_real_to_widget (TootleWidgetizable* base,
                                        GError** error)
{
	TootleAPINotification * self;
	TootleWidgetsNotification* _tmp0_;
	GtkWidget* result = NULL;
	self = (TootleAPINotification*) base;
	_tmp0_ = tootle_widgets_notification_new (self);
	g_object_ref_sink (_tmp0_);
	result = (GtkWidget*) _tmp0_;
	return result;
}

SoupMessage*
tootle_api_notification_dismiss (TootleAPINotification* self)
{
	TootleAPINotificationType _tmp0_;
	TootleAPINotificationType _tmp7_;
	TootleRequest* req = NULL;
	TootleRequest* _tmp9_;
	TootleRequest* _tmp10_;
	TootleAccounts* _tmp11_;
	TootleInstanceAccount* _tmp12_;
	TootleInstanceAccount* _tmp13_;
	TootleRequest* _tmp14_;
	TootleRequest* _tmp15_;
	const gchar* _tmp16_;
	TootleRequest* _tmp17_;
	TootleRequest* _tmp18_;
	TootleRequest* _tmp19_;
	TootleRequest* _tmp20_;
	SoupMessage* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_kind;
	if (_tmp0_ == TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST) {
		TootleAccounts* _tmp1_;
		TootleInstanceAccount* _tmp2_;
		TootleInstanceAccount* _tmp3_;
		GeeArrayList* _tmp4_;
		GeeArrayList* _tmp5_;
		_tmp1_ = tootle_accounts;
		_tmp2_ = tootle_accounts_get_active (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = tootle_instance_account_get_cached_notifications (_tmp3_);
		_tmp5_ = _tmp4_;
		if (gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp5_, self)) {
			TootleAccounts* _tmp6_;
			_tmp6_ = tootle_accounts;
			tootle_accounts_save (_tmp6_, TRUE);
		}
		result = NULL;
		return result;
	}
	_tmp7_ = self->priv->_kind;
	if (_tmp7_ == TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST) {
		SoupMessage* _tmp8_;
		_tmp8_ = tootle_api_notification_reject_follow_request (self);
		result = _tmp8_;
		return result;
	}
	_tmp9_ = tootle_request_new_POST ("/api/v1/notifications/dismiss");
	_tmp10_ = _tmp9_;
	_tmp11_ = tootle_accounts;
	_tmp12_ = tootle_accounts_get_active (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = tootle_request_with_account (_tmp10_, _tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = self->priv->_id;
	_tmp17_ = tootle_request_with_param (_tmp15_, "id", _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = tootle_request_exec (_tmp18_);
	_tmp20_ = _tmp19_;
	_g_object_unref0 (_tmp18_);
	_g_object_unref0 (_tmp15_);
	_g_object_unref0 (_tmp10_);
	req = _tmp20_;
	result = (SoupMessage*) req;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

SoupMessage*
tootle_api_notification_accept_follow_request (TootleAPINotification* self)
{
	TootleRequest* req = NULL;
	TootleAPIAccount* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	TootleRequest* _tmp6_;
	TootleRequest* _tmp7_;
	TootleAccounts* _tmp8_;
	TootleInstanceAccount* _tmp9_;
	TootleInstanceAccount* _tmp10_;
	TootleRequest* _tmp11_;
	TootleRequest* _tmp12_;
	TootleRequest* _tmp13_;
	TootleRequest* _tmp14_;
	SoupMessage* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	_tmp1_ = tootle_api_account_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat ("/api/v1/follow_requests/", _tmp3_, "/authorize", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = tootle_request_new_POST (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = tootle_accounts;
	_tmp9_ = tootle_accounts_get_active (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = tootle_request_with_account (_tmp7_, _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = tootle_request_exec (_tmp12_);
	_tmp14_ = _tmp13_;
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (_tmp7_);
	_g_free0 (_tmp5_);
	req = _tmp14_;
	result = (SoupMessage*) req;
	return result;
}

SoupMessage*
tootle_api_notification_reject_follow_request (TootleAPINotification* self)
{
	TootleRequest* req = NULL;
	TootleAPIAccount* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	TootleRequest* _tmp6_;
	TootleRequest* _tmp7_;
	TootleAccounts* _tmp8_;
	TootleInstanceAccount* _tmp9_;
	TootleInstanceAccount* _tmp10_;
	TootleRequest* _tmp11_;
	TootleRequest* _tmp12_;
	TootleRequest* _tmp13_;
	TootleRequest* _tmp14_;
	SoupMessage* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	_tmp1_ = tootle_api_account_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat ("/api/v1/follow_requests/", _tmp3_, "/reject", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = tootle_request_new_POST (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = tootle_accounts;
	_tmp9_ = tootle_accounts_get_active (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = tootle_request_with_account (_tmp7_, _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = tootle_request_exec (_tmp12_);
	_tmp14_ = _tmp13_;
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (_tmp7_);
	_g_free0 (_tmp5_);
	req = _tmp14_;
	result = (SoupMessage*) req;
	return result;
}

TootleAPINotification*
tootle_api_notification_construct (GType object_type)
{
	TootleAPINotification * self = NULL;
	self = (TootleAPINotification*) tootle_entity_construct (object_type);
	return self;
}

TootleAPINotification*
tootle_api_notification_new (void)
{
	return tootle_api_notification_construct (TOOTLE_API_TYPE_NOTIFICATION);
}

const gchar*
tootle_api_notification_get_id (TootleAPINotification* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_id;
	result = _tmp0_;
	return result;
}

void
tootle_api_notification_set_id (TootleAPINotification* self,
                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_notification_get_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_id);
		self->priv->_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_ID_PROPERTY]);
	}
}

TootleAPIAccount*
tootle_api_notification_get_account (TootleAPINotification* self)
{
	TootleAPIAccount* result;
	TootleAPIAccount* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
tootle_api_notification_set_account (TootleAPINotification* self,
                                     TootleAPIAccount* value)
{
	TootleAPIAccount* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_notification_get_account (self);
	if (old_value != value) {
		TootleAPIAccount* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_ACCOUNT_PROPERTY]);
	}
}

TootleAPINotificationType
tootle_api_notification_get_kind (TootleAPINotification* self)
{
	TootleAPINotificationType result;
	TootleAPINotificationType _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_kind;
	result = _tmp0_;
	return result;
}

void
tootle_api_notification_set_kind (TootleAPINotification* self,
                                  TootleAPINotificationType value)
{
	TootleAPINotificationType old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_notification_get_kind (self);
	if (old_value != value) {
		self->priv->_kind = value;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_KIND_PROPERTY]);
	}
}

const gchar*
tootle_api_notification_get_created_at (TootleAPINotification* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_created_at;
	result = _tmp0_;
	return result;
}

void
tootle_api_notification_set_created_at (TootleAPINotification* self,
                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_notification_get_created_at (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_created_at);
		self->priv->_created_at = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_CREATED_AT_PROPERTY]);
	}
}

TootleAPIStatus*
tootle_api_notification_get_status (TootleAPINotification* self)
{
	TootleAPIStatus* result;
	TootleAPIStatus* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_status;
	result = _tmp0_;
	return result;
}

void
tootle_api_notification_set_status (TootleAPINotification* self,
                                    TootleAPIStatus* value)
{
	TootleAPIStatus* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_notification_get_status (self);
	if (old_value != value) {
		TootleAPIStatus* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_status);
		self->priv->_status = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_STATUS_PROPERTY]);
	}
}

static void
tootle_api_notification_class_init (TootleAPINotificationClass * klass,
                                    gpointer klass_data)
{
	tootle_api_notification_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleAPINotification_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_api_notification_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_api_notification_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_api_notification_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_NOTIFICATION_ID_PROPERTY, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_NOTIFICATION_ACCOUNT_PROPERTY, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", TOOTLE_API_TYPE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_NOTIFICATION_KIND_PROPERTY, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_KIND_PROPERTY] = g_param_spec_enum ("kind", "kind", "kind", TOOTLE_API_TYPE_NOTIFICATION_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_NOTIFICATION_CREATED_AT_PROPERTY, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_CREATED_AT_PROPERTY] = g_param_spec_string ("created-at", "created-at", "created-at", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_NOTIFICATION_STATUS_PROPERTY, tootle_api_notification_properties[TOOTLE_API_NOTIFICATION_STATUS_PROPERTY] = g_param_spec_object ("status", "status", "status", TOOTLE_API_TYPE_STATUS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
tootle_api_notification_tootle_widgetizable_interface_init (TootleWidgetizableIface * iface,
                                                            gpointer iface_data)
{
	tootle_api_notification_tootle_widgetizable_parent_iface = g_type_interface_peek_parent (iface);
	iface->to_widget = (GtkWidget* (*) (TootleWidgetizable*, GError**)) tootle_api_notification_real_to_widget;
}

static void
tootle_api_notification_instance_init (TootleAPINotification * self,
                                       gpointer klass)
{
	self->priv = tootle_api_notification_get_instance_private (self);
	self->priv->_status = NULL;
}

static void
tootle_api_notification_finalize (GObject * obj)
{
	TootleAPINotification * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotification);
	_g_free0 (self->priv->_id);
	_g_object_unref0 (self->priv->_account);
	_g_free0 (self->priv->_created_at);
	_g_object_unref0 (self->priv->_status);
	G_OBJECT_CLASS (tootle_api_notification_parent_class)->finalize (obj);
}

static GType
tootle_api_notification_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleAPINotificationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_api_notification_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleAPINotification), 0, (GInstanceInitFunc) tootle_api_notification_instance_init, NULL };
	static const GInterfaceInfo tootle_widgetizable_info = { (GInterfaceInitFunc) tootle_api_notification_tootle_widgetizable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tootle_api_notification_type_id;
	tootle_api_notification_type_id = g_type_register_static (TOOTLE_TYPE_ENTITY, "TootleAPINotification", &g_define_type_info, 0);
	g_type_add_interface_static (tootle_api_notification_type_id, TOOTLE_TYPE_WIDGETIZABLE, &tootle_widgetizable_info);
	TootleAPINotification_private_offset = g_type_add_instance_private (tootle_api_notification_type_id, sizeof (TootleAPINotificationPrivate));
	return tootle_api_notification_type_id;
}

GType
tootle_api_notification_get_type (void)
{
	static volatile gsize tootle_api_notification_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_api_notification_type_id__volatile)) {
		GType tootle_api_notification_type_id;
		tootle_api_notification_type_id = tootle_api_notification_get_type_once ();
		g_once_init_leave (&tootle_api_notification_type_id__volatile, tootle_api_notification_type_id);
	}
	return tootle_api_notification_type_id__volatile;
}

static void
_vala_tootle_api_notification_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	TootleAPINotification * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotification);
	switch (property_id) {
		case TOOTLE_API_NOTIFICATION_ID_PROPERTY:
		g_value_set_string (value, tootle_api_notification_get_id (self));
		break;
		case TOOTLE_API_NOTIFICATION_ACCOUNT_PROPERTY:
		g_value_set_object (value, tootle_api_notification_get_account (self));
		break;
		case TOOTLE_API_NOTIFICATION_KIND_PROPERTY:
		g_value_set_enum (value, tootle_api_notification_get_kind (self));
		break;
		case TOOTLE_API_NOTIFICATION_CREATED_AT_PROPERTY:
		g_value_set_string (value, tootle_api_notification_get_created_at (self));
		break;
		case TOOTLE_API_NOTIFICATION_STATUS_PROPERTY:
		g_value_set_object (value, tootle_api_notification_get_status (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_api_notification_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	TootleAPINotification * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotification);
	switch (property_id) {
		case TOOTLE_API_NOTIFICATION_ID_PROPERTY:
		tootle_api_notification_set_id (self, g_value_get_string (value));
		break;
		case TOOTLE_API_NOTIFICATION_ACCOUNT_PROPERTY:
		tootle_api_notification_set_account (self, g_value_get_object (value));
		break;
		case TOOTLE_API_NOTIFICATION_KIND_PROPERTY:
		tootle_api_notification_set_kind (self, g_value_get_enum (value));
		break;
		case TOOTLE_API_NOTIFICATION_CREATED_AT_PROPERTY:
		tootle_api_notification_set_created_at (self, g_value_get_string (value));
		break;
		case TOOTLE_API_NOTIFICATION_STATUS_PROPERTY:
		tootle_api_notification_set_status (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

