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

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_TYPE_WIDGETIZABLE (tuba_widgetizable_get_type ())
#define TUBA_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizable))
#define TUBA_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_WIDGETIZABLE))
#define TUBA_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizableIface))

typedef struct _TubaWidgetizable TubaWidgetizable;
typedef struct _TubaWidgetizableIface TubaWidgetizableIface;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;
typedef struct _TubaEntityPrivate TubaEntityPrivate;

#define TUBA_API_TYPE_SEARCH_RESULTS (tuba_api_search_results_get_type ())
#define TUBA_API_SEARCH_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_SEARCH_RESULTS, TubaAPISearchResults))
#define TUBA_API_SEARCH_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_SEARCH_RESULTS, TubaAPISearchResultsClass))
#define TUBA_API_IS_SEARCH_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_SEARCH_RESULTS))
#define TUBA_API_IS_SEARCH_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_SEARCH_RESULTS))
#define TUBA_API_SEARCH_RESULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_SEARCH_RESULTS, TubaAPISearchResultsClass))

typedef struct _TubaAPISearchResults TubaAPISearchResults;
typedef struct _TubaAPISearchResultsClass TubaAPISearchResultsClass;
typedef struct _TubaAPISearchResultsPrivate TubaAPISearchResultsPrivate;

#define TUBA_API_TYPE_STATUS (tuba_api_status_get_type ())
#define TUBA_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_STATUS, TubaAPIStatus))
#define TUBA_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_STATUS, TubaAPIStatusClass))
#define TUBA_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_STATUS))
#define TUBA_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_STATUS))
#define TUBA_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_STATUS, TubaAPIStatusClass))

typedef struct _TubaAPIStatus TubaAPIStatus;
typedef struct _TubaAPIStatusClass TubaAPIStatusClass;

#define TUBA_API_TYPE_TAG (tuba_api_tag_get_type ())
#define TUBA_API_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_TAG, TubaAPITag))
#define TUBA_API_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_TAG, TubaAPITagClass))
#define TUBA_API_IS_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_TAG))
#define TUBA_API_IS_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_TAG))
#define TUBA_API_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_TAG, TubaAPITagClass))

typedef struct _TubaAPITag TubaAPITag;
typedef struct _TubaAPITagClass TubaAPITagClass;
enum  {
	TUBA_API_SEARCH_RESULTS_0_PROPERTY,
	TUBA_API_SEARCH_RESULTS_ACCOUNTS_PROPERTY,
	TUBA_API_SEARCH_RESULTS_STATUSES_PROPERTY,
	TUBA_API_SEARCH_RESULTS_HASHTAGS_PROPERTY,
	TUBA_API_SEARCH_RESULTS_COLLECTIONS_PROPERTY,
	TUBA_API_SEARCH_RESULTS_NUM_PROPERTIES
};
static GParamSpec* tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_API_TYPE_COLLECTION (tuba_api_collection_get_type ())
#define TUBA_API_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_COLLECTION, TubaAPICollection))
#define TUBA_API_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_COLLECTION, TubaAPICollectionClass))
#define TUBA_API_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_COLLECTION))
#define TUBA_API_IS_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_COLLECTION))
#define TUBA_API_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_COLLECTION, TubaAPICollectionClass))

typedef struct _TubaAPICollection TubaAPICollection;
typedef struct _TubaAPICollectionClass TubaAPICollectionClass;

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))

#define TUBA_TYPE_REQUEST_V2 (tuba_request_v2_get_type ())
#define TUBA_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2))
#define TUBA_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))
#define TUBA_IS_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_REQUEST_V2))
#define TUBA_IS_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_REQUEST_V2))
#define TUBA_REQUEST_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))

typedef struct _TubaRequestV2 TubaRequestV2;
typedef struct _TubaRequestV2Class TubaRequestV2Class;
typedef enum  {
	TUBA_REQUEST_V2_METHOD_GET,
	TUBA_REQUEST_V2_METHOD_POST,
	TUBA_REQUEST_V2_METHOD_PUT,
	TUBA_REQUEST_V2_METHOD_DELETE,
	TUBA_REQUEST_V2_METHOD_PATCH
} TubaRequestV2Method;

#define TUBA_REQUEST_V2_TYPE_METHOD (tuba_request_v2_method_get_type ())

#define TUBA_TYPE_NETWORK (tuba_network_get_type ())
#define TUBA_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_NETWORK, TubaNetwork))
#define TUBA_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_NETWORK, TubaNetworkClass))
#define TUBA_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_NETWORK))
#define TUBA_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_NETWORK))
#define TUBA_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_NETWORK, TubaNetworkClass))

typedef struct _TubaNetwork TubaNetwork;
typedef struct _TubaNetworkClass TubaNetworkClass;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _TubaApiSearchResultsRequestData TubaApiSearchResultsRequestData;

struct _TubaWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TubaWidgetizable* self);
	void (*open) (TubaWidgetizable* self);
	void (*resolve_open) (TubaWidgetizable* self, TubaInstanceAccount* account);
};

struct _TubaEntity {
	GObject parent_instance;
	TubaEntityPrivate * priv;
};

struct _TubaEntityClass {
	GObjectClass parent_class;
	gboolean (*is_local) (TubaEntity* self, TubaInstanceAccount* account);
	GType (*deserialize_array_type) (TubaEntity* self, const gchar* prop);
};

struct _TubaAPISearchResults {
	TubaEntity parent_instance;
	TubaAPISearchResultsPrivate * priv;
};

struct _TubaAPISearchResultsClass {
	TubaEntityClass parent_class;
};

struct _TubaAPISearchResultsPrivate {
	GeeArrayList* _accounts;
	GeeArrayList* _statuses;
	GeeArrayList* _hashtags;
	GeeArrayList* _collections;
};

typedef enum  {
	TUBA_OOPSIE_USER,
	TUBA_OOPSIE_PARSING,
	TUBA_OOPSIE_INSTANCE,
	TUBA_OOPSIE_INTERNAL,
	TUBA_OOPSIE_HTTP_401 = 401,
	TUBA_OOPSIE_HTTP_403 = 403,
	TUBA_OOPSIE_HTTP_404 = 404,
	TUBA_OOPSIE_HTTP_410 = 410,
	TUBA_OOPSIE_HTTP_422 = 422,
	TUBA_OOPSIE_HTTP_429 = 429,
	TUBA_OOPSIE_HTTP_500 = 500,
	TUBA_OOPSIE_HTTP_503 = 503
} TubaOopsie;
#define TUBA_OOPSIE tuba_oopsie_quark ()

struct _TubaApiSearchResultsRequestData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* q;
	TubaInstanceAccount* account;
	TubaAPISearchResults* result;
	TubaRequestV2* req;
	TubaInstanceAccount* _tmp0_;
	TubaRequestV2* _tmp1_;
	TubaRequestV2* _tmp2_;
	TubaRequestV2* _tmp3_;
	GInputStream* in_stream;
	TubaRequestV2* _tmp4_;
	GInputStream* _tmp5_;
	JsonParser* parser;
	GInputStream* _tmp6_;
	JsonParser* _tmp7_;
	TubaAPISearchResults* _tmp8_;
	TubaNetwork* _tmp9_;
	JsonParser* _tmp10_;
	JsonNode* _tmp11_;
	JsonNode* _tmp12_;
	TubaAPISearchResults* _tmp13_;
	TubaAPISearchResults* _tmp14_;
	TubaAPISearchResults* _tmp15_;
	GError* _inner_error0_;
};

static gint TubaAPISearchResults_private_offset;
static gpointer tuba_api_search_results_parent_class = NULL;
VALA_EXTERN TubaNetwork* tuba_network;

VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN GType tuba_widgetizable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetizable, g_object_unref)
VALA_EXTERN GType tuba_api_search_results_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPISearchResults, g_object_unref)
VALA_EXTERN GType tuba_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIStatus, g_object_unref)
VALA_EXTERN GType tuba_api_tag_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPITag, g_object_unref)
VALA_EXTERN GType tuba_entity_deserialize_array_type (TubaEntity* self,
                                          const gchar* prop);
static GType tuba_api_search_results_real_deserialize_array_type (TubaEntity* base,
                                                           const gchar* prop);
VALA_EXTERN GType tuba_api_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPICollection, g_object_unref)
VALA_EXTERN TubaAPISearchResults* tuba_api_search_results_from (JsonNode* node,
                                                    GError** error);
VALA_EXTERN TubaEntity* tuba_entity_from_json (GType type,
                                   JsonNode* node,
                                   GError** error);
VALA_EXTERN TubaEntity* tuba_api_search_results_first (TubaAPISearchResults* self,
                                           GError** error);
VALA_EXTERN GeeArrayList* tuba_api_search_results_get_accounts (TubaAPISearchResults* self);
VALA_EXTERN GeeArrayList* tuba_api_search_results_get_statuses (TubaAPISearchResults* self);
VALA_EXTERN GeeArrayList* tuba_api_search_results_get_hashtags (TubaAPISearchResults* self);
VALA_EXTERN GeeArrayList* tuba_api_search_results_get_collections (TubaAPISearchResults* self);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
static void tuba_api_search_results_request_data_free (gpointer _data);
VALA_EXTERN void tuba_api_search_results_request (const gchar* q,
                                      TubaInstanceAccount* account,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN TubaAPISearchResults* tuba_api_search_results_request_finish (GAsyncResult* _res_,
                                                              GError** error);
static gboolean tuba_api_search_results_request_co (TubaApiSearchResultsRequestData* _data_);
VALA_EXTERN GType tuba_request_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequestV2, g_object_unref)
VALA_EXTERN GType tuba_request_v2_method_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaRequestV2* tuba_request_v2_new (const gchar* url,
                                    TubaRequestV2Method method);
VALA_EXTERN TubaRequestV2* tuba_request_v2_construct (GType object_type,
                                          const gchar* url,
                                          TubaRequestV2Method method);
VALA_EXTERN void tuba_request_v2_set_account (TubaRequestV2* self,
                                  TubaInstanceAccount* value);
VALA_EXTERN void tuba_request_v2_add_parameter (TubaRequestV2* self,
                                    const gchar* key,
                                    const gchar* value);
VALA_EXTERN void tuba_request_v2_exec (TubaRequestV2* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
VALA_EXTERN GInputStream* tuba_request_v2_exec_finish (TubaRequestV2* self,
                                           GAsyncResult* _res_,
                                           SoupMessageHeaders** response_headers,
                                           GError** error);
static void tuba_api_search_results_request_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
VALA_EXTERN void tuba_network_get_parser_from_inputstream_async (GInputStream* in_stream,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN JsonParser* tuba_network_get_parser_from_inputstream_finish (GAsyncResult* _res_,
                                                             GError** error);
VALA_EXTERN GType tuba_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaNetwork, g_object_unref)
VALA_EXTERN JsonNode* tuba_network_parse_node (TubaNetwork* self,
                                   JsonParser* parser);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN TubaAPISearchResults* tuba_api_search_results_new (void);
VALA_EXTERN TubaAPISearchResults* tuba_api_search_results_construct (GType object_type);
VALA_EXTERN TubaEntity* tuba_entity_new (void);
VALA_EXTERN TubaEntity* tuba_entity_construct (GType object_type);
VALA_EXTERN void tuba_api_search_results_set_accounts (TubaAPISearchResults* self,
                                           GeeArrayList* value);
VALA_EXTERN void tuba_api_search_results_set_statuses (TubaAPISearchResults* self,
                                           GeeArrayList* value);
VALA_EXTERN void tuba_api_search_results_set_hashtags (TubaAPISearchResults* self,
                                           GeeArrayList* value);
VALA_EXTERN void tuba_api_search_results_set_collections (TubaAPISearchResults* self,
                                              GeeArrayList* value);
static void tuba_api_search_results_finalize (GObject * obj);
static GType tuba_api_search_results_get_type_once (void);
static void _vala_tuba_api_search_results_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_tuba_api_search_results_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);

static inline gpointer
tuba_api_search_results_get_instance_private (TubaAPISearchResults* self)
{
	return G_STRUCT_MEMBER_P (self, TubaAPISearchResults_private_offset);
}

static GType
tuba_api_search_results_real_deserialize_array_type (TubaEntity* base,
                                                     const gchar* prop)
{
	TubaAPISearchResults * self;
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	static GQuark _tmp1_label3 = 0;
	GType result;
	self = (TubaAPISearchResults*) base;
	g_return_val_if_fail (prop != NULL, G_TYPE_INVALID);
	_tmp0_ = prop;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("accounts")))) {
		switch (0) {
			default:
			{
				result = TUBA_API_TYPE_ACCOUNT;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("statuses")))) {
		switch (0) {
			default:
			{
				result = TUBA_API_TYPE_STATUS;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("hashtags")))) {
		switch (0) {
			default:
			{
				result = TUBA_API_TYPE_TAG;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("collections")))) {
		switch (0) {
			default:
			{
				result = TUBA_API_TYPE_COLLECTION;
				return result;
			}
		}
	}
	result = TUBA_ENTITY_CLASS (tuba_api_search_results_parent_class)->deserialize_array_type (G_TYPE_CHECK_INSTANCE_CAST (self, TUBA_TYPE_ENTITY, TubaEntity), prop);
	return result;
}

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

TubaAPISearchResults*
tuba_api_search_results_from (JsonNode* node,
                              GError** error)
{
	TubaEntity* _tmp0_ = NULL;
	TubaEntity* _tmp1_;
	TubaAPISearchResults* _tmp2_;
	GError* _inner_error0_ = NULL;
	TubaAPISearchResults* result;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp1_ = tuba_entity_from_json (TUBA_API_TYPE_SEARCH_RESULTS, node, &_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp2_ = _g_object_ref0 (TUBA_API_IS_SEARCH_RESULTS (_tmp0_) ? ((TubaAPISearchResults*) _tmp0_) : NULL);
	result = _tmp2_;
	_g_object_unref0 (_tmp0_);
	return result;
}

TubaEntity*
tuba_api_search_results_first (TubaAPISearchResults* self,
                               GError** error)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GError* _inner_error0_ = NULL;
	TubaEntity* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_accounts;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ > 0) {
		GeeArrayList* _tmp3_;
		gpointer _tmp4_;
		_tmp3_ = self->priv->_accounts;
		_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) _tmp3_, 0);
		result = (TubaEntity*) ((TubaAPIAccount*) _tmp4_);
		return result;
	} else {
		GeeArrayList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = self->priv->_statuses;
		_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		if (_tmp7_ > 0) {
			GeeArrayList* _tmp8_;
			gpointer _tmp9_;
			_tmp8_ = self->priv->_statuses;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, 0);
			result = (TubaEntity*) ((TubaAPIStatus*) _tmp9_);
			return result;
		} else {
			GeeArrayList* _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			_tmp10_ = self->priv->_hashtags;
			_tmp11_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp10_);
			_tmp12_ = _tmp11_;
			if (_tmp12_ > 0) {
				GeeArrayList* _tmp13_;
				gpointer _tmp14_;
				_tmp13_ = self->priv->_hashtags;
				_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, 0);
				result = (TubaEntity*) ((TubaAPITag*) _tmp14_);
				return result;
			} else {
				gboolean _tmp15_ = FALSE;
				GeeArrayList* _tmp16_;
				_tmp16_ = self->priv->_collections;
				if (_tmp16_ != NULL) {
					GeeArrayList* _tmp17_;
					gint _tmp18_;
					gint _tmp19_;
					_tmp17_ = self->priv->_collections;
					_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
					_tmp19_ = _tmp18_;
					_tmp15_ = _tmp19_ > 0;
				} else {
					_tmp15_ = FALSE;
				}
				if (_tmp15_) {
					GeeArrayList* _tmp20_;
					gpointer _tmp21_;
					_tmp20_ = self->priv->_collections;
					_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, 0);
					result = (TubaEntity*) ((TubaAPITag*) _tmp21_);
					return result;
				} else {
					GError* _tmp22_;
					_tmp22_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INTERNAL, _ ("Search returned no results"));
					_inner_error0_ = _tmp22_;
					g_propagate_error (error, _inner_error0_);
					return NULL;
				}
			}
		}
	}
}

static void
tuba_api_search_results_request_data_free (gpointer _data)
{
	TubaApiSearchResultsRequestData* _data_;
	_data_ = _data;
	_g_free0 (_data_->q);
	_g_object_unref0 (_data_->account);
	_g_object_unref0 (_data_->result);
	g_slice_free (TubaApiSearchResultsRequestData, _data_);
}

void
tuba_api_search_results_request (const gchar* q,
                                 TubaInstanceAccount* account,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	TubaApiSearchResultsRequestData* _data_;
	gchar* _tmp0_;
	TubaInstanceAccount* _tmp1_;
	g_return_if_fail (q != NULL);
	g_return_if_fail (account != NULL);
	_data_ = g_slice_new0 (TubaApiSearchResultsRequestData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_api_search_results_request_data_free);
	_tmp0_ = g_strdup (q);
	_g_free0 (_data_->q);
	_data_->q = _tmp0_;
	_tmp1_ = _g_object_ref0 (account);
	_g_object_unref0 (_data_->account);
	_data_->account = _tmp1_;
	tuba_api_search_results_request_co (_data_);
}

TubaAPISearchResults*
tuba_api_search_results_request_finish (GAsyncResult* _res_,
                                        GError** error)
{
	TubaAPISearchResults* result;
	TubaApiSearchResultsRequestData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
tuba_api_search_results_request_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	TubaApiSearchResultsRequestData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_api_search_results_request_co (_data_);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gboolean
tuba_api_search_results_request_co (TubaApiSearchResultsRequestData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _g_object_ref0 (_data_->account);
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = tuba_request_v2_new ("/api/v2/search", TUBA_REQUEST_V2_METHOD_GET);
	tuba_request_v2_set_account (_data_->_tmp1_, _data_->_tmp0_);
	_g_object_unref0 (_data_->_tmp0_);
	_data_->req = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->req;
	tuba_request_v2_add_parameter (_data_->_tmp2_, "resolve", "true");
	_data_->_tmp3_ = _data_->req;
	tuba_request_v2_add_parameter (_data_->_tmp3_, "q", _data_->q);
	_data_->_tmp4_ = _data_->req;
	_data_->_state_ = 1;
	tuba_request_v2_exec (_data_->_tmp4_, tuba_api_search_results_request_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp5_ = tuba_request_v2_exec_finish (_data_->_tmp4_, _data_->_res_, NULL, &_data_->_inner_error0_);
	_data_->in_stream = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = _data_->in_stream;
	_data_->_state_ = 2;
	tuba_network_get_parser_from_inputstream_async (_data_->_tmp6_, NULL, tuba_api_search_results_request_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp7_ = tuba_network_get_parser_from_inputstream_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->parser = _data_->_tmp7_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp9_ = tuba_network;
	_data_->_tmp10_ = _data_->parser;
	_data_->_tmp11_ = tuba_network_parse_node (_data_->_tmp9_, _data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = tuba_api_search_results_from (_data_->_tmp12_, &_data_->_inner_error0_);
	_data_->_tmp14_ = _data_->_tmp13_;
	__vala_JsonNode_free0 (_data_->_tmp12_);
	_data_->_tmp8_ = _data_->_tmp14_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp15_ = _data_->_tmp8_;
	_data_->_tmp8_ = NULL;
	_data_->result = _data_->_tmp15_;
	_g_object_unref0 (_data_->_tmp8_);
	_g_object_unref0 (_data_->parser);
	_g_object_unref0 (_data_->in_stream);
	_g_object_unref0 (_data_->req);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

TubaAPISearchResults*
tuba_api_search_results_construct (GType object_type)
{
	TubaAPISearchResults * self = NULL;
	self = (TubaAPISearchResults*) tuba_entity_construct (object_type);
	return self;
}

TubaAPISearchResults*
tuba_api_search_results_new (void)
{
	return tuba_api_search_results_construct (TUBA_API_TYPE_SEARCH_RESULTS);
}

GeeArrayList*
tuba_api_search_results_get_accounts (TubaAPISearchResults* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_accounts;
	result = _tmp0_;
	return result;
}

void
tuba_api_search_results_set_accounts (TubaAPISearchResults* self,
                                      GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_search_results_get_accounts (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_accounts);
		self->priv->_accounts = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_ACCOUNTS_PROPERTY]);
	}
}

GeeArrayList*
tuba_api_search_results_get_statuses (TubaAPISearchResults* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_statuses;
	result = _tmp0_;
	return result;
}

void
tuba_api_search_results_set_statuses (TubaAPISearchResults* self,
                                      GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_search_results_get_statuses (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_statuses);
		self->priv->_statuses = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_STATUSES_PROPERTY]);
	}
}

GeeArrayList*
tuba_api_search_results_get_hashtags (TubaAPISearchResults* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_hashtags;
	result = _tmp0_;
	return result;
}

void
tuba_api_search_results_set_hashtags (TubaAPISearchResults* self,
                                      GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_search_results_get_hashtags (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_hashtags);
		self->priv->_hashtags = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_HASHTAGS_PROPERTY]);
	}
}

GeeArrayList*
tuba_api_search_results_get_collections (TubaAPISearchResults* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_collections;
	result = _tmp0_;
	return result;
}

void
tuba_api_search_results_set_collections (TubaAPISearchResults* self,
                                         GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_search_results_get_collections (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_collections);
		self->priv->_collections = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_COLLECTIONS_PROPERTY]);
	}
}

static void
tuba_api_search_results_class_init (TubaAPISearchResultsClass * klass,
                                    gpointer klass_data)
{
	tuba_api_search_results_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaAPISearchResults_private_offset);
	((TubaEntityClass *) klass)->deserialize_array_type = (GType (*) (TubaEntity*, const gchar*)) tuba_api_search_results_real_deserialize_array_type;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_api_search_results_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_api_search_results_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_api_search_results_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_SEARCH_RESULTS_ACCOUNTS_PROPERTY, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_ACCOUNTS_PROPERTY] = g_param_spec_object ("accounts", "accounts", "accounts", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_SEARCH_RESULTS_STATUSES_PROPERTY, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_STATUSES_PROPERTY] = g_param_spec_object ("statuses", "statuses", "statuses", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_SEARCH_RESULTS_HASHTAGS_PROPERTY, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_HASHTAGS_PROPERTY] = g_param_spec_object ("hashtags", "hashtags", "hashtags", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_SEARCH_RESULTS_COLLECTIONS_PROPERTY, tuba_api_search_results_properties[TUBA_API_SEARCH_RESULTS_COLLECTIONS_PROPERTY] = g_param_spec_object ("collections", "collections", "collections", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
tuba_api_search_results_instance_init (TubaAPISearchResults * self,
                                       gpointer klass)
{
	self->priv = tuba_api_search_results_get_instance_private (self);
	self->priv->_collections = NULL;
}

static void
tuba_api_search_results_finalize (GObject * obj)
{
	TubaAPISearchResults * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_API_TYPE_SEARCH_RESULTS, TubaAPISearchResults);
	_g_object_unref0 (self->priv->_accounts);
	_g_object_unref0 (self->priv->_statuses);
	_g_object_unref0 (self->priv->_hashtags);
	_g_object_unref0 (self->priv->_collections);
	G_OBJECT_CLASS (tuba_api_search_results_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_api_search_results_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaAPISearchResultsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_api_search_results_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaAPISearchResults), 0, (GInstanceInitFunc) tuba_api_search_results_instance_init, NULL };
	GType tuba_api_search_results_type_id;
	tuba_api_search_results_type_id = g_type_register_static (TUBA_TYPE_ENTITY, "TubaAPISearchResults", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaAPISearchResults_private_offset = g_type_add_instance_private (tuba_api_search_results_type_id, sizeof (TubaAPISearchResultsPrivate));
	return tuba_api_search_results_type_id;
}

GType
tuba_api_search_results_get_type (void)
{
	static GType tuba_api_search_results_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_api_search_results_type_id__once)) {
		GType tuba_api_search_results_type_id;
		tuba_api_search_results_type_id = tuba_api_search_results_get_type_once ();
		g_once_init_leave_pointer (&tuba_api_search_results_type_id__once, tuba_api_search_results_type_id);
	}
	return tuba_api_search_results_type_id__once;
}

static void
_vala_tuba_api_search_results_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	TubaAPISearchResults * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_API_TYPE_SEARCH_RESULTS, TubaAPISearchResults);
	switch (property_id) {
		case TUBA_API_SEARCH_RESULTS_ACCOUNTS_PROPERTY:
		g_value_set_object (value, tuba_api_search_results_get_accounts (self));
		break;
		case TUBA_API_SEARCH_RESULTS_STATUSES_PROPERTY:
		g_value_set_object (value, tuba_api_search_results_get_statuses (self));
		break;
		case TUBA_API_SEARCH_RESULTS_HASHTAGS_PROPERTY:
		g_value_set_object (value, tuba_api_search_results_get_hashtags (self));
		break;
		case TUBA_API_SEARCH_RESULTS_COLLECTIONS_PROPERTY:
		g_value_set_object (value, tuba_api_search_results_get_collections (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_api_search_results_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	TubaAPISearchResults * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_API_TYPE_SEARCH_RESULTS, TubaAPISearchResults);
	switch (property_id) {
		case TUBA_API_SEARCH_RESULTS_ACCOUNTS_PROPERTY:
		tuba_api_search_results_set_accounts (self, g_value_get_object (value));
		break;
		case TUBA_API_SEARCH_RESULTS_STATUSES_PROPERTY:
		tuba_api_search_results_set_statuses (self, g_value_get_object (value));
		break;
		case TUBA_API_SEARCH_RESULTS_HASHTAGS_PROPERTY:
		tuba_api_search_results_set_hashtags (self, g_value_get_object (value));
		break;
		case TUBA_API_SEARCH_RESULTS_COLLECTIONS_PROPERTY:
		tuba_api_search_results_set_collections (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

