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

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <libsoup/soup.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <json-glib/json-glib.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_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 struct _TubaRequestV2Private TubaRequestV2Private;
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_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;
enum  {
	TUBA_REQUEST_V2_0_PROPERTY,
	TUBA_REQUEST_V2_METHOD_PROPERTY,
	TUBA_REQUEST_V2_URL_PROPERTY,
	TUBA_REQUEST_V2_PRIORITY_PROPERTY,
	TUBA_REQUEST_V2_CANCELLABLE_PROPERTY,
	TUBA_REQUEST_V2_ACCOUNT_PROPERTY,
	TUBA_REQUEST_V2_FORCE_TOKEN_PROPERTY,
	TUBA_REQUEST_V2_NO_AUTH_PROPERTY,
	TUBA_REQUEST_V2_CACHE_PROPERTY,
	TUBA_REQUEST_V2_TRACK_WRITTEN_BODY_DATA_PROPERTY,
	TUBA_REQUEST_V2_HAS_FORM_DATA_PROPERTY,
	TUBA_REQUEST_V2_CTX_PROPERTY,
	TUBA_REQUEST_V2_NUM_PROPERTIES
};
static GParamSpec* tuba_request_v2_properties[TUBA_REQUEST_V2_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 _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define __vala_SoupMultipart_free0(var) ((var == NULL) ? NULL : (var = (_vala_SoupMultipart_free (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _Block58Data Block58Data;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())
#define _soup_message_headers_unref0(var) ((var == NULL) ? NULL : (var = (soup_message_headers_unref (var), NULL)))
#define _g_uri_unref0(var) ((var == NULL) ? NULL : (var = (g_uri_unref (var), NULL)))

#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;
typedef struct _TubaRequestV2ExecData TubaRequestV2ExecData;
typedef struct _Block59Data Block59Data;
enum  {
	TUBA_REQUEST_V2_WROTE_BODY_DATA_SIGNAL,
	TUBA_REQUEST_V2_NUM_SIGNALS
};
static guint tuba_request_v2_signals[TUBA_REQUEST_V2_NUM_SIGNALS] = {0};

struct _TubaRequestV2 {
	GObject parent_instance;
	TubaRequestV2Private * priv;
};

struct _TubaRequestV2Class {
	GObjectClass parent_class;
};

struct _TubaRequestV2Private {
	TubaRequestV2Method _method;
	gchar* _url;
	SoupMessagePriority _priority;
	GCancellable* _cancellable;
	TubaInstanceAccount* _account;
	gchar* _force_token;
	gboolean _no_auth;
	gboolean _cache;
	gboolean _track_written_body_data;
	GHashTable* parameters;
	gchar* _content_type;
	GtkWidget* _ctx;
	SoupMultipart* form_data;
	GBytes* body_bytes;
};

struct _Block58Data {
	int _ref_count_;
	TubaRequestV2* self;
	gchar* final_key;
};

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 _TubaRequestV2ExecData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaRequestV2* self;
	SoupMessageHeaders* response_headers;
	GInputStream* result;
	GCancellable* _tmp0_;
	GCancellable* _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GError* _tmp4_;
	gchar* final_url;
	gchar* _tmp5_;
	SoupMessage* message;
	SoupMultipart* _tmp6_;
	GUri* final_uri;
	const gchar* _tmp7_;
	GUri* _tmp8_;
	TubaRequestV2Method _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GUri* _tmp12_;
	SoupMessage* _tmp13_;
	const gchar* _tmp14_;
	SoupMultipart* _tmp15_;
	SoupMessage* _tmp16_;
	TubaRequestV2Method _tmp17_;
	SoupMessage* _tmp18_;
	TubaRequestV2Method _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gboolean _tmp22_;
	SoupMessage* _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	SoupMessage* _tmp26_;
	SoupMessageHeaders* _tmp27_;
	SoupMessageHeaders* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gboolean _tmp33_;
	TubaInstanceAccount* _tmp34_;
	TubaInstanceAccount* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	SoupMessage* _tmp38_;
	SoupMessageHeaders* _tmp39_;
	SoupMessageHeaders* _tmp40_;
	TubaInstanceAccount* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	SoupMessage* _tmp47_;
	SoupMessageHeaders* _tmp48_;
	SoupMessageHeaders* _tmp49_;
	gboolean _tmp50_;
	SoupMessage* _tmp51_;
	SoupMessage* _tmp52_;
	SoupMessagePriority _tmp53_;
	gboolean _tmp54_;
	const gchar* _tmp55_;
	GBytes* _tmp56_;
	SoupMessage* _tmp57_;
	const gchar* _tmp58_;
	GBytes* _tmp59_;
	GInputStream* _tmp60_;
	TubaNetwork* _tmp61_;
	SoupMessage* _tmp62_;
	SoupMessage* _tmp63_;
	GCancellable* _tmp64_;
	SoupMessageHeaders* _tmp65_;
	GInputStream* _tmp66_;
	GInputStream* _tmp67_;
	GError* _inner_error0_;
};

struct _Block59Data {
	int _ref_count_;
	TubaRequestV2* self;
	gchar* res;
	gint i;
};

static gint TubaRequestV2_private_offset;
static gpointer tuba_request_v2_parent_class = NULL;
VALA_EXTERN TubaNetwork* tuba_network;

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 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 gchar* tuba_request_v2_method_to_string (TubaRequestV2Method self);
static void _g_free0_ (gpointer var);
static void _vala_SoupMultipart_free (SoupMultipart* self);
static void tuba_request_v2_on_wrote_body_data (TubaRequestV2* self,
                                         guint chunk_size);
static void tuba_request_v2_on_ctx_destroy (TubaRequestV2* self);
VALA_EXTERN GCancellable* tuba_request_v2_get_cancellable (TubaRequestV2* self);
VALA_EXTERN void tuba_request_v2_set_ctx (TubaRequestV2* self,
                              GtkWidget* value);
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);
static void tuba_request_v2_set_method (TubaRequestV2* self,
                                 TubaRequestV2Method value);
static void tuba_request_v2_set_url (TubaRequestV2* self,
                              const gchar* value);
VALA_EXTERN void tuba_request_v2_add_parameter (TubaRequestV2* self,
                                    const gchar* key,
                                    const gchar* value);
VALA_EXTERN gboolean tuba_request_v2_remove_parameter (TubaRequestV2* self,
                                           const gchar* key);
static Block58Data* block58_data_ref (Block58Data* _data58_);
static void block58_data_unref (void * _userdata_);
static gboolean __lambda8_ (Block58Data* _data58_,
                     const gchar* p_key,
                     const gchar* p_val);
static gboolean ___lambda8__ghr_func (gconstpointer key,
                               gconstpointer value,
                               gpointer self);
VALA_EXTERN void tuba_request_v2_add_parameter_array (TubaRequestV2* self,
                                          const gchar* key,
                                          gchar** values,
                                          gint values_length1);
VALA_EXTERN void tuba_request_v2_add_form_data (TubaRequestV2* self,
                                    const gchar* name,
                                    const gchar* val);
VALA_EXTERN void tuba_request_v2_add_form_data_file (TubaRequestV2* self,
                                         const gchar* name,
                                         const gchar* mime,
                                         GBytes* buffer);
VALA_EXTERN void tuba_request_v2_set_body (TubaRequestV2* self,
                               const gchar* content_type,
                               GBytes* bytes);
static void tuba_request_v2_set_content_type (TubaRequestV2* self,
                                       const gchar* value);
VALA_EXTERN void tuba_request_v2_set_body_from_json (TubaRequestV2* self,
                                         JsonBuilder* json_builder);
static void _vala_JsonNode_free (JsonNode* self);
static guint8* _vala_array_dup37 (guint8* self,
                           gssize length);
static void tuba_request_v2_exec_data_free (gpointer _data);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
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 gboolean tuba_request_v2_exec_co (TubaRequestV2ExecData* _data_);
VALA_EXTERN void tuba_request_v2_set_cancellable (TubaRequestV2* self,
                                      GCancellable* value);
static gchar* tuba_request_v2_build_final_url (TubaRequestV2* self);
VALA_EXTERN TubaRequestV2Method tuba_request_v2_get_method (TubaRequestV2* self);
VALA_EXTERN gboolean tuba_request_v2_get_track_written_body_data (TubaRequestV2* self);
static void _tuba_request_v2_on_wrote_body_data_soup_message_wrote_body_data (SoupMessage* _sender,
                                                                       guint chunk_size,
                                                                       gpointer self);
VALA_EXTERN gboolean tuba_request_v2_get_no_auth (TubaRequestV2* self);
VALA_EXTERN const gchar* tuba_request_v2_get_force_token (TubaRequestV2* self);
VALA_EXTERN TubaInstanceAccount* tuba_request_v2_get_account (TubaRequestV2* self);
VALA_EXTERN const gchar* tuba_instance_account_get_access_token (TubaInstanceAccount* self);
VALA_EXTERN gboolean tuba_request_v2_get_cache (TubaRequestV2* self);
VALA_EXTERN SoupMessagePriority tuba_request_v2_get_priority (TubaRequestV2* self);
static const gchar* tuba_request_v2_get_content_type (TubaRequestV2* self);
VALA_EXTERN GType tuba_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaNetwork, g_object_unref)
VALA_EXTERN void tuba_network_queue_v2 (TubaNetwork* self,
                            SoupMessage* msg,
                            GCancellable* cancellable,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_);
VALA_EXTERN GInputStream* tuba_network_queue_v2_finish (TubaNetwork* self,
                                            GAsyncResult* _res_,
                                            SoupMessageHeaders** response_headers,
                                            GError** error);
static void tuba_request_v2_exec_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_);
VALA_EXTERN const gchar* tuba_request_v2_get_url (TubaRequestV2* self);
VALA_EXTERN const gchar* tuba_instance_account_get_instance (TubaInstanceAccount* self);
static gchar* tuba_request_v2_parameters_to_string (TubaRequestV2* self);
static Block59Data* block59_data_ref (Block59Data* _data59_);
static void block59_data_unref (void * _userdata_);
static void __lambda9_ (Block59Data* _data59_,
                 const gchar* key,
                 const gchar* val);
static void ___lambda9__gh_func (gconstpointer key,
                          gconstpointer value,
                          gpointer self);
VALA_EXTERN void tuba_request_v2_set_priority (TubaRequestV2* self,
                                   SoupMessagePriority value);
VALA_EXTERN void tuba_request_v2_set_account (TubaRequestV2* self,
                                  TubaInstanceAccount* value);
VALA_EXTERN void tuba_request_v2_set_force_token (TubaRequestV2* self,
                                      const gchar* value);
VALA_EXTERN void tuba_request_v2_set_no_auth (TubaRequestV2* self,
                                  gboolean value);
VALA_EXTERN void tuba_request_v2_set_cache (TubaRequestV2* self,
                                gboolean value);
VALA_EXTERN void tuba_request_v2_set_track_written_body_data (TubaRequestV2* self,
                                                  gboolean value);
VALA_EXTERN gboolean tuba_request_v2_get_has_form_data (TubaRequestV2* self);
static void _tuba_request_v2_on_ctx_destroy_gtk_widget_destroy (GtkWidget* _sender,
                                                         gpointer self);
static void tuba_request_v2_finalize (GObject * obj);
static GType tuba_request_v2_get_type_once (void);
static void _vala_tuba_request_v2_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_tuba_request_v2_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);

static inline gpointer
tuba_request_v2_get_instance_private (TubaRequestV2* self)
{
	return G_STRUCT_MEMBER_P (self, TubaRequestV2_private_offset);
}

gchar*
tuba_request_v2_method_to_string (TubaRequestV2Method self)
{
	gchar* result;
	switch (self) {
		case TUBA_REQUEST_V2_METHOD_GET:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("GET");
			result = _tmp0_;
			return result;
		}
		case TUBA_REQUEST_V2_METHOD_POST:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("POST");
			result = _tmp1_;
			return result;
		}
		case TUBA_REQUEST_V2_METHOD_PUT:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("PUT");
			result = _tmp2_;
			return result;
		}
		case TUBA_REQUEST_V2_METHOD_DELETE:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("DELETE");
			result = _tmp3_;
			return result;
		}
		case TUBA_REQUEST_V2_METHOD_PATCH:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("PATCH");
			result = _tmp4_;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

 G_GNUC_NO_INLINE static GType
tuba_request_v2_method_get_type_once (void)
{
	static const GEnumValue values[] = {{TUBA_REQUEST_V2_METHOD_GET, "TUBA_REQUEST_V2_METHOD_GET", "get"}, {TUBA_REQUEST_V2_METHOD_POST, "TUBA_REQUEST_V2_METHOD_POST", "post"}, {TUBA_REQUEST_V2_METHOD_PUT, "TUBA_REQUEST_V2_METHOD_PUT", "put"}, {TUBA_REQUEST_V2_METHOD_DELETE, "TUBA_REQUEST_V2_METHOD_DELETE", "delete"}, {TUBA_REQUEST_V2_METHOD_PATCH, "TUBA_REQUEST_V2_METHOD_PATCH", "patch"}, {0, NULL, NULL}};
	GType tuba_request_v2_method_type_id;
	tuba_request_v2_method_type_id = g_enum_register_static ("TubaRequestV2Method", values);
	return tuba_request_v2_method_type_id;
}

GType
tuba_request_v2_method_get_type (void)
{
	static GType tuba_request_v2_method_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_request_v2_method_type_id__once)) {
		GType tuba_request_v2_method_type_id;
		tuba_request_v2_method_type_id = tuba_request_v2_method_get_type_once ();
		g_once_init_leave_pointer (&tuba_request_v2_method_type_id__once, tuba_request_v2_method_type_id);
	}
	return tuba_request_v2_method_type_id__once;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_vala_SoupMultipart_free (SoupMultipart* self)
{
	g_boxed_free (soup_multipart_get_type (), self);
}

static void
tuba_request_v2_on_wrote_body_data (TubaRequestV2* self,
                                    guint chunk_size)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, tuba_request_v2_signals[TUBA_REQUEST_V2_WROTE_BODY_DATA_SIGNAL], 0, chunk_size);
}

static void
tuba_request_v2_on_ctx_destroy (TubaRequestV2* self)
{
	GCancellable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_cancellable;
	if (_tmp0_ != NULL) {
		GCancellable* _tmp1_;
		_tmp1_ = self->priv->_cancellable;
		g_cancellable_cancel (_tmp1_);
	}
	tuba_request_v2_set_ctx (self, NULL);
}

TubaRequestV2*
tuba_request_v2_construct (GType object_type,
                           const gchar* url,
                           TubaRequestV2Method method)
{
	TubaRequestV2 * self = NULL;
	g_return_val_if_fail (url != NULL, NULL);
	self = (TubaRequestV2*) g_object_new (object_type, NULL);
	tuba_request_v2_set_method (self, method);
	tuba_request_v2_set_url (self, url);
	return self;
}

TubaRequestV2*
tuba_request_v2_new (const gchar* url,
                     TubaRequestV2Method method)
{
	return tuba_request_v2_construct (TUBA_TYPE_REQUEST_V2, url, method);
}

void
tuba_request_v2_add_parameter (TubaRequestV2* self,
                               const gchar* key,
                               const gchar* value)
{
	GHashTable* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = self->priv->parameters;
	_tmp1_ = g_uri_escape_string (key, "[]", TRUE);
	_tmp2_ = g_uri_escape_string (value, NULL, TRUE);
	g_hash_table_insert (_tmp0_, _tmp1_, _tmp2_);
}

static Block58Data*
block58_data_ref (Block58Data* _data58_)
{
	g_atomic_int_inc (&_data58_->_ref_count_);
	return _data58_;
}

static void
block58_data_unref (void * _userdata_)
{
	Block58Data* _data58_;
	_data58_ = (Block58Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data58_->_ref_count_)) {
		TubaRequestV2* self;
		self = _data58_->self;
		_g_free0 (_data58_->final_key);
		_g_object_unref0 (self);
		g_slice_free (Block58Data, _data58_);
	}
}

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

static gboolean
__lambda8_ (Block58Data* _data58_,
            const gchar* p_key,
            const gchar* p_val)
{
	TubaRequestV2* self;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	gboolean result;
	self = _data58_->self;
	g_return_val_if_fail (p_key != NULL, FALSE);
	g_return_val_if_fail (p_val != NULL, FALSE);
	_tmp1_ = _data58_->final_key;
	if (g_strcmp0 (p_key, _tmp1_) == 0) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = _data58_->final_key;
		_tmp3_ = string_to_string (_tmp2_);
		_tmp4_ = g_strconcat (_tmp3_, "[]", NULL);
		_tmp5_ = _tmp4_;
		_tmp0_ = g_strcmp0 (p_key, _tmp5_) == 0;
		_g_free0 (_tmp5_);
	}
	result = _tmp0_;
	return result;
}

static gboolean
___lambda8__ghr_func (gconstpointer key,
                      gconstpointer value,
                      gpointer self)
{
	gboolean result;
	result = __lambda8_ (self, (const gchar*) key, (const gchar*) value);
	return result;
}

gboolean
tuba_request_v2_remove_parameter (TubaRequestV2* self,
                                  const gchar* key)
{
	Block58Data* _data58_;
	gchar* _tmp0_;
	GHashTable* _tmp1_;
	const gchar* _tmp2_;
	GHashTable* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_data58_ = g_slice_new0 (Block58Data);
	_data58_->_ref_count_ = 1;
	_data58_->self = g_object_ref (self);
	_tmp0_ = g_uri_escape_string (key, "[]", TRUE);
	_data58_->final_key = _tmp0_;
	_tmp1_ = self->priv->parameters;
	_tmp2_ = _data58_->final_key;
	if (!g_hash_table_contains (_tmp1_, _tmp2_)) {
		result = FALSE;
		block58_data_unref (_data58_);
		_data58_ = NULL;
		return result;
	}
	_tmp3_ = self->priv->parameters;
	result = g_hash_table_foreach_remove (_tmp3_, ___lambda8__ghr_func, _data58_) > ((guint) 0);
	block58_data_unref (_data58_);
	_data58_ = NULL;
	return result;
}

void
tuba_request_v2_add_parameter_array (TubaRequestV2* self,
                                     const gchar* key,
                                     gchar** values,
                                     gint values_length1)
{
	gchar* final_key = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	if (values_length1 == 0) {
		return;
	}
	_tmp0_ = g_strdup (key);
	final_key = _tmp0_;
	_tmp1_ = final_key;
	if (!g_str_has_suffix (_tmp1_, "[]")) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = string_to_string (key);
		_tmp3_ = g_strconcat (_tmp2_, "[]", NULL);
		_g_free0 (final_key);
		final_key = _tmp3_;
	}
	{
		gchar** value_collection = NULL;
		gint value_collection_length1 = 0;
		gint _value_collection_size_ = 0;
		gint value_it = 0;
		value_collection = values;
		value_collection_length1 = values_length1;
		for (value_it = 0; value_it < value_collection_length1; value_it = value_it + 1) {
			const gchar* value = NULL;
			value = value_collection[value_it];
			{
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				_tmp4_ = final_key;
				_tmp5_ = value;
				tuba_request_v2_add_parameter (self, _tmp4_, _tmp5_);
			}
		}
	}
	_g_free0 (final_key);
}

void
tuba_request_v2_add_form_data (TubaRequestV2* self,
                               const gchar* name,
                               const gchar* val)
{
	SoupMultipart* _tmp0_;
	SoupMultipart* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (val != NULL);
	_tmp0_ = self->priv->form_data;
	if (_tmp0_ == NULL) {
		SoupMultipart* _tmp1_;
		_tmp1_ = soup_multipart_new (SOUP_FORM_MIME_TYPE_MULTIPART);
		__vala_SoupMultipart_free0 (self->priv->form_data);
		self->priv->form_data = _tmp1_;
	}
	_tmp2_ = self->priv->form_data;
	soup_multipart_append_form_string (_tmp2_, name, val);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

void
tuba_request_v2_add_form_data_file (TubaRequestV2* self,
                                    const gchar* name,
                                    const gchar* mime,
                                    GBytes* buffer)
{
	SoupMultipart* _tmp0_;
	SoupMultipart* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (mime != NULL);
	g_return_if_fail (buffer != NULL);
	_tmp0_ = self->priv->form_data;
	if (_tmp0_ == NULL) {
		SoupMultipart* _tmp1_;
		_tmp1_ = soup_multipart_new (SOUP_FORM_MIME_TYPE_MULTIPART);
		__vala_SoupMultipart_free0 (self->priv->form_data);
		self->priv->form_data = _tmp1_;
	}
	_tmp2_ = self->priv->form_data;
	_tmp3_ = string_replace (mime, "/", ".");
	_tmp4_ = _tmp3_;
	soup_multipart_append_form_file (_tmp2_, name, _tmp4_, mime, buffer);
	_g_free0 (_tmp4_);
}

static gpointer
_g_bytes_ref0 (gpointer self)
{
	return self ? g_bytes_ref (self) : NULL;
}

void
tuba_request_v2_set_body (TubaRequestV2* self,
                          const gchar* content_type,
                          GBytes* bytes)
{
	GBytes* _tmp0_;
	g_return_if_fail (self != NULL);
	tuba_request_v2_set_content_type (self, content_type);
	_tmp0_ = _g_bytes_ref0 (bytes);
	_g_bytes_unref0 (self->priv->body_bytes);
	self->priv->body_bytes = _tmp0_;
}

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

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static guint8*
_vala_array_dup37 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

void
tuba_request_v2_set_body_from_json (TubaRequestV2* self,
                                    JsonBuilder* json_builder)
{
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp0_;
	JsonNode* _tmp1_;
	JsonNode* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	guint8* _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_ = 0;
	guint8* _tmp7_;
	gint _tmp7__length1;
	guint8* _tmp8_;
	gint _tmp8__length1;
	GBytes* _tmp9_;
	GBytes* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (json_builder != NULL);
	_tmp0_ = json_generator_new ();
	generator = _tmp0_;
	_tmp1_ = json_builder_get_root (json_builder);
	_tmp2_ = _tmp1_;
	json_generator_set_root (generator, _tmp2_);
	__vala_JsonNode_free0 (_tmp2_);
	_tmp3_ = json_generator_to_data (generator, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_get_data (_tmp4_, &_tmp6_);
	_tmp5__length1 = _tmp6_;
	_tmp7_ = _tmp5_;
	_tmp7__length1 = _tmp5__length1;
	_tmp8_ = (_tmp7_ != NULL) ? _vala_array_dup37 (_tmp7_, _tmp7__length1) : _tmp7_;
	_tmp8__length1 = _tmp7__length1;
	_tmp9_ = g_bytes_new_take (_tmp8_, _tmp8__length1);
	_tmp10_ = _tmp9_;
	tuba_request_v2_set_body (self, "application/json", _tmp10_);
	_g_bytes_unref0 (_tmp10_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (generator);
}

static void
tuba_request_v2_exec_data_free (gpointer _data)
{
	TubaRequestV2ExecData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (TubaRequestV2ExecData, _data_);
}

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

void
tuba_request_v2_exec (TubaRequestV2* self,
                      GAsyncReadyCallback _callback_,
                      gpointer _user_data_)
{
	TubaRequestV2ExecData* _data_;
	TubaRequestV2* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaRequestV2ExecData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_request_v2_exec_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_request_v2_exec_co (_data_);
}

GInputStream*
tuba_request_v2_exec_finish (TubaRequestV2* self,
                             GAsyncResult* _res_,
                             SoupMessageHeaders** response_headers,
                             GError** error)
{
	GInputStream* result;
	TubaRequestV2ExecData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	if (response_headers) {
		*response_headers = _data_->response_headers;
	} else {
		_soup_message_headers_unref0 (_data_->response_headers);
	}
	_data_->response_headers = NULL;
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
_tuba_request_v2_on_wrote_body_data_soup_message_wrote_body_data (SoupMessage* _sender,
                                                                  guint chunk_size,
                                                                  gpointer self)
{
	tuba_request_v2_on_wrote_body_data ((TubaRequestV2*) self, chunk_size);
}

static void
tuba_request_v2_exec_ready (GObject* source_object,
                            GAsyncResult* _res_,
                            gpointer _user_data_)
{
	TubaRequestV2ExecData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_request_v2_exec_co (_data_);
}

static gboolean
tuba_request_v2_exec_co (TubaRequestV2ExecData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_cancellable;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp1_ = g_cancellable_new ();
		_data_->_tmp2_ = _data_->_tmp1_;
		tuba_request_v2_set_cancellable (_data_->self, _data_->_tmp2_);
		_g_object_unref0 (_data_->_tmp2_);
	} else {
		_data_->_tmp3_ = _data_->self->priv->_cancellable;
		if (g_cancellable_is_cancelled (_data_->_tmp3_)) {
			_data_->_tmp4_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled");
			_data_->_inner_error0_ = _data_->_tmp4_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_soup_message_headers_unref0 (_data_->response_headers);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp5_ = tuba_request_v2_build_final_url (_data_->self);
	_data_->final_url = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->self->priv->form_data;
	if (_data_->_tmp6_ == NULL) {
		_data_->_tmp7_ = _data_->final_url;
		_data_->_tmp8_ = g_uri_parse (_data_->_tmp7_, G_URI_FLAGS_ENCODED_PATH | G_URI_FLAGS_ENCODED_QUERY, &_data_->_inner_error0_);
		_data_->final_uri = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->message);
			_g_free0 (_data_->final_url);
			_soup_message_headers_unref0 (_data_->response_headers);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp9_ = _data_->self->priv->_method;
		_data_->_tmp10_ = tuba_request_v2_method_to_string (_data_->_tmp9_);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp12_ = _data_->final_uri;
		_data_->_tmp13_ = soup_message_new_from_uri (_data_->_tmp11_, _data_->_tmp12_);
		_g_object_unref0 (_data_->message);
		_data_->message = _data_->_tmp13_;
		_g_free0 (_data_->_tmp11_);
		_g_uri_unref0 (_data_->final_uri);
	} else {
		_data_->_tmp14_ = _data_->final_url;
		_data_->_tmp15_ = _data_->self->priv->form_data;
		_data_->_tmp16_ = soup_message_new_from_multipart (_data_->_tmp14_, _data_->_tmp15_);
		_g_object_unref0 (_data_->message);
		_data_->message = _data_->_tmp16_;
		_data_->_tmp17_ = _data_->self->priv->_method;
		if (_data_->_tmp17_ != TUBA_REQUEST_V2_METHOD_POST) {
			_data_->_tmp18_ = _data_->message;
			_data_->_tmp19_ = _data_->self->priv->_method;
			_data_->_tmp20_ = tuba_request_v2_method_to_string (_data_->_tmp19_);
			_data_->_tmp21_ = _data_->_tmp20_;
			soup_message_set_method (_data_->_tmp18_, _data_->_tmp21_);
			_g_free0 (_data_->_tmp21_);
		}
	}
	_data_->_tmp22_ = _data_->self->priv->_track_written_body_data;
	if (_data_->_tmp22_) {
		_data_->_tmp23_ = _data_->message;
		g_signal_connect_object (_data_->_tmp23_, "wrote-body-data", (GCallback) _tuba_request_v2_on_wrote_body_data_soup_message_wrote_body_data, _data_->self, 0);
	}
	_data_->_tmp24_ = _data_->self->priv->_no_auth;
	if (!_data_->_tmp24_) {
		_data_->_tmp25_ = _data_->self->priv->_force_token;
		if (_data_->_tmp25_ != NULL) {
			_data_->_tmp26_ = _data_->message;
			_data_->_tmp27_ = soup_message_get_request_headers (_data_->_tmp26_);
			_data_->_tmp28_ = _data_->_tmp27_;
			_data_->_tmp29_ = _data_->self->priv->_force_token;
			_data_->_tmp30_ = string_to_string (_data_->_tmp29_);
			_data_->_tmp31_ = g_strconcat ("Bearer ", _data_->_tmp30_, NULL);
			_data_->_tmp32_ = _data_->_tmp31_;
			soup_message_headers_append (_data_->_tmp28_, "Authorization", _data_->_tmp32_);
			_g_free0 (_data_->_tmp32_);
		} else {
			_data_->_tmp34_ = _data_->self->priv->_account;
			if (_data_->_tmp34_ != NULL) {
				_data_->_tmp35_ = _data_->self->priv->_account;
				_data_->_tmp36_ = tuba_instance_account_get_access_token (_data_->_tmp35_);
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp33_ = _data_->_tmp37_ != NULL;
			} else {
				_data_->_tmp33_ = FALSE;
			}
			if (_data_->_tmp33_) {
				_data_->_tmp38_ = _data_->message;
				_data_->_tmp39_ = soup_message_get_request_headers (_data_->_tmp38_);
				_data_->_tmp40_ = _data_->_tmp39_;
				_data_->_tmp41_ = _data_->self->priv->_account;
				_data_->_tmp42_ = tuba_instance_account_get_access_token (_data_->_tmp41_);
				_data_->_tmp43_ = _data_->_tmp42_;
				_data_->_tmp44_ = string_to_string (_data_->_tmp43_);
				_data_->_tmp45_ = g_strconcat ("Bearer ", _data_->_tmp44_, NULL);
				_data_->_tmp46_ = _data_->_tmp45_;
				soup_message_headers_append (_data_->_tmp40_, "Authorization", _data_->_tmp46_);
				_g_free0 (_data_->_tmp46_);
			}
		}
	} else {
		_data_->_tmp47_ = _data_->message;
		_data_->_tmp48_ = soup_message_get_request_headers (_data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		soup_message_headers_remove (_data_->_tmp49_, "Authorization");
	}
	_data_->_tmp50_ = _data_->self->priv->_cache;
	if (!_data_->_tmp50_) {
		_data_->_tmp51_ = _data_->message;
		soup_message_disable_feature (_data_->_tmp51_, soup_cache_get_type ());
	}
	_data_->_tmp52_ = _data_->message;
	_data_->_tmp53_ = _data_->self->priv->_priority;
	soup_message_set_priority (_data_->_tmp52_, _data_->_tmp53_);
	_data_->_tmp55_ = _data_->self->priv->_content_type;
	if (_data_->_tmp55_ != NULL) {
		_data_->_tmp56_ = _data_->self->priv->body_bytes;
		_data_->_tmp54_ = _data_->_tmp56_ != NULL;
	} else {
		_data_->_tmp54_ = FALSE;
	}
	if (_data_->_tmp54_) {
		_data_->_tmp57_ = _data_->message;
		_data_->_tmp58_ = _data_->self->priv->_content_type;
		_data_->_tmp59_ = _data_->self->priv->body_bytes;
		soup_message_set_request_body_from_bytes (_data_->_tmp57_, _data_->_tmp58_, _data_->_tmp59_);
	}
	_data_->_tmp61_ = tuba_network;
	_data_->_tmp62_ = _data_->message;
	_data_->_tmp63_ = _g_object_ref0 (_data_->_tmp62_);
	_data_->_tmp64_ = _data_->self->priv->_cancellable;
	_data_->_tmp65_ = NULL;
	_data_->_state_ = 1;
	tuba_network_queue_v2 (_data_->_tmp61_, _data_->_tmp63_, _data_->_tmp64_, tuba_request_v2_exec_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp66_ = tuba_network_queue_v2_finish (_data_->_tmp61_, _data_->_res_, &_data_->_tmp65_, &_data_->_inner_error0_);
	_soup_message_headers_unref0 (_data_->response_headers);
	_data_->response_headers = _data_->_tmp65_;
	_data_->_tmp60_ = _data_->_tmp66_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->message);
		_g_free0 (_data_->final_url);
		_soup_message_headers_unref0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp67_ = _data_->_tmp60_;
	_data_->_tmp60_ = NULL;
	_data_->result = _data_->_tmp67_;
	_g_object_unref0 (_data_->_tmp60_);
	_g_object_unref0 (_data_->message);
	_g_free0 (_data_->final_url);
	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;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gchar*
tuba_request_v2_build_final_url (TubaRequestV2* self)
{
	gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	TubaInstanceAccount* _tmp2_;
	gchar* final_url = NULL;
	gchar* _tmp13_;
	GHashTable* _tmp14_;
	guint _tmp15_;
	guint _tmp16_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp2_ = self->priv->_account;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->_url;
		_tmp1_ = g_str_has_prefix (_tmp3_, "/");
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		TubaInstanceAccount* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp4_ = self->priv->_account;
		_tmp5_ = tuba_instance_account_get_instance (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = string_to_string (_tmp6_);
		_tmp8_ = self->priv->_url;
		_tmp9_ = string_to_string (_tmp8_);
		_tmp10_ = g_strconcat (_tmp7_, _tmp9_, NULL);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp10_;
	} else {
		const gchar* _tmp11_;
		gchar* _tmp12_;
		_tmp11_ = self->priv->_url;
		_tmp12_ = g_strdup (_tmp11_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp12_;
	}
	_tmp13_ = _tmp0_;
	_tmp0_ = NULL;
	final_url = _tmp13_;
	_tmp14_ = self->priv->parameters;
	_tmp15_ = g_hash_table_size (_tmp14_);
	_tmp16_ = _tmp15_;
	if (_tmp16_ > ((guint) 0)) {
		const gchar* _tmp17_ = NULL;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		_tmp18_ = self->priv->_url;
		if (string_contains (_tmp18_, "?")) {
			_tmp17_ = "&";
		} else {
			_tmp17_ = "?";
		}
		_tmp19_ = final_url;
		_tmp20_ = string_to_string (_tmp17_);
		_tmp21_ = tuba_request_v2_parameters_to_string (self);
		_tmp22_ = _tmp21_;
		_tmp23_ = string_to_string (_tmp22_);
		_tmp24_ = g_strconcat (_tmp20_, _tmp23_, NULL);
		_tmp25_ = _tmp24_;
		_tmp26_ = g_strconcat (_tmp19_, _tmp25_, NULL);
		_g_free0 (final_url);
		final_url = _tmp26_;
		_g_free0 (_tmp25_);
		_g_free0 (_tmp22_);
	}
	result = final_url;
	_g_free0 (_tmp0_);
	return result;
}

static Block59Data*
block59_data_ref (Block59Data* _data59_)
{
	g_atomic_int_inc (&_data59_->_ref_count_);
	return _data59_;
}

static void
block59_data_unref (void * _userdata_)
{
	Block59Data* _data59_;
	_data59_ = (Block59Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data59_->_ref_count_)) {
		TubaRequestV2* self;
		self = _data59_->self;
		_g_free0 (_data59_->res);
		_g_object_unref0 (self);
		g_slice_free (Block59Data, _data59_);
	}
}

static void
__lambda9_ (Block59Data* _data59_,
            const gchar* key,
            const gchar* val)
{
	TubaRequestV2* self;
	gint _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GHashTable* _tmp7_;
	guint _tmp8_;
	guint _tmp9_;
	self = _data59_->self;
	g_return_if_fail (key != NULL);
	g_return_if_fail (val != NULL);
	_tmp0_ = _data59_->i;
	_data59_->i = _tmp0_ + 1;
	_tmp1_ = _data59_->res;
	_tmp2_ = string_to_string (key);
	_tmp3_ = string_to_string (val);
	_tmp4_ = g_strconcat (_tmp2_, "=", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat (_tmp1_, _tmp5_, NULL);
	_g_free0 (_data59_->res);
	_data59_->res = _tmp6_;
	_g_free0 (_tmp5_);
	_tmp7_ = self->priv->parameters;
	_tmp8_ = g_hash_table_size (_tmp7_);
	_tmp9_ = _tmp8_;
	if (((guint) _data59_->i) < _tmp9_) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = _data59_->res;
		_tmp11_ = g_strconcat (_tmp10_, "&", NULL);
		_g_free0 (_data59_->res);
		_data59_->res = _tmp11_;
	}
}

static void
___lambda9__gh_func (gconstpointer key,
                     gconstpointer value,
                     gpointer self)
{
	__lambda9_ (self, (const gchar*) key, (const gchar*) value);
}

static gchar*
tuba_request_v2_parameters_to_string (TubaRequestV2* self)
{
	Block59Data* _data59_;
	gchar* _tmp0_;
	GHashTable* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	GHashTable* _tmp6_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data59_ = g_slice_new0 (Block59Data);
	_data59_->_ref_count_ = 1;
	_data59_->self = g_object_ref (self);
	_tmp0_ = g_strdup ("");
	_data59_->res = _tmp0_;
	_tmp1_ = self->priv->parameters;
	_tmp2_ = g_hash_table_size (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == ((guint) 0)) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = _data59_->res;
		_tmp5_ = g_strdup (_tmp4_);
		result = _tmp5_;
		block59_data_unref (_data59_);
		_data59_ = NULL;
		return result;
	}
	_data59_->i = 0;
	_tmp6_ = self->priv->parameters;
	g_hash_table_foreach (_tmp6_, ___lambda9__gh_func, _data59_);
	_tmp7_ = _data59_->res;
	_data59_->res = NULL;
	result = _tmp7_;
	block59_data_unref (_data59_);
	_data59_ = NULL;
	return result;
}

TubaRequestV2Method
tuba_request_v2_get_method (TubaRequestV2* self)
{
	TubaRequestV2Method result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_method;
	return result;
}

static void
tuba_request_v2_set_method (TubaRequestV2* self,
                            TubaRequestV2Method value)
{
	TubaRequestV2Method old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_method (self);
	if (old_value != value) {
		self->priv->_method = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_METHOD_PROPERTY]);
	}
}

const gchar*
tuba_request_v2_get_url (TubaRequestV2* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_url;
	result = _tmp0_;
	return result;
}

static void
tuba_request_v2_set_url (TubaRequestV2* self,
                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_url (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_url);
		self->priv->_url = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_URL_PROPERTY]);
	}
}

SoupMessagePriority
tuba_request_v2_get_priority (TubaRequestV2* self)
{
	SoupMessagePriority result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_priority;
	return result;
}

void
tuba_request_v2_set_priority (TubaRequestV2* self,
                              SoupMessagePriority value)
{
	SoupMessagePriority old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_priority (self);
	if (old_value != value) {
		self->priv->_priority = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_PRIORITY_PROPERTY]);
	}
}

GCancellable*
tuba_request_v2_get_cancellable (TubaRequestV2* self)
{
	GCancellable* result;
	GCancellable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_cancellable;
	result = _tmp0_;
	return result;
}

void
tuba_request_v2_set_cancellable (TubaRequestV2* self,
                                 GCancellable* value)
{
	GCancellable* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_cancellable (self);
	if (old_value != value) {
		GCancellable* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_cancellable);
		self->priv->_cancellable = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_CANCELLABLE_PROPERTY]);
	}
}

TubaInstanceAccount*
tuba_request_v2_get_account (TubaRequestV2* self)
{
	TubaInstanceAccount* result;
	TubaInstanceAccount* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

void
tuba_request_v2_set_account (TubaRequestV2* self,
                             TubaInstanceAccount* value)
{
	TubaInstanceAccount* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_account (self);
	if (old_value != value) {
		TubaInstanceAccount* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_ACCOUNT_PROPERTY]);
	}
}

const gchar*
tuba_request_v2_get_force_token (TubaRequestV2* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_force_token;
	result = _tmp0_;
	return result;
}

void
tuba_request_v2_set_force_token (TubaRequestV2* self,
                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_force_token (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_force_token);
		self->priv->_force_token = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_FORCE_TOKEN_PROPERTY]);
	}
}

gboolean
tuba_request_v2_get_no_auth (TubaRequestV2* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_no_auth;
	return result;
}

void
tuba_request_v2_set_no_auth (TubaRequestV2* self,
                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_no_auth (self);
	if (old_value != value) {
		self->priv->_no_auth = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_NO_AUTH_PROPERTY]);
	}
}

gboolean
tuba_request_v2_get_cache (TubaRequestV2* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_cache;
	return result;
}

void
tuba_request_v2_set_cache (TubaRequestV2* self,
                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_cache (self);
	if (old_value != value) {
		self->priv->_cache = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_CACHE_PROPERTY]);
	}
}

gboolean
tuba_request_v2_get_track_written_body_data (TubaRequestV2* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_track_written_body_data;
	return result;
}

void
tuba_request_v2_set_track_written_body_data (TubaRequestV2* self,
                                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_request_v2_get_track_written_body_data (self);
	if (old_value != value) {
		self->priv->_track_written_body_data = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_TRACK_WRITTEN_BODY_DATA_PROPERTY]);
	}
}

gboolean
tuba_request_v2_get_has_form_data (TubaRequestV2* self)
{
	gboolean result;
	SoupMultipart* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->form_data;
	result = _tmp0_ != NULL;
	return result;
}

static void
_tuba_request_v2_on_ctx_destroy_gtk_widget_destroy (GtkWidget* _sender,
                                                    gpointer self)
{
	tuba_request_v2_on_ctx_destroy ((TubaRequestV2*) self);
}

void
tuba_request_v2_set_ctx (TubaRequestV2* self,
                         GtkWidget* value)
{
	GtkWidget* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_ctx = value;
	_tmp0_ = self->priv->_ctx;
	if (_tmp0_ != NULL) {
		GtkWidget* _tmp1_;
		_tmp1_ = self->priv->_ctx;
		g_signal_connect_object (_tmp1_, "destroy", (GCallback) _tuba_request_v2_on_ctx_destroy_gtk_widget_destroy, self, 0);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_request_v2_properties[TUBA_REQUEST_V2_CTX_PROPERTY]);
}

static const gchar*
tuba_request_v2_get_content_type (TubaRequestV2* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_type;
	result = _tmp0_;
	return result;
}

static void
tuba_request_v2_set_content_type (TubaRequestV2* self,
                                  const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_content_type);
	self->priv->_content_type = _tmp0_;
}

static void
tuba_request_v2_class_init (TubaRequestV2Class * klass,
                            gpointer klass_data)
{
	tuba_request_v2_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaRequestV2_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_request_v2_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_request_v2_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_request_v2_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_METHOD_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_METHOD_PROPERTY] = g_param_spec_enum ("method", "method", "method", TUBA_REQUEST_V2_TYPE_METHOD, TUBA_REQUEST_V2_METHOD_GET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_URL_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_PRIORITY_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_PRIORITY_PROPERTY] = g_param_spec_enum ("priority", "priority", "priority", soup_message_priority_get_type (), SOUP_MESSAGE_PRIORITY_NORMAL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_CANCELLABLE_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_CANCELLABLE_PROPERTY] = g_param_spec_object ("cancellable", "cancellable", "cancellable", g_cancellable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_ACCOUNT_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", TUBA_TYPE_INSTANCE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_FORCE_TOKEN_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_FORCE_TOKEN_PROPERTY] = g_param_spec_string ("force-token", "force-token", "force-token", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_NO_AUTH_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_NO_AUTH_PROPERTY] = g_param_spec_boolean ("no-auth", "no-auth", "no-auth", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_CACHE_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_CACHE_PROPERTY] = g_param_spec_boolean ("cache", "cache", "cache", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_TRACK_WRITTEN_BODY_DATA_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_TRACK_WRITTEN_BODY_DATA_PROPERTY] = g_param_spec_boolean ("track-written-body-data", "track-written-body-data", "track-written-body-data", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_HAS_FORM_DATA_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_HAS_FORM_DATA_PROPERTY] = g_param_spec_boolean ("has-form-data", "has-form-data", "has-form-data", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_REQUEST_V2_CTX_PROPERTY, tuba_request_v2_properties[TUBA_REQUEST_V2_CTX_PROPERTY] = g_param_spec_object ("ctx", "ctx", "ctx", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	tuba_request_v2_signals[TUBA_REQUEST_V2_WROTE_BODY_DATA_SIGNAL] = g_signal_new ("wrote-body-data", TUBA_TYPE_REQUEST_V2, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
}

static void
tuba_request_v2_instance_init (TubaRequestV2 * self,
                               gpointer klass)
{
	GCancellable* _tmp0_;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	GHashTable* _tmp3_;
	self->priv = tuba_request_v2_get_instance_private (self);
	self->priv->_method = TUBA_REQUEST_V2_METHOD_GET;
	self->priv->_priority = SOUP_MESSAGE_PRIORITY_NORMAL;
	_tmp0_ = g_cancellable_new ();
	self->priv->_cancellable = _tmp0_;
	self->priv->_account = NULL;
	self->priv->_force_token = NULL;
	self->priv->_no_auth = FALSE;
	self->priv->_cache = TRUE;
	self->priv->_track_written_body_data = FALSE;
	_tmp1_ = g_str_hash;
	_tmp2_ = g_str_equal;
	_tmp3_ = g_hash_table_new_full (_tmp1_, _tmp2_, _g_free0_, _g_free0_);
	self->priv->parameters = _tmp3_;
	self->priv->_content_type = NULL;
	self->priv->_ctx = NULL;
	self->priv->form_data = NULL;
	self->priv->body_bytes = NULL;
}

static void
tuba_request_v2_finalize (GObject * obj)
{
	TubaRequestV2 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_TYPE_REQUEST_V2, TubaRequestV2);
	_g_free0 (self->priv->_url);
	_g_object_unref0 (self->priv->_cancellable);
	_g_object_unref0 (self->priv->_account);
	_g_free0 (self->priv->_force_token);
	_g_hash_table_unref0 (self->priv->parameters);
	_g_free0 (self->priv->_content_type);
	__vala_SoupMultipart_free0 (self->priv->form_data);
	_g_bytes_unref0 (self->priv->body_bytes);
	G_OBJECT_CLASS (tuba_request_v2_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_request_v2_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaRequestV2Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_request_v2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaRequestV2), 0, (GInstanceInitFunc) tuba_request_v2_instance_init, NULL };
	GType tuba_request_v2_type_id;
	tuba_request_v2_type_id = g_type_register_static (G_TYPE_OBJECT, "TubaRequestV2", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaRequestV2_private_offset = g_type_add_instance_private (tuba_request_v2_type_id, sizeof (TubaRequestV2Private));
	return tuba_request_v2_type_id;
}

GType
tuba_request_v2_get_type (void)
{
	static GType tuba_request_v2_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_request_v2_type_id__once)) {
		GType tuba_request_v2_type_id;
		tuba_request_v2_type_id = tuba_request_v2_get_type_once ();
		g_once_init_leave_pointer (&tuba_request_v2_type_id__once, tuba_request_v2_type_id);
	}
	return tuba_request_v2_type_id__once;
}

static void
_vala_tuba_request_v2_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	TubaRequestV2 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_TYPE_REQUEST_V2, TubaRequestV2);
	switch (property_id) {
		case TUBA_REQUEST_V2_METHOD_PROPERTY:
		g_value_set_enum (value, tuba_request_v2_get_method (self));
		break;
		case TUBA_REQUEST_V2_URL_PROPERTY:
		g_value_set_string (value, tuba_request_v2_get_url (self));
		break;
		case TUBA_REQUEST_V2_PRIORITY_PROPERTY:
		g_value_set_enum (value, tuba_request_v2_get_priority (self));
		break;
		case TUBA_REQUEST_V2_CANCELLABLE_PROPERTY:
		g_value_set_object (value, tuba_request_v2_get_cancellable (self));
		break;
		case TUBA_REQUEST_V2_ACCOUNT_PROPERTY:
		g_value_set_object (value, tuba_request_v2_get_account (self));
		break;
		case TUBA_REQUEST_V2_FORCE_TOKEN_PROPERTY:
		g_value_set_string (value, tuba_request_v2_get_force_token (self));
		break;
		case TUBA_REQUEST_V2_NO_AUTH_PROPERTY:
		g_value_set_boolean (value, tuba_request_v2_get_no_auth (self));
		break;
		case TUBA_REQUEST_V2_CACHE_PROPERTY:
		g_value_set_boolean (value, tuba_request_v2_get_cache (self));
		break;
		case TUBA_REQUEST_V2_TRACK_WRITTEN_BODY_DATA_PROPERTY:
		g_value_set_boolean (value, tuba_request_v2_get_track_written_body_data (self));
		break;
		case TUBA_REQUEST_V2_HAS_FORM_DATA_PROPERTY:
		g_value_set_boolean (value, tuba_request_v2_get_has_form_data (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_request_v2_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	TubaRequestV2 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_TYPE_REQUEST_V2, TubaRequestV2);
	switch (property_id) {
		case TUBA_REQUEST_V2_METHOD_PROPERTY:
		tuba_request_v2_set_method (self, g_value_get_enum (value));
		break;
		case TUBA_REQUEST_V2_URL_PROPERTY:
		tuba_request_v2_set_url (self, g_value_get_string (value));
		break;
		case TUBA_REQUEST_V2_PRIORITY_PROPERTY:
		tuba_request_v2_set_priority (self, g_value_get_enum (value));
		break;
		case TUBA_REQUEST_V2_CANCELLABLE_PROPERTY:
		tuba_request_v2_set_cancellable (self, g_value_get_object (value));
		break;
		case TUBA_REQUEST_V2_ACCOUNT_PROPERTY:
		tuba_request_v2_set_account (self, g_value_get_object (value));
		break;
		case TUBA_REQUEST_V2_FORCE_TOKEN_PROPERTY:
		tuba_request_v2_set_force_token (self, g_value_get_string (value));
		break;
		case TUBA_REQUEST_V2_NO_AUTH_PROPERTY:
		tuba_request_v2_set_no_auth (self, g_value_get_boolean (value));
		break;
		case TUBA_REQUEST_V2_CACHE_PROPERTY:
		tuba_request_v2_set_cache (self, g_value_get_boolean (value));
		break;
		case TUBA_REQUEST_V2_TRACK_WRITTEN_BODY_DATA_PROPERTY:
		tuba_request_v2_set_track_written_body_data (self, g_value_get_boolean (value));
		break;
		case TUBA_REQUEST_V2_CTX_PROPERTY:
		tuba_request_v2_set_ctx (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

