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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

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

#define SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL "https://api.todoist.com/api/v1/sync"
#define SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE _ ("Todoist has updated their API. Please reconnect your account in Prefer" \
"ences to continue syncing.")
#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

enum  {
	SERVICES_TODOIST_ITEMS_0_PROPERTY,
	SERVICES_TODOIST_ITEMS_NUM_PROPERTIES
};
static GParamSpec* services_todoist_items_properties[SERVICES_TODOIST_ITEMS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ServicesTodoistItemsAddData ServicesTodoistItemsAddData;
typedef struct _ServicesTodoistItemsUpdateData ServicesTodoistItemsUpdateData;
typedef struct _ServicesTodoistItemsDeleteData ServicesTodoistItemsDeleteData;
typedef struct _ServicesTodoistItemsCloseItemData ServicesTodoistItemsCloseItemData;
typedef struct _ServicesTodoistItemsCompleteItemData ServicesTodoistItemsCompleteItemData;
typedef struct _ServicesTodoistItemsMoveItemData ServicesTodoistItemsMoveItemData;
typedef struct _ServicesTodoistItemsUpdateItemsData ServicesTodoistItemsUpdateItemsData;

struct _ServicesTodoistItemsPrivate {
	SoupSession* session;
};

struct _ServicesTodoistItemsAddData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	ObjectsBaseObject* object;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsSource* _tmp1_;
	ObjectsSource* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gchar* temp_id;
	Util* _tmp6_;
	Util* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* uuid;
	Util* _tmp10_;
	Util* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* id;
	gchar* json;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	SoupMessage* message;
	SoupMessage* _tmp17_;
	SoupMessage* _tmp18_;
	SoupMessageHeaders* _tmp19_;
	SoupMessageHeaders* _tmp20_;
	ObjectsSource* _tmp21_;
	ObjectsSource* _tmp22_;
	ObjectsSourceTodoistData* _tmp23_;
	ObjectsSourceTodoistData* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	SoupMessage* _tmp29_;
	const gchar* _tmp30_;
	guint8* _tmp31_;
	gint _tmp31__length1;
	gint _tmp32_;
	guint8* _tmp33_;
	gint _tmp33__length1;
	GBytes* _tmp34_;
	GBytes* _tmp35_;
	GBytes* stream;
	SoupSession* _tmp36_;
	SoupMessage* _tmp37_;
	GBytes* _tmp38_;
	JsonParser* parser;
	JsonParser* _tmp39_;
	JsonParser* _tmp40_;
	GBytes* _tmp41_;
	gsize _tmp42_;
	guint8* _tmp43_;
	ServicesTodoist* _tmp44_;
	ServicesTodoist* _tmp45_;
	SoupMessage* _tmp46_;
	guint _tmp47_;
	guint _tmp48_;
	gboolean _tmp49_;
	HttpResponse* _tmp50_;
	JsonParser* _tmp51_;
	JsonNode* _tmp52_;
	SoupMessage* _tmp53_;
	guint _tmp54_;
	guint _tmp55_;
	ServicesTodoist* _tmp56_;
	ServicesTodoist* _tmp57_;
	SoupMessage* _tmp58_;
	guint _tmp59_;
	guint _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	JsonObject* sync_status;
	JsonParser* _tmp63_;
	JsonNode* _tmp64_;
	JsonObject* _tmp65_;
	JsonObject* _tmp66_;
	JsonObject* _tmp67_;
	JsonNode* uuid_member;
	JsonObject* _tmp68_;
	const gchar* _tmp69_;
	JsonNode* _tmp70_;
	JsonNode* _tmp71_;
	JsonNode* _tmp72_;
	ObjectsSource* _tmp73_;
	ObjectsSource* _tmp74_;
	ObjectsSourceTodoistData* _tmp75_;
	ObjectsSourceTodoistData* _tmp76_;
	JsonParser* _tmp77_;
	JsonNode* _tmp78_;
	JsonObject* _tmp79_;
	const gchar* _tmp80_;
	ObjectsSource* _tmp81_;
	ObjectsSource* _tmp82_;
	GDateTime* _tmp83_;
	GDateTime* _tmp84_;
	gchar* _tmp85_;
	gchar* _tmp86_;
	ObjectsSource* _tmp87_;
	ObjectsSource* _tmp88_;
	JsonParser* _tmp89_;
	JsonNode* _tmp90_;
	JsonObject* _tmp91_;
	JsonObject* _tmp92_;
	const gchar* _tmp93_;
	const gchar* _tmp94_;
	gchar* _tmp95_;
	HttpResponse* _tmp96_;
	HttpResponse* _tmp97_;
	const gchar* _tmp98_;
	HttpResponse* _tmp99_;
	JsonObject* _tmp100_;
	const gchar* _tmp101_;
	JsonObject* _tmp102_;
	const gchar* _tmp103_;
	JsonObject* _tmp104_;
	const gchar* _tmp105_;
	JsonObject* _tmp106_;
	JsonObject* _tmp107_;
	const gchar* _tmp108_;
	JsonObject* _tmp109_;
	const gchar* _tmp110_;
	GError* e;
	ServicesTodoist* _tmp111_;
	ServicesTodoist* _tmp112_;
	SoupMessage* _tmp113_;
	guint _tmp114_;
	guint _tmp115_;
	gboolean _tmp116_;
	HttpResponse* _tmp117_;
	GError* _tmp118_;
	const gchar* _tmp119_;
	SoupMessage* _tmp120_;
	guint _tmp121_;
	guint _tmp122_;
	GError* _tmp123_;
	const gchar* _tmp124_;
	Util* _tmp125_;
	Util* _tmp126_;
	gchar* _tmp127_;
	ObjectsQueue* queue;
	ObjectsQueue* _tmp128_;
	ObjectsQueue* _tmp129_;
	const gchar* _tmp130_;
	ObjectsQueue* _tmp131_;
	const gchar* _tmp132_;
	ObjectsQueue* _tmp133_;
	const gchar* _tmp134_;
	ObjectsQueue* _tmp135_;
	const gchar* _tmp136_;
	const gchar* _tmp137_;
	ObjectsQueue* _tmp138_;
	gchar* _tmp139_;
	gchar* _tmp140_;
	ObjectsQueue* _tmp141_;
	ObjectsSource* _tmp142_;
	ObjectsSource* _tmp143_;
	const gchar* _tmp144_;
	const gchar* _tmp145_;
	ServicesDatabase* _tmp146_;
	ServicesDatabase* _tmp147_;
	ObjectsQueue* _tmp148_;
	ServicesDatabase* _tmp149_;
	ServicesDatabase* _tmp150_;
	const gchar* _tmp151_;
	const gchar* _tmp152_;
	const gchar* _tmp153_;
	const gchar* _tmp154_;
	HttpResponse* _tmp155_;
	HttpResponse* _tmp156_;
	ObjectsQueue* _tmp157_;
	const gchar* _tmp158_;
	const gchar* _tmp159_;
	GError* _inner_error0_;
};

struct _ServicesTodoistItemsUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	ObjectsBaseObject* object;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsSource* _tmp1_;
	ObjectsSource* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gchar* uuid;
	Util* _tmp6_;
	Util* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* json;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	ObjectsSource* source;
	ObjectsSource* _tmp12_;
	ObjectsSource* _tmp13_;
	ObjectsSource* _tmp14_;
	SoupMessage* message;
	SoupMessage* _tmp15_;
	SoupMessage* _tmp16_;
	SoupMessageHeaders* _tmp17_;
	SoupMessageHeaders* _tmp18_;
	ObjectsSource* _tmp19_;
	ObjectsSourceTodoistData* _tmp20_;
	ObjectsSourceTodoistData* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	SoupMessage* _tmp26_;
	const gchar* _tmp27_;
	guint8* _tmp28_;
	gint _tmp28__length1;
	gint _tmp29_;
	guint8* _tmp30_;
	gint _tmp30__length1;
	GBytes* _tmp31_;
	GBytes* _tmp32_;
	GBytes* stream;
	SoupSession* _tmp33_;
	SoupMessage* _tmp34_;
	GBytes* _tmp35_;
	JsonParser* parser;
	JsonParser* _tmp36_;
	JsonParser* _tmp37_;
	GBytes* _tmp38_;
	gsize _tmp39_;
	guint8* _tmp40_;
	ServicesTodoist* _tmp41_;
	ServicesTodoist* _tmp42_;
	SoupMessage* _tmp43_;
	guint _tmp44_;
	guint _tmp45_;
	gboolean _tmp46_;
	HttpResponse* _tmp47_;
	JsonParser* _tmp48_;
	JsonNode* _tmp49_;
	SoupMessage* _tmp50_;
	guint _tmp51_;
	guint _tmp52_;
	ServicesTodoist* _tmp53_;
	ServicesTodoist* _tmp54_;
	SoupMessage* _tmp55_;
	guint _tmp56_;
	guint _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	JsonObject* sync_status;
	JsonParser* _tmp60_;
	JsonNode* _tmp61_;
	JsonObject* _tmp62_;
	JsonObject* _tmp63_;
	JsonObject* _tmp64_;
	JsonNode* uuid_member;
	JsonObject* _tmp65_;
	const gchar* _tmp66_;
	JsonNode* _tmp67_;
	JsonNode* _tmp68_;
	JsonNode* _tmp69_;
	ObjectsSource* _tmp70_;
	ObjectsSourceTodoistData* _tmp71_;
	ObjectsSourceTodoistData* _tmp72_;
	JsonParser* _tmp73_;
	JsonNode* _tmp74_;
	JsonObject* _tmp75_;
	const gchar* _tmp76_;
	HttpResponse* _tmp77_;
	ObjectsSource* _tmp78_;
	GDateTime* _tmp79_;
	GDateTime* _tmp80_;
	gchar* _tmp81_;
	gchar* _tmp82_;
	ObjectsSource* _tmp83_;
	HttpResponse* _tmp84_;
	JsonObject* _tmp85_;
	const gchar* _tmp86_;
	JsonObject* _tmp87_;
	const gchar* _tmp88_;
	JsonObject* _tmp89_;
	const gchar* _tmp90_;
	JsonObject* _tmp91_;
	JsonObject* _tmp92_;
	const gchar* _tmp93_;
	JsonObject* _tmp94_;
	const gchar* _tmp95_;
	GError* e;
	ServicesTodoist* _tmp96_;
	ServicesTodoist* _tmp97_;
	SoupMessage* _tmp98_;
	guint _tmp99_;
	guint _tmp100_;
	gboolean _tmp101_;
	HttpResponse* _tmp102_;
	GError* _tmp103_;
	const gchar* _tmp104_;
	SoupMessage* _tmp105_;
	guint _tmp106_;
	guint _tmp107_;
	GError* _tmp108_;
	const gchar* _tmp109_;
	ObjectsQueue* queue;
	ObjectsQueue* _tmp110_;
	ObjectsQueue* _tmp111_;
	const gchar* _tmp112_;
	ObjectsQueue* _tmp113_;
	const gchar* _tmp114_;
	const gchar* _tmp115_;
	ObjectsQueue* _tmp116_;
	const gchar* _tmp117_;
	const gchar* _tmp118_;
	ObjectsQueue* _tmp119_;
	gchar* _tmp120_;
	gchar* _tmp121_;
	ObjectsQueue* _tmp122_;
	ObjectsSource* _tmp123_;
	ObjectsSource* _tmp124_;
	const gchar* _tmp125_;
	const gchar* _tmp126_;
	ServicesDatabase* _tmp127_;
	ServicesDatabase* _tmp128_;
	ObjectsQueue* _tmp129_;
	HttpResponse* _tmp130_;
	GError* _inner_error0_;
};

struct _ServicesTodoistItemsDeleteData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	ObjectsBaseObject* object;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsSource* _tmp1_;
	ObjectsSource* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gchar* uuid;
	Util* _tmp6_;
	Util* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* json;
	ServicesTodoist* _tmp10_;
	ServicesTodoist* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	SoupMessage* message;
	SoupMessage* _tmp19_;
	SoupMessage* _tmp20_;
	SoupMessageHeaders* _tmp21_;
	SoupMessageHeaders* _tmp22_;
	ObjectsSource* _tmp23_;
	ObjectsSource* _tmp24_;
	ObjectsSourceTodoistData* _tmp25_;
	ObjectsSourceTodoistData* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	SoupMessage* _tmp31_;
	const gchar* _tmp32_;
	guint8* _tmp33_;
	gint _tmp33__length1;
	gint _tmp34_;
	guint8* _tmp35_;
	gint _tmp35__length1;
	GBytes* _tmp36_;
	GBytes* _tmp37_;
	GBytes* stream;
	SoupSession* _tmp38_;
	SoupMessage* _tmp39_;
	GBytes* _tmp40_;
	JsonParser* parser;
	JsonParser* _tmp41_;
	JsonParser* _tmp42_;
	GBytes* _tmp43_;
	gsize _tmp44_;
	guint8* _tmp45_;
	ServicesTodoist* _tmp46_;
	ServicesTodoist* _tmp47_;
	SoupMessage* _tmp48_;
	guint _tmp49_;
	guint _tmp50_;
	gboolean _tmp51_;
	HttpResponse* _tmp52_;
	JsonParser* _tmp53_;
	JsonNode* _tmp54_;
	SoupMessage* _tmp55_;
	guint _tmp56_;
	guint _tmp57_;
	ServicesTodoist* _tmp58_;
	ServicesTodoist* _tmp59_;
	SoupMessage* _tmp60_;
	guint _tmp61_;
	guint _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	JsonObject* sync_status;
	JsonParser* _tmp65_;
	JsonNode* _tmp66_;
	JsonObject* _tmp67_;
	JsonObject* _tmp68_;
	JsonObject* _tmp69_;
	JsonNode* uuid_member;
	JsonObject* _tmp70_;
	const gchar* _tmp71_;
	JsonNode* _tmp72_;
	JsonNode* _tmp73_;
	JsonNode* _tmp74_;
	ObjectsSource* _tmp75_;
	ObjectsSource* _tmp76_;
	ObjectsSourceTodoistData* _tmp77_;
	ObjectsSourceTodoistData* _tmp78_;
	JsonParser* _tmp79_;
	JsonNode* _tmp80_;
	JsonObject* _tmp81_;
	const gchar* _tmp82_;
	ObjectsSource* _tmp83_;
	ObjectsSource* _tmp84_;
	GDateTime* _tmp85_;
	GDateTime* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	ObjectsSource* _tmp89_;
	ObjectsSource* _tmp90_;
	HttpResponse* _tmp91_;
	HttpResponse* _tmp92_;
	JsonObject* _tmp93_;
	const gchar* _tmp94_;
	JsonObject* _tmp95_;
	const gchar* _tmp96_;
	JsonObject* _tmp97_;
	const gchar* _tmp98_;
	JsonObject* _tmp99_;
	JsonObject* _tmp100_;
	const gchar* _tmp101_;
	JsonObject* _tmp102_;
	const gchar* _tmp103_;
	GError* e;
	ServicesTodoist* _tmp104_;
	ServicesTodoist* _tmp105_;
	SoupMessage* _tmp106_;
	guint _tmp107_;
	guint _tmp108_;
	gboolean _tmp109_;
	HttpResponse* _tmp110_;
	GError* _tmp111_;
	const gchar* _tmp112_;
	SoupMessage* _tmp113_;
	guint _tmp114_;
	guint _tmp115_;
	GError* _tmp116_;
	const gchar* _tmp117_;
	ObjectsQueue* queue;
	ObjectsQueue* _tmp118_;
	ObjectsQueue* _tmp119_;
	const gchar* _tmp120_;
	ObjectsQueue* _tmp121_;
	const gchar* _tmp122_;
	const gchar* _tmp123_;
	ObjectsQueue* _tmp124_;
	const gchar* _tmp125_;
	const gchar* _tmp126_;
	ObjectsQueue* _tmp127_;
	gchar* _tmp128_;
	gchar* _tmp129_;
	ObjectsQueue* _tmp130_;
	ObjectsSource* _tmp131_;
	ObjectsSource* _tmp132_;
	const gchar* _tmp133_;
	const gchar* _tmp134_;
	ServicesDatabase* _tmp135_;
	ServicesDatabase* _tmp136_;
	ObjectsQueue* _tmp137_;
	HttpResponse* _tmp138_;
	GError* _inner_error0_;
};

struct _ServicesTodoistItemsCloseItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	ObjectsItem* item;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsSource* _tmp1_;
	ObjectsSource* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gchar* uuid;
	Util* _tmp6_;
	Util* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* json;
	const gchar* _tmp10_;
	ObjectsSource* _tmp11_;
	ObjectsSource* _tmp12_;
	ObjectsSourceTodoistData* _tmp13_;
	ObjectsSourceTodoistData* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	ObjectsSource* source;
	ObjectsSource* _tmp18_;
	ObjectsSource* _tmp19_;
	ObjectsSource* _tmp20_;
	SoupMessage* message;
	SoupMessage* _tmp21_;
	SoupMessage* _tmp22_;
	SoupMessageHeaders* _tmp23_;
	SoupMessageHeaders* _tmp24_;
	ObjectsSource* _tmp25_;
	ObjectsSourceTodoistData* _tmp26_;
	ObjectsSourceTodoistData* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	SoupMessage* _tmp32_;
	const gchar* _tmp33_;
	guint8* _tmp34_;
	gint _tmp34__length1;
	gint _tmp35_;
	guint8* _tmp36_;
	gint _tmp36__length1;
	GBytes* _tmp37_;
	GBytes* _tmp38_;
	GBytes* stream;
	SoupSession* _tmp39_;
	SoupMessage* _tmp40_;
	GBytes* _tmp41_;
	JsonParser* parser;
	JsonParser* _tmp42_;
	JsonParser* _tmp43_;
	GBytes* _tmp44_;
	gsize _tmp45_;
	guint8* _tmp46_;
	ServicesTodoist* _tmp47_;
	ServicesTodoist* _tmp48_;
	SoupMessage* _tmp49_;
	guint _tmp50_;
	guint _tmp51_;
	gboolean _tmp52_;
	HttpResponse* _tmp53_;
	JsonParser* _tmp54_;
	JsonNode* _tmp55_;
	SoupMessage* _tmp56_;
	guint _tmp57_;
	guint _tmp58_;
	ServicesTodoist* _tmp59_;
	ServicesTodoist* _tmp60_;
	SoupMessage* _tmp61_;
	guint _tmp62_;
	guint _tmp63_;
	gchar* _tmp64_;
	gchar* _tmp65_;
	JsonObject* sync_status;
	JsonParser* _tmp66_;
	JsonNode* _tmp67_;
	JsonObject* _tmp68_;
	JsonObject* _tmp69_;
	JsonObject* _tmp70_;
	JsonNode* uuid_member;
	JsonObject* _tmp71_;
	const gchar* _tmp72_;
	JsonNode* _tmp73_;
	JsonNode* _tmp74_;
	JsonNode* _tmp75_;
	ObjectsSource* _tmp76_;
	ObjectsSourceTodoistData* _tmp77_;
	ObjectsSourceTodoistData* _tmp78_;
	JsonParser* _tmp79_;
	JsonNode* _tmp80_;
	JsonObject* _tmp81_;
	const gchar* _tmp82_;
	HttpResponse* _tmp83_;
	JsonObject* root;
	JsonParser* _tmp84_;
	JsonNode* _tmp85_;
	JsonObject* _tmp86_;
	JsonObject* _tmp87_;
	JsonObject* _tmp88_;
	JsonArray* items;
	JsonObject* _tmp89_;
	JsonArray* _tmp90_;
	JsonArray* _tmp91_;
	GList* _tmp92_;
	GList* node_collection;
	GList* node_it;
	JsonNode* node;
	JsonNode* _tmp93_;
	JsonObject* _tmp94_;
	const gchar* _tmp95_;
	const gchar* _tmp96_;
	const gchar* _tmp97_;
	JsonNode* _tmp98_;
	JsonObject* _tmp99_;
	ObjectsDueDate* _tmp100_;
	ObjectsDueDate* _tmp101_;
	JsonNode* _tmp102_;
	JsonObject* _tmp103_;
	JsonObject* _tmp104_;
	ObjectsSource* _tmp105_;
	GDateTime* _tmp106_;
	GDateTime* _tmp107_;
	gchar* _tmp108_;
	gchar* _tmp109_;
	ObjectsSource* _tmp110_;
	HttpResponse* _tmp111_;
	JsonObject* _tmp112_;
	const gchar* _tmp113_;
	JsonObject* _tmp114_;
	const gchar* _tmp115_;
	JsonObject* _tmp116_;
	const gchar* _tmp117_;
	JsonObject* _tmp118_;
	JsonObject* _tmp119_;
	const gchar* _tmp120_;
	JsonObject* _tmp121_;
	const gchar* _tmp122_;
	GError* e;
	ServicesTodoist* _tmp123_;
	ServicesTodoist* _tmp124_;
	SoupMessage* _tmp125_;
	guint _tmp126_;
	guint _tmp127_;
	gboolean _tmp128_;
	HttpResponse* _tmp129_;
	GError* _tmp130_;
	const gchar* _tmp131_;
	SoupMessage* _tmp132_;
	guint _tmp133_;
	guint _tmp134_;
	GError* _tmp135_;
	const gchar* _tmp136_;
	ObjectsQueue* queue;
	ObjectsQueue* _tmp137_;
	ObjectsQueue* _tmp138_;
	const gchar* _tmp139_;
	ObjectsQueue* _tmp140_;
	const gchar* _tmp141_;
	const gchar* _tmp142_;
	ObjectsQueue* _tmp143_;
	ObjectsQueue* _tmp144_;
	gchar* _tmp145_;
	gchar* _tmp146_;
	ObjectsQueue* _tmp147_;
	ObjectsSource* _tmp148_;
	ObjectsSource* _tmp149_;
	const gchar* _tmp150_;
	const gchar* _tmp151_;
	ServicesDatabase* _tmp152_;
	ServicesDatabase* _tmp153_;
	ObjectsQueue* _tmp154_;
	HttpResponse* _tmp155_;
	GError* _inner_error0_;
};

struct _ServicesTodoistItemsCompleteItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	ObjectsItem* item;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsSource* _tmp1_;
	ObjectsSource* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gchar* uuid;
	Util* _tmp6_;
	Util* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	gchar* json;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	ObjectsSource* source;
	ObjectsSource* _tmp15_;
	ObjectsSource* _tmp16_;
	ObjectsSource* _tmp17_;
	SoupMessage* message;
	SoupMessage* _tmp18_;
	SoupMessage* _tmp19_;
	SoupMessageHeaders* _tmp20_;
	SoupMessageHeaders* _tmp21_;
	ObjectsSource* _tmp22_;
	ObjectsSourceTodoistData* _tmp23_;
	ObjectsSourceTodoistData* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	SoupMessage* _tmp29_;
	const gchar* _tmp30_;
	guint8* _tmp31_;
	gint _tmp31__length1;
	gint _tmp32_;
	guint8* _tmp33_;
	gint _tmp33__length1;
	GBytes* _tmp34_;
	GBytes* _tmp35_;
	GBytes* stream;
	SoupSession* _tmp36_;
	SoupMessage* _tmp37_;
	GBytes* _tmp38_;
	JsonParser* parser;
	JsonParser* _tmp39_;
	JsonParser* _tmp40_;
	GBytes* _tmp41_;
	gsize _tmp42_;
	guint8* _tmp43_;
	ServicesTodoist* _tmp44_;
	ServicesTodoist* _tmp45_;
	SoupMessage* _tmp46_;
	guint _tmp47_;
	guint _tmp48_;
	gboolean _tmp49_;
	HttpResponse* _tmp50_;
	JsonParser* _tmp51_;
	JsonNode* _tmp52_;
	SoupMessage* _tmp53_;
	guint _tmp54_;
	guint _tmp55_;
	ServicesTodoist* _tmp56_;
	ServicesTodoist* _tmp57_;
	SoupMessage* _tmp58_;
	guint _tmp59_;
	guint _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	JsonObject* sync_status;
	JsonParser* _tmp63_;
	JsonNode* _tmp64_;
	JsonObject* _tmp65_;
	JsonObject* _tmp66_;
	JsonObject* _tmp67_;
	JsonNode* uuid_member;
	JsonObject* _tmp68_;
	const gchar* _tmp69_;
	JsonNode* _tmp70_;
	JsonNode* _tmp71_;
	JsonNode* _tmp72_;
	ObjectsSource* _tmp73_;
	ObjectsSourceTodoistData* _tmp74_;
	ObjectsSourceTodoistData* _tmp75_;
	JsonParser* _tmp76_;
	JsonNode* _tmp77_;
	JsonObject* _tmp78_;
	const gchar* _tmp79_;
	HttpResponse* _tmp80_;
	ObjectsSource* _tmp81_;
	GDateTime* _tmp82_;
	GDateTime* _tmp83_;
	gchar* _tmp84_;
	gchar* _tmp85_;
	ObjectsSource* _tmp86_;
	HttpResponse* _tmp87_;
	JsonObject* _tmp88_;
	const gchar* _tmp89_;
	JsonObject* _tmp90_;
	const gchar* _tmp91_;
	JsonObject* _tmp92_;
	const gchar* _tmp93_;
	JsonObject* _tmp94_;
	JsonObject* _tmp95_;
	const gchar* _tmp96_;
	JsonObject* _tmp97_;
	const gchar* _tmp98_;
	GError* e;
	ServicesTodoist* _tmp99_;
	ServicesTodoist* _tmp100_;
	SoupMessage* _tmp101_;
	guint _tmp102_;
	guint _tmp103_;
	gboolean _tmp104_;
	HttpResponse* _tmp105_;
	GError* _tmp106_;
	const gchar* _tmp107_;
	SoupMessage* _tmp108_;
	guint _tmp109_;
	guint _tmp110_;
	GError* _tmp111_;
	const gchar* _tmp112_;
	ObjectsQueue* queue;
	ObjectsQueue* _tmp113_;
	ObjectsQueue* _tmp114_;
	const gchar* _tmp115_;
	ObjectsQueue* _tmp116_;
	const gchar* _tmp117_;
	const gchar* _tmp118_;
	const gchar* _tmp119_;
	gboolean _tmp120_;
	gboolean _tmp121_;
	ObjectsQueue* _tmp122_;
	ObjectsQueue* _tmp123_;
	gchar* _tmp124_;
	gchar* _tmp125_;
	ObjectsQueue* _tmp126_;
	ObjectsSource* _tmp127_;
	ObjectsSource* _tmp128_;
	const gchar* _tmp129_;
	const gchar* _tmp130_;
	ServicesDatabase* _tmp131_;
	ServicesDatabase* _tmp132_;
	ObjectsQueue* _tmp133_;
	HttpResponse* _tmp134_;
	GError* _inner_error0_;
};

struct _ServicesTodoistItemsMoveItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	ObjectsItem* item;
	gchar* type;
	gchar* id;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsSource* _tmp1_;
	ObjectsSource* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gchar* uuid;
	Util* _tmp6_;
	Util* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* json;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	ObjectsSource* source;
	ObjectsSource* _tmp12_;
	ObjectsSource* _tmp13_;
	ObjectsSource* _tmp14_;
	SoupMessage* message;
	SoupMessage* _tmp15_;
	SoupMessage* _tmp16_;
	SoupMessageHeaders* _tmp17_;
	SoupMessageHeaders* _tmp18_;
	ObjectsSource* _tmp19_;
	ObjectsSourceTodoistData* _tmp20_;
	ObjectsSourceTodoistData* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	SoupMessage* _tmp26_;
	const gchar* _tmp27_;
	guint8* _tmp28_;
	gint _tmp28__length1;
	gint _tmp29_;
	guint8* _tmp30_;
	gint _tmp30__length1;
	GBytes* _tmp31_;
	GBytes* _tmp32_;
	GBytes* stream;
	SoupSession* _tmp33_;
	SoupMessage* _tmp34_;
	GBytes* _tmp35_;
	JsonParser* parser;
	JsonParser* _tmp36_;
	JsonParser* _tmp37_;
	GBytes* _tmp38_;
	gsize _tmp39_;
	guint8* _tmp40_;
	ServicesTodoist* _tmp41_;
	ServicesTodoist* _tmp42_;
	SoupMessage* _tmp43_;
	guint _tmp44_;
	guint _tmp45_;
	gboolean _tmp46_;
	HttpResponse* _tmp47_;
	JsonParser* _tmp48_;
	JsonNode* _tmp49_;
	SoupMessage* _tmp50_;
	guint _tmp51_;
	guint _tmp52_;
	ServicesTodoist* _tmp53_;
	ServicesTodoist* _tmp54_;
	SoupMessage* _tmp55_;
	guint _tmp56_;
	guint _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	JsonObject* sync_status;
	JsonParser* _tmp60_;
	JsonNode* _tmp61_;
	JsonObject* _tmp62_;
	JsonObject* _tmp63_;
	JsonObject* _tmp64_;
	JsonNode* uuid_member;
	JsonObject* _tmp65_;
	const gchar* _tmp66_;
	JsonNode* _tmp67_;
	JsonNode* _tmp68_;
	JsonNode* _tmp69_;
	ObjectsSource* _tmp70_;
	ObjectsSourceTodoistData* _tmp71_;
	ObjectsSourceTodoistData* _tmp72_;
	JsonParser* _tmp73_;
	JsonNode* _tmp74_;
	JsonObject* _tmp75_;
	const gchar* _tmp76_;
	HttpResponse* _tmp77_;
	ObjectsSource* _tmp78_;
	GDateTime* _tmp79_;
	GDateTime* _tmp80_;
	gchar* _tmp81_;
	gchar* _tmp82_;
	ObjectsSource* _tmp83_;
	HttpResponse* _tmp84_;
	JsonObject* _tmp85_;
	const gchar* _tmp86_;
	JsonObject* _tmp87_;
	const gchar* _tmp88_;
	JsonObject* _tmp89_;
	const gchar* _tmp90_;
	JsonObject* _tmp91_;
	JsonObject* _tmp92_;
	const gchar* _tmp93_;
	JsonObject* _tmp94_;
	const gchar* _tmp95_;
	GError* e;
	ServicesTodoist* _tmp96_;
	ServicesTodoist* _tmp97_;
	SoupMessage* _tmp98_;
	guint _tmp99_;
	guint _tmp100_;
	gboolean _tmp101_;
	HttpResponse* _tmp102_;
	GError* _tmp103_;
	const gchar* _tmp104_;
	SoupMessage* _tmp105_;
	guint _tmp106_;
	guint _tmp107_;
	GError* _tmp108_;
	const gchar* _tmp109_;
	ObjectsQueue* queue;
	ObjectsQueue* _tmp110_;
	ObjectsQueue* _tmp111_;
	const gchar* _tmp112_;
	ObjectsQueue* _tmp113_;
	const gchar* _tmp114_;
	const gchar* _tmp115_;
	ObjectsQueue* _tmp116_;
	ObjectsQueue* _tmp117_;
	gchar* _tmp118_;
	gchar* _tmp119_;
	ObjectsQueue* _tmp120_;
	ObjectsSource* _tmp121_;
	ObjectsSource* _tmp122_;
	const gchar* _tmp123_;
	const gchar* _tmp124_;
	ServicesDatabase* _tmp125_;
	ServicesDatabase* _tmp126_;
	ObjectsQueue* _tmp127_;
	HttpResponse* _tmp128_;
	GError* _inner_error0_;
};

struct _ServicesTodoistItemsUpdateItemsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesTodoistItems* self;
	GeeArrayList* objects;
	gchar* json;
	gchar* _tmp0_;
	ObjectsSource* source;
	GeeArrayList* _item_list;
	gint _item_size;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _item_index;
	gint _tmp4_;
	gint _tmp5_;
	ObjectsItem* item;
	GeeArrayList* _tmp6_;
	gpointer _tmp7_;
	ObjectsItem* _tmp8_;
	ObjectsSource* _tmp9_;
	ObjectsSource* _tmp10_;
	ObjectsItem* _tmp11_;
	ObjectsSource* _tmp12_;
	ObjectsSource* _tmp13_;
	ObjectsSource* _tmp14_;
	ObjectsSource* _tmp15_;
	SoupMessage* message;
	SoupMessage* _tmp16_;
	SoupMessage* _tmp17_;
	SoupMessageHeaders* _tmp18_;
	SoupMessageHeaders* _tmp19_;
	ObjectsSource* _tmp20_;
	ObjectsSourceTodoistData* _tmp21_;
	ObjectsSourceTodoistData* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	SoupMessage* _tmp27_;
	const gchar* _tmp28_;
	guint8* _tmp29_;
	gint _tmp29__length1;
	gint _tmp30_;
	guint8* _tmp31_;
	gint _tmp31__length1;
	GBytes* _tmp32_;
	GBytes* _tmp33_;
	GBytes* stream;
	SoupSession* _tmp34_;
	SoupMessage* _tmp35_;
	GBytes* _tmp36_;
	JsonParser* parser;
	JsonParser* _tmp37_;
	JsonParser* _tmp38_;
	GBytes* _tmp39_;
	gsize _tmp40_;
	guint8* _tmp41_;
	ServicesTodoist* _tmp42_;
	ServicesTodoist* _tmp43_;
	SoupMessage* _tmp44_;
	guint _tmp45_;
	guint _tmp46_;
	gboolean _tmp47_;
	SoupMessage* _tmp48_;
	guint _tmp49_;
	guint _tmp50_;
	ServicesTodoist* _tmp51_;
	ServicesTodoist* _tmp52_;
	SoupMessage* _tmp53_;
	guint _tmp54_;
	guint _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	ObjectsSource* _tmp58_;
	ObjectsSourceTodoistData* _tmp59_;
	ObjectsSourceTodoistData* _tmp60_;
	JsonParser* _tmp61_;
	JsonNode* _tmp62_;
	JsonObject* _tmp63_;
	const gchar* _tmp64_;
	ObjectsSource* _tmp65_;
	GDateTime* _tmp66_;
	GDateTime* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	ObjectsSource* _tmp70_;
	GError* e;
	ServicesLogService* _tmp71_;
	ServicesLogService* _tmp72_;
	GError* _tmp73_;
	const gchar* _tmp74_;
	gchar* _tmp75_;
	gchar* _tmp76_;
	GError* _inner_error0_;
};

static gint ServicesTodoistItems_private_offset;
static gpointer services_todoist_items_parent_class = NULL;

static void services_todoist_items_add_data_free (gpointer _data);
static gboolean services_todoist_items_add_co (ServicesTodoistItemsAddData* _data_);
static void services_todoist_items_add_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
static void services_todoist_items_debug_error (ServicesTodoistItems* self,
                                         guint status_code,
                                         const gchar* message);
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
static void _vala_JsonNode_free (JsonNode* self);
static void services_todoist_items_update_data_free (gpointer _data);
static gboolean services_todoist_items_update_co (ServicesTodoistItemsUpdateData* _data_);
static void services_todoist_items_update_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void services_todoist_items_delete_data_free (gpointer _data);
static gboolean services_todoist_items_delete_co (ServicesTodoistItemsDeleteData* _data_);
static void services_todoist_items_delete_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void services_todoist_items_close_item_data_free (gpointer _data);
static gboolean services_todoist_items_close_item_co (ServicesTodoistItemsCloseItemData* _data_);
static void services_todoist_items_close_item_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static void services_todoist_items_complete_item_data_free (gpointer _data);
static gboolean services_todoist_items_complete_item_co (ServicesTodoistItemsCompleteItemData* _data_);
static void services_todoist_items_complete_item_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void services_todoist_items_move_item_data_free (gpointer _data);
static gboolean services_todoist_items_move_item_co (ServicesTodoistItemsMoveItemData* _data_);
static void services_todoist_items_move_item_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static void services_todoist_items_update_items_data_free (gpointer _data);
static gboolean services_todoist_items_update_items_co (ServicesTodoistItemsUpdateItemsData* _data_);
static void services_todoist_items_update_items_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void services_todoist_items_finalize (GObject * obj);
static GType services_todoist_items_get_type_once (void);

static inline gpointer
services_todoist_items_get_instance_private (ServicesTodoistItems* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesTodoistItems_private_offset);
}

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

ServicesTodoistItems*
services_todoist_items_construct (GType object_type,
                                  SoupSession* session)
{
	ServicesTodoistItems * self = NULL;
	SoupSession* _tmp0_;
	g_return_val_if_fail (session != NULL, NULL);
	self = (ServicesTodoistItems*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (session);
	_g_object_unref0 (self->priv->session);
	self->priv->session = _tmp0_;
	return self;
}

ServicesTodoistItems*
services_todoist_items_new (SoupSession* session)
{
	return services_todoist_items_construct (SERVICES_TYPE_TODOIST_ITEMS, session);
}

static void
services_todoist_items_add_data_free (gpointer _data)
{
	ServicesTodoistItemsAddData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->object);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsAddData, _data_);
}

void
services_todoist_items_add (ServicesTodoistItems* self,
                            ObjectsBaseObject* object,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	ServicesTodoistItemsAddData* _data_;
	ServicesTodoistItems* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsAddData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_add_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (object);
	_g_object_unref0 (_data_->object);
	_data_->object = _tmp1_;
	services_todoist_items_add_co (_data_);
}

HttpResponse*
services_todoist_items_add_finish (ServicesTodoistItems* self,
                                   GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesTodoistItemsAddData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

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 void
services_todoist_items_add_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	ServicesTodoistItemsAddData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_add_co (_data_);
}

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

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

static gchar*
g_date_time_to_string (GDateTime* self)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_format (self, "%FT%H:%M:%S%z");
	result = _tmp0_;
	return result;
}

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

static gboolean
services_todoist_items_add_co (ServicesTodoistItemsAddData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_base_object_get_source (_data_->object);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (objects_source_needs_migration (_data_->_tmp2_)) {
		_data_->_tmp3_ = _data_->response;
		http_response_set_status (_data_->_tmp3_, FALSE);
		_data_->_tmp4_ = _data_->response;
		http_response_set_error (_data_->_tmp4_, SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE);
		_data_->_tmp5_ = _data_->response;
		http_response_set_error_code (_data_->_tmp5_, 410);
		_data_->result = _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_->_tmp6_ = util_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = util_generate_string (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->temp_id = _data_->_tmp9_;
	_data_->_tmp10_ = util_get_default ();
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = util_generate_string (_data_->_tmp11_);
	_data_->_tmp13_ = _data_->_tmp12_;
	_g_object_unref0 (_data_->_tmp11_);
	_data_->uuid = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->temp_id;
	_data_->_tmp15_ = _data_->uuid;
	_data_->_tmp16_ = objects_base_object_get_add_json (_data_->object, _data_->_tmp14_, _data_->_tmp15_);
	_data_->json = _data_->_tmp16_;
	_data_->_tmp17_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->message;
	_data_->_tmp19_ = soup_message_get_request_headers (_data_->_tmp18_);
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = objects_base_object_get_source (_data_->object);
	_data_->_tmp22_ = _data_->_tmp21_;
	_data_->_tmp23_ = objects_source_get_todoist_data (_data_->_tmp22_);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = objects_source_todoist_data_get_access_token (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	_data_->_tmp27_ = g_strdup_printf ("Bearer %s", _data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	soup_message_headers_append (_data_->_tmp20_, "Authorization", _data_->_tmp28_);
	_g_free0 (_data_->_tmp28_);
	_data_->_tmp29_ = _data_->message;
	_data_->_tmp30_ = _data_->json;
	_data_->_tmp32_ = 0;
	_data_->_tmp31_ = string_get_data (_data_->_tmp30_, &_data_->_tmp32_);
	_data_->_tmp31__length1 = _data_->_tmp32_;
	_data_->_tmp33_ = _data_->_tmp31_;
	_data_->_tmp33__length1 = _data_->_tmp31__length1;
	_data_->_tmp34_ = g_bytes_new (_data_->_tmp33_, _data_->_tmp33__length1);
	_data_->_tmp35_ = _data_->_tmp34_;
	soup_message_set_request_body_from_bytes (_data_->_tmp29_, "application/json", _data_->_tmp35_);
	_g_bytes_unref0 (_data_->_tmp35_);
	{
		_data_->_tmp36_ = _data_->self->priv->session;
		_data_->_tmp37_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp36_, _data_->_tmp37_, G_PRIORITY_HIGH, NULL, services_todoist_items_add_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp38_ = soup_session_send_and_read_finish (_data_->_tmp36_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp38_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp39_ = json_parser_new ();
		_data_->parser = _data_->_tmp39_;
		_data_->_tmp40_ = _data_->parser;
		_data_->_tmp41_ = _data_->stream;
		_data_->_tmp42_ = 0;
		_data_->_tmp43_ = g_bytes_get_data (_data_->_tmp41_, &_data_->_tmp42_);
		json_parser_load_from_data (_data_->_tmp40_, (const gchar*) _data_->_tmp43_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp44_ = services_todoist_get_default ();
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = _data_->message;
		g_object_get (_data_->_tmp46_, "status-code", &_data_->_tmp47_, NULL);
		_data_->_tmp48_ = _data_->_tmp47_;
		_data_->_tmp49_ = services_todoist_is_todoist_error (_data_->_tmp45_, _data_->_tmp48_);
		_g_object_unref0 (_data_->_tmp45_);
		if (_data_->_tmp49_) {
			_data_->_tmp50_ = _data_->response;
			_data_->_tmp51_ = _data_->parser;
			_data_->_tmp52_ = json_parser_get_root (_data_->_tmp51_);
			http_response_from_error_json (_data_->_tmp50_, _data_->_tmp52_);
			_data_->_tmp53_ = _data_->message;
			g_object_get (_data_->_tmp53_, "status-code", &_data_->_tmp54_, NULL);
			_data_->_tmp55_ = _data_->_tmp54_;
			_data_->_tmp56_ = services_todoist_get_default ();
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = _data_->message;
			g_object_get (_data_->_tmp58_, "status-code", &_data_->_tmp59_, NULL);
			_data_->_tmp60_ = _data_->_tmp59_;
			_data_->_tmp61_ = services_todoist_get_todoist_error (_data_->_tmp57_, _data_->_tmp60_);
			_data_->_tmp62_ = _data_->_tmp61_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp55_, _data_->_tmp62_);
			_g_free0 (_data_->_tmp62_);
			_g_object_unref0 (_data_->_tmp57_);
		} else {
			_data_->_tmp63_ = _data_->parser;
			_data_->_tmp64_ = json_parser_get_root (_data_->_tmp63_);
			_data_->_tmp65_ = json_node_get_object (_data_->_tmp64_);
			_data_->_tmp66_ = json_object_get_object_member (_data_->_tmp65_, "sync_status");
			_data_->_tmp67_ = _json_object_ref0 (_data_->_tmp66_);
			_data_->sync_status = _data_->_tmp67_;
			_data_->_tmp68_ = _data_->sync_status;
			_data_->_tmp69_ = _data_->uuid;
			_data_->_tmp70_ = json_object_get_member (_data_->_tmp68_, _data_->_tmp69_);
			_data_->_tmp71_ = __vala_JsonNode_copy0 (_data_->_tmp70_);
			_data_->uuid_member = _data_->_tmp71_;
			_data_->_tmp72_ = _data_->uuid_member;
			if (json_node_get_node_type (_data_->_tmp72_) == JSON_NODE_VALUE) {
				_data_->_tmp73_ = objects_base_object_get_source (_data_->object);
				_data_->_tmp74_ = _data_->_tmp73_;
				_data_->_tmp75_ = objects_source_get_todoist_data (_data_->_tmp74_);
				_data_->_tmp76_ = _data_->_tmp75_;
				_data_->_tmp77_ = _data_->parser;
				_data_->_tmp78_ = json_parser_get_root (_data_->_tmp77_);
				_data_->_tmp79_ = json_node_get_object (_data_->_tmp78_);
				_data_->_tmp80_ = json_object_get_string_member (_data_->_tmp79_, "sync_token");
				objects_source_todoist_data_set_sync_token (_data_->_tmp76_, _data_->_tmp80_);
				_data_->_tmp81_ = objects_base_object_get_source (_data_->object);
				_data_->_tmp82_ = _data_->_tmp81_;
				_data_->_tmp83_ = g_date_time_new_now_local ();
				_data_->_tmp84_ = _data_->_tmp83_;
				_data_->_tmp85_ = g_date_time_to_string (_data_->_tmp84_);
				_data_->_tmp86_ = _data_->_tmp85_;
				objects_source_set_last_sync (_data_->_tmp82_, _data_->_tmp86_);
				_g_free0 (_data_->_tmp86_);
				_g_date_time_unref0 (_data_->_tmp84_);
				_data_->_tmp87_ = objects_base_object_get_source (_data_->object);
				_data_->_tmp88_ = _data_->_tmp87_;
				objects_source_save (_data_->_tmp88_);
				_data_->_tmp89_ = _data_->parser;
				_data_->_tmp90_ = json_parser_get_root (_data_->_tmp89_);
				_data_->_tmp91_ = json_node_get_object (_data_->_tmp90_);
				_data_->_tmp92_ = json_object_get_object_member (_data_->_tmp91_, "temp_id_mapping");
				_data_->_tmp93_ = _data_->temp_id;
				_data_->_tmp94_ = json_object_get_string_member (_data_->_tmp92_, _data_->_tmp93_);
				_data_->_tmp95_ = g_strdup (_data_->_tmp94_);
				_g_free0 (_data_->id);
				_data_->id = _data_->_tmp95_;
				_data_->_tmp96_ = _data_->response;
				http_response_set_status (_data_->_tmp96_, TRUE);
				_data_->_tmp97_ = _data_->response;
				_data_->_tmp98_ = _data_->id;
				http_response_set_data (_data_->_tmp97_, _data_->_tmp98_);
			} else {
				_data_->_tmp99_ = _data_->response;
				_data_->_tmp100_ = _data_->sync_status;
				_data_->_tmp101_ = _data_->uuid;
				_data_->_tmp102_ = json_object_get_object_member (_data_->_tmp100_, _data_->_tmp101_);
				_data_->_tmp103_ = json_object_get_string_member (_data_->_tmp102_, "error");
				http_response_set_error (_data_->_tmp99_, _data_->_tmp103_);
				_data_->_tmp104_ = _data_->sync_status;
				_data_->_tmp105_ = _data_->uuid;
				_data_->_tmp106_ = json_object_get_object_member (_data_->_tmp104_, _data_->_tmp105_);
				_data_->_tmp107_ = _data_->sync_status;
				_data_->_tmp108_ = _data_->uuid;
				_data_->_tmp109_ = json_object_get_object_member (_data_->_tmp107_, _data_->_tmp108_);
				_data_->_tmp110_ = json_object_get_string_member (_data_->_tmp109_, "error");
				services_todoist_items_debug_error (_data_->self, (guint) json_object_get_int_member (_data_->_tmp106_, "http_code"), _data_->_tmp110_);
			}
			__vala_JsonNode_free0 (_data_->uuid_member);
			_json_object_unref0 (_data_->sync_status);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp111_ = services_todoist_get_default ();
		_data_->_tmp112_ = _data_->_tmp111_;
		_data_->_tmp113_ = _data_->message;
		g_object_get (_data_->_tmp113_, "status-code", &_data_->_tmp114_, NULL);
		_data_->_tmp115_ = _data_->_tmp114_;
		_data_->_tmp116_ = services_todoist_is_todoist_error (_data_->_tmp112_, _data_->_tmp115_);
		_g_object_unref0 (_data_->_tmp112_);
		if (_data_->_tmp116_) {
			_data_->_tmp117_ = _data_->response;
			_data_->_tmp118_ = _data_->e;
			_data_->_tmp119_ = _data_->_tmp118_->message;
			http_response_set_error (_data_->_tmp117_, _data_->_tmp119_);
			_data_->_tmp120_ = _data_->message;
			g_object_get (_data_->_tmp120_, "status-code", &_data_->_tmp121_, NULL);
			_data_->_tmp122_ = _data_->_tmp121_;
			_data_->_tmp123_ = _data_->e;
			_data_->_tmp124_ = _data_->_tmp123_->message;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp122_, _data_->_tmp124_);
		} else {
			_data_->_tmp125_ = util_get_default ();
			_data_->_tmp126_ = _data_->_tmp125_;
			_data_->_tmp127_ = util_generate_id (_data_->_tmp126_, _data_->object);
			_g_free0 (_data_->id);
			_data_->id = _data_->_tmp127_;
			_g_object_unref0 (_data_->_tmp126_);
			_data_->_tmp128_ = objects_queue_new ();
			_data_->queue = _data_->_tmp128_;
			_data_->_tmp129_ = _data_->queue;
			_data_->_tmp130_ = _data_->uuid;
			objects_queue_set_uuid (_data_->_tmp129_, _data_->_tmp130_);
			_data_->_tmp131_ = _data_->queue;
			_data_->_tmp132_ = _data_->id;
			objects_queue_set_object_id (_data_->_tmp131_, _data_->_tmp132_);
			_data_->_tmp133_ = _data_->queue;
			_data_->_tmp134_ = _data_->temp_id;
			objects_queue_set_temp_id (_data_->_tmp133_, _data_->_tmp134_);
			_data_->_tmp135_ = _data_->queue;
			_data_->_tmp136_ = objects_base_object_get_type_add (_data_->object);
			_data_->_tmp137_ = _data_->_tmp136_;
			objects_queue_set_query (_data_->_tmp135_, _data_->_tmp137_);
			_data_->_tmp138_ = _data_->queue;
			_data_->_tmp139_ = objects_base_object_to_json (_data_->object);
			_data_->_tmp140_ = _data_->_tmp139_;
			objects_queue_set_args (_data_->_tmp138_, _data_->_tmp140_);
			_g_free0 (_data_->_tmp140_);
			_data_->_tmp141_ = _data_->queue;
			_data_->_tmp142_ = objects_base_object_get_source (_data_->object);
			_data_->_tmp143_ = _data_->_tmp142_;
			_data_->_tmp144_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp143_);
			_data_->_tmp145_ = _data_->_tmp144_;
			objects_queue_set_source_id (_data_->_tmp141_, _data_->_tmp145_);
			_data_->_tmp146_ = services_database_get_default ();
			_data_->_tmp147_ = _data_->_tmp146_;
			_data_->_tmp148_ = _data_->queue;
			services_database_insert_queue (_data_->_tmp147_, _data_->_tmp148_);
			_g_object_unref0 (_data_->_tmp147_);
			_data_->_tmp149_ = services_database_get_default ();
			_data_->_tmp150_ = _data_->_tmp149_;
			_data_->_tmp151_ = _data_->id;
			_data_->_tmp152_ = _data_->temp_id;
			_data_->_tmp153_ = objects_base_object_get_object_type_string (_data_->object);
			_data_->_tmp154_ = _data_->_tmp153_;
			services_database_insert_CurTempIds (_data_->_tmp150_, _data_->_tmp151_, _data_->_tmp152_, _data_->_tmp154_);
			_g_object_unref0 (_data_->_tmp150_);
			_data_->_tmp155_ = _data_->response;
			http_response_set_status (_data_->_tmp155_, TRUE);
			_data_->_tmp156_ = _data_->response;
			_data_->_tmp157_ = _data_->queue;
			_data_->_tmp158_ = objects_queue_get_object_id (_data_->_tmp157_);
			_data_->_tmp159_ = _data_->_tmp158_;
			http_response_set_data (_data_->_tmp156_, _data_->_tmp159_);
			_g_object_unref0 (_data_->queue);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_free0 (_data_->json);
		_g_free0 (_data_->id);
		_g_free0 (_data_->uuid);
		_g_free0 (_data_->temp_id);
		_http_response_unref0 (_data_->response);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->response;
	_g_object_unref0 (_data_->message);
	_g_free0 (_data_->json);
	_g_free0 (_data_->id);
	_g_free0 (_data_->uuid);
	_g_free0 (_data_->temp_id);
	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
services_todoist_items_update_data_free (gpointer _data)
{
	ServicesTodoistItemsUpdateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->object);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsUpdateData, _data_);
}

void
services_todoist_items_update (ServicesTodoistItems* self,
                               ObjectsBaseObject* object,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	ServicesTodoistItemsUpdateData* _data_;
	ServicesTodoistItems* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsUpdateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_update_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (object);
	_g_object_unref0 (_data_->object);
	_data_->object = _tmp1_;
	services_todoist_items_update_co (_data_);
}

HttpResponse*
services_todoist_items_update_finish (ServicesTodoistItems* self,
                                      GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesTodoistItemsUpdateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_todoist_items_update_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	ServicesTodoistItemsUpdateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_update_co (_data_);
}

static gboolean
services_todoist_items_update_co (ServicesTodoistItemsUpdateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_base_object_get_source (_data_->object);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (objects_source_needs_migration (_data_->_tmp2_)) {
		_data_->_tmp3_ = _data_->response;
		http_response_set_status (_data_->_tmp3_, FALSE);
		_data_->_tmp4_ = _data_->response;
		http_response_set_error (_data_->_tmp4_, SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE);
		_data_->_tmp5_ = _data_->response;
		http_response_set_error_code (_data_->_tmp5_, 410);
		_data_->result = _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_->_tmp6_ = util_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = util_generate_string (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->uuid = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->uuid;
	_data_->_tmp11_ = objects_base_object_get_update_json (_data_->object, _data_->_tmp10_, NULL);
	_data_->json = _data_->_tmp11_;
	_data_->_tmp12_ = objects_base_object_get_source (_data_->object);
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_tmp14_ = _g_object_ref0 (_data_->_tmp13_);
	_data_->source = _data_->_tmp14_;
	_data_->_tmp15_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp15_;
	_data_->_tmp16_ = _data_->message;
	_data_->_tmp17_ = soup_message_get_request_headers (_data_->_tmp16_);
	_data_->_tmp18_ = _data_->_tmp17_;
	_data_->_tmp19_ = _data_->source;
	_data_->_tmp20_ = objects_source_get_todoist_data (_data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = objects_source_todoist_data_get_access_token (_data_->_tmp21_);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = g_strdup_printf ("Bearer %s", _data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	soup_message_headers_append (_data_->_tmp18_, "Authorization", _data_->_tmp25_);
	_g_free0 (_data_->_tmp25_);
	_data_->_tmp26_ = _data_->message;
	_data_->_tmp27_ = _data_->json;
	_data_->_tmp29_ = 0;
	_data_->_tmp28_ = string_get_data (_data_->_tmp27_, &_data_->_tmp29_);
	_data_->_tmp28__length1 = _data_->_tmp29_;
	_data_->_tmp30_ = _data_->_tmp28_;
	_data_->_tmp30__length1 = _data_->_tmp28__length1;
	_data_->_tmp31_ = g_bytes_new (_data_->_tmp30_, _data_->_tmp30__length1);
	_data_->_tmp32_ = _data_->_tmp31_;
	soup_message_set_request_body_from_bytes (_data_->_tmp26_, "application/json", _data_->_tmp32_);
	_g_bytes_unref0 (_data_->_tmp32_);
	{
		_data_->_tmp33_ = _data_->self->priv->session;
		_data_->_tmp34_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp33_, _data_->_tmp34_, G_PRIORITY_HIGH, NULL, services_todoist_items_update_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp35_ = soup_session_send_and_read_finish (_data_->_tmp33_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp35_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp36_ = json_parser_new ();
		_data_->parser = _data_->_tmp36_;
		_data_->_tmp37_ = _data_->parser;
		_data_->_tmp38_ = _data_->stream;
		_data_->_tmp39_ = 0;
		_data_->_tmp40_ = g_bytes_get_data (_data_->_tmp38_, &_data_->_tmp39_);
		json_parser_load_from_data (_data_->_tmp37_, (const gchar*) _data_->_tmp40_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp41_ = services_todoist_get_default ();
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_tmp43_ = _data_->message;
		g_object_get (_data_->_tmp43_, "status-code", &_data_->_tmp44_, NULL);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = services_todoist_is_todoist_error (_data_->_tmp42_, _data_->_tmp45_);
		_g_object_unref0 (_data_->_tmp42_);
		if (_data_->_tmp46_) {
			_data_->_tmp47_ = _data_->response;
			_data_->_tmp48_ = _data_->parser;
			_data_->_tmp49_ = json_parser_get_root (_data_->_tmp48_);
			http_response_from_error_json (_data_->_tmp47_, _data_->_tmp49_);
			_data_->_tmp50_ = _data_->message;
			g_object_get (_data_->_tmp50_, "status-code", &_data_->_tmp51_, NULL);
			_data_->_tmp52_ = _data_->_tmp51_;
			_data_->_tmp53_ = services_todoist_get_default ();
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp55_ = _data_->message;
			g_object_get (_data_->_tmp55_, "status-code", &_data_->_tmp56_, NULL);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = services_todoist_get_todoist_error (_data_->_tmp54_, _data_->_tmp57_);
			_data_->_tmp59_ = _data_->_tmp58_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp52_, _data_->_tmp59_);
			_g_free0 (_data_->_tmp59_);
			_g_object_unref0 (_data_->_tmp54_);
		} else {
			_data_->_tmp60_ = _data_->parser;
			_data_->_tmp61_ = json_parser_get_root (_data_->_tmp60_);
			_data_->_tmp62_ = json_node_get_object (_data_->_tmp61_);
			_data_->_tmp63_ = json_object_get_object_member (_data_->_tmp62_, "sync_status");
			_data_->_tmp64_ = _json_object_ref0 (_data_->_tmp63_);
			_data_->sync_status = _data_->_tmp64_;
			_data_->_tmp65_ = _data_->sync_status;
			_data_->_tmp66_ = _data_->uuid;
			_data_->_tmp67_ = json_object_get_member (_data_->_tmp65_, _data_->_tmp66_);
			_data_->_tmp68_ = __vala_JsonNode_copy0 (_data_->_tmp67_);
			_data_->uuid_member = _data_->_tmp68_;
			_data_->_tmp69_ = _data_->uuid_member;
			if (json_node_get_node_type (_data_->_tmp69_) == JSON_NODE_VALUE) {
				_data_->_tmp70_ = _data_->source;
				_data_->_tmp71_ = objects_source_get_todoist_data (_data_->_tmp70_);
				_data_->_tmp72_ = _data_->_tmp71_;
				_data_->_tmp73_ = _data_->parser;
				_data_->_tmp74_ = json_parser_get_root (_data_->_tmp73_);
				_data_->_tmp75_ = json_node_get_object (_data_->_tmp74_);
				_data_->_tmp76_ = json_object_get_string_member (_data_->_tmp75_, "sync_token");
				objects_source_todoist_data_set_sync_token (_data_->_tmp72_, _data_->_tmp76_);
				_data_->_tmp77_ = _data_->response;
				http_response_set_status (_data_->_tmp77_, TRUE);
				_data_->_tmp78_ = _data_->source;
				_data_->_tmp79_ = g_date_time_new_now_local ();
				_data_->_tmp80_ = _data_->_tmp79_;
				_data_->_tmp81_ = g_date_time_to_string (_data_->_tmp80_);
				_data_->_tmp82_ = _data_->_tmp81_;
				objects_source_set_last_sync (_data_->_tmp78_, _data_->_tmp82_);
				_g_free0 (_data_->_tmp82_);
				_g_date_time_unref0 (_data_->_tmp80_);
				_data_->_tmp83_ = _data_->source;
				objects_source_save (_data_->_tmp83_);
			} else {
				_data_->_tmp84_ = _data_->response;
				_data_->_tmp85_ = _data_->sync_status;
				_data_->_tmp86_ = _data_->uuid;
				_data_->_tmp87_ = json_object_get_object_member (_data_->_tmp85_, _data_->_tmp86_);
				_data_->_tmp88_ = json_object_get_string_member (_data_->_tmp87_, "error");
				http_response_set_error (_data_->_tmp84_, _data_->_tmp88_);
				_data_->_tmp89_ = _data_->sync_status;
				_data_->_tmp90_ = _data_->uuid;
				_data_->_tmp91_ = json_object_get_object_member (_data_->_tmp89_, _data_->_tmp90_);
				_data_->_tmp92_ = _data_->sync_status;
				_data_->_tmp93_ = _data_->uuid;
				_data_->_tmp94_ = json_object_get_object_member (_data_->_tmp92_, _data_->_tmp93_);
				_data_->_tmp95_ = json_object_get_string_member (_data_->_tmp94_, "error");
				services_todoist_items_debug_error (_data_->self, (guint) json_object_get_int_member (_data_->_tmp91_, "http_code"), _data_->_tmp95_);
			}
			__vala_JsonNode_free0 (_data_->uuid_member);
			_json_object_unref0 (_data_->sync_status);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp96_ = services_todoist_get_default ();
		_data_->_tmp97_ = _data_->_tmp96_;
		_data_->_tmp98_ = _data_->message;
		g_object_get (_data_->_tmp98_, "status-code", &_data_->_tmp99_, NULL);
		_data_->_tmp100_ = _data_->_tmp99_;
		_data_->_tmp101_ = services_todoist_is_todoist_error (_data_->_tmp97_, _data_->_tmp100_);
		_g_object_unref0 (_data_->_tmp97_);
		if (_data_->_tmp101_) {
			_data_->_tmp102_ = _data_->response;
			_data_->_tmp103_ = _data_->e;
			_data_->_tmp104_ = _data_->_tmp103_->message;
			http_response_set_error (_data_->_tmp102_, _data_->_tmp104_);
			_data_->_tmp105_ = _data_->message;
			g_object_get (_data_->_tmp105_, "status-code", &_data_->_tmp106_, NULL);
			_data_->_tmp107_ = _data_->_tmp106_;
			_data_->_tmp108_ = _data_->e;
			_data_->_tmp109_ = _data_->_tmp108_->message;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp107_, _data_->_tmp109_);
		} else {
			_data_->_tmp110_ = objects_queue_new ();
			_data_->queue = _data_->_tmp110_;
			_data_->_tmp111_ = _data_->queue;
			_data_->_tmp112_ = _data_->uuid;
			objects_queue_set_uuid (_data_->_tmp111_, _data_->_tmp112_);
			_data_->_tmp113_ = _data_->queue;
			_data_->_tmp114_ = objects_base_object_get_id (_data_->object);
			_data_->_tmp115_ = _data_->_tmp114_;
			objects_queue_set_object_id (_data_->_tmp113_, _data_->_tmp115_);
			_data_->_tmp116_ = _data_->queue;
			_data_->_tmp117_ = objects_base_object_get_type_update (_data_->object);
			_data_->_tmp118_ = _data_->_tmp117_;
			objects_queue_set_query (_data_->_tmp116_, _data_->_tmp118_);
			_data_->_tmp119_ = _data_->queue;
			_data_->_tmp120_ = objects_base_object_to_json (_data_->object);
			_data_->_tmp121_ = _data_->_tmp120_;
			objects_queue_set_args (_data_->_tmp119_, _data_->_tmp121_);
			_g_free0 (_data_->_tmp121_);
			_data_->_tmp122_ = _data_->queue;
			_data_->_tmp123_ = objects_base_object_get_source (_data_->object);
			_data_->_tmp124_ = _data_->_tmp123_;
			_data_->_tmp125_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp124_);
			_data_->_tmp126_ = _data_->_tmp125_;
			objects_queue_set_source_id (_data_->_tmp122_, _data_->_tmp126_);
			_data_->_tmp127_ = services_database_get_default ();
			_data_->_tmp128_ = _data_->_tmp127_;
			_data_->_tmp129_ = _data_->queue;
			services_database_insert_queue (_data_->_tmp128_, _data_->_tmp129_);
			_g_object_unref0 (_data_->_tmp128_);
			_data_->_tmp130_ = _data_->response;
			http_response_set_status (_data_->_tmp130_, TRUE);
			_g_object_unref0 (_data_->queue);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_object_unref0 (_data_->source);
		_g_free0 (_data_->json);
		_g_free0 (_data_->uuid);
		_http_response_unref0 (_data_->response);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->response;
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->source);
	_g_free0 (_data_->json);
	_g_free0 (_data_->uuid);
	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
services_todoist_items_delete_data_free (gpointer _data)
{
	ServicesTodoistItemsDeleteData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->object);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsDeleteData, _data_);
}

void
services_todoist_items_delete (ServicesTodoistItems* self,
                               ObjectsBaseObject* object,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	ServicesTodoistItemsDeleteData* _data_;
	ServicesTodoistItems* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsDeleteData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_delete_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (object);
	_g_object_unref0 (_data_->object);
	_data_->object = _tmp1_;
	services_todoist_items_delete_co (_data_);
}

HttpResponse*
services_todoist_items_delete_finish (ServicesTodoistItems* self,
                                      GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesTodoistItemsDeleteData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_todoist_items_delete_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	ServicesTodoistItemsDeleteData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_delete_co (_data_);
}

static gboolean
services_todoist_items_delete_co (ServicesTodoistItemsDeleteData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_base_object_get_source (_data_->object);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (objects_source_needs_migration (_data_->_tmp2_)) {
		_data_->_tmp3_ = _data_->response;
		http_response_set_status (_data_->_tmp3_, FALSE);
		_data_->_tmp4_ = _data_->response;
		http_response_set_error (_data_->_tmp4_, SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE);
		_data_->_tmp5_ = _data_->response;
		http_response_set_error_code (_data_->_tmp5_, 410);
		_data_->result = _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_->_tmp6_ = util_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = util_generate_string (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->uuid = _data_->_tmp9_;
	_data_->_tmp10_ = services_todoist_get_default ();
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = objects_base_object_get_id (_data_->object);
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_tmp14_ = objects_base_object_get_type_delete (_data_->object);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->_tmp16_ = _data_->uuid;
	_data_->_tmp17_ = services_todoist_get_delete_json (_data_->_tmp11_, _data_->_tmp13_, _data_->_tmp15_, _data_->_tmp16_);
	_data_->_tmp18_ = _data_->_tmp17_;
	_g_object_unref0 (_data_->_tmp11_);
	_data_->json = _data_->_tmp18_;
	_data_->_tmp19_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp19_;
	_data_->_tmp20_ = _data_->message;
	_data_->_tmp21_ = soup_message_get_request_headers (_data_->_tmp20_);
	_data_->_tmp22_ = _data_->_tmp21_;
	_data_->_tmp23_ = objects_base_object_get_source (_data_->object);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = objects_source_get_todoist_data (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	_data_->_tmp27_ = objects_source_todoist_data_get_access_token (_data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	_data_->_tmp29_ = g_strdup_printf ("Bearer %s", _data_->_tmp28_);
	_data_->_tmp30_ = _data_->_tmp29_;
	soup_message_headers_append (_data_->_tmp22_, "Authorization", _data_->_tmp30_);
	_g_free0 (_data_->_tmp30_);
	_data_->_tmp31_ = _data_->message;
	_data_->_tmp32_ = _data_->json;
	_data_->_tmp34_ = 0;
	_data_->_tmp33_ = string_get_data (_data_->_tmp32_, &_data_->_tmp34_);
	_data_->_tmp33__length1 = _data_->_tmp34_;
	_data_->_tmp35_ = _data_->_tmp33_;
	_data_->_tmp35__length1 = _data_->_tmp33__length1;
	_data_->_tmp36_ = g_bytes_new (_data_->_tmp35_, _data_->_tmp35__length1);
	_data_->_tmp37_ = _data_->_tmp36_;
	soup_message_set_request_body_from_bytes (_data_->_tmp31_, "application/json", _data_->_tmp37_);
	_g_bytes_unref0 (_data_->_tmp37_);
	{
		_data_->_tmp38_ = _data_->self->priv->session;
		_data_->_tmp39_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp38_, _data_->_tmp39_, G_PRIORITY_HIGH, NULL, services_todoist_items_delete_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp40_ = soup_session_send_and_read_finish (_data_->_tmp38_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp40_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp41_ = json_parser_new ();
		_data_->parser = _data_->_tmp41_;
		_data_->_tmp42_ = _data_->parser;
		_data_->_tmp43_ = _data_->stream;
		_data_->_tmp44_ = 0;
		_data_->_tmp45_ = g_bytes_get_data (_data_->_tmp43_, &_data_->_tmp44_);
		json_parser_load_from_data (_data_->_tmp42_, (const gchar*) _data_->_tmp45_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp46_ = services_todoist_get_default ();
		_data_->_tmp47_ = _data_->_tmp46_;
		_data_->_tmp48_ = _data_->message;
		g_object_get (_data_->_tmp48_, "status-code", &_data_->_tmp49_, NULL);
		_data_->_tmp50_ = _data_->_tmp49_;
		_data_->_tmp51_ = services_todoist_is_todoist_error (_data_->_tmp47_, _data_->_tmp50_);
		_g_object_unref0 (_data_->_tmp47_);
		if (_data_->_tmp51_) {
			_data_->_tmp52_ = _data_->response;
			_data_->_tmp53_ = _data_->parser;
			_data_->_tmp54_ = json_parser_get_root (_data_->_tmp53_);
			http_response_from_error_json (_data_->_tmp52_, _data_->_tmp54_);
			_data_->_tmp55_ = _data_->message;
			g_object_get (_data_->_tmp55_, "status-code", &_data_->_tmp56_, NULL);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = services_todoist_get_default ();
			_data_->_tmp59_ = _data_->_tmp58_;
			_data_->_tmp60_ = _data_->message;
			g_object_get (_data_->_tmp60_, "status-code", &_data_->_tmp61_, NULL);
			_data_->_tmp62_ = _data_->_tmp61_;
			_data_->_tmp63_ = services_todoist_get_todoist_error (_data_->_tmp59_, _data_->_tmp62_);
			_data_->_tmp64_ = _data_->_tmp63_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp57_, _data_->_tmp64_);
			_g_free0 (_data_->_tmp64_);
			_g_object_unref0 (_data_->_tmp59_);
		} else {
			_data_->_tmp65_ = _data_->parser;
			_data_->_tmp66_ = json_parser_get_root (_data_->_tmp65_);
			_data_->_tmp67_ = json_node_get_object (_data_->_tmp66_);
			_data_->_tmp68_ = json_object_get_object_member (_data_->_tmp67_, "sync_status");
			_data_->_tmp69_ = _json_object_ref0 (_data_->_tmp68_);
			_data_->sync_status = _data_->_tmp69_;
			_data_->_tmp70_ = _data_->sync_status;
			_data_->_tmp71_ = _data_->uuid;
			_data_->_tmp72_ = json_object_get_member (_data_->_tmp70_, _data_->_tmp71_);
			_data_->_tmp73_ = __vala_JsonNode_copy0 (_data_->_tmp72_);
			_data_->uuid_member = _data_->_tmp73_;
			_data_->_tmp74_ = _data_->uuid_member;
			if (json_node_get_node_type (_data_->_tmp74_) == JSON_NODE_VALUE) {
				_data_->_tmp75_ = objects_base_object_get_source (_data_->object);
				_data_->_tmp76_ = _data_->_tmp75_;
				_data_->_tmp77_ = objects_source_get_todoist_data (_data_->_tmp76_);
				_data_->_tmp78_ = _data_->_tmp77_;
				_data_->_tmp79_ = _data_->parser;
				_data_->_tmp80_ = json_parser_get_root (_data_->_tmp79_);
				_data_->_tmp81_ = json_node_get_object (_data_->_tmp80_);
				_data_->_tmp82_ = json_object_get_string_member (_data_->_tmp81_, "sync_token");
				objects_source_todoist_data_set_sync_token (_data_->_tmp78_, _data_->_tmp82_);
				_data_->_tmp83_ = objects_base_object_get_source (_data_->object);
				_data_->_tmp84_ = _data_->_tmp83_;
				_data_->_tmp85_ = g_date_time_new_now_local ();
				_data_->_tmp86_ = _data_->_tmp85_;
				_data_->_tmp87_ = g_date_time_to_string (_data_->_tmp86_);
				_data_->_tmp88_ = _data_->_tmp87_;
				objects_source_set_last_sync (_data_->_tmp84_, _data_->_tmp88_);
				_g_free0 (_data_->_tmp88_);
				_g_date_time_unref0 (_data_->_tmp86_);
				_data_->_tmp89_ = objects_base_object_get_source (_data_->object);
				_data_->_tmp90_ = _data_->_tmp89_;
				objects_source_save (_data_->_tmp90_);
				_data_->_tmp91_ = _data_->response;
				http_response_set_status (_data_->_tmp91_, TRUE);
			} else {
				_data_->_tmp92_ = _data_->response;
				_data_->_tmp93_ = _data_->sync_status;
				_data_->_tmp94_ = _data_->uuid;
				_data_->_tmp95_ = json_object_get_object_member (_data_->_tmp93_, _data_->_tmp94_);
				_data_->_tmp96_ = json_object_get_string_member (_data_->_tmp95_, "error");
				http_response_set_error (_data_->_tmp92_, _data_->_tmp96_);
				_data_->_tmp97_ = _data_->sync_status;
				_data_->_tmp98_ = _data_->uuid;
				_data_->_tmp99_ = json_object_get_object_member (_data_->_tmp97_, _data_->_tmp98_);
				_data_->_tmp100_ = _data_->sync_status;
				_data_->_tmp101_ = _data_->uuid;
				_data_->_tmp102_ = json_object_get_object_member (_data_->_tmp100_, _data_->_tmp101_);
				_data_->_tmp103_ = json_object_get_string_member (_data_->_tmp102_, "error");
				services_todoist_items_debug_error (_data_->self, (guint) json_object_get_int_member (_data_->_tmp99_, "http_code"), _data_->_tmp103_);
			}
			__vala_JsonNode_free0 (_data_->uuid_member);
			_json_object_unref0 (_data_->sync_status);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp104_ = services_todoist_get_default ();
		_data_->_tmp105_ = _data_->_tmp104_;
		_data_->_tmp106_ = _data_->message;
		g_object_get (_data_->_tmp106_, "status-code", &_data_->_tmp107_, NULL);
		_data_->_tmp108_ = _data_->_tmp107_;
		_data_->_tmp109_ = services_todoist_is_todoist_error (_data_->_tmp105_, _data_->_tmp108_);
		_g_object_unref0 (_data_->_tmp105_);
		if (_data_->_tmp109_) {
			_data_->_tmp110_ = _data_->response;
			_data_->_tmp111_ = _data_->e;
			_data_->_tmp112_ = _data_->_tmp111_->message;
			http_response_set_error (_data_->_tmp110_, _data_->_tmp112_);
			_data_->_tmp113_ = _data_->message;
			g_object_get (_data_->_tmp113_, "status-code", &_data_->_tmp114_, NULL);
			_data_->_tmp115_ = _data_->_tmp114_;
			_data_->_tmp116_ = _data_->e;
			_data_->_tmp117_ = _data_->_tmp116_->message;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp115_, _data_->_tmp117_);
		} else {
			_data_->_tmp118_ = objects_queue_new ();
			_data_->queue = _data_->_tmp118_;
			_data_->_tmp119_ = _data_->queue;
			_data_->_tmp120_ = _data_->uuid;
			objects_queue_set_uuid (_data_->_tmp119_, _data_->_tmp120_);
			_data_->_tmp121_ = _data_->queue;
			_data_->_tmp122_ = objects_base_object_get_id (_data_->object);
			_data_->_tmp123_ = _data_->_tmp122_;
			objects_queue_set_object_id (_data_->_tmp121_, _data_->_tmp123_);
			_data_->_tmp124_ = _data_->queue;
			_data_->_tmp125_ = objects_base_object_get_type_delete (_data_->object);
			_data_->_tmp126_ = _data_->_tmp125_;
			objects_queue_set_query (_data_->_tmp124_, _data_->_tmp126_);
			_data_->_tmp127_ = _data_->queue;
			_data_->_tmp128_ = objects_base_object_to_json (_data_->object);
			_data_->_tmp129_ = _data_->_tmp128_;
			objects_queue_set_args (_data_->_tmp127_, _data_->_tmp129_);
			_g_free0 (_data_->_tmp129_);
			_data_->_tmp130_ = _data_->queue;
			_data_->_tmp131_ = objects_base_object_get_source (_data_->object);
			_data_->_tmp132_ = _data_->_tmp131_;
			_data_->_tmp133_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp132_);
			_data_->_tmp134_ = _data_->_tmp133_;
			objects_queue_set_source_id (_data_->_tmp130_, _data_->_tmp134_);
			_data_->_tmp135_ = services_database_get_default ();
			_data_->_tmp136_ = _data_->_tmp135_;
			_data_->_tmp137_ = _data_->queue;
			services_database_insert_queue (_data_->_tmp136_, _data_->_tmp137_);
			_g_object_unref0 (_data_->_tmp136_);
			_data_->_tmp138_ = _data_->response;
			http_response_set_status (_data_->_tmp138_, TRUE);
			_g_object_unref0 (_data_->queue);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_free0 (_data_->json);
		_g_free0 (_data_->uuid);
		_http_response_unref0 (_data_->response);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->response;
	_g_object_unref0 (_data_->message);
	_g_free0 (_data_->json);
	_g_free0 (_data_->uuid);
	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
services_todoist_items_close_item_data_free (gpointer _data)
{
	ServicesTodoistItemsCloseItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsCloseItemData, _data_);
}

void
services_todoist_items_close_item (ServicesTodoistItems* self,
                                   ObjectsItem* item,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	ServicesTodoistItemsCloseItemData* _data_;
	ServicesTodoistItems* _tmp0_;
	ObjectsItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsCloseItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_close_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	services_todoist_items_close_item_co (_data_);
}

HttpResponse*
services_todoist_items_close_item_finish (ServicesTodoistItems* self,
                                          GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesTodoistItemsCloseItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_todoist_items_close_item_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	ServicesTodoistItemsCloseItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_close_item_co (_data_);
}

static gboolean
services_todoist_items_close_item_co (ServicesTodoistItemsCloseItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (objects_source_needs_migration (_data_->_tmp2_)) {
		_data_->_tmp3_ = _data_->response;
		http_response_set_status (_data_->_tmp3_, FALSE);
		_data_->_tmp4_ = _data_->response;
		http_response_set_error (_data_->_tmp4_, SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE);
		_data_->_tmp5_ = _data_->response;
		http_response_set_error_code (_data_->_tmp5_, 410);
		_data_->result = _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_->_tmp6_ = util_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = util_generate_string (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->uuid = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->uuid;
	_data_->_tmp11_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = objects_source_get_todoist_data (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_tmp15_ = objects_source_todoist_data_get_sync_token (_data_->_tmp14_);
	_data_->_tmp16_ = _data_->_tmp15_;
	_data_->_tmp17_ = objects_item_get_check_json (_data_->item, _data_->_tmp10_, "item_close", _data_->_tmp16_);
	_data_->json = _data_->_tmp17_;
	_data_->_tmp18_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp20_ = _g_object_ref0 (_data_->_tmp19_);
	_data_->source = _data_->_tmp20_;
	_data_->_tmp21_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp21_;
	_data_->_tmp22_ = _data_->message;
	_data_->_tmp23_ = soup_message_get_request_headers (_data_->_tmp22_);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = _data_->source;
	_data_->_tmp26_ = objects_source_get_todoist_data (_data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	_data_->_tmp28_ = objects_source_todoist_data_get_access_token (_data_->_tmp27_);
	_data_->_tmp29_ = _data_->_tmp28_;
	_data_->_tmp30_ = g_strdup_printf ("Bearer %s", _data_->_tmp29_);
	_data_->_tmp31_ = _data_->_tmp30_;
	soup_message_headers_append (_data_->_tmp24_, "Authorization", _data_->_tmp31_);
	_g_free0 (_data_->_tmp31_);
	_data_->_tmp32_ = _data_->message;
	_data_->_tmp33_ = _data_->json;
	_data_->_tmp35_ = 0;
	_data_->_tmp34_ = string_get_data (_data_->_tmp33_, &_data_->_tmp35_);
	_data_->_tmp34__length1 = _data_->_tmp35_;
	_data_->_tmp36_ = _data_->_tmp34_;
	_data_->_tmp36__length1 = _data_->_tmp34__length1;
	_data_->_tmp37_ = g_bytes_new (_data_->_tmp36_, _data_->_tmp36__length1);
	_data_->_tmp38_ = _data_->_tmp37_;
	soup_message_set_request_body_from_bytes (_data_->_tmp32_, "application/json", _data_->_tmp38_);
	_g_bytes_unref0 (_data_->_tmp38_);
	{
		_data_->_tmp39_ = _data_->self->priv->session;
		_data_->_tmp40_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp39_, _data_->_tmp40_, G_PRIORITY_HIGH, NULL, services_todoist_items_close_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp41_ = soup_session_send_and_read_finish (_data_->_tmp39_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp41_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp42_ = json_parser_new ();
		_data_->parser = _data_->_tmp42_;
		_data_->_tmp43_ = _data_->parser;
		_data_->_tmp44_ = _data_->stream;
		_data_->_tmp45_ = 0;
		_data_->_tmp46_ = g_bytes_get_data (_data_->_tmp44_, &_data_->_tmp45_);
		json_parser_load_from_data (_data_->_tmp43_, (const gchar*) _data_->_tmp46_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp47_ = services_todoist_get_default ();
		_data_->_tmp48_ = _data_->_tmp47_;
		_data_->_tmp49_ = _data_->message;
		g_object_get (_data_->_tmp49_, "status-code", &_data_->_tmp50_, NULL);
		_data_->_tmp51_ = _data_->_tmp50_;
		_data_->_tmp52_ = services_todoist_is_todoist_error (_data_->_tmp48_, _data_->_tmp51_);
		_g_object_unref0 (_data_->_tmp48_);
		if (_data_->_tmp52_) {
			_data_->_tmp53_ = _data_->response;
			_data_->_tmp54_ = _data_->parser;
			_data_->_tmp55_ = json_parser_get_root (_data_->_tmp54_);
			http_response_from_error_json (_data_->_tmp53_, _data_->_tmp55_);
			_data_->_tmp56_ = _data_->message;
			g_object_get (_data_->_tmp56_, "status-code", &_data_->_tmp57_, NULL);
			_data_->_tmp58_ = _data_->_tmp57_;
			_data_->_tmp59_ = services_todoist_get_default ();
			_data_->_tmp60_ = _data_->_tmp59_;
			_data_->_tmp61_ = _data_->message;
			g_object_get (_data_->_tmp61_, "status-code", &_data_->_tmp62_, NULL);
			_data_->_tmp63_ = _data_->_tmp62_;
			_data_->_tmp64_ = services_todoist_get_todoist_error (_data_->_tmp60_, _data_->_tmp63_);
			_data_->_tmp65_ = _data_->_tmp64_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp58_, _data_->_tmp65_);
			_g_free0 (_data_->_tmp65_);
			_g_object_unref0 (_data_->_tmp60_);
		} else {
			_data_->_tmp66_ = _data_->parser;
			_data_->_tmp67_ = json_parser_get_root (_data_->_tmp66_);
			_data_->_tmp68_ = json_node_get_object (_data_->_tmp67_);
			_data_->_tmp69_ = json_object_get_object_member (_data_->_tmp68_, "sync_status");
			_data_->_tmp70_ = _json_object_ref0 (_data_->_tmp69_);
			_data_->sync_status = _data_->_tmp70_;
			_data_->_tmp71_ = _data_->sync_status;
			_data_->_tmp72_ = _data_->uuid;
			_data_->_tmp73_ = json_object_get_member (_data_->_tmp71_, _data_->_tmp72_);
			_data_->_tmp74_ = __vala_JsonNode_copy0 (_data_->_tmp73_);
			_data_->uuid_member = _data_->_tmp74_;
			_data_->_tmp75_ = _data_->uuid_member;
			if (json_node_get_node_type (_data_->_tmp75_) == JSON_NODE_VALUE) {
				_data_->_tmp76_ = _data_->source;
				_data_->_tmp77_ = objects_source_get_todoist_data (_data_->_tmp76_);
				_data_->_tmp78_ = _data_->_tmp77_;
				_data_->_tmp79_ = _data_->parser;
				_data_->_tmp80_ = json_parser_get_root (_data_->_tmp79_);
				_data_->_tmp81_ = json_node_get_object (_data_->_tmp80_);
				_data_->_tmp82_ = json_object_get_string_member (_data_->_tmp81_, "sync_token");
				objects_source_todoist_data_set_sync_token (_data_->_tmp78_, _data_->_tmp82_);
				_data_->_tmp83_ = _data_->response;
				http_response_set_status (_data_->_tmp83_, TRUE);
				_data_->_tmp84_ = _data_->parser;
				_data_->_tmp85_ = json_parser_get_root (_data_->_tmp84_);
				_data_->_tmp86_ = json_node_get_object (_data_->_tmp85_);
				_data_->_tmp87_ = _json_object_ref0 (_data_->_tmp86_);
				_data_->root = _data_->_tmp87_;
				_data_->_tmp88_ = _data_->root;
				if (json_object_has_member (_data_->_tmp88_, "items")) {
					_data_->_tmp89_ = _data_->root;
					_data_->_tmp90_ = json_object_get_array_member (_data_->_tmp89_, "items");
					_data_->items = _data_->_tmp90_;
					_data_->_tmp91_ = _data_->items;
					_data_->_tmp92_ = json_array_get_elements (_data_->_tmp91_);
					{
						_data_->node_collection = _data_->_tmp92_;
						for (_data_->node_it = _data_->node_collection; _data_->node_it != NULL; _data_->node_it = _data_->node_it->next) {
							_data_->node = (JsonNode*) _data_->node_it->data;
							{
								_data_->_tmp93_ = _data_->node;
								_data_->_tmp94_ = json_node_get_object (_data_->_tmp93_);
								_data_->_tmp95_ = json_object_get_string_member (_data_->_tmp94_, "id");
								_data_->_tmp96_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->item);
								_data_->_tmp97_ = _data_->_tmp96_;
								if (g_strcmp0 (_data_->_tmp95_, _data_->_tmp97_) == 0) {
									_data_->_tmp98_ = _data_->node;
									_data_->_tmp99_ = json_node_get_object (_data_->_tmp98_);
									if (!json_object_get_null_member (_data_->_tmp99_, "due")) {
										_data_->_tmp100_ = objects_item_get_due (_data_->item);
										_data_->_tmp101_ = _data_->_tmp100_;
										_data_->_tmp102_ = _data_->node;
										_data_->_tmp103_ = json_node_get_object (_data_->_tmp102_);
										_data_->_tmp104_ = json_object_get_object_member (_data_->_tmp103_, "due");
										objects_due_date_update_from_todoist_json (_data_->_tmp101_, _data_->_tmp104_);
									}
									break;
								}
							}
						}
						(_data_->node_collection == NULL) ? NULL : (_data_->node_collection = (g_list_free (_data_->node_collection), NULL));
					}
				}
				_data_->_tmp105_ = _data_->source;
				_data_->_tmp106_ = g_date_time_new_now_local ();
				_data_->_tmp107_ = _data_->_tmp106_;
				_data_->_tmp108_ = g_date_time_to_string (_data_->_tmp107_);
				_data_->_tmp109_ = _data_->_tmp108_;
				objects_source_set_last_sync (_data_->_tmp105_, _data_->_tmp109_);
				_g_free0 (_data_->_tmp109_);
				_g_date_time_unref0 (_data_->_tmp107_);
				_data_->_tmp110_ = _data_->source;
				objects_source_save (_data_->_tmp110_);
				_json_object_unref0 (_data_->root);
			} else {
				_data_->_tmp111_ = _data_->response;
				_data_->_tmp112_ = _data_->sync_status;
				_data_->_tmp113_ = _data_->uuid;
				_data_->_tmp114_ = json_object_get_object_member (_data_->_tmp112_, _data_->_tmp113_);
				_data_->_tmp115_ = json_object_get_string_member (_data_->_tmp114_, "error");
				http_response_set_error (_data_->_tmp111_, _data_->_tmp115_);
				_data_->_tmp116_ = _data_->sync_status;
				_data_->_tmp117_ = _data_->uuid;
				_data_->_tmp118_ = json_object_get_object_member (_data_->_tmp116_, _data_->_tmp117_);
				_data_->_tmp119_ = _data_->sync_status;
				_data_->_tmp120_ = _data_->uuid;
				_data_->_tmp121_ = json_object_get_object_member (_data_->_tmp119_, _data_->_tmp120_);
				_data_->_tmp122_ = json_object_get_string_member (_data_->_tmp121_, "error");
				services_todoist_items_debug_error (_data_->self, (guint) json_object_get_int_member (_data_->_tmp118_, "http_code"), _data_->_tmp122_);
			}
			__vala_JsonNode_free0 (_data_->uuid_member);
			_json_object_unref0 (_data_->sync_status);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp123_ = services_todoist_get_default ();
		_data_->_tmp124_ = _data_->_tmp123_;
		_data_->_tmp125_ = _data_->message;
		g_object_get (_data_->_tmp125_, "status-code", &_data_->_tmp126_, NULL);
		_data_->_tmp127_ = _data_->_tmp126_;
		_data_->_tmp128_ = services_todoist_is_todoist_error (_data_->_tmp124_, _data_->_tmp127_);
		_g_object_unref0 (_data_->_tmp124_);
		if (_data_->_tmp128_) {
			_data_->_tmp129_ = _data_->response;
			_data_->_tmp130_ = _data_->e;
			_data_->_tmp131_ = _data_->_tmp130_->message;
			http_response_set_error (_data_->_tmp129_, _data_->_tmp131_);
			_data_->_tmp132_ = _data_->message;
			g_object_get (_data_->_tmp132_, "status-code", &_data_->_tmp133_, NULL);
			_data_->_tmp134_ = _data_->_tmp133_;
			_data_->_tmp135_ = _data_->e;
			_data_->_tmp136_ = _data_->_tmp135_->message;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp134_, _data_->_tmp136_);
		} else {
			_data_->_tmp137_ = objects_queue_new ();
			_data_->queue = _data_->_tmp137_;
			_data_->_tmp138_ = _data_->queue;
			_data_->_tmp139_ = _data_->uuid;
			objects_queue_set_uuid (_data_->_tmp138_, _data_->_tmp139_);
			_data_->_tmp140_ = _data_->queue;
			_data_->_tmp141_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp142_ = _data_->_tmp141_;
			objects_queue_set_object_id (_data_->_tmp140_, _data_->_tmp142_);
			_data_->_tmp143_ = _data_->queue;
			objects_queue_set_query (_data_->_tmp143_, "item_close");
			_data_->_tmp144_ = _data_->queue;
			_data_->_tmp145_ = objects_base_object_to_json ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp146_ = _data_->_tmp145_;
			objects_queue_set_args (_data_->_tmp144_, _data_->_tmp146_);
			_g_free0 (_data_->_tmp146_);
			_data_->_tmp147_ = _data_->queue;
			_data_->_tmp148_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp149_ = _data_->_tmp148_;
			_data_->_tmp150_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp149_);
			_data_->_tmp151_ = _data_->_tmp150_;
			objects_queue_set_source_id (_data_->_tmp147_, _data_->_tmp151_);
			_data_->_tmp152_ = services_database_get_default ();
			_data_->_tmp153_ = _data_->_tmp152_;
			_data_->_tmp154_ = _data_->queue;
			services_database_insert_queue (_data_->_tmp153_, _data_->_tmp154_);
			_g_object_unref0 (_data_->_tmp153_);
			_data_->_tmp155_ = _data_->response;
			http_response_set_status (_data_->_tmp155_, TRUE);
			_g_object_unref0 (_data_->queue);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_object_unref0 (_data_->source);
		_g_free0 (_data_->json);
		_g_free0 (_data_->uuid);
		_http_response_unref0 (_data_->response);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->response;
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->source);
	_g_free0 (_data_->json);
	_g_free0 (_data_->uuid);
	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
services_todoist_items_complete_item_data_free (gpointer _data)
{
	ServicesTodoistItemsCompleteItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsCompleteItemData, _data_);
}

void
services_todoist_items_complete_item (ServicesTodoistItems* self,
                                      ObjectsItem* item,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	ServicesTodoistItemsCompleteItemData* _data_;
	ServicesTodoistItems* _tmp0_;
	ObjectsItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsCompleteItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_complete_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	services_todoist_items_complete_item_co (_data_);
}

HttpResponse*
services_todoist_items_complete_item_finish (ServicesTodoistItems* self,
                                             GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesTodoistItemsCompleteItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_todoist_items_complete_item_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	ServicesTodoistItemsCompleteItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_complete_item_co (_data_);
}

static gboolean
services_todoist_items_complete_item_co (ServicesTodoistItemsCompleteItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (objects_source_needs_migration (_data_->_tmp2_)) {
		_data_->_tmp3_ = _data_->response;
		http_response_set_status (_data_->_tmp3_, FALSE);
		_data_->_tmp4_ = _data_->response;
		http_response_set_error (_data_->_tmp4_, SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE);
		_data_->_tmp5_ = _data_->response;
		http_response_set_error_code (_data_->_tmp5_, 410);
		_data_->result = _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_->_tmp6_ = util_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = util_generate_string (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->uuid = _data_->_tmp9_;
	_data_->_tmp11_ = objects_item_get_checked (_data_->item);
	_data_->_tmp12_ = _data_->_tmp11_;
	if (_data_->_tmp12_) {
		_data_->_tmp10_ = "item_complete";
	} else {
		_data_->_tmp10_ = "item_uncomplete";
	}
	_data_->_tmp13_ = _data_->uuid;
	_data_->_tmp14_ = objects_item_get_check_json (_data_->item, _data_->_tmp13_, _data_->_tmp10_, NULL);
	_data_->json = _data_->_tmp14_;
	_data_->_tmp15_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp16_ = _data_->_tmp15_;
	_data_->_tmp17_ = _g_object_ref0 (_data_->_tmp16_);
	_data_->source = _data_->_tmp17_;
	_data_->_tmp18_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp18_;
	_data_->_tmp19_ = _data_->message;
	_data_->_tmp20_ = soup_message_get_request_headers (_data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = _data_->source;
	_data_->_tmp23_ = objects_source_get_todoist_data (_data_->_tmp22_);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = objects_source_todoist_data_get_access_token (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	_data_->_tmp27_ = g_strdup_printf ("Bearer %s", _data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	soup_message_headers_append (_data_->_tmp21_, "Authorization", _data_->_tmp28_);
	_g_free0 (_data_->_tmp28_);
	_data_->_tmp29_ = _data_->message;
	_data_->_tmp30_ = _data_->json;
	_data_->_tmp32_ = 0;
	_data_->_tmp31_ = string_get_data (_data_->_tmp30_, &_data_->_tmp32_);
	_data_->_tmp31__length1 = _data_->_tmp32_;
	_data_->_tmp33_ = _data_->_tmp31_;
	_data_->_tmp33__length1 = _data_->_tmp31__length1;
	_data_->_tmp34_ = g_bytes_new (_data_->_tmp33_, _data_->_tmp33__length1);
	_data_->_tmp35_ = _data_->_tmp34_;
	soup_message_set_request_body_from_bytes (_data_->_tmp29_, "application/json", _data_->_tmp35_);
	_g_bytes_unref0 (_data_->_tmp35_);
	{
		_data_->_tmp36_ = _data_->self->priv->session;
		_data_->_tmp37_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp36_, _data_->_tmp37_, G_PRIORITY_HIGH, NULL, services_todoist_items_complete_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp38_ = soup_session_send_and_read_finish (_data_->_tmp36_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp38_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp39_ = json_parser_new ();
		_data_->parser = _data_->_tmp39_;
		_data_->_tmp40_ = _data_->parser;
		_data_->_tmp41_ = _data_->stream;
		_data_->_tmp42_ = 0;
		_data_->_tmp43_ = g_bytes_get_data (_data_->_tmp41_, &_data_->_tmp42_);
		json_parser_load_from_data (_data_->_tmp40_, (const gchar*) _data_->_tmp43_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp44_ = services_todoist_get_default ();
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = _data_->message;
		g_object_get (_data_->_tmp46_, "status-code", &_data_->_tmp47_, NULL);
		_data_->_tmp48_ = _data_->_tmp47_;
		_data_->_tmp49_ = services_todoist_is_todoist_error (_data_->_tmp45_, _data_->_tmp48_);
		_g_object_unref0 (_data_->_tmp45_);
		if (_data_->_tmp49_) {
			_data_->_tmp50_ = _data_->response;
			_data_->_tmp51_ = _data_->parser;
			_data_->_tmp52_ = json_parser_get_root (_data_->_tmp51_);
			http_response_from_error_json (_data_->_tmp50_, _data_->_tmp52_);
			_data_->_tmp53_ = _data_->message;
			g_object_get (_data_->_tmp53_, "status-code", &_data_->_tmp54_, NULL);
			_data_->_tmp55_ = _data_->_tmp54_;
			_data_->_tmp56_ = services_todoist_get_default ();
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = _data_->message;
			g_object_get (_data_->_tmp58_, "status-code", &_data_->_tmp59_, NULL);
			_data_->_tmp60_ = _data_->_tmp59_;
			_data_->_tmp61_ = services_todoist_get_todoist_error (_data_->_tmp57_, _data_->_tmp60_);
			_data_->_tmp62_ = _data_->_tmp61_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp55_, _data_->_tmp62_);
			_g_free0 (_data_->_tmp62_);
			_g_object_unref0 (_data_->_tmp57_);
		} else {
			_data_->_tmp63_ = _data_->parser;
			_data_->_tmp64_ = json_parser_get_root (_data_->_tmp63_);
			_data_->_tmp65_ = json_node_get_object (_data_->_tmp64_);
			_data_->_tmp66_ = json_object_get_object_member (_data_->_tmp65_, "sync_status");
			_data_->_tmp67_ = _json_object_ref0 (_data_->_tmp66_);
			_data_->sync_status = _data_->_tmp67_;
			_data_->_tmp68_ = _data_->sync_status;
			_data_->_tmp69_ = _data_->uuid;
			_data_->_tmp70_ = json_object_get_member (_data_->_tmp68_, _data_->_tmp69_);
			_data_->_tmp71_ = __vala_JsonNode_copy0 (_data_->_tmp70_);
			_data_->uuid_member = _data_->_tmp71_;
			_data_->_tmp72_ = _data_->uuid_member;
			if (json_node_get_node_type (_data_->_tmp72_) == JSON_NODE_VALUE) {
				_data_->_tmp73_ = _data_->source;
				_data_->_tmp74_ = objects_source_get_todoist_data (_data_->_tmp73_);
				_data_->_tmp75_ = _data_->_tmp74_;
				_data_->_tmp76_ = _data_->parser;
				_data_->_tmp77_ = json_parser_get_root (_data_->_tmp76_);
				_data_->_tmp78_ = json_node_get_object (_data_->_tmp77_);
				_data_->_tmp79_ = json_object_get_string_member (_data_->_tmp78_, "sync_token");
				objects_source_todoist_data_set_sync_token (_data_->_tmp75_, _data_->_tmp79_);
				_data_->_tmp80_ = _data_->response;
				http_response_set_status (_data_->_tmp80_, TRUE);
				_data_->_tmp81_ = _data_->source;
				_data_->_tmp82_ = g_date_time_new_now_local ();
				_data_->_tmp83_ = _data_->_tmp82_;
				_data_->_tmp84_ = g_date_time_to_string (_data_->_tmp83_);
				_data_->_tmp85_ = _data_->_tmp84_;
				objects_source_set_last_sync (_data_->_tmp81_, _data_->_tmp85_);
				_g_free0 (_data_->_tmp85_);
				_g_date_time_unref0 (_data_->_tmp83_);
				_data_->_tmp86_ = _data_->source;
				objects_source_save (_data_->_tmp86_);
			} else {
				_data_->_tmp87_ = _data_->response;
				_data_->_tmp88_ = _data_->sync_status;
				_data_->_tmp89_ = _data_->uuid;
				_data_->_tmp90_ = json_object_get_object_member (_data_->_tmp88_, _data_->_tmp89_);
				_data_->_tmp91_ = json_object_get_string_member (_data_->_tmp90_, "error");
				http_response_set_error (_data_->_tmp87_, _data_->_tmp91_);
				_data_->_tmp92_ = _data_->sync_status;
				_data_->_tmp93_ = _data_->uuid;
				_data_->_tmp94_ = json_object_get_object_member (_data_->_tmp92_, _data_->_tmp93_);
				_data_->_tmp95_ = _data_->sync_status;
				_data_->_tmp96_ = _data_->uuid;
				_data_->_tmp97_ = json_object_get_object_member (_data_->_tmp95_, _data_->_tmp96_);
				_data_->_tmp98_ = json_object_get_string_member (_data_->_tmp97_, "error");
				services_todoist_items_debug_error (_data_->self, (guint) json_object_get_int_member (_data_->_tmp94_, "http_code"), _data_->_tmp98_);
			}
			__vala_JsonNode_free0 (_data_->uuid_member);
			_json_object_unref0 (_data_->sync_status);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp99_ = services_todoist_get_default ();
		_data_->_tmp100_ = _data_->_tmp99_;
		_data_->_tmp101_ = _data_->message;
		g_object_get (_data_->_tmp101_, "status-code", &_data_->_tmp102_, NULL);
		_data_->_tmp103_ = _data_->_tmp102_;
		_data_->_tmp104_ = services_todoist_is_todoist_error (_data_->_tmp100_, _data_->_tmp103_);
		_g_object_unref0 (_data_->_tmp100_);
		if (_data_->_tmp104_) {
			_data_->_tmp105_ = _data_->response;
			_data_->_tmp106_ = _data_->e;
			_data_->_tmp107_ = _data_->_tmp106_->message;
			http_response_set_error (_data_->_tmp105_, _data_->_tmp107_);
			_data_->_tmp108_ = _data_->message;
			g_object_get (_data_->_tmp108_, "status-code", &_data_->_tmp109_, NULL);
			_data_->_tmp110_ = _data_->_tmp109_;
			_data_->_tmp111_ = _data_->e;
			_data_->_tmp112_ = _data_->_tmp111_->message;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp110_, _data_->_tmp112_);
		} else {
			_data_->_tmp113_ = objects_queue_new ();
			_data_->queue = _data_->_tmp113_;
			_data_->_tmp114_ = _data_->queue;
			_data_->_tmp115_ = _data_->uuid;
			objects_queue_set_uuid (_data_->_tmp114_, _data_->_tmp115_);
			_data_->_tmp116_ = _data_->queue;
			_data_->_tmp117_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp118_ = _data_->_tmp117_;
			objects_queue_set_object_id (_data_->_tmp116_, _data_->_tmp118_);
			_data_->_tmp120_ = objects_item_get_checked (_data_->item);
			_data_->_tmp121_ = _data_->_tmp120_;
			if (_data_->_tmp121_) {
				_data_->_tmp119_ = "item_complete";
			} else {
				_data_->_tmp119_ = "item_uncomplete";
			}
			_data_->_tmp122_ = _data_->queue;
			objects_queue_set_query (_data_->_tmp122_, _data_->_tmp119_);
			_data_->_tmp123_ = _data_->queue;
			_data_->_tmp124_ = objects_base_object_to_json ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp125_ = _data_->_tmp124_;
			objects_queue_set_args (_data_->_tmp123_, _data_->_tmp125_);
			_g_free0 (_data_->_tmp125_);
			_data_->_tmp126_ = _data_->queue;
			_data_->_tmp127_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp128_ = _data_->_tmp127_;
			_data_->_tmp129_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp128_);
			_data_->_tmp130_ = _data_->_tmp129_;
			objects_queue_set_source_id (_data_->_tmp126_, _data_->_tmp130_);
			_data_->_tmp131_ = services_database_get_default ();
			_data_->_tmp132_ = _data_->_tmp131_;
			_data_->_tmp133_ = _data_->queue;
			services_database_insert_queue (_data_->_tmp132_, _data_->_tmp133_);
			_g_object_unref0 (_data_->_tmp132_);
			_data_->_tmp134_ = _data_->response;
			http_response_set_status (_data_->_tmp134_, TRUE);
			_g_object_unref0 (_data_->queue);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_object_unref0 (_data_->source);
		_g_free0 (_data_->json);
		_g_free0 (_data_->uuid);
		_http_response_unref0 (_data_->response);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->response;
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->source);
	_g_free0 (_data_->json);
	_g_free0 (_data_->uuid);
	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
services_todoist_items_move_item_data_free (gpointer _data)
{
	ServicesTodoistItemsMoveItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_free0 (_data_->type);
	_g_free0 (_data_->id);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsMoveItemData, _data_);
}

void
services_todoist_items_move_item (ServicesTodoistItems* self,
                                  ObjectsItem* item,
                                  const gchar* type,
                                  const gchar* id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	ServicesTodoistItemsMoveItemData* _data_;
	ServicesTodoistItems* _tmp0_;
	ObjectsItem* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (type != NULL);
	g_return_if_fail (id != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsMoveItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_move_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_tmp2_ = g_strdup (type);
	_g_free0 (_data_->type);
	_data_->type = _tmp2_;
	_tmp3_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp3_;
	services_todoist_items_move_item_co (_data_);
}

HttpResponse*
services_todoist_items_move_item_finish (ServicesTodoistItems* self,
                                         GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesTodoistItemsMoveItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_todoist_items_move_item_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	ServicesTodoistItemsMoveItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_move_item_co (_data_);
}

static gboolean
services_todoist_items_move_item_co (ServicesTodoistItemsMoveItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (objects_source_needs_migration (_data_->_tmp2_)) {
		_data_->_tmp3_ = _data_->response;
		http_response_set_status (_data_->_tmp3_, FALSE);
		_data_->_tmp4_ = _data_->response;
		http_response_set_error (_data_->_tmp4_, SERVICES_TODOIST_ITEMS_MIGRATE_MESSAGE);
		_data_->_tmp5_ = _data_->response;
		http_response_set_error_code (_data_->_tmp5_, 410);
		_data_->result = _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_->_tmp6_ = util_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = util_generate_string (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->uuid = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->uuid;
	_data_->_tmp11_ = objects_item_get_move_item (_data_->item, _data_->_tmp10_, _data_->type, _data_->id);
	_data_->json = _data_->_tmp11_;
	_data_->_tmp12_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_tmp14_ = _g_object_ref0 (_data_->_tmp13_);
	_data_->source = _data_->_tmp14_;
	_data_->_tmp15_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp15_;
	_data_->_tmp16_ = _data_->message;
	_data_->_tmp17_ = soup_message_get_request_headers (_data_->_tmp16_);
	_data_->_tmp18_ = _data_->_tmp17_;
	_data_->_tmp19_ = _data_->source;
	_data_->_tmp20_ = objects_source_get_todoist_data (_data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = objects_source_todoist_data_get_access_token (_data_->_tmp21_);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = g_strdup_printf ("Bearer %s", _data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	soup_message_headers_append (_data_->_tmp18_, "Authorization", _data_->_tmp25_);
	_g_free0 (_data_->_tmp25_);
	_data_->_tmp26_ = _data_->message;
	_data_->_tmp27_ = _data_->json;
	_data_->_tmp29_ = 0;
	_data_->_tmp28_ = string_get_data (_data_->_tmp27_, &_data_->_tmp29_);
	_data_->_tmp28__length1 = _data_->_tmp29_;
	_data_->_tmp30_ = _data_->_tmp28_;
	_data_->_tmp30__length1 = _data_->_tmp28__length1;
	_data_->_tmp31_ = g_bytes_new (_data_->_tmp30_, _data_->_tmp30__length1);
	_data_->_tmp32_ = _data_->_tmp31_;
	soup_message_set_request_body_from_bytes (_data_->_tmp26_, "application/json", _data_->_tmp32_);
	_g_bytes_unref0 (_data_->_tmp32_);
	{
		_data_->_tmp33_ = _data_->self->priv->session;
		_data_->_tmp34_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp33_, _data_->_tmp34_, G_PRIORITY_HIGH, NULL, services_todoist_items_move_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp35_ = soup_session_send_and_read_finish (_data_->_tmp33_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp35_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp36_ = json_parser_new ();
		_data_->parser = _data_->_tmp36_;
		_data_->_tmp37_ = _data_->parser;
		_data_->_tmp38_ = _data_->stream;
		_data_->_tmp39_ = 0;
		_data_->_tmp40_ = g_bytes_get_data (_data_->_tmp38_, &_data_->_tmp39_);
		json_parser_load_from_data (_data_->_tmp37_, (const gchar*) _data_->_tmp40_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp41_ = services_todoist_get_default ();
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_tmp43_ = _data_->message;
		g_object_get (_data_->_tmp43_, "status-code", &_data_->_tmp44_, NULL);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = services_todoist_is_todoist_error (_data_->_tmp42_, _data_->_tmp45_);
		_g_object_unref0 (_data_->_tmp42_);
		if (_data_->_tmp46_) {
			_data_->_tmp47_ = _data_->response;
			_data_->_tmp48_ = _data_->parser;
			_data_->_tmp49_ = json_parser_get_root (_data_->_tmp48_);
			http_response_from_error_json (_data_->_tmp47_, _data_->_tmp49_);
			_data_->_tmp50_ = _data_->message;
			g_object_get (_data_->_tmp50_, "status-code", &_data_->_tmp51_, NULL);
			_data_->_tmp52_ = _data_->_tmp51_;
			_data_->_tmp53_ = services_todoist_get_default ();
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp55_ = _data_->message;
			g_object_get (_data_->_tmp55_, "status-code", &_data_->_tmp56_, NULL);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = services_todoist_get_todoist_error (_data_->_tmp54_, _data_->_tmp57_);
			_data_->_tmp59_ = _data_->_tmp58_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp52_, _data_->_tmp59_);
			_g_free0 (_data_->_tmp59_);
			_g_object_unref0 (_data_->_tmp54_);
		} else {
			_data_->_tmp60_ = _data_->parser;
			_data_->_tmp61_ = json_parser_get_root (_data_->_tmp60_);
			_data_->_tmp62_ = json_node_get_object (_data_->_tmp61_);
			_data_->_tmp63_ = json_object_get_object_member (_data_->_tmp62_, "sync_status");
			_data_->_tmp64_ = _json_object_ref0 (_data_->_tmp63_);
			_data_->sync_status = _data_->_tmp64_;
			_data_->_tmp65_ = _data_->sync_status;
			_data_->_tmp66_ = _data_->uuid;
			_data_->_tmp67_ = json_object_get_member (_data_->_tmp65_, _data_->_tmp66_);
			_data_->_tmp68_ = __vala_JsonNode_copy0 (_data_->_tmp67_);
			_data_->uuid_member = _data_->_tmp68_;
			_data_->_tmp69_ = _data_->uuid_member;
			if (json_node_get_node_type (_data_->_tmp69_) == JSON_NODE_VALUE) {
				_data_->_tmp70_ = _data_->source;
				_data_->_tmp71_ = objects_source_get_todoist_data (_data_->_tmp70_);
				_data_->_tmp72_ = _data_->_tmp71_;
				_data_->_tmp73_ = _data_->parser;
				_data_->_tmp74_ = json_parser_get_root (_data_->_tmp73_);
				_data_->_tmp75_ = json_node_get_object (_data_->_tmp74_);
				_data_->_tmp76_ = json_object_get_string_member (_data_->_tmp75_, "sync_token");
				objects_source_todoist_data_set_sync_token (_data_->_tmp72_, _data_->_tmp76_);
				_data_->_tmp77_ = _data_->response;
				http_response_set_status (_data_->_tmp77_, TRUE);
				_data_->_tmp78_ = _data_->source;
				_data_->_tmp79_ = g_date_time_new_now_local ();
				_data_->_tmp80_ = _data_->_tmp79_;
				_data_->_tmp81_ = g_date_time_to_string (_data_->_tmp80_);
				_data_->_tmp82_ = _data_->_tmp81_;
				objects_source_set_last_sync (_data_->_tmp78_, _data_->_tmp82_);
				_g_free0 (_data_->_tmp82_);
				_g_date_time_unref0 (_data_->_tmp80_);
				_data_->_tmp83_ = _data_->source;
				objects_source_save (_data_->_tmp83_);
			} else {
				_data_->_tmp84_ = _data_->response;
				_data_->_tmp85_ = _data_->sync_status;
				_data_->_tmp86_ = _data_->uuid;
				_data_->_tmp87_ = json_object_get_object_member (_data_->_tmp85_, _data_->_tmp86_);
				_data_->_tmp88_ = json_object_get_string_member (_data_->_tmp87_, "error");
				http_response_set_error (_data_->_tmp84_, _data_->_tmp88_);
				_data_->_tmp89_ = _data_->sync_status;
				_data_->_tmp90_ = _data_->uuid;
				_data_->_tmp91_ = json_object_get_object_member (_data_->_tmp89_, _data_->_tmp90_);
				_data_->_tmp92_ = _data_->sync_status;
				_data_->_tmp93_ = _data_->uuid;
				_data_->_tmp94_ = json_object_get_object_member (_data_->_tmp92_, _data_->_tmp93_);
				_data_->_tmp95_ = json_object_get_string_member (_data_->_tmp94_, "error");
				services_todoist_items_debug_error (_data_->self, (guint) json_object_get_int_member (_data_->_tmp91_, "http_code"), _data_->_tmp95_);
			}
			__vala_JsonNode_free0 (_data_->uuid_member);
			_json_object_unref0 (_data_->sync_status);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp96_ = services_todoist_get_default ();
		_data_->_tmp97_ = _data_->_tmp96_;
		_data_->_tmp98_ = _data_->message;
		g_object_get (_data_->_tmp98_, "status-code", &_data_->_tmp99_, NULL);
		_data_->_tmp100_ = _data_->_tmp99_;
		_data_->_tmp101_ = services_todoist_is_todoist_error (_data_->_tmp97_, _data_->_tmp100_);
		_g_object_unref0 (_data_->_tmp97_);
		if (_data_->_tmp101_) {
			_data_->_tmp102_ = _data_->response;
			_data_->_tmp103_ = _data_->e;
			_data_->_tmp104_ = _data_->_tmp103_->message;
			http_response_set_error (_data_->_tmp102_, _data_->_tmp104_);
			_data_->_tmp105_ = _data_->message;
			g_object_get (_data_->_tmp105_, "status-code", &_data_->_tmp106_, NULL);
			_data_->_tmp107_ = _data_->_tmp106_;
			_data_->_tmp108_ = _data_->e;
			_data_->_tmp109_ = _data_->_tmp108_->message;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp107_, _data_->_tmp109_);
		} else {
			_data_->_tmp110_ = objects_queue_new ();
			_data_->queue = _data_->_tmp110_;
			_data_->_tmp111_ = _data_->queue;
			_data_->_tmp112_ = _data_->uuid;
			objects_queue_set_uuid (_data_->_tmp111_, _data_->_tmp112_);
			_data_->_tmp113_ = _data_->queue;
			_data_->_tmp114_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp115_ = _data_->_tmp114_;
			objects_queue_set_object_id (_data_->_tmp113_, _data_->_tmp115_);
			_data_->_tmp116_ = _data_->queue;
			objects_queue_set_query (_data_->_tmp116_, "item_move");
			_data_->_tmp117_ = _data_->queue;
			_data_->_tmp118_ = objects_item_to_move_json (_data_->item, _data_->type, _data_->id);
			_data_->_tmp119_ = _data_->_tmp118_;
			objects_queue_set_args (_data_->_tmp117_, _data_->_tmp119_);
			_g_free0 (_data_->_tmp119_);
			_data_->_tmp120_ = _data_->queue;
			_data_->_tmp121_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->item);
			_data_->_tmp122_ = _data_->_tmp121_;
			_data_->_tmp123_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp122_);
			_data_->_tmp124_ = _data_->_tmp123_;
			objects_queue_set_source_id (_data_->_tmp120_, _data_->_tmp124_);
			_data_->_tmp125_ = services_database_get_default ();
			_data_->_tmp126_ = _data_->_tmp125_;
			_data_->_tmp127_ = _data_->queue;
			services_database_insert_queue (_data_->_tmp126_, _data_->_tmp127_);
			_g_object_unref0 (_data_->_tmp126_);
			_data_->_tmp128_ = _data_->response;
			http_response_set_status (_data_->_tmp128_, TRUE);
			_g_object_unref0 (_data_->queue);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_object_unref0 (_data_->source);
		_g_free0 (_data_->json);
		_g_free0 (_data_->uuid);
		_http_response_unref0 (_data_->response);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->response;
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->source);
	_g_free0 (_data_->json);
	_g_free0 (_data_->uuid);
	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
services_todoist_items_update_items_data_free (gpointer _data)
{
	ServicesTodoistItemsUpdateItemsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->objects);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesTodoistItemsUpdateItemsData, _data_);
}

void
services_todoist_items_update_items (ServicesTodoistItems* self,
                                     GeeArrayList* objects,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	ServicesTodoistItemsUpdateItemsData* _data_;
	ServicesTodoistItems* _tmp0_;
	GeeArrayList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (objects != NULL);
	_data_ = g_slice_new0 (ServicesTodoistItemsUpdateItemsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_todoist_items_update_items_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (objects);
	_g_object_unref0 (_data_->objects);
	_data_->objects = _tmp1_;
	services_todoist_items_update_items_co (_data_);
}

void
services_todoist_items_update_items_finish (ServicesTodoistItems* self,
                                            GAsyncResult* _res_)
{
	ServicesTodoistItemsUpdateItemsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
services_todoist_items_update_items_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	ServicesTodoistItemsUpdateItemsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_todoist_items_update_items_co (_data_);
}

static gboolean
services_todoist_items_update_items_co (ServicesTodoistItemsUpdateItemsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_todoist_items_get_update_items_json (_data_->self, _data_->objects);
	_data_->json = _data_->_tmp0_;
	_data_->source = NULL;
	{
		_data_->_item_list = _data_->objects;
		_data_->_tmp1_ = _data_->_item_list;
		_data_->_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_item_size = _data_->_tmp3_;
		_data_->_item_index = -1;
		while (TRUE) {
			_data_->_item_index = _data_->_item_index + 1;
			_data_->_tmp4_ = _data_->_item_index;
			_data_->_tmp5_ = _data_->_item_size;
			if (!(_data_->_tmp4_ < _data_->_tmp5_)) {
				break;
			}
			_data_->_tmp6_ = _data_->_item_list;
			_data_->_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp6_, _data_->_item_index);
			_data_->item = (ObjectsItem*) _data_->_tmp7_;
			_data_->_tmp8_ = _data_->item;
			_data_->_tmp9_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->_tmp8_);
			_data_->_tmp10_ = _data_->_tmp9_;
			if (_data_->_tmp10_ != NULL) {
				_data_->_tmp11_ = _data_->item;
				_data_->_tmp12_ = objects_base_object_get_source ((ObjectsBaseObject*) _data_->_tmp11_);
				_data_->_tmp13_ = _data_->_tmp12_;
				_data_->_tmp14_ = _g_object_ref0 (_data_->_tmp13_);
				_g_object_unref0 (_data_->source);
				_data_->source = _data_->_tmp14_;
				_g_object_unref0 (_data_->item);
				break;
			}
			_g_object_unref0 (_data_->item);
		}
	}
	_data_->_tmp15_ = _data_->source;
	if (_data_->_tmp15_ == NULL) {
		g_warning ("TodoistItems.vala:446: No valid source found in items");
		_g_object_unref0 (_data_->source);
		_g_free0 (_data_->json);
		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_->_tmp16_ = soup_message_new ("POST", SERVICES_TODOIST_ITEMS_TODOIST_SYNC_URL);
	_data_->message = _data_->_tmp16_;
	_data_->_tmp17_ = _data_->message;
	_data_->_tmp18_ = soup_message_get_request_headers (_data_->_tmp17_);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp20_ = _data_->source;
	_data_->_tmp21_ = objects_source_get_todoist_data (_data_->_tmp20_);
	_data_->_tmp22_ = _data_->_tmp21_;
	_data_->_tmp23_ = objects_source_todoist_data_get_access_token (_data_->_tmp22_);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = g_strdup_printf ("Bearer %s", _data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	soup_message_headers_append (_data_->_tmp19_, "Authorization", _data_->_tmp26_);
	_g_free0 (_data_->_tmp26_);
	_data_->_tmp27_ = _data_->message;
	_data_->_tmp28_ = _data_->json;
	_data_->_tmp30_ = 0;
	_data_->_tmp29_ = string_get_data (_data_->_tmp28_, &_data_->_tmp30_);
	_data_->_tmp29__length1 = _data_->_tmp30_;
	_data_->_tmp31_ = _data_->_tmp29_;
	_data_->_tmp31__length1 = _data_->_tmp29__length1;
	_data_->_tmp32_ = g_bytes_new (_data_->_tmp31_, _data_->_tmp31__length1);
	_data_->_tmp33_ = _data_->_tmp32_;
	soup_message_set_request_body_from_bytes (_data_->_tmp27_, "application/json", _data_->_tmp33_);
	_g_bytes_unref0 (_data_->_tmp33_);
	{
		_data_->_tmp34_ = _data_->self->priv->session;
		_data_->_tmp35_ = _data_->message;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp34_, _data_->_tmp35_, G_PRIORITY_HIGH, NULL, services_todoist_items_update_items_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp36_ = soup_session_send_and_read_finish (_data_->_tmp34_, _data_->_res_, &_data_->_inner_error0_);
		_data_->stream = _data_->_tmp36_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp37_ = json_parser_new ();
		_data_->parser = _data_->_tmp37_;
		_data_->_tmp38_ = _data_->parser;
		_data_->_tmp39_ = _data_->stream;
		_data_->_tmp40_ = 0;
		_data_->_tmp41_ = g_bytes_get_data (_data_->_tmp39_, &_data_->_tmp40_);
		json_parser_load_from_data (_data_->_tmp38_, (const gchar*) _data_->_tmp41_, (gssize) -1, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->parser);
			_g_bytes_unref0 (_data_->stream);
			goto __catch0_g_error;
		}
		_data_->_tmp42_ = services_todoist_get_default ();
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp44_ = _data_->message;
		g_object_get (_data_->_tmp44_, "status-code", &_data_->_tmp45_, NULL);
		_data_->_tmp46_ = _data_->_tmp45_;
		_data_->_tmp47_ = services_todoist_is_todoist_error (_data_->_tmp43_, _data_->_tmp46_);
		_g_object_unref0 (_data_->_tmp43_);
		if (_data_->_tmp47_) {
			_data_->_tmp48_ = _data_->message;
			g_object_get (_data_->_tmp48_, "status-code", &_data_->_tmp49_, NULL);
			_data_->_tmp50_ = _data_->_tmp49_;
			_data_->_tmp51_ = services_todoist_get_default ();
			_data_->_tmp52_ = _data_->_tmp51_;
			_data_->_tmp53_ = _data_->message;
			g_object_get (_data_->_tmp53_, "status-code", &_data_->_tmp54_, NULL);
			_data_->_tmp55_ = _data_->_tmp54_;
			_data_->_tmp56_ = services_todoist_get_todoist_error (_data_->_tmp52_, _data_->_tmp55_);
			_data_->_tmp57_ = _data_->_tmp56_;
			services_todoist_items_debug_error (_data_->self, _data_->_tmp50_, _data_->_tmp57_);
			_g_free0 (_data_->_tmp57_);
			_g_object_unref0 (_data_->_tmp52_);
		} else {
			_data_->_tmp58_ = _data_->source;
			_data_->_tmp59_ = objects_source_get_todoist_data (_data_->_tmp58_);
			_data_->_tmp60_ = _data_->_tmp59_;
			_data_->_tmp61_ = _data_->parser;
			_data_->_tmp62_ = json_parser_get_root (_data_->_tmp61_);
			_data_->_tmp63_ = json_node_get_object (_data_->_tmp62_);
			_data_->_tmp64_ = json_object_get_string_member (_data_->_tmp63_, "sync_token");
			objects_source_todoist_data_set_sync_token (_data_->_tmp60_, _data_->_tmp64_);
			_data_->_tmp65_ = _data_->source;
			_data_->_tmp66_ = g_date_time_new_now_local ();
			_data_->_tmp67_ = _data_->_tmp66_;
			_data_->_tmp68_ = g_date_time_to_string (_data_->_tmp67_);
			_data_->_tmp69_ = _data_->_tmp68_;
			objects_source_set_last_sync (_data_->_tmp65_, _data_->_tmp69_);
			_g_free0 (_data_->_tmp69_);
			_g_date_time_unref0 (_data_->_tmp67_);
			_data_->_tmp70_ = _data_->source;
			objects_source_save (_data_->_tmp70_);
		}
		_g_object_unref0 (_data_->parser);
		_g_bytes_unref0 (_data_->stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp71_ = services_log_service_get_default ();
		_data_->_tmp72_ = _data_->_tmp71_;
		_data_->_tmp73_ = _data_->e;
		_data_->_tmp74_ = _data_->_tmp73_->message;
		_data_->_tmp75_ = g_strdup_printf ("Failed to update items: %s", _data_->_tmp74_);
		_data_->_tmp76_ = _data_->_tmp75_;
		services_log_service_warn (_data_->_tmp72_, "Todoist", _data_->_tmp76_);
		_g_free0 (_data_->_tmp76_);
		_g_object_unref0 (_data_->_tmp72_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->message);
		_g_object_unref0 (_data_->source);
		_g_free0 (_data_->json);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->source);
	_g_free0 (_data_->json);
	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;
}

gchar*
services_todoist_items_get_update_items_json (ServicesTodoistItems* self,
                                              GeeArrayList* objects)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp88_;
	JsonBuilder* _tmp89_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp90_;
	JsonBuilder* _tmp91_;
	JsonNode* _tmp92_;
	JsonNode* _tmp93_;
	gchar* _tmp94_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (objects != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_object (_tmp1_);
	_tmp2_ = builder;
	json_builder_set_member_name (_tmp2_, "commands");
	_tmp3_ = builder;
	json_builder_begin_array (_tmp3_);
	{
		GeeArrayList* _item_list = NULL;
		gint _item_size = 0;
		GeeArrayList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _item_index = 0;
		_item_list = objects;
		_tmp4_ = _item_list;
		_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_item_size = _tmp6_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			ObjectsItem* item = NULL;
			GeeArrayList* _tmp9_;
			gpointer _tmp10_;
			JsonBuilder* _tmp11_;
			JsonBuilder* _tmp12_;
			JsonBuilder* _tmp13_;
			JsonBuilder* _tmp14_;
			JsonBuilder* _tmp15_;
			Util* _tmp16_;
			Util* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			JsonBuilder* _tmp20_;
			JsonBuilder* _tmp21_;
			JsonBuilder* _tmp22_;
			JsonBuilder* _tmp23_;
			ObjectsItem* _tmp24_;
			const gchar* _tmp25_;
			const gchar* _tmp26_;
			JsonBuilder* _tmp27_;
			JsonBuilder* _tmp28_;
			Util* _tmp29_;
			Util* _tmp30_;
			ObjectsItem* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			gchar* _tmp34_;
			gchar* _tmp35_;
			JsonBuilder* _tmp36_;
			JsonBuilder* _tmp37_;
			Util* _tmp38_;
			Util* _tmp39_;
			ObjectsItem* _tmp40_;
			const gchar* _tmp41_;
			const gchar* _tmp42_;
			gchar* _tmp43_;
			gchar* _tmp44_;
			JsonBuilder* _tmp45_;
			gint _tmp46_ = 0;
			ObjectsItem* _tmp47_;
			gint _tmp48_;
			gint _tmp49_;
			JsonBuilder* _tmp53_;
			ObjectsItem* _tmp54_;
			gboolean _tmp55_;
			gboolean _tmp56_;
			JsonBuilder* _tmp69_;
			JsonBuilder* _tmp70_;
			JsonBuilder* _tmp85_;
			JsonBuilder* _tmp86_;
			JsonBuilder* _tmp87_;
			_item_index = _item_index + 1;
			_tmp7_ = _item_index;
			_tmp8_ = _item_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _item_list;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
			item = (ObjectsItem*) _tmp10_;
			_tmp11_ = builder;
			json_builder_begin_object (_tmp11_);
			_tmp12_ = builder;
			json_builder_set_member_name (_tmp12_, "type");
			_tmp13_ = builder;
			json_builder_add_string_value (_tmp13_, "item_update");
			_tmp14_ = builder;
			json_builder_set_member_name (_tmp14_, "uuid");
			_tmp15_ = builder;
			_tmp16_ = util_get_default ();
			_tmp17_ = _tmp16_;
			_tmp18_ = util_generate_string (_tmp17_);
			_tmp19_ = _tmp18_;
			json_builder_add_string_value (_tmp15_, _tmp19_);
			_g_free0 (_tmp19_);
			_g_object_unref0 (_tmp17_);
			_tmp20_ = builder;
			json_builder_set_member_name (_tmp20_, "args");
			_tmp21_ = builder;
			json_builder_begin_object (_tmp21_);
			_tmp22_ = builder;
			json_builder_set_member_name (_tmp22_, "id");
			_tmp23_ = builder;
			_tmp24_ = item;
			_tmp25_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp24_);
			_tmp26_ = _tmp25_;
			json_builder_add_string_value (_tmp23_, _tmp26_);
			_tmp27_ = builder;
			json_builder_set_member_name (_tmp27_, "content");
			_tmp28_ = builder;
			_tmp29_ = util_get_default ();
			_tmp30_ = _tmp29_;
			_tmp31_ = item;
			_tmp32_ = objects_item_get_content (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = util_get_encode_text (_tmp30_, _tmp33_);
			_tmp35_ = _tmp34_;
			json_builder_add_string_value (_tmp28_, _tmp35_);
			_g_free0 (_tmp35_);
			_g_object_unref0 (_tmp30_);
			_tmp36_ = builder;
			json_builder_set_member_name (_tmp36_, "description");
			_tmp37_ = builder;
			_tmp38_ = util_get_default ();
			_tmp39_ = _tmp38_;
			_tmp40_ = item;
			_tmp41_ = objects_item_get_description (_tmp40_);
			_tmp42_ = _tmp41_;
			_tmp43_ = util_get_encode_text (_tmp39_, _tmp42_);
			_tmp44_ = _tmp43_;
			json_builder_add_string_value (_tmp37_, _tmp44_);
			_g_free0 (_tmp44_);
			_g_object_unref0 (_tmp39_);
			_tmp45_ = builder;
			json_builder_set_member_name (_tmp45_, "priority");
			_tmp47_ = item;
			_tmp48_ = objects_item_get_priority (_tmp47_);
			_tmp49_ = _tmp48_;
			if (_tmp49_ == 0) {
				_tmp46_ = CONSTANTS_PRIORITY_4;
			} else {
				ObjectsItem* _tmp50_;
				gint _tmp51_;
				gint _tmp52_;
				_tmp50_ = item;
				_tmp51_ = objects_item_get_priority (_tmp50_);
				_tmp52_ = _tmp51_;
				_tmp46_ = _tmp52_;
			}
			_tmp53_ = builder;
			json_builder_add_int_value (_tmp53_, (gint64) _tmp46_);
			_tmp54_ = item;
			_tmp55_ = objects_item_get_has_due (_tmp54_);
			_tmp56_ = _tmp55_;
			if (_tmp56_) {
				JsonBuilder* _tmp57_;
				JsonBuilder* _tmp58_;
				JsonBuilder* _tmp59_;
				JsonBuilder* _tmp60_;
				ObjectsItem* _tmp61_;
				ObjectsDueDate* _tmp62_;
				ObjectsDueDate* _tmp63_;
				gchar* _tmp64_;
				gchar* _tmp65_;
				JsonBuilder* _tmp66_;
				_tmp57_ = builder;
				json_builder_set_member_name (_tmp57_, "due");
				_tmp58_ = builder;
				json_builder_begin_object (_tmp58_);
				_tmp59_ = builder;
				json_builder_set_member_name (_tmp59_, "string");
				_tmp60_ = builder;
				_tmp61_ = item;
				_tmp62_ = objects_item_get_due (_tmp61_);
				_tmp63_ = _tmp62_;
				_tmp64_ = utils_datetime_due_to_todoist_natural_language (_tmp63_);
				_tmp65_ = _tmp64_;
				json_builder_add_string_value (_tmp60_, _tmp65_);
				_g_free0 (_tmp65_);
				_tmp66_ = builder;
				json_builder_end_object (_tmp66_);
			} else {
				JsonBuilder* _tmp67_;
				JsonBuilder* _tmp68_;
				_tmp67_ = builder;
				json_builder_set_member_name (_tmp67_, "due");
				_tmp68_ = builder;
				json_builder_add_null_value (_tmp68_);
			}
			_tmp69_ = builder;
			json_builder_set_member_name (_tmp69_, "labels");
			_tmp70_ = builder;
			json_builder_begin_array (_tmp70_);
			{
				GeeArrayList* _label_list = NULL;
				ObjectsItem* _tmp71_;
				GeeArrayList* _tmp72_;
				GeeArrayList* _tmp73_;
				gint _label_size = 0;
				GeeArrayList* _tmp74_;
				gint _tmp75_;
				gint _tmp76_;
				gint _label_index = 0;
				_tmp71_ = item;
				_tmp72_ = objects_item_get_labels (_tmp71_);
				_tmp73_ = _tmp72_;
				_label_list = _tmp73_;
				_tmp74_ = _label_list;
				_tmp75_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp74_);
				_tmp76_ = _tmp75_;
				_label_size = _tmp76_;
				_label_index = -1;
				while (TRUE) {
					gint _tmp77_;
					gint _tmp78_;
					ObjectsLabel* label = NULL;
					GeeArrayList* _tmp79_;
					gpointer _tmp80_;
					JsonBuilder* _tmp81_;
					ObjectsLabel* _tmp82_;
					const gchar* _tmp83_;
					const gchar* _tmp84_;
					_label_index = _label_index + 1;
					_tmp77_ = _label_index;
					_tmp78_ = _label_size;
					if (!(_tmp77_ < _tmp78_)) {
						break;
					}
					_tmp79_ = _label_list;
					_tmp80_ = gee_abstract_list_get ((GeeAbstractList*) _tmp79_, _label_index);
					label = (ObjectsLabel*) _tmp80_;
					_tmp81_ = builder;
					_tmp82_ = label;
					_tmp83_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp82_);
					_tmp84_ = _tmp83_;
					json_builder_add_string_value (_tmp81_, _tmp84_);
					_g_object_unref0 (label);
				}
			}
			_tmp85_ = builder;
			json_builder_end_array (_tmp85_);
			_tmp86_ = builder;
			json_builder_end_object (_tmp86_);
			_tmp87_ = builder;
			json_builder_end_object (_tmp87_);
			_g_object_unref0 (item);
		}
	}
	_tmp88_ = builder;
	json_builder_end_array (_tmp88_);
	_tmp89_ = builder;
	json_builder_end_object (_tmp89_);
	_tmp90_ = json_generator_new ();
	generator = _tmp90_;
	_tmp91_ = builder;
	_tmp92_ = json_builder_get_root (_tmp91_);
	_tmp93_ = _tmp92_;
	json_generator_set_root (generator, _tmp93_);
	__vala_JsonNode_free0 (_tmp93_);
	_tmp94_ = json_generator_to_data (generator, NULL);
	result = _tmp94_;
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

static void
services_todoist_items_debug_error (ServicesTodoistItems* self,
                                    guint status_code,
                                    const gchar* message)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = g_strdup_printf ("%u", status_code);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("Code: %s - %s", _tmp1_, message);
	_tmp3_ = _tmp2_;
	g_debug ("TodoistItems.vala:517: %s", _tmp3_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
}

static void
services_todoist_items_class_init (ServicesTodoistItemsClass * klass,
                                   gpointer klass_data)
{
	services_todoist_items_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesTodoistItems_private_offset);
	G_OBJECT_CLASS (klass)->finalize = services_todoist_items_finalize;
}

static void
services_todoist_items_instance_init (ServicesTodoistItems * self,
                                      gpointer klass)
{
	self->priv = services_todoist_items_get_instance_private (self);
}

static void
services_todoist_items_finalize (GObject * obj)
{
	ServicesTodoistItems * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_TYPE_TODOIST_ITEMS, ServicesTodoistItems);
	_g_object_unref0 (self->priv->session);
	G_OBJECT_CLASS (services_todoist_items_parent_class)->finalize (obj);
}

static GType
services_todoist_items_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesTodoistItemsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_todoist_items_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesTodoistItems), 0, (GInstanceInitFunc) services_todoist_items_instance_init, NULL };
	GType services_todoist_items_type_id;
	services_todoist_items_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesTodoistItems", &g_define_type_info, 0);
	ServicesTodoistItems_private_offset = g_type_add_instance_private (services_todoist_items_type_id, sizeof (ServicesTodoistItemsPrivate));
	return services_todoist_items_type_id;
}

GType
services_todoist_items_get_type (void)
{
	static volatile gsize services_todoist_items_type_id__once = 0;
	if (g_once_init_enter (&services_todoist_items_type_id__once)) {
		GType services_todoist_items_type_id;
		services_todoist_items_type_id = services_todoist_items_get_type_once ();
		g_once_init_leave (&services_todoist_items_type_id__once, services_todoist_items_type_id);
	}
	return services_todoist_items_type_id__once;
}

