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

#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.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 PROTON_PLUS_MODELS_TYPE_RUNNER (proton_plus_models_runner_get_type ())
#define PROTON_PLUS_MODELS_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_RUNNER, ProtonPlusModelsRunner))
#define PROTON_PLUS_MODELS_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_RUNNER, ProtonPlusModelsRunnerClass))
#define PROTON_PLUS_MODELS_IS_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_RUNNER))
#define PROTON_PLUS_MODELS_IS_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_RUNNER))
#define PROTON_PLUS_MODELS_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_RUNNER, ProtonPlusModelsRunnerClass))

typedef struct _ProtonPlusModelsRunner ProtonPlusModelsRunner;
typedef struct _ProtonPlusModelsRunnerClass ProtonPlusModelsRunnerClass;
typedef struct _ProtonPlusModelsRunnerPrivate ProtonPlusModelsRunnerPrivate;

#define PROTON_PLUS_MODELS_TYPE_BASE_RELEASE (proton_plus_models_base_release_get_type ())
#define PROTON_PLUS_MODELS_BASE_RELEASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_BASE_RELEASE, ProtonPlusModelsBaseRelease))
#define PROTON_PLUS_MODELS_BASE_RELEASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_BASE_RELEASE, ProtonPlusModelsBaseReleaseClass))
#define PROTON_PLUS_MODELS_IS_BASE_RELEASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_BASE_RELEASE))
#define PROTON_PLUS_MODELS_IS_BASE_RELEASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_BASE_RELEASE))
#define PROTON_PLUS_MODELS_BASE_RELEASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_BASE_RELEASE, ProtonPlusModelsBaseReleaseClass))

typedef struct _ProtonPlusModelsBaseRelease ProtonPlusModelsBaseRelease;
typedef struct _ProtonPlusModelsBaseReleaseClass ProtonPlusModelsBaseReleaseClass;

#define PROTON_PLUS_MODELS_TYPE_RELEASE (proton_plus_models_release_get_type ())
#define PROTON_PLUS_MODELS_RELEASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_RELEASE, ProtonPlusModelsRelease))
#define PROTON_PLUS_MODELS_RELEASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_RELEASE, ProtonPlusModelsReleaseClass))
#define PROTON_PLUS_MODELS_IS_RELEASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_RELEASE))
#define PROTON_PLUS_MODELS_IS_RELEASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_RELEASE))
#define PROTON_PLUS_MODELS_RELEASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_RELEASE, ProtonPlusModelsReleaseClass))

typedef struct _ProtonPlusModelsRelease ProtonPlusModelsRelease;
typedef struct _ProtonPlusModelsReleaseClass ProtonPlusModelsReleaseClass;
typedef enum  {
	PROTON_PLUS_RETURN_CODE_UNKNOWN_ERROR,
	PROTON_PLUS_RETURN_CODE_RELEASES_LOADED,
	PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE,
	PROTON_PLUS_RETURN_CODE_RUNNERS_UPDATED,
	PROTON_PLUS_RETURN_CODE_RUNNER_UPDATED,
	PROTON_PLUS_RETURN_CODE_VALID_REQUEST,
	PROTON_PLUS_RETURN_CODE_CONNECTION_ISSUE,
	PROTON_PLUS_RETURN_CODE_CONNECTION_REFUSED,
	PROTON_PLUS_RETURN_CODE_CONNECTION_UNKNOWN,
	PROTON_PLUS_RETURN_CODE_API_LIMIT_REACHED,
	PROTON_PLUS_RETURN_CODE_INVALID_ACCESS_TOKEN
} ProtonPlusReturnCode;

#define PROTON_PLUS_TYPE_RETURN_CODE (proton_plus_return_code_get_type ())

#define PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC (proton_plus_models_runners_basic_get_type ())
#define PROTON_PLUS_MODELS_RUNNERS_BASIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC, ProtonPlusModelsRunnersBasic))
#define PROTON_PLUS_MODELS_RUNNERS_BASIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC, ProtonPlusModelsRunnersBasicClass))
#define PROTON_PLUS_MODELS_RUNNERS_IS_BASIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC))
#define PROTON_PLUS_MODELS_RUNNERS_IS_BASIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC))
#define PROTON_PLUS_MODELS_RUNNERS_BASIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC, ProtonPlusModelsRunnersBasicClass))

typedef struct _ProtonPlusModelsRunnersBasic ProtonPlusModelsRunnersBasic;
typedef struct _ProtonPlusModelsRunnersBasicClass ProtonPlusModelsRunnersBasicClass;
typedef struct _ProtonPlusModelsRunnersBasicPrivate ProtonPlusModelsRunnersBasicPrivate;

#define PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO (proton_plus_models_runners_forgejo_get_type ())
#define PROTON_PLUS_MODELS_RUNNERS_FORGEJO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO, ProtonPlusModelsRunnersForgejo))
#define PROTON_PLUS_MODELS_RUNNERS_FORGEJO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO, ProtonPlusModelsRunnersForgejoClass))
#define PROTON_PLUS_MODELS_RUNNERS_IS_FORGEJO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO))
#define PROTON_PLUS_MODELS_RUNNERS_IS_FORGEJO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO))
#define PROTON_PLUS_MODELS_RUNNERS_FORGEJO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO, ProtonPlusModelsRunnersForgejoClass))

typedef struct _ProtonPlusModelsRunnersForgejo ProtonPlusModelsRunnersForgejo;
typedef struct _ProtonPlusModelsRunnersForgejoClass ProtonPlusModelsRunnersForgejoClass;
typedef struct _ProtonPlusModelsRunnersForgejoPrivate ProtonPlusModelsRunnersForgejoPrivate;
enum  {
	PROTON_PLUS_MODELS_RUNNERS_FORGEJO_0_PROPERTY,
	PROTON_PLUS_MODELS_RUNNERS_FORGEJO_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_runners_forgejo_properties[PROTON_PLUS_MODELS_RUNNERS_FORGEJO_NUM_PROPERTIES];
typedef enum  {
	PROTON_PLUS_UTILS_WEB_GET_TYPE_OTHER,
	PROTON_PLUS_UTILS_WEB_GET_TYPE_GITHUB,
	PROTON_PLUS_UTILS_WEB_GET_TYPE_GITLAB,
	PROTON_PLUS_UTILS_WEB_GET_TYPE_FORGEJO,
	PROTON_PLUS_UTILS_WEB_GET_TYPE_STEAMTINKERLAUNCH
} ProtonPlusUtilsWebGetType;

#define PROTON_PLUS_UTILS_WEB_TYPE_GET_TYPE (proton_plus_utils_web_get_type_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))

#define PROTON_PLUS_MODELS_RELEASES_TYPE_BASIC (proton_plus_models_releases_basic_get_type ())
#define PROTON_PLUS_MODELS_RELEASES_BASIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_RELEASES_TYPE_BASIC, ProtonPlusModelsReleasesBasic))
#define PROTON_PLUS_MODELS_RELEASES_BASIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_RELEASES_TYPE_BASIC, ProtonPlusModelsReleasesBasicClass))
#define PROTON_PLUS_MODELS_RELEASES_IS_BASIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_RELEASES_TYPE_BASIC))
#define PROTON_PLUS_MODELS_RELEASES_IS_BASIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_RELEASES_TYPE_BASIC))
#define PROTON_PLUS_MODELS_RELEASES_BASIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_RELEASES_TYPE_BASIC, ProtonPlusModelsReleasesBasicClass))

typedef struct _ProtonPlusModelsReleasesBasic ProtonPlusModelsReleasesBasic;
typedef struct _ProtonPlusModelsReleasesBasicClass ProtonPlusModelsReleasesBasicClass;
typedef struct _ProtonPlusModelsRunnersForgejoLoadData ProtonPlusModelsRunnersForgejoLoadData;

struct _ProtonPlusModelsRunner {
	GObject parent_instance;
	ProtonPlusModelsRunnerPrivate * priv;
	GList* releases;
};

struct _ProtonPlusModelsRunnerClass {
	GObjectClass parent_class;
	void (*load) (ProtonPlusModelsRunner* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	ProtonPlusReturnCode (*load_finish) (ProtonPlusModelsRunner* self, GAsyncResult* _res_, GList** releases);
};

struct _ProtonPlusModelsRunnersBasic {
	ProtonPlusModelsRunner parent_instance;
	ProtonPlusModelsRunnersBasicPrivate * priv;
};

struct _ProtonPlusModelsRunnersBasicClass {
	ProtonPlusModelsRunnerClass parent_class;
	gchar* (*get_directory_name) (ProtonPlusModelsRunnersBasic* self, const gchar* release_name);
};

struct _ProtonPlusModelsRunnersForgejo {
	ProtonPlusModelsRunnersBasic parent_instance;
	ProtonPlusModelsRunnersForgejoPrivate * priv;
};

struct _ProtonPlusModelsRunnersForgejoClass {
	ProtonPlusModelsRunnersBasicClass parent_class;
};

struct _ProtonPlusModelsRunnersForgejoLoadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsRunnersForgejo* self;
	GList* releases;
	ProtonPlusReturnCode result;
	gchar* response;
	ProtonPlusReturnCode code;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	ProtonPlusUtilsWebGetType _tmp6_;
	ProtonPlusUtilsWebGetType _tmp7_;
	gchar* _tmp8_;
	ProtonPlusReturnCode _tmp9_;
	ProtonPlusReturnCode _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	JsonNode* root_node;
	const gchar* _tmp13_;
	JsonNode* _tmp14_;
	gboolean _tmp15_;
	JsonNode* _tmp16_;
	JsonNode* _tmp17_;
	JsonArray* root_array;
	JsonNode* _tmp18_;
	JsonArray* _tmp19_;
	JsonArray* _tmp20_;
	JsonArray* _tmp21_;
	gint i;
	gboolean _tmp22_;
	gint _tmp23_;
	JsonArray* _tmp24_;
	JsonObject* object;
	JsonArray* _tmp25_;
	JsonObject* _tmp26_;
	JsonObject* _tmp27_;
	gchar* title;
	JsonObject* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* description;
	JsonObject* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* release_date;
	JsonObject* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* page_url;
	JsonObject* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	JsonArray* assets_array;
	JsonObject* _tmp40_;
	JsonArray* _tmp41_;
	JsonArray* _tmp42_;
	JsonArray* _tmp43_;
	JsonArray* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	JsonObject* link_object;
	JsonArray* _tmp47_;
	gint _tmp48_;
	gint _tmp49_;
	JsonObject* _tmp50_;
	JsonObject* _tmp51_;
	gchar* download_url;
	JsonObject* _tmp52_;
	const gchar* _tmp53_;
	gchar* _tmp54_;
	gint64 download_size;
	JsonObject* _tmp55_;
	ProtonPlusModelsReleasesBasic* release;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	const gchar* _tmp60_;
	ProtonPlusModelsReleasesBasic* _tmp61_;
	ProtonPlusModelsReleasesBasic* _tmp62_;
	ProtonPlusModelsRelease* _tmp63_;
	ProtonPlusModelsReleasesBasic* _tmp64_;
	ProtonPlusModelsRelease* _tmp65_;
	JsonArray* _tmp66_;
};

static gpointer proton_plus_models_runners_forgejo_parent_class = NULL;

VALA_EXTERN GType proton_plus_models_runner_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsRunner, g_object_unref)
VALA_EXTERN GType proton_plus_models_base_release_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsBaseRelease, g_object_unref)
VALA_EXTERN GType proton_plus_models_release_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsRelease, g_object_unref)
VALA_EXTERN GType proton_plus_return_code_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType proton_plus_models_runners_basic_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsRunnersBasic, g_object_unref)
VALA_EXTERN GType proton_plus_models_runners_forgejo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsRunnersForgejo, g_object_unref)
VALA_EXTERN void proton_plus_models_runner_load (ProtonPlusModelsRunner* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_models_runner_load_finish (ProtonPlusModelsRunner* self,
                                                            GAsyncResult* _res_,
                                                            GList** releases);
VALA_EXTERN ProtonPlusModelsRunnersForgejo* proton_plus_models_runners_forgejo_new (void);
VALA_EXTERN ProtonPlusModelsRunnersForgejo* proton_plus_models_runners_forgejo_construct (GType object_type);
VALA_EXTERN ProtonPlusModelsRunnersBasic* proton_plus_models_runners_basic_construct (GType object_type);
VALA_EXTERN GType proton_plus_utils_web_get_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void proton_plus_models_runner_set_get_type (ProtonPlusModelsRunner* self,
                                             ProtonPlusUtilsWebGetType value);
static void proton_plus_models_runners_forgejo_real_load_data_free (gpointer _data);
static void proton_plus_models_runners_forgejo_real_load (ProtonPlusModelsRunner* base,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static gboolean proton_plus_models_runners_forgejo_real_load_co (ProtonPlusModelsRunnersForgejoLoadData* _data_);
VALA_EXTERN void proton_plus_utils_web_get_request (const gchar* uri,
                                        ProtonPlusUtilsWebGetType get_type,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_utils_web_get_request_finish (GAsyncResult* _res_,
                                                               gchar** response);
VALA_EXTERN const gchar* proton_plus_models_runners_basic_get_endpoint (ProtonPlusModelsRunnersBasic* self);
VALA_EXTERN gint proton_plus_models_runners_basic_get_page (ProtonPlusModelsRunnersBasic* self);
VALA_EXTERN ProtonPlusUtilsWebGetType proton_plus_models_runner_get_get_type (ProtonPlusModelsRunner* self);
static void proton_plus_models_runners_forgejo_load_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
VALA_EXTERN void proton_plus_models_runners_basic_set_page (ProtonPlusModelsRunnersBasic* self,
                                                gint value);
VALA_EXTERN JsonNode* proton_plus_utils_parser_get_node_from_json (const gchar* json);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN gint proton_plus_models_runners_basic_get_asset_position (ProtonPlusModelsRunnersBasic* self);
VALA_EXTERN GType proton_plus_models_releases_basic_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsReleasesBasic, g_object_unref)
VALA_EXTERN ProtonPlusModelsReleasesBasic* proton_plus_models_releases_basic_new_github (ProtonPlusModelsRunnersBasic* runner,
                                                                             const gchar* title,
                                                                             const gchar* description,
                                                                             const gchar* release_date,
                                                                             gint64 download_size,
                                                                             const gchar* download_url,
                                                                             const gchar* page_url);
VALA_EXTERN ProtonPlusModelsReleasesBasic* proton_plus_models_releases_basic_construct_github (GType object_type,
                                                                                   ProtonPlusModelsRunnersBasic* runner,
                                                                                   const gchar* title,
                                                                                   const gchar* description,
                                                                                   const gchar* release_date,
                                                                                   gint64 download_size,
                                                                                   const gchar* download_url,
                                                                                   const gchar* page_url);
VALA_EXTERN void proton_plus_models_runner_set_has_more (ProtonPlusModelsRunner* self,
                                             gboolean value);
static GType proton_plus_models_runners_forgejo_get_type_once (void);

ProtonPlusModelsRunnersForgejo*
proton_plus_models_runners_forgejo_construct (GType object_type)
{
	ProtonPlusModelsRunnersForgejo * self = NULL;
	self = (ProtonPlusModelsRunnersForgejo*) proton_plus_models_runners_basic_construct (object_type);
	proton_plus_models_runner_set_get_type ((ProtonPlusModelsRunner*) self, PROTON_PLUS_UTILS_WEB_GET_TYPE_FORGEJO);
	return self;
}

ProtonPlusModelsRunnersForgejo*
proton_plus_models_runners_forgejo_new (void)
{
	return proton_plus_models_runners_forgejo_construct (PROTON_PLUS_MODELS_RUNNERS_TYPE_FORGEJO);
}

static void
proton_plus_models_runners_forgejo_real_load_data_free (gpointer _data)
{
	ProtonPlusModelsRunnersForgejoLoadData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsRunnersForgejoLoadData, _data_);
}

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

static void
proton_plus_models_runners_forgejo_real_load (ProtonPlusModelsRunner* base,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	ProtonPlusModelsRunnersForgejo * self;
	ProtonPlusModelsRunnersForgejoLoadData* _data_;
	ProtonPlusModelsRunnersForgejo* _tmp0_;
	self = (ProtonPlusModelsRunnersForgejo*) base;
	_data_ = g_slice_new0 (ProtonPlusModelsRunnersForgejoLoadData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_runners_forgejo_real_load_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_runners_forgejo_real_load_co (_data_);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static ProtonPlusReturnCode
proton_plus_models_runners_forgejo_load_finish (ProtonPlusModelsRunner* base,
                                                GAsyncResult* _res_,
                                                GList** releases)
{
	ProtonPlusReturnCode result;
	ProtonPlusModelsRunnersForgejoLoadData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (releases) {
		*releases = _data_->releases;
	} else {
		(_data_->releases == NULL) ? NULL : (_data_->releases = (_g_list_free__g_object_unref0_ (_data_->releases), NULL));
	}
	_data_->releases = NULL;
	result = _data_->result;
	return result;
}

static void
proton_plus_models_runners_forgejo_load_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	ProtonPlusModelsRunnersForgejoLoadData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_runners_forgejo_real_load_co (_data_);
}

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

static gpointer
_json_array_ref0 (gpointer self)
{
	return self ? json_array_ref (self) : NULL;
}

static gpointer
_json_object_ref0 (gpointer self)
{
	return self ? json_object_ref (self) : NULL;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
proton_plus_models_runners_forgejo_real_load_co (ProtonPlusModelsRunnersForgejoLoadData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	(_data_->releases == NULL) ? NULL : (_data_->releases = (_g_list_free__g_object_unref0_ (_data_->releases), NULL));
	_data_->releases = NULL;
	_data_->_tmp0_ = proton_plus_models_runners_basic_get_endpoint ((ProtonPlusModelsRunnersBasic*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = proton_plus_models_runners_basic_get_page ((ProtonPlusModelsRunnersBasic*) _data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = g_strdup_printf ("%s?limit=25&page=%i", _data_->_tmp1_, _data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = proton_plus_models_runner_get_get_type ((ProtonPlusModelsRunner*) _data_->self);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = NULL;
	_data_->_state_ = 1;
	proton_plus_utils_web_get_request (_data_->_tmp5_, _data_->_tmp7_, proton_plus_models_runners_forgejo_load_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = proton_plus_utils_web_get_request_finish (_data_->_res_, &_data_->_tmp8_);
	_g_free0 (_data_->response);
	_data_->response = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->_tmp9_;
	_g_free0 (_data_->_tmp5_);
	_data_->code = _data_->_tmp10_;
	if (_data_->code != PROTON_PLUS_RETURN_CODE_VALID_REQUEST) {
		_data_->result = _data_->code;
		_g_free0 (_data_->response);
		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;
	}
	_data_->_tmp11_ = proton_plus_models_runners_basic_get_page ((ProtonPlusModelsRunnersBasic*) _data_->self);
	_data_->_tmp12_ = _data_->_tmp11_;
	proton_plus_models_runners_basic_set_page ((ProtonPlusModelsRunnersBasic*) _data_->self, _data_->_tmp12_ + 1);
	_data_->_tmp13_ = _data_->response;
	_data_->_tmp14_ = proton_plus_utils_parser_get_node_from_json (_data_->_tmp13_);
	_data_->root_node = _data_->_tmp14_;
	_data_->_tmp16_ = _data_->root_node;
	if (_data_->_tmp16_ == NULL) {
		_data_->_tmp15_ = TRUE;
	} else {
		_data_->_tmp17_ = _data_->root_node;
		_data_->_tmp15_ = json_node_get_node_type (_data_->_tmp17_) != JSON_NODE_ARRAY;
	}
	if (_data_->_tmp15_) {
		_data_->result = PROTON_PLUS_RETURN_CODE_UNKNOWN_ERROR;
		__vala_JsonNode_free0 (_data_->root_node);
		_g_free0 (_data_->response);
		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;
	}
	_data_->_tmp18_ = _data_->root_node;
	_data_->_tmp19_ = json_node_get_array (_data_->_tmp18_);
	_data_->_tmp20_ = _json_array_ref0 (_data_->_tmp19_);
	_data_->root_array = _data_->_tmp20_;
	_data_->_tmp21_ = _data_->root_array;
	if (_data_->_tmp21_ == NULL) {
		_data_->result = PROTON_PLUS_RETURN_CODE_UNKNOWN_ERROR;
		_json_array_unref0 (_data_->root_array);
		__vala_JsonNode_free0 (_data_->root_node);
		_g_free0 (_data_->response);
		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;
	}
	{
		_data_->i = 0;
		{
			_data_->_tmp22_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp22_) {
					_data_->_tmp23_ = _data_->i;
					_data_->i = _data_->_tmp23_ + 1;
				}
				_data_->_tmp22_ = FALSE;
				_data_->_tmp24_ = _data_->root_array;
				if (!(((guint) _data_->i) < json_array_get_length (_data_->_tmp24_))) {
					break;
				}
				_data_->_tmp25_ = _data_->root_array;
				_data_->_tmp26_ = json_array_get_object_element (_data_->_tmp25_, (guint) _data_->i);
				_data_->_tmp27_ = _json_object_ref0 (_data_->_tmp26_);
				_data_->object = _data_->_tmp27_;
				_data_->_tmp28_ = _data_->object;
				_data_->_tmp29_ = json_object_get_string_member (_data_->_tmp28_, "tag_name");
				_data_->_tmp30_ = g_strdup (_data_->_tmp29_);
				_data_->title = _data_->_tmp30_;
				_data_->_tmp31_ = _data_->object;
				_data_->_tmp32_ = json_object_get_string_member (_data_->_tmp31_, "body");
				_data_->_tmp33_ = string_strip (_data_->_tmp32_);
				_data_->description = _data_->_tmp33_;
				_data_->_tmp34_ = _data_->object;
				_data_->_tmp35_ = json_object_get_string_member (_data_->_tmp34_, "created_at");
				_data_->_tmp36_ = g_strdup (_data_->_tmp35_);
				_data_->release_date = _data_->_tmp36_;
				_data_->_tmp37_ = _data_->object;
				_data_->_tmp38_ = json_object_get_string_member (_data_->_tmp37_, "html_url");
				_data_->_tmp39_ = g_strdup (_data_->_tmp38_);
				_data_->page_url = _data_->_tmp39_;
				_data_->_tmp40_ = _data_->object;
				_data_->_tmp41_ = json_object_get_array_member (_data_->_tmp40_, "assets");
				_data_->_tmp42_ = _json_array_ref0 (_data_->_tmp41_);
				_data_->assets_array = _data_->_tmp42_;
				_data_->_tmp43_ = _data_->assets_array;
				if (_data_->_tmp43_ == NULL) {
					_json_array_unref0 (_data_->assets_array);
					_g_free0 (_data_->page_url);
					_g_free0 (_data_->release_date);
					_g_free0 (_data_->description);
					_g_free0 (_data_->title);
					_json_object_unref0 (_data_->object);
					continue;
				}
				_data_->_tmp44_ = _data_->assets_array;
				_data_->_tmp45_ = proton_plus_models_runners_basic_get_asset_position ((ProtonPlusModelsRunnersBasic*) _data_->self);
				_data_->_tmp46_ = _data_->_tmp45_;
				if ((json_array_get_length (_data_->_tmp44_) - 1) >= ((guint) _data_->_tmp46_)) {
					_data_->_tmp47_ = _data_->assets_array;
					_data_->_tmp48_ = proton_plus_models_runners_basic_get_asset_position ((ProtonPlusModelsRunnersBasic*) _data_->self);
					_data_->_tmp49_ = _data_->_tmp48_;
					_data_->_tmp50_ = json_array_get_object_element (_data_->_tmp47_, (guint) _data_->_tmp49_);
					_data_->_tmp51_ = _json_object_ref0 (_data_->_tmp50_);
					_data_->link_object = _data_->_tmp51_;
					_data_->_tmp52_ = _data_->link_object;
					_data_->_tmp53_ = json_object_get_string_member (_data_->_tmp52_, "browser_download_url");
					_data_->_tmp54_ = g_strdup (_data_->_tmp53_);
					_data_->download_url = _data_->_tmp54_;
					_data_->_tmp55_ = _data_->link_object;
					_data_->download_size = json_object_get_int_member (_data_->_tmp55_, "size");
					_data_->_tmp56_ = _data_->title;
					_data_->_tmp57_ = _data_->description;
					_data_->_tmp58_ = _data_->release_date;
					_data_->_tmp59_ = _data_->download_url;
					_data_->_tmp60_ = _data_->page_url;
					_data_->_tmp61_ = proton_plus_models_releases_basic_new_github ((ProtonPlusModelsRunnersBasic*) _data_->self, _data_->_tmp56_, _data_->_tmp57_, _data_->_tmp58_, _data_->download_size, _data_->_tmp59_, _data_->_tmp60_);
					_data_->release = _data_->_tmp61_;
					_data_->_tmp62_ = _data_->release;
					_data_->_tmp63_ = _g_object_ref0 ((ProtonPlusModelsRelease*) _data_->_tmp62_);
					_data_->releases = g_list_append (_data_->releases, _data_->_tmp63_);
					_data_->_tmp64_ = _data_->release;
					_data_->_tmp65_ = _g_object_ref0 ((ProtonPlusModelsRelease*) _data_->_tmp64_);
					((ProtonPlusModelsRunner*) _data_->self)->releases = g_list_append (((ProtonPlusModelsRunner*) _data_->self)->releases, _data_->_tmp65_);
					_g_object_unref0 (_data_->release);
					_g_free0 (_data_->download_url);
					_json_object_unref0 (_data_->link_object);
				}
				_json_array_unref0 (_data_->assets_array);
				_g_free0 (_data_->page_url);
				_g_free0 (_data_->release_date);
				_g_free0 (_data_->description);
				_g_free0 (_data_->title);
				_json_object_unref0 (_data_->object);
			}
		}
	}
	_data_->_tmp66_ = _data_->root_array;
	proton_plus_models_runner_set_has_more ((ProtonPlusModelsRunner*) _data_->self, json_array_get_length (_data_->_tmp66_) == ((guint) 25));
	_data_->result = PROTON_PLUS_RETURN_CODE_RELEASES_LOADED;
	_json_array_unref0 (_data_->root_array);
	__vala_JsonNode_free0 (_data_->root_node);
	_g_free0 (_data_->response);
	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 void
proton_plus_models_runners_forgejo_class_init (ProtonPlusModelsRunnersForgejoClass * klass,
                                               gpointer klass_data)
{
	proton_plus_models_runners_forgejo_parent_class = g_type_class_peek_parent (klass);
	((ProtonPlusModelsRunnerClass *) klass)->load = (void (*) (ProtonPlusModelsRunner*, GAsyncReadyCallback, gpointer)) proton_plus_models_runners_forgejo_real_load;
	((ProtonPlusModelsRunnerClass *) klass)->load_finish = (ProtonPlusReturnCode (*) (ProtonPlusModelsRunner*, GAsyncResult*, GList**)) proton_plus_models_runners_forgejo_load_finish;
}

static void
proton_plus_models_runners_forgejo_instance_init (ProtonPlusModelsRunnersForgejo * self,
                                                  gpointer klass)
{
}

static GType
proton_plus_models_runners_forgejo_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsRunnersForgejoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_runners_forgejo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsRunnersForgejo), 0, (GInstanceInitFunc) proton_plus_models_runners_forgejo_instance_init, NULL };
	GType proton_plus_models_runners_forgejo_type_id;
	proton_plus_models_runners_forgejo_type_id = g_type_register_static (PROTON_PLUS_MODELS_RUNNERS_TYPE_BASIC, "ProtonPlusModelsRunnersForgejo", &g_define_type_info, 0);
	return proton_plus_models_runners_forgejo_type_id;
}

GType
proton_plus_models_runners_forgejo_get_type (void)
{
	static volatile gsize proton_plus_models_runners_forgejo_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_runners_forgejo_type_id__once)) {
		GType proton_plus_models_runners_forgejo_type_id;
		proton_plus_models_runners_forgejo_type_id = proton_plus_models_runners_forgejo_get_type_once ();
		g_once_init_leave (&proton_plus_models_runners_forgejo_type_id__once, proton_plus_models_runners_forgejo_type_id);
	}
	return proton_plus_models_runners_forgejo_type_id__once;
}

