#include "td_api.h"

#include "td/tl/tl_jni_object.h"

#include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/tl_parsers.h"
#include "td/utils/tl_storers.h"
#include "td/utils/TlStorerToString.h"

namespace td {
namespace td_api {


jclass addedProxy::Class;
jfieldID addedProxy::id_fieldID;
jfieldID addedProxy::last_used_date_fieldID;
jfieldID addedProxy::is_enabled_fieldID;
jfieldID addedProxy::comment_fieldID;
jfieldID addedProxy::proxy_fieldID;

addedProxy::addedProxy()
  : id_()
  , last_used_date_()
  , is_enabled_()
  , comment_()
  , proxy_()
{}

addedProxy::addedProxy(int32 id_, int32 last_used_date_, bool is_enabled_, string const &comment_, object_ptr<proxy> &&proxy_)
  : id_(id_)
  , last_used_date_(last_used_date_)
  , is_enabled_(is_enabled_)
  , comment_(comment_)
  , proxy_(std::move(proxy_))
{}

const std::int32_t addedProxy::ID;

object_ptr<addedProxy> addedProxy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addedProxy> res = make_object<addedProxy>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->last_used_date_ = env->GetIntField(p, res->last_used_date_fieldID);
  res->is_enabled_ = (env->GetBooleanField(p, res->is_enabled_fieldID) != 0);
  res->comment_ = jni::fetch_string(env, p, res->comment_fieldID);
  res->proxy_ = jni::fetch_tl_object<proxy>(env, jni::fetch_object(env, p, res->proxy_fieldID));
  return res;
}

void addedProxy::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetIntField(s, last_used_date_fieldID, last_used_date_);
  env->SetBooleanField(s, is_enabled_fieldID, is_enabled_);
  { jstring nextString = jni::to_jstring(env, comment_); if (nextString) { env->SetObjectField(s, comment_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (proxy_ != nullptr) { jobject next; proxy_->store(env, next); if (next) { env->SetObjectField(s, proxy_fieldID, next); env->DeleteLocalRef(next); } }
}

void addedProxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddedProxy");
    s.store_field("id", id_);
    s.store_field("lastUsedDate", last_used_date_);
    s.store_field("isEnabled", is_enabled_);
    s.store_field("comment", comment_);
    s.store_object_field("proxy", static_cast<const BaseObject *>(proxy_.get()));
    s.store_class_end();
  }
}

void addedProxy::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddedProxy").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    last_used_date_fieldID = jni::get_field_id(env, Class, "lastUsedDate", "I");
    is_enabled_fieldID = jni::get_field_id(env, Class, "isEnabled", "Z");
    comment_fieldID = jni::get_field_id(env, Class, "comment", "Ljava/lang/String;");
    proxy_fieldID = jni::get_field_id(env, Class, "proxy", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Proxy;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addedReaction::Class;
jfieldID addedReaction::type_fieldID;
jfieldID addedReaction::sender_id_fieldID;
jfieldID addedReaction::is_outgoing_fieldID;
jfieldID addedReaction::date_fieldID;

addedReaction::addedReaction()
  : type_()
  , sender_id_()
  , is_outgoing_()
  , date_()
{}

addedReaction::addedReaction(object_ptr<ReactionType> &&type_, object_ptr<MessageSender> &&sender_id_, bool is_outgoing_, int32 date_)
  : type_(std::move(type_))
  , sender_id_(std::move(sender_id_))
  , is_outgoing_(is_outgoing_)
  , date_(date_)
{}

const std::int32_t addedReaction::ID;

object_ptr<addedReaction> addedReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addedReaction> res = make_object<addedReaction>();
  res->type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->is_outgoing_ = (env->GetBooleanField(p, res->is_outgoing_fieldID) != 0);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void addedReaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_outgoing_fieldID, is_outgoing_);
  env->SetIntField(s, date_fieldID, date_);
}

void addedReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddedReaction");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("isOutgoing", is_outgoing_);
    s.store_field("date", date_);
    s.store_class_end();
  }
}

void addedReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddedReaction").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_outgoing_fieldID = jni::get_field_id(env, Class, "isOutgoing", "Z");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass addedReactions::Class;
jfieldID addedReactions::total_count_fieldID;
jfieldID addedReactions::reactions_fieldID;
jfieldID addedReactions::next_offset_fieldID;

addedReactions::addedReactions()
  : total_count_()
  , reactions_()
  , next_offset_()
{}

addedReactions::addedReactions(int32 total_count_, array<object_ptr<addedReaction>> &&reactions_, string const &next_offset_)
  : total_count_(total_count_)
  , reactions_(std::move(reactions_))
  , next_offset_(next_offset_)
{}

const std::int32_t addedReactions::ID;

object_ptr<addedReactions> addedReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addedReactions> res = make_object<addedReactions>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->reactions_ = jni::FetchVector<addedReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->reactions_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void addedReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, reactions_); if (arr_tmp_) { env->SetObjectField(s, reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void addedReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddedReactions");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("reactions", reactions_.size()); for (const auto &_value : reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("nextOffset", next_offset_);
    s.store_class_end();
  }
}

void addedReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddedReactions").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    reactions_fieldID = jni::get_field_id(env, Class, "reactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AddedReaction;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass affiliateProgramInfo::Class;
jfieldID affiliateProgramInfo::parameters_fieldID;
jfieldID affiliateProgramInfo::end_date_fieldID;
jfieldID affiliateProgramInfo::daily_revenue_per_user_amount_fieldID;

affiliateProgramInfo::affiliateProgramInfo()
  : parameters_()
  , end_date_()
  , daily_revenue_per_user_amount_()
{}

affiliateProgramInfo::affiliateProgramInfo(object_ptr<affiliateProgramParameters> &&parameters_, int32 end_date_, object_ptr<starAmount> &&daily_revenue_per_user_amount_)
  : parameters_(std::move(parameters_))
  , end_date_(end_date_)
  , daily_revenue_per_user_amount_(std::move(daily_revenue_per_user_amount_))
{}

const std::int32_t affiliateProgramInfo::ID;

object_ptr<affiliateProgramInfo> affiliateProgramInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<affiliateProgramInfo> res = make_object<affiliateProgramInfo>();
  res->parameters_ = jni::fetch_tl_object<affiliateProgramParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->end_date_ = env->GetIntField(p, res->end_date_fieldID);
  res->daily_revenue_per_user_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->daily_revenue_per_user_amount_fieldID));
  return res;
}

void affiliateProgramInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (parameters_ != nullptr) { jobject next; parameters_->store(env, next); if (next) { env->SetObjectField(s, parameters_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, end_date_fieldID, end_date_);
  if (daily_revenue_per_user_amount_ != nullptr) { jobject next; daily_revenue_per_user_amount_->store(env, next); if (next) { env->SetObjectField(s, daily_revenue_per_user_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void affiliateProgramInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AffiliateProgramInfo");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("endDate", end_date_);
    s.store_object_field("dailyRevenuePerUserAmount", static_cast<const BaseObject *>(daily_revenue_per_user_amount_.get()));
    s.store_class_end();
  }
}

void affiliateProgramInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateProgramInfo").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateProgramParameters;").c_str());
    end_date_fieldID = jni::get_field_id(env, Class, "endDate", "I");
    daily_revenue_per_user_amount_fieldID = jni::get_field_id(env, Class, "dailyRevenuePerUserAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass AffiliateType::Class;

object_ptr<AffiliateType> AffiliateType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case affiliateTypeCurrentUser::ID:
      return affiliateTypeCurrentUser::fetch(env, p);
    case affiliateTypeBot::ID:
      return affiliateTypeBot::fetch(env, p);
    case affiliateTypeChannel::ID:
      return affiliateTypeChannel::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void AffiliateType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass affiliateTypeCurrentUser::Class;

affiliateTypeCurrentUser::affiliateTypeCurrentUser() {
}

const std::int32_t affiliateTypeCurrentUser::ID;

object_ptr<AffiliateType> affiliateTypeCurrentUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<affiliateTypeCurrentUser>();
}

void affiliateTypeCurrentUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AffiliateTypeCurrentUser");
    s.store_class_end();
  }
}

void affiliateTypeCurrentUser::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateTypeCurrentUser").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass affiliateTypeBot::Class;
jfieldID affiliateTypeBot::user_id_fieldID;

affiliateTypeBot::affiliateTypeBot()
  : user_id_()
{}

affiliateTypeBot::affiliateTypeBot(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t affiliateTypeBot::ID;

object_ptr<AffiliateType> affiliateTypeBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<affiliateTypeBot> res = make_object<affiliateTypeBot>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  return std::move(res);
}

void affiliateTypeBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AffiliateTypeBot");
    s.store_field("userId", user_id_);
    s.store_class_end();
  }
}

void affiliateTypeBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateTypeBot").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass affiliateTypeChannel::Class;
jfieldID affiliateTypeChannel::chat_id_fieldID;

affiliateTypeChannel::affiliateTypeChannel()
  : chat_id_()
{}

affiliateTypeChannel::affiliateTypeChannel(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t affiliateTypeChannel::ID;

object_ptr<AffiliateType> affiliateTypeChannel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<affiliateTypeChannel> res = make_object<affiliateTypeChannel>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return std::move(res);
}

void affiliateTypeChannel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AffiliateTypeChannel");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

void affiliateTypeChannel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateTypeChannel").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass birthdate::Class;
jfieldID birthdate::day_fieldID;
jfieldID birthdate::month_fieldID;
jfieldID birthdate::year_fieldID;

birthdate::birthdate()
  : day_()
  , month_()
  , year_()
{}

birthdate::birthdate(int32 day_, int32 month_, int32 year_)
  : day_(day_)
  , month_(month_)
  , year_(year_)
{}

const std::int32_t birthdate::ID;

object_ptr<birthdate> birthdate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<birthdate> res = make_object<birthdate>();
  res->day_ = env->GetIntField(p, res->day_fieldID);
  res->month_ = env->GetIntField(p, res->month_fieldID);
  res->year_ = env->GetIntField(p, res->year_fieldID);
  return res;
}

void birthdate::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, day_fieldID, day_);
  env->SetIntField(s, month_fieldID, month_);
  env->SetIntField(s, year_fieldID, year_);
}

void birthdate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Birthdate");
    s.store_field("day", day_);
    s.store_field("month", month_);
    s.store_field("year", year_);
    s.store_class_end();
  }
}

void birthdate::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Birthdate").c_str());
    day_fieldID = jni::get_field_id(env, Class, "day", "I");
    month_fieldID = jni::get_field_id(env, Class, "month", "I");
    year_fieldID = jni::get_field_id(env, Class, "year", "I");
    return true;
  }();
  (void)is_inited;
}

jclass botCommand::Class;
jfieldID botCommand::command_fieldID;
jfieldID botCommand::description_fieldID;

botCommand::botCommand()
  : command_()
  , description_()
{}

botCommand::botCommand(string const &command_, string const &description_)
  : command_(command_)
  , description_(description_)
{}

const std::int32_t botCommand::ID;

object_ptr<botCommand> botCommand::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botCommand> res = make_object<botCommand>();
  res->command_ = jni::fetch_string(env, p, res->command_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return res;
}

void botCommand::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, command_); if (nextString) { env->SetObjectField(s, command_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void botCommand::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotCommand");
    s.store_field("command", command_);
    s.store_field("description", description_);
    s.store_class_end();
  }
}

void botCommand::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotCommand").c_str());
    command_fieldID = jni::get_field_id(env, Class, "command", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass botMenuButton::Class;
jfieldID botMenuButton::text_fieldID;
jfieldID botMenuButton::url_fieldID;

botMenuButton::botMenuButton()
  : text_()
  , url_()
{}

botMenuButton::botMenuButton(string const &text_, string const &url_)
  : text_(text_)
  , url_(url_)
{}

const std::int32_t botMenuButton::ID;

object_ptr<botMenuButton> botMenuButton::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botMenuButton> res = make_object<botMenuButton>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return res;
}

void botMenuButton::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, text_); if (nextString) { env->SetObjectField(s, text_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void botMenuButton::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotMenuButton");
    s.store_field("text", text_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void botMenuButton::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotMenuButton").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass businessBotManageBar::Class;
jfieldID businessBotManageBar::bot_user_id_fieldID;
jfieldID businessBotManageBar::manage_url_fieldID;
jfieldID businessBotManageBar::is_bot_paused_fieldID;
jfieldID businessBotManageBar::can_bot_reply_fieldID;

businessBotManageBar::businessBotManageBar()
  : bot_user_id_()
  , manage_url_()
  , is_bot_paused_()
  , can_bot_reply_()
{}

businessBotManageBar::businessBotManageBar(int53 bot_user_id_, string const &manage_url_, bool is_bot_paused_, bool can_bot_reply_)
  : bot_user_id_(bot_user_id_)
  , manage_url_(manage_url_)
  , is_bot_paused_(is_bot_paused_)
  , can_bot_reply_(can_bot_reply_)
{}

const std::int32_t businessBotManageBar::ID;

object_ptr<businessBotManageBar> businessBotManageBar::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessBotManageBar> res = make_object<businessBotManageBar>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->manage_url_ = jni::fetch_string(env, p, res->manage_url_fieldID);
  res->is_bot_paused_ = (env->GetBooleanField(p, res->is_bot_paused_fieldID) != 0);
  res->can_bot_reply_ = (env->GetBooleanField(p, res->can_bot_reply_fieldID) != 0);
  return res;
}

void businessBotManageBar::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, bot_user_id_fieldID, bot_user_id_);
  { jstring nextString = jni::to_jstring(env, manage_url_); if (nextString) { env->SetObjectField(s, manage_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_bot_paused_fieldID, is_bot_paused_);
  env->SetBooleanField(s, can_bot_reply_fieldID, can_bot_reply_);
}

void businessBotManageBar::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessBotManageBar");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("manageUrl", manage_url_);
    s.store_field("isBotPaused", is_bot_paused_);
    s.store_field("canBotReply", can_bot_reply_);
    s.store_class_end();
  }
}

void businessBotManageBar::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessBotManageBar").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    manage_url_fieldID = jni::get_field_id(env, Class, "manageUrl", "Ljava/lang/String;");
    is_bot_paused_fieldID = jni::get_field_id(env, Class, "isBotPaused", "Z");
    can_bot_reply_fieldID = jni::get_field_id(env, Class, "canBotReply", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass businessOpeningHours::Class;
jfieldID businessOpeningHours::time_zone_id_fieldID;
jfieldID businessOpeningHours::opening_hours_fieldID;

businessOpeningHours::businessOpeningHours()
  : time_zone_id_()
  , opening_hours_()
{}

businessOpeningHours::businessOpeningHours(string const &time_zone_id_, array<object_ptr<businessOpeningHoursInterval>> &&opening_hours_)
  : time_zone_id_(time_zone_id_)
  , opening_hours_(std::move(opening_hours_))
{}

const std::int32_t businessOpeningHours::ID;

object_ptr<businessOpeningHours> businessOpeningHours::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessOpeningHours> res = make_object<businessOpeningHours>();
  res->time_zone_id_ = jni::fetch_string(env, p, res->time_zone_id_fieldID);
  res->opening_hours_ = jni::FetchVector<businessOpeningHoursInterval>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->opening_hours_fieldID));
  return res;
}

void businessOpeningHours::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, time_zone_id_); if (nextString) { env->SetObjectField(s, time_zone_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, opening_hours_); if (arr_tmp_) { env->SetObjectField(s, opening_hours_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void businessOpeningHours::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessOpeningHours");
    s.store_field("timeZoneId", time_zone_id_);
    { s.store_vector_begin("openingHours", opening_hours_.size()); for (const auto &_value : opening_hours_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void businessOpeningHours::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessOpeningHours").c_str());
    time_zone_id_fieldID = jni::get_field_id(env, Class, "timeZoneId", "Ljava/lang/String;");
    opening_hours_fieldID = jni::get_field_id(env, Class, "openingHours", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BusinessOpeningHoursInterval;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass businessRecipients::Class;
jfieldID businessRecipients::chat_ids_fieldID;
jfieldID businessRecipients::excluded_chat_ids_fieldID;
jfieldID businessRecipients::select_existing_chats_fieldID;
jfieldID businessRecipients::select_new_chats_fieldID;
jfieldID businessRecipients::select_contacts_fieldID;
jfieldID businessRecipients::select_non_contacts_fieldID;
jfieldID businessRecipients::exclude_selected_fieldID;

businessRecipients::businessRecipients()
  : chat_ids_()
  , excluded_chat_ids_()
  , select_existing_chats_()
  , select_new_chats_()
  , select_contacts_()
  , select_non_contacts_()
  , exclude_selected_()
{}

businessRecipients::businessRecipients(array<int53> &&chat_ids_, array<int53> &&excluded_chat_ids_, bool select_existing_chats_, bool select_new_chats_, bool select_contacts_, bool select_non_contacts_, bool exclude_selected_)
  : chat_ids_(std::move(chat_ids_))
  , excluded_chat_ids_(std::move(excluded_chat_ids_))
  , select_existing_chats_(select_existing_chats_)
  , select_new_chats_(select_new_chats_)
  , select_contacts_(select_contacts_)
  , select_non_contacts_(select_non_contacts_)
  , exclude_selected_(exclude_selected_)
{}

const std::int32_t businessRecipients::ID;

object_ptr<businessRecipients> businessRecipients::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessRecipients> res = make_object<businessRecipients>();
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  res->excluded_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->excluded_chat_ids_fieldID));
  res->select_existing_chats_ = (env->GetBooleanField(p, res->select_existing_chats_fieldID) != 0);
  res->select_new_chats_ = (env->GetBooleanField(p, res->select_new_chats_fieldID) != 0);
  res->select_contacts_ = (env->GetBooleanField(p, res->select_contacts_fieldID) != 0);
  res->select_non_contacts_ = (env->GetBooleanField(p, res->select_non_contacts_fieldID) != 0);
  res->exclude_selected_ = (env->GetBooleanField(p, res->exclude_selected_fieldID) != 0);
  return res;
}

void businessRecipients::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, chat_ids_); if (arr_tmp_) { env->SetObjectField(s, chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, excluded_chat_ids_); if (arr_tmp_) { env->SetObjectField(s, excluded_chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, select_existing_chats_fieldID, select_existing_chats_);
  env->SetBooleanField(s, select_new_chats_fieldID, select_new_chats_);
  env->SetBooleanField(s, select_contacts_fieldID, select_contacts_);
  env->SetBooleanField(s, select_non_contacts_fieldID, select_non_contacts_);
  env->SetBooleanField(s, exclude_selected_fieldID, exclude_selected_);
}

void businessRecipients::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessRecipients");
    { s.store_vector_begin("chatIds", chat_ids_.size()); for (const auto &_value : chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("excludedChatIds", excluded_chat_ids_.size()); for (const auto &_value : excluded_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("selectExistingChats", select_existing_chats_);
    s.store_field("selectNewChats", select_new_chats_);
    s.store_field("selectContacts", select_contacts_);
    s.store_field("selectNonContacts", select_non_contacts_);
    s.store_field("excludeSelected", exclude_selected_);
    s.store_class_end();
  }
}

void businessRecipients::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessRecipients").c_str());
    chat_ids_fieldID = jni::get_field_id(env, Class, "chatIds", "[J");
    excluded_chat_ids_fieldID = jni::get_field_id(env, Class, "excludedChatIds", "[J");
    select_existing_chats_fieldID = jni::get_field_id(env, Class, "selectExistingChats", "Z");
    select_new_chats_fieldID = jni::get_field_id(env, Class, "selectNewChats", "Z");
    select_contacts_fieldID = jni::get_field_id(env, Class, "selectContacts", "Z");
    select_non_contacts_fieldID = jni::get_field_id(env, Class, "selectNonContacts", "Z");
    exclude_selected_fieldID = jni::get_field_id(env, Class, "excludeSelected", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass call::Class;
jfieldID call::id_fieldID;
jfieldID call::unique_id_fieldID;
jfieldID call::user_id_fieldID;
jfieldID call::is_outgoing_fieldID;
jfieldID call::is_video_fieldID;
jfieldID call::state_fieldID;

call::call()
  : id_()
  , unique_id_()
  , user_id_()
  , is_outgoing_()
  , is_video_()
  , state_()
{}

call::call(int32 id_, int64 unique_id_, int53 user_id_, bool is_outgoing_, bool is_video_, object_ptr<CallState> &&state_)
  : id_(id_)
  , unique_id_(unique_id_)
  , user_id_(user_id_)
  , is_outgoing_(is_outgoing_)
  , is_video_(is_video_)
  , state_(std::move(state_))
{}

const std::int32_t call::ID;

object_ptr<call> call::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<call> res = make_object<call>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->unique_id_ = env->GetLongField(p, res->unique_id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->is_outgoing_ = (env->GetBooleanField(p, res->is_outgoing_fieldID) != 0);
  res->is_video_ = (env->GetBooleanField(p, res->is_video_fieldID) != 0);
  res->state_ = jni::fetch_tl_object<CallState>(env, jni::fetch_object(env, p, res->state_fieldID));
  return res;
}

void call::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetLongField(s, unique_id_fieldID, unique_id_);
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetBooleanField(s, is_outgoing_fieldID, is_outgoing_);
  env->SetBooleanField(s, is_video_fieldID, is_video_);
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
}

void call::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Call");
    s.store_field("id", id_);
    s.store_field("uniqueId", unique_id_);
    s.store_field("userId", user_id_);
    s.store_field("isOutgoing", is_outgoing_);
    s.store_field("isVideo", is_video_);
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_class_end();
  }
}

void call::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Call").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    unique_id_fieldID = jni::get_field_id(env, Class, "uniqueId", "J");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    is_outgoing_fieldID = jni::get_field_id(env, Class, "isOutgoing", "Z");
    is_video_fieldID = jni::get_field_id(env, Class, "isVideo", "Z");
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass callServer::Class;
jfieldID callServer::id_fieldID;
jfieldID callServer::ip_address_fieldID;
jfieldID callServer::ipv6_address_fieldID;
jfieldID callServer::port_fieldID;
jfieldID callServer::type_fieldID;

callServer::callServer()
  : id_()
  , ip_address_()
  , ipv6_address_()
  , port_()
  , type_()
{}

callServer::callServer(int64 id_, string const &ip_address_, string const &ipv6_address_, int32 port_, object_ptr<CallServerType> &&type_)
  : id_(id_)
  , ip_address_(ip_address_)
  , ipv6_address_(ipv6_address_)
  , port_(port_)
  , type_(std::move(type_))
{}

const std::int32_t callServer::ID;

object_ptr<callServer> callServer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<callServer> res = make_object<callServer>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->ip_address_ = jni::fetch_string(env, p, res->ip_address_fieldID);
  res->ipv6_address_ = jni::fetch_string(env, p, res->ipv6_address_fieldID);
  res->port_ = env->GetIntField(p, res->port_fieldID);
  res->type_ = jni::fetch_tl_object<CallServerType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void callServer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, ip_address_); if (nextString) { env->SetObjectField(s, ip_address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, ipv6_address_); if (nextString) { env->SetObjectField(s, ipv6_address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, port_fieldID, port_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void callServer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CallServer");
    s.store_field("id", id_);
    s.store_field("ipAddress", ip_address_);
    s.store_field("ipv6Address", ipv6_address_);
    s.store_field("port", port_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void callServer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CallServer").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    ip_address_fieldID = jni::get_field_id(env, Class, "ipAddress", "Ljava/lang/String;");
    ipv6_address_fieldID = jni::get_field_id(env, Class, "ipv6Address", "Ljava/lang/String;");
    port_fieldID = jni::get_field_id(env, Class, "port", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallServerType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass CanTransferOwnershipResult::Class;

object_ptr<CanTransferOwnershipResult> CanTransferOwnershipResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case canTransferOwnershipResultOk::ID:
      return canTransferOwnershipResultOk::fetch(env, p);
    case canTransferOwnershipResultPasswordNeeded::ID:
      return canTransferOwnershipResultPasswordNeeded::fetch(env, p);
    case canTransferOwnershipResultPasswordTooFresh::ID:
      return canTransferOwnershipResultPasswordTooFresh::fetch(env, p);
    case canTransferOwnershipResultSessionTooFresh::ID:
      return canTransferOwnershipResultSessionTooFresh::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void CanTransferOwnershipResult::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanTransferOwnershipResult").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass canTransferOwnershipResultOk::Class;

canTransferOwnershipResultOk::canTransferOwnershipResultOk() {
}

const std::int32_t canTransferOwnershipResultOk::ID;

object_ptr<CanTransferOwnershipResult> canTransferOwnershipResultOk::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<canTransferOwnershipResultOk>();
}

void canTransferOwnershipResultOk::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void canTransferOwnershipResultOk::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanTransferOwnershipResultOk");
    s.store_class_end();
  }
}

void canTransferOwnershipResultOk::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanTransferOwnershipResultOk").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass canTransferOwnershipResultPasswordNeeded::Class;

canTransferOwnershipResultPasswordNeeded::canTransferOwnershipResultPasswordNeeded() {
}

const std::int32_t canTransferOwnershipResultPasswordNeeded::ID;

object_ptr<CanTransferOwnershipResult> canTransferOwnershipResultPasswordNeeded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<canTransferOwnershipResultPasswordNeeded>();
}

void canTransferOwnershipResultPasswordNeeded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void canTransferOwnershipResultPasswordNeeded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanTransferOwnershipResultPasswordNeeded");
    s.store_class_end();
  }
}

void canTransferOwnershipResultPasswordNeeded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanTransferOwnershipResultPasswordNeeded").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass canTransferOwnershipResultPasswordTooFresh::Class;
jfieldID canTransferOwnershipResultPasswordTooFresh::retry_after_fieldID;

canTransferOwnershipResultPasswordTooFresh::canTransferOwnershipResultPasswordTooFresh()
  : retry_after_()
{}

canTransferOwnershipResultPasswordTooFresh::canTransferOwnershipResultPasswordTooFresh(int32 retry_after_)
  : retry_after_(retry_after_)
{}

const std::int32_t canTransferOwnershipResultPasswordTooFresh::ID;

object_ptr<CanTransferOwnershipResult> canTransferOwnershipResultPasswordTooFresh::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canTransferOwnershipResultPasswordTooFresh> res = make_object<canTransferOwnershipResultPasswordTooFresh>();
  res->retry_after_ = env->GetIntField(p, res->retry_after_fieldID);
  return std::move(res);
}

void canTransferOwnershipResultPasswordTooFresh::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, retry_after_fieldID, retry_after_);
}

void canTransferOwnershipResultPasswordTooFresh::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanTransferOwnershipResultPasswordTooFresh");
    s.store_field("retryAfter", retry_after_);
    s.store_class_end();
  }
}

void canTransferOwnershipResultPasswordTooFresh::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanTransferOwnershipResultPasswordTooFresh").c_str());
    retry_after_fieldID = jni::get_field_id(env, Class, "retryAfter", "I");
    return true;
  }();
  (void)is_inited;
}

jclass canTransferOwnershipResultSessionTooFresh::Class;
jfieldID canTransferOwnershipResultSessionTooFresh::retry_after_fieldID;

canTransferOwnershipResultSessionTooFresh::canTransferOwnershipResultSessionTooFresh()
  : retry_after_()
{}

canTransferOwnershipResultSessionTooFresh::canTransferOwnershipResultSessionTooFresh(int32 retry_after_)
  : retry_after_(retry_after_)
{}

const std::int32_t canTransferOwnershipResultSessionTooFresh::ID;

object_ptr<CanTransferOwnershipResult> canTransferOwnershipResultSessionTooFresh::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canTransferOwnershipResultSessionTooFresh> res = make_object<canTransferOwnershipResultSessionTooFresh>();
  res->retry_after_ = env->GetIntField(p, res->retry_after_fieldID);
  return std::move(res);
}

void canTransferOwnershipResultSessionTooFresh::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, retry_after_fieldID, retry_after_);
}

void canTransferOwnershipResultSessionTooFresh::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanTransferOwnershipResultSessionTooFresh");
    s.store_field("retryAfter", retry_after_);
    s.store_class_end();
  }
}

void canTransferOwnershipResultSessionTooFresh::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanTransferOwnershipResultSessionTooFresh").c_str());
    retry_after_fieldID = jni::get_field_id(env, Class, "retryAfter", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatAdministratorRights::Class;
jfieldID chatAdministratorRights::can_manage_chat_fieldID;
jfieldID chatAdministratorRights::can_change_info_fieldID;
jfieldID chatAdministratorRights::can_post_messages_fieldID;
jfieldID chatAdministratorRights::can_edit_messages_fieldID;
jfieldID chatAdministratorRights::can_delete_messages_fieldID;
jfieldID chatAdministratorRights::can_invite_users_fieldID;
jfieldID chatAdministratorRights::can_restrict_members_fieldID;
jfieldID chatAdministratorRights::can_pin_messages_fieldID;
jfieldID chatAdministratorRights::can_manage_topics_fieldID;
jfieldID chatAdministratorRights::can_promote_members_fieldID;
jfieldID chatAdministratorRights::can_manage_video_chats_fieldID;
jfieldID chatAdministratorRights::can_post_stories_fieldID;
jfieldID chatAdministratorRights::can_edit_stories_fieldID;
jfieldID chatAdministratorRights::can_delete_stories_fieldID;
jfieldID chatAdministratorRights::can_manage_direct_messages_fieldID;
jfieldID chatAdministratorRights::can_manage_tags_fieldID;
jfieldID chatAdministratorRights::is_anonymous_fieldID;

chatAdministratorRights::chatAdministratorRights()
  : can_manage_chat_()
  , can_change_info_()
  , can_post_messages_()
  , can_edit_messages_()
  , can_delete_messages_()
  , can_invite_users_()
  , can_restrict_members_()
  , can_pin_messages_()
  , can_manage_topics_()
  , can_promote_members_()
  , can_manage_video_chats_()
  , can_post_stories_()
  , can_edit_stories_()
  , can_delete_stories_()
  , can_manage_direct_messages_()
  , can_manage_tags_()
  , is_anonymous_()
{}

chatAdministratorRights::chatAdministratorRights(bool can_manage_chat_, bool can_change_info_, bool can_post_messages_, bool can_edit_messages_, bool can_delete_messages_, bool can_invite_users_, bool can_restrict_members_, bool can_pin_messages_, bool can_manage_topics_, bool can_promote_members_, bool can_manage_video_chats_, bool can_post_stories_, bool can_edit_stories_, bool can_delete_stories_, bool can_manage_direct_messages_, bool can_manage_tags_, bool is_anonymous_)
  : can_manage_chat_(can_manage_chat_)
  , can_change_info_(can_change_info_)
  , can_post_messages_(can_post_messages_)
  , can_edit_messages_(can_edit_messages_)
  , can_delete_messages_(can_delete_messages_)
  , can_invite_users_(can_invite_users_)
  , can_restrict_members_(can_restrict_members_)
  , can_pin_messages_(can_pin_messages_)
  , can_manage_topics_(can_manage_topics_)
  , can_promote_members_(can_promote_members_)
  , can_manage_video_chats_(can_manage_video_chats_)
  , can_post_stories_(can_post_stories_)
  , can_edit_stories_(can_edit_stories_)
  , can_delete_stories_(can_delete_stories_)
  , can_manage_direct_messages_(can_manage_direct_messages_)
  , can_manage_tags_(can_manage_tags_)
  , is_anonymous_(is_anonymous_)
{}

const std::int32_t chatAdministratorRights::ID;

object_ptr<chatAdministratorRights> chatAdministratorRights::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatAdministratorRights> res = make_object<chatAdministratorRights>();
  res->can_manage_chat_ = (env->GetBooleanField(p, res->can_manage_chat_fieldID) != 0);
  res->can_change_info_ = (env->GetBooleanField(p, res->can_change_info_fieldID) != 0);
  res->can_post_messages_ = (env->GetBooleanField(p, res->can_post_messages_fieldID) != 0);
  res->can_edit_messages_ = (env->GetBooleanField(p, res->can_edit_messages_fieldID) != 0);
  res->can_delete_messages_ = (env->GetBooleanField(p, res->can_delete_messages_fieldID) != 0);
  res->can_invite_users_ = (env->GetBooleanField(p, res->can_invite_users_fieldID) != 0);
  res->can_restrict_members_ = (env->GetBooleanField(p, res->can_restrict_members_fieldID) != 0);
  res->can_pin_messages_ = (env->GetBooleanField(p, res->can_pin_messages_fieldID) != 0);
  res->can_manage_topics_ = (env->GetBooleanField(p, res->can_manage_topics_fieldID) != 0);
  res->can_promote_members_ = (env->GetBooleanField(p, res->can_promote_members_fieldID) != 0);
  res->can_manage_video_chats_ = (env->GetBooleanField(p, res->can_manage_video_chats_fieldID) != 0);
  res->can_post_stories_ = (env->GetBooleanField(p, res->can_post_stories_fieldID) != 0);
  res->can_edit_stories_ = (env->GetBooleanField(p, res->can_edit_stories_fieldID) != 0);
  res->can_delete_stories_ = (env->GetBooleanField(p, res->can_delete_stories_fieldID) != 0);
  res->can_manage_direct_messages_ = (env->GetBooleanField(p, res->can_manage_direct_messages_fieldID) != 0);
  res->can_manage_tags_ = (env->GetBooleanField(p, res->can_manage_tags_fieldID) != 0);
  res->is_anonymous_ = (env->GetBooleanField(p, res->is_anonymous_fieldID) != 0);
  return res;
}

void chatAdministratorRights::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_manage_chat_fieldID, can_manage_chat_);
  env->SetBooleanField(s, can_change_info_fieldID, can_change_info_);
  env->SetBooleanField(s, can_post_messages_fieldID, can_post_messages_);
  env->SetBooleanField(s, can_edit_messages_fieldID, can_edit_messages_);
  env->SetBooleanField(s, can_delete_messages_fieldID, can_delete_messages_);
  env->SetBooleanField(s, can_invite_users_fieldID, can_invite_users_);
  env->SetBooleanField(s, can_restrict_members_fieldID, can_restrict_members_);
  env->SetBooleanField(s, can_pin_messages_fieldID, can_pin_messages_);
  env->SetBooleanField(s, can_manage_topics_fieldID, can_manage_topics_);
  env->SetBooleanField(s, can_promote_members_fieldID, can_promote_members_);
  env->SetBooleanField(s, can_manage_video_chats_fieldID, can_manage_video_chats_);
  env->SetBooleanField(s, can_post_stories_fieldID, can_post_stories_);
  env->SetBooleanField(s, can_edit_stories_fieldID, can_edit_stories_);
  env->SetBooleanField(s, can_delete_stories_fieldID, can_delete_stories_);
  env->SetBooleanField(s, can_manage_direct_messages_fieldID, can_manage_direct_messages_);
  env->SetBooleanField(s, can_manage_tags_fieldID, can_manage_tags_);
  env->SetBooleanField(s, is_anonymous_fieldID, is_anonymous_);
}

void chatAdministratorRights::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatAdministratorRights");
    s.store_field("canManageChat", can_manage_chat_);
    s.store_field("canChangeInfo", can_change_info_);
    s.store_field("canPostMessages", can_post_messages_);
    s.store_field("canEditMessages", can_edit_messages_);
    s.store_field("canDeleteMessages", can_delete_messages_);
    s.store_field("canInviteUsers", can_invite_users_);
    s.store_field("canRestrictMembers", can_restrict_members_);
    s.store_field("canPinMessages", can_pin_messages_);
    s.store_field("canManageTopics", can_manage_topics_);
    s.store_field("canPromoteMembers", can_promote_members_);
    s.store_field("canManageVideoChats", can_manage_video_chats_);
    s.store_field("canPostStories", can_post_stories_);
    s.store_field("canEditStories", can_edit_stories_);
    s.store_field("canDeleteStories", can_delete_stories_);
    s.store_field("canManageDirectMessages", can_manage_direct_messages_);
    s.store_field("canManageTags", can_manage_tags_);
    s.store_field("isAnonymous", is_anonymous_);
    s.store_class_end();
  }
}

void chatAdministratorRights::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatAdministratorRights").c_str());
    can_manage_chat_fieldID = jni::get_field_id(env, Class, "canManageChat", "Z");
    can_change_info_fieldID = jni::get_field_id(env, Class, "canChangeInfo", "Z");
    can_post_messages_fieldID = jni::get_field_id(env, Class, "canPostMessages", "Z");
    can_edit_messages_fieldID = jni::get_field_id(env, Class, "canEditMessages", "Z");
    can_delete_messages_fieldID = jni::get_field_id(env, Class, "canDeleteMessages", "Z");
    can_invite_users_fieldID = jni::get_field_id(env, Class, "canInviteUsers", "Z");
    can_restrict_members_fieldID = jni::get_field_id(env, Class, "canRestrictMembers", "Z");
    can_pin_messages_fieldID = jni::get_field_id(env, Class, "canPinMessages", "Z");
    can_manage_topics_fieldID = jni::get_field_id(env, Class, "canManageTopics", "Z");
    can_promote_members_fieldID = jni::get_field_id(env, Class, "canPromoteMembers", "Z");
    can_manage_video_chats_fieldID = jni::get_field_id(env, Class, "canManageVideoChats", "Z");
    can_post_stories_fieldID = jni::get_field_id(env, Class, "canPostStories", "Z");
    can_edit_stories_fieldID = jni::get_field_id(env, Class, "canEditStories", "Z");
    can_delete_stories_fieldID = jni::get_field_id(env, Class, "canDeleteStories", "Z");
    can_manage_direct_messages_fieldID = jni::get_field_id(env, Class, "canManageDirectMessages", "Z");
    can_manage_tags_fieldID = jni::get_field_id(env, Class, "canManageTags", "Z");
    is_anonymous_fieldID = jni::get_field_id(env, Class, "isAnonymous", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatBoostStatus::Class;
jfieldID chatBoostStatus::boost_url_fieldID;
jfieldID chatBoostStatus::applied_slot_ids_fieldID;
jfieldID chatBoostStatus::level_fieldID;
jfieldID chatBoostStatus::gift_code_boost_count_fieldID;
jfieldID chatBoostStatus::boost_count_fieldID;
jfieldID chatBoostStatus::current_level_boost_count_fieldID;
jfieldID chatBoostStatus::next_level_boost_count_fieldID;
jfieldID chatBoostStatus::premium_member_count_fieldID;
jfieldID chatBoostStatus::premium_member_percentage_fieldID;
jfieldID chatBoostStatus::prepaid_giveaways_fieldID;

chatBoostStatus::chatBoostStatus()
  : boost_url_()
  , applied_slot_ids_()
  , level_()
  , gift_code_boost_count_()
  , boost_count_()
  , current_level_boost_count_()
  , next_level_boost_count_()
  , premium_member_count_()
  , premium_member_percentage_()
  , prepaid_giveaways_()
{}

chatBoostStatus::chatBoostStatus(string const &boost_url_, array<int32> &&applied_slot_ids_, int32 level_, int32 gift_code_boost_count_, int32 boost_count_, int32 current_level_boost_count_, int32 next_level_boost_count_, int32 premium_member_count_, double premium_member_percentage_, array<object_ptr<prepaidGiveaway>> &&prepaid_giveaways_)
  : boost_url_(boost_url_)
  , applied_slot_ids_(std::move(applied_slot_ids_))
  , level_(level_)
  , gift_code_boost_count_(gift_code_boost_count_)
  , boost_count_(boost_count_)
  , current_level_boost_count_(current_level_boost_count_)
  , next_level_boost_count_(next_level_boost_count_)
  , premium_member_count_(premium_member_count_)
  , premium_member_percentage_(premium_member_percentage_)
  , prepaid_giveaways_(std::move(prepaid_giveaways_))
{}

const std::int32_t chatBoostStatus::ID;

object_ptr<chatBoostStatus> chatBoostStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostStatus> res = make_object<chatBoostStatus>();
  res->boost_url_ = jni::fetch_string(env, p, res->boost_url_fieldID);
  res->applied_slot_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->applied_slot_ids_fieldID));
  res->level_ = env->GetIntField(p, res->level_fieldID);
  res->gift_code_boost_count_ = env->GetIntField(p, res->gift_code_boost_count_fieldID);
  res->boost_count_ = env->GetIntField(p, res->boost_count_fieldID);
  res->current_level_boost_count_ = env->GetIntField(p, res->current_level_boost_count_fieldID);
  res->next_level_boost_count_ = env->GetIntField(p, res->next_level_boost_count_fieldID);
  res->premium_member_count_ = env->GetIntField(p, res->premium_member_count_fieldID);
  res->premium_member_percentage_ = env->GetDoubleField(p, res->premium_member_percentage_fieldID);
  res->prepaid_giveaways_ = jni::FetchVector<prepaidGiveaway>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->prepaid_giveaways_fieldID));
  return res;
}

void chatBoostStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, boost_url_); if (nextString) { env->SetObjectField(s, boost_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, applied_slot_ids_); if (arr_tmp_) { env->SetObjectField(s, applied_slot_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, level_fieldID, level_);
  env->SetIntField(s, gift_code_boost_count_fieldID, gift_code_boost_count_);
  env->SetIntField(s, boost_count_fieldID, boost_count_);
  env->SetIntField(s, current_level_boost_count_fieldID, current_level_boost_count_);
  env->SetIntField(s, next_level_boost_count_fieldID, next_level_boost_count_);
  env->SetIntField(s, premium_member_count_fieldID, premium_member_count_);
  env->SetDoubleField(s, premium_member_percentage_fieldID, premium_member_percentage_);
  { auto arr_tmp_ = jni::store_vector(env, prepaid_giveaways_); if (arr_tmp_) { env->SetObjectField(s, prepaid_giveaways_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void chatBoostStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBoostStatus");
    s.store_field("boostUrl", boost_url_);
    { s.store_vector_begin("appliedSlotIds", applied_slot_ids_.size()); for (const auto &_value : applied_slot_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("level", level_);
    s.store_field("giftCodeBoostCount", gift_code_boost_count_);
    s.store_field("boostCount", boost_count_);
    s.store_field("currentLevelBoostCount", current_level_boost_count_);
    s.store_field("nextLevelBoostCount", next_level_boost_count_);
    s.store_field("premiumMemberCount", premium_member_count_);
    s.store_field("premiumMemberPercentage", premium_member_percentage_);
    { s.store_vector_begin("prepaidGiveaways", prepaid_giveaways_.size()); for (const auto &_value : prepaid_giveaways_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void chatBoostStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBoostStatus").c_str());
    boost_url_fieldID = jni::get_field_id(env, Class, "boostUrl", "Ljava/lang/String;");
    applied_slot_ids_fieldID = jni::get_field_id(env, Class, "appliedSlotIds", "[I");
    level_fieldID = jni::get_field_id(env, Class, "level", "I");
    gift_code_boost_count_fieldID = jni::get_field_id(env, Class, "giftCodeBoostCount", "I");
    boost_count_fieldID = jni::get_field_id(env, Class, "boostCount", "I");
    current_level_boost_count_fieldID = jni::get_field_id(env, Class, "currentLevelBoostCount", "I");
    next_level_boost_count_fieldID = jni::get_field_id(env, Class, "nextLevelBoostCount", "I");
    premium_member_count_fieldID = jni::get_field_id(env, Class, "premiumMemberCount", "I");
    premium_member_percentage_fieldID = jni::get_field_id(env, Class, "premiumMemberPercentage", "D");
    prepaid_giveaways_fieldID = jni::get_field_id(env, Class, "prepaidGiveaways", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PrepaidGiveaway;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatFolder::Class;
jfieldID chatFolder::name_fieldID;
jfieldID chatFolder::icon_fieldID;
jfieldID chatFolder::color_id_fieldID;
jfieldID chatFolder::is_shareable_fieldID;
jfieldID chatFolder::pinned_chat_ids_fieldID;
jfieldID chatFolder::included_chat_ids_fieldID;
jfieldID chatFolder::excluded_chat_ids_fieldID;
jfieldID chatFolder::exclude_muted_fieldID;
jfieldID chatFolder::exclude_read_fieldID;
jfieldID chatFolder::exclude_archived_fieldID;
jfieldID chatFolder::include_contacts_fieldID;
jfieldID chatFolder::include_non_contacts_fieldID;
jfieldID chatFolder::include_bots_fieldID;
jfieldID chatFolder::include_groups_fieldID;
jfieldID chatFolder::include_channels_fieldID;

chatFolder::chatFolder()
  : name_()
  , icon_()
  , color_id_()
  , is_shareable_()
  , pinned_chat_ids_()
  , included_chat_ids_()
  , excluded_chat_ids_()
  , exclude_muted_()
  , exclude_read_()
  , exclude_archived_()
  , include_contacts_()
  , include_non_contacts_()
  , include_bots_()
  , include_groups_()
  , include_channels_()
{}

chatFolder::chatFolder(object_ptr<chatFolderName> &&name_, object_ptr<chatFolderIcon> &&icon_, int32 color_id_, bool is_shareable_, array<int53> &&pinned_chat_ids_, array<int53> &&included_chat_ids_, array<int53> &&excluded_chat_ids_, bool exclude_muted_, bool exclude_read_, bool exclude_archived_, bool include_contacts_, bool include_non_contacts_, bool include_bots_, bool include_groups_, bool include_channels_)
  : name_(std::move(name_))
  , icon_(std::move(icon_))
  , color_id_(color_id_)
  , is_shareable_(is_shareable_)
  , pinned_chat_ids_(std::move(pinned_chat_ids_))
  , included_chat_ids_(std::move(included_chat_ids_))
  , excluded_chat_ids_(std::move(excluded_chat_ids_))
  , exclude_muted_(exclude_muted_)
  , exclude_read_(exclude_read_)
  , exclude_archived_(exclude_archived_)
  , include_contacts_(include_contacts_)
  , include_non_contacts_(include_non_contacts_)
  , include_bots_(include_bots_)
  , include_groups_(include_groups_)
  , include_channels_(include_channels_)
{}

const std::int32_t chatFolder::ID;

object_ptr<chatFolder> chatFolder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatFolder> res = make_object<chatFolder>();
  res->name_ = jni::fetch_tl_object<chatFolderName>(env, jni::fetch_object(env, p, res->name_fieldID));
  res->icon_ = jni::fetch_tl_object<chatFolderIcon>(env, jni::fetch_object(env, p, res->icon_fieldID));
  res->color_id_ = env->GetIntField(p, res->color_id_fieldID);
  res->is_shareable_ = (env->GetBooleanField(p, res->is_shareable_fieldID) != 0);
  res->pinned_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->pinned_chat_ids_fieldID));
  res->included_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->included_chat_ids_fieldID));
  res->excluded_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->excluded_chat_ids_fieldID));
  res->exclude_muted_ = (env->GetBooleanField(p, res->exclude_muted_fieldID) != 0);
  res->exclude_read_ = (env->GetBooleanField(p, res->exclude_read_fieldID) != 0);
  res->exclude_archived_ = (env->GetBooleanField(p, res->exclude_archived_fieldID) != 0);
  res->include_contacts_ = (env->GetBooleanField(p, res->include_contacts_fieldID) != 0);
  res->include_non_contacts_ = (env->GetBooleanField(p, res->include_non_contacts_fieldID) != 0);
  res->include_bots_ = (env->GetBooleanField(p, res->include_bots_fieldID) != 0);
  res->include_groups_ = (env->GetBooleanField(p, res->include_groups_fieldID) != 0);
  res->include_channels_ = (env->GetBooleanField(p, res->include_channels_fieldID) != 0);
  return res;
}

void chatFolder::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (name_ != nullptr) { jobject next; name_->store(env, next); if (next) { env->SetObjectField(s, name_fieldID, next); env->DeleteLocalRef(next); } }
  if (icon_ != nullptr) { jobject next; icon_->store(env, next); if (next) { env->SetObjectField(s, icon_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, color_id_fieldID, color_id_);
  env->SetBooleanField(s, is_shareable_fieldID, is_shareable_);
  { auto arr_tmp_ = jni::store_vector(env, pinned_chat_ids_); if (arr_tmp_) { env->SetObjectField(s, pinned_chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, included_chat_ids_); if (arr_tmp_) { env->SetObjectField(s, included_chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, excluded_chat_ids_); if (arr_tmp_) { env->SetObjectField(s, excluded_chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, exclude_muted_fieldID, exclude_muted_);
  env->SetBooleanField(s, exclude_read_fieldID, exclude_read_);
  env->SetBooleanField(s, exclude_archived_fieldID, exclude_archived_);
  env->SetBooleanField(s, include_contacts_fieldID, include_contacts_);
  env->SetBooleanField(s, include_non_contacts_fieldID, include_non_contacts_);
  env->SetBooleanField(s, include_bots_fieldID, include_bots_);
  env->SetBooleanField(s, include_groups_fieldID, include_groups_);
  env->SetBooleanField(s, include_channels_fieldID, include_channels_);
}

void chatFolder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatFolder");
    s.store_object_field("name", static_cast<const BaseObject *>(name_.get()));
    s.store_object_field("icon", static_cast<const BaseObject *>(icon_.get()));
    s.store_field("colorId", color_id_);
    s.store_field("isShareable", is_shareable_);
    { s.store_vector_begin("pinnedChatIds", pinned_chat_ids_.size()); for (const auto &_value : pinned_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("includedChatIds", included_chat_ids_.size()); for (const auto &_value : included_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("excludedChatIds", excluded_chat_ids_.size()); for (const auto &_value : excluded_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("excludeMuted", exclude_muted_);
    s.store_field("excludeRead", exclude_read_);
    s.store_field("excludeArchived", exclude_archived_);
    s.store_field("includeContacts", include_contacts_);
    s.store_field("includeNonContacts", include_non_contacts_);
    s.store_field("includeBots", include_bots_);
    s.store_field("includeGroups", include_groups_);
    s.store_field("includeChannels", include_channels_);
    s.store_class_end();
  }
}

void chatFolder::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatFolder").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatFolderName;").c_str());
    icon_fieldID = jni::get_field_id(env, Class, "icon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatFolderIcon;").c_str());
    color_id_fieldID = jni::get_field_id(env, Class, "colorId", "I");
    is_shareable_fieldID = jni::get_field_id(env, Class, "isShareable", "Z");
    pinned_chat_ids_fieldID = jni::get_field_id(env, Class, "pinnedChatIds", "[J");
    included_chat_ids_fieldID = jni::get_field_id(env, Class, "includedChatIds", "[J");
    excluded_chat_ids_fieldID = jni::get_field_id(env, Class, "excludedChatIds", "[J");
    exclude_muted_fieldID = jni::get_field_id(env, Class, "excludeMuted", "Z");
    exclude_read_fieldID = jni::get_field_id(env, Class, "excludeRead", "Z");
    exclude_archived_fieldID = jni::get_field_id(env, Class, "excludeArchived", "Z");
    include_contacts_fieldID = jni::get_field_id(env, Class, "includeContacts", "Z");
    include_non_contacts_fieldID = jni::get_field_id(env, Class, "includeNonContacts", "Z");
    include_bots_fieldID = jni::get_field_id(env, Class, "includeBots", "Z");
    include_groups_fieldID = jni::get_field_id(env, Class, "includeGroups", "Z");
    include_channels_fieldID = jni::get_field_id(env, Class, "includeChannels", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatInviteLink::Class;
jfieldID chatInviteLink::invite_link_fieldID;
jfieldID chatInviteLink::name_fieldID;
jfieldID chatInviteLink::creator_user_id_fieldID;
jfieldID chatInviteLink::date_fieldID;
jfieldID chatInviteLink::edit_date_fieldID;
jfieldID chatInviteLink::expiration_date_fieldID;
jfieldID chatInviteLink::subscription_pricing_fieldID;
jfieldID chatInviteLink::member_limit_fieldID;
jfieldID chatInviteLink::member_count_fieldID;
jfieldID chatInviteLink::expired_member_count_fieldID;
jfieldID chatInviteLink::pending_join_request_count_fieldID;
jfieldID chatInviteLink::creates_join_request_fieldID;
jfieldID chatInviteLink::is_primary_fieldID;
jfieldID chatInviteLink::is_revoked_fieldID;

chatInviteLink::chatInviteLink()
  : invite_link_()
  , name_()
  , creator_user_id_()
  , date_()
  , edit_date_()
  , expiration_date_()
  , subscription_pricing_()
  , member_limit_()
  , member_count_()
  , expired_member_count_()
  , pending_join_request_count_()
  , creates_join_request_()
  , is_primary_()
  , is_revoked_()
{}

chatInviteLink::chatInviteLink(string const &invite_link_, string const &name_, int53 creator_user_id_, int32 date_, int32 edit_date_, int32 expiration_date_, object_ptr<starSubscriptionPricing> &&subscription_pricing_, int32 member_limit_, int32 member_count_, int32 expired_member_count_, int32 pending_join_request_count_, bool creates_join_request_, bool is_primary_, bool is_revoked_)
  : invite_link_(invite_link_)
  , name_(name_)
  , creator_user_id_(creator_user_id_)
  , date_(date_)
  , edit_date_(edit_date_)
  , expiration_date_(expiration_date_)
  , subscription_pricing_(std::move(subscription_pricing_))
  , member_limit_(member_limit_)
  , member_count_(member_count_)
  , expired_member_count_(expired_member_count_)
  , pending_join_request_count_(pending_join_request_count_)
  , creates_join_request_(creates_join_request_)
  , is_primary_(is_primary_)
  , is_revoked_(is_revoked_)
{}

const std::int32_t chatInviteLink::ID;

object_ptr<chatInviteLink> chatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatInviteLink> res = make_object<chatInviteLink>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->creator_user_id_ = env->GetLongField(p, res->creator_user_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->edit_date_ = env->GetIntField(p, res->edit_date_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  res->subscription_pricing_ = jni::fetch_tl_object<starSubscriptionPricing>(env, jni::fetch_object(env, p, res->subscription_pricing_fieldID));
  res->member_limit_ = env->GetIntField(p, res->member_limit_fieldID);
  res->member_count_ = env->GetIntField(p, res->member_count_fieldID);
  res->expired_member_count_ = env->GetIntField(p, res->expired_member_count_fieldID);
  res->pending_join_request_count_ = env->GetIntField(p, res->pending_join_request_count_fieldID);
  res->creates_join_request_ = (env->GetBooleanField(p, res->creates_join_request_fieldID) != 0);
  res->is_primary_ = (env->GetBooleanField(p, res->is_primary_fieldID) != 0);
  res->is_revoked_ = (env->GetBooleanField(p, res->is_revoked_fieldID) != 0);
  return res;
}

void chatInviteLink::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, invite_link_); if (nextString) { env->SetObjectField(s, invite_link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, creator_user_id_fieldID, creator_user_id_);
  env->SetIntField(s, date_fieldID, date_);
  env->SetIntField(s, edit_date_fieldID, edit_date_);
  env->SetIntField(s, expiration_date_fieldID, expiration_date_);
  if (subscription_pricing_ != nullptr) { jobject next; subscription_pricing_->store(env, next); if (next) { env->SetObjectField(s, subscription_pricing_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, member_limit_fieldID, member_limit_);
  env->SetIntField(s, member_count_fieldID, member_count_);
  env->SetIntField(s, expired_member_count_fieldID, expired_member_count_);
  env->SetIntField(s, pending_join_request_count_fieldID, pending_join_request_count_);
  env->SetBooleanField(s, creates_join_request_fieldID, creates_join_request_);
  env->SetBooleanField(s, is_primary_fieldID, is_primary_);
  env->SetBooleanField(s, is_revoked_fieldID, is_revoked_);
}

void chatInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatInviteLink");
    s.store_field("inviteLink", invite_link_);
    s.store_field("name", name_);
    s.store_field("creatorUserId", creator_user_id_);
    s.store_field("date", date_);
    s.store_field("editDate", edit_date_);
    s.store_field("expirationDate", expiration_date_);
    s.store_object_field("subscriptionPricing", static_cast<const BaseObject *>(subscription_pricing_.get()));
    s.store_field("memberLimit", member_limit_);
    s.store_field("memberCount", member_count_);
    s.store_field("expiredMemberCount", expired_member_count_);
    s.store_field("pendingJoinRequestCount", pending_join_request_count_);
    s.store_field("createsJoinRequest", creates_join_request_);
    s.store_field("isPrimary", is_primary_);
    s.store_field("isRevoked", is_revoked_);
    s.store_class_end();
  }
}

void chatInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatInviteLink").c_str());
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    creator_user_id_fieldID = jni::get_field_id(env, Class, "creatorUserId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    edit_date_fieldID = jni::get_field_id(env, Class, "editDate", "I");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    subscription_pricing_fieldID = jni::get_field_id(env, Class, "subscriptionPricing", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarSubscriptionPricing;").c_str());
    member_limit_fieldID = jni::get_field_id(env, Class, "memberLimit", "I");
    member_count_fieldID = jni::get_field_id(env, Class, "memberCount", "I");
    expired_member_count_fieldID = jni::get_field_id(env, Class, "expiredMemberCount", "I");
    pending_join_request_count_fieldID = jni::get_field_id(env, Class, "pendingJoinRequestCount", "I");
    creates_join_request_fieldID = jni::get_field_id(env, Class, "createsJoinRequest", "Z");
    is_primary_fieldID = jni::get_field_id(env, Class, "isPrimary", "Z");
    is_revoked_fieldID = jni::get_field_id(env, Class, "isRevoked", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatInviteLinkSubscriptionInfo::Class;
jfieldID chatInviteLinkSubscriptionInfo::pricing_fieldID;
jfieldID chatInviteLinkSubscriptionInfo::can_reuse_fieldID;
jfieldID chatInviteLinkSubscriptionInfo::form_id_fieldID;

chatInviteLinkSubscriptionInfo::chatInviteLinkSubscriptionInfo()
  : pricing_()
  , can_reuse_()
  , form_id_()
{}

chatInviteLinkSubscriptionInfo::chatInviteLinkSubscriptionInfo(object_ptr<starSubscriptionPricing> &&pricing_, bool can_reuse_, int64 form_id_)
  : pricing_(std::move(pricing_))
  , can_reuse_(can_reuse_)
  , form_id_(form_id_)
{}

const std::int32_t chatInviteLinkSubscriptionInfo::ID;

object_ptr<chatInviteLinkSubscriptionInfo> chatInviteLinkSubscriptionInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatInviteLinkSubscriptionInfo> res = make_object<chatInviteLinkSubscriptionInfo>();
  res->pricing_ = jni::fetch_tl_object<starSubscriptionPricing>(env, jni::fetch_object(env, p, res->pricing_fieldID));
  res->can_reuse_ = (env->GetBooleanField(p, res->can_reuse_fieldID) != 0);
  res->form_id_ = env->GetLongField(p, res->form_id_fieldID);
  return res;
}

void chatInviteLinkSubscriptionInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (pricing_ != nullptr) { jobject next; pricing_->store(env, next); if (next) { env->SetObjectField(s, pricing_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_reuse_fieldID, can_reuse_);
  env->SetLongField(s, form_id_fieldID, form_id_);
}

void chatInviteLinkSubscriptionInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatInviteLinkSubscriptionInfo");
    s.store_object_field("pricing", static_cast<const BaseObject *>(pricing_.get()));
    s.store_field("canReuse", can_reuse_);
    s.store_field("formId", form_id_);
    s.store_class_end();
  }
}

void chatInviteLinkSubscriptionInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatInviteLinkSubscriptionInfo").c_str());
    pricing_fieldID = jni::get_field_id(env, Class, "pricing", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarSubscriptionPricing;").c_str());
    can_reuse_fieldID = jni::get_field_id(env, Class, "canReuse", "Z");
    form_id_fieldID = jni::get_field_id(env, Class, "formId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatJoinRequest::Class;
jfieldID chatJoinRequest::user_id_fieldID;
jfieldID chatJoinRequest::date_fieldID;
jfieldID chatJoinRequest::bio_fieldID;

chatJoinRequest::chatJoinRequest()
  : user_id_()
  , date_()
  , bio_()
{}

chatJoinRequest::chatJoinRequest(int53 user_id_, int32 date_, string const &bio_)
  : user_id_(user_id_)
  , date_(date_)
  , bio_(bio_)
{}

const std::int32_t chatJoinRequest::ID;

object_ptr<chatJoinRequest> chatJoinRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatJoinRequest> res = make_object<chatJoinRequest>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->bio_ = jni::fetch_string(env, p, res->bio_fieldID);
  return res;
}

void chatJoinRequest::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetIntField(s, date_fieldID, date_);
  { jstring nextString = jni::to_jstring(env, bio_); if (nextString) { env->SetObjectField(s, bio_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chatJoinRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatJoinRequest");
    s.store_field("userId", user_id_);
    s.store_field("date", date_);
    s.store_field("bio", bio_);
    s.store_class_end();
  }
}

void chatJoinRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatJoinRequest").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    bio_fieldID = jni::get_field_id(env, Class, "bio", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass ChatRevenueTransactionType::Class;

object_ptr<ChatRevenueTransactionType> ChatRevenueTransactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case chatRevenueTransactionTypeUnsupported::ID:
      return chatRevenueTransactionTypeUnsupported::fetch(env, p);
    case chatRevenueTransactionTypeSponsoredMessageEarnings::ID:
      return chatRevenueTransactionTypeSponsoredMessageEarnings::fetch(env, p);
    case chatRevenueTransactionTypeSuggestedPostEarnings::ID:
      return chatRevenueTransactionTypeSuggestedPostEarnings::fetch(env, p);
    case chatRevenueTransactionTypeFragmentWithdrawal::ID:
      return chatRevenueTransactionTypeFragmentWithdrawal::fetch(env, p);
    case chatRevenueTransactionTypeFragmentRefund::ID:
      return chatRevenueTransactionTypeFragmentRefund::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void ChatRevenueTransactionType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactionType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatRevenueTransactionTypeUnsupported::Class;

chatRevenueTransactionTypeUnsupported::chatRevenueTransactionTypeUnsupported() {
}

const std::int32_t chatRevenueTransactionTypeUnsupported::ID;

object_ptr<ChatRevenueTransactionType> chatRevenueTransactionTypeUnsupported::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<chatRevenueTransactionTypeUnsupported>();
}

void chatRevenueTransactionTypeUnsupported::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void chatRevenueTransactionTypeUnsupported::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueTransactionTypeUnsupported");
    s.store_class_end();
  }
}

void chatRevenueTransactionTypeUnsupported::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactionTypeUnsupported").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatRevenueTransactionTypeSponsoredMessageEarnings::Class;
jfieldID chatRevenueTransactionTypeSponsoredMessageEarnings::start_date_fieldID;
jfieldID chatRevenueTransactionTypeSponsoredMessageEarnings::end_date_fieldID;

chatRevenueTransactionTypeSponsoredMessageEarnings::chatRevenueTransactionTypeSponsoredMessageEarnings()
  : start_date_()
  , end_date_()
{}

chatRevenueTransactionTypeSponsoredMessageEarnings::chatRevenueTransactionTypeSponsoredMessageEarnings(int32 start_date_, int32 end_date_)
  : start_date_(start_date_)
  , end_date_(end_date_)
{}

const std::int32_t chatRevenueTransactionTypeSponsoredMessageEarnings::ID;

object_ptr<ChatRevenueTransactionType> chatRevenueTransactionTypeSponsoredMessageEarnings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueTransactionTypeSponsoredMessageEarnings> res = make_object<chatRevenueTransactionTypeSponsoredMessageEarnings>();
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  res->end_date_ = env->GetIntField(p, res->end_date_fieldID);
  return std::move(res);
}

void chatRevenueTransactionTypeSponsoredMessageEarnings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, start_date_fieldID, start_date_);
  env->SetIntField(s, end_date_fieldID, end_date_);
}

void chatRevenueTransactionTypeSponsoredMessageEarnings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueTransactionTypeSponsoredMessageEarnings");
    s.store_field("startDate", start_date_);
    s.store_field("endDate", end_date_);
    s.store_class_end();
  }
}

void chatRevenueTransactionTypeSponsoredMessageEarnings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactionTypeSponsoredMessageEarnings").c_str());
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    end_date_fieldID = jni::get_field_id(env, Class, "endDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatRevenueTransactionTypeSuggestedPostEarnings::Class;
jfieldID chatRevenueTransactionTypeSuggestedPostEarnings::user_id_fieldID;

chatRevenueTransactionTypeSuggestedPostEarnings::chatRevenueTransactionTypeSuggestedPostEarnings()
  : user_id_()
{}

chatRevenueTransactionTypeSuggestedPostEarnings::chatRevenueTransactionTypeSuggestedPostEarnings(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t chatRevenueTransactionTypeSuggestedPostEarnings::ID;

object_ptr<ChatRevenueTransactionType> chatRevenueTransactionTypeSuggestedPostEarnings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueTransactionTypeSuggestedPostEarnings> res = make_object<chatRevenueTransactionTypeSuggestedPostEarnings>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  return std::move(res);
}

void chatRevenueTransactionTypeSuggestedPostEarnings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
}

void chatRevenueTransactionTypeSuggestedPostEarnings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueTransactionTypeSuggestedPostEarnings");
    s.store_field("userId", user_id_);
    s.store_class_end();
  }
}

void chatRevenueTransactionTypeSuggestedPostEarnings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactionTypeSuggestedPostEarnings").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatRevenueTransactionTypeFragmentWithdrawal::Class;
jfieldID chatRevenueTransactionTypeFragmentWithdrawal::withdrawal_date_fieldID;
jfieldID chatRevenueTransactionTypeFragmentWithdrawal::state_fieldID;

chatRevenueTransactionTypeFragmentWithdrawal::chatRevenueTransactionTypeFragmentWithdrawal()
  : withdrawal_date_()
  , state_()
{}

chatRevenueTransactionTypeFragmentWithdrawal::chatRevenueTransactionTypeFragmentWithdrawal(int32 withdrawal_date_, object_ptr<RevenueWithdrawalState> &&state_)
  : withdrawal_date_(withdrawal_date_)
  , state_(std::move(state_))
{}

const std::int32_t chatRevenueTransactionTypeFragmentWithdrawal::ID;

object_ptr<ChatRevenueTransactionType> chatRevenueTransactionTypeFragmentWithdrawal::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueTransactionTypeFragmentWithdrawal> res = make_object<chatRevenueTransactionTypeFragmentWithdrawal>();
  res->withdrawal_date_ = env->GetIntField(p, res->withdrawal_date_fieldID);
  res->state_ = jni::fetch_tl_object<RevenueWithdrawalState>(env, jni::fetch_object(env, p, res->state_fieldID));
  return std::move(res);
}

void chatRevenueTransactionTypeFragmentWithdrawal::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, withdrawal_date_fieldID, withdrawal_date_);
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatRevenueTransactionTypeFragmentWithdrawal::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueTransactionTypeFragmentWithdrawal");
    s.store_field("withdrawalDate", withdrawal_date_);
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_class_end();
  }
}

void chatRevenueTransactionTypeFragmentWithdrawal::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactionTypeFragmentWithdrawal").c_str());
    withdrawal_date_fieldID = jni::get_field_id(env, Class, "withdrawalDate", "I");
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RevenueWithdrawalState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatRevenueTransactionTypeFragmentRefund::Class;
jfieldID chatRevenueTransactionTypeFragmentRefund::refund_date_fieldID;

chatRevenueTransactionTypeFragmentRefund::chatRevenueTransactionTypeFragmentRefund()
  : refund_date_()
{}

chatRevenueTransactionTypeFragmentRefund::chatRevenueTransactionTypeFragmentRefund(int32 refund_date_)
  : refund_date_(refund_date_)
{}

const std::int32_t chatRevenueTransactionTypeFragmentRefund::ID;

object_ptr<ChatRevenueTransactionType> chatRevenueTransactionTypeFragmentRefund::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueTransactionTypeFragmentRefund> res = make_object<chatRevenueTransactionTypeFragmentRefund>();
  res->refund_date_ = env->GetIntField(p, res->refund_date_fieldID);
  return std::move(res);
}

void chatRevenueTransactionTypeFragmentRefund::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, refund_date_fieldID, refund_date_);
}

void chatRevenueTransactionTypeFragmentRefund::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueTransactionTypeFragmentRefund");
    s.store_field("refundDate", refund_date_);
    s.store_class_end();
  }
}

void chatRevenueTransactionTypeFragmentRefund::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactionTypeFragmentRefund").c_str());
    refund_date_fieldID = jni::get_field_id(env, Class, "refundDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatStatisticsMessageSenderInfo::Class;
jfieldID chatStatisticsMessageSenderInfo::user_id_fieldID;
jfieldID chatStatisticsMessageSenderInfo::sent_message_count_fieldID;
jfieldID chatStatisticsMessageSenderInfo::average_character_count_fieldID;

chatStatisticsMessageSenderInfo::chatStatisticsMessageSenderInfo()
  : user_id_()
  , sent_message_count_()
  , average_character_count_()
{}

chatStatisticsMessageSenderInfo::chatStatisticsMessageSenderInfo(int53 user_id_, int32 sent_message_count_, int32 average_character_count_)
  : user_id_(user_id_)
  , sent_message_count_(sent_message_count_)
  , average_character_count_(average_character_count_)
{}

const std::int32_t chatStatisticsMessageSenderInfo::ID;

object_ptr<chatStatisticsMessageSenderInfo> chatStatisticsMessageSenderInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatStatisticsMessageSenderInfo> res = make_object<chatStatisticsMessageSenderInfo>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->sent_message_count_ = env->GetIntField(p, res->sent_message_count_fieldID);
  res->average_character_count_ = env->GetIntField(p, res->average_character_count_fieldID);
  return res;
}

void chatStatisticsMessageSenderInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetIntField(s, sent_message_count_fieldID, sent_message_count_);
  env->SetIntField(s, average_character_count_fieldID, average_character_count_);
}

void chatStatisticsMessageSenderInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatStatisticsMessageSenderInfo");
    s.store_field("userId", user_id_);
    s.store_field("sentMessageCount", sent_message_count_);
    s.store_field("averageCharacterCount", average_character_count_);
    s.store_class_end();
  }
}

void chatStatisticsMessageSenderInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatStatisticsMessageSenderInfo").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    sent_message_count_fieldID = jni::get_field_id(env, Class, "sentMessageCount", "I");
    average_character_count_fieldID = jni::get_field_id(env, Class, "averageCharacterCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass CollectibleItemType::Class;

object_ptr<CollectibleItemType> CollectibleItemType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case collectibleItemTypeUsername::ID:
      return collectibleItemTypeUsername::fetch(env, p);
    case collectibleItemTypePhoneNumber::ID:
      return collectibleItemTypePhoneNumber::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void CollectibleItemType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CollectibleItemType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass collectibleItemTypeUsername::Class;
jfieldID collectibleItemTypeUsername::username_fieldID;

collectibleItemTypeUsername::collectibleItemTypeUsername()
  : username_()
{}

collectibleItemTypeUsername::collectibleItemTypeUsername(string const &username_)
  : username_(username_)
{}

const std::int32_t collectibleItemTypeUsername::ID;

object_ptr<CollectibleItemType> collectibleItemTypeUsername::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<collectibleItemTypeUsername> res = make_object<collectibleItemTypeUsername>();
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  return std::move(res);
}

void collectibleItemTypeUsername::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CollectibleItemTypeUsername");
    s.store_field("username", username_);
    s.store_class_end();
  }
}

void collectibleItemTypeUsername::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CollectibleItemTypeUsername").c_str());
    username_fieldID = jni::get_field_id(env, Class, "username", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass collectibleItemTypePhoneNumber::Class;
jfieldID collectibleItemTypePhoneNumber::phone_number_fieldID;

collectibleItemTypePhoneNumber::collectibleItemTypePhoneNumber()
  : phone_number_()
{}

collectibleItemTypePhoneNumber::collectibleItemTypePhoneNumber(string const &phone_number_)
  : phone_number_(phone_number_)
{}

const std::int32_t collectibleItemTypePhoneNumber::ID;

object_ptr<CollectibleItemType> collectibleItemTypePhoneNumber::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<collectibleItemTypePhoneNumber> res = make_object<collectibleItemTypePhoneNumber>();
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  return std::move(res);
}

void collectibleItemTypePhoneNumber::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CollectibleItemTypePhoneNumber");
    s.store_field("phoneNumber", phone_number_);
    s.store_class_end();
  }
}

void collectibleItemTypePhoneNumber::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CollectibleItemTypePhoneNumber").c_str());
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass ConnectionState::Class;

object_ptr<ConnectionState> ConnectionState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case connectionStateWaitingForNetwork::ID:
      return connectionStateWaitingForNetwork::fetch(env, p);
    case connectionStateConnectingToProxy::ID:
      return connectionStateConnectingToProxy::fetch(env, p);
    case connectionStateConnecting::ID:
      return connectionStateConnecting::fetch(env, p);
    case connectionStateUpdating::ID:
      return connectionStateUpdating::fetch(env, p);
    case connectionStateReady::ID:
      return connectionStateReady::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void ConnectionState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectionState").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass connectionStateWaitingForNetwork::Class;

connectionStateWaitingForNetwork::connectionStateWaitingForNetwork() {
}

const std::int32_t connectionStateWaitingForNetwork::ID;

object_ptr<ConnectionState> connectionStateWaitingForNetwork::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<connectionStateWaitingForNetwork>();
}

void connectionStateWaitingForNetwork::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void connectionStateWaitingForNetwork::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectionStateWaitingForNetwork");
    s.store_class_end();
  }
}

void connectionStateWaitingForNetwork::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectionStateWaitingForNetwork").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass connectionStateConnectingToProxy::Class;

connectionStateConnectingToProxy::connectionStateConnectingToProxy() {
}

const std::int32_t connectionStateConnectingToProxy::ID;

object_ptr<ConnectionState> connectionStateConnectingToProxy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<connectionStateConnectingToProxy>();
}

void connectionStateConnectingToProxy::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void connectionStateConnectingToProxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectionStateConnectingToProxy");
    s.store_class_end();
  }
}

void connectionStateConnectingToProxy::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectionStateConnectingToProxy").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass connectionStateConnecting::Class;

connectionStateConnecting::connectionStateConnecting() {
}

const std::int32_t connectionStateConnecting::ID;

object_ptr<ConnectionState> connectionStateConnecting::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<connectionStateConnecting>();
}

void connectionStateConnecting::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void connectionStateConnecting::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectionStateConnecting");
    s.store_class_end();
  }
}

void connectionStateConnecting::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectionStateConnecting").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass connectionStateUpdating::Class;

connectionStateUpdating::connectionStateUpdating() {
}

const std::int32_t connectionStateUpdating::ID;

object_ptr<ConnectionState> connectionStateUpdating::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<connectionStateUpdating>();
}

void connectionStateUpdating::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void connectionStateUpdating::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectionStateUpdating");
    s.store_class_end();
  }
}

void connectionStateUpdating::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectionStateUpdating").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass connectionStateReady::Class;

connectionStateReady::connectionStateReady() {
}

const std::int32_t connectionStateReady::ID;

object_ptr<ConnectionState> connectionStateReady::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<connectionStateReady>();
}

void connectionStateReady::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void connectionStateReady::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectionStateReady");
    s.store_class_end();
  }
}

void connectionStateReady::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectionStateReady").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass countries::Class;
jfieldID countries::countries_fieldID;

countries::countries()
  : countries_()
{}

countries::countries(array<object_ptr<countryInfo>> &&countries_)
  : countries_(std::move(countries_))
{}

const std::int32_t countries::ID;

object_ptr<countries> countries::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<countries> res = make_object<countries>();
  res->countries_ = jni::FetchVector<countryInfo>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->countries_fieldID));
  return res;
}

void countries::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, countries_); if (arr_tmp_) { env->SetObjectField(s, countries_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void countries::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Countries");
    { s.store_vector_begin("countries", countries_.size()); for (const auto &_value : countries_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void countries::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Countries").c_str());
    countries_fieldID = jni::get_field_id(env, Class, "countries", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$CountryInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass deepLinkInfo::Class;
jfieldID deepLinkInfo::text_fieldID;
jfieldID deepLinkInfo::need_update_application_fieldID;

deepLinkInfo::deepLinkInfo()
  : text_()
  , need_update_application_()
{}

deepLinkInfo::deepLinkInfo(object_ptr<formattedText> &&text_, bool need_update_application_)
  : text_(std::move(text_))
  , need_update_application_(need_update_application_)
{}

const std::int32_t deepLinkInfo::ID;

object_ptr<deepLinkInfo> deepLinkInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deepLinkInfo> res = make_object<deepLinkInfo>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->need_update_application_ = (env->GetBooleanField(p, res->need_update_application_fieldID) != 0);
  return res;
}

void deepLinkInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, need_update_application_fieldID, need_update_application_);
}

void deepLinkInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeepLinkInfo");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("needUpdateApplication", need_update_application_);
    s.store_class_end();
  }
}

void deepLinkInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeepLinkInfo").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    need_update_application_fieldID = jni::get_field_id(env, Class, "needUpdateApplication", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass emojiChatTheme::Class;
jfieldID emojiChatTheme::name_fieldID;
jfieldID emojiChatTheme::light_settings_fieldID;
jfieldID emojiChatTheme::dark_settings_fieldID;

emojiChatTheme::emojiChatTheme()
  : name_()
  , light_settings_()
  , dark_settings_()
{}

emojiChatTheme::emojiChatTheme(string const &name_, object_ptr<themeSettings> &&light_settings_, object_ptr<themeSettings> &&dark_settings_)
  : name_(name_)
  , light_settings_(std::move(light_settings_))
  , dark_settings_(std::move(dark_settings_))
{}

const std::int32_t emojiChatTheme::ID;

object_ptr<emojiChatTheme> emojiChatTheme::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiChatTheme> res = make_object<emojiChatTheme>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->light_settings_ = jni::fetch_tl_object<themeSettings>(env, jni::fetch_object(env, p, res->light_settings_fieldID));
  res->dark_settings_ = jni::fetch_tl_object<themeSettings>(env, jni::fetch_object(env, p, res->dark_settings_fieldID));
  return res;
}

void emojiChatTheme::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (light_settings_ != nullptr) { jobject next; light_settings_->store(env, next); if (next) { env->SetObjectField(s, light_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (dark_settings_ != nullptr) { jobject next; dark_settings_->store(env, next); if (next) { env->SetObjectField(s, dark_settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void emojiChatTheme::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiChatTheme");
    s.store_field("name", name_);
    s.store_object_field("lightSettings", static_cast<const BaseObject *>(light_settings_.get()));
    s.store_object_field("darkSettings", static_cast<const BaseObject *>(dark_settings_.get()));
    s.store_class_end();
  }
}

void emojiChatTheme::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiChatTheme").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    light_settings_fieldID = jni::get_field_id(env, Class, "lightSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThemeSettings;").c_str());
    dark_settings_fieldID = jni::get_field_id(env, Class, "darkSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThemeSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass EmojiStatusType::Class;

object_ptr<EmojiStatusType> EmojiStatusType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case emojiStatusTypeCustomEmoji::ID:
      return emojiStatusTypeCustomEmoji::fetch(env, p);
    case emojiStatusTypeUpgradedGift::ID:
      return emojiStatusTypeUpgradedGift::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void EmojiStatusType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiStatusType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass emojiStatusTypeCustomEmoji::Class;
jfieldID emojiStatusTypeCustomEmoji::custom_emoji_id_fieldID;

emojiStatusTypeCustomEmoji::emojiStatusTypeCustomEmoji()
  : custom_emoji_id_()
{}

emojiStatusTypeCustomEmoji::emojiStatusTypeCustomEmoji(int64 custom_emoji_id_)
  : custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t emojiStatusTypeCustomEmoji::ID;

object_ptr<EmojiStatusType> emojiStatusTypeCustomEmoji::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiStatusTypeCustomEmoji> res = make_object<emojiStatusTypeCustomEmoji>();
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  return std::move(res);
}

void emojiStatusTypeCustomEmoji::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, custom_emoji_id_fieldID, custom_emoji_id_);
}

void emojiStatusTypeCustomEmoji::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiStatusTypeCustomEmoji");
    s.store_field("customEmojiId", custom_emoji_id_);
    s.store_class_end();
  }
}

void emojiStatusTypeCustomEmoji::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiStatusTypeCustomEmoji").c_str());
    custom_emoji_id_fieldID = jni::get_field_id(env, Class, "customEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass emojiStatusTypeUpgradedGift::Class;
jfieldID emojiStatusTypeUpgradedGift::upgraded_gift_id_fieldID;
jfieldID emojiStatusTypeUpgradedGift::gift_title_fieldID;
jfieldID emojiStatusTypeUpgradedGift::gift_name_fieldID;
jfieldID emojiStatusTypeUpgradedGift::model_custom_emoji_id_fieldID;
jfieldID emojiStatusTypeUpgradedGift::symbol_custom_emoji_id_fieldID;
jfieldID emojiStatusTypeUpgradedGift::backdrop_colors_fieldID;

emojiStatusTypeUpgradedGift::emojiStatusTypeUpgradedGift()
  : upgraded_gift_id_()
  , gift_title_()
  , gift_name_()
  , model_custom_emoji_id_()
  , symbol_custom_emoji_id_()
  , backdrop_colors_()
{}

emojiStatusTypeUpgradedGift::emojiStatusTypeUpgradedGift(int64 upgraded_gift_id_, string const &gift_title_, string const &gift_name_, int64 model_custom_emoji_id_, int64 symbol_custom_emoji_id_, object_ptr<upgradedGiftBackdropColors> &&backdrop_colors_)
  : upgraded_gift_id_(upgraded_gift_id_)
  , gift_title_(gift_title_)
  , gift_name_(gift_name_)
  , model_custom_emoji_id_(model_custom_emoji_id_)
  , symbol_custom_emoji_id_(symbol_custom_emoji_id_)
  , backdrop_colors_(std::move(backdrop_colors_))
{}

const std::int32_t emojiStatusTypeUpgradedGift::ID;

object_ptr<EmojiStatusType> emojiStatusTypeUpgradedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiStatusTypeUpgradedGift> res = make_object<emojiStatusTypeUpgradedGift>();
  res->upgraded_gift_id_ = env->GetLongField(p, res->upgraded_gift_id_fieldID);
  res->gift_title_ = jni::fetch_string(env, p, res->gift_title_fieldID);
  res->gift_name_ = jni::fetch_string(env, p, res->gift_name_fieldID);
  res->model_custom_emoji_id_ = env->GetLongField(p, res->model_custom_emoji_id_fieldID);
  res->symbol_custom_emoji_id_ = env->GetLongField(p, res->symbol_custom_emoji_id_fieldID);
  res->backdrop_colors_ = jni::fetch_tl_object<upgradedGiftBackdropColors>(env, jni::fetch_object(env, p, res->backdrop_colors_fieldID));
  return std::move(res);
}

void emojiStatusTypeUpgradedGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, upgraded_gift_id_fieldID, upgraded_gift_id_);
  { jstring nextString = jni::to_jstring(env, gift_title_); if (nextString) { env->SetObjectField(s, gift_title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, gift_name_); if (nextString) { env->SetObjectField(s, gift_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, model_custom_emoji_id_fieldID, model_custom_emoji_id_);
  env->SetLongField(s, symbol_custom_emoji_id_fieldID, symbol_custom_emoji_id_);
  if (backdrop_colors_ != nullptr) { jobject next; backdrop_colors_->store(env, next); if (next) { env->SetObjectField(s, backdrop_colors_fieldID, next); env->DeleteLocalRef(next); } }
}

void emojiStatusTypeUpgradedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiStatusTypeUpgradedGift");
    s.store_field("upgradedGiftId", upgraded_gift_id_);
    s.store_field("giftTitle", gift_title_);
    s.store_field("giftName", gift_name_);
    s.store_field("modelCustomEmojiId", model_custom_emoji_id_);
    s.store_field("symbolCustomEmojiId", symbol_custom_emoji_id_);
    s.store_object_field("backdropColors", static_cast<const BaseObject *>(backdrop_colors_.get()));
    s.store_class_end();
  }
}

void emojiStatusTypeUpgradedGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiStatusTypeUpgradedGift").c_str());
    upgraded_gift_id_fieldID = jni::get_field_id(env, Class, "upgradedGiftId", "J");
    gift_title_fieldID = jni::get_field_id(env, Class, "giftTitle", "Ljava/lang/String;");
    gift_name_fieldID = jni::get_field_id(env, Class, "giftName", "Ljava/lang/String;");
    model_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "modelCustomEmojiId", "J");
    symbol_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "symbolCustomEmojiId", "J");
    backdrop_colors_fieldID = jni::get_field_id(env, Class, "backdropColors", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftBackdropColors;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass gift::Class;
jfieldID gift::id_fieldID;
jfieldID gift::publisher_chat_id_fieldID;
jfieldID gift::sticker_fieldID;
jfieldID gift::star_count_fieldID;
jfieldID gift::default_sell_star_count_fieldID;
jfieldID gift::upgrade_star_count_fieldID;
jfieldID gift::upgrade_variant_count_fieldID;
jfieldID gift::has_colors_fieldID;
jfieldID gift::is_for_birthday_fieldID;
jfieldID gift::is_premium_fieldID;
jfieldID gift::auction_info_fieldID;
jfieldID gift::next_send_date_fieldID;
jfieldID gift::user_limits_fieldID;
jfieldID gift::overall_limits_fieldID;
jfieldID gift::background_fieldID;
jfieldID gift::first_send_date_fieldID;
jfieldID gift::last_send_date_fieldID;

gift::gift()
  : id_()
  , publisher_chat_id_()
  , sticker_()
  , star_count_()
  , default_sell_star_count_()
  , upgrade_star_count_()
  , upgrade_variant_count_()
  , has_colors_()
  , is_for_birthday_()
  , is_premium_()
  , auction_info_()
  , next_send_date_()
  , user_limits_()
  , overall_limits_()
  , background_()
  , first_send_date_()
  , last_send_date_()
{}

gift::gift(int64 id_, int53 publisher_chat_id_, object_ptr<sticker> &&sticker_, int53 star_count_, int53 default_sell_star_count_, int53 upgrade_star_count_, int32 upgrade_variant_count_, bool has_colors_, bool is_for_birthday_, bool is_premium_, object_ptr<giftAuction> &&auction_info_, int32 next_send_date_, object_ptr<giftPurchaseLimits> &&user_limits_, object_ptr<giftPurchaseLimits> &&overall_limits_, object_ptr<giftBackground> &&background_, int32 first_send_date_, int32 last_send_date_)
  : id_(id_)
  , publisher_chat_id_(publisher_chat_id_)
  , sticker_(std::move(sticker_))
  , star_count_(star_count_)
  , default_sell_star_count_(default_sell_star_count_)
  , upgrade_star_count_(upgrade_star_count_)
  , upgrade_variant_count_(upgrade_variant_count_)
  , has_colors_(has_colors_)
  , is_for_birthday_(is_for_birthday_)
  , is_premium_(is_premium_)
  , auction_info_(std::move(auction_info_))
  , next_send_date_(next_send_date_)
  , user_limits_(std::move(user_limits_))
  , overall_limits_(std::move(overall_limits_))
  , background_(std::move(background_))
  , first_send_date_(first_send_date_)
  , last_send_date_(last_send_date_)
{}

const std::int32_t gift::ID;

object_ptr<gift> gift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<gift> res = make_object<gift>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->publisher_chat_id_ = env->GetLongField(p, res->publisher_chat_id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->default_sell_star_count_ = env->GetLongField(p, res->default_sell_star_count_fieldID);
  res->upgrade_star_count_ = env->GetLongField(p, res->upgrade_star_count_fieldID);
  res->upgrade_variant_count_ = env->GetIntField(p, res->upgrade_variant_count_fieldID);
  res->has_colors_ = (env->GetBooleanField(p, res->has_colors_fieldID) != 0);
  res->is_for_birthday_ = (env->GetBooleanField(p, res->is_for_birthday_fieldID) != 0);
  res->is_premium_ = (env->GetBooleanField(p, res->is_premium_fieldID) != 0);
  res->auction_info_ = jni::fetch_tl_object<giftAuction>(env, jni::fetch_object(env, p, res->auction_info_fieldID));
  res->next_send_date_ = env->GetIntField(p, res->next_send_date_fieldID);
  res->user_limits_ = jni::fetch_tl_object<giftPurchaseLimits>(env, jni::fetch_object(env, p, res->user_limits_fieldID));
  res->overall_limits_ = jni::fetch_tl_object<giftPurchaseLimits>(env, jni::fetch_object(env, p, res->overall_limits_fieldID));
  res->background_ = jni::fetch_tl_object<giftBackground>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->first_send_date_ = env->GetIntField(p, res->first_send_date_fieldID);
  res->last_send_date_ = env->GetIntField(p, res->last_send_date_fieldID);
  return res;
}

void gift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, publisher_chat_id_fieldID, publisher_chat_id_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, star_count_fieldID, star_count_);
  env->SetLongField(s, default_sell_star_count_fieldID, default_sell_star_count_);
  env->SetLongField(s, upgrade_star_count_fieldID, upgrade_star_count_);
  env->SetIntField(s, upgrade_variant_count_fieldID, upgrade_variant_count_);
  env->SetBooleanField(s, has_colors_fieldID, has_colors_);
  env->SetBooleanField(s, is_for_birthday_fieldID, is_for_birthday_);
  env->SetBooleanField(s, is_premium_fieldID, is_premium_);
  if (auction_info_ != nullptr) { jobject next; auction_info_->store(env, next); if (next) { env->SetObjectField(s, auction_info_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, next_send_date_fieldID, next_send_date_);
  if (user_limits_ != nullptr) { jobject next; user_limits_->store(env, next); if (next) { env->SetObjectField(s, user_limits_fieldID, next); env->DeleteLocalRef(next); } }
  if (overall_limits_ != nullptr) { jobject next; overall_limits_->store(env, next); if (next) { env->SetObjectField(s, overall_limits_fieldID, next); env->DeleteLocalRef(next); } }
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, first_send_date_fieldID, first_send_date_);
  env->SetIntField(s, last_send_date_fieldID, last_send_date_);
}

void gift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Gift");
    s.store_field("id", id_);
    s.store_field("publisherChatId", publisher_chat_id_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_field("starCount", star_count_);
    s.store_field("defaultSellStarCount", default_sell_star_count_);
    s.store_field("upgradeStarCount", upgrade_star_count_);
    s.store_field("upgradeVariantCount", upgrade_variant_count_);
    s.store_field("hasColors", has_colors_);
    s.store_field("isForBirthday", is_for_birthday_);
    s.store_field("isPremium", is_premium_);
    s.store_object_field("auctionInfo", static_cast<const BaseObject *>(auction_info_.get()));
    s.store_field("nextSendDate", next_send_date_);
    s.store_object_field("userLimits", static_cast<const BaseObject *>(user_limits_.get()));
    s.store_object_field("overallLimits", static_cast<const BaseObject *>(overall_limits_.get()));
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_field("firstSendDate", first_send_date_);
    s.store_field("lastSendDate", last_send_date_);
    s.store_class_end();
  }
}

void gift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Gift").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    publisher_chat_id_fieldID = jni::get_field_id(env, Class, "publisherChatId", "J");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    default_sell_star_count_fieldID = jni::get_field_id(env, Class, "defaultSellStarCount", "J");
    upgrade_star_count_fieldID = jni::get_field_id(env, Class, "upgradeStarCount", "J");
    upgrade_variant_count_fieldID = jni::get_field_id(env, Class, "upgradeVariantCount", "I");
    has_colors_fieldID = jni::get_field_id(env, Class, "hasColors", "Z");
    is_for_birthday_fieldID = jni::get_field_id(env, Class, "isForBirthday", "Z");
    is_premium_fieldID = jni::get_field_id(env, Class, "isPremium", "Z");
    auction_info_fieldID = jni::get_field_id(env, Class, "auctionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftAuction;").c_str());
    next_send_date_fieldID = jni::get_field_id(env, Class, "nextSendDate", "I");
    user_limits_fieldID = jni::get_field_id(env, Class, "userLimits", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftPurchaseLimits;").c_str());
    overall_limits_fieldID = jni::get_field_id(env, Class, "overallLimits", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftPurchaseLimits;").c_str());
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftBackground;").c_str());
    first_send_date_fieldID = jni::get_field_id(env, Class, "firstSendDate", "I");
    last_send_date_fieldID = jni::get_field_id(env, Class, "lastSendDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass giftAuction::Class;
jfieldID giftAuction::id_fieldID;
jfieldID giftAuction::gifts_per_round_fieldID;
jfieldID giftAuction::start_date_fieldID;

giftAuction::giftAuction()
  : id_()
  , gifts_per_round_()
  , start_date_()
{}

giftAuction::giftAuction(string const &id_, int32 gifts_per_round_, int32 start_date_)
  : id_(id_)
  , gifts_per_round_(gifts_per_round_)
  , start_date_(start_date_)
{}

const std::int32_t giftAuction::ID;

object_ptr<giftAuction> giftAuction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftAuction> res = make_object<giftAuction>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->gifts_per_round_ = env->GetIntField(p, res->gifts_per_round_fieldID);
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  return res;
}

void giftAuction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, gifts_per_round_fieldID, gifts_per_round_);
  env->SetIntField(s, start_date_fieldID, start_date_);
}

void giftAuction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftAuction");
    s.store_field("id", id_);
    s.store_field("giftsPerRound", gifts_per_round_);
    s.store_field("startDate", start_date_);
    s.store_class_end();
  }
}

void giftAuction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftAuction").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    gifts_per_round_fieldID = jni::get_field_id(env, Class, "giftsPerRound", "I");
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass giftAuctionAcquiredGifts::Class;
jfieldID giftAuctionAcquiredGifts::gifts_fieldID;

giftAuctionAcquiredGifts::giftAuctionAcquiredGifts()
  : gifts_()
{}

giftAuctionAcquiredGifts::giftAuctionAcquiredGifts(array<object_ptr<giftAuctionAcquiredGift>> &&gifts_)
  : gifts_(std::move(gifts_))
{}

const std::int32_t giftAuctionAcquiredGifts::ID;

object_ptr<giftAuctionAcquiredGifts> giftAuctionAcquiredGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftAuctionAcquiredGifts> res = make_object<giftAuctionAcquiredGifts>();
  res->gifts_ = jni::FetchVector<giftAuctionAcquiredGift>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->gifts_fieldID));
  return res;
}

void giftAuctionAcquiredGifts::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, gifts_); if (arr_tmp_) { env->SetObjectField(s, gifts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void giftAuctionAcquiredGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftAuctionAcquiredGifts");
    { s.store_vector_begin("gifts", gifts_.size()); for (const auto &_value : gifts_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void giftAuctionAcquiredGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftAuctionAcquiredGifts").c_str());
    gifts_fieldID = jni::get_field_id(env, Class, "gifts", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GiftAuctionAcquiredGift;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass giftForResale::Class;
jfieldID giftForResale::gift_fieldID;
jfieldID giftForResale::received_gift_id_fieldID;

giftForResale::giftForResale()
  : gift_()
  , received_gift_id_()
{}

giftForResale::giftForResale(object_ptr<upgradedGift> &&gift_, string const &received_gift_id_)
  : gift_(std::move(gift_))
  , received_gift_id_(received_gift_id_)
{}

const std::int32_t giftForResale::ID;

object_ptr<giftForResale> giftForResale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftForResale> res = make_object<giftForResale>();
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  return res;
}

void giftForResale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, received_gift_id_); if (nextString) { env->SetObjectField(s, received_gift_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void giftForResale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftForResale");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_class_end();
  }
}

void giftForResale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftForResale").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass importedContact::Class;
jfieldID importedContact::phone_number_fieldID;
jfieldID importedContact::first_name_fieldID;
jfieldID importedContact::last_name_fieldID;
jfieldID importedContact::note_fieldID;

importedContact::importedContact()
  : phone_number_()
  , first_name_()
  , last_name_()
  , note_()
{}

importedContact::importedContact(string const &phone_number_, string const &first_name_, string const &last_name_, object_ptr<formattedText> &&note_)
  : phone_number_(phone_number_)
  , first_name_(first_name_)
  , last_name_(last_name_)
  , note_(std::move(note_))
{}

const std::int32_t importedContact::ID;

object_ptr<importedContact> importedContact::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<importedContact> res = make_object<importedContact>();
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  res->note_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->note_fieldID));
  return res;
}

void importedContact::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ImportedContact");
    s.store_field("phoneNumber", phone_number_);
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_object_field("note", static_cast<const BaseObject *>(note_.get()));
    s.store_class_end();
  }
}

void importedContact::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ImportedContact").c_str());
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    first_name_fieldID = jni::get_field_id(env, Class, "firstName", "Ljava/lang/String;");
    last_name_fieldID = jni::get_field_id(env, Class, "lastName", "Ljava/lang/String;");
    note_fieldID = jni::get_field_id(env, Class, "note", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass InlineKeyboardButtonType::Class;

object_ptr<InlineKeyboardButtonType> InlineKeyboardButtonType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case inlineKeyboardButtonTypeUrl::ID:
      return inlineKeyboardButtonTypeUrl::fetch(env, p);
    case inlineKeyboardButtonTypeLoginUrl::ID:
      return inlineKeyboardButtonTypeLoginUrl::fetch(env, p);
    case inlineKeyboardButtonTypeWebApp::ID:
      return inlineKeyboardButtonTypeWebApp::fetch(env, p);
    case inlineKeyboardButtonTypeCallback::ID:
      return inlineKeyboardButtonTypeCallback::fetch(env, p);
    case inlineKeyboardButtonTypeCallbackWithPassword::ID:
      return inlineKeyboardButtonTypeCallbackWithPassword::fetch(env, p);
    case inlineKeyboardButtonTypeCallbackGame::ID:
      return inlineKeyboardButtonTypeCallbackGame::fetch(env, p);
    case inlineKeyboardButtonTypeSwitchInline::ID:
      return inlineKeyboardButtonTypeSwitchInline::fetch(env, p);
    case inlineKeyboardButtonTypeBuy::ID:
      return inlineKeyboardButtonTypeBuy::fetch(env, p);
    case inlineKeyboardButtonTypeUser::ID:
      return inlineKeyboardButtonTypeUser::fetch(env, p);
    case inlineKeyboardButtonTypeCopyText::ID:
      return inlineKeyboardButtonTypeCopyText::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void InlineKeyboardButtonType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeUrl::Class;
jfieldID inlineKeyboardButtonTypeUrl::url_fieldID;

inlineKeyboardButtonTypeUrl::inlineKeyboardButtonTypeUrl()
  : url_()
{}

inlineKeyboardButtonTypeUrl::inlineKeyboardButtonTypeUrl(string const &url_)
  : url_(url_)
{}

const std::int32_t inlineKeyboardButtonTypeUrl::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeUrl> res = make_object<inlineKeyboardButtonTypeUrl>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void inlineKeyboardButtonTypeUrl::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineKeyboardButtonTypeUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeUrl");
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeUrl").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeLoginUrl::Class;
jfieldID inlineKeyboardButtonTypeLoginUrl::url_fieldID;
jfieldID inlineKeyboardButtonTypeLoginUrl::id_fieldID;
jfieldID inlineKeyboardButtonTypeLoginUrl::forward_text_fieldID;

inlineKeyboardButtonTypeLoginUrl::inlineKeyboardButtonTypeLoginUrl()
  : url_()
  , id_()
  , forward_text_()
{}

inlineKeyboardButtonTypeLoginUrl::inlineKeyboardButtonTypeLoginUrl(string const &url_, int53 id_, string const &forward_text_)
  : url_(url_)
  , id_(id_)
  , forward_text_(forward_text_)
{}

const std::int32_t inlineKeyboardButtonTypeLoginUrl::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeLoginUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeLoginUrl> res = make_object<inlineKeyboardButtonTypeLoginUrl>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->forward_text_ = jni::fetch_string(env, p, res->forward_text_fieldID);
  return std::move(res);
}

void inlineKeyboardButtonTypeLoginUrl::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, forward_text_); if (nextString) { env->SetObjectField(s, forward_text_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineKeyboardButtonTypeLoginUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeLoginUrl");
    s.store_field("url", url_);
    s.store_field("id", id_);
    s.store_field("forwardText", forward_text_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeLoginUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeLoginUrl").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    forward_text_fieldID = jni::get_field_id(env, Class, "forwardText", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeWebApp::Class;
jfieldID inlineKeyboardButtonTypeWebApp::url_fieldID;

inlineKeyboardButtonTypeWebApp::inlineKeyboardButtonTypeWebApp()
  : url_()
{}

inlineKeyboardButtonTypeWebApp::inlineKeyboardButtonTypeWebApp(string const &url_)
  : url_(url_)
{}

const std::int32_t inlineKeyboardButtonTypeWebApp::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeWebApp> res = make_object<inlineKeyboardButtonTypeWebApp>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void inlineKeyboardButtonTypeWebApp::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineKeyboardButtonTypeWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeWebApp");
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeWebApp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeWebApp").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeCallback::Class;
jfieldID inlineKeyboardButtonTypeCallback::data_fieldID;

inlineKeyboardButtonTypeCallback::inlineKeyboardButtonTypeCallback()
  : data_()
{}

inlineKeyboardButtonTypeCallback::inlineKeyboardButtonTypeCallback(bytes const &data_)
  : data_(std::move(data_))
{}

const std::int32_t inlineKeyboardButtonTypeCallback::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeCallback::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeCallback> res = make_object<inlineKeyboardButtonTypeCallback>();
  res->data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_fieldID));
  return std::move(res);
}

void inlineKeyboardButtonTypeCallback::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jbyteArray nextBytes = jni::to_bytes(env, data_); if (nextBytes) { env->SetObjectField(s, data_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
}

void inlineKeyboardButtonTypeCallback::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeCallback");
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeCallback::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeCallback").c_str());
    data_fieldID = jni::get_field_id(env, Class, "data", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeCallbackWithPassword::Class;
jfieldID inlineKeyboardButtonTypeCallbackWithPassword::data_fieldID;

inlineKeyboardButtonTypeCallbackWithPassword::inlineKeyboardButtonTypeCallbackWithPassword()
  : data_()
{}

inlineKeyboardButtonTypeCallbackWithPassword::inlineKeyboardButtonTypeCallbackWithPassword(bytes const &data_)
  : data_(std::move(data_))
{}

const std::int32_t inlineKeyboardButtonTypeCallbackWithPassword::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeCallbackWithPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeCallbackWithPassword> res = make_object<inlineKeyboardButtonTypeCallbackWithPassword>();
  res->data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_fieldID));
  return std::move(res);
}

void inlineKeyboardButtonTypeCallbackWithPassword::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jbyteArray nextBytes = jni::to_bytes(env, data_); if (nextBytes) { env->SetObjectField(s, data_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
}

void inlineKeyboardButtonTypeCallbackWithPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeCallbackWithPassword");
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeCallbackWithPassword::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeCallbackWithPassword").c_str());
    data_fieldID = jni::get_field_id(env, Class, "data", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeCallbackGame::Class;

inlineKeyboardButtonTypeCallbackGame::inlineKeyboardButtonTypeCallbackGame() {
}

const std::int32_t inlineKeyboardButtonTypeCallbackGame::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeCallbackGame::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<inlineKeyboardButtonTypeCallbackGame>();
}

void inlineKeyboardButtonTypeCallbackGame::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void inlineKeyboardButtonTypeCallbackGame::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeCallbackGame");
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeCallbackGame::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeCallbackGame").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeSwitchInline::Class;
jfieldID inlineKeyboardButtonTypeSwitchInline::query_fieldID;
jfieldID inlineKeyboardButtonTypeSwitchInline::target_chat_fieldID;

inlineKeyboardButtonTypeSwitchInline::inlineKeyboardButtonTypeSwitchInline()
  : query_()
  , target_chat_()
{}

inlineKeyboardButtonTypeSwitchInline::inlineKeyboardButtonTypeSwitchInline(string const &query_, object_ptr<TargetChat> &&target_chat_)
  : query_(query_)
  , target_chat_(std::move(target_chat_))
{}

const std::int32_t inlineKeyboardButtonTypeSwitchInline::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeSwitchInline::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeSwitchInline> res = make_object<inlineKeyboardButtonTypeSwitchInline>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->target_chat_ = jni::fetch_tl_object<TargetChat>(env, jni::fetch_object(env, p, res->target_chat_fieldID));
  return std::move(res);
}

void inlineKeyboardButtonTypeSwitchInline::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, query_); if (nextString) { env->SetObjectField(s, query_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (target_chat_ != nullptr) { jobject next; target_chat_->store(env, next); if (next) { env->SetObjectField(s, target_chat_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineKeyboardButtonTypeSwitchInline::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeSwitchInline");
    s.store_field("query", query_);
    s.store_object_field("targetChat", static_cast<const BaseObject *>(target_chat_.get()));
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeSwitchInline::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeSwitchInline").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    target_chat_fieldID = jni::get_field_id(env, Class, "targetChat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TargetChat;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeBuy::Class;

inlineKeyboardButtonTypeBuy::inlineKeyboardButtonTypeBuy() {
}

const std::int32_t inlineKeyboardButtonTypeBuy::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeBuy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<inlineKeyboardButtonTypeBuy>();
}

void inlineKeyboardButtonTypeBuy::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void inlineKeyboardButtonTypeBuy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeBuy");
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeBuy::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeBuy").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeUser::Class;
jfieldID inlineKeyboardButtonTypeUser::user_id_fieldID;

inlineKeyboardButtonTypeUser::inlineKeyboardButtonTypeUser()
  : user_id_()
{}

inlineKeyboardButtonTypeUser::inlineKeyboardButtonTypeUser(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t inlineKeyboardButtonTypeUser::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeUser> res = make_object<inlineKeyboardButtonTypeUser>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  return std::move(res);
}

void inlineKeyboardButtonTypeUser::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
}

void inlineKeyboardButtonTypeUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeUser");
    s.store_field("userId", user_id_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeUser::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeUser").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass inlineKeyboardButtonTypeCopyText::Class;
jfieldID inlineKeyboardButtonTypeCopyText::text_fieldID;

inlineKeyboardButtonTypeCopyText::inlineKeyboardButtonTypeCopyText()
  : text_()
{}

inlineKeyboardButtonTypeCopyText::inlineKeyboardButtonTypeCopyText(string const &text_)
  : text_(text_)
{}

const std::int32_t inlineKeyboardButtonTypeCopyText::ID;

object_ptr<InlineKeyboardButtonType> inlineKeyboardButtonTypeCopyText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineKeyboardButtonTypeCopyText> res = make_object<inlineKeyboardButtonTypeCopyText>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  return std::move(res);
}

void inlineKeyboardButtonTypeCopyText::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, text_); if (nextString) { env->SetObjectField(s, text_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineKeyboardButtonTypeCopyText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineKeyboardButtonTypeCopyText");
    s.store_field("text", text_);
    s.store_class_end();
  }
}

void inlineKeyboardButtonTypeCopyText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineKeyboardButtonTypeCopyText").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass InlineQueryResult::Class;

object_ptr<InlineQueryResult> InlineQueryResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case inlineQueryResultArticle::ID:
      return inlineQueryResultArticle::fetch(env, p);
    case inlineQueryResultContact::ID:
      return inlineQueryResultContact::fetch(env, p);
    case inlineQueryResultLocation::ID:
      return inlineQueryResultLocation::fetch(env, p);
    case inlineQueryResultVenue::ID:
      return inlineQueryResultVenue::fetch(env, p);
    case inlineQueryResultGame::ID:
      return inlineQueryResultGame::fetch(env, p);
    case inlineQueryResultAnimation::ID:
      return inlineQueryResultAnimation::fetch(env, p);
    case inlineQueryResultAudio::ID:
      return inlineQueryResultAudio::fetch(env, p);
    case inlineQueryResultDocument::ID:
      return inlineQueryResultDocument::fetch(env, p);
    case inlineQueryResultPhoto::ID:
      return inlineQueryResultPhoto::fetch(env, p);
    case inlineQueryResultSticker::ID:
      return inlineQueryResultSticker::fetch(env, p);
    case inlineQueryResultVideo::ID:
      return inlineQueryResultVideo::fetch(env, p);
    case inlineQueryResultVoiceNote::ID:
      return inlineQueryResultVoiceNote::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void InlineQueryResult::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResult").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultArticle::Class;
jfieldID inlineQueryResultArticle::id_fieldID;
jfieldID inlineQueryResultArticle::url_fieldID;
jfieldID inlineQueryResultArticle::title_fieldID;
jfieldID inlineQueryResultArticle::description_fieldID;
jfieldID inlineQueryResultArticle::thumbnail_fieldID;

inlineQueryResultArticle::inlineQueryResultArticle()
  : id_()
  , url_()
  , title_()
  , description_()
  , thumbnail_()
{}

inlineQueryResultArticle::inlineQueryResultArticle(string const &id_, string const &url_, string const &title_, string const &description_, object_ptr<thumbnail> &&thumbnail_)
  : id_(id_)
  , url_(url_)
  , title_(title_)
  , description_(description_)
  , thumbnail_(std::move(thumbnail_))
{}

const std::int32_t inlineQueryResultArticle::ID;

object_ptr<InlineQueryResult> inlineQueryResultArticle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultArticle> res = make_object<inlineQueryResultArticle>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  return std::move(res);
}

void inlineQueryResultArticle::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultArticle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultArticle");
    s.store_field("id", id_);
    s.store_field("url", url_);
    s.store_field("title", title_);
    s.store_field("description", description_);
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultArticle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultArticle").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultContact::Class;
jfieldID inlineQueryResultContact::id_fieldID;
jfieldID inlineQueryResultContact::contact_fieldID;
jfieldID inlineQueryResultContact::thumbnail_fieldID;

inlineQueryResultContact::inlineQueryResultContact()
  : id_()
  , contact_()
  , thumbnail_()
{}

inlineQueryResultContact::inlineQueryResultContact(string const &id_, object_ptr<contact> &&contact_, object_ptr<thumbnail> &&thumbnail_)
  : id_(id_)
  , contact_(std::move(contact_))
  , thumbnail_(std::move(thumbnail_))
{}

const std::int32_t inlineQueryResultContact::ID;

object_ptr<InlineQueryResult> inlineQueryResultContact::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultContact> res = make_object<inlineQueryResultContact>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->contact_ = jni::fetch_tl_object<contact>(env, jni::fetch_object(env, p, res->contact_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  return std::move(res);
}

void inlineQueryResultContact::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (contact_ != nullptr) { jobject next; contact_->store(env, next); if (next) { env->SetObjectField(s, contact_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultContact::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultContact");
    s.store_field("id", id_);
    s.store_object_field("contact", static_cast<const BaseObject *>(contact_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultContact::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultContact").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    contact_fieldID = jni::get_field_id(env, Class, "contact", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Contact;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultLocation::Class;
jfieldID inlineQueryResultLocation::id_fieldID;
jfieldID inlineQueryResultLocation::location_fieldID;
jfieldID inlineQueryResultLocation::title_fieldID;
jfieldID inlineQueryResultLocation::thumbnail_fieldID;

inlineQueryResultLocation::inlineQueryResultLocation()
  : id_()
  , location_()
  , title_()
  , thumbnail_()
{}

inlineQueryResultLocation::inlineQueryResultLocation(string const &id_, object_ptr<location> &&location_, string const &title_, object_ptr<thumbnail> &&thumbnail_)
  : id_(id_)
  , location_(std::move(location_))
  , title_(title_)
  , thumbnail_(std::move(thumbnail_))
{}

const std::int32_t inlineQueryResultLocation::ID;

object_ptr<InlineQueryResult> inlineQueryResultLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultLocation> res = make_object<inlineQueryResultLocation>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  return std::move(res);
}

void inlineQueryResultLocation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultLocation");
    s.store_field("id", id_);
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("title", title_);
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultLocation").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultVenue::Class;
jfieldID inlineQueryResultVenue::id_fieldID;
jfieldID inlineQueryResultVenue::venue_fieldID;
jfieldID inlineQueryResultVenue::thumbnail_fieldID;

inlineQueryResultVenue::inlineQueryResultVenue()
  : id_()
  , venue_()
  , thumbnail_()
{}

inlineQueryResultVenue::inlineQueryResultVenue(string const &id_, object_ptr<venue> &&venue_, object_ptr<thumbnail> &&thumbnail_)
  : id_(id_)
  , venue_(std::move(venue_))
  , thumbnail_(std::move(thumbnail_))
{}

const std::int32_t inlineQueryResultVenue::ID;

object_ptr<InlineQueryResult> inlineQueryResultVenue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultVenue> res = make_object<inlineQueryResultVenue>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->venue_ = jni::fetch_tl_object<venue>(env, jni::fetch_object(env, p, res->venue_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  return std::move(res);
}

void inlineQueryResultVenue::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (venue_ != nullptr) { jobject next; venue_->store(env, next); if (next) { env->SetObjectField(s, venue_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultVenue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultVenue");
    s.store_field("id", id_);
    s.store_object_field("venue", static_cast<const BaseObject *>(venue_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultVenue::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultVenue").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    venue_fieldID = jni::get_field_id(env, Class, "venue", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Venue;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultGame::Class;
jfieldID inlineQueryResultGame::id_fieldID;
jfieldID inlineQueryResultGame::game_fieldID;

inlineQueryResultGame::inlineQueryResultGame()
  : id_()
  , game_()
{}

inlineQueryResultGame::inlineQueryResultGame(string const &id_, object_ptr<game> &&game_)
  : id_(id_)
  , game_(std::move(game_))
{}

const std::int32_t inlineQueryResultGame::ID;

object_ptr<InlineQueryResult> inlineQueryResultGame::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultGame> res = make_object<inlineQueryResultGame>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->game_ = jni::fetch_tl_object<game>(env, jni::fetch_object(env, p, res->game_fieldID));
  return std::move(res);
}

void inlineQueryResultGame::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (game_ != nullptr) { jobject next; game_->store(env, next); if (next) { env->SetObjectField(s, game_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultGame::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultGame");
    s.store_field("id", id_);
    s.store_object_field("game", static_cast<const BaseObject *>(game_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultGame::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultGame").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    game_fieldID = jni::get_field_id(env, Class, "game", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Game;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultAnimation::Class;
jfieldID inlineQueryResultAnimation::id_fieldID;
jfieldID inlineQueryResultAnimation::animation_fieldID;
jfieldID inlineQueryResultAnimation::title_fieldID;

inlineQueryResultAnimation::inlineQueryResultAnimation()
  : id_()
  , animation_()
  , title_()
{}

inlineQueryResultAnimation::inlineQueryResultAnimation(string const &id_, object_ptr<animation> &&animation_, string const &title_)
  : id_(id_)
  , animation_(std::move(animation_))
  , title_(title_)
{}

const std::int32_t inlineQueryResultAnimation::ID;

object_ptr<InlineQueryResult> inlineQueryResultAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultAnimation> res = make_object<inlineQueryResultAnimation>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  return std::move(res);
}

void inlineQueryResultAnimation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineQueryResultAnimation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultAnimation");
    s.store_field("id", id_);
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_field("title", title_);
    s.store_class_end();
  }
}

void inlineQueryResultAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultAnimation").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultAudio::Class;
jfieldID inlineQueryResultAudio::id_fieldID;
jfieldID inlineQueryResultAudio::audio_fieldID;

inlineQueryResultAudio::inlineQueryResultAudio()
  : id_()
  , audio_()
{}

inlineQueryResultAudio::inlineQueryResultAudio(string const &id_, object_ptr<audio> &&audio_)
  : id_(id_)
  , audio_(std::move(audio_))
{}

const std::int32_t inlineQueryResultAudio::ID;

object_ptr<InlineQueryResult> inlineQueryResultAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultAudio> res = make_object<inlineQueryResultAudio>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->audio_ = jni::fetch_tl_object<audio>(env, jni::fetch_object(env, p, res->audio_fieldID));
  return std::move(res);
}

void inlineQueryResultAudio::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (audio_ != nullptr) { jobject next; audio_->store(env, next); if (next) { env->SetObjectField(s, audio_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultAudio");
    s.store_field("id", id_);
    s.store_object_field("audio", static_cast<const BaseObject *>(audio_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultAudio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultAudio").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Audio;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultDocument::Class;
jfieldID inlineQueryResultDocument::id_fieldID;
jfieldID inlineQueryResultDocument::document_fieldID;
jfieldID inlineQueryResultDocument::title_fieldID;
jfieldID inlineQueryResultDocument::description_fieldID;

inlineQueryResultDocument::inlineQueryResultDocument()
  : id_()
  , document_()
  , title_()
  , description_()
{}

inlineQueryResultDocument::inlineQueryResultDocument(string const &id_, object_ptr<document> &&document_, string const &title_, string const &description_)
  : id_(id_)
  , document_(std::move(document_))
  , title_(title_)
  , description_(description_)
{}

const std::int32_t inlineQueryResultDocument::ID;

object_ptr<InlineQueryResult> inlineQueryResultDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultDocument> res = make_object<inlineQueryResultDocument>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->document_ = jni::fetch_tl_object<document>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return std::move(res);
}

void inlineQueryResultDocument::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (document_ != nullptr) { jobject next; document_->store(env, next); if (next) { env->SetObjectField(s, document_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineQueryResultDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultDocument");
    s.store_field("id", id_);
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_field("title", title_);
    s.store_field("description", description_);
    s.store_class_end();
  }
}

void inlineQueryResultDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultDocument").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Document;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultPhoto::Class;
jfieldID inlineQueryResultPhoto::id_fieldID;
jfieldID inlineQueryResultPhoto::photo_fieldID;
jfieldID inlineQueryResultPhoto::title_fieldID;
jfieldID inlineQueryResultPhoto::description_fieldID;

inlineQueryResultPhoto::inlineQueryResultPhoto()
  : id_()
  , photo_()
  , title_()
  , description_()
{}

inlineQueryResultPhoto::inlineQueryResultPhoto(string const &id_, object_ptr<photo> &&photo_, string const &title_, string const &description_)
  : id_(id_)
  , photo_(std::move(photo_))
  , title_(title_)
  , description_(description_)
{}

const std::int32_t inlineQueryResultPhoto::ID;

object_ptr<InlineQueryResult> inlineQueryResultPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultPhoto> res = make_object<inlineQueryResultPhoto>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return std::move(res);
}

void inlineQueryResultPhoto::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineQueryResultPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultPhoto");
    s.store_field("id", id_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("title", title_);
    s.store_field("description", description_);
    s.store_class_end();
  }
}

void inlineQueryResultPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultPhoto").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultSticker::Class;
jfieldID inlineQueryResultSticker::id_fieldID;
jfieldID inlineQueryResultSticker::sticker_fieldID;

inlineQueryResultSticker::inlineQueryResultSticker()
  : id_()
  , sticker_()
{}

inlineQueryResultSticker::inlineQueryResultSticker(string const &id_, object_ptr<sticker> &&sticker_)
  : id_(id_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t inlineQueryResultSticker::ID;

object_ptr<InlineQueryResult> inlineQueryResultSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultSticker> res = make_object<inlineQueryResultSticker>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void inlineQueryResultSticker::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void inlineQueryResultSticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultSticker");
    s.store_field("id", id_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void inlineQueryResultSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultSticker").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultVideo::Class;
jfieldID inlineQueryResultVideo::id_fieldID;
jfieldID inlineQueryResultVideo::video_fieldID;
jfieldID inlineQueryResultVideo::title_fieldID;
jfieldID inlineQueryResultVideo::description_fieldID;

inlineQueryResultVideo::inlineQueryResultVideo()
  : id_()
  , video_()
  , title_()
  , description_()
{}

inlineQueryResultVideo::inlineQueryResultVideo(string const &id_, object_ptr<video> &&video_, string const &title_, string const &description_)
  : id_(id_)
  , video_(std::move(video_))
  , title_(title_)
  , description_(description_)
{}

const std::int32_t inlineQueryResultVideo::ID;

object_ptr<InlineQueryResult> inlineQueryResultVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultVideo> res = make_object<inlineQueryResultVideo>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return std::move(res);
}

void inlineQueryResultVideo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineQueryResultVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultVideo");
    s.store_field("id", id_);
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_field("title", title_);
    s.store_field("description", description_);
    s.store_class_end();
  }
}

void inlineQueryResultVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultVideo").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inlineQueryResultVoiceNote::Class;
jfieldID inlineQueryResultVoiceNote::id_fieldID;
jfieldID inlineQueryResultVoiceNote::voice_note_fieldID;
jfieldID inlineQueryResultVoiceNote::title_fieldID;

inlineQueryResultVoiceNote::inlineQueryResultVoiceNote()
  : id_()
  , voice_note_()
  , title_()
{}

inlineQueryResultVoiceNote::inlineQueryResultVoiceNote(string const &id_, object_ptr<voiceNote> &&voice_note_, string const &title_)
  : id_(id_)
  , voice_note_(std::move(voice_note_))
  , title_(title_)
{}

const std::int32_t inlineQueryResultVoiceNote::ID;

object_ptr<InlineQueryResult> inlineQueryResultVoiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultVoiceNote> res = make_object<inlineQueryResultVoiceNote>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->voice_note_ = jni::fetch_tl_object<voiceNote>(env, jni::fetch_object(env, p, res->voice_note_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  return std::move(res);
}

void inlineQueryResultVoiceNote::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (voice_note_ != nullptr) { jobject next; voice_note_->store(env, next); if (next) { env->SetObjectField(s, voice_note_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineQueryResultVoiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultVoiceNote");
    s.store_field("id", id_);
    s.store_object_field("voiceNote", static_cast<const BaseObject *>(voice_note_.get()));
    s.store_field("title", title_);
    s.store_class_end();
  }
}

void inlineQueryResultVoiceNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResultVoiceNote").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    voice_note_fieldID = jni::get_field_id(env, Class, "voiceNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VoiceNote;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inputChecklistTask::Class;
jfieldID inputChecklistTask::id_fieldID;
jfieldID inputChecklistTask::text_fieldID;

inputChecklistTask::inputChecklistTask()
  : id_()
  , text_()
{}

inputChecklistTask::inputChecklistTask(int32 id_, object_ptr<formattedText> &&text_)
  : id_(id_)
  , text_(std::move(text_))
{}

const std::int32_t inputChecklistTask::ID;

object_ptr<inputChecklistTask> inputChecklistTask::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputChecklistTask> res = make_object<inputChecklistTask>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return res;
}

void inputChecklistTask::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputChecklistTask::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputChecklistTask");
    s.store_field("id", id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void inputChecklistTask::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputChecklistTask").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass LinkPreviewAlbumMedia::Class;

object_ptr<LinkPreviewAlbumMedia> LinkPreviewAlbumMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case linkPreviewAlbumMediaPhoto::ID:
      return linkPreviewAlbumMediaPhoto::fetch(env, p);
    case linkPreviewAlbumMediaVideo::ID:
      return linkPreviewAlbumMediaVideo::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void LinkPreviewAlbumMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewAlbumMedia").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewAlbumMediaPhoto::Class;
jfieldID linkPreviewAlbumMediaPhoto::photo_fieldID;

linkPreviewAlbumMediaPhoto::linkPreviewAlbumMediaPhoto()
  : photo_()
{}

linkPreviewAlbumMediaPhoto::linkPreviewAlbumMediaPhoto(object_ptr<photo> &&photo_)
  : photo_(std::move(photo_))
{}

const std::int32_t linkPreviewAlbumMediaPhoto::ID;

object_ptr<LinkPreviewAlbumMedia> linkPreviewAlbumMediaPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewAlbumMediaPhoto> res = make_object<linkPreviewAlbumMediaPhoto>();
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return std::move(res);
}

void linkPreviewAlbumMediaPhoto::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
}

void linkPreviewAlbumMediaPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewAlbumMediaPhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_class_end();
  }
}

void linkPreviewAlbumMediaPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewAlbumMediaPhoto").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewAlbumMediaVideo::Class;
jfieldID linkPreviewAlbumMediaVideo::video_fieldID;

linkPreviewAlbumMediaVideo::linkPreviewAlbumMediaVideo()
  : video_()
{}

linkPreviewAlbumMediaVideo::linkPreviewAlbumMediaVideo(object_ptr<video> &&video_)
  : video_(std::move(video_))
{}

const std::int32_t linkPreviewAlbumMediaVideo::ID;

object_ptr<LinkPreviewAlbumMedia> linkPreviewAlbumMediaVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewAlbumMediaVideo> res = make_object<linkPreviewAlbumMediaVideo>();
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  return std::move(res);
}

void linkPreviewAlbumMediaVideo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
}

void linkPreviewAlbumMediaVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewAlbumMediaVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_class_end();
  }
}

void linkPreviewAlbumMediaVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewAlbumMediaVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass liveStoryDonors::Class;
jfieldID liveStoryDonors::total_star_count_fieldID;
jfieldID liveStoryDonors::top_donors_fieldID;

liveStoryDonors::liveStoryDonors()
  : total_star_count_()
  , top_donors_()
{}

liveStoryDonors::liveStoryDonors(int53 total_star_count_, array<object_ptr<paidReactor>> &&top_donors_)
  : total_star_count_(total_star_count_)
  , top_donors_(std::move(top_donors_))
{}

const std::int32_t liveStoryDonors::ID;

object_ptr<liveStoryDonors> liveStoryDonors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<liveStoryDonors> res = make_object<liveStoryDonors>();
  res->total_star_count_ = env->GetLongField(p, res->total_star_count_fieldID);
  res->top_donors_ = jni::FetchVector<paidReactor>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->top_donors_fieldID));
  return res;
}

void liveStoryDonors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, total_star_count_fieldID, total_star_count_);
  { auto arr_tmp_ = jni::store_vector(env, top_donors_); if (arr_tmp_) { env->SetObjectField(s, top_donors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void liveStoryDonors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LiveStoryDonors");
    s.store_field("totalStarCount", total_star_count_);
    { s.store_vector_begin("topDonors", top_donors_.size()); for (const auto &_value : top_donors_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void liveStoryDonors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LiveStoryDonors").c_str());
    total_star_count_fieldID = jni::get_field_id(env, Class, "totalStarCount", "J");
    top_donors_fieldID = jni::get_field_id(env, Class, "topDonors", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaidReactor;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass localFile::Class;
jfieldID localFile::path_fieldID;
jfieldID localFile::can_be_downloaded_fieldID;
jfieldID localFile::can_be_deleted_fieldID;
jfieldID localFile::is_downloading_active_fieldID;
jfieldID localFile::is_downloading_completed_fieldID;
jfieldID localFile::download_offset_fieldID;
jfieldID localFile::downloaded_prefix_size_fieldID;
jfieldID localFile::downloaded_size_fieldID;

localFile::localFile()
  : path_()
  , can_be_downloaded_()
  , can_be_deleted_()
  , is_downloading_active_()
  , is_downloading_completed_()
  , download_offset_()
  , downloaded_prefix_size_()
  , downloaded_size_()
{}

localFile::localFile(string const &path_, bool can_be_downloaded_, bool can_be_deleted_, bool is_downloading_active_, bool is_downloading_completed_, int53 download_offset_, int53 downloaded_prefix_size_, int53 downloaded_size_)
  : path_(path_)
  , can_be_downloaded_(can_be_downloaded_)
  , can_be_deleted_(can_be_deleted_)
  , is_downloading_active_(is_downloading_active_)
  , is_downloading_completed_(is_downloading_completed_)
  , download_offset_(download_offset_)
  , downloaded_prefix_size_(downloaded_prefix_size_)
  , downloaded_size_(downloaded_size_)
{}

const std::int32_t localFile::ID;

object_ptr<localFile> localFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<localFile> res = make_object<localFile>();
  res->path_ = jni::fetch_string(env, p, res->path_fieldID);
  res->can_be_downloaded_ = (env->GetBooleanField(p, res->can_be_downloaded_fieldID) != 0);
  res->can_be_deleted_ = (env->GetBooleanField(p, res->can_be_deleted_fieldID) != 0);
  res->is_downloading_active_ = (env->GetBooleanField(p, res->is_downloading_active_fieldID) != 0);
  res->is_downloading_completed_ = (env->GetBooleanField(p, res->is_downloading_completed_fieldID) != 0);
  res->download_offset_ = env->GetLongField(p, res->download_offset_fieldID);
  res->downloaded_prefix_size_ = env->GetLongField(p, res->downloaded_prefix_size_fieldID);
  res->downloaded_size_ = env->GetLongField(p, res->downloaded_size_fieldID);
  return res;
}

void localFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, path_); if (nextString) { env->SetObjectField(s, path_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, can_be_downloaded_fieldID, can_be_downloaded_);
  env->SetBooleanField(s, can_be_deleted_fieldID, can_be_deleted_);
  env->SetBooleanField(s, is_downloading_active_fieldID, is_downloading_active_);
  env->SetBooleanField(s, is_downloading_completed_fieldID, is_downloading_completed_);
  env->SetLongField(s, download_offset_fieldID, download_offset_);
  env->SetLongField(s, downloaded_prefix_size_fieldID, downloaded_prefix_size_);
  env->SetLongField(s, downloaded_size_fieldID, downloaded_size_);
}

void localFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LocalFile");
    s.store_field("path", path_);
    s.store_field("canBeDownloaded", can_be_downloaded_);
    s.store_field("canBeDeleted", can_be_deleted_);
    s.store_field("isDownloadingActive", is_downloading_active_);
    s.store_field("isDownloadingCompleted", is_downloading_completed_);
    s.store_field("downloadOffset", download_offset_);
    s.store_field("downloadedPrefixSize", downloaded_prefix_size_);
    s.store_field("downloadedSize", downloaded_size_);
    s.store_class_end();
  }
}

void localFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LocalFile").c_str());
    path_fieldID = jni::get_field_id(env, Class, "path", "Ljava/lang/String;");
    can_be_downloaded_fieldID = jni::get_field_id(env, Class, "canBeDownloaded", "Z");
    can_be_deleted_fieldID = jni::get_field_id(env, Class, "canBeDeleted", "Z");
    is_downloading_active_fieldID = jni::get_field_id(env, Class, "isDownloadingActive", "Z");
    is_downloading_completed_fieldID = jni::get_field_id(env, Class, "isDownloadingCompleted", "Z");
    download_offset_fieldID = jni::get_field_id(env, Class, "downloadOffset", "J");
    downloaded_prefix_size_fieldID = jni::get_field_id(env, Class, "downloadedPrefixSize", "J");
    downloaded_size_fieldID = jni::get_field_id(env, Class, "downloadedSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass logVerbosityLevel::Class;
jfieldID logVerbosityLevel::verbosity_level_fieldID;

logVerbosityLevel::logVerbosityLevel()
  : verbosity_level_()
{}

logVerbosityLevel::logVerbosityLevel(int32 verbosity_level_)
  : verbosity_level_(verbosity_level_)
{}

const std::int32_t logVerbosityLevel::ID;

object_ptr<logVerbosityLevel> logVerbosityLevel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<logVerbosityLevel> res = make_object<logVerbosityLevel>();
  res->verbosity_level_ = env->GetIntField(p, res->verbosity_level_fieldID);
  return res;
}

void logVerbosityLevel::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, verbosity_level_fieldID, verbosity_level_);
}

void logVerbosityLevel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LogVerbosityLevel");
    s.store_field("verbosityLevel", verbosity_level_);
    s.store_class_end();
  }
}

void logVerbosityLevel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LogVerbosityLevel").c_str());
    verbosity_level_fieldID = jni::get_field_id(env, Class, "verbosityLevel", "I");
    return true;
  }();
  (void)is_inited;
}

jclass MaskPoint::Class;

object_ptr<MaskPoint> MaskPoint::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case maskPointForehead::ID:
      return maskPointForehead::fetch(env, p);
    case maskPointEyes::ID:
      return maskPointEyes::fetch(env, p);
    case maskPointMouth::ID:
      return maskPointMouth::fetch(env, p);
    case maskPointChin::ID:
      return maskPointChin::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void MaskPoint::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MaskPoint").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass maskPointForehead::Class;

maskPointForehead::maskPointForehead() {
}

const std::int32_t maskPointForehead::ID;

object_ptr<MaskPoint> maskPointForehead::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<maskPointForehead>();
}

void maskPointForehead::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void maskPointForehead::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MaskPointForehead");
    s.store_class_end();
  }
}

void maskPointForehead::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MaskPointForehead").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass maskPointEyes::Class;

maskPointEyes::maskPointEyes() {
}

const std::int32_t maskPointEyes::ID;

object_ptr<MaskPoint> maskPointEyes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<maskPointEyes>();
}

void maskPointEyes::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void maskPointEyes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MaskPointEyes");
    s.store_class_end();
  }
}

void maskPointEyes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MaskPointEyes").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass maskPointMouth::Class;

maskPointMouth::maskPointMouth() {
}

const std::int32_t maskPointMouth::ID;

object_ptr<MaskPoint> maskPointMouth::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<maskPointMouth>();
}

void maskPointMouth::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void maskPointMouth::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MaskPointMouth");
    s.store_class_end();
  }
}

void maskPointMouth::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MaskPointMouth").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass maskPointChin::Class;

maskPointChin::maskPointChin() {
}

const std::int32_t maskPointChin::ID;

object_ptr<MaskPoint> maskPointChin::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<maskPointChin>();
}

void maskPointChin::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void maskPointChin::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MaskPointChin");
    s.store_class_end();
  }
}

void maskPointChin::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MaskPointChin").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageLink::Class;
jfieldID messageLink::link_fieldID;
jfieldID messageLink::is_public_fieldID;

messageLink::messageLink()
  : link_()
  , is_public_()
{}

messageLink::messageLink(string const &link_, bool is_public_)
  : link_(link_)
  , is_public_(is_public_)
{}

const std::int32_t messageLink::ID;

object_ptr<messageLink> messageLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageLink> res = make_object<messageLink>();
  res->link_ = jni::fetch_string(env, p, res->link_fieldID);
  res->is_public_ = (env->GetBooleanField(p, res->is_public_fieldID) != 0);
  return res;
}

void messageLink::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, link_); if (nextString) { env->SetObjectField(s, link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_public_fieldID, is_public_);
}

void messageLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageLink");
    s.store_field("link", link_);
    s.store_field("isPublic", is_public_);
    s.store_class_end();
  }
}

void messageLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageLink").c_str());
    link_fieldID = jni::get_field_id(env, Class, "link", "Ljava/lang/String;");
    is_public_fieldID = jni::get_field_id(env, Class, "isPublic", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageProperties::Class;
jfieldID messageProperties::can_add_offer_fieldID;
jfieldID messageProperties::can_add_tasks_fieldID;
jfieldID messageProperties::can_be_approved_fieldID;
jfieldID messageProperties::can_be_copied_fieldID;
jfieldID messageProperties::can_be_copied_to_secret_chat_fieldID;
jfieldID messageProperties::can_be_declined_fieldID;
jfieldID messageProperties::can_be_deleted_only_for_self_fieldID;
jfieldID messageProperties::can_be_deleted_for_all_users_fieldID;
jfieldID messageProperties::can_be_edited_fieldID;
jfieldID messageProperties::can_be_forwarded_fieldID;
jfieldID messageProperties::can_be_paid_fieldID;
jfieldID messageProperties::can_be_pinned_fieldID;
jfieldID messageProperties::can_be_replied_fieldID;
jfieldID messageProperties::can_be_replied_in_another_chat_fieldID;
jfieldID messageProperties::can_be_saved_fieldID;
jfieldID messageProperties::can_be_shared_in_story_fieldID;
jfieldID messageProperties::can_delete_reactions_fieldID;
jfieldID messageProperties::can_edit_media_fieldID;
jfieldID messageProperties::can_edit_scheduling_state_fieldID;
jfieldID messageProperties::can_edit_suggested_post_info_fieldID;
jfieldID messageProperties::can_get_author_fieldID;
jfieldID messageProperties::can_get_embedding_code_fieldID;
jfieldID messageProperties::can_get_link_fieldID;
jfieldID messageProperties::can_get_media_timestamp_links_fieldID;
jfieldID messageProperties::can_get_message_thread_fieldID;
jfieldID messageProperties::can_get_poll_vote_statistics_fieldID;
jfieldID messageProperties::can_get_read_date_fieldID;
jfieldID messageProperties::can_get_statistics_fieldID;
jfieldID messageProperties::can_get_video_advertisements_fieldID;
jfieldID messageProperties::can_get_viewers_fieldID;
jfieldID messageProperties::can_mark_tasks_as_done_fieldID;
jfieldID messageProperties::can_recognize_speech_fieldID;
jfieldID messageProperties::can_report_chat_fieldID;
jfieldID messageProperties::can_report_reactions_fieldID;
jfieldID messageProperties::can_report_supergroup_spam_fieldID;
jfieldID messageProperties::can_set_fact_check_fieldID;
jfieldID messageProperties::has_protected_content_by_current_user_fieldID;
jfieldID messageProperties::has_protected_content_by_other_user_fieldID;
jfieldID messageProperties::need_show_statistics_fieldID;

messageProperties::messageProperties()
  : can_add_offer_()
  , can_add_tasks_()
  , can_be_approved_()
  , can_be_copied_()
  , can_be_copied_to_secret_chat_()
  , can_be_declined_()
  , can_be_deleted_only_for_self_()
  , can_be_deleted_for_all_users_()
  , can_be_edited_()
  , can_be_forwarded_()
  , can_be_paid_()
  , can_be_pinned_()
  , can_be_replied_()
  , can_be_replied_in_another_chat_()
  , can_be_saved_()
  , can_be_shared_in_story_()
  , can_delete_reactions_()
  , can_edit_media_()
  , can_edit_scheduling_state_()
  , can_edit_suggested_post_info_()
  , can_get_author_()
  , can_get_embedding_code_()
  , can_get_link_()
  , can_get_media_timestamp_links_()
  , can_get_message_thread_()
  , can_get_poll_vote_statistics_()
  , can_get_read_date_()
  , can_get_statistics_()
  , can_get_video_advertisements_()
  , can_get_viewers_()
  , can_mark_tasks_as_done_()
  , can_recognize_speech_()
  , can_report_chat_()
  , can_report_reactions_()
  , can_report_supergroup_spam_()
  , can_set_fact_check_()
  , has_protected_content_by_current_user_()
  , has_protected_content_by_other_user_()
  , need_show_statistics_()
{}

messageProperties::messageProperties(bool can_add_offer_, bool can_add_tasks_, bool can_be_approved_, bool can_be_copied_, bool can_be_copied_to_secret_chat_, bool can_be_declined_, bool can_be_deleted_only_for_self_, bool can_be_deleted_for_all_users_, bool can_be_edited_, bool can_be_forwarded_, bool can_be_paid_, bool can_be_pinned_, bool can_be_replied_, bool can_be_replied_in_another_chat_, bool can_be_saved_, bool can_be_shared_in_story_, bool can_delete_reactions_, bool can_edit_media_, bool can_edit_scheduling_state_, bool can_edit_suggested_post_info_, bool can_get_author_, bool can_get_embedding_code_, bool can_get_link_, bool can_get_media_timestamp_links_, bool can_get_message_thread_, bool can_get_poll_vote_statistics_, bool can_get_read_date_, bool can_get_statistics_, bool can_get_video_advertisements_, bool can_get_viewers_, bool can_mark_tasks_as_done_, bool can_recognize_speech_, bool can_report_chat_, bool can_report_reactions_, bool can_report_supergroup_spam_, bool can_set_fact_check_, bool has_protected_content_by_current_user_, bool has_protected_content_by_other_user_, bool need_show_statistics_)
  : can_add_offer_(can_add_offer_)
  , can_add_tasks_(can_add_tasks_)
  , can_be_approved_(can_be_approved_)
  , can_be_copied_(can_be_copied_)
  , can_be_copied_to_secret_chat_(can_be_copied_to_secret_chat_)
  , can_be_declined_(can_be_declined_)
  , can_be_deleted_only_for_self_(can_be_deleted_only_for_self_)
  , can_be_deleted_for_all_users_(can_be_deleted_for_all_users_)
  , can_be_edited_(can_be_edited_)
  , can_be_forwarded_(can_be_forwarded_)
  , can_be_paid_(can_be_paid_)
  , can_be_pinned_(can_be_pinned_)
  , can_be_replied_(can_be_replied_)
  , can_be_replied_in_another_chat_(can_be_replied_in_another_chat_)
  , can_be_saved_(can_be_saved_)
  , can_be_shared_in_story_(can_be_shared_in_story_)
  , can_delete_reactions_(can_delete_reactions_)
  , can_edit_media_(can_edit_media_)
  , can_edit_scheduling_state_(can_edit_scheduling_state_)
  , can_edit_suggested_post_info_(can_edit_suggested_post_info_)
  , can_get_author_(can_get_author_)
  , can_get_embedding_code_(can_get_embedding_code_)
  , can_get_link_(can_get_link_)
  , can_get_media_timestamp_links_(can_get_media_timestamp_links_)
  , can_get_message_thread_(can_get_message_thread_)
  , can_get_poll_vote_statistics_(can_get_poll_vote_statistics_)
  , can_get_read_date_(can_get_read_date_)
  , can_get_statistics_(can_get_statistics_)
  , can_get_video_advertisements_(can_get_video_advertisements_)
  , can_get_viewers_(can_get_viewers_)
  , can_mark_tasks_as_done_(can_mark_tasks_as_done_)
  , can_recognize_speech_(can_recognize_speech_)
  , can_report_chat_(can_report_chat_)
  , can_report_reactions_(can_report_reactions_)
  , can_report_supergroup_spam_(can_report_supergroup_spam_)
  , can_set_fact_check_(can_set_fact_check_)
  , has_protected_content_by_current_user_(has_protected_content_by_current_user_)
  , has_protected_content_by_other_user_(has_protected_content_by_other_user_)
  , need_show_statistics_(need_show_statistics_)
{}

const std::int32_t messageProperties::ID;

object_ptr<messageProperties> messageProperties::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageProperties> res = make_object<messageProperties>();
  res->can_add_offer_ = (env->GetBooleanField(p, res->can_add_offer_fieldID) != 0);
  res->can_add_tasks_ = (env->GetBooleanField(p, res->can_add_tasks_fieldID) != 0);
  res->can_be_approved_ = (env->GetBooleanField(p, res->can_be_approved_fieldID) != 0);
  res->can_be_copied_ = (env->GetBooleanField(p, res->can_be_copied_fieldID) != 0);
  res->can_be_copied_to_secret_chat_ = (env->GetBooleanField(p, res->can_be_copied_to_secret_chat_fieldID) != 0);
  res->can_be_declined_ = (env->GetBooleanField(p, res->can_be_declined_fieldID) != 0);
  res->can_be_deleted_only_for_self_ = (env->GetBooleanField(p, res->can_be_deleted_only_for_self_fieldID) != 0);
  res->can_be_deleted_for_all_users_ = (env->GetBooleanField(p, res->can_be_deleted_for_all_users_fieldID) != 0);
  res->can_be_edited_ = (env->GetBooleanField(p, res->can_be_edited_fieldID) != 0);
  res->can_be_forwarded_ = (env->GetBooleanField(p, res->can_be_forwarded_fieldID) != 0);
  res->can_be_paid_ = (env->GetBooleanField(p, res->can_be_paid_fieldID) != 0);
  res->can_be_pinned_ = (env->GetBooleanField(p, res->can_be_pinned_fieldID) != 0);
  res->can_be_replied_ = (env->GetBooleanField(p, res->can_be_replied_fieldID) != 0);
  res->can_be_replied_in_another_chat_ = (env->GetBooleanField(p, res->can_be_replied_in_another_chat_fieldID) != 0);
  res->can_be_saved_ = (env->GetBooleanField(p, res->can_be_saved_fieldID) != 0);
  res->can_be_shared_in_story_ = (env->GetBooleanField(p, res->can_be_shared_in_story_fieldID) != 0);
  res->can_delete_reactions_ = (env->GetBooleanField(p, res->can_delete_reactions_fieldID) != 0);
  res->can_edit_media_ = (env->GetBooleanField(p, res->can_edit_media_fieldID) != 0);
  res->can_edit_scheduling_state_ = (env->GetBooleanField(p, res->can_edit_scheduling_state_fieldID) != 0);
  res->can_edit_suggested_post_info_ = (env->GetBooleanField(p, res->can_edit_suggested_post_info_fieldID) != 0);
  res->can_get_author_ = (env->GetBooleanField(p, res->can_get_author_fieldID) != 0);
  res->can_get_embedding_code_ = (env->GetBooleanField(p, res->can_get_embedding_code_fieldID) != 0);
  res->can_get_link_ = (env->GetBooleanField(p, res->can_get_link_fieldID) != 0);
  res->can_get_media_timestamp_links_ = (env->GetBooleanField(p, res->can_get_media_timestamp_links_fieldID) != 0);
  res->can_get_message_thread_ = (env->GetBooleanField(p, res->can_get_message_thread_fieldID) != 0);
  res->can_get_poll_vote_statistics_ = (env->GetBooleanField(p, res->can_get_poll_vote_statistics_fieldID) != 0);
  res->can_get_read_date_ = (env->GetBooleanField(p, res->can_get_read_date_fieldID) != 0);
  res->can_get_statistics_ = (env->GetBooleanField(p, res->can_get_statistics_fieldID) != 0);
  res->can_get_video_advertisements_ = (env->GetBooleanField(p, res->can_get_video_advertisements_fieldID) != 0);
  res->can_get_viewers_ = (env->GetBooleanField(p, res->can_get_viewers_fieldID) != 0);
  res->can_mark_tasks_as_done_ = (env->GetBooleanField(p, res->can_mark_tasks_as_done_fieldID) != 0);
  res->can_recognize_speech_ = (env->GetBooleanField(p, res->can_recognize_speech_fieldID) != 0);
  res->can_report_chat_ = (env->GetBooleanField(p, res->can_report_chat_fieldID) != 0);
  res->can_report_reactions_ = (env->GetBooleanField(p, res->can_report_reactions_fieldID) != 0);
  res->can_report_supergroup_spam_ = (env->GetBooleanField(p, res->can_report_supergroup_spam_fieldID) != 0);
  res->can_set_fact_check_ = (env->GetBooleanField(p, res->can_set_fact_check_fieldID) != 0);
  res->has_protected_content_by_current_user_ = (env->GetBooleanField(p, res->has_protected_content_by_current_user_fieldID) != 0);
  res->has_protected_content_by_other_user_ = (env->GetBooleanField(p, res->has_protected_content_by_other_user_fieldID) != 0);
  res->need_show_statistics_ = (env->GetBooleanField(p, res->need_show_statistics_fieldID) != 0);
  return res;
}

void messageProperties::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_add_offer_fieldID, can_add_offer_);
  env->SetBooleanField(s, can_add_tasks_fieldID, can_add_tasks_);
  env->SetBooleanField(s, can_be_approved_fieldID, can_be_approved_);
  env->SetBooleanField(s, can_be_copied_fieldID, can_be_copied_);
  env->SetBooleanField(s, can_be_copied_to_secret_chat_fieldID, can_be_copied_to_secret_chat_);
  env->SetBooleanField(s, can_be_declined_fieldID, can_be_declined_);
  env->SetBooleanField(s, can_be_deleted_only_for_self_fieldID, can_be_deleted_only_for_self_);
  env->SetBooleanField(s, can_be_deleted_for_all_users_fieldID, can_be_deleted_for_all_users_);
  env->SetBooleanField(s, can_be_edited_fieldID, can_be_edited_);
  env->SetBooleanField(s, can_be_forwarded_fieldID, can_be_forwarded_);
  env->SetBooleanField(s, can_be_paid_fieldID, can_be_paid_);
  env->SetBooleanField(s, can_be_pinned_fieldID, can_be_pinned_);
  env->SetBooleanField(s, can_be_replied_fieldID, can_be_replied_);
  env->SetBooleanField(s, can_be_replied_in_another_chat_fieldID, can_be_replied_in_another_chat_);
  env->SetBooleanField(s, can_be_saved_fieldID, can_be_saved_);
  env->SetBooleanField(s, can_be_shared_in_story_fieldID, can_be_shared_in_story_);
  env->SetBooleanField(s, can_delete_reactions_fieldID, can_delete_reactions_);
  env->SetBooleanField(s, can_edit_media_fieldID, can_edit_media_);
  env->SetBooleanField(s, can_edit_scheduling_state_fieldID, can_edit_scheduling_state_);
  env->SetBooleanField(s, can_edit_suggested_post_info_fieldID, can_edit_suggested_post_info_);
  env->SetBooleanField(s, can_get_author_fieldID, can_get_author_);
  env->SetBooleanField(s, can_get_embedding_code_fieldID, can_get_embedding_code_);
  env->SetBooleanField(s, can_get_link_fieldID, can_get_link_);
  env->SetBooleanField(s, can_get_media_timestamp_links_fieldID, can_get_media_timestamp_links_);
  env->SetBooleanField(s, can_get_message_thread_fieldID, can_get_message_thread_);
  env->SetBooleanField(s, can_get_poll_vote_statistics_fieldID, can_get_poll_vote_statistics_);
  env->SetBooleanField(s, can_get_read_date_fieldID, can_get_read_date_);
  env->SetBooleanField(s, can_get_statistics_fieldID, can_get_statistics_);
  env->SetBooleanField(s, can_get_video_advertisements_fieldID, can_get_video_advertisements_);
  env->SetBooleanField(s, can_get_viewers_fieldID, can_get_viewers_);
  env->SetBooleanField(s, can_mark_tasks_as_done_fieldID, can_mark_tasks_as_done_);
  env->SetBooleanField(s, can_recognize_speech_fieldID, can_recognize_speech_);
  env->SetBooleanField(s, can_report_chat_fieldID, can_report_chat_);
  env->SetBooleanField(s, can_report_reactions_fieldID, can_report_reactions_);
  env->SetBooleanField(s, can_report_supergroup_spam_fieldID, can_report_supergroup_spam_);
  env->SetBooleanField(s, can_set_fact_check_fieldID, can_set_fact_check_);
  env->SetBooleanField(s, has_protected_content_by_current_user_fieldID, has_protected_content_by_current_user_);
  env->SetBooleanField(s, has_protected_content_by_other_user_fieldID, has_protected_content_by_other_user_);
  env->SetBooleanField(s, need_show_statistics_fieldID, need_show_statistics_);
}

void messageProperties::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageProperties");
    s.store_field("canAddOffer", can_add_offer_);
    s.store_field("canAddTasks", can_add_tasks_);
    s.store_field("canBeApproved", can_be_approved_);
    s.store_field("canBeCopied", can_be_copied_);
    s.store_field("canBeCopiedToSecretChat", can_be_copied_to_secret_chat_);
    s.store_field("canBeDeclined", can_be_declined_);
    s.store_field("canBeDeletedOnlyForSelf", can_be_deleted_only_for_self_);
    s.store_field("canBeDeletedForAllUsers", can_be_deleted_for_all_users_);
    s.store_field("canBeEdited", can_be_edited_);
    s.store_field("canBeForwarded", can_be_forwarded_);
    s.store_field("canBePaid", can_be_paid_);
    s.store_field("canBePinned", can_be_pinned_);
    s.store_field("canBeReplied", can_be_replied_);
    s.store_field("canBeRepliedInAnotherChat", can_be_replied_in_another_chat_);
    s.store_field("canBeSaved", can_be_saved_);
    s.store_field("canBeSharedInStory", can_be_shared_in_story_);
    s.store_field("canDeleteReactions", can_delete_reactions_);
    s.store_field("canEditMedia", can_edit_media_);
    s.store_field("canEditSchedulingState", can_edit_scheduling_state_);
    s.store_field("canEditSuggestedPostInfo", can_edit_suggested_post_info_);
    s.store_field("canGetAuthor", can_get_author_);
    s.store_field("canGetEmbeddingCode", can_get_embedding_code_);
    s.store_field("canGetLink", can_get_link_);
    s.store_field("canGetMediaTimestampLinks", can_get_media_timestamp_links_);
    s.store_field("canGetMessageThread", can_get_message_thread_);
    s.store_field("canGetPollVoteStatistics", can_get_poll_vote_statistics_);
    s.store_field("canGetReadDate", can_get_read_date_);
    s.store_field("canGetStatistics", can_get_statistics_);
    s.store_field("canGetVideoAdvertisements", can_get_video_advertisements_);
    s.store_field("canGetViewers", can_get_viewers_);
    s.store_field("canMarkTasksAsDone", can_mark_tasks_as_done_);
    s.store_field("canRecognizeSpeech", can_recognize_speech_);
    s.store_field("canReportChat", can_report_chat_);
    s.store_field("canReportReactions", can_report_reactions_);
    s.store_field("canReportSupergroupSpam", can_report_supergroup_spam_);
    s.store_field("canSetFactCheck", can_set_fact_check_);
    s.store_field("hasProtectedContentByCurrentUser", has_protected_content_by_current_user_);
    s.store_field("hasProtectedContentByOtherUser", has_protected_content_by_other_user_);
    s.store_field("needShowStatistics", need_show_statistics_);
    s.store_class_end();
  }
}

void messageProperties::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageProperties").c_str());
    can_add_offer_fieldID = jni::get_field_id(env, Class, "canAddOffer", "Z");
    can_add_tasks_fieldID = jni::get_field_id(env, Class, "canAddTasks", "Z");
    can_be_approved_fieldID = jni::get_field_id(env, Class, "canBeApproved", "Z");
    can_be_copied_fieldID = jni::get_field_id(env, Class, "canBeCopied", "Z");
    can_be_copied_to_secret_chat_fieldID = jni::get_field_id(env, Class, "canBeCopiedToSecretChat", "Z");
    can_be_declined_fieldID = jni::get_field_id(env, Class, "canBeDeclined", "Z");
    can_be_deleted_only_for_self_fieldID = jni::get_field_id(env, Class, "canBeDeletedOnlyForSelf", "Z");
    can_be_deleted_for_all_users_fieldID = jni::get_field_id(env, Class, "canBeDeletedForAllUsers", "Z");
    can_be_edited_fieldID = jni::get_field_id(env, Class, "canBeEdited", "Z");
    can_be_forwarded_fieldID = jni::get_field_id(env, Class, "canBeForwarded", "Z");
    can_be_paid_fieldID = jni::get_field_id(env, Class, "canBePaid", "Z");
    can_be_pinned_fieldID = jni::get_field_id(env, Class, "canBePinned", "Z");
    can_be_replied_fieldID = jni::get_field_id(env, Class, "canBeReplied", "Z");
    can_be_replied_in_another_chat_fieldID = jni::get_field_id(env, Class, "canBeRepliedInAnotherChat", "Z");
    can_be_saved_fieldID = jni::get_field_id(env, Class, "canBeSaved", "Z");
    can_be_shared_in_story_fieldID = jni::get_field_id(env, Class, "canBeSharedInStory", "Z");
    can_delete_reactions_fieldID = jni::get_field_id(env, Class, "canDeleteReactions", "Z");
    can_edit_media_fieldID = jni::get_field_id(env, Class, "canEditMedia", "Z");
    can_edit_scheduling_state_fieldID = jni::get_field_id(env, Class, "canEditSchedulingState", "Z");
    can_edit_suggested_post_info_fieldID = jni::get_field_id(env, Class, "canEditSuggestedPostInfo", "Z");
    can_get_author_fieldID = jni::get_field_id(env, Class, "canGetAuthor", "Z");
    can_get_embedding_code_fieldID = jni::get_field_id(env, Class, "canGetEmbeddingCode", "Z");
    can_get_link_fieldID = jni::get_field_id(env, Class, "canGetLink", "Z");
    can_get_media_timestamp_links_fieldID = jni::get_field_id(env, Class, "canGetMediaTimestampLinks", "Z");
    can_get_message_thread_fieldID = jni::get_field_id(env, Class, "canGetMessageThread", "Z");
    can_get_poll_vote_statistics_fieldID = jni::get_field_id(env, Class, "canGetPollVoteStatistics", "Z");
    can_get_read_date_fieldID = jni::get_field_id(env, Class, "canGetReadDate", "Z");
    can_get_statistics_fieldID = jni::get_field_id(env, Class, "canGetStatistics", "Z");
    can_get_video_advertisements_fieldID = jni::get_field_id(env, Class, "canGetVideoAdvertisements", "Z");
    can_get_viewers_fieldID = jni::get_field_id(env, Class, "canGetViewers", "Z");
    can_mark_tasks_as_done_fieldID = jni::get_field_id(env, Class, "canMarkTasksAsDone", "Z");
    can_recognize_speech_fieldID = jni::get_field_id(env, Class, "canRecognizeSpeech", "Z");
    can_report_chat_fieldID = jni::get_field_id(env, Class, "canReportChat", "Z");
    can_report_reactions_fieldID = jni::get_field_id(env, Class, "canReportReactions", "Z");
    can_report_supergroup_spam_fieldID = jni::get_field_id(env, Class, "canReportSupergroupSpam", "Z");
    can_set_fact_check_fieldID = jni::get_field_id(env, Class, "canSetFactCheck", "Z");
    has_protected_content_by_current_user_fieldID = jni::get_field_id(env, Class, "hasProtectedContentByCurrentUser", "Z");
    has_protected_content_by_other_user_fieldID = jni::get_field_id(env, Class, "hasProtectedContentByOtherUser", "Z");
    need_show_statistics_fieldID = jni::get_field_id(env, Class, "needShowStatistics", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageReplyInfo::Class;
jfieldID messageReplyInfo::reply_count_fieldID;
jfieldID messageReplyInfo::recent_replier_ids_fieldID;
jfieldID messageReplyInfo::last_read_inbox_message_id_fieldID;
jfieldID messageReplyInfo::last_read_outbox_message_id_fieldID;
jfieldID messageReplyInfo::last_message_id_fieldID;

messageReplyInfo::messageReplyInfo()
  : reply_count_()
  , recent_replier_ids_()
  , last_read_inbox_message_id_()
  , last_read_outbox_message_id_()
  , last_message_id_()
{}

messageReplyInfo::messageReplyInfo(int32 reply_count_, array<object_ptr<MessageSender>> &&recent_replier_ids_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int53 last_message_id_)
  : reply_count_(reply_count_)
  , recent_replier_ids_(std::move(recent_replier_ids_))
  , last_read_inbox_message_id_(last_read_inbox_message_id_)
  , last_read_outbox_message_id_(last_read_outbox_message_id_)
  , last_message_id_(last_message_id_)
{}

const std::int32_t messageReplyInfo::ID;

object_ptr<messageReplyInfo> messageReplyInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageReplyInfo> res = make_object<messageReplyInfo>();
  res->reply_count_ = env->GetIntField(p, res->reply_count_fieldID);
  res->recent_replier_ids_ = jni::FetchVector<MessageSender>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->recent_replier_ids_fieldID));
  res->last_read_inbox_message_id_ = env->GetLongField(p, res->last_read_inbox_message_id_fieldID);
  res->last_read_outbox_message_id_ = env->GetLongField(p, res->last_read_outbox_message_id_fieldID);
  res->last_message_id_ = env->GetLongField(p, res->last_message_id_fieldID);
  return res;
}

void messageReplyInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, reply_count_fieldID, reply_count_);
  { auto arr_tmp_ = jni::store_vector(env, recent_replier_ids_); if (arr_tmp_) { env->SetObjectField(s, recent_replier_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetLongField(s, last_read_inbox_message_id_fieldID, last_read_inbox_message_id_);
  env->SetLongField(s, last_read_outbox_message_id_fieldID, last_read_outbox_message_id_);
  env->SetLongField(s, last_message_id_fieldID, last_message_id_);
}

void messageReplyInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageReplyInfo");
    s.store_field("replyCount", reply_count_);
    { s.store_vector_begin("recentReplierIds", recent_replier_ids_.size()); for (const auto &_value : recent_replier_ids_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("lastReadInboxMessageId", last_read_inbox_message_id_);
    s.store_field("lastReadOutboxMessageId", last_read_outbox_message_id_);
    s.store_field("lastMessageId", last_message_id_);
    s.store_class_end();
  }
}

void messageReplyInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageReplyInfo").c_str());
    reply_count_fieldID = jni::get_field_id(env, Class, "replyCount", "I");
    recent_replier_ids_fieldID = jni::get_field_id(env, Class, "recentReplierIds", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    last_read_inbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadInboxMessageId", "J");
    last_read_outbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadOutboxMessageId", "J");
    last_message_id_fieldID = jni::get_field_id(env, Class, "lastMessageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass messageSenders::Class;
jfieldID messageSenders::total_count_fieldID;
jfieldID messageSenders::senders_fieldID;

messageSenders::messageSenders()
  : total_count_()
  , senders_()
{}

messageSenders::messageSenders(int32 total_count_, array<object_ptr<MessageSender>> &&senders_)
  : total_count_(total_count_)
  , senders_(std::move(senders_))
{}

const std::int32_t messageSenders::ID;

object_ptr<messageSenders> messageSenders::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSenders> res = make_object<messageSenders>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->senders_ = jni::FetchVector<MessageSender>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->senders_fieldID));
  return res;
}

void messageSenders::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, senders_); if (arr_tmp_) { env->SetObjectField(s, senders_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageSenders::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSenders");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("senders", senders_.size()); for (const auto &_value : senders_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void messageSenders::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSenders").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    senders_fieldID = jni::get_field_id(env, Class, "senders", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageThreadInfo::Class;
jfieldID messageThreadInfo::chat_id_fieldID;
jfieldID messageThreadInfo::message_thread_id_fieldID;
jfieldID messageThreadInfo::reply_info_fieldID;
jfieldID messageThreadInfo::unread_message_count_fieldID;
jfieldID messageThreadInfo::messages_fieldID;
jfieldID messageThreadInfo::draft_message_fieldID;

messageThreadInfo::messageThreadInfo()
  : chat_id_()
  , message_thread_id_()
  , reply_info_()
  , unread_message_count_()
  , messages_()
  , draft_message_()
{}

messageThreadInfo::messageThreadInfo(int53 chat_id_, int53 message_thread_id_, object_ptr<messageReplyInfo> &&reply_info_, int32 unread_message_count_, array<object_ptr<message>> &&messages_, object_ptr<draftMessage> &&draft_message_)
  : chat_id_(chat_id_)
  , message_thread_id_(message_thread_id_)
  , reply_info_(std::move(reply_info_))
  , unread_message_count_(unread_message_count_)
  , messages_(std::move(messages_))
  , draft_message_(std::move(draft_message_))
{}

const std::int32_t messageThreadInfo::ID;

object_ptr<messageThreadInfo> messageThreadInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageThreadInfo> res = make_object<messageThreadInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_thread_id_ = env->GetLongField(p, res->message_thread_id_fieldID);
  res->reply_info_ = jni::fetch_tl_object<messageReplyInfo>(env, jni::fetch_object(env, p, res->reply_info_fieldID));
  res->unread_message_count_ = env->GetIntField(p, res->unread_message_count_fieldID);
  res->messages_ = jni::FetchVector<message>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->messages_fieldID));
  res->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  return res;
}

void messageThreadInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_thread_id_fieldID, message_thread_id_);
  if (reply_info_ != nullptr) { jobject next; reply_info_->store(env, next); if (next) { env->SetObjectField(s, reply_info_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, unread_message_count_fieldID, unread_message_count_);
  { auto arr_tmp_ = jni::store_vector(env, messages_); if (arr_tmp_) { env->SetObjectField(s, messages_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (draft_message_ != nullptr) { jobject next; draft_message_->store(env, next); if (next) { env->SetObjectField(s, draft_message_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageThreadInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageThreadInfo");
    s.store_field("chatId", chat_id_);
    s.store_field("messageThreadId", message_thread_id_);
    s.store_object_field("replyInfo", static_cast<const BaseObject *>(reply_info_.get()));
    s.store_field("unreadMessageCount", unread_message_count_);
    { s.store_vector_begin("messages", messages_.size()); for (const auto &_value : messages_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_class_end();
  }
}

void messageThreadInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageThreadInfo").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_thread_id_fieldID = jni::get_field_id(env, Class, "messageThreadId", "J");
    reply_info_fieldID = jni::get_field_id(env, Class, "replyInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageReplyInfo;").c_str());
    unread_message_count_fieldID = jni::get_field_id(env, Class, "unreadMessageCount", "I");
    messages_fieldID = jni::get_field_id(env, Class, "messages", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    draft_message_fieldID = jni::get_field_id(env, Class, "draftMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DraftMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass ok::Class;

ok::ok() {
}

const std::int32_t ok::ID;

object_ptr<ok> ok::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<ok>();
}

void ok::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void ok::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Ok");
    s.store_class_end();
  }
}

void ok::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Ok").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PassportElementErrorSource::Class;

object_ptr<PassportElementErrorSource> PassportElementErrorSource::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case passportElementErrorSourceUnspecified::ID:
      return passportElementErrorSourceUnspecified::fetch(env, p);
    case passportElementErrorSourceDataField::ID:
      return passportElementErrorSourceDataField::fetch(env, p);
    case passportElementErrorSourceFrontSide::ID:
      return passportElementErrorSourceFrontSide::fetch(env, p);
    case passportElementErrorSourceReverseSide::ID:
      return passportElementErrorSourceReverseSide::fetch(env, p);
    case passportElementErrorSourceSelfie::ID:
      return passportElementErrorSourceSelfie::fetch(env, p);
    case passportElementErrorSourceTranslationFile::ID:
      return passportElementErrorSourceTranslationFile::fetch(env, p);
    case passportElementErrorSourceTranslationFiles::ID:
      return passportElementErrorSourceTranslationFiles::fetch(env, p);
    case passportElementErrorSourceFile::ID:
      return passportElementErrorSourceFile::fetch(env, p);
    case passportElementErrorSourceFiles::ID:
      return passportElementErrorSourceFiles::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void PassportElementErrorSource::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSource").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceUnspecified::Class;

passportElementErrorSourceUnspecified::passportElementErrorSourceUnspecified() {
}

const std::int32_t passportElementErrorSourceUnspecified::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceUnspecified::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<passportElementErrorSourceUnspecified>();
}

void passportElementErrorSourceUnspecified::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void passportElementErrorSourceUnspecified::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceUnspecified");
    s.store_class_end();
  }
}

void passportElementErrorSourceUnspecified::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceUnspecified").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceDataField::Class;
jfieldID passportElementErrorSourceDataField::field_name_fieldID;

passportElementErrorSourceDataField::passportElementErrorSourceDataField()
  : field_name_()
{}

passportElementErrorSourceDataField::passportElementErrorSourceDataField(string const &field_name_)
  : field_name_(field_name_)
{}

const std::int32_t passportElementErrorSourceDataField::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceDataField::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passportElementErrorSourceDataField> res = make_object<passportElementErrorSourceDataField>();
  res->field_name_ = jni::fetch_string(env, p, res->field_name_fieldID);
  return std::move(res);
}

void passportElementErrorSourceDataField::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, field_name_); if (nextString) { env->SetObjectField(s, field_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void passportElementErrorSourceDataField::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceDataField");
    s.store_field("fieldName", field_name_);
    s.store_class_end();
  }
}

void passportElementErrorSourceDataField::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceDataField").c_str());
    field_name_fieldID = jni::get_field_id(env, Class, "fieldName", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceFrontSide::Class;

passportElementErrorSourceFrontSide::passportElementErrorSourceFrontSide() {
}

const std::int32_t passportElementErrorSourceFrontSide::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceFrontSide::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<passportElementErrorSourceFrontSide>();
}

void passportElementErrorSourceFrontSide::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void passportElementErrorSourceFrontSide::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceFrontSide");
    s.store_class_end();
  }
}

void passportElementErrorSourceFrontSide::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceFrontSide").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceReverseSide::Class;

passportElementErrorSourceReverseSide::passportElementErrorSourceReverseSide() {
}

const std::int32_t passportElementErrorSourceReverseSide::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceReverseSide::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<passportElementErrorSourceReverseSide>();
}

void passportElementErrorSourceReverseSide::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void passportElementErrorSourceReverseSide::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceReverseSide");
    s.store_class_end();
  }
}

void passportElementErrorSourceReverseSide::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceReverseSide").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceSelfie::Class;

passportElementErrorSourceSelfie::passportElementErrorSourceSelfie() {
}

const std::int32_t passportElementErrorSourceSelfie::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceSelfie::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<passportElementErrorSourceSelfie>();
}

void passportElementErrorSourceSelfie::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void passportElementErrorSourceSelfie::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceSelfie");
    s.store_class_end();
  }
}

void passportElementErrorSourceSelfie::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceSelfie").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceTranslationFile::Class;
jfieldID passportElementErrorSourceTranslationFile::file_index_fieldID;

passportElementErrorSourceTranslationFile::passportElementErrorSourceTranslationFile()
  : file_index_()
{}

passportElementErrorSourceTranslationFile::passportElementErrorSourceTranslationFile(int32 file_index_)
  : file_index_(file_index_)
{}

const std::int32_t passportElementErrorSourceTranslationFile::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceTranslationFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passportElementErrorSourceTranslationFile> res = make_object<passportElementErrorSourceTranslationFile>();
  res->file_index_ = env->GetIntField(p, res->file_index_fieldID);
  return std::move(res);
}

void passportElementErrorSourceTranslationFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, file_index_fieldID, file_index_);
}

void passportElementErrorSourceTranslationFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceTranslationFile");
    s.store_field("fileIndex", file_index_);
    s.store_class_end();
  }
}

void passportElementErrorSourceTranslationFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceTranslationFile").c_str());
    file_index_fieldID = jni::get_field_id(env, Class, "fileIndex", "I");
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceTranslationFiles::Class;

passportElementErrorSourceTranslationFiles::passportElementErrorSourceTranslationFiles() {
}

const std::int32_t passportElementErrorSourceTranslationFiles::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceTranslationFiles::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<passportElementErrorSourceTranslationFiles>();
}

void passportElementErrorSourceTranslationFiles::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void passportElementErrorSourceTranslationFiles::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceTranslationFiles");
    s.store_class_end();
  }
}

void passportElementErrorSourceTranslationFiles::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceTranslationFiles").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceFile::Class;
jfieldID passportElementErrorSourceFile::file_index_fieldID;

passportElementErrorSourceFile::passportElementErrorSourceFile()
  : file_index_()
{}

passportElementErrorSourceFile::passportElementErrorSourceFile(int32 file_index_)
  : file_index_(file_index_)
{}

const std::int32_t passportElementErrorSourceFile::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passportElementErrorSourceFile> res = make_object<passportElementErrorSourceFile>();
  res->file_index_ = env->GetIntField(p, res->file_index_fieldID);
  return std::move(res);
}

void passportElementErrorSourceFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, file_index_fieldID, file_index_);
}

void passportElementErrorSourceFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceFile");
    s.store_field("fileIndex", file_index_);
    s.store_class_end();
  }
}

void passportElementErrorSourceFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceFile").c_str());
    file_index_fieldID = jni::get_field_id(env, Class, "fileIndex", "I");
    return true;
  }();
  (void)is_inited;
}

jclass passportElementErrorSourceFiles::Class;

passportElementErrorSourceFiles::passportElementErrorSourceFiles() {
}

const std::int32_t passportElementErrorSourceFiles::ID;

object_ptr<PassportElementErrorSource> passportElementErrorSourceFiles::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<passportElementErrorSourceFiles>();
}

void passportElementErrorSourceFiles::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void passportElementErrorSourceFiles::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementErrorSourceFiles");
    s.store_class_end();
  }
}

void passportElementErrorSourceFiles::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementErrorSourceFiles").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PaymentFormType::Class;

object_ptr<PaymentFormType> PaymentFormType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case paymentFormTypeRegular::ID:
      return paymentFormTypeRegular::fetch(env, p);
    case paymentFormTypeStars::ID:
      return paymentFormTypeStars::fetch(env, p);
    case paymentFormTypeStarSubscription::ID:
      return paymentFormTypeStarSubscription::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void PaymentFormType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentFormType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass paymentFormTypeRegular::Class;
jfieldID paymentFormTypeRegular::invoice_fieldID;
jfieldID paymentFormTypeRegular::payment_provider_user_id_fieldID;
jfieldID paymentFormTypeRegular::payment_provider_fieldID;
jfieldID paymentFormTypeRegular::additional_payment_options_fieldID;
jfieldID paymentFormTypeRegular::saved_order_info_fieldID;
jfieldID paymentFormTypeRegular::saved_credentials_fieldID;
jfieldID paymentFormTypeRegular::can_save_credentials_fieldID;
jfieldID paymentFormTypeRegular::need_password_fieldID;

paymentFormTypeRegular::paymentFormTypeRegular()
  : invoice_()
  , payment_provider_user_id_()
  , payment_provider_()
  , additional_payment_options_()
  , saved_order_info_()
  , saved_credentials_()
  , can_save_credentials_()
  , need_password_()
{}

paymentFormTypeRegular::paymentFormTypeRegular(object_ptr<invoice> &&invoice_, int53 payment_provider_user_id_, object_ptr<PaymentProvider> &&payment_provider_, array<object_ptr<paymentOption>> &&additional_payment_options_, object_ptr<orderInfo> &&saved_order_info_, array<object_ptr<savedCredentials>> &&saved_credentials_, bool can_save_credentials_, bool need_password_)
  : invoice_(std::move(invoice_))
  , payment_provider_user_id_(payment_provider_user_id_)
  , payment_provider_(std::move(payment_provider_))
  , additional_payment_options_(std::move(additional_payment_options_))
  , saved_order_info_(std::move(saved_order_info_))
  , saved_credentials_(std::move(saved_credentials_))
  , can_save_credentials_(can_save_credentials_)
  , need_password_(need_password_)
{}

const std::int32_t paymentFormTypeRegular::ID;

object_ptr<PaymentFormType> paymentFormTypeRegular::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentFormTypeRegular> res = make_object<paymentFormTypeRegular>();
  res->invoice_ = jni::fetch_tl_object<invoice>(env, jni::fetch_object(env, p, res->invoice_fieldID));
  res->payment_provider_user_id_ = env->GetLongField(p, res->payment_provider_user_id_fieldID);
  res->payment_provider_ = jni::fetch_tl_object<PaymentProvider>(env, jni::fetch_object(env, p, res->payment_provider_fieldID));
  res->additional_payment_options_ = jni::FetchVector<paymentOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->additional_payment_options_fieldID));
  res->saved_order_info_ = jni::fetch_tl_object<orderInfo>(env, jni::fetch_object(env, p, res->saved_order_info_fieldID));
  res->saved_credentials_ = jni::FetchVector<savedCredentials>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->saved_credentials_fieldID));
  res->can_save_credentials_ = (env->GetBooleanField(p, res->can_save_credentials_fieldID) != 0);
  res->need_password_ = (env->GetBooleanField(p, res->need_password_fieldID) != 0);
  return std::move(res);
}

void paymentFormTypeRegular::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (invoice_ != nullptr) { jobject next; invoice_->store(env, next); if (next) { env->SetObjectField(s, invoice_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, payment_provider_user_id_fieldID, payment_provider_user_id_);
  if (payment_provider_ != nullptr) { jobject next; payment_provider_->store(env, next); if (next) { env->SetObjectField(s, payment_provider_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, additional_payment_options_); if (arr_tmp_) { env->SetObjectField(s, additional_payment_options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (saved_order_info_ != nullptr) { jobject next; saved_order_info_->store(env, next); if (next) { env->SetObjectField(s, saved_order_info_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, saved_credentials_); if (arr_tmp_) { env->SetObjectField(s, saved_credentials_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, can_save_credentials_fieldID, can_save_credentials_);
  env->SetBooleanField(s, need_password_fieldID, need_password_);
}

void paymentFormTypeRegular::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentFormTypeRegular");
    s.store_object_field("invoice", static_cast<const BaseObject *>(invoice_.get()));
    s.store_field("paymentProviderUserId", payment_provider_user_id_);
    s.store_object_field("paymentProvider", static_cast<const BaseObject *>(payment_provider_.get()));
    { s.store_vector_begin("additionalPaymentOptions", additional_payment_options_.size()); for (const auto &_value : additional_payment_options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("savedOrderInfo", static_cast<const BaseObject *>(saved_order_info_.get()));
    { s.store_vector_begin("savedCredentials", saved_credentials_.size()); for (const auto &_value : saved_credentials_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("canSaveCredentials", can_save_credentials_);
    s.store_field("needPassword", need_password_);
    s.store_class_end();
  }
}

void paymentFormTypeRegular::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentFormTypeRegular").c_str());
    invoice_fieldID = jni::get_field_id(env, Class, "invoice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Invoice;").c_str());
    payment_provider_user_id_fieldID = jni::get_field_id(env, Class, "paymentProviderUserId", "J");
    payment_provider_fieldID = jni::get_field_id(env, Class, "paymentProvider", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PaymentProvider;").c_str());
    additional_payment_options_fieldID = jni::get_field_id(env, Class, "additionalPaymentOptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaymentOption;").c_str());
    saved_order_info_fieldID = jni::get_field_id(env, Class, "savedOrderInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$OrderInfo;").c_str());
    saved_credentials_fieldID = jni::get_field_id(env, Class, "savedCredentials", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$SavedCredentials;").c_str());
    can_save_credentials_fieldID = jni::get_field_id(env, Class, "canSaveCredentials", "Z");
    need_password_fieldID = jni::get_field_id(env, Class, "needPassword", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass paymentFormTypeStars::Class;
jfieldID paymentFormTypeStars::star_count_fieldID;

paymentFormTypeStars::paymentFormTypeStars()
  : star_count_()
{}

paymentFormTypeStars::paymentFormTypeStars(int53 star_count_)
  : star_count_(star_count_)
{}

const std::int32_t paymentFormTypeStars::ID;

object_ptr<PaymentFormType> paymentFormTypeStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentFormTypeStars> res = make_object<paymentFormTypeStars>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

void paymentFormTypeStars::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, star_count_fieldID, star_count_);
}

void paymentFormTypeStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentFormTypeStars");
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

void paymentFormTypeStars::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentFormTypeStars").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass paymentFormTypeStarSubscription::Class;
jfieldID paymentFormTypeStarSubscription::pricing_fieldID;

paymentFormTypeStarSubscription::paymentFormTypeStarSubscription()
  : pricing_()
{}

paymentFormTypeStarSubscription::paymentFormTypeStarSubscription(object_ptr<starSubscriptionPricing> &&pricing_)
  : pricing_(std::move(pricing_))
{}

const std::int32_t paymentFormTypeStarSubscription::ID;

object_ptr<PaymentFormType> paymentFormTypeStarSubscription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentFormTypeStarSubscription> res = make_object<paymentFormTypeStarSubscription>();
  res->pricing_ = jni::fetch_tl_object<starSubscriptionPricing>(env, jni::fetch_object(env, p, res->pricing_fieldID));
  return std::move(res);
}

void paymentFormTypeStarSubscription::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (pricing_ != nullptr) { jobject next; pricing_->store(env, next); if (next) { env->SetObjectField(s, pricing_fieldID, next); env->DeleteLocalRef(next); } }
}

void paymentFormTypeStarSubscription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentFormTypeStarSubscription");
    s.store_object_field("pricing", static_cast<const BaseObject *>(pricing_.get()));
    s.store_class_end();
  }
}

void paymentFormTypeStarSubscription::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentFormTypeStarSubscription").c_str());
    pricing_fieldID = jni::get_field_id(env, Class, "pricing", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarSubscriptionPricing;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass paymentOption::Class;
jfieldID paymentOption::title_fieldID;
jfieldID paymentOption::url_fieldID;

paymentOption::paymentOption()
  : title_()
  , url_()
{}

paymentOption::paymentOption(string const &title_, string const &url_)
  : title_(title_)
  , url_(url_)
{}

const std::int32_t paymentOption::ID;

object_ptr<paymentOption> paymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentOption> res = make_object<paymentOption>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return res;
}

void paymentOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void paymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentOption");
    s.store_field("title", title_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void paymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentOption").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass poll::Class;
jfieldID poll::id_fieldID;
jfieldID poll::question_fieldID;
jfieldID poll::options_fieldID;
jfieldID poll::total_voter_count_fieldID;
jfieldID poll::recent_voter_ids_fieldID;
jfieldID poll::can_get_voters_fieldID;
jfieldID poll::is_anonymous_fieldID;
jfieldID poll::allows_multiple_answers_fieldID;
jfieldID poll::allows_revoting_fieldID;
jfieldID poll::members_only_fieldID;
jfieldID poll::country_codes_fieldID;
jfieldID poll::option_order_fieldID;
jfieldID poll::type_fieldID;
jfieldID poll::open_period_fieldID;
jfieldID poll::close_date_fieldID;
jfieldID poll::is_closed_fieldID;
jfieldID poll::vote_restriction_reason_fieldID;

poll::poll()
  : id_()
  , question_()
  , options_()
  , total_voter_count_()
  , recent_voter_ids_()
  , can_get_voters_()
  , is_anonymous_()
  , allows_multiple_answers_()
  , allows_revoting_()
  , members_only_()
  , country_codes_()
  , option_order_()
  , type_()
  , open_period_()
  , close_date_()
  , is_closed_()
  , vote_restriction_reason_()
{}

poll::poll(int64 id_, object_ptr<formattedText> &&question_, array<object_ptr<pollOption>> &&options_, int32 total_voter_count_, array<object_ptr<MessageSender>> &&recent_voter_ids_, bool can_get_voters_, bool is_anonymous_, bool allows_multiple_answers_, bool allows_revoting_, bool members_only_, array<string> &&country_codes_, array<int32> &&option_order_, object_ptr<PollType> &&type_, int32 open_period_, int32 close_date_, bool is_closed_, object_ptr<PollVoteRestrictionReason> &&vote_restriction_reason_)
  : id_(id_)
  , question_(std::move(question_))
  , options_(std::move(options_))
  , total_voter_count_(total_voter_count_)
  , recent_voter_ids_(std::move(recent_voter_ids_))
  , can_get_voters_(can_get_voters_)
  , is_anonymous_(is_anonymous_)
  , allows_multiple_answers_(allows_multiple_answers_)
  , allows_revoting_(allows_revoting_)
  , members_only_(members_only_)
  , country_codes_(std::move(country_codes_))
  , option_order_(std::move(option_order_))
  , type_(std::move(type_))
  , open_period_(open_period_)
  , close_date_(close_date_)
  , is_closed_(is_closed_)
  , vote_restriction_reason_(std::move(vote_restriction_reason_))
{}

const std::int32_t poll::ID;

object_ptr<poll> poll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<poll> res = make_object<poll>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->question_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->question_fieldID));
  res->options_ = jni::FetchVector<pollOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  res->total_voter_count_ = env->GetIntField(p, res->total_voter_count_fieldID);
  res->recent_voter_ids_ = jni::FetchVector<MessageSender>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->recent_voter_ids_fieldID));
  res->can_get_voters_ = (env->GetBooleanField(p, res->can_get_voters_fieldID) != 0);
  res->is_anonymous_ = (env->GetBooleanField(p, res->is_anonymous_fieldID) != 0);
  res->allows_multiple_answers_ = (env->GetBooleanField(p, res->allows_multiple_answers_fieldID) != 0);
  res->allows_revoting_ = (env->GetBooleanField(p, res->allows_revoting_fieldID) != 0);
  res->members_only_ = (env->GetBooleanField(p, res->members_only_fieldID) != 0);
  res->country_codes_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->country_codes_fieldID));
  res->option_order_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->option_order_fieldID));
  res->type_ = jni::fetch_tl_object<PollType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->open_period_ = env->GetIntField(p, res->open_period_fieldID);
  res->close_date_ = env->GetIntField(p, res->close_date_fieldID);
  res->is_closed_ = (env->GetBooleanField(p, res->is_closed_fieldID) != 0);
  res->vote_restriction_reason_ = jni::fetch_tl_object<PollVoteRestrictionReason>(env, jni::fetch_object(env, p, res->vote_restriction_reason_fieldID));
  return res;
}

void poll::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (question_ != nullptr) { jobject next; question_->store(env, next); if (next) { env->SetObjectField(s, question_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, options_); if (arr_tmp_) { env->SetObjectField(s, options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, total_voter_count_fieldID, total_voter_count_);
  { auto arr_tmp_ = jni::store_vector(env, recent_voter_ids_); if (arr_tmp_) { env->SetObjectField(s, recent_voter_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, can_get_voters_fieldID, can_get_voters_);
  env->SetBooleanField(s, is_anonymous_fieldID, is_anonymous_);
  env->SetBooleanField(s, allows_multiple_answers_fieldID, allows_multiple_answers_);
  env->SetBooleanField(s, allows_revoting_fieldID, allows_revoting_);
  env->SetBooleanField(s, members_only_fieldID, members_only_);
  { auto arr_tmp_ = jni::store_vector(env, country_codes_); if (arr_tmp_) { env->SetObjectField(s, country_codes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, option_order_); if (arr_tmp_) { env->SetObjectField(s, option_order_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, open_period_fieldID, open_period_);
  env->SetIntField(s, close_date_fieldID, close_date_);
  env->SetBooleanField(s, is_closed_fieldID, is_closed_);
  if (vote_restriction_reason_ != nullptr) { jobject next; vote_restriction_reason_->store(env, next); if (next) { env->SetObjectField(s, vote_restriction_reason_fieldID, next); env->DeleteLocalRef(next); } }
}

void poll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Poll");
    s.store_field("id", id_);
    s.store_object_field("question", static_cast<const BaseObject *>(question_.get()));
    { s.store_vector_begin("options", options_.size()); for (const auto &_value : options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("totalVoterCount", total_voter_count_);
    { s.store_vector_begin("recentVoterIds", recent_voter_ids_.size()); for (const auto &_value : recent_voter_ids_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("canGetVoters", can_get_voters_);
    s.store_field("isAnonymous", is_anonymous_);
    s.store_field("allowsMultipleAnswers", allows_multiple_answers_);
    s.store_field("allowsRevoting", allows_revoting_);
    s.store_field("membersOnly", members_only_);
    { s.store_vector_begin("countryCodes", country_codes_.size()); for (const auto &_value : country_codes_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("optionOrder", option_order_.size()); for (const auto &_value : option_order_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("openPeriod", open_period_);
    s.store_field("closeDate", close_date_);
    s.store_field("isClosed", is_closed_);
    s.store_object_field("voteRestrictionReason", static_cast<const BaseObject *>(vote_restriction_reason_.get()));
    s.store_class_end();
  }
}

void poll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Poll").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    question_fieldID = jni::get_field_id(env, Class, "question", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    options_fieldID = jni::get_field_id(env, Class, "options", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PollOption;").c_str());
    total_voter_count_fieldID = jni::get_field_id(env, Class, "totalVoterCount", "I");
    recent_voter_ids_fieldID = jni::get_field_id(env, Class, "recentVoterIds", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    can_get_voters_fieldID = jni::get_field_id(env, Class, "canGetVoters", "Z");
    is_anonymous_fieldID = jni::get_field_id(env, Class, "isAnonymous", "Z");
    allows_multiple_answers_fieldID = jni::get_field_id(env, Class, "allowsMultipleAnswers", "Z");
    allows_revoting_fieldID = jni::get_field_id(env, Class, "allowsRevoting", "Z");
    members_only_fieldID = jni::get_field_id(env, Class, "membersOnly", "Z");
    country_codes_fieldID = jni::get_field_id(env, Class, "countryCodes", "[Ljava/lang/String;");
    option_order_fieldID = jni::get_field_id(env, Class, "optionOrder", "[I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PollType;").c_str());
    open_period_fieldID = jni::get_field_id(env, Class, "openPeriod", "I");
    close_date_fieldID = jni::get_field_id(env, Class, "closeDate", "I");
    is_closed_fieldID = jni::get_field_id(env, Class, "isClosed", "Z");
    vote_restriction_reason_fieldID = jni::get_field_id(env, Class, "voteRestrictionReason", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PollVoteRestrictionReason;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pollOptionProperties::Class;
jfieldID pollOptionProperties::can_be_deleted_fieldID;
jfieldID pollOptionProperties::can_be_replied_fieldID;
jfieldID pollOptionProperties::can_be_replied_in_another_chat_fieldID;
jfieldID pollOptionProperties::can_get_link_fieldID;

pollOptionProperties::pollOptionProperties()
  : can_be_deleted_()
  , can_be_replied_()
  , can_be_replied_in_another_chat_()
  , can_get_link_()
{}

pollOptionProperties::pollOptionProperties(bool can_be_deleted_, bool can_be_replied_, bool can_be_replied_in_another_chat_, bool can_get_link_)
  : can_be_deleted_(can_be_deleted_)
  , can_be_replied_(can_be_replied_)
  , can_be_replied_in_another_chat_(can_be_replied_in_another_chat_)
  , can_get_link_(can_get_link_)
{}

const std::int32_t pollOptionProperties::ID;

object_ptr<pollOptionProperties> pollOptionProperties::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pollOptionProperties> res = make_object<pollOptionProperties>();
  res->can_be_deleted_ = (env->GetBooleanField(p, res->can_be_deleted_fieldID) != 0);
  res->can_be_replied_ = (env->GetBooleanField(p, res->can_be_replied_fieldID) != 0);
  res->can_be_replied_in_another_chat_ = (env->GetBooleanField(p, res->can_be_replied_in_another_chat_fieldID) != 0);
  res->can_get_link_ = (env->GetBooleanField(p, res->can_get_link_fieldID) != 0);
  return res;
}

void pollOptionProperties::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_be_deleted_fieldID, can_be_deleted_);
  env->SetBooleanField(s, can_be_replied_fieldID, can_be_replied_);
  env->SetBooleanField(s, can_be_replied_in_another_chat_fieldID, can_be_replied_in_another_chat_);
  env->SetBooleanField(s, can_get_link_fieldID, can_get_link_);
}

void pollOptionProperties::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PollOptionProperties");
    s.store_field("canBeDeleted", can_be_deleted_);
    s.store_field("canBeReplied", can_be_replied_);
    s.store_field("canBeRepliedInAnotherChat", can_be_replied_in_another_chat_);
    s.store_field("canGetLink", can_get_link_);
    s.store_class_end();
  }
}

void pollOptionProperties::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PollOptionProperties").c_str());
    can_be_deleted_fieldID = jni::get_field_id(env, Class, "canBeDeleted", "Z");
    can_be_replied_fieldID = jni::get_field_id(env, Class, "canBeReplied", "Z");
    can_be_replied_in_another_chat_fieldID = jni::get_field_id(env, Class, "canBeRepliedInAnotherChat", "Z");
    can_get_link_fieldID = jni::get_field_id(env, Class, "canGetLink", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass PremiumStoryFeature::Class;

object_ptr<PremiumStoryFeature> PremiumStoryFeature::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case premiumStoryFeaturePriorityOrder::ID:
      return premiumStoryFeaturePriorityOrder::fetch(env, p);
    case premiumStoryFeatureStealthMode::ID:
      return premiumStoryFeatureStealthMode::fetch(env, p);
    case premiumStoryFeaturePermanentViewsHistory::ID:
      return premiumStoryFeaturePermanentViewsHistory::fetch(env, p);
    case premiumStoryFeatureCustomExpirationDuration::ID:
      return premiumStoryFeatureCustomExpirationDuration::fetch(env, p);
    case premiumStoryFeatureSaveStories::ID:
      return premiumStoryFeatureSaveStories::fetch(env, p);
    case premiumStoryFeatureLinksAndFormatting::ID:
      return premiumStoryFeatureLinksAndFormatting::fetch(env, p);
    case premiumStoryFeatureVideoQuality::ID:
      return premiumStoryFeatureVideoQuality::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void PremiumStoryFeature::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeature").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeaturePriorityOrder::Class;

premiumStoryFeaturePriorityOrder::premiumStoryFeaturePriorityOrder() {
}

const std::int32_t premiumStoryFeaturePriorityOrder::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeaturePriorityOrder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeaturePriorityOrder>();
}

void premiumStoryFeaturePriorityOrder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeaturePriorityOrder");
    s.store_class_end();
  }
}

void premiumStoryFeaturePriorityOrder::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeaturePriorityOrder").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeatureStealthMode::Class;

premiumStoryFeatureStealthMode::premiumStoryFeatureStealthMode() {
}

const std::int32_t premiumStoryFeatureStealthMode::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeatureStealthMode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeatureStealthMode>();
}

void premiumStoryFeatureStealthMode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeatureStealthMode");
    s.store_class_end();
  }
}

void premiumStoryFeatureStealthMode::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeatureStealthMode").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeaturePermanentViewsHistory::Class;

premiumStoryFeaturePermanentViewsHistory::premiumStoryFeaturePermanentViewsHistory() {
}

const std::int32_t premiumStoryFeaturePermanentViewsHistory::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeaturePermanentViewsHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeaturePermanentViewsHistory>();
}

void premiumStoryFeaturePermanentViewsHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeaturePermanentViewsHistory");
    s.store_class_end();
  }
}

void premiumStoryFeaturePermanentViewsHistory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeaturePermanentViewsHistory").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeatureCustomExpirationDuration::Class;

premiumStoryFeatureCustomExpirationDuration::premiumStoryFeatureCustomExpirationDuration() {
}

const std::int32_t premiumStoryFeatureCustomExpirationDuration::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeatureCustomExpirationDuration::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeatureCustomExpirationDuration>();
}

void premiumStoryFeatureCustomExpirationDuration::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeatureCustomExpirationDuration");
    s.store_class_end();
  }
}

void premiumStoryFeatureCustomExpirationDuration::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeatureCustomExpirationDuration").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeatureSaveStories::Class;

premiumStoryFeatureSaveStories::premiumStoryFeatureSaveStories() {
}

const std::int32_t premiumStoryFeatureSaveStories::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeatureSaveStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeatureSaveStories>();
}

void premiumStoryFeatureSaveStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeatureSaveStories");
    s.store_class_end();
  }
}

void premiumStoryFeatureSaveStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeatureSaveStories").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeatureLinksAndFormatting::Class;

premiumStoryFeatureLinksAndFormatting::premiumStoryFeatureLinksAndFormatting() {
}

const std::int32_t premiumStoryFeatureLinksAndFormatting::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeatureLinksAndFormatting::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeatureLinksAndFormatting>();
}

void premiumStoryFeatureLinksAndFormatting::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeatureLinksAndFormatting");
    s.store_class_end();
  }
}

void premiumStoryFeatureLinksAndFormatting::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeatureLinksAndFormatting").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStoryFeatureVideoQuality::Class;

premiumStoryFeatureVideoQuality::premiumStoryFeatureVideoQuality() {
}

const std::int32_t premiumStoryFeatureVideoQuality::ID;

object_ptr<PremiumStoryFeature> premiumStoryFeatureVideoQuality::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<premiumStoryFeatureVideoQuality>();
}

void premiumStoryFeatureVideoQuality::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStoryFeatureVideoQuality");
    s.store_class_end();
  }
}

void premiumStoryFeatureVideoQuality::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStoryFeatureVideoQuality").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass profileAccentColors::Class;
jfieldID profileAccentColors::palette_colors_fieldID;
jfieldID profileAccentColors::background_colors_fieldID;
jfieldID profileAccentColors::story_colors_fieldID;

profileAccentColors::profileAccentColors()
  : palette_colors_()
  , background_colors_()
  , story_colors_()
{}

profileAccentColors::profileAccentColors(array<int32> &&palette_colors_, array<int32> &&background_colors_, array<int32> &&story_colors_)
  : palette_colors_(std::move(palette_colors_))
  , background_colors_(std::move(background_colors_))
  , story_colors_(std::move(story_colors_))
{}

const std::int32_t profileAccentColors::ID;

object_ptr<profileAccentColors> profileAccentColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<profileAccentColors> res = make_object<profileAccentColors>();
  res->palette_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->palette_colors_fieldID));
  res->background_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->background_colors_fieldID));
  res->story_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->story_colors_fieldID));
  return res;
}

void profileAccentColors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, palette_colors_); if (arr_tmp_) { env->SetObjectField(s, palette_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, background_colors_); if (arr_tmp_) { env->SetObjectField(s, background_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, story_colors_); if (arr_tmp_) { env->SetObjectField(s, story_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void profileAccentColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProfileAccentColors");
    { s.store_vector_begin("paletteColors", palette_colors_.size()); for (const auto &_value : palette_colors_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("backgroundColors", background_colors_.size()); for (const auto &_value : background_colors_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("storyColors", story_colors_.size()); for (const auto &_value : story_colors_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void profileAccentColors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ProfileAccentColors").c_str());
    palette_colors_fieldID = jni::get_field_id(env, Class, "paletteColors", "[I");
    background_colors_fieldID = jni::get_field_id(env, Class, "backgroundColors", "[I");
    story_colors_fieldID = jni::get_field_id(env, Class, "storyColors", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass quickReplyMessage::Class;
jfieldID quickReplyMessage::id_fieldID;
jfieldID quickReplyMessage::sending_state_fieldID;
jfieldID quickReplyMessage::can_be_edited_fieldID;
jfieldID quickReplyMessage::reply_to_message_id_fieldID;
jfieldID quickReplyMessage::via_bot_user_id_fieldID;
jfieldID quickReplyMessage::media_album_id_fieldID;
jfieldID quickReplyMessage::content_fieldID;
jfieldID quickReplyMessage::reply_markup_fieldID;

quickReplyMessage::quickReplyMessage()
  : id_()
  , sending_state_()
  , can_be_edited_()
  , reply_to_message_id_()
  , via_bot_user_id_()
  , media_album_id_()
  , content_()
  , reply_markup_()
{}

quickReplyMessage::quickReplyMessage(int53 id_, object_ptr<MessageSendingState> &&sending_state_, bool can_be_edited_, int53 reply_to_message_id_, int53 via_bot_user_id_, int64 media_album_id_, object_ptr<MessageContent> &&content_, object_ptr<ReplyMarkup> &&reply_markup_)
  : id_(id_)
  , sending_state_(std::move(sending_state_))
  , can_be_edited_(can_be_edited_)
  , reply_to_message_id_(reply_to_message_id_)
  , via_bot_user_id_(via_bot_user_id_)
  , media_album_id_(media_album_id_)
  , content_(std::move(content_))
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t quickReplyMessage::ID;

object_ptr<quickReplyMessage> quickReplyMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<quickReplyMessage> res = make_object<quickReplyMessage>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sending_state_ = jni::fetch_tl_object<MessageSendingState>(env, jni::fetch_object(env, p, res->sending_state_fieldID));
  res->can_be_edited_ = (env->GetBooleanField(p, res->can_be_edited_fieldID) != 0);
  res->reply_to_message_id_ = env->GetLongField(p, res->reply_to_message_id_fieldID);
  res->via_bot_user_id_ = env->GetLongField(p, res->via_bot_user_id_fieldID);
  res->media_album_id_ = env->GetLongField(p, res->media_album_id_fieldID);
  res->content_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  return res;
}

void quickReplyMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (sending_state_ != nullptr) { jobject next; sending_state_->store(env, next); if (next) { env->SetObjectField(s, sending_state_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_be_edited_fieldID, can_be_edited_);
  env->SetLongField(s, reply_to_message_id_fieldID, reply_to_message_id_);
  env->SetLongField(s, via_bot_user_id_fieldID, via_bot_user_id_);
  env->SetLongField(s, media_album_id_fieldID, media_album_id_);
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
  if (reply_markup_ != nullptr) { jobject next; reply_markup_->store(env, next); if (next) { env->SetObjectField(s, reply_markup_fieldID, next); env->DeleteLocalRef(next); } }
}

void quickReplyMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "QuickReplyMessage");
    s.store_field("id", id_);
    s.store_object_field("sendingState", static_cast<const BaseObject *>(sending_state_.get()));
    s.store_field("canBeEdited", can_be_edited_);
    s.store_field("replyToMessageId", reply_to_message_id_);
    s.store_field("viaBotUserId", via_bot_user_id_);
    s.store_field("mediaAlbumId", media_album_id_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_class_end();
  }
}

void quickReplyMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$QuickReplyMessage").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sending_state_fieldID = jni::get_field_id(env, Class, "sendingState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSendingState;").c_str());
    can_be_edited_fieldID = jni::get_field_id(env, Class, "canBeEdited", "Z");
    reply_to_message_id_fieldID = jni::get_field_id(env, Class, "replyToMessageId", "J");
    via_bot_user_id_fieldID = jni::get_field_id(env, Class, "viaBotUserId", "J");
    media_album_id_fieldID = jni::get_field_id(env, Class, "mediaAlbumId", "J");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass recommendedChatFolders::Class;
jfieldID recommendedChatFolders::chat_folders_fieldID;

recommendedChatFolders::recommendedChatFolders()
  : chat_folders_()
{}

recommendedChatFolders::recommendedChatFolders(array<object_ptr<recommendedChatFolder>> &&chat_folders_)
  : chat_folders_(std::move(chat_folders_))
{}

const std::int32_t recommendedChatFolders::ID;

object_ptr<recommendedChatFolders> recommendedChatFolders::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<recommendedChatFolders> res = make_object<recommendedChatFolders>();
  res->chat_folders_ = jni::FetchVector<recommendedChatFolder>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->chat_folders_fieldID));
  return res;
}

void recommendedChatFolders::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, chat_folders_); if (arr_tmp_) { env->SetObjectField(s, chat_folders_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void recommendedChatFolders::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RecommendedChatFolders");
    { s.store_vector_begin("chatFolders", chat_folders_.size()); for (const auto &_value : chat_folders_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void recommendedChatFolders::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RecommendedChatFolders").c_str());
    chat_folders_fieldID = jni::get_field_id(env, Class, "chatFolders", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$RecommendedChatFolder;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass ReportSponsoredResult::Class;

object_ptr<ReportSponsoredResult> ReportSponsoredResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case reportSponsoredResultOk::ID:
      return reportSponsoredResultOk::fetch(env, p);
    case reportSponsoredResultFailed::ID:
      return reportSponsoredResultFailed::fetch(env, p);
    case reportSponsoredResultOptionRequired::ID:
      return reportSponsoredResultOptionRequired::fetch(env, p);
    case reportSponsoredResultAdsHidden::ID:
      return reportSponsoredResultAdsHidden::fetch(env, p);
    case reportSponsoredResultPremiumRequired::ID:
      return reportSponsoredResultPremiumRequired::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void ReportSponsoredResult::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSponsoredResult").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportSponsoredResultOk::Class;

reportSponsoredResultOk::reportSponsoredResultOk() {
}

const std::int32_t reportSponsoredResultOk::ID;

object_ptr<ReportSponsoredResult> reportSponsoredResultOk::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<reportSponsoredResultOk>();
}

void reportSponsoredResultOk::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void reportSponsoredResultOk::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportSponsoredResultOk");
    s.store_class_end();
  }
}

void reportSponsoredResultOk::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSponsoredResultOk").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportSponsoredResultFailed::Class;

reportSponsoredResultFailed::reportSponsoredResultFailed() {
}

const std::int32_t reportSponsoredResultFailed::ID;

object_ptr<ReportSponsoredResult> reportSponsoredResultFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<reportSponsoredResultFailed>();
}

void reportSponsoredResultFailed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void reportSponsoredResultFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportSponsoredResultFailed");
    s.store_class_end();
  }
}

void reportSponsoredResultFailed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSponsoredResultFailed").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportSponsoredResultOptionRequired::Class;
jfieldID reportSponsoredResultOptionRequired::title_fieldID;
jfieldID reportSponsoredResultOptionRequired::options_fieldID;

reportSponsoredResultOptionRequired::reportSponsoredResultOptionRequired()
  : title_()
  , options_()
{}

reportSponsoredResultOptionRequired::reportSponsoredResultOptionRequired(string const &title_, array<object_ptr<reportOption>> &&options_)
  : title_(title_)
  , options_(std::move(options_))
{}

const std::int32_t reportSponsoredResultOptionRequired::ID;

object_ptr<ReportSponsoredResult> reportSponsoredResultOptionRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportSponsoredResultOptionRequired> res = make_object<reportSponsoredResultOptionRequired>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->options_ = jni::FetchVector<reportOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  return std::move(res);
}

void reportSponsoredResultOptionRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, options_); if (arr_tmp_) { env->SetObjectField(s, options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void reportSponsoredResultOptionRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportSponsoredResultOptionRequired");
    s.store_field("title", title_);
    { s.store_vector_begin("options", options_.size()); for (const auto &_value : options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void reportSponsoredResultOptionRequired::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSponsoredResultOptionRequired").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    options_fieldID = jni::get_field_id(env, Class, "options", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReportOption;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportSponsoredResultAdsHidden::Class;

reportSponsoredResultAdsHidden::reportSponsoredResultAdsHidden() {
}

const std::int32_t reportSponsoredResultAdsHidden::ID;

object_ptr<ReportSponsoredResult> reportSponsoredResultAdsHidden::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<reportSponsoredResultAdsHidden>();
}

void reportSponsoredResultAdsHidden::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void reportSponsoredResultAdsHidden::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportSponsoredResultAdsHidden");
    s.store_class_end();
  }
}

void reportSponsoredResultAdsHidden::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSponsoredResultAdsHidden").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportSponsoredResultPremiumRequired::Class;

reportSponsoredResultPremiumRequired::reportSponsoredResultPremiumRequired() {
}

const std::int32_t reportSponsoredResultPremiumRequired::ID;

object_ptr<ReportSponsoredResult> reportSponsoredResultPremiumRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<reportSponsoredResultPremiumRequired>();
}

void reportSponsoredResultPremiumRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void reportSponsoredResultPremiumRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportSponsoredResultPremiumRequired");
    s.store_class_end();
  }
}

void reportSponsoredResultPremiumRequired::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSponsoredResultPremiumRequired").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass rtmpUrl::Class;
jfieldID rtmpUrl::url_fieldID;
jfieldID rtmpUrl::stream_key_fieldID;

rtmpUrl::rtmpUrl()
  : url_()
  , stream_key_()
{}

rtmpUrl::rtmpUrl(string const &url_, string const &stream_key_)
  : url_(url_)
  , stream_key_(stream_key_)
{}

const std::int32_t rtmpUrl::ID;

object_ptr<rtmpUrl> rtmpUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<rtmpUrl> res = make_object<rtmpUrl>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->stream_key_ = jni::fetch_string(env, p, res->stream_key_fieldID);
  return res;
}

void rtmpUrl::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, stream_key_); if (nextString) { env->SetObjectField(s, stream_key_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void rtmpUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RtmpUrl");
    s.store_field("url", url_);
    s.store_field("streamKey", stream_key_);
    s.store_class_end();
  }
}

void rtmpUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RtmpUrl").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    stream_key_fieldID = jni::get_field_id(env, Class, "streamKey", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass sharedUser::Class;
jfieldID sharedUser::user_id_fieldID;
jfieldID sharedUser::first_name_fieldID;
jfieldID sharedUser::last_name_fieldID;
jfieldID sharedUser::username_fieldID;
jfieldID sharedUser::photo_fieldID;

sharedUser::sharedUser()
  : user_id_()
  , first_name_()
  , last_name_()
  , username_()
  , photo_()
{}

sharedUser::sharedUser(int53 user_id_, string const &first_name_, string const &last_name_, string const &username_, object_ptr<photo> &&photo_)
  : user_id_(user_id_)
  , first_name_(first_name_)
  , last_name_(last_name_)
  , username_(username_)
  , photo_(std::move(photo_))
{}

const std::int32_t sharedUser::ID;

object_ptr<sharedUser> sharedUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sharedUser> res = make_object<sharedUser>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return res;
}

void sharedUser::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  { jstring nextString = jni::to_jstring(env, first_name_); if (nextString) { env->SetObjectField(s, first_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, last_name_); if (nextString) { env->SetObjectField(s, last_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, username_); if (nextString) { env->SetObjectField(s, username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
}

void sharedUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SharedUser");
    s.store_field("userId", user_id_);
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_field("username", username_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_class_end();
  }
}

void sharedUser::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SharedUser").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    first_name_fieldID = jni::get_field_id(env, Class, "firstName", "Ljava/lang/String;");
    last_name_fieldID = jni::get_field_id(env, Class, "lastName", "Ljava/lang/String;");
    username_fieldID = jni::get_field_id(env, Class, "username", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starPaymentOption::Class;
jfieldID starPaymentOption::currency_fieldID;
jfieldID starPaymentOption::amount_fieldID;
jfieldID starPaymentOption::star_count_fieldID;
jfieldID starPaymentOption::store_product_id_fieldID;
jfieldID starPaymentOption::is_additional_fieldID;

starPaymentOption::starPaymentOption()
  : currency_()
  , amount_()
  , star_count_()
  , store_product_id_()
  , is_additional_()
{}

starPaymentOption::starPaymentOption(string const &currency_, int53 amount_, int53 star_count_, string const &store_product_id_, bool is_additional_)
  : currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
  , store_product_id_(store_product_id_)
  , is_additional_(is_additional_)
{}

const std::int32_t starPaymentOption::ID;

object_ptr<starPaymentOption> starPaymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starPaymentOption> res = make_object<starPaymentOption>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->store_product_id_ = jni::fetch_string(env, p, res->store_product_id_fieldID);
  res->is_additional_ = (env->GetBooleanField(p, res->is_additional_fieldID) != 0);
  return res;
}

void starPaymentOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  env->SetLongField(s, star_count_fieldID, star_count_);
  { jstring nextString = jni::to_jstring(env, store_product_id_); if (nextString) { env->SetObjectField(s, store_product_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_additional_fieldID, is_additional_);
}

void starPaymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarPaymentOption");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_field("storeProductId", store_product_id_);
    s.store_field("isAdditional", is_additional_);
    s.store_class_end();
  }
}

void starPaymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarPaymentOption").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    store_product_id_fieldID = jni::get_field_id(env, Class, "storeProductId", "Ljava/lang/String;");
    is_additional_fieldID = jni::get_field_id(env, Class, "isAdditional", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass starSubscription::Class;
jfieldID starSubscription::id_fieldID;
jfieldID starSubscription::chat_id_fieldID;
jfieldID starSubscription::expiration_date_fieldID;
jfieldID starSubscription::is_canceled_fieldID;
jfieldID starSubscription::is_expiring_fieldID;
jfieldID starSubscription::pricing_fieldID;
jfieldID starSubscription::type_fieldID;

starSubscription::starSubscription()
  : id_()
  , chat_id_()
  , expiration_date_()
  , is_canceled_()
  , is_expiring_()
  , pricing_()
  , type_()
{}

starSubscription::starSubscription(string const &id_, int53 chat_id_, int32 expiration_date_, bool is_canceled_, bool is_expiring_, object_ptr<starSubscriptionPricing> &&pricing_, object_ptr<StarSubscriptionType> &&type_)
  : id_(id_)
  , chat_id_(chat_id_)
  , expiration_date_(expiration_date_)
  , is_canceled_(is_canceled_)
  , is_expiring_(is_expiring_)
  , pricing_(std::move(pricing_))
  , type_(std::move(type_))
{}

const std::int32_t starSubscription::ID;

object_ptr<starSubscription> starSubscription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starSubscription> res = make_object<starSubscription>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  res->is_canceled_ = (env->GetBooleanField(p, res->is_canceled_fieldID) != 0);
  res->is_expiring_ = (env->GetBooleanField(p, res->is_expiring_fieldID) != 0);
  res->pricing_ = jni::fetch_tl_object<starSubscriptionPricing>(env, jni::fetch_object(env, p, res->pricing_fieldID));
  res->type_ = jni::fetch_tl_object<StarSubscriptionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void starSubscription::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, expiration_date_fieldID, expiration_date_);
  env->SetBooleanField(s, is_canceled_fieldID, is_canceled_);
  env->SetBooleanField(s, is_expiring_fieldID, is_expiring_);
  if (pricing_ != nullptr) { jobject next; pricing_->store(env, next); if (next) { env->SetObjectField(s, pricing_fieldID, next); env->DeleteLocalRef(next); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void starSubscription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarSubscription");
    s.store_field("id", id_);
    s.store_field("chatId", chat_id_);
    s.store_field("expirationDate", expiration_date_);
    s.store_field("isCanceled", is_canceled_);
    s.store_field("isExpiring", is_expiring_);
    s.store_object_field("pricing", static_cast<const BaseObject *>(pricing_.get()));
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void starSubscription::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarSubscription").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    is_canceled_fieldID = jni::get_field_id(env, Class, "isCanceled", "Z");
    is_expiring_fieldID = jni::get_field_id(env, Class, "isExpiring", "Z");
    pricing_fieldID = jni::get_field_id(env, Class, "pricing", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarSubscriptionPricing;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarSubscriptionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactions::Class;
jfieldID starTransactions::star_amount_fieldID;
jfieldID starTransactions::transactions_fieldID;
jfieldID starTransactions::next_offset_fieldID;

starTransactions::starTransactions()
  : star_amount_()
  , transactions_()
  , next_offset_()
{}

starTransactions::starTransactions(object_ptr<starAmount> &&star_amount_, array<object_ptr<starTransaction>> &&transactions_, string const &next_offset_)
  : star_amount_(std::move(star_amount_))
  , transactions_(std::move(transactions_))
  , next_offset_(next_offset_)
{}

const std::int32_t starTransactions::ID;

object_ptr<starTransactions> starTransactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactions> res = make_object<starTransactions>();
  res->star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->star_amount_fieldID));
  res->transactions_ = jni::FetchVector<starTransaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->transactions_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void starTransactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (star_amount_ != nullptr) { jobject next; star_amount_->store(env, next); if (next) { env->SetObjectField(s, star_amount_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, transactions_); if (arr_tmp_) { env->SetObjectField(s, transactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void starTransactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactions");
    s.store_object_field("starAmount", static_cast<const BaseObject *>(star_amount_.get()));
    { s.store_vector_begin("transactions", transactions_.size()); for (const auto &_value : transactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("nextOffset", next_offset_);
    s.store_class_end();
  }
}

void starTransactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactions").c_str());
    star_amount_fieldID = jni::get_field_id(env, Class, "starAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    transactions_fieldID = jni::get_field_id(env, Class, "transactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StarTransaction;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass stickerSetInfo::Class;
jfieldID stickerSetInfo::id_fieldID;
jfieldID stickerSetInfo::title_fieldID;
jfieldID stickerSetInfo::name_fieldID;
jfieldID stickerSetInfo::thumbnail_fieldID;
jfieldID stickerSetInfo::thumbnail_outline_fieldID;
jfieldID stickerSetInfo::is_owned_fieldID;
jfieldID stickerSetInfo::is_installed_fieldID;
jfieldID stickerSetInfo::is_archived_fieldID;
jfieldID stickerSetInfo::is_official_fieldID;
jfieldID stickerSetInfo::sticker_type_fieldID;
jfieldID stickerSetInfo::needs_repainting_fieldID;
jfieldID stickerSetInfo::is_allowed_as_chat_emoji_status_fieldID;
jfieldID stickerSetInfo::is_viewed_fieldID;
jfieldID stickerSetInfo::size_fieldID;
jfieldID stickerSetInfo::covers_fieldID;

stickerSetInfo::stickerSetInfo()
  : id_()
  , title_()
  , name_()
  , thumbnail_()
  , thumbnail_outline_()
  , is_owned_()
  , is_installed_()
  , is_archived_()
  , is_official_()
  , sticker_type_()
  , needs_repainting_()
  , is_allowed_as_chat_emoji_status_()
  , is_viewed_()
  , size_()
  , covers_()
{}

stickerSetInfo::stickerSetInfo(int64 id_, string const &title_, string const &name_, object_ptr<thumbnail> &&thumbnail_, object_ptr<outline> &&thumbnail_outline_, bool is_owned_, bool is_installed_, bool is_archived_, bool is_official_, object_ptr<StickerType> &&sticker_type_, bool needs_repainting_, bool is_allowed_as_chat_emoji_status_, bool is_viewed_, int32 size_, array<object_ptr<sticker>> &&covers_)
  : id_(id_)
  , title_(title_)
  , name_(name_)
  , thumbnail_(std::move(thumbnail_))
  , thumbnail_outline_(std::move(thumbnail_outline_))
  , is_owned_(is_owned_)
  , is_installed_(is_installed_)
  , is_archived_(is_archived_)
  , is_official_(is_official_)
  , sticker_type_(std::move(sticker_type_))
  , needs_repainting_(needs_repainting_)
  , is_allowed_as_chat_emoji_status_(is_allowed_as_chat_emoji_status_)
  , is_viewed_(is_viewed_)
  , size_(size_)
  , covers_(std::move(covers_))
{}

const std::int32_t stickerSetInfo::ID;

object_ptr<stickerSetInfo> stickerSetInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stickerSetInfo> res = make_object<stickerSetInfo>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->thumbnail_outline_ = jni::fetch_tl_object<outline>(env, jni::fetch_object(env, p, res->thumbnail_outline_fieldID));
  res->is_owned_ = (env->GetBooleanField(p, res->is_owned_fieldID) != 0);
  res->is_installed_ = (env->GetBooleanField(p, res->is_installed_fieldID) != 0);
  res->is_archived_ = (env->GetBooleanField(p, res->is_archived_fieldID) != 0);
  res->is_official_ = (env->GetBooleanField(p, res->is_official_fieldID) != 0);
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->needs_repainting_ = (env->GetBooleanField(p, res->needs_repainting_fieldID) != 0);
  res->is_allowed_as_chat_emoji_status_ = (env->GetBooleanField(p, res->is_allowed_as_chat_emoji_status_fieldID) != 0);
  res->is_viewed_ = (env->GetBooleanField(p, res->is_viewed_fieldID) != 0);
  res->size_ = env->GetIntField(p, res->size_fieldID);
  res->covers_ = jni::FetchVector<sticker>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->covers_fieldID));
  return res;
}

void stickerSetInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_outline_ != nullptr) { jobject next; thumbnail_outline_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_outline_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_owned_fieldID, is_owned_);
  env->SetBooleanField(s, is_installed_fieldID, is_installed_);
  env->SetBooleanField(s, is_archived_fieldID, is_archived_);
  env->SetBooleanField(s, is_official_fieldID, is_official_);
  if (sticker_type_ != nullptr) { jobject next; sticker_type_->store(env, next); if (next) { env->SetObjectField(s, sticker_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, needs_repainting_fieldID, needs_repainting_);
  env->SetBooleanField(s, is_allowed_as_chat_emoji_status_fieldID, is_allowed_as_chat_emoji_status_);
  env->SetBooleanField(s, is_viewed_fieldID, is_viewed_);
  env->SetIntField(s, size_fieldID, size_);
  { auto arr_tmp_ = jni::store_vector(env, covers_); if (arr_tmp_) { env->SetObjectField(s, covers_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void stickerSetInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StickerSetInfo");
    s.store_field("id", id_);
    s.store_field("title", title_);
    s.store_field("name", name_);
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("thumbnailOutline", static_cast<const BaseObject *>(thumbnail_outline_.get()));
    s.store_field("isOwned", is_owned_);
    s.store_field("isInstalled", is_installed_);
    s.store_field("isArchived", is_archived_);
    s.store_field("isOfficial", is_official_);
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("needsRepainting", needs_repainting_);
    s.store_field("isAllowedAsChatEmojiStatus", is_allowed_as_chat_emoji_status_);
    s.store_field("isViewed", is_viewed_);
    s.store_field("size", size_);
    { s.store_vector_begin("covers", covers_.size()); for (const auto &_value : covers_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void stickerSetInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StickerSetInfo").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    thumbnail_outline_fieldID = jni::get_field_id(env, Class, "thumbnailOutline", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Outline;").c_str());
    is_owned_fieldID = jni::get_field_id(env, Class, "isOwned", "Z");
    is_installed_fieldID = jni::get_field_id(env, Class, "isInstalled", "Z");
    is_archived_fieldID = jni::get_field_id(env, Class, "isArchived", "Z");
    is_official_fieldID = jni::get_field_id(env, Class, "isOfficial", "Z");
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    needs_repainting_fieldID = jni::get_field_id(env, Class, "needsRepainting", "Z");
    is_allowed_as_chat_emoji_status_fieldID = jni::get_field_id(env, Class, "isAllowedAsChatEmojiStatus", "Z");
    is_viewed_fieldID = jni::get_field_id(env, Class, "isViewed", "Z");
    size_fieldID = jni::get_field_id(env, Class, "size", "I");
    covers_fieldID = jni::get_field_id(env, Class, "covers", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyInteraction::Class;
jfieldID storyInteraction::actor_id_fieldID;
jfieldID storyInteraction::interaction_date_fieldID;
jfieldID storyInteraction::block_list_fieldID;
jfieldID storyInteraction::type_fieldID;

storyInteraction::storyInteraction()
  : actor_id_()
  , interaction_date_()
  , block_list_()
  , type_()
{}

storyInteraction::storyInteraction(object_ptr<MessageSender> &&actor_id_, int32 interaction_date_, object_ptr<BlockList> &&block_list_, object_ptr<StoryInteractionType> &&type_)
  : actor_id_(std::move(actor_id_))
  , interaction_date_(interaction_date_)
  , block_list_(std::move(block_list_))
  , type_(std::move(type_))
{}

const std::int32_t storyInteraction::ID;

object_ptr<storyInteraction> storyInteraction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInteraction> res = make_object<storyInteraction>();
  res->actor_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->actor_id_fieldID));
  res->interaction_date_ = env->GetIntField(p, res->interaction_date_fieldID);
  res->block_list_ = jni::fetch_tl_object<BlockList>(env, jni::fetch_object(env, p, res->block_list_fieldID));
  res->type_ = jni::fetch_tl_object<StoryInteractionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void storyInteraction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (actor_id_ != nullptr) { jobject next; actor_id_->store(env, next); if (next) { env->SetObjectField(s, actor_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, interaction_date_fieldID, interaction_date_);
  if (block_list_ != nullptr) { jobject next; block_list_->store(env, next); if (next) { env->SetObjectField(s, block_list_fieldID, next); env->DeleteLocalRef(next); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void storyInteraction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInteraction");
    s.store_object_field("actorId", static_cast<const BaseObject *>(actor_id_.get()));
    s.store_field("interactionDate", interaction_date_);
    s.store_object_field("blockList", static_cast<const BaseObject *>(block_list_.get()));
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void storyInteraction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteraction").c_str());
    actor_id_fieldID = jni::get_field_id(env, Class, "actorId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    interaction_date_fieldID = jni::get_field_id(env, Class, "interactionDate", "I");
    block_list_fieldID = jni::get_field_id(env, Class, "blockList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BlockList;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryInteractionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass StoryInteractionType::Class;

object_ptr<StoryInteractionType> StoryInteractionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case storyInteractionTypeView::ID:
      return storyInteractionTypeView::fetch(env, p);
    case storyInteractionTypeForward::ID:
      return storyInteractionTypeForward::fetch(env, p);
    case storyInteractionTypeRepost::ID:
      return storyInteractionTypeRepost::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void StoryInteractionType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteractionType").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyInteractionTypeView::Class;
jfieldID storyInteractionTypeView::chosen_reaction_type_fieldID;

storyInteractionTypeView::storyInteractionTypeView()
  : chosen_reaction_type_()
{}

storyInteractionTypeView::storyInteractionTypeView(object_ptr<ReactionType> &&chosen_reaction_type_)
  : chosen_reaction_type_(std::move(chosen_reaction_type_))
{}

const std::int32_t storyInteractionTypeView::ID;

object_ptr<StoryInteractionType> storyInteractionTypeView::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInteractionTypeView> res = make_object<storyInteractionTypeView>();
  res->chosen_reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->chosen_reaction_type_fieldID));
  return std::move(res);
}

void storyInteractionTypeView::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (chosen_reaction_type_ != nullptr) { jobject next; chosen_reaction_type_->store(env, next); if (next) { env->SetObjectField(s, chosen_reaction_type_fieldID, next); env->DeleteLocalRef(next); } }
}

void storyInteractionTypeView::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInteractionTypeView");
    s.store_object_field("chosenReactionType", static_cast<const BaseObject *>(chosen_reaction_type_.get()));
    s.store_class_end();
  }
}

void storyInteractionTypeView::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteractionTypeView").c_str());
    chosen_reaction_type_fieldID = jni::get_field_id(env, Class, "chosenReactionType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyInteractionTypeForward::Class;
jfieldID storyInteractionTypeForward::message_fieldID;

storyInteractionTypeForward::storyInteractionTypeForward()
  : message_()
{}

storyInteractionTypeForward::storyInteractionTypeForward(object_ptr<message> &&message_)
  : message_(std::move(message_))
{}

const std::int32_t storyInteractionTypeForward::ID;

object_ptr<StoryInteractionType> storyInteractionTypeForward::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInteractionTypeForward> res = make_object<storyInteractionTypeForward>();
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  return std::move(res);
}

void storyInteractionTypeForward::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
}

void storyInteractionTypeForward::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInteractionTypeForward");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void storyInteractionTypeForward::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteractionTypeForward").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyInteractionTypeRepost::Class;
jfieldID storyInteractionTypeRepost::story_fieldID;

storyInteractionTypeRepost::storyInteractionTypeRepost()
  : story_()
{}

storyInteractionTypeRepost::storyInteractionTypeRepost(object_ptr<story> &&story_)
  : story_(std::move(story_))
{}

const std::int32_t storyInteractionTypeRepost::ID;

object_ptr<StoryInteractionType> storyInteractionTypeRepost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInteractionTypeRepost> res = make_object<storyInteractionTypeRepost>();
  res->story_ = jni::fetch_tl_object<story>(env, jni::fetch_object(env, p, res->story_fieldID));
  return std::move(res);
}

void storyInteractionTypeRepost::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (story_ != nullptr) { jobject next; story_->store(env, next); if (next) { env->SetObjectField(s, story_fieldID, next); env->DeleteLocalRef(next); } }
}

void storyInteractionTypeRepost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInteractionTypeRepost");
    s.store_object_field("story", static_cast<const BaseObject *>(story_.get()));
    s.store_class_end();
  }
}

void storyInteractionTypeRepost::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteractionTypeRepost").c_str());
    story_fieldID = jni::get_field_id(env, Class, "story", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Story;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass StoryList::Class;

object_ptr<StoryList> StoryList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case storyListMain::ID:
      return storyListMain::fetch(env, p);
    case storyListArchive::ID:
      return storyListArchive::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void StoryList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryList").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyListMain::Class;

storyListMain::storyListMain() {
}

const std::int32_t storyListMain::ID;

object_ptr<StoryList> storyListMain::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<storyListMain>();
}

void storyListMain::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void storyListMain::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryListMain");
    s.store_class_end();
  }
}

void storyListMain::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryListMain").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyListArchive::Class;

storyListArchive::storyListArchive() {
}

const std::int32_t storyListArchive::ID;

object_ptr<StoryList> storyListArchive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<storyListArchive>();
}

void storyListArchive::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void storyListArchive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryListArchive");
    s.store_class_end();
  }
}

void storyListArchive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryListArchive").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass testVectorString::Class;
jfieldID testVectorString::value_fieldID;

testVectorString::testVectorString()
  : value_()
{}

testVectorString::testVectorString(array<string> &&value_)
  : value_(std::move(value_))
{}

const std::int32_t testVectorString::ID;

object_ptr<testVectorString> testVectorString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testVectorString> res = make_object<testVectorString>();
  res->value_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->value_fieldID));
  return res;
}

void testVectorString::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, value_); if (arr_tmp_) { env->SetObjectField(s, value_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void testVectorString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestVectorString");
    { s.store_vector_begin("value", value_.size()); for (const auto &_value : value_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void testVectorString::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TestVectorString").c_str());
    value_fieldID = jni::get_field_id(env, Class, "value", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass ThumbnailFormat::Class;

object_ptr<ThumbnailFormat> ThumbnailFormat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case thumbnailFormatJpeg::ID:
      return thumbnailFormatJpeg::fetch(env, p);
    case thumbnailFormatGif::ID:
      return thumbnailFormatGif::fetch(env, p);
    case thumbnailFormatMpeg4::ID:
      return thumbnailFormatMpeg4::fetch(env, p);
    case thumbnailFormatPng::ID:
      return thumbnailFormatPng::fetch(env, p);
    case thumbnailFormatTgs::ID:
      return thumbnailFormatTgs::fetch(env, p);
    case thumbnailFormatWebm::ID:
      return thumbnailFormatWebm::fetch(env, p);
    case thumbnailFormatWebp::ID:
      return thumbnailFormatWebp::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void ThumbnailFormat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormat").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatJpeg::Class;

thumbnailFormatJpeg::thumbnailFormatJpeg() {
}

const std::int32_t thumbnailFormatJpeg::ID;

object_ptr<ThumbnailFormat> thumbnailFormatJpeg::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatJpeg>();
}

void thumbnailFormatJpeg::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatJpeg::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatJpeg");
    s.store_class_end();
  }
}

void thumbnailFormatJpeg::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatJpeg").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatGif::Class;

thumbnailFormatGif::thumbnailFormatGif() {
}

const std::int32_t thumbnailFormatGif::ID;

object_ptr<ThumbnailFormat> thumbnailFormatGif::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatGif>();
}

void thumbnailFormatGif::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatGif::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatGif");
    s.store_class_end();
  }
}

void thumbnailFormatGif::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatGif").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatMpeg4::Class;

thumbnailFormatMpeg4::thumbnailFormatMpeg4() {
}

const std::int32_t thumbnailFormatMpeg4::ID;

object_ptr<ThumbnailFormat> thumbnailFormatMpeg4::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatMpeg4>();
}

void thumbnailFormatMpeg4::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatMpeg4::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatMpeg4");
    s.store_class_end();
  }
}

void thumbnailFormatMpeg4::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatMpeg4").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatPng::Class;

thumbnailFormatPng::thumbnailFormatPng() {
}

const std::int32_t thumbnailFormatPng::ID;

object_ptr<ThumbnailFormat> thumbnailFormatPng::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatPng>();
}

void thumbnailFormatPng::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatPng::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatPng");
    s.store_class_end();
  }
}

void thumbnailFormatPng::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatPng").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatTgs::Class;

thumbnailFormatTgs::thumbnailFormatTgs() {
}

const std::int32_t thumbnailFormatTgs::ID;

object_ptr<ThumbnailFormat> thumbnailFormatTgs::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatTgs>();
}

void thumbnailFormatTgs::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatTgs::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatTgs");
    s.store_class_end();
  }
}

void thumbnailFormatTgs::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatTgs").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatWebm::Class;

thumbnailFormatWebm::thumbnailFormatWebm() {
}

const std::int32_t thumbnailFormatWebm::ID;

object_ptr<ThumbnailFormat> thumbnailFormatWebm::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatWebm>();
}

void thumbnailFormatWebm::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatWebm::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatWebm");
    s.store_class_end();
  }
}

void thumbnailFormatWebm::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatWebm").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass thumbnailFormatWebp::Class;

thumbnailFormatWebp::thumbnailFormatWebp() {
}

const std::int32_t thumbnailFormatWebp::ID;

object_ptr<ThumbnailFormat> thumbnailFormatWebp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<thumbnailFormatWebp>();
}

void thumbnailFormatWebp::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
}

void thumbnailFormatWebp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThumbnailFormatWebp");
    s.store_class_end();
  }
}

void thumbnailFormatWebp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThumbnailFormatWebp").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass tonRevenueStatistics::Class;
jfieldID tonRevenueStatistics::revenue_by_day_graph_fieldID;
jfieldID tonRevenueStatistics::status_fieldID;
jfieldID tonRevenueStatistics::usd_rate_fieldID;

tonRevenueStatistics::tonRevenueStatistics()
  : revenue_by_day_graph_()
  , status_()
  , usd_rate_()
{}

tonRevenueStatistics::tonRevenueStatistics(object_ptr<StatisticalGraph> &&revenue_by_day_graph_, object_ptr<tonRevenueStatus> &&status_, double usd_rate_)
  : revenue_by_day_graph_(std::move(revenue_by_day_graph_))
  , status_(std::move(status_))
  , usd_rate_(usd_rate_)
{}

const std::int32_t tonRevenueStatistics::ID;

object_ptr<tonRevenueStatistics> tonRevenueStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonRevenueStatistics> res = make_object<tonRevenueStatistics>();
  res->revenue_by_day_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->revenue_by_day_graph_fieldID));
  res->status_ = jni::fetch_tl_object<tonRevenueStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  res->usd_rate_ = env->GetDoubleField(p, res->usd_rate_fieldID);
  return res;
}

void tonRevenueStatistics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (revenue_by_day_graph_ != nullptr) { jobject next; revenue_by_day_graph_->store(env, next); if (next) { env->SetObjectField(s, revenue_by_day_graph_fieldID, next); env->DeleteLocalRef(next); } }
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetDoubleField(s, usd_rate_fieldID, usd_rate_);
}

void tonRevenueStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TonRevenueStatistics");
    s.store_object_field("revenueByDayGraph", static_cast<const BaseObject *>(revenue_by_day_graph_.get()));
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_field("usdRate", usd_rate_);
    s.store_class_end();
  }
}

void tonRevenueStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TonRevenueStatistics").c_str());
    revenue_by_day_graph_fieldID = jni::get_field_id(env, Class, "revenueByDayGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TonRevenueStatus;").c_str());
    usd_rate_fieldID = jni::get_field_id(env, Class, "usdRate", "D");
    return true;
  }();
  (void)is_inited;
}

jclass tonTransaction::Class;
jfieldID tonTransaction::id_fieldID;
jfieldID tonTransaction::ton_amount_fieldID;
jfieldID tonTransaction::is_refund_fieldID;
jfieldID tonTransaction::date_fieldID;
jfieldID tonTransaction::type_fieldID;

tonTransaction::tonTransaction()
  : id_()
  , ton_amount_()
  , is_refund_()
  , date_()
  , type_()
{}

tonTransaction::tonTransaction(string const &id_, int53 ton_amount_, bool is_refund_, int32 date_, object_ptr<TonTransactionType> &&type_)
  : id_(id_)
  , ton_amount_(ton_amount_)
  , is_refund_(is_refund_)
  , date_(date_)
  , type_(std::move(type_))
{}

const std::int32_t tonTransaction::ID;

object_ptr<tonTransaction> tonTransaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonTransaction> res = make_object<tonTransaction>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->ton_amount_ = env->GetLongField(p, res->ton_amount_fieldID);
  res->is_refund_ = (env->GetBooleanField(p, res->is_refund_fieldID) != 0);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->type_ = jni::fetch_tl_object<TonTransactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void tonTransaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, ton_amount_fieldID, ton_amount_);
  env->SetBooleanField(s, is_refund_fieldID, is_refund_);
  env->SetIntField(s, date_fieldID, date_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void tonTransaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TonTransaction");
    s.store_field("id", id_);
    s.store_field("tonAmount", ton_amount_);
    s.store_field("isRefund", is_refund_);
    s.store_field("date", date_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void tonTransaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TonTransaction").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    ton_amount_fieldID = jni::get_field_id(env, Class, "tonAmount", "J");
    is_refund_fieldID = jni::get_field_id(env, Class, "isRefund", "Z");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TonTransactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass Update::Class;

object_ptr<Update> Update::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case updateAuthorizationState::ID:
      return updateAuthorizationState::fetch(env, p);
    case updateNewMessage::ID:
      return updateNewMessage::fetch(env, p);
    case updateMessageSendAcknowledged::ID:
      return updateMessageSendAcknowledged::fetch(env, p);
    case updateMessageSendSucceeded::ID:
      return updateMessageSendSucceeded::fetch(env, p);
    case updateMessageSendFailed::ID:
      return updateMessageSendFailed::fetch(env, p);
    case updateMessageContent::ID:
      return updateMessageContent::fetch(env, p);
    case updateMessageEdited::ID:
      return updateMessageEdited::fetch(env, p);
    case updateMessageIsPinned::ID:
      return updateMessageIsPinned::fetch(env, p);
    case updateMessageInteractionInfo::ID:
      return updateMessageInteractionInfo::fetch(env, p);
    case updateMessageContentOpened::ID:
      return updateMessageContentOpened::fetch(env, p);
    case updateMessageMentionRead::ID:
      return updateMessageMentionRead::fetch(env, p);
    case updateMessageUnreadReactions::ID:
      return updateMessageUnreadReactions::fetch(env, p);
    case updateMessageContainsUnreadPollVotes::ID:
      return updateMessageContainsUnreadPollVotes::fetch(env, p);
    case updateMessageFactCheck::ID:
      return updateMessageFactCheck::fetch(env, p);
    case updateMessageSuggestedPostInfo::ID:
      return updateMessageSuggestedPostInfo::fetch(env, p);
    case updateMessageLiveLocationViewed::ID:
      return updateMessageLiveLocationViewed::fetch(env, p);
    case updateVideoPublished::ID:
      return updateVideoPublished::fetch(env, p);
    case updateNewChat::ID:
      return updateNewChat::fetch(env, p);
    case updateChatTitle::ID:
      return updateChatTitle::fetch(env, p);
    case updateChatPhoto::ID:
      return updateChatPhoto::fetch(env, p);
    case updateChatAccentColors::ID:
      return updateChatAccentColors::fetch(env, p);
    case updateChatPermissions::ID:
      return updateChatPermissions::fetch(env, p);
    case updateChatLastMessage::ID:
      return updateChatLastMessage::fetch(env, p);
    case updateChatPosition::ID:
      return updateChatPosition::fetch(env, p);
    case updateChatAddedToList::ID:
      return updateChatAddedToList::fetch(env, p);
    case updateChatRemovedFromList::ID:
      return updateChatRemovedFromList::fetch(env, p);
    case updateChatReadInbox::ID:
      return updateChatReadInbox::fetch(env, p);
    case updateChatReadOutbox::ID:
      return updateChatReadOutbox::fetch(env, p);
    case updateChatActionBar::ID:
      return updateChatActionBar::fetch(env, p);
    case updateChatBusinessBotManageBar::ID:
      return updateChatBusinessBotManageBar::fetch(env, p);
    case updateChatAvailableReactions::ID:
      return updateChatAvailableReactions::fetch(env, p);
    case updateChatDraftMessage::ID:
      return updateChatDraftMessage::fetch(env, p);
    case updateChatEmojiStatus::ID:
      return updateChatEmojiStatus::fetch(env, p);
    case updateChatMessageSender::ID:
      return updateChatMessageSender::fetch(env, p);
    case updateChatMessageAutoDeleteTime::ID:
      return updateChatMessageAutoDeleteTime::fetch(env, p);
    case updateChatNotificationSettings::ID:
      return updateChatNotificationSettings::fetch(env, p);
    case updateChatPendingJoinRequests::ID:
      return updateChatPendingJoinRequests::fetch(env, p);
    case updateChatReplyMarkup::ID:
      return updateChatReplyMarkup::fetch(env, p);
    case updateChatBackground::ID:
      return updateChatBackground::fetch(env, p);
    case updateChatTheme::ID:
      return updateChatTheme::fetch(env, p);
    case updateChatUnreadMentionCount::ID:
      return updateChatUnreadMentionCount::fetch(env, p);
    case updateChatUnreadReactionCount::ID:
      return updateChatUnreadReactionCount::fetch(env, p);
    case updateChatUnreadPollVoteCount::ID:
      return updateChatUnreadPollVoteCount::fetch(env, p);
    case updateChatVideoChat::ID:
      return updateChatVideoChat::fetch(env, p);
    case updateChatDefaultDisableNotification::ID:
      return updateChatDefaultDisableNotification::fetch(env, p);
    case updateChatHasProtectedContent::ID:
      return updateChatHasProtectedContent::fetch(env, p);
    case updateChatIsTranslatable::ID:
      return updateChatIsTranslatable::fetch(env, p);
    case updateChatIsMarkedAsUnread::ID:
      return updateChatIsMarkedAsUnread::fetch(env, p);
    case updateChatViewAsTopics::ID:
      return updateChatViewAsTopics::fetch(env, p);
    case updateChatBlockList::ID:
      return updateChatBlockList::fetch(env, p);
    case updateChatHasScheduledMessages::ID:
      return updateChatHasScheduledMessages::fetch(env, p);
    case updateChatFolders::ID:
      return updateChatFolders::fetch(env, p);
    case updateChatOnlineMemberCount::ID:
      return updateChatOnlineMemberCount::fetch(env, p);
    case updateSavedMessagesTopic::ID:
      return updateSavedMessagesTopic::fetch(env, p);
    case updateSavedMessagesTopicCount::ID:
      return updateSavedMessagesTopicCount::fetch(env, p);
    case updateDirectMessagesChatTopic::ID:
      return updateDirectMessagesChatTopic::fetch(env, p);
    case updateTopicMessageCount::ID:
      return updateTopicMessageCount::fetch(env, p);
    case updateQuickReplyShortcut::ID:
      return updateQuickReplyShortcut::fetch(env, p);
    case updateQuickReplyShortcutDeleted::ID:
      return updateQuickReplyShortcutDeleted::fetch(env, p);
    case updateQuickReplyShortcuts::ID:
      return updateQuickReplyShortcuts::fetch(env, p);
    case updateQuickReplyShortcutMessages::ID:
      return updateQuickReplyShortcutMessages::fetch(env, p);
    case updateForumTopicInfo::ID:
      return updateForumTopicInfo::fetch(env, p);
    case updateForumTopic::ID:
      return updateForumTopic::fetch(env, p);
    case updateScopeNotificationSettings::ID:
      return updateScopeNotificationSettings::fetch(env, p);
    case updateReactionNotificationSettings::ID:
      return updateReactionNotificationSettings::fetch(env, p);
    case updateNotification::ID:
      return updateNotification::fetch(env, p);
    case updateNotificationGroup::ID:
      return updateNotificationGroup::fetch(env, p);
    case updateActiveNotifications::ID:
      return updateActiveNotifications::fetch(env, p);
    case updateHavePendingNotifications::ID:
      return updateHavePendingNotifications::fetch(env, p);
    case updateDeleteMessages::ID:
      return updateDeleteMessages::fetch(env, p);
    case updateChatAction::ID:
      return updateChatAction::fetch(env, p);
    case updatePendingTextMessage::ID:
      return updatePendingTextMessage::fetch(env, p);
    case updateUserStatus::ID:
      return updateUserStatus::fetch(env, p);
    case updateUser::ID:
      return updateUser::fetch(env, p);
    case updateBasicGroup::ID:
      return updateBasicGroup::fetch(env, p);
    case updateSupergroup::ID:
      return updateSupergroup::fetch(env, p);
    case updateSecretChat::ID:
      return updateSecretChat::fetch(env, p);
    case updateUserFullInfo::ID:
      return updateUserFullInfo::fetch(env, p);
    case updateBasicGroupFullInfo::ID:
      return updateBasicGroupFullInfo::fetch(env, p);
    case updateSupergroupFullInfo::ID:
      return updateSupergroupFullInfo::fetch(env, p);
    case updateServiceNotification::ID:
      return updateServiceNotification::fetch(env, p);
    case updateNewOauthRequest::ID:
      return updateNewOauthRequest::fetch(env, p);
    case updateFile::ID:
      return updateFile::fetch(env, p);
    case updateFileGenerationStart::ID:
      return updateFileGenerationStart::fetch(env, p);
    case updateFileGenerationStop::ID:
      return updateFileGenerationStop::fetch(env, p);
    case updateFileDownloads::ID:
      return updateFileDownloads::fetch(env, p);
    case updateFileAddedToDownloads::ID:
      return updateFileAddedToDownloads::fetch(env, p);
    case updateFileDownload::ID:
      return updateFileDownload::fetch(env, p);
    case updateFileRemovedFromDownloads::ID:
      return updateFileRemovedFromDownloads::fetch(env, p);
    case updateApplicationVerificationRequired::ID:
      return updateApplicationVerificationRequired::fetch(env, p);
    case updateApplicationRecaptchaVerificationRequired::ID:
      return updateApplicationRecaptchaVerificationRequired::fetch(env, p);
    case updateCall::ID:
      return updateCall::fetch(env, p);
    case updateGroupCall::ID:
      return updateGroupCall::fetch(env, p);
    case updateGroupCallParticipant::ID:
      return updateGroupCallParticipant::fetch(env, p);
    case updateGroupCallParticipants::ID:
      return updateGroupCallParticipants::fetch(env, p);
    case updateGroupCallVerificationState::ID:
      return updateGroupCallVerificationState::fetch(env, p);
    case updateNewGroupCallMessage::ID:
      return updateNewGroupCallMessage::fetch(env, p);
    case updateNewGroupCallPaidReaction::ID:
      return updateNewGroupCallPaidReaction::fetch(env, p);
    case updateGroupCallMessageSendFailed::ID:
      return updateGroupCallMessageSendFailed::fetch(env, p);
    case updateGroupCallMessagesDeleted::ID:
      return updateGroupCallMessagesDeleted::fetch(env, p);
    case updateLiveStoryTopDonors::ID:
      return updateLiveStoryTopDonors::fetch(env, p);
    case updateNewCallSignalingData::ID:
      return updateNewCallSignalingData::fetch(env, p);
    case updateGiftAuctionState::ID:
      return updateGiftAuctionState::fetch(env, p);
    case updateActiveGiftAuctions::ID:
      return updateActiveGiftAuctions::fetch(env, p);
    case updateUserPrivacySettingRules::ID:
      return updateUserPrivacySettingRules::fetch(env, p);
    case updateUnreadMessageCount::ID:
      return updateUnreadMessageCount::fetch(env, p);
    case updateUnreadChatCount::ID:
      return updateUnreadChatCount::fetch(env, p);
    case updateStory::ID:
      return updateStory::fetch(env, p);
    case updateStoryDeleted::ID:
      return updateStoryDeleted::fetch(env, p);
    case updateStoryPostSucceeded::ID:
      return updateStoryPostSucceeded::fetch(env, p);
    case updateStoryPostFailed::ID:
      return updateStoryPostFailed::fetch(env, p);
    case updateChatActiveStories::ID:
      return updateChatActiveStories::fetch(env, p);
    case updateStoryListChatCount::ID:
      return updateStoryListChatCount::fetch(env, p);
    case updateStoryStealthMode::ID:
      return updateStoryStealthMode::fetch(env, p);
    case updateTrustedMiniAppBots::ID:
      return updateTrustedMiniAppBots::fetch(env, p);
    case updateOption::ID:
      return updateOption::fetch(env, p);
    case updateStickerSet::ID:
      return updateStickerSet::fetch(env, p);
    case updateInstalledStickerSets::ID:
      return updateInstalledStickerSets::fetch(env, p);
    case updateTrendingStickerSets::ID:
      return updateTrendingStickerSets::fetch(env, p);
    case updateRecentStickers::ID:
      return updateRecentStickers::fetch(env, p);
    case updateFavoriteStickers::ID:
      return updateFavoriteStickers::fetch(env, p);
    case updateSavedAnimations::ID:
      return updateSavedAnimations::fetch(env, p);
    case updateSavedNotificationSounds::ID:
      return updateSavedNotificationSounds::fetch(env, p);
    case updateDefaultBackground::ID:
      return updateDefaultBackground::fetch(env, p);
    case updateEmojiChatThemes::ID:
      return updateEmojiChatThemes::fetch(env, p);
    case updateAccentColors::ID:
      return updateAccentColors::fetch(env, p);
    case updateProfileAccentColors::ID:
      return updateProfileAccentColors::fetch(env, p);
    case updateLanguagePackStrings::ID:
      return updateLanguagePackStrings::fetch(env, p);
    case updateConnectionState::ID:
      return updateConnectionState::fetch(env, p);
    case updateFreezeState::ID:
      return updateFreezeState::fetch(env, p);
    case updateAgeVerificationParameters::ID:
      return updateAgeVerificationParameters::fetch(env, p);
    case updateTermsOfService::ID:
      return updateTermsOfService::fetch(env, p);
    case updateUnconfirmedSession::ID:
      return updateUnconfirmedSession::fetch(env, p);
    case updateAttachmentMenuBots::ID:
      return updateAttachmentMenuBots::fetch(env, p);
    case updateWebAppMessageSent::ID:
      return updateWebAppMessageSent::fetch(env, p);
    case updateActiveEmojiReactions::ID:
      return updateActiveEmojiReactions::fetch(env, p);
    case updateAvailableMessageEffects::ID:
      return updateAvailableMessageEffects::fetch(env, p);
    case updateDefaultReactionType::ID:
      return updateDefaultReactionType::fetch(env, p);
    case updateDefaultPaidReactionType::ID:
      return updateDefaultPaidReactionType::fetch(env, p);
    case updateSavedMessagesTags::ID:
      return updateSavedMessagesTags::fetch(env, p);
    case updateActiveLiveLocationMessages::ID:
      return updateActiveLiveLocationMessages::fetch(env, p);
    case updateOwnedStarCount::ID:
      return updateOwnedStarCount::fetch(env, p);
    case updateOwnedTonCount::ID:
      return updateOwnedTonCount::fetch(env, p);
    case updateChatRevenueAmount::ID:
      return updateChatRevenueAmount::fetch(env, p);
    case updateStarRevenueStatus::ID:
      return updateStarRevenueStatus::fetch(env, p);
    case updateTonRevenueStatus::ID:
      return updateTonRevenueStatus::fetch(env, p);
    case updateSpeechRecognitionTrial::ID:
      return updateSpeechRecognitionTrial::fetch(env, p);
    case updateGroupCallMessageLevels::ID:
      return updateGroupCallMessageLevels::fetch(env, p);
    case updateDiceEmojis::ID:
      return updateDiceEmojis::fetch(env, p);
    case updateStakeDiceState::ID:
      return updateStakeDiceState::fetch(env, p);
    case updateAnimatedEmojiMessageClicked::ID:
      return updateAnimatedEmojiMessageClicked::fetch(env, p);
    case updateAnimationSearchParameters::ID:
      return updateAnimationSearchParameters::fetch(env, p);
    case updateTextCompositionStyles::ID:
      return updateTextCompositionStyles::fetch(env, p);
    case updateSuggestedActions::ID:
      return updateSuggestedActions::fetch(env, p);
    case updateSpeedLimitNotification::ID:
      return updateSpeedLimitNotification::fetch(env, p);
    case updateContactCloseBirthdays::ID:
      return updateContactCloseBirthdays::fetch(env, p);
    case updateAutosaveSettings::ID:
      return updateAutosaveSettings::fetch(env, p);
    case updateBusinessConnection::ID:
      return updateBusinessConnection::fetch(env, p);
    case updateNewBusinessMessage::ID:
      return updateNewBusinessMessage::fetch(env, p);
    case updateBusinessMessageEdited::ID:
      return updateBusinessMessageEdited::fetch(env, p);
    case updateBusinessMessagesDeleted::ID:
      return updateBusinessMessagesDeleted::fetch(env, p);
    case updateNewInlineQuery::ID:
      return updateNewInlineQuery::fetch(env, p);
    case updateNewChosenInlineResult::ID:
      return updateNewChosenInlineResult::fetch(env, p);
    case updateNewGuestQuery::ID:
      return updateNewGuestQuery::fetch(env, p);
    case updateNewCallbackQuery::ID:
      return updateNewCallbackQuery::fetch(env, p);
    case updateNewInlineCallbackQuery::ID:
      return updateNewInlineCallbackQuery::fetch(env, p);
    case updateNewBusinessCallbackQuery::ID:
      return updateNewBusinessCallbackQuery::fetch(env, p);
    case updateNewShippingQuery::ID:
      return updateNewShippingQuery::fetch(env, p);
    case updateNewPreCheckoutQuery::ID:
      return updateNewPreCheckoutQuery::fetch(env, p);
    case updateNewCustomEvent::ID:
      return updateNewCustomEvent::fetch(env, p);
    case updateNewCustomQuery::ID:
      return updateNewCustomQuery::fetch(env, p);
    case updatePoll::ID:
      return updatePoll::fetch(env, p);
    case updatePollAnswer::ID:
      return updatePollAnswer::fetch(env, p);
    case updateManagedBot::ID:
      return updateManagedBot::fetch(env, p);
    case updateChatMember::ID:
      return updateChatMember::fetch(env, p);
    case updateNewChatJoinRequest::ID:
      return updateNewChatJoinRequest::fetch(env, p);
    case updateChatBoost::ID:
      return updateChatBoost::fetch(env, p);
    case updateMessageReaction::ID:
      return updateMessageReaction::fetch(env, p);
    case updateMessageReactions::ID:
      return updateMessageReactions::fetch(env, p);
    case updatePaidMediaPurchased::ID:
      return updatePaidMediaPurchased::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

void Update::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Update").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateAuthorizationState::Class;
jfieldID updateAuthorizationState::authorization_state_fieldID;

updateAuthorizationState::updateAuthorizationState()
  : authorization_state_()
{}

updateAuthorizationState::updateAuthorizationState(object_ptr<AuthorizationState> &&authorization_state_)
  : authorization_state_(std::move(authorization_state_))
{}

const std::int32_t updateAuthorizationState::ID;

object_ptr<Update> updateAuthorizationState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAuthorizationState> res = make_object<updateAuthorizationState>();
  res->authorization_state_ = jni::fetch_tl_object<AuthorizationState>(env, jni::fetch_object(env, p, res->authorization_state_fieldID));
  return std::move(res);
}

void updateAuthorizationState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (authorization_state_ != nullptr) { jobject next; authorization_state_->store(env, next); if (next) { env->SetObjectField(s, authorization_state_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateAuthorizationState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAuthorizationState");
    s.store_object_field("authorizationState", static_cast<const BaseObject *>(authorization_state_.get()));
    s.store_class_end();
  }
}

void updateAuthorizationState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAuthorizationState").c_str());
    authorization_state_fieldID = jni::get_field_id(env, Class, "authorizationState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AuthorizationState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewMessage::Class;
jfieldID updateNewMessage::message_fieldID;

updateNewMessage::updateNewMessage()
  : message_()
{}

updateNewMessage::updateNewMessage(object_ptr<message> &&message_)
  : message_(std::move(message_))
{}

const std::int32_t updateNewMessage::ID;

object_ptr<Update> updateNewMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewMessage> res = make_object<updateNewMessage>();
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  return std::move(res);
}

void updateNewMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewMessage");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void updateNewMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewMessage").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageSendAcknowledged::Class;
jfieldID updateMessageSendAcknowledged::chat_id_fieldID;
jfieldID updateMessageSendAcknowledged::message_id_fieldID;

updateMessageSendAcknowledged::updateMessageSendAcknowledged()
  : chat_id_()
  , message_id_()
{}

updateMessageSendAcknowledged::updateMessageSendAcknowledged(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t updateMessageSendAcknowledged::ID;

object_ptr<Update> updateMessageSendAcknowledged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageSendAcknowledged> res = make_object<updateMessageSendAcknowledged>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return std::move(res);
}

void updateMessageSendAcknowledged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
}

void updateMessageSendAcknowledged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageSendAcknowledged");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

void updateMessageSendAcknowledged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageSendAcknowledged").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageSendSucceeded::Class;
jfieldID updateMessageSendSucceeded::message_fieldID;
jfieldID updateMessageSendSucceeded::old_message_id_fieldID;

updateMessageSendSucceeded::updateMessageSendSucceeded()
  : message_()
  , old_message_id_()
{}

updateMessageSendSucceeded::updateMessageSendSucceeded(object_ptr<message> &&message_, int53 old_message_id_)
  : message_(std::move(message_))
  , old_message_id_(old_message_id_)
{}

const std::int32_t updateMessageSendSucceeded::ID;

object_ptr<Update> updateMessageSendSucceeded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageSendSucceeded> res = make_object<updateMessageSendSucceeded>();
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->old_message_id_ = env->GetLongField(p, res->old_message_id_fieldID);
  return std::move(res);
}

void updateMessageSendSucceeded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, old_message_id_fieldID, old_message_id_);
}

void updateMessageSendSucceeded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageSendSucceeded");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_field("oldMessageId", old_message_id_);
    s.store_class_end();
  }
}

void updateMessageSendSucceeded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageSendSucceeded").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    old_message_id_fieldID = jni::get_field_id(env, Class, "oldMessageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageSendFailed::Class;
jfieldID updateMessageSendFailed::message_fieldID;
jfieldID updateMessageSendFailed::old_message_id_fieldID;
jfieldID updateMessageSendFailed::error_fieldID;

updateMessageSendFailed::updateMessageSendFailed()
  : message_()
  , old_message_id_()
  , error_()
{}

updateMessageSendFailed::updateMessageSendFailed(object_ptr<message> &&message_, int53 old_message_id_, object_ptr<error> &&error_)
  : message_(std::move(message_))
  , old_message_id_(old_message_id_)
  , error_(std::move(error_))
{}

const std::int32_t updateMessageSendFailed::ID;

object_ptr<Update> updateMessageSendFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageSendFailed> res = make_object<updateMessageSendFailed>();
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->old_message_id_ = env->GetLongField(p, res->old_message_id_fieldID);
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  return std::move(res);
}

void updateMessageSendFailed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, old_message_id_fieldID, old_message_id_);
  if (error_ != nullptr) { jobject next; error_->store(env, next); if (next) { env->SetObjectField(s, error_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateMessageSendFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageSendFailed");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_field("oldMessageId", old_message_id_);
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_class_end();
  }
}

void updateMessageSendFailed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageSendFailed").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    old_message_id_fieldID = jni::get_field_id(env, Class, "oldMessageId", "J");
    error_fieldID = jni::get_field_id(env, Class, "error", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Error;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageContent::Class;
jfieldID updateMessageContent::chat_id_fieldID;
jfieldID updateMessageContent::message_id_fieldID;
jfieldID updateMessageContent::new_content_fieldID;

updateMessageContent::updateMessageContent()
  : chat_id_()
  , message_id_()
  , new_content_()
{}

updateMessageContent::updateMessageContent(int53 chat_id_, int53 message_id_, object_ptr<MessageContent> &&new_content_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , new_content_(std::move(new_content_))
{}

const std::int32_t updateMessageContent::ID;

object_ptr<Update> updateMessageContent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageContent> res = make_object<updateMessageContent>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->new_content_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->new_content_fieldID));
  return std::move(res);
}

void updateMessageContent::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (new_content_ != nullptr) { jobject next; new_content_->store(env, next); if (next) { env->SetObjectField(s, new_content_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateMessageContent::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageContent");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("newContent", static_cast<const BaseObject *>(new_content_.get()));
    s.store_class_end();
  }
}

void updateMessageContent::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageContent").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    new_content_fieldID = jni::get_field_id(env, Class, "newContent", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageEdited::Class;
jfieldID updateMessageEdited::chat_id_fieldID;
jfieldID updateMessageEdited::message_id_fieldID;
jfieldID updateMessageEdited::edit_date_fieldID;
jfieldID updateMessageEdited::reply_markup_fieldID;

updateMessageEdited::updateMessageEdited()
  : chat_id_()
  , message_id_()
  , edit_date_()
  , reply_markup_()
{}

updateMessageEdited::updateMessageEdited(int53 chat_id_, int53 message_id_, int32 edit_date_, object_ptr<ReplyMarkup> &&reply_markup_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , edit_date_(edit_date_)
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t updateMessageEdited::ID;

object_ptr<Update> updateMessageEdited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageEdited> res = make_object<updateMessageEdited>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->edit_date_ = env->GetIntField(p, res->edit_date_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  return std::move(res);
}

void updateMessageEdited::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetIntField(s, edit_date_fieldID, edit_date_);
  if (reply_markup_ != nullptr) { jobject next; reply_markup_->store(env, next); if (next) { env->SetObjectField(s, reply_markup_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateMessageEdited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageEdited");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("editDate", edit_date_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_class_end();
  }
}

void updateMessageEdited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageEdited").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    edit_date_fieldID = jni::get_field_id(env, Class, "editDate", "I");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageIsPinned::Class;
jfieldID updateMessageIsPinned::chat_id_fieldID;
jfieldID updateMessageIsPinned::message_id_fieldID;
jfieldID updateMessageIsPinned::is_pinned_fieldID;

updateMessageIsPinned::updateMessageIsPinned()
  : chat_id_()
  , message_id_()
  , is_pinned_()
{}

updateMessageIsPinned::updateMessageIsPinned(int53 chat_id_, int53 message_id_, bool is_pinned_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t updateMessageIsPinned::ID;

object_ptr<Update> updateMessageIsPinned::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageIsPinned> res = make_object<updateMessageIsPinned>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void updateMessageIsPinned::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void updateMessageIsPinned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageIsPinned");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void updateMessageIsPinned::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageIsPinned").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageInteractionInfo::Class;
jfieldID updateMessageInteractionInfo::chat_id_fieldID;
jfieldID updateMessageInteractionInfo::message_id_fieldID;
jfieldID updateMessageInteractionInfo::interaction_info_fieldID;

updateMessageInteractionInfo::updateMessageInteractionInfo()
  : chat_id_()
  , message_id_()
  , interaction_info_()
{}

updateMessageInteractionInfo::updateMessageInteractionInfo(int53 chat_id_, int53 message_id_, object_ptr<messageInteractionInfo> &&interaction_info_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , interaction_info_(std::move(interaction_info_))
{}

const std::int32_t updateMessageInteractionInfo::ID;

object_ptr<Update> updateMessageInteractionInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageInteractionInfo> res = make_object<updateMessageInteractionInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->interaction_info_ = jni::fetch_tl_object<messageInteractionInfo>(env, jni::fetch_object(env, p, res->interaction_info_fieldID));
  return std::move(res);
}

void updateMessageInteractionInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (interaction_info_ != nullptr) { jobject next; interaction_info_->store(env, next); if (next) { env->SetObjectField(s, interaction_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateMessageInteractionInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageInteractionInfo");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("interactionInfo", static_cast<const BaseObject *>(interaction_info_.get()));
    s.store_class_end();
  }
}

void updateMessageInteractionInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageInteractionInfo").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    interaction_info_fieldID = jni::get_field_id(env, Class, "interactionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageInteractionInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageContentOpened::Class;
jfieldID updateMessageContentOpened::chat_id_fieldID;
jfieldID updateMessageContentOpened::message_id_fieldID;

updateMessageContentOpened::updateMessageContentOpened()
  : chat_id_()
  , message_id_()
{}

updateMessageContentOpened::updateMessageContentOpened(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t updateMessageContentOpened::ID;

object_ptr<Update> updateMessageContentOpened::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageContentOpened> res = make_object<updateMessageContentOpened>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return std::move(res);
}

void updateMessageContentOpened::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
}

void updateMessageContentOpened::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageContentOpened");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

void updateMessageContentOpened::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageContentOpened").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageMentionRead::Class;
jfieldID updateMessageMentionRead::chat_id_fieldID;
jfieldID updateMessageMentionRead::message_id_fieldID;
jfieldID updateMessageMentionRead::unread_mention_count_fieldID;

updateMessageMentionRead::updateMessageMentionRead()
  : chat_id_()
  , message_id_()
  , unread_mention_count_()
{}

updateMessageMentionRead::updateMessageMentionRead(int53 chat_id_, int53 message_id_, int32 unread_mention_count_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , unread_mention_count_(unread_mention_count_)
{}

const std::int32_t updateMessageMentionRead::ID;

object_ptr<Update> updateMessageMentionRead::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageMentionRead> res = make_object<updateMessageMentionRead>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->unread_mention_count_ = env->GetIntField(p, res->unread_mention_count_fieldID);
  return std::move(res);
}

void updateMessageMentionRead::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetIntField(s, unread_mention_count_fieldID, unread_mention_count_);
}

void updateMessageMentionRead::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageMentionRead");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("unreadMentionCount", unread_mention_count_);
    s.store_class_end();
  }
}

void updateMessageMentionRead::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageMentionRead").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    unread_mention_count_fieldID = jni::get_field_id(env, Class, "unreadMentionCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageUnreadReactions::Class;
jfieldID updateMessageUnreadReactions::chat_id_fieldID;
jfieldID updateMessageUnreadReactions::message_id_fieldID;
jfieldID updateMessageUnreadReactions::unread_reactions_fieldID;
jfieldID updateMessageUnreadReactions::unread_reaction_count_fieldID;

updateMessageUnreadReactions::updateMessageUnreadReactions()
  : chat_id_()
  , message_id_()
  , unread_reactions_()
  , unread_reaction_count_()
{}

updateMessageUnreadReactions::updateMessageUnreadReactions(int53 chat_id_, int53 message_id_, array<object_ptr<unreadReaction>> &&unread_reactions_, int32 unread_reaction_count_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , unread_reactions_(std::move(unread_reactions_))
  , unread_reaction_count_(unread_reaction_count_)
{}

const std::int32_t updateMessageUnreadReactions::ID;

object_ptr<Update> updateMessageUnreadReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageUnreadReactions> res = make_object<updateMessageUnreadReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->unread_reactions_ = jni::FetchVector<unreadReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->unread_reactions_fieldID));
  res->unread_reaction_count_ = env->GetIntField(p, res->unread_reaction_count_fieldID);
  return std::move(res);
}

void updateMessageUnreadReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  { auto arr_tmp_ = jni::store_vector(env, unread_reactions_); if (arr_tmp_) { env->SetObjectField(s, unread_reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, unread_reaction_count_fieldID, unread_reaction_count_);
}

void updateMessageUnreadReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageUnreadReactions");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    { s.store_vector_begin("unreadReactions", unread_reactions_.size()); for (const auto &_value : unread_reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("unreadReactionCount", unread_reaction_count_);
    s.store_class_end();
  }
}

void updateMessageUnreadReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageUnreadReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    unread_reactions_fieldID = jni::get_field_id(env, Class, "unreadReactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UnreadReaction;").c_str());
    unread_reaction_count_fieldID = jni::get_field_id(env, Class, "unreadReactionCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageContainsUnreadPollVotes::Class;
jfieldID updateMessageContainsUnreadPollVotes::chat_id_fieldID;
jfieldID updateMessageContainsUnreadPollVotes::message_id_fieldID;
jfieldID updateMessageContainsUnreadPollVotes::contains_unread_poll_votes_fieldID;
jfieldID updateMessageContainsUnreadPollVotes::unread_poll_vote_count_fieldID;

updateMessageContainsUnreadPollVotes::updateMessageContainsUnreadPollVotes()
  : chat_id_()
  , message_id_()
  , contains_unread_poll_votes_()
  , unread_poll_vote_count_()
{}

updateMessageContainsUnreadPollVotes::updateMessageContainsUnreadPollVotes(int53 chat_id_, int53 message_id_, bool contains_unread_poll_votes_, int32 unread_poll_vote_count_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , contains_unread_poll_votes_(contains_unread_poll_votes_)
  , unread_poll_vote_count_(unread_poll_vote_count_)
{}

const std::int32_t updateMessageContainsUnreadPollVotes::ID;

object_ptr<Update> updateMessageContainsUnreadPollVotes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageContainsUnreadPollVotes> res = make_object<updateMessageContainsUnreadPollVotes>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->contains_unread_poll_votes_ = (env->GetBooleanField(p, res->contains_unread_poll_votes_fieldID) != 0);
  res->unread_poll_vote_count_ = env->GetIntField(p, res->unread_poll_vote_count_fieldID);
  return std::move(res);
}

void updateMessageContainsUnreadPollVotes::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetBooleanField(s, contains_unread_poll_votes_fieldID, contains_unread_poll_votes_);
  env->SetIntField(s, unread_poll_vote_count_fieldID, unread_poll_vote_count_);
}

void updateMessageContainsUnreadPollVotes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageContainsUnreadPollVotes");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("containsUnreadPollVotes", contains_unread_poll_votes_);
    s.store_field("unreadPollVoteCount", unread_poll_vote_count_);
    s.store_class_end();
  }
}

void updateMessageContainsUnreadPollVotes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageContainsUnreadPollVotes").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    contains_unread_poll_votes_fieldID = jni::get_field_id(env, Class, "containsUnreadPollVotes", "Z");
    unread_poll_vote_count_fieldID = jni::get_field_id(env, Class, "unreadPollVoteCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageFactCheck::Class;
jfieldID updateMessageFactCheck::chat_id_fieldID;
jfieldID updateMessageFactCheck::message_id_fieldID;
jfieldID updateMessageFactCheck::fact_check_fieldID;

updateMessageFactCheck::updateMessageFactCheck()
  : chat_id_()
  , message_id_()
  , fact_check_()
{}

updateMessageFactCheck::updateMessageFactCheck(int53 chat_id_, int53 message_id_, object_ptr<factCheck> &&fact_check_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , fact_check_(std::move(fact_check_))
{}

const std::int32_t updateMessageFactCheck::ID;

object_ptr<Update> updateMessageFactCheck::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageFactCheck> res = make_object<updateMessageFactCheck>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->fact_check_ = jni::fetch_tl_object<factCheck>(env, jni::fetch_object(env, p, res->fact_check_fieldID));
  return std::move(res);
}

void updateMessageFactCheck::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (fact_check_ != nullptr) { jobject next; fact_check_->store(env, next); if (next) { env->SetObjectField(s, fact_check_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateMessageFactCheck::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageFactCheck");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("factCheck", static_cast<const BaseObject *>(fact_check_.get()));
    s.store_class_end();
  }
}

void updateMessageFactCheck::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageFactCheck").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    fact_check_fieldID = jni::get_field_id(env, Class, "factCheck", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FactCheck;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageSuggestedPostInfo::Class;
jfieldID updateMessageSuggestedPostInfo::chat_id_fieldID;
jfieldID updateMessageSuggestedPostInfo::message_id_fieldID;
jfieldID updateMessageSuggestedPostInfo::suggested_post_info_fieldID;

updateMessageSuggestedPostInfo::updateMessageSuggestedPostInfo()
  : chat_id_()
  , message_id_()
  , suggested_post_info_()
{}

updateMessageSuggestedPostInfo::updateMessageSuggestedPostInfo(int53 chat_id_, int53 message_id_, object_ptr<suggestedPostInfo> &&suggested_post_info_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , suggested_post_info_(std::move(suggested_post_info_))
{}

const std::int32_t updateMessageSuggestedPostInfo::ID;

object_ptr<Update> updateMessageSuggestedPostInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageSuggestedPostInfo> res = make_object<updateMessageSuggestedPostInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->suggested_post_info_ = jni::fetch_tl_object<suggestedPostInfo>(env, jni::fetch_object(env, p, res->suggested_post_info_fieldID));
  return std::move(res);
}

void updateMessageSuggestedPostInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (suggested_post_info_ != nullptr) { jobject next; suggested_post_info_->store(env, next); if (next) { env->SetObjectField(s, suggested_post_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateMessageSuggestedPostInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageSuggestedPostInfo");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("suggestedPostInfo", static_cast<const BaseObject *>(suggested_post_info_.get()));
    s.store_class_end();
  }
}

void updateMessageSuggestedPostInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageSuggestedPostInfo").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    suggested_post_info_fieldID = jni::get_field_id(env, Class, "suggestedPostInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageLiveLocationViewed::Class;
jfieldID updateMessageLiveLocationViewed::chat_id_fieldID;
jfieldID updateMessageLiveLocationViewed::message_id_fieldID;

updateMessageLiveLocationViewed::updateMessageLiveLocationViewed()
  : chat_id_()
  , message_id_()
{}

updateMessageLiveLocationViewed::updateMessageLiveLocationViewed(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t updateMessageLiveLocationViewed::ID;

object_ptr<Update> updateMessageLiveLocationViewed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageLiveLocationViewed> res = make_object<updateMessageLiveLocationViewed>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return std::move(res);
}

void updateMessageLiveLocationViewed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
}

void updateMessageLiveLocationViewed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageLiveLocationViewed");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

void updateMessageLiveLocationViewed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageLiveLocationViewed").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateVideoPublished::Class;
jfieldID updateVideoPublished::chat_id_fieldID;
jfieldID updateVideoPublished::message_id_fieldID;

updateVideoPublished::updateVideoPublished()
  : chat_id_()
  , message_id_()
{}

updateVideoPublished::updateVideoPublished(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t updateVideoPublished::ID;

object_ptr<Update> updateVideoPublished::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateVideoPublished> res = make_object<updateVideoPublished>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return std::move(res);
}

void updateVideoPublished::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
}

void updateVideoPublished::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateVideoPublished");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

void updateVideoPublished::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateVideoPublished").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateNewChat::Class;
jfieldID updateNewChat::chat_fieldID;

updateNewChat::updateNewChat()
  : chat_()
{}

updateNewChat::updateNewChat(object_ptr<chat> &&chat_)
  : chat_(std::move(chat_))
{}

const std::int32_t updateNewChat::ID;

object_ptr<Update> updateNewChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewChat> res = make_object<updateNewChat>();
  res->chat_ = jni::fetch_tl_object<chat>(env, jni::fetch_object(env, p, res->chat_fieldID));
  return std::move(res);
}

void updateNewChat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (chat_ != nullptr) { jobject next; chat_->store(env, next); if (next) { env->SetObjectField(s, chat_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewChat");
    s.store_object_field("chat", static_cast<const BaseObject *>(chat_.get()));
    s.store_class_end();
  }
}

void updateNewChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewChat").c_str());
    chat_fieldID = jni::get_field_id(env, Class, "chat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Chat;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatTitle::Class;
jfieldID updateChatTitle::chat_id_fieldID;
jfieldID updateChatTitle::title_fieldID;

updateChatTitle::updateChatTitle()
  : chat_id_()
  , title_()
{}

updateChatTitle::updateChatTitle(int53 chat_id_, string const &title_)
  : chat_id_(chat_id_)
  , title_(title_)
{}

const std::int32_t updateChatTitle::ID;

object_ptr<Update> updateChatTitle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatTitle> res = make_object<updateChatTitle>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  return std::move(res);
}

void updateChatTitle::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateChatTitle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatTitle");
    s.store_field("chatId", chat_id_);
    s.store_field("title", title_);
    s.store_class_end();
  }
}

void updateChatTitle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatTitle").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatPhoto::Class;
jfieldID updateChatPhoto::chat_id_fieldID;
jfieldID updateChatPhoto::photo_fieldID;

updateChatPhoto::updateChatPhoto()
  : chat_id_()
  , photo_()
{}

updateChatPhoto::updateChatPhoto(int53 chat_id_, object_ptr<chatPhotoInfo> &&photo_)
  : chat_id_(chat_id_)
  , photo_(std::move(photo_))
{}

const std::int32_t updateChatPhoto::ID;

object_ptr<Update> updateChatPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatPhoto> res = make_object<updateChatPhoto>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->photo_ = jni::fetch_tl_object<chatPhotoInfo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return std::move(res);
}

void updateChatPhoto::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatPhoto");
    s.store_field("chatId", chat_id_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_class_end();
  }
}

void updateChatPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatPhoto").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhotoInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatAccentColors::Class;
jfieldID updateChatAccentColors::chat_id_fieldID;
jfieldID updateChatAccentColors::accent_color_id_fieldID;
jfieldID updateChatAccentColors::background_custom_emoji_id_fieldID;
jfieldID updateChatAccentColors::upgraded_gift_colors_fieldID;
jfieldID updateChatAccentColors::profile_accent_color_id_fieldID;
jfieldID updateChatAccentColors::profile_background_custom_emoji_id_fieldID;

updateChatAccentColors::updateChatAccentColors()
  : chat_id_()
  , accent_color_id_()
  , background_custom_emoji_id_()
  , upgraded_gift_colors_()
  , profile_accent_color_id_()
  , profile_background_custom_emoji_id_()
{}

updateChatAccentColors::updateChatAccentColors(int53 chat_id_, int32 accent_color_id_, int64 background_custom_emoji_id_, object_ptr<upgradedGiftColors> &&upgraded_gift_colors_, int32 profile_accent_color_id_, int64 profile_background_custom_emoji_id_)
  : chat_id_(chat_id_)
  , accent_color_id_(accent_color_id_)
  , background_custom_emoji_id_(background_custom_emoji_id_)
  , upgraded_gift_colors_(std::move(upgraded_gift_colors_))
  , profile_accent_color_id_(profile_accent_color_id_)
  , profile_background_custom_emoji_id_(profile_background_custom_emoji_id_)
{}

const std::int32_t updateChatAccentColors::ID;

object_ptr<Update> updateChatAccentColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatAccentColors> res = make_object<updateChatAccentColors>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->background_custom_emoji_id_ = env->GetLongField(p, res->background_custom_emoji_id_fieldID);
  res->upgraded_gift_colors_ = jni::fetch_tl_object<upgradedGiftColors>(env, jni::fetch_object(env, p, res->upgraded_gift_colors_fieldID));
  res->profile_accent_color_id_ = env->GetIntField(p, res->profile_accent_color_id_fieldID);
  res->profile_background_custom_emoji_id_ = env->GetLongField(p, res->profile_background_custom_emoji_id_fieldID);
  return std::move(res);
}

void updateChatAccentColors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, accent_color_id_fieldID, accent_color_id_);
  env->SetLongField(s, background_custom_emoji_id_fieldID, background_custom_emoji_id_);
  if (upgraded_gift_colors_ != nullptr) { jobject next; upgraded_gift_colors_->store(env, next); if (next) { env->SetObjectField(s, upgraded_gift_colors_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, profile_accent_color_id_fieldID, profile_accent_color_id_);
  env->SetLongField(s, profile_background_custom_emoji_id_fieldID, profile_background_custom_emoji_id_);
}

void updateChatAccentColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatAccentColors");
    s.store_field("chatId", chat_id_);
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("backgroundCustomEmojiId", background_custom_emoji_id_);
    s.store_object_field("upgradedGiftColors", static_cast<const BaseObject *>(upgraded_gift_colors_.get()));
    s.store_field("profileAccentColorId", profile_accent_color_id_);
    s.store_field("profileBackgroundCustomEmojiId", profile_background_custom_emoji_id_);
    s.store_class_end();
  }
}

void updateChatAccentColors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatAccentColors").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "backgroundCustomEmojiId", "J");
    upgraded_gift_colors_fieldID = jni::get_field_id(env, Class, "upgradedGiftColors", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftColors;").c_str());
    profile_accent_color_id_fieldID = jni::get_field_id(env, Class, "profileAccentColorId", "I");
    profile_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "profileBackgroundCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatPermissions::Class;
jfieldID updateChatPermissions::chat_id_fieldID;
jfieldID updateChatPermissions::permissions_fieldID;

updateChatPermissions::updateChatPermissions()
  : chat_id_()
  , permissions_()
{}

updateChatPermissions::updateChatPermissions(int53 chat_id_, object_ptr<chatPermissions> &&permissions_)
  : chat_id_(chat_id_)
  , permissions_(std::move(permissions_))
{}

const std::int32_t updateChatPermissions::ID;

object_ptr<Update> updateChatPermissions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatPermissions> res = make_object<updateChatPermissions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->permissions_ = jni::fetch_tl_object<chatPermissions>(env, jni::fetch_object(env, p, res->permissions_fieldID));
  return std::move(res);
}

void updateChatPermissions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (permissions_ != nullptr) { jobject next; permissions_->store(env, next); if (next) { env->SetObjectField(s, permissions_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatPermissions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatPermissions");
    s.store_field("chatId", chat_id_);
    s.store_object_field("permissions", static_cast<const BaseObject *>(permissions_.get()));
    s.store_class_end();
  }
}

void updateChatPermissions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatPermissions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    permissions_fieldID = jni::get_field_id(env, Class, "permissions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPermissions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatLastMessage::Class;
jfieldID updateChatLastMessage::chat_id_fieldID;
jfieldID updateChatLastMessage::last_message_fieldID;
jfieldID updateChatLastMessage::positions_fieldID;

updateChatLastMessage::updateChatLastMessage()
  : chat_id_()
  , last_message_()
  , positions_()
{}

updateChatLastMessage::updateChatLastMessage(int53 chat_id_, object_ptr<message> &&last_message_, array<object_ptr<chatPosition>> &&positions_)
  : chat_id_(chat_id_)
  , last_message_(std::move(last_message_))
  , positions_(std::move(positions_))
{}

const std::int32_t updateChatLastMessage::ID;

object_ptr<Update> updateChatLastMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatLastMessage> res = make_object<updateChatLastMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->last_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->last_message_fieldID));
  res->positions_ = jni::FetchVector<chatPosition>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->positions_fieldID));
  return std::move(res);
}

void updateChatLastMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (last_message_ != nullptr) { jobject next; last_message_->store(env, next); if (next) { env->SetObjectField(s, last_message_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, positions_); if (arr_tmp_) { env->SetObjectField(s, positions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateChatLastMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatLastMessage");
    s.store_field("chatId", chat_id_);
    s.store_object_field("lastMessage", static_cast<const BaseObject *>(last_message_.get()));
    { s.store_vector_begin("positions", positions_.size()); for (const auto &_value : positions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateChatLastMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatLastMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    last_message_fieldID = jni::get_field_id(env, Class, "lastMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    positions_fieldID = jni::get_field_id(env, Class, "positions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatPosition;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatPosition::Class;
jfieldID updateChatPosition::chat_id_fieldID;
jfieldID updateChatPosition::position_fieldID;

updateChatPosition::updateChatPosition()
  : chat_id_()
  , position_()
{}

updateChatPosition::updateChatPosition(int53 chat_id_, object_ptr<chatPosition> &&position_)
  : chat_id_(chat_id_)
  , position_(std::move(position_))
{}

const std::int32_t updateChatPosition::ID;

object_ptr<Update> updateChatPosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatPosition> res = make_object<updateChatPosition>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->position_ = jni::fetch_tl_object<chatPosition>(env, jni::fetch_object(env, p, res->position_fieldID));
  return std::move(res);
}

void updateChatPosition::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (position_ != nullptr) { jobject next; position_->store(env, next); if (next) { env->SetObjectField(s, position_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatPosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatPosition");
    s.store_field("chatId", chat_id_);
    s.store_object_field("position", static_cast<const BaseObject *>(position_.get()));
    s.store_class_end();
  }
}

void updateChatPosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatPosition").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    position_fieldID = jni::get_field_id(env, Class, "position", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPosition;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatAddedToList::Class;
jfieldID updateChatAddedToList::chat_id_fieldID;
jfieldID updateChatAddedToList::chat_list_fieldID;

updateChatAddedToList::updateChatAddedToList()
  : chat_id_()
  , chat_list_()
{}

updateChatAddedToList::updateChatAddedToList(int53 chat_id_, object_ptr<ChatList> &&chat_list_)
  : chat_id_(chat_id_)
  , chat_list_(std::move(chat_list_))
{}

const std::int32_t updateChatAddedToList::ID;

object_ptr<Update> updateChatAddedToList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatAddedToList> res = make_object<updateChatAddedToList>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  return std::move(res);
}

void updateChatAddedToList::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (chat_list_ != nullptr) { jobject next; chat_list_->store(env, next); if (next) { env->SetObjectField(s, chat_list_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatAddedToList::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatAddedToList");
    s.store_field("chatId", chat_id_);
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_class_end();
  }
}

void updateChatAddedToList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatAddedToList").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatRemovedFromList::Class;
jfieldID updateChatRemovedFromList::chat_id_fieldID;
jfieldID updateChatRemovedFromList::chat_list_fieldID;

updateChatRemovedFromList::updateChatRemovedFromList()
  : chat_id_()
  , chat_list_()
{}

updateChatRemovedFromList::updateChatRemovedFromList(int53 chat_id_, object_ptr<ChatList> &&chat_list_)
  : chat_id_(chat_id_)
  , chat_list_(std::move(chat_list_))
{}

const std::int32_t updateChatRemovedFromList::ID;

object_ptr<Update> updateChatRemovedFromList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatRemovedFromList> res = make_object<updateChatRemovedFromList>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  return std::move(res);
}

void updateChatRemovedFromList::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (chat_list_ != nullptr) { jobject next; chat_list_->store(env, next); if (next) { env->SetObjectField(s, chat_list_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatRemovedFromList::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatRemovedFromList");
    s.store_field("chatId", chat_id_);
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_class_end();
  }
}

void updateChatRemovedFromList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatRemovedFromList").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatReadInbox::Class;
jfieldID updateChatReadInbox::chat_id_fieldID;
jfieldID updateChatReadInbox::last_read_inbox_message_id_fieldID;
jfieldID updateChatReadInbox::unread_count_fieldID;

updateChatReadInbox::updateChatReadInbox()
  : chat_id_()
  , last_read_inbox_message_id_()
  , unread_count_()
{}

updateChatReadInbox::updateChatReadInbox(int53 chat_id_, int53 last_read_inbox_message_id_, int32 unread_count_)
  : chat_id_(chat_id_)
  , last_read_inbox_message_id_(last_read_inbox_message_id_)
  , unread_count_(unread_count_)
{}

const std::int32_t updateChatReadInbox::ID;

object_ptr<Update> updateChatReadInbox::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatReadInbox> res = make_object<updateChatReadInbox>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->last_read_inbox_message_id_ = env->GetLongField(p, res->last_read_inbox_message_id_fieldID);
  res->unread_count_ = env->GetIntField(p, res->unread_count_fieldID);
  return std::move(res);
}

void updateChatReadInbox::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, last_read_inbox_message_id_fieldID, last_read_inbox_message_id_);
  env->SetIntField(s, unread_count_fieldID, unread_count_);
}

void updateChatReadInbox::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatReadInbox");
    s.store_field("chatId", chat_id_);
    s.store_field("lastReadInboxMessageId", last_read_inbox_message_id_);
    s.store_field("unreadCount", unread_count_);
    s.store_class_end();
  }
}

void updateChatReadInbox::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatReadInbox").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    last_read_inbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadInboxMessageId", "J");
    unread_count_fieldID = jni::get_field_id(env, Class, "unreadCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatReadOutbox::Class;
jfieldID updateChatReadOutbox::chat_id_fieldID;
jfieldID updateChatReadOutbox::last_read_outbox_message_id_fieldID;

updateChatReadOutbox::updateChatReadOutbox()
  : chat_id_()
  , last_read_outbox_message_id_()
{}

updateChatReadOutbox::updateChatReadOutbox(int53 chat_id_, int53 last_read_outbox_message_id_)
  : chat_id_(chat_id_)
  , last_read_outbox_message_id_(last_read_outbox_message_id_)
{}

const std::int32_t updateChatReadOutbox::ID;

object_ptr<Update> updateChatReadOutbox::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatReadOutbox> res = make_object<updateChatReadOutbox>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->last_read_outbox_message_id_ = env->GetLongField(p, res->last_read_outbox_message_id_fieldID);
  return std::move(res);
}

void updateChatReadOutbox::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, last_read_outbox_message_id_fieldID, last_read_outbox_message_id_);
}

void updateChatReadOutbox::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatReadOutbox");
    s.store_field("chatId", chat_id_);
    s.store_field("lastReadOutboxMessageId", last_read_outbox_message_id_);
    s.store_class_end();
  }
}

void updateChatReadOutbox::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatReadOutbox").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    last_read_outbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadOutboxMessageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatActionBar::Class;
jfieldID updateChatActionBar::chat_id_fieldID;
jfieldID updateChatActionBar::action_bar_fieldID;

updateChatActionBar::updateChatActionBar()
  : chat_id_()
  , action_bar_()
{}

updateChatActionBar::updateChatActionBar(int53 chat_id_, object_ptr<ChatActionBar> &&action_bar_)
  : chat_id_(chat_id_)
  , action_bar_(std::move(action_bar_))
{}

const std::int32_t updateChatActionBar::ID;

object_ptr<Update> updateChatActionBar::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatActionBar> res = make_object<updateChatActionBar>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->action_bar_ = jni::fetch_tl_object<ChatActionBar>(env, jni::fetch_object(env, p, res->action_bar_fieldID));
  return std::move(res);
}

void updateChatActionBar::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (action_bar_ != nullptr) { jobject next; action_bar_->store(env, next); if (next) { env->SetObjectField(s, action_bar_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatActionBar::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatActionBar");
    s.store_field("chatId", chat_id_);
    s.store_object_field("actionBar", static_cast<const BaseObject *>(action_bar_.get()));
    s.store_class_end();
  }
}

void updateChatActionBar::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatActionBar").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    action_bar_fieldID = jni::get_field_id(env, Class, "actionBar", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatActionBar;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatBusinessBotManageBar::Class;
jfieldID updateChatBusinessBotManageBar::chat_id_fieldID;
jfieldID updateChatBusinessBotManageBar::business_bot_manage_bar_fieldID;

updateChatBusinessBotManageBar::updateChatBusinessBotManageBar()
  : chat_id_()
  , business_bot_manage_bar_()
{}

updateChatBusinessBotManageBar::updateChatBusinessBotManageBar(int53 chat_id_, object_ptr<businessBotManageBar> &&business_bot_manage_bar_)
  : chat_id_(chat_id_)
  , business_bot_manage_bar_(std::move(business_bot_manage_bar_))
{}

const std::int32_t updateChatBusinessBotManageBar::ID;

object_ptr<Update> updateChatBusinessBotManageBar::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatBusinessBotManageBar> res = make_object<updateChatBusinessBotManageBar>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->business_bot_manage_bar_ = jni::fetch_tl_object<businessBotManageBar>(env, jni::fetch_object(env, p, res->business_bot_manage_bar_fieldID));
  return std::move(res);
}

void updateChatBusinessBotManageBar::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (business_bot_manage_bar_ != nullptr) { jobject next; business_bot_manage_bar_->store(env, next); if (next) { env->SetObjectField(s, business_bot_manage_bar_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatBusinessBotManageBar::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatBusinessBotManageBar");
    s.store_field("chatId", chat_id_);
    s.store_object_field("businessBotManageBar", static_cast<const BaseObject *>(business_bot_manage_bar_.get()));
    s.store_class_end();
  }
}

void updateChatBusinessBotManageBar::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatBusinessBotManageBar").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    business_bot_manage_bar_fieldID = jni::get_field_id(env, Class, "businessBotManageBar", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessBotManageBar;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatAvailableReactions::Class;
jfieldID updateChatAvailableReactions::chat_id_fieldID;
jfieldID updateChatAvailableReactions::available_reactions_fieldID;

updateChatAvailableReactions::updateChatAvailableReactions()
  : chat_id_()
  , available_reactions_()
{}

updateChatAvailableReactions::updateChatAvailableReactions(int53 chat_id_, object_ptr<ChatAvailableReactions> &&available_reactions_)
  : chat_id_(chat_id_)
  , available_reactions_(std::move(available_reactions_))
{}

const std::int32_t updateChatAvailableReactions::ID;

object_ptr<Update> updateChatAvailableReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatAvailableReactions> res = make_object<updateChatAvailableReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->available_reactions_ = jni::fetch_tl_object<ChatAvailableReactions>(env, jni::fetch_object(env, p, res->available_reactions_fieldID));
  return std::move(res);
}

void updateChatAvailableReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (available_reactions_ != nullptr) { jobject next; available_reactions_->store(env, next); if (next) { env->SetObjectField(s, available_reactions_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatAvailableReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatAvailableReactions");
    s.store_field("chatId", chat_id_);
    s.store_object_field("availableReactions", static_cast<const BaseObject *>(available_reactions_.get()));
    s.store_class_end();
  }
}

void updateChatAvailableReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatAvailableReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    available_reactions_fieldID = jni::get_field_id(env, Class, "availableReactions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAvailableReactions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatDraftMessage::Class;
jfieldID updateChatDraftMessage::chat_id_fieldID;
jfieldID updateChatDraftMessage::draft_message_fieldID;
jfieldID updateChatDraftMessage::positions_fieldID;

updateChatDraftMessage::updateChatDraftMessage()
  : chat_id_()
  , draft_message_()
  , positions_()
{}

updateChatDraftMessage::updateChatDraftMessage(int53 chat_id_, object_ptr<draftMessage> &&draft_message_, array<object_ptr<chatPosition>> &&positions_)
  : chat_id_(chat_id_)
  , draft_message_(std::move(draft_message_))
  , positions_(std::move(positions_))
{}

const std::int32_t updateChatDraftMessage::ID;

object_ptr<Update> updateChatDraftMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatDraftMessage> res = make_object<updateChatDraftMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  res->positions_ = jni::FetchVector<chatPosition>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->positions_fieldID));
  return std::move(res);
}

void updateChatDraftMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (draft_message_ != nullptr) { jobject next; draft_message_->store(env, next); if (next) { env->SetObjectField(s, draft_message_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, positions_); if (arr_tmp_) { env->SetObjectField(s, positions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateChatDraftMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatDraftMessage");
    s.store_field("chatId", chat_id_);
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    { s.store_vector_begin("positions", positions_.size()); for (const auto &_value : positions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateChatDraftMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatDraftMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    draft_message_fieldID = jni::get_field_id(env, Class, "draftMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DraftMessage;").c_str());
    positions_fieldID = jni::get_field_id(env, Class, "positions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatPosition;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatEmojiStatus::Class;
jfieldID updateChatEmojiStatus::chat_id_fieldID;
jfieldID updateChatEmojiStatus::emoji_status_fieldID;

updateChatEmojiStatus::updateChatEmojiStatus()
  : chat_id_()
  , emoji_status_()
{}

updateChatEmojiStatus::updateChatEmojiStatus(int53 chat_id_, object_ptr<emojiStatus> &&emoji_status_)
  : chat_id_(chat_id_)
  , emoji_status_(std::move(emoji_status_))
{}

const std::int32_t updateChatEmojiStatus::ID;

object_ptr<Update> updateChatEmojiStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatEmojiStatus> res = make_object<updateChatEmojiStatus>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->emoji_status_fieldID));
  return std::move(res);
}

void updateChatEmojiStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (emoji_status_ != nullptr) { jobject next; emoji_status_->store(env, next); if (next) { env->SetObjectField(s, emoji_status_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatEmojiStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatEmojiStatus");
    s.store_field("chatId", chat_id_);
    s.store_object_field("emojiStatus", static_cast<const BaseObject *>(emoji_status_.get()));
    s.store_class_end();
  }
}

void updateChatEmojiStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatEmojiStatus").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    emoji_status_fieldID = jni::get_field_id(env, Class, "emojiStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatMessageSender::Class;
jfieldID updateChatMessageSender::chat_id_fieldID;
jfieldID updateChatMessageSender::message_sender_id_fieldID;

updateChatMessageSender::updateChatMessageSender()
  : chat_id_()
  , message_sender_id_()
{}

updateChatMessageSender::updateChatMessageSender(int53 chat_id_, object_ptr<MessageSender> &&message_sender_id_)
  : chat_id_(chat_id_)
  , message_sender_id_(std::move(message_sender_id_))
{}

const std::int32_t updateChatMessageSender::ID;

object_ptr<Update> updateChatMessageSender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatMessageSender> res = make_object<updateChatMessageSender>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->message_sender_id_fieldID));
  return std::move(res);
}

void updateChatMessageSender::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (message_sender_id_ != nullptr) { jobject next; message_sender_id_->store(env, next); if (next) { env->SetObjectField(s, message_sender_id_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatMessageSender::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatMessageSender");
    s.store_field("chatId", chat_id_);
    s.store_object_field("messageSenderId", static_cast<const BaseObject *>(message_sender_id_.get()));
    s.store_class_end();
  }
}

void updateChatMessageSender::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatMessageSender").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_sender_id_fieldID = jni::get_field_id(env, Class, "messageSenderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatMessageAutoDeleteTime::Class;
jfieldID updateChatMessageAutoDeleteTime::chat_id_fieldID;
jfieldID updateChatMessageAutoDeleteTime::message_auto_delete_time_fieldID;

updateChatMessageAutoDeleteTime::updateChatMessageAutoDeleteTime()
  : chat_id_()
  , message_auto_delete_time_()
{}

updateChatMessageAutoDeleteTime::updateChatMessageAutoDeleteTime(int53 chat_id_, int32 message_auto_delete_time_)
  : chat_id_(chat_id_)
  , message_auto_delete_time_(message_auto_delete_time_)
{}

const std::int32_t updateChatMessageAutoDeleteTime::ID;

object_ptr<Update> updateChatMessageAutoDeleteTime::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatMessageAutoDeleteTime> res = make_object<updateChatMessageAutoDeleteTime>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_auto_delete_time_ = env->GetIntField(p, res->message_auto_delete_time_fieldID);
  return std::move(res);
}

void updateChatMessageAutoDeleteTime::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, message_auto_delete_time_fieldID, message_auto_delete_time_);
}

void updateChatMessageAutoDeleteTime::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatMessageAutoDeleteTime");
    s.store_field("chatId", chat_id_);
    s.store_field("messageAutoDeleteTime", message_auto_delete_time_);
    s.store_class_end();
  }
}

void updateChatMessageAutoDeleteTime::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatMessageAutoDeleteTime").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_auto_delete_time_fieldID = jni::get_field_id(env, Class, "messageAutoDeleteTime", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatNotificationSettings::Class;
jfieldID updateChatNotificationSettings::chat_id_fieldID;
jfieldID updateChatNotificationSettings::notification_settings_fieldID;

updateChatNotificationSettings::updateChatNotificationSettings()
  : chat_id_()
  , notification_settings_()
{}

updateChatNotificationSettings::updateChatNotificationSettings(int53 chat_id_, object_ptr<chatNotificationSettings> &&notification_settings_)
  : chat_id_(chat_id_)
  , notification_settings_(std::move(notification_settings_))
{}

const std::int32_t updateChatNotificationSettings::ID;

object_ptr<Update> updateChatNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatNotificationSettings> res = make_object<updateChatNotificationSettings>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->notification_settings_ = jni::fetch_tl_object<chatNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return std::move(res);
}

void updateChatNotificationSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (notification_settings_ != nullptr) { jobject next; notification_settings_->store(env, next); if (next) { env->SetObjectField(s, notification_settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatNotificationSettings");
    s.store_field("chatId", chat_id_);
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_class_end();
  }
}

void updateChatNotificationSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatNotificationSettings").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    notification_settings_fieldID = jni::get_field_id(env, Class, "notificationSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatNotificationSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatPendingJoinRequests::Class;
jfieldID updateChatPendingJoinRequests::chat_id_fieldID;
jfieldID updateChatPendingJoinRequests::pending_join_requests_fieldID;

updateChatPendingJoinRequests::updateChatPendingJoinRequests()
  : chat_id_()
  , pending_join_requests_()
{}

updateChatPendingJoinRequests::updateChatPendingJoinRequests(int53 chat_id_, object_ptr<chatJoinRequestsInfo> &&pending_join_requests_)
  : chat_id_(chat_id_)
  , pending_join_requests_(std::move(pending_join_requests_))
{}

const std::int32_t updateChatPendingJoinRequests::ID;

object_ptr<Update> updateChatPendingJoinRequests::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatPendingJoinRequests> res = make_object<updateChatPendingJoinRequests>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->pending_join_requests_ = jni::fetch_tl_object<chatJoinRequestsInfo>(env, jni::fetch_object(env, p, res->pending_join_requests_fieldID));
  return std::move(res);
}

void updateChatPendingJoinRequests::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (pending_join_requests_ != nullptr) { jobject next; pending_join_requests_->store(env, next); if (next) { env->SetObjectField(s, pending_join_requests_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatPendingJoinRequests::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatPendingJoinRequests");
    s.store_field("chatId", chat_id_);
    s.store_object_field("pendingJoinRequests", static_cast<const BaseObject *>(pending_join_requests_.get()));
    s.store_class_end();
  }
}

void updateChatPendingJoinRequests::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatPendingJoinRequests").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    pending_join_requests_fieldID = jni::get_field_id(env, Class, "pendingJoinRequests", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatJoinRequestsInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatReplyMarkup::Class;
jfieldID updateChatReplyMarkup::chat_id_fieldID;
jfieldID updateChatReplyMarkup::reply_markup_message_fieldID;

updateChatReplyMarkup::updateChatReplyMarkup()
  : chat_id_()
  , reply_markup_message_()
{}

updateChatReplyMarkup::updateChatReplyMarkup(int53 chat_id_, object_ptr<message> &&reply_markup_message_)
  : chat_id_(chat_id_)
  , reply_markup_message_(std::move(reply_markup_message_))
{}

const std::int32_t updateChatReplyMarkup::ID;

object_ptr<Update> updateChatReplyMarkup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatReplyMarkup> res = make_object<updateChatReplyMarkup>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->reply_markup_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->reply_markup_message_fieldID));
  return std::move(res);
}

void updateChatReplyMarkup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (reply_markup_message_ != nullptr) { jobject next; reply_markup_message_->store(env, next); if (next) { env->SetObjectField(s, reply_markup_message_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatReplyMarkup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatReplyMarkup");
    s.store_field("chatId", chat_id_);
    s.store_object_field("replyMarkupMessage", static_cast<const BaseObject *>(reply_markup_message_.get()));
    s.store_class_end();
  }
}

void updateChatReplyMarkup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatReplyMarkup").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    reply_markup_message_fieldID = jni::get_field_id(env, Class, "replyMarkupMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatBackground::Class;
jfieldID updateChatBackground::chat_id_fieldID;
jfieldID updateChatBackground::background_fieldID;

updateChatBackground::updateChatBackground()
  : chat_id_()
  , background_()
{}

updateChatBackground::updateChatBackground(int53 chat_id_, object_ptr<chatBackground> &&background_)
  : chat_id_(chat_id_)
  , background_(std::move(background_))
{}

const std::int32_t updateChatBackground::ID;

object_ptr<Update> updateChatBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatBackground> res = make_object<updateChatBackground>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->background_ = jni::fetch_tl_object<chatBackground>(env, jni::fetch_object(env, p, res->background_fieldID));
  return std::move(res);
}

void updateChatBackground::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatBackground");
    s.store_field("chatId", chat_id_);
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_class_end();
  }
}

void updateChatBackground::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatBackground").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBackground;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatTheme::Class;
jfieldID updateChatTheme::chat_id_fieldID;
jfieldID updateChatTheme::theme_fieldID;

updateChatTheme::updateChatTheme()
  : chat_id_()
  , theme_()
{}

updateChatTheme::updateChatTheme(int53 chat_id_, object_ptr<ChatTheme> &&theme_)
  : chat_id_(chat_id_)
  , theme_(std::move(theme_))
{}

const std::int32_t updateChatTheme::ID;

object_ptr<Update> updateChatTheme::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatTheme> res = make_object<updateChatTheme>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->theme_ = jni::fetch_tl_object<ChatTheme>(env, jni::fetch_object(env, p, res->theme_fieldID));
  return std::move(res);
}

void updateChatTheme::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (theme_ != nullptr) { jobject next; theme_->store(env, next); if (next) { env->SetObjectField(s, theme_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatTheme::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatTheme");
    s.store_field("chatId", chat_id_);
    s.store_object_field("theme", static_cast<const BaseObject *>(theme_.get()));
    s.store_class_end();
  }
}

void updateChatTheme::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatTheme").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    theme_fieldID = jni::get_field_id(env, Class, "theme", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatTheme;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatUnreadMentionCount::Class;
jfieldID updateChatUnreadMentionCount::chat_id_fieldID;
jfieldID updateChatUnreadMentionCount::unread_mention_count_fieldID;

updateChatUnreadMentionCount::updateChatUnreadMentionCount()
  : chat_id_()
  , unread_mention_count_()
{}

updateChatUnreadMentionCount::updateChatUnreadMentionCount(int53 chat_id_, int32 unread_mention_count_)
  : chat_id_(chat_id_)
  , unread_mention_count_(unread_mention_count_)
{}

const std::int32_t updateChatUnreadMentionCount::ID;

object_ptr<Update> updateChatUnreadMentionCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatUnreadMentionCount> res = make_object<updateChatUnreadMentionCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->unread_mention_count_ = env->GetIntField(p, res->unread_mention_count_fieldID);
  return std::move(res);
}

void updateChatUnreadMentionCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, unread_mention_count_fieldID, unread_mention_count_);
}

void updateChatUnreadMentionCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatUnreadMentionCount");
    s.store_field("chatId", chat_id_);
    s.store_field("unreadMentionCount", unread_mention_count_);
    s.store_class_end();
  }
}

void updateChatUnreadMentionCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatUnreadMentionCount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    unread_mention_count_fieldID = jni::get_field_id(env, Class, "unreadMentionCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatUnreadReactionCount::Class;
jfieldID updateChatUnreadReactionCount::chat_id_fieldID;
jfieldID updateChatUnreadReactionCount::unread_reaction_count_fieldID;

updateChatUnreadReactionCount::updateChatUnreadReactionCount()
  : chat_id_()
  , unread_reaction_count_()
{}

updateChatUnreadReactionCount::updateChatUnreadReactionCount(int53 chat_id_, int32 unread_reaction_count_)
  : chat_id_(chat_id_)
  , unread_reaction_count_(unread_reaction_count_)
{}

const std::int32_t updateChatUnreadReactionCount::ID;

object_ptr<Update> updateChatUnreadReactionCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatUnreadReactionCount> res = make_object<updateChatUnreadReactionCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->unread_reaction_count_ = env->GetIntField(p, res->unread_reaction_count_fieldID);
  return std::move(res);
}

void updateChatUnreadReactionCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, unread_reaction_count_fieldID, unread_reaction_count_);
}

void updateChatUnreadReactionCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatUnreadReactionCount");
    s.store_field("chatId", chat_id_);
    s.store_field("unreadReactionCount", unread_reaction_count_);
    s.store_class_end();
  }
}

void updateChatUnreadReactionCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatUnreadReactionCount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    unread_reaction_count_fieldID = jni::get_field_id(env, Class, "unreadReactionCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatUnreadPollVoteCount::Class;
jfieldID updateChatUnreadPollVoteCount::chat_id_fieldID;
jfieldID updateChatUnreadPollVoteCount::unread_poll_vote_count_fieldID;

updateChatUnreadPollVoteCount::updateChatUnreadPollVoteCount()
  : chat_id_()
  , unread_poll_vote_count_()
{}

updateChatUnreadPollVoteCount::updateChatUnreadPollVoteCount(int53 chat_id_, int32 unread_poll_vote_count_)
  : chat_id_(chat_id_)
  , unread_poll_vote_count_(unread_poll_vote_count_)
{}

const std::int32_t updateChatUnreadPollVoteCount::ID;

object_ptr<Update> updateChatUnreadPollVoteCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatUnreadPollVoteCount> res = make_object<updateChatUnreadPollVoteCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->unread_poll_vote_count_ = env->GetIntField(p, res->unread_poll_vote_count_fieldID);
  return std::move(res);
}

void updateChatUnreadPollVoteCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, unread_poll_vote_count_fieldID, unread_poll_vote_count_);
}

void updateChatUnreadPollVoteCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatUnreadPollVoteCount");
    s.store_field("chatId", chat_id_);
    s.store_field("unreadPollVoteCount", unread_poll_vote_count_);
    s.store_class_end();
  }
}

void updateChatUnreadPollVoteCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatUnreadPollVoteCount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    unread_poll_vote_count_fieldID = jni::get_field_id(env, Class, "unreadPollVoteCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatVideoChat::Class;
jfieldID updateChatVideoChat::chat_id_fieldID;
jfieldID updateChatVideoChat::video_chat_fieldID;

updateChatVideoChat::updateChatVideoChat()
  : chat_id_()
  , video_chat_()
{}

updateChatVideoChat::updateChatVideoChat(int53 chat_id_, object_ptr<videoChat> &&video_chat_)
  : chat_id_(chat_id_)
  , video_chat_(std::move(video_chat_))
{}

const std::int32_t updateChatVideoChat::ID;

object_ptr<Update> updateChatVideoChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatVideoChat> res = make_object<updateChatVideoChat>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->video_chat_ = jni::fetch_tl_object<videoChat>(env, jni::fetch_object(env, p, res->video_chat_fieldID));
  return std::move(res);
}

void updateChatVideoChat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (video_chat_ != nullptr) { jobject next; video_chat_->store(env, next); if (next) { env->SetObjectField(s, video_chat_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatVideoChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatVideoChat");
    s.store_field("chatId", chat_id_);
    s.store_object_field("videoChat", static_cast<const BaseObject *>(video_chat_.get()));
    s.store_class_end();
  }
}

void updateChatVideoChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatVideoChat").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    video_chat_fieldID = jni::get_field_id(env, Class, "videoChat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VideoChat;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatDefaultDisableNotification::Class;
jfieldID updateChatDefaultDisableNotification::chat_id_fieldID;
jfieldID updateChatDefaultDisableNotification::default_disable_notification_fieldID;

updateChatDefaultDisableNotification::updateChatDefaultDisableNotification()
  : chat_id_()
  , default_disable_notification_()
{}

updateChatDefaultDisableNotification::updateChatDefaultDisableNotification(int53 chat_id_, bool default_disable_notification_)
  : chat_id_(chat_id_)
  , default_disable_notification_(default_disable_notification_)
{}

const std::int32_t updateChatDefaultDisableNotification::ID;

object_ptr<Update> updateChatDefaultDisableNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatDefaultDisableNotification> res = make_object<updateChatDefaultDisableNotification>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->default_disable_notification_ = (env->GetBooleanField(p, res->default_disable_notification_fieldID) != 0);
  return std::move(res);
}

void updateChatDefaultDisableNotification::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetBooleanField(s, default_disable_notification_fieldID, default_disable_notification_);
}

void updateChatDefaultDisableNotification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatDefaultDisableNotification");
    s.store_field("chatId", chat_id_);
    s.store_field("defaultDisableNotification", default_disable_notification_);
    s.store_class_end();
  }
}

void updateChatDefaultDisableNotification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatDefaultDisableNotification").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    default_disable_notification_fieldID = jni::get_field_id(env, Class, "defaultDisableNotification", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatHasProtectedContent::Class;
jfieldID updateChatHasProtectedContent::chat_id_fieldID;
jfieldID updateChatHasProtectedContent::has_protected_content_fieldID;

updateChatHasProtectedContent::updateChatHasProtectedContent()
  : chat_id_()
  , has_protected_content_()
{}

updateChatHasProtectedContent::updateChatHasProtectedContent(int53 chat_id_, bool has_protected_content_)
  : chat_id_(chat_id_)
  , has_protected_content_(has_protected_content_)
{}

const std::int32_t updateChatHasProtectedContent::ID;

object_ptr<Update> updateChatHasProtectedContent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatHasProtectedContent> res = make_object<updateChatHasProtectedContent>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->has_protected_content_ = (env->GetBooleanField(p, res->has_protected_content_fieldID) != 0);
  return std::move(res);
}

void updateChatHasProtectedContent::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetBooleanField(s, has_protected_content_fieldID, has_protected_content_);
}

void updateChatHasProtectedContent::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatHasProtectedContent");
    s.store_field("chatId", chat_id_);
    s.store_field("hasProtectedContent", has_protected_content_);
    s.store_class_end();
  }
}

void updateChatHasProtectedContent::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatHasProtectedContent").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    has_protected_content_fieldID = jni::get_field_id(env, Class, "hasProtectedContent", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatIsTranslatable::Class;
jfieldID updateChatIsTranslatable::chat_id_fieldID;
jfieldID updateChatIsTranslatable::is_translatable_fieldID;

updateChatIsTranslatable::updateChatIsTranslatable()
  : chat_id_()
  , is_translatable_()
{}

updateChatIsTranslatable::updateChatIsTranslatable(int53 chat_id_, bool is_translatable_)
  : chat_id_(chat_id_)
  , is_translatable_(is_translatable_)
{}

const std::int32_t updateChatIsTranslatable::ID;

object_ptr<Update> updateChatIsTranslatable::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatIsTranslatable> res = make_object<updateChatIsTranslatable>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_translatable_ = (env->GetBooleanField(p, res->is_translatable_fieldID) != 0);
  return std::move(res);
}

void updateChatIsTranslatable::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetBooleanField(s, is_translatable_fieldID, is_translatable_);
}

void updateChatIsTranslatable::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatIsTranslatable");
    s.store_field("chatId", chat_id_);
    s.store_field("isTranslatable", is_translatable_);
    s.store_class_end();
  }
}

void updateChatIsTranslatable::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatIsTranslatable").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    is_translatable_fieldID = jni::get_field_id(env, Class, "isTranslatable", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatIsMarkedAsUnread::Class;
jfieldID updateChatIsMarkedAsUnread::chat_id_fieldID;
jfieldID updateChatIsMarkedAsUnread::is_marked_as_unread_fieldID;

updateChatIsMarkedAsUnread::updateChatIsMarkedAsUnread()
  : chat_id_()
  , is_marked_as_unread_()
{}

updateChatIsMarkedAsUnread::updateChatIsMarkedAsUnread(int53 chat_id_, bool is_marked_as_unread_)
  : chat_id_(chat_id_)
  , is_marked_as_unread_(is_marked_as_unread_)
{}

const std::int32_t updateChatIsMarkedAsUnread::ID;

object_ptr<Update> updateChatIsMarkedAsUnread::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatIsMarkedAsUnread> res = make_object<updateChatIsMarkedAsUnread>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_marked_as_unread_ = (env->GetBooleanField(p, res->is_marked_as_unread_fieldID) != 0);
  return std::move(res);
}

void updateChatIsMarkedAsUnread::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetBooleanField(s, is_marked_as_unread_fieldID, is_marked_as_unread_);
}

void updateChatIsMarkedAsUnread::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatIsMarkedAsUnread");
    s.store_field("chatId", chat_id_);
    s.store_field("isMarkedAsUnread", is_marked_as_unread_);
    s.store_class_end();
  }
}

void updateChatIsMarkedAsUnread::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatIsMarkedAsUnread").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    is_marked_as_unread_fieldID = jni::get_field_id(env, Class, "isMarkedAsUnread", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatViewAsTopics::Class;
jfieldID updateChatViewAsTopics::chat_id_fieldID;
jfieldID updateChatViewAsTopics::view_as_topics_fieldID;

updateChatViewAsTopics::updateChatViewAsTopics()
  : chat_id_()
  , view_as_topics_()
{}

updateChatViewAsTopics::updateChatViewAsTopics(int53 chat_id_, bool view_as_topics_)
  : chat_id_(chat_id_)
  , view_as_topics_(view_as_topics_)
{}

const std::int32_t updateChatViewAsTopics::ID;

object_ptr<Update> updateChatViewAsTopics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatViewAsTopics> res = make_object<updateChatViewAsTopics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->view_as_topics_ = (env->GetBooleanField(p, res->view_as_topics_fieldID) != 0);
  return std::move(res);
}

void updateChatViewAsTopics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetBooleanField(s, view_as_topics_fieldID, view_as_topics_);
}

void updateChatViewAsTopics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatViewAsTopics");
    s.store_field("chatId", chat_id_);
    s.store_field("viewAsTopics", view_as_topics_);
    s.store_class_end();
  }
}

void updateChatViewAsTopics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatViewAsTopics").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    view_as_topics_fieldID = jni::get_field_id(env, Class, "viewAsTopics", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatBlockList::Class;
jfieldID updateChatBlockList::chat_id_fieldID;
jfieldID updateChatBlockList::block_list_fieldID;

updateChatBlockList::updateChatBlockList()
  : chat_id_()
  , block_list_()
{}

updateChatBlockList::updateChatBlockList(int53 chat_id_, object_ptr<BlockList> &&block_list_)
  : chat_id_(chat_id_)
  , block_list_(std::move(block_list_))
{}

const std::int32_t updateChatBlockList::ID;

object_ptr<Update> updateChatBlockList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatBlockList> res = make_object<updateChatBlockList>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->block_list_ = jni::fetch_tl_object<BlockList>(env, jni::fetch_object(env, p, res->block_list_fieldID));
  return std::move(res);
}

void updateChatBlockList::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (block_list_ != nullptr) { jobject next; block_list_->store(env, next); if (next) { env->SetObjectField(s, block_list_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatBlockList::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatBlockList");
    s.store_field("chatId", chat_id_);
    s.store_object_field("blockList", static_cast<const BaseObject *>(block_list_.get()));
    s.store_class_end();
  }
}

void updateChatBlockList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatBlockList").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    block_list_fieldID = jni::get_field_id(env, Class, "blockList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BlockList;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatHasScheduledMessages::Class;
jfieldID updateChatHasScheduledMessages::chat_id_fieldID;
jfieldID updateChatHasScheduledMessages::has_scheduled_messages_fieldID;

updateChatHasScheduledMessages::updateChatHasScheduledMessages()
  : chat_id_()
  , has_scheduled_messages_()
{}

updateChatHasScheduledMessages::updateChatHasScheduledMessages(int53 chat_id_, bool has_scheduled_messages_)
  : chat_id_(chat_id_)
  , has_scheduled_messages_(has_scheduled_messages_)
{}

const std::int32_t updateChatHasScheduledMessages::ID;

object_ptr<Update> updateChatHasScheduledMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatHasScheduledMessages> res = make_object<updateChatHasScheduledMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->has_scheduled_messages_ = (env->GetBooleanField(p, res->has_scheduled_messages_fieldID) != 0);
  return std::move(res);
}

void updateChatHasScheduledMessages::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetBooleanField(s, has_scheduled_messages_fieldID, has_scheduled_messages_);
}

void updateChatHasScheduledMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatHasScheduledMessages");
    s.store_field("chatId", chat_id_);
    s.store_field("hasScheduledMessages", has_scheduled_messages_);
    s.store_class_end();
  }
}

void updateChatHasScheduledMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatHasScheduledMessages").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    has_scheduled_messages_fieldID = jni::get_field_id(env, Class, "hasScheduledMessages", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatFolders::Class;
jfieldID updateChatFolders::chat_folders_fieldID;
jfieldID updateChatFolders::main_chat_list_position_fieldID;
jfieldID updateChatFolders::are_tags_enabled_fieldID;

updateChatFolders::updateChatFolders()
  : chat_folders_()
  , main_chat_list_position_()
  , are_tags_enabled_()
{}

updateChatFolders::updateChatFolders(array<object_ptr<chatFolderInfo>> &&chat_folders_, int32 main_chat_list_position_, bool are_tags_enabled_)
  : chat_folders_(std::move(chat_folders_))
  , main_chat_list_position_(main_chat_list_position_)
  , are_tags_enabled_(are_tags_enabled_)
{}

const std::int32_t updateChatFolders::ID;

object_ptr<Update> updateChatFolders::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatFolders> res = make_object<updateChatFolders>();
  res->chat_folders_ = jni::FetchVector<chatFolderInfo>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->chat_folders_fieldID));
  res->main_chat_list_position_ = env->GetIntField(p, res->main_chat_list_position_fieldID);
  res->are_tags_enabled_ = (env->GetBooleanField(p, res->are_tags_enabled_fieldID) != 0);
  return std::move(res);
}

void updateChatFolders::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, chat_folders_); if (arr_tmp_) { env->SetObjectField(s, chat_folders_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, main_chat_list_position_fieldID, main_chat_list_position_);
  env->SetBooleanField(s, are_tags_enabled_fieldID, are_tags_enabled_);
}

void updateChatFolders::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatFolders");
    { s.store_vector_begin("chatFolders", chat_folders_.size()); for (const auto &_value : chat_folders_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("mainChatListPosition", main_chat_list_position_);
    s.store_field("areTagsEnabled", are_tags_enabled_);
    s.store_class_end();
  }
}

void updateChatFolders::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatFolders").c_str());
    chat_folders_fieldID = jni::get_field_id(env, Class, "chatFolders", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatFolderInfo;").c_str());
    main_chat_list_position_fieldID = jni::get_field_id(env, Class, "mainChatListPosition", "I");
    are_tags_enabled_fieldID = jni::get_field_id(env, Class, "areTagsEnabled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatOnlineMemberCount::Class;
jfieldID updateChatOnlineMemberCount::chat_id_fieldID;
jfieldID updateChatOnlineMemberCount::online_member_count_fieldID;

updateChatOnlineMemberCount::updateChatOnlineMemberCount()
  : chat_id_()
  , online_member_count_()
{}

updateChatOnlineMemberCount::updateChatOnlineMemberCount(int53 chat_id_, int32 online_member_count_)
  : chat_id_(chat_id_)
  , online_member_count_(online_member_count_)
{}

const std::int32_t updateChatOnlineMemberCount::ID;

object_ptr<Update> updateChatOnlineMemberCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatOnlineMemberCount> res = make_object<updateChatOnlineMemberCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->online_member_count_ = env->GetIntField(p, res->online_member_count_fieldID);
  return std::move(res);
}

void updateChatOnlineMemberCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, online_member_count_fieldID, online_member_count_);
}

void updateChatOnlineMemberCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatOnlineMemberCount");
    s.store_field("chatId", chat_id_);
    s.store_field("onlineMemberCount", online_member_count_);
    s.store_class_end();
  }
}

void updateChatOnlineMemberCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatOnlineMemberCount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    online_member_count_fieldID = jni::get_field_id(env, Class, "onlineMemberCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateSavedMessagesTopic::Class;
jfieldID updateSavedMessagesTopic::topic_fieldID;

updateSavedMessagesTopic::updateSavedMessagesTopic()
  : topic_()
{}

updateSavedMessagesTopic::updateSavedMessagesTopic(object_ptr<savedMessagesTopic> &&topic_)
  : topic_(std::move(topic_))
{}

const std::int32_t updateSavedMessagesTopic::ID;

object_ptr<Update> updateSavedMessagesTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSavedMessagesTopic> res = make_object<updateSavedMessagesTopic>();
  res->topic_ = jni::fetch_tl_object<savedMessagesTopic>(env, jni::fetch_object(env, p, res->topic_fieldID));
  return std::move(res);
}

void updateSavedMessagesTopic::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (topic_ != nullptr) { jobject next; topic_->store(env, next); if (next) { env->SetObjectField(s, topic_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateSavedMessagesTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSavedMessagesTopic");
    s.store_object_field("topic", static_cast<const BaseObject *>(topic_.get()));
    s.store_class_end();
  }
}

void updateSavedMessagesTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSavedMessagesTopic").c_str());
    topic_fieldID = jni::get_field_id(env, Class, "topic", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SavedMessagesTopic;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSavedMessagesTopicCount::Class;
jfieldID updateSavedMessagesTopicCount::topic_count_fieldID;

updateSavedMessagesTopicCount::updateSavedMessagesTopicCount()
  : topic_count_()
{}

updateSavedMessagesTopicCount::updateSavedMessagesTopicCount(int32 topic_count_)
  : topic_count_(topic_count_)
{}

const std::int32_t updateSavedMessagesTopicCount::ID;

object_ptr<Update> updateSavedMessagesTopicCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSavedMessagesTopicCount> res = make_object<updateSavedMessagesTopicCount>();
  res->topic_count_ = env->GetIntField(p, res->topic_count_fieldID);
  return std::move(res);
}

void updateSavedMessagesTopicCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, topic_count_fieldID, topic_count_);
}

void updateSavedMessagesTopicCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSavedMessagesTopicCount");
    s.store_field("topicCount", topic_count_);
    s.store_class_end();
  }
}

void updateSavedMessagesTopicCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSavedMessagesTopicCount").c_str());
    topic_count_fieldID = jni::get_field_id(env, Class, "topicCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateDirectMessagesChatTopic::Class;
jfieldID updateDirectMessagesChatTopic::topic_fieldID;

updateDirectMessagesChatTopic::updateDirectMessagesChatTopic()
  : topic_()
{}

updateDirectMessagesChatTopic::updateDirectMessagesChatTopic(object_ptr<directMessagesChatTopic> &&topic_)
  : topic_(std::move(topic_))
{}

const std::int32_t updateDirectMessagesChatTopic::ID;

object_ptr<Update> updateDirectMessagesChatTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateDirectMessagesChatTopic> res = make_object<updateDirectMessagesChatTopic>();
  res->topic_ = jni::fetch_tl_object<directMessagesChatTopic>(env, jni::fetch_object(env, p, res->topic_fieldID));
  return std::move(res);
}

void updateDirectMessagesChatTopic::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (topic_ != nullptr) { jobject next; topic_->store(env, next); if (next) { env->SetObjectField(s, topic_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateDirectMessagesChatTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateDirectMessagesChatTopic");
    s.store_object_field("topic", static_cast<const BaseObject *>(topic_.get()));
    s.store_class_end();
  }
}

void updateDirectMessagesChatTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateDirectMessagesChatTopic").c_str());
    topic_fieldID = jni::get_field_id(env, Class, "topic", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DirectMessagesChatTopic;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateTopicMessageCount::Class;
jfieldID updateTopicMessageCount::chat_id_fieldID;
jfieldID updateTopicMessageCount::topic_id_fieldID;
jfieldID updateTopicMessageCount::message_count_fieldID;

updateTopicMessageCount::updateTopicMessageCount()
  : chat_id_()
  , topic_id_()
  , message_count_()
{}

updateTopicMessageCount::updateTopicMessageCount(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, int32 message_count_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , message_count_(message_count_)
{}

const std::int32_t updateTopicMessageCount::ID;

object_ptr<Update> updateTopicMessageCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateTopicMessageCount> res = make_object<updateTopicMessageCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->message_count_ = env->GetIntField(p, res->message_count_fieldID);
  return std::move(res);
}

void updateTopicMessageCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (topic_id_ != nullptr) { jobject next; topic_id_->store(env, next); if (next) { env->SetObjectField(s, topic_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, message_count_fieldID, message_count_);
}

void updateTopicMessageCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateTopicMessageCount");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_field("messageCount", message_count_);
    s.store_class_end();
  }
}

void updateTopicMessageCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateTopicMessageCount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    message_count_fieldID = jni::get_field_id(env, Class, "messageCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateQuickReplyShortcut::Class;
jfieldID updateQuickReplyShortcut::shortcut_fieldID;

updateQuickReplyShortcut::updateQuickReplyShortcut()
  : shortcut_()
{}

updateQuickReplyShortcut::updateQuickReplyShortcut(object_ptr<quickReplyShortcut> &&shortcut_)
  : shortcut_(std::move(shortcut_))
{}

const std::int32_t updateQuickReplyShortcut::ID;

object_ptr<Update> updateQuickReplyShortcut::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateQuickReplyShortcut> res = make_object<updateQuickReplyShortcut>();
  res->shortcut_ = jni::fetch_tl_object<quickReplyShortcut>(env, jni::fetch_object(env, p, res->shortcut_fieldID));
  return std::move(res);
}

void updateQuickReplyShortcut::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (shortcut_ != nullptr) { jobject next; shortcut_->store(env, next); if (next) { env->SetObjectField(s, shortcut_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateQuickReplyShortcut::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateQuickReplyShortcut");
    s.store_object_field("shortcut", static_cast<const BaseObject *>(shortcut_.get()));
    s.store_class_end();
  }
}

void updateQuickReplyShortcut::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateQuickReplyShortcut").c_str());
    shortcut_fieldID = jni::get_field_id(env, Class, "shortcut", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$QuickReplyShortcut;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateQuickReplyShortcutDeleted::Class;
jfieldID updateQuickReplyShortcutDeleted::shortcut_id_fieldID;

updateQuickReplyShortcutDeleted::updateQuickReplyShortcutDeleted()
  : shortcut_id_()
{}

updateQuickReplyShortcutDeleted::updateQuickReplyShortcutDeleted(int32 shortcut_id_)
  : shortcut_id_(shortcut_id_)
{}

const std::int32_t updateQuickReplyShortcutDeleted::ID;

object_ptr<Update> updateQuickReplyShortcutDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateQuickReplyShortcutDeleted> res = make_object<updateQuickReplyShortcutDeleted>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  return std::move(res);
}

void updateQuickReplyShortcutDeleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, shortcut_id_fieldID, shortcut_id_);
}

void updateQuickReplyShortcutDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateQuickReplyShortcutDeleted");
    s.store_field("shortcutId", shortcut_id_);
    s.store_class_end();
  }
}

void updateQuickReplyShortcutDeleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateQuickReplyShortcutDeleted").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateQuickReplyShortcuts::Class;
jfieldID updateQuickReplyShortcuts::shortcut_ids_fieldID;

updateQuickReplyShortcuts::updateQuickReplyShortcuts()
  : shortcut_ids_()
{}

updateQuickReplyShortcuts::updateQuickReplyShortcuts(array<int32> &&shortcut_ids_)
  : shortcut_ids_(std::move(shortcut_ids_))
{}

const std::int32_t updateQuickReplyShortcuts::ID;

object_ptr<Update> updateQuickReplyShortcuts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateQuickReplyShortcuts> res = make_object<updateQuickReplyShortcuts>();
  res->shortcut_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->shortcut_ids_fieldID));
  return std::move(res);
}

void updateQuickReplyShortcuts::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, shortcut_ids_); if (arr_tmp_) { env->SetObjectField(s, shortcut_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateQuickReplyShortcuts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateQuickReplyShortcuts");
    { s.store_vector_begin("shortcutIds", shortcut_ids_.size()); for (const auto &_value : shortcut_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateQuickReplyShortcuts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateQuickReplyShortcuts").c_str());
    shortcut_ids_fieldID = jni::get_field_id(env, Class, "shortcutIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateQuickReplyShortcutMessages::Class;
jfieldID updateQuickReplyShortcutMessages::shortcut_id_fieldID;
jfieldID updateQuickReplyShortcutMessages::messages_fieldID;

updateQuickReplyShortcutMessages::updateQuickReplyShortcutMessages()
  : shortcut_id_()
  , messages_()
{}

updateQuickReplyShortcutMessages::updateQuickReplyShortcutMessages(int32 shortcut_id_, array<object_ptr<quickReplyMessage>> &&messages_)
  : shortcut_id_(shortcut_id_)
  , messages_(std::move(messages_))
{}

const std::int32_t updateQuickReplyShortcutMessages::ID;

object_ptr<Update> updateQuickReplyShortcutMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateQuickReplyShortcutMessages> res = make_object<updateQuickReplyShortcutMessages>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->messages_ = jni::FetchVector<quickReplyMessage>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->messages_fieldID));
  return std::move(res);
}

void updateQuickReplyShortcutMessages::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, shortcut_id_fieldID, shortcut_id_);
  { auto arr_tmp_ = jni::store_vector(env, messages_); if (arr_tmp_) { env->SetObjectField(s, messages_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateQuickReplyShortcutMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateQuickReplyShortcutMessages");
    s.store_field("shortcutId", shortcut_id_);
    { s.store_vector_begin("messages", messages_.size()); for (const auto &_value : messages_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateQuickReplyShortcutMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateQuickReplyShortcutMessages").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    messages_fieldID = jni::get_field_id(env, Class, "messages", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$QuickReplyMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateForumTopicInfo::Class;
jfieldID updateForumTopicInfo::info_fieldID;

updateForumTopicInfo::updateForumTopicInfo()
  : info_()
{}

updateForumTopicInfo::updateForumTopicInfo(object_ptr<forumTopicInfo> &&info_)
  : info_(std::move(info_))
{}

const std::int32_t updateForumTopicInfo::ID;

object_ptr<Update> updateForumTopicInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateForumTopicInfo> res = make_object<updateForumTopicInfo>();
  res->info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->info_fieldID));
  return std::move(res);
}

void updateForumTopicInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (info_ != nullptr) { jobject next; info_->store(env, next); if (next) { env->SetObjectField(s, info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateForumTopicInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateForumTopicInfo");
    s.store_object_field("info", static_cast<const BaseObject *>(info_.get()));
    s.store_class_end();
  }
}

void updateForumTopicInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateForumTopicInfo").c_str());
    info_fieldID = jni::get_field_id(env, Class, "info", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateForumTopic::Class;
jfieldID updateForumTopic::chat_id_fieldID;
jfieldID updateForumTopic::forum_topic_id_fieldID;
jfieldID updateForumTopic::is_pinned_fieldID;
jfieldID updateForumTopic::last_read_inbox_message_id_fieldID;
jfieldID updateForumTopic::last_read_outbox_message_id_fieldID;
jfieldID updateForumTopic::unread_mention_count_fieldID;
jfieldID updateForumTopic::unread_reaction_count_fieldID;
jfieldID updateForumTopic::unread_poll_vote_count_fieldID;
jfieldID updateForumTopic::notification_settings_fieldID;
jfieldID updateForumTopic::draft_message_fieldID;

updateForumTopic::updateForumTopic()
  : chat_id_()
  , forum_topic_id_()
  , is_pinned_()
  , last_read_inbox_message_id_()
  , last_read_outbox_message_id_()
  , unread_mention_count_()
  , unread_reaction_count_()
  , unread_poll_vote_count_()
  , notification_settings_()
  , draft_message_()
{}

updateForumTopic::updateForumTopic(int53 chat_id_, int32 forum_topic_id_, bool is_pinned_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int32 unread_mention_count_, int32 unread_reaction_count_, int32 unread_poll_vote_count_, object_ptr<chatNotificationSettings> &&notification_settings_, object_ptr<draftMessage> &&draft_message_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , is_pinned_(is_pinned_)
  , last_read_inbox_message_id_(last_read_inbox_message_id_)
  , last_read_outbox_message_id_(last_read_outbox_message_id_)
  , unread_mention_count_(unread_mention_count_)
  , unread_reaction_count_(unread_reaction_count_)
  , unread_poll_vote_count_(unread_poll_vote_count_)
  , notification_settings_(std::move(notification_settings_))
  , draft_message_(std::move(draft_message_))
{}

const std::int32_t updateForumTopic::ID;

object_ptr<Update> updateForumTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateForumTopic> res = make_object<updateForumTopic>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  res->last_read_inbox_message_id_ = env->GetLongField(p, res->last_read_inbox_message_id_fieldID);
  res->last_read_outbox_message_id_ = env->GetLongField(p, res->last_read_outbox_message_id_fieldID);
  res->unread_mention_count_ = env->GetIntField(p, res->unread_mention_count_fieldID);
  res->unread_reaction_count_ = env->GetIntField(p, res->unread_reaction_count_fieldID);
  res->unread_poll_vote_count_ = env->GetIntField(p, res->unread_poll_vote_count_fieldID);
  res->notification_settings_ = jni::fetch_tl_object<chatNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  res->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  return std::move(res);
}

void updateForumTopic::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, forum_topic_id_fieldID, forum_topic_id_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
  env->SetLongField(s, last_read_inbox_message_id_fieldID, last_read_inbox_message_id_);
  env->SetLongField(s, last_read_outbox_message_id_fieldID, last_read_outbox_message_id_);
  env->SetIntField(s, unread_mention_count_fieldID, unread_mention_count_);
  env->SetIntField(s, unread_reaction_count_fieldID, unread_reaction_count_);
  env->SetIntField(s, unread_poll_vote_count_fieldID, unread_poll_vote_count_);
  if (notification_settings_ != nullptr) { jobject next; notification_settings_->store(env, next); if (next) { env->SetObjectField(s, notification_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (draft_message_ != nullptr) { jobject next; draft_message_->store(env, next); if (next) { env->SetObjectField(s, draft_message_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateForumTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateForumTopic");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("isPinned", is_pinned_);
    s.store_field("lastReadInboxMessageId", last_read_inbox_message_id_);
    s.store_field("lastReadOutboxMessageId", last_read_outbox_message_id_);
    s.store_field("unreadMentionCount", unread_mention_count_);
    s.store_field("unreadReactionCount", unread_reaction_count_);
    s.store_field("unreadPollVoteCount", unread_poll_vote_count_);
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_class_end();
  }
}

void updateForumTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateForumTopic").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    forum_topic_id_fieldID = jni::get_field_id(env, Class, "forumTopicId", "I");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    last_read_inbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadInboxMessageId", "J");
    last_read_outbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadOutboxMessageId", "J");
    unread_mention_count_fieldID = jni::get_field_id(env, Class, "unreadMentionCount", "I");
    unread_reaction_count_fieldID = jni::get_field_id(env, Class, "unreadReactionCount", "I");
    unread_poll_vote_count_fieldID = jni::get_field_id(env, Class, "unreadPollVoteCount", "I");
    notification_settings_fieldID = jni::get_field_id(env, Class, "notificationSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatNotificationSettings;").c_str());
    draft_message_fieldID = jni::get_field_id(env, Class, "draftMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DraftMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateScopeNotificationSettings::Class;
jfieldID updateScopeNotificationSettings::scope_fieldID;
jfieldID updateScopeNotificationSettings::notification_settings_fieldID;

updateScopeNotificationSettings::updateScopeNotificationSettings()
  : scope_()
  , notification_settings_()
{}

updateScopeNotificationSettings::updateScopeNotificationSettings(object_ptr<NotificationSettingsScope> &&scope_, object_ptr<scopeNotificationSettings> &&notification_settings_)
  : scope_(std::move(scope_))
  , notification_settings_(std::move(notification_settings_))
{}

const std::int32_t updateScopeNotificationSettings::ID;

object_ptr<Update> updateScopeNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateScopeNotificationSettings> res = make_object<updateScopeNotificationSettings>();
  res->scope_ = jni::fetch_tl_object<NotificationSettingsScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->notification_settings_ = jni::fetch_tl_object<scopeNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return std::move(res);
}

void updateScopeNotificationSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (scope_ != nullptr) { jobject next; scope_->store(env, next); if (next) { env->SetObjectField(s, scope_fieldID, next); env->DeleteLocalRef(next); } }
  if (notification_settings_ != nullptr) { jobject next; notification_settings_->store(env, next); if (next) { env->SetObjectField(s, notification_settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateScopeNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateScopeNotificationSettings");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_class_end();
  }
}

void updateScopeNotificationSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateScopeNotificationSettings").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NotificationSettingsScope;").c_str());
    notification_settings_fieldID = jni::get_field_id(env, Class, "notificationSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeNotificationSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateReactionNotificationSettings::Class;
jfieldID updateReactionNotificationSettings::notification_settings_fieldID;

updateReactionNotificationSettings::updateReactionNotificationSettings()
  : notification_settings_()
{}

updateReactionNotificationSettings::updateReactionNotificationSettings(object_ptr<reactionNotificationSettings> &&notification_settings_)
  : notification_settings_(std::move(notification_settings_))
{}

const std::int32_t updateReactionNotificationSettings::ID;

object_ptr<Update> updateReactionNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateReactionNotificationSettings> res = make_object<updateReactionNotificationSettings>();
  res->notification_settings_ = jni::fetch_tl_object<reactionNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return std::move(res);
}

void updateReactionNotificationSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (notification_settings_ != nullptr) { jobject next; notification_settings_->store(env, next); if (next) { env->SetObjectField(s, notification_settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateReactionNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateReactionNotificationSettings");
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_class_end();
  }
}

void updateReactionNotificationSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateReactionNotificationSettings").c_str());
    notification_settings_fieldID = jni::get_field_id(env, Class, "notificationSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionNotificationSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNotification::Class;
jfieldID updateNotification::notification_group_id_fieldID;
jfieldID updateNotification::notification_fieldID;

updateNotification::updateNotification()
  : notification_group_id_()
  , notification_()
{}

updateNotification::updateNotification(int32 notification_group_id_, object_ptr<notification> &&notification_)
  : notification_group_id_(notification_group_id_)
  , notification_(std::move(notification_))
{}

const std::int32_t updateNotification::ID;

object_ptr<Update> updateNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNotification> res = make_object<updateNotification>();
  res->notification_group_id_ = env->GetIntField(p, res->notification_group_id_fieldID);
  res->notification_ = jni::fetch_tl_object<notification>(env, jni::fetch_object(env, p, res->notification_fieldID));
  return std::move(res);
}

void updateNotification::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, notification_group_id_fieldID, notification_group_id_);
  if (notification_ != nullptr) { jobject next; notification_->store(env, next); if (next) { env->SetObjectField(s, notification_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNotification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNotification");
    s.store_field("notificationGroupId", notification_group_id_);
    s.store_object_field("notification", static_cast<const BaseObject *>(notification_.get()));
    s.store_class_end();
  }
}

void updateNotification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNotification").c_str());
    notification_group_id_fieldID = jni::get_field_id(env, Class, "notificationGroupId", "I");
    notification_fieldID = jni::get_field_id(env, Class, "notification", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Notification;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNotificationGroup::Class;
jfieldID updateNotificationGroup::notification_group_id_fieldID;
jfieldID updateNotificationGroup::type_fieldID;
jfieldID updateNotificationGroup::chat_id_fieldID;
jfieldID updateNotificationGroup::notification_settings_chat_id_fieldID;
jfieldID updateNotificationGroup::notification_sound_id_fieldID;
jfieldID updateNotificationGroup::total_count_fieldID;
jfieldID updateNotificationGroup::added_notifications_fieldID;
jfieldID updateNotificationGroup::removed_notification_ids_fieldID;

updateNotificationGroup::updateNotificationGroup()
  : notification_group_id_()
  , type_()
  , chat_id_()
  , notification_settings_chat_id_()
  , notification_sound_id_()
  , total_count_()
  , added_notifications_()
  , removed_notification_ids_()
{}

updateNotificationGroup::updateNotificationGroup(int32 notification_group_id_, object_ptr<NotificationGroupType> &&type_, int53 chat_id_, int53 notification_settings_chat_id_, int64 notification_sound_id_, int32 total_count_, array<object_ptr<notification>> &&added_notifications_, array<int32> &&removed_notification_ids_)
  : notification_group_id_(notification_group_id_)
  , type_(std::move(type_))
  , chat_id_(chat_id_)
  , notification_settings_chat_id_(notification_settings_chat_id_)
  , notification_sound_id_(notification_sound_id_)
  , total_count_(total_count_)
  , added_notifications_(std::move(added_notifications_))
  , removed_notification_ids_(std::move(removed_notification_ids_))
{}

const std::int32_t updateNotificationGroup::ID;

object_ptr<Update> updateNotificationGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNotificationGroup> res = make_object<updateNotificationGroup>();
  res->notification_group_id_ = env->GetIntField(p, res->notification_group_id_fieldID);
  res->type_ = jni::fetch_tl_object<NotificationGroupType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->notification_settings_chat_id_ = env->GetLongField(p, res->notification_settings_chat_id_fieldID);
  res->notification_sound_id_ = env->GetLongField(p, res->notification_sound_id_fieldID);
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->added_notifications_ = jni::FetchVector<notification>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->added_notifications_fieldID));
  res->removed_notification_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->removed_notification_ids_fieldID));
  return std::move(res);
}

void updateNotificationGroup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, notification_group_id_fieldID, notification_group_id_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, notification_settings_chat_id_fieldID, notification_settings_chat_id_);
  env->SetLongField(s, notification_sound_id_fieldID, notification_sound_id_);
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, added_notifications_); if (arr_tmp_) { env->SetObjectField(s, added_notifications_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, removed_notification_ids_); if (arr_tmp_) { env->SetObjectField(s, removed_notification_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateNotificationGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNotificationGroup");
    s.store_field("notificationGroupId", notification_group_id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("chatId", chat_id_);
    s.store_field("notificationSettingsChatId", notification_settings_chat_id_);
    s.store_field("notificationSoundId", notification_sound_id_);
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("addedNotifications", added_notifications_.size()); for (const auto &_value : added_notifications_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("removedNotificationIds", removed_notification_ids_.size()); for (const auto &_value : removed_notification_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateNotificationGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNotificationGroup").c_str());
    notification_group_id_fieldID = jni::get_field_id(env, Class, "notificationGroupId", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NotificationGroupType;").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    notification_settings_chat_id_fieldID = jni::get_field_id(env, Class, "notificationSettingsChatId", "J");
    notification_sound_id_fieldID = jni::get_field_id(env, Class, "notificationSoundId", "J");
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    added_notifications_fieldID = jni::get_field_id(env, Class, "addedNotifications", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Notification;").c_str());
    removed_notification_ids_fieldID = jni::get_field_id(env, Class, "removedNotificationIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateActiveNotifications::Class;
jfieldID updateActiveNotifications::groups_fieldID;

updateActiveNotifications::updateActiveNotifications()
  : groups_()
{}

updateActiveNotifications::updateActiveNotifications(array<object_ptr<notificationGroup>> &&groups_)
  : groups_(std::move(groups_))
{}

const std::int32_t updateActiveNotifications::ID;

object_ptr<Update> updateActiveNotifications::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateActiveNotifications> res = make_object<updateActiveNotifications>();
  res->groups_ = jni::FetchVector<notificationGroup>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->groups_fieldID));
  return std::move(res);
}

void updateActiveNotifications::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, groups_); if (arr_tmp_) { env->SetObjectField(s, groups_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateActiveNotifications::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateActiveNotifications");
    { s.store_vector_begin("groups", groups_.size()); for (const auto &_value : groups_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateActiveNotifications::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateActiveNotifications").c_str());
    groups_fieldID = jni::get_field_id(env, Class, "groups", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$NotificationGroup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateHavePendingNotifications::Class;
jfieldID updateHavePendingNotifications::have_delayed_notifications_fieldID;
jfieldID updateHavePendingNotifications::have_unreceived_notifications_fieldID;

updateHavePendingNotifications::updateHavePendingNotifications()
  : have_delayed_notifications_()
  , have_unreceived_notifications_()
{}

updateHavePendingNotifications::updateHavePendingNotifications(bool have_delayed_notifications_, bool have_unreceived_notifications_)
  : have_delayed_notifications_(have_delayed_notifications_)
  , have_unreceived_notifications_(have_unreceived_notifications_)
{}

const std::int32_t updateHavePendingNotifications::ID;

object_ptr<Update> updateHavePendingNotifications::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateHavePendingNotifications> res = make_object<updateHavePendingNotifications>();
  res->have_delayed_notifications_ = (env->GetBooleanField(p, res->have_delayed_notifications_fieldID) != 0);
  res->have_unreceived_notifications_ = (env->GetBooleanField(p, res->have_unreceived_notifications_fieldID) != 0);
  return std::move(res);
}

void updateHavePendingNotifications::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, have_delayed_notifications_fieldID, have_delayed_notifications_);
  env->SetBooleanField(s, have_unreceived_notifications_fieldID, have_unreceived_notifications_);
}

void updateHavePendingNotifications::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateHavePendingNotifications");
    s.store_field("haveDelayedNotifications", have_delayed_notifications_);
    s.store_field("haveUnreceivedNotifications", have_unreceived_notifications_);
    s.store_class_end();
  }
}

void updateHavePendingNotifications::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateHavePendingNotifications").c_str());
    have_delayed_notifications_fieldID = jni::get_field_id(env, Class, "haveDelayedNotifications", "Z");
    have_unreceived_notifications_fieldID = jni::get_field_id(env, Class, "haveUnreceivedNotifications", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateDeleteMessages::Class;
jfieldID updateDeleteMessages::chat_id_fieldID;
jfieldID updateDeleteMessages::message_ids_fieldID;
jfieldID updateDeleteMessages::is_permanent_fieldID;
jfieldID updateDeleteMessages::from_cache_fieldID;

updateDeleteMessages::updateDeleteMessages()
  : chat_id_()
  , message_ids_()
  , is_permanent_()
  , from_cache_()
{}

updateDeleteMessages::updateDeleteMessages(int53 chat_id_, array<int53> &&message_ids_, bool is_permanent_, bool from_cache_)
  : chat_id_(chat_id_)
  , message_ids_(std::move(message_ids_))
  , is_permanent_(is_permanent_)
  , from_cache_(from_cache_)
{}

const std::int32_t updateDeleteMessages::ID;

object_ptr<Update> updateDeleteMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateDeleteMessages> res = make_object<updateDeleteMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  res->is_permanent_ = (env->GetBooleanField(p, res->is_permanent_fieldID) != 0);
  res->from_cache_ = (env->GetBooleanField(p, res->from_cache_fieldID) != 0);
  return std::move(res);
}

void updateDeleteMessages::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  { auto arr_tmp_ = jni::store_vector(env, message_ids_); if (arr_tmp_) { env->SetObjectField(s, message_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_permanent_fieldID, is_permanent_);
  env->SetBooleanField(s, from_cache_fieldID, from_cache_);
}

void updateDeleteMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateDeleteMessages");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("isPermanent", is_permanent_);
    s.store_field("fromCache", from_cache_);
    s.store_class_end();
  }
}

void updateDeleteMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateDeleteMessages").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    is_permanent_fieldID = jni::get_field_id(env, Class, "isPermanent", "Z");
    from_cache_fieldID = jni::get_field_id(env, Class, "fromCache", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatAction::Class;
jfieldID updateChatAction::chat_id_fieldID;
jfieldID updateChatAction::topic_id_fieldID;
jfieldID updateChatAction::sender_id_fieldID;
jfieldID updateChatAction::action_fieldID;

updateChatAction::updateChatAction()
  : chat_id_()
  , topic_id_()
  , sender_id_()
  , action_()
{}

updateChatAction::updateChatAction(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<MessageSender> &&sender_id_, object_ptr<ChatAction> &&action_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , sender_id_(std::move(sender_id_))
  , action_(std::move(action_))
{}

const std::int32_t updateChatAction::ID;

object_ptr<Update> updateChatAction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatAction> res = make_object<updateChatAction>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->action_ = jni::fetch_tl_object<ChatAction>(env, jni::fetch_object(env, p, res->action_fieldID));
  return std::move(res);
}

void updateChatAction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (topic_id_ != nullptr) { jobject next; topic_id_->store(env, next); if (next) { env->SetObjectField(s, topic_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (action_ != nullptr) { jobject next; action_->store(env, next); if (next) { env->SetObjectField(s, action_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatAction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatAction");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_object_field("action", static_cast<const BaseObject *>(action_.get()));
    s.store_class_end();
  }
}

void updateChatAction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatAction").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    action_fieldID = jni::get_field_id(env, Class, "action", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAction;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updatePendingTextMessage::Class;
jfieldID updatePendingTextMessage::chat_id_fieldID;
jfieldID updatePendingTextMessage::forum_topic_id_fieldID;
jfieldID updatePendingTextMessage::draft_id_fieldID;
jfieldID updatePendingTextMessage::text_fieldID;

updatePendingTextMessage::updatePendingTextMessage()
  : chat_id_()
  , forum_topic_id_()
  , draft_id_()
  , text_()
{}

updatePendingTextMessage::updatePendingTextMessage(int53 chat_id_, int32 forum_topic_id_, int64 draft_id_, object_ptr<formattedText> &&text_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , draft_id_(draft_id_)
  , text_(std::move(text_))
{}

const std::int32_t updatePendingTextMessage::ID;

object_ptr<Update> updatePendingTextMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updatePendingTextMessage> res = make_object<updatePendingTextMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->draft_id_ = env->GetLongField(p, res->draft_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void updatePendingTextMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, forum_topic_id_fieldID, forum_topic_id_);
  env->SetLongField(s, draft_id_fieldID, draft_id_);
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
}

void updatePendingTextMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdatePendingTextMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("draftId", draft_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void updatePendingTextMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdatePendingTextMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    forum_topic_id_fieldID = jni::get_field_id(env, Class, "forumTopicId", "I");
    draft_id_fieldID = jni::get_field_id(env, Class, "draftId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateUserStatus::Class;
jfieldID updateUserStatus::user_id_fieldID;
jfieldID updateUserStatus::status_fieldID;

updateUserStatus::updateUserStatus()
  : user_id_()
  , status_()
{}

updateUserStatus::updateUserStatus(int53 user_id_, object_ptr<UserStatus> &&status_)
  : user_id_(user_id_)
  , status_(std::move(status_))
{}

const std::int32_t updateUserStatus::ID;

object_ptr<Update> updateUserStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUserStatus> res = make_object<updateUserStatus>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->status_ = jni::fetch_tl_object<UserStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  return std::move(res);
}

void updateUserStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateUserStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUserStatus");
    s.store_field("userId", user_id_);
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_class_end();
  }
}

void updateUserStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUserStatus").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateUser::Class;
jfieldID updateUser::user_fieldID;

updateUser::updateUser()
  : user_()
{}

updateUser::updateUser(object_ptr<user> &&user_)
  : user_(std::move(user_))
{}

const std::int32_t updateUser::ID;

object_ptr<Update> updateUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUser> res = make_object<updateUser>();
  res->user_ = jni::fetch_tl_object<user>(env, jni::fetch_object(env, p, res->user_fieldID));
  return std::move(res);
}

void updateUser::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (user_ != nullptr) { jobject next; user_->store(env, next); if (next) { env->SetObjectField(s, user_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUser");
    s.store_object_field("user", static_cast<const BaseObject *>(user_.get()));
    s.store_class_end();
  }
}

void updateUser::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUser").c_str());
    user_fieldID = jni::get_field_id(env, Class, "user", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$User;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateBasicGroup::Class;
jfieldID updateBasicGroup::basic_group_fieldID;

updateBasicGroup::updateBasicGroup()
  : basic_group_()
{}

updateBasicGroup::updateBasicGroup(object_ptr<basicGroup> &&basic_group_)
  : basic_group_(std::move(basic_group_))
{}

const std::int32_t updateBasicGroup::ID;

object_ptr<Update> updateBasicGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateBasicGroup> res = make_object<updateBasicGroup>();
  res->basic_group_ = jni::fetch_tl_object<basicGroup>(env, jni::fetch_object(env, p, res->basic_group_fieldID));
  return std::move(res);
}

void updateBasicGroup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (basic_group_ != nullptr) { jobject next; basic_group_->store(env, next); if (next) { env->SetObjectField(s, basic_group_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateBasicGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateBasicGroup");
    s.store_object_field("basicGroup", static_cast<const BaseObject *>(basic_group_.get()));
    s.store_class_end();
  }
}

void updateBasicGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateBasicGroup").c_str());
    basic_group_fieldID = jni::get_field_id(env, Class, "basicGroup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BasicGroup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSupergroup::Class;
jfieldID updateSupergroup::supergroup_fieldID;

updateSupergroup::updateSupergroup()
  : supergroup_()
{}

updateSupergroup::updateSupergroup(object_ptr<supergroup> &&supergroup_)
  : supergroup_(std::move(supergroup_))
{}

const std::int32_t updateSupergroup::ID;

object_ptr<Update> updateSupergroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSupergroup> res = make_object<updateSupergroup>();
  res->supergroup_ = jni::fetch_tl_object<supergroup>(env, jni::fetch_object(env, p, res->supergroup_fieldID));
  return std::move(res);
}

void updateSupergroup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (supergroup_ != nullptr) { jobject next; supergroup_->store(env, next); if (next) { env->SetObjectField(s, supergroup_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateSupergroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSupergroup");
    s.store_object_field("supergroup", static_cast<const BaseObject *>(supergroup_.get()));
    s.store_class_end();
  }
}

void updateSupergroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSupergroup").c_str());
    supergroup_fieldID = jni::get_field_id(env, Class, "supergroup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Supergroup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSecretChat::Class;
jfieldID updateSecretChat::secret_chat_fieldID;

updateSecretChat::updateSecretChat()
  : secret_chat_()
{}

updateSecretChat::updateSecretChat(object_ptr<secretChat> &&secret_chat_)
  : secret_chat_(std::move(secret_chat_))
{}

const std::int32_t updateSecretChat::ID;

object_ptr<Update> updateSecretChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSecretChat> res = make_object<updateSecretChat>();
  res->secret_chat_ = jni::fetch_tl_object<secretChat>(env, jni::fetch_object(env, p, res->secret_chat_fieldID));
  return std::move(res);
}

void updateSecretChat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (secret_chat_ != nullptr) { jobject next; secret_chat_->store(env, next); if (next) { env->SetObjectField(s, secret_chat_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateSecretChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSecretChat");
    s.store_object_field("secretChat", static_cast<const BaseObject *>(secret_chat_.get()));
    s.store_class_end();
  }
}

void updateSecretChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSecretChat").c_str());
    secret_chat_fieldID = jni::get_field_id(env, Class, "secretChat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SecretChat;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateUserFullInfo::Class;
jfieldID updateUserFullInfo::user_id_fieldID;
jfieldID updateUserFullInfo::user_full_info_fieldID;

updateUserFullInfo::updateUserFullInfo()
  : user_id_()
  , user_full_info_()
{}

updateUserFullInfo::updateUserFullInfo(int53 user_id_, object_ptr<userFullInfo> &&user_full_info_)
  : user_id_(user_id_)
  , user_full_info_(std::move(user_full_info_))
{}

const std::int32_t updateUserFullInfo::ID;

object_ptr<Update> updateUserFullInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUserFullInfo> res = make_object<updateUserFullInfo>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->user_full_info_ = jni::fetch_tl_object<userFullInfo>(env, jni::fetch_object(env, p, res->user_full_info_fieldID));
  return std::move(res);
}

void updateUserFullInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (user_full_info_ != nullptr) { jobject next; user_full_info_->store(env, next); if (next) { env->SetObjectField(s, user_full_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateUserFullInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUserFullInfo");
    s.store_field("userId", user_id_);
    s.store_object_field("userFullInfo", static_cast<const BaseObject *>(user_full_info_.get()));
    s.store_class_end();
  }
}

void updateUserFullInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUserFullInfo").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    user_full_info_fieldID = jni::get_field_id(env, Class, "userFullInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserFullInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateBasicGroupFullInfo::Class;
jfieldID updateBasicGroupFullInfo::basic_group_id_fieldID;
jfieldID updateBasicGroupFullInfo::basic_group_full_info_fieldID;

updateBasicGroupFullInfo::updateBasicGroupFullInfo()
  : basic_group_id_()
  , basic_group_full_info_()
{}

updateBasicGroupFullInfo::updateBasicGroupFullInfo(int53 basic_group_id_, object_ptr<basicGroupFullInfo> &&basic_group_full_info_)
  : basic_group_id_(basic_group_id_)
  , basic_group_full_info_(std::move(basic_group_full_info_))
{}

const std::int32_t updateBasicGroupFullInfo::ID;

object_ptr<Update> updateBasicGroupFullInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateBasicGroupFullInfo> res = make_object<updateBasicGroupFullInfo>();
  res->basic_group_id_ = env->GetLongField(p, res->basic_group_id_fieldID);
  res->basic_group_full_info_ = jni::fetch_tl_object<basicGroupFullInfo>(env, jni::fetch_object(env, p, res->basic_group_full_info_fieldID));
  return std::move(res);
}

void updateBasicGroupFullInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, basic_group_id_fieldID, basic_group_id_);
  if (basic_group_full_info_ != nullptr) { jobject next; basic_group_full_info_->store(env, next); if (next) { env->SetObjectField(s, basic_group_full_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateBasicGroupFullInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateBasicGroupFullInfo");
    s.store_field("basicGroupId", basic_group_id_);
    s.store_object_field("basicGroupFullInfo", static_cast<const BaseObject *>(basic_group_full_info_.get()));
    s.store_class_end();
  }
}

void updateBasicGroupFullInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateBasicGroupFullInfo").c_str());
    basic_group_id_fieldID = jni::get_field_id(env, Class, "basicGroupId", "J");
    basic_group_full_info_fieldID = jni::get_field_id(env, Class, "basicGroupFullInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BasicGroupFullInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSupergroupFullInfo::Class;
jfieldID updateSupergroupFullInfo::supergroup_id_fieldID;
jfieldID updateSupergroupFullInfo::supergroup_full_info_fieldID;

updateSupergroupFullInfo::updateSupergroupFullInfo()
  : supergroup_id_()
  , supergroup_full_info_()
{}

updateSupergroupFullInfo::updateSupergroupFullInfo(int53 supergroup_id_, object_ptr<supergroupFullInfo> &&supergroup_full_info_)
  : supergroup_id_(supergroup_id_)
  , supergroup_full_info_(std::move(supergroup_full_info_))
{}

const std::int32_t updateSupergroupFullInfo::ID;

object_ptr<Update> updateSupergroupFullInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSupergroupFullInfo> res = make_object<updateSupergroupFullInfo>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->supergroup_full_info_ = jni::fetch_tl_object<supergroupFullInfo>(env, jni::fetch_object(env, p, res->supergroup_full_info_fieldID));
  return std::move(res);
}

void updateSupergroupFullInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, supergroup_id_fieldID, supergroup_id_);
  if (supergroup_full_info_ != nullptr) { jobject next; supergroup_full_info_->store(env, next); if (next) { env->SetObjectField(s, supergroup_full_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateSupergroupFullInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSupergroupFullInfo");
    s.store_field("supergroupId", supergroup_id_);
    s.store_object_field("supergroupFullInfo", static_cast<const BaseObject *>(supergroup_full_info_.get()));
    s.store_class_end();
  }
}

void updateSupergroupFullInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSupergroupFullInfo").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    supergroup_full_info_fieldID = jni::get_field_id(env, Class, "supergroupFullInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SupergroupFullInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateServiceNotification::Class;
jfieldID updateServiceNotification::type_fieldID;
jfieldID updateServiceNotification::content_fieldID;

updateServiceNotification::updateServiceNotification()
  : type_()
  , content_()
{}

updateServiceNotification::updateServiceNotification(string const &type_, object_ptr<MessageContent> &&content_)
  : type_(type_)
  , content_(std::move(content_))
{}

const std::int32_t updateServiceNotification::ID;

object_ptr<Update> updateServiceNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateServiceNotification> res = make_object<updateServiceNotification>();
  res->type_ = jni::fetch_string(env, p, res->type_fieldID);
  res->content_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  return std::move(res);
}

void updateServiceNotification::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, type_); if (nextString) { env->SetObjectField(s, type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateServiceNotification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateServiceNotification");
    s.store_field("type", type_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_class_end();
  }
}

void updateServiceNotification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateServiceNotification").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", "Ljava/lang/String;");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewOauthRequest::Class;
jfieldID updateNewOauthRequest::domain_fieldID;
jfieldID updateNewOauthRequest::location_fieldID;
jfieldID updateNewOauthRequest::url_fieldID;

updateNewOauthRequest::updateNewOauthRequest()
  : domain_()
  , location_()
  , url_()
{}

updateNewOauthRequest::updateNewOauthRequest(string const &domain_, string const &location_, string const &url_)
  : domain_(domain_)
  , location_(location_)
  , url_(url_)
{}

const std::int32_t updateNewOauthRequest::ID;

object_ptr<Update> updateNewOauthRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewOauthRequest> res = make_object<updateNewOauthRequest>();
  res->domain_ = jni::fetch_string(env, p, res->domain_fieldID);
  res->location_ = jni::fetch_string(env, p, res->location_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void updateNewOauthRequest::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, domain_); if (nextString) { env->SetObjectField(s, domain_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, location_); if (nextString) { env->SetObjectField(s, location_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateNewOauthRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewOauthRequest");
    s.store_field("domain", domain_);
    s.store_field("location", location_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void updateNewOauthRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewOauthRequest").c_str());
    domain_fieldID = jni::get_field_id(env, Class, "domain", "Ljava/lang/String;");
    location_fieldID = jni::get_field_id(env, Class, "location", "Ljava/lang/String;");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateFile::Class;
jfieldID updateFile::file_fieldID;

updateFile::updateFile()
  : file_()
{}

updateFile::updateFile(object_ptr<file> &&file_)
  : file_(std::move(file_))
{}

const std::int32_t updateFile::ID;

object_ptr<Update> updateFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFile> res = make_object<updateFile>();
  res->file_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->file_fieldID));
  return std::move(res);
}

void updateFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (file_ != nullptr) { jobject next; file_->store(env, next); if (next) { env->SetObjectField(s, file_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFile");
    s.store_object_field("file", static_cast<const BaseObject *>(file_.get()));
    s.store_class_end();
  }
}

void updateFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFile").c_str());
    file_fieldID = jni::get_field_id(env, Class, "file", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateFileGenerationStart::Class;
jfieldID updateFileGenerationStart::generation_id_fieldID;
jfieldID updateFileGenerationStart::original_path_fieldID;
jfieldID updateFileGenerationStart::destination_path_fieldID;
jfieldID updateFileGenerationStart::conversion_fieldID;

updateFileGenerationStart::updateFileGenerationStart()
  : generation_id_()
  , original_path_()
  , destination_path_()
  , conversion_()
{}

updateFileGenerationStart::updateFileGenerationStart(int64 generation_id_, string const &original_path_, string const &destination_path_, string const &conversion_)
  : generation_id_(generation_id_)
  , original_path_(original_path_)
  , destination_path_(destination_path_)
  , conversion_(conversion_)
{}

const std::int32_t updateFileGenerationStart::ID;

object_ptr<Update> updateFileGenerationStart::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFileGenerationStart> res = make_object<updateFileGenerationStart>();
  res->generation_id_ = env->GetLongField(p, res->generation_id_fieldID);
  res->original_path_ = jni::fetch_string(env, p, res->original_path_fieldID);
  res->destination_path_ = jni::fetch_string(env, p, res->destination_path_fieldID);
  res->conversion_ = jni::fetch_string(env, p, res->conversion_fieldID);
  return std::move(res);
}

void updateFileGenerationStart::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, generation_id_fieldID, generation_id_);
  { jstring nextString = jni::to_jstring(env, original_path_); if (nextString) { env->SetObjectField(s, original_path_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, destination_path_); if (nextString) { env->SetObjectField(s, destination_path_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, conversion_); if (nextString) { env->SetObjectField(s, conversion_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateFileGenerationStart::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFileGenerationStart");
    s.store_field("generationId", generation_id_);
    s.store_field("originalPath", original_path_);
    s.store_field("destinationPath", destination_path_);
    s.store_field("conversion", conversion_);
    s.store_class_end();
  }
}

void updateFileGenerationStart::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFileGenerationStart").c_str());
    generation_id_fieldID = jni::get_field_id(env, Class, "generationId", "J");
    original_path_fieldID = jni::get_field_id(env, Class, "originalPath", "Ljava/lang/String;");
    destination_path_fieldID = jni::get_field_id(env, Class, "destinationPath", "Ljava/lang/String;");
    conversion_fieldID = jni::get_field_id(env, Class, "conversion", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateFileGenerationStop::Class;
jfieldID updateFileGenerationStop::generation_id_fieldID;

updateFileGenerationStop::updateFileGenerationStop()
  : generation_id_()
{}

updateFileGenerationStop::updateFileGenerationStop(int64 generation_id_)
  : generation_id_(generation_id_)
{}

const std::int32_t updateFileGenerationStop::ID;

object_ptr<Update> updateFileGenerationStop::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFileGenerationStop> res = make_object<updateFileGenerationStop>();
  res->generation_id_ = env->GetLongField(p, res->generation_id_fieldID);
  return std::move(res);
}

void updateFileGenerationStop::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, generation_id_fieldID, generation_id_);
}

void updateFileGenerationStop::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFileGenerationStop");
    s.store_field("generationId", generation_id_);
    s.store_class_end();
  }
}

void updateFileGenerationStop::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFileGenerationStop").c_str());
    generation_id_fieldID = jni::get_field_id(env, Class, "generationId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateFileDownloads::Class;
jfieldID updateFileDownloads::total_size_fieldID;
jfieldID updateFileDownloads::total_count_fieldID;
jfieldID updateFileDownloads::downloaded_size_fieldID;

updateFileDownloads::updateFileDownloads()
  : total_size_()
  , total_count_()
  , downloaded_size_()
{}

updateFileDownloads::updateFileDownloads(int53 total_size_, int32 total_count_, int53 downloaded_size_)
  : total_size_(total_size_)
  , total_count_(total_count_)
  , downloaded_size_(downloaded_size_)
{}

const std::int32_t updateFileDownloads::ID;

object_ptr<Update> updateFileDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFileDownloads> res = make_object<updateFileDownloads>();
  res->total_size_ = env->GetLongField(p, res->total_size_fieldID);
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->downloaded_size_ = env->GetLongField(p, res->downloaded_size_fieldID);
  return std::move(res);
}

void updateFileDownloads::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, total_size_fieldID, total_size_);
  env->SetIntField(s, total_count_fieldID, total_count_);
  env->SetLongField(s, downloaded_size_fieldID, downloaded_size_);
}

void updateFileDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFileDownloads");
    s.store_field("totalSize", total_size_);
    s.store_field("totalCount", total_count_);
    s.store_field("downloadedSize", downloaded_size_);
    s.store_class_end();
  }
}

void updateFileDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFileDownloads").c_str());
    total_size_fieldID = jni::get_field_id(env, Class, "totalSize", "J");
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    downloaded_size_fieldID = jni::get_field_id(env, Class, "downloadedSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateFileAddedToDownloads::Class;
jfieldID updateFileAddedToDownloads::file_download_fieldID;
jfieldID updateFileAddedToDownloads::counts_fieldID;

updateFileAddedToDownloads::updateFileAddedToDownloads()
  : file_download_()
  , counts_()
{}

updateFileAddedToDownloads::updateFileAddedToDownloads(object_ptr<fileDownload> &&file_download_, object_ptr<downloadedFileCounts> &&counts_)
  : file_download_(std::move(file_download_))
  , counts_(std::move(counts_))
{}

const std::int32_t updateFileAddedToDownloads::ID;

object_ptr<Update> updateFileAddedToDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFileAddedToDownloads> res = make_object<updateFileAddedToDownloads>();
  res->file_download_ = jni::fetch_tl_object<fileDownload>(env, jni::fetch_object(env, p, res->file_download_fieldID));
  res->counts_ = jni::fetch_tl_object<downloadedFileCounts>(env, jni::fetch_object(env, p, res->counts_fieldID));
  return std::move(res);
}

void updateFileAddedToDownloads::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (file_download_ != nullptr) { jobject next; file_download_->store(env, next); if (next) { env->SetObjectField(s, file_download_fieldID, next); env->DeleteLocalRef(next); } }
  if (counts_ != nullptr) { jobject next; counts_->store(env, next); if (next) { env->SetObjectField(s, counts_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateFileAddedToDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFileAddedToDownloads");
    s.store_object_field("fileDownload", static_cast<const BaseObject *>(file_download_.get()));
    s.store_object_field("counts", static_cast<const BaseObject *>(counts_.get()));
    s.store_class_end();
  }
}

void updateFileAddedToDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFileAddedToDownloads").c_str());
    file_download_fieldID = jni::get_field_id(env, Class, "fileDownload", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FileDownload;").c_str());
    counts_fieldID = jni::get_field_id(env, Class, "counts", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DownloadedFileCounts;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateFileDownload::Class;
jfieldID updateFileDownload::file_id_fieldID;
jfieldID updateFileDownload::complete_date_fieldID;
jfieldID updateFileDownload::is_paused_fieldID;
jfieldID updateFileDownload::counts_fieldID;

updateFileDownload::updateFileDownload()
  : file_id_()
  , complete_date_()
  , is_paused_()
  , counts_()
{}

updateFileDownload::updateFileDownload(int32 file_id_, int32 complete_date_, bool is_paused_, object_ptr<downloadedFileCounts> &&counts_)
  : file_id_(file_id_)
  , complete_date_(complete_date_)
  , is_paused_(is_paused_)
  , counts_(std::move(counts_))
{}

const std::int32_t updateFileDownload::ID;

object_ptr<Update> updateFileDownload::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFileDownload> res = make_object<updateFileDownload>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->complete_date_ = env->GetIntField(p, res->complete_date_fieldID);
  res->is_paused_ = (env->GetBooleanField(p, res->is_paused_fieldID) != 0);
  res->counts_ = jni::fetch_tl_object<downloadedFileCounts>(env, jni::fetch_object(env, p, res->counts_fieldID));
  return std::move(res);
}

void updateFileDownload::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, file_id_fieldID, file_id_);
  env->SetIntField(s, complete_date_fieldID, complete_date_);
  env->SetBooleanField(s, is_paused_fieldID, is_paused_);
  if (counts_ != nullptr) { jobject next; counts_->store(env, next); if (next) { env->SetObjectField(s, counts_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateFileDownload::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFileDownload");
    s.store_field("fileId", file_id_);
    s.store_field("completeDate", complete_date_);
    s.store_field("isPaused", is_paused_);
    s.store_object_field("counts", static_cast<const BaseObject *>(counts_.get()));
    s.store_class_end();
  }
}

void updateFileDownload::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFileDownload").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    complete_date_fieldID = jni::get_field_id(env, Class, "completeDate", "I");
    is_paused_fieldID = jni::get_field_id(env, Class, "isPaused", "Z");
    counts_fieldID = jni::get_field_id(env, Class, "counts", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DownloadedFileCounts;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateFileRemovedFromDownloads::Class;
jfieldID updateFileRemovedFromDownloads::file_id_fieldID;
jfieldID updateFileRemovedFromDownloads::counts_fieldID;

updateFileRemovedFromDownloads::updateFileRemovedFromDownloads()
  : file_id_()
  , counts_()
{}

updateFileRemovedFromDownloads::updateFileRemovedFromDownloads(int32 file_id_, object_ptr<downloadedFileCounts> &&counts_)
  : file_id_(file_id_)
  , counts_(std::move(counts_))
{}

const std::int32_t updateFileRemovedFromDownloads::ID;

object_ptr<Update> updateFileRemovedFromDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFileRemovedFromDownloads> res = make_object<updateFileRemovedFromDownloads>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->counts_ = jni::fetch_tl_object<downloadedFileCounts>(env, jni::fetch_object(env, p, res->counts_fieldID));
  return std::move(res);
}

void updateFileRemovedFromDownloads::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, file_id_fieldID, file_id_);
  if (counts_ != nullptr) { jobject next; counts_->store(env, next); if (next) { env->SetObjectField(s, counts_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateFileRemovedFromDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFileRemovedFromDownloads");
    s.store_field("fileId", file_id_);
    s.store_object_field("counts", static_cast<const BaseObject *>(counts_.get()));
    s.store_class_end();
  }
}

void updateFileRemovedFromDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFileRemovedFromDownloads").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    counts_fieldID = jni::get_field_id(env, Class, "counts", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DownloadedFileCounts;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateApplicationVerificationRequired::Class;
jfieldID updateApplicationVerificationRequired::verification_id_fieldID;
jfieldID updateApplicationVerificationRequired::nonce_fieldID;
jfieldID updateApplicationVerificationRequired::cloud_project_number_fieldID;

updateApplicationVerificationRequired::updateApplicationVerificationRequired()
  : verification_id_()
  , nonce_()
  , cloud_project_number_()
{}

updateApplicationVerificationRequired::updateApplicationVerificationRequired(int53 verification_id_, string const &nonce_, int64 cloud_project_number_)
  : verification_id_(verification_id_)
  , nonce_(nonce_)
  , cloud_project_number_(cloud_project_number_)
{}

const std::int32_t updateApplicationVerificationRequired::ID;

object_ptr<Update> updateApplicationVerificationRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateApplicationVerificationRequired> res = make_object<updateApplicationVerificationRequired>();
  res->verification_id_ = env->GetLongField(p, res->verification_id_fieldID);
  res->nonce_ = jni::fetch_string(env, p, res->nonce_fieldID);
  res->cloud_project_number_ = env->GetLongField(p, res->cloud_project_number_fieldID);
  return std::move(res);
}

void updateApplicationVerificationRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, verification_id_fieldID, verification_id_);
  { jstring nextString = jni::to_jstring(env, nonce_); if (nextString) { env->SetObjectField(s, nonce_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, cloud_project_number_fieldID, cloud_project_number_);
}

void updateApplicationVerificationRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateApplicationVerificationRequired");
    s.store_field("verificationId", verification_id_);
    s.store_field("nonce", nonce_);
    s.store_field("cloudProjectNumber", cloud_project_number_);
    s.store_class_end();
  }
}

void updateApplicationVerificationRequired::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateApplicationVerificationRequired").c_str());
    verification_id_fieldID = jni::get_field_id(env, Class, "verificationId", "J");
    nonce_fieldID = jni::get_field_id(env, Class, "nonce", "Ljava/lang/String;");
    cloud_project_number_fieldID = jni::get_field_id(env, Class, "cloudProjectNumber", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateApplicationRecaptchaVerificationRequired::Class;
jfieldID updateApplicationRecaptchaVerificationRequired::verification_id_fieldID;
jfieldID updateApplicationRecaptchaVerificationRequired::action_fieldID;
jfieldID updateApplicationRecaptchaVerificationRequired::recaptcha_key_id_fieldID;

updateApplicationRecaptchaVerificationRequired::updateApplicationRecaptchaVerificationRequired()
  : verification_id_()
  , action_()
  , recaptcha_key_id_()
{}

updateApplicationRecaptchaVerificationRequired::updateApplicationRecaptchaVerificationRequired(int53 verification_id_, string const &action_, string const &recaptcha_key_id_)
  : verification_id_(verification_id_)
  , action_(action_)
  , recaptcha_key_id_(recaptcha_key_id_)
{}

const std::int32_t updateApplicationRecaptchaVerificationRequired::ID;

object_ptr<Update> updateApplicationRecaptchaVerificationRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateApplicationRecaptchaVerificationRequired> res = make_object<updateApplicationRecaptchaVerificationRequired>();
  res->verification_id_ = env->GetLongField(p, res->verification_id_fieldID);
  res->action_ = jni::fetch_string(env, p, res->action_fieldID);
  res->recaptcha_key_id_ = jni::fetch_string(env, p, res->recaptcha_key_id_fieldID);
  return std::move(res);
}

void updateApplicationRecaptchaVerificationRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, verification_id_fieldID, verification_id_);
  { jstring nextString = jni::to_jstring(env, action_); if (nextString) { env->SetObjectField(s, action_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, recaptcha_key_id_); if (nextString) { env->SetObjectField(s, recaptcha_key_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateApplicationRecaptchaVerificationRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateApplicationRecaptchaVerificationRequired");
    s.store_field("verificationId", verification_id_);
    s.store_field("action", action_);
    s.store_field("recaptchaKeyId", recaptcha_key_id_);
    s.store_class_end();
  }
}

void updateApplicationRecaptchaVerificationRequired::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateApplicationRecaptchaVerificationRequired").c_str());
    verification_id_fieldID = jni::get_field_id(env, Class, "verificationId", "J");
    action_fieldID = jni::get_field_id(env, Class, "action", "Ljava/lang/String;");
    recaptcha_key_id_fieldID = jni::get_field_id(env, Class, "recaptchaKeyId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateCall::Class;
jfieldID updateCall::call_fieldID;

updateCall::updateCall()
  : call_()
{}

updateCall::updateCall(object_ptr<call> &&call_)
  : call_(std::move(call_))
{}

const std::int32_t updateCall::ID;

object_ptr<Update> updateCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateCall> res = make_object<updateCall>();
  res->call_ = jni::fetch_tl_object<call>(env, jni::fetch_object(env, p, res->call_fieldID));
  return std::move(res);
}

void updateCall::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (call_ != nullptr) { jobject next; call_->store(env, next); if (next) { env->SetObjectField(s, call_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateCall");
    s.store_object_field("call", static_cast<const BaseObject *>(call_.get()));
    s.store_class_end();
  }
}

void updateCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateCall").c_str());
    call_fieldID = jni::get_field_id(env, Class, "call", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Call;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCall::Class;
jfieldID updateGroupCall::group_call_fieldID;

updateGroupCall::updateGroupCall()
  : group_call_()
{}

updateGroupCall::updateGroupCall(object_ptr<groupCall> &&group_call_)
  : group_call_(std::move(group_call_))
{}

const std::int32_t updateGroupCall::ID;

object_ptr<Update> updateGroupCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCall> res = make_object<updateGroupCall>();
  res->group_call_ = jni::fetch_tl_object<groupCall>(env, jni::fetch_object(env, p, res->group_call_fieldID));
  return std::move(res);
}

void updateGroupCall::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (group_call_ != nullptr) { jobject next; group_call_->store(env, next); if (next) { env->SetObjectField(s, group_call_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateGroupCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCall");
    s.store_object_field("groupCall", static_cast<const BaseObject *>(group_call_.get()));
    s.store_class_end();
  }
}

void updateGroupCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCall").c_str());
    group_call_fieldID = jni::get_field_id(env, Class, "groupCall", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCall;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCallParticipant::Class;
jfieldID updateGroupCallParticipant::group_call_id_fieldID;
jfieldID updateGroupCallParticipant::participant_fieldID;

updateGroupCallParticipant::updateGroupCallParticipant()
  : group_call_id_()
  , participant_()
{}

updateGroupCallParticipant::updateGroupCallParticipant(int32 group_call_id_, object_ptr<groupCallParticipant> &&participant_)
  : group_call_id_(group_call_id_)
  , participant_(std::move(participant_))
{}

const std::int32_t updateGroupCallParticipant::ID;

object_ptr<Update> updateGroupCallParticipant::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCallParticipant> res = make_object<updateGroupCallParticipant>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->participant_ = jni::fetch_tl_object<groupCallParticipant>(env, jni::fetch_object(env, p, res->participant_fieldID));
  return std::move(res);
}

void updateGroupCallParticipant::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  if (participant_ != nullptr) { jobject next; participant_->store(env, next); if (next) { env->SetObjectField(s, participant_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateGroupCallParticipant::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCallParticipant");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("participant", static_cast<const BaseObject *>(participant_.get()));
    s.store_class_end();
  }
}

void updateGroupCallParticipant::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCallParticipant").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    participant_fieldID = jni::get_field_id(env, Class, "participant", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCallParticipant;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCallParticipants::Class;
jfieldID updateGroupCallParticipants::group_call_id_fieldID;
jfieldID updateGroupCallParticipants::participant_user_ids_fieldID;

updateGroupCallParticipants::updateGroupCallParticipants()
  : group_call_id_()
  , participant_user_ids_()
{}

updateGroupCallParticipants::updateGroupCallParticipants(int32 group_call_id_, array<int64> &&participant_user_ids_)
  : group_call_id_(group_call_id_)
  , participant_user_ids_(std::move(participant_user_ids_))
{}

const std::int32_t updateGroupCallParticipants::ID;

object_ptr<Update> updateGroupCallParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCallParticipants> res = make_object<updateGroupCallParticipants>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->participant_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->participant_user_ids_fieldID));
  return std::move(res);
}

void updateGroupCallParticipants::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  { auto arr_tmp_ = jni::store_vector(env, participant_user_ids_); if (arr_tmp_) { env->SetObjectField(s, participant_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateGroupCallParticipants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCallParticipants");
    s.store_field("groupCallId", group_call_id_);
    { s.store_vector_begin("participantUserIds", participant_user_ids_.size()); for (const auto &_value : participant_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateGroupCallParticipants::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCallParticipants").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    participant_user_ids_fieldID = jni::get_field_id(env, Class, "participantUserIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCallVerificationState::Class;
jfieldID updateGroupCallVerificationState::group_call_id_fieldID;
jfieldID updateGroupCallVerificationState::generation_fieldID;
jfieldID updateGroupCallVerificationState::emojis_fieldID;

updateGroupCallVerificationState::updateGroupCallVerificationState()
  : group_call_id_()
  , generation_()
  , emojis_()
{}

updateGroupCallVerificationState::updateGroupCallVerificationState(int32 group_call_id_, int32 generation_, array<string> &&emojis_)
  : group_call_id_(group_call_id_)
  , generation_(generation_)
  , emojis_(std::move(emojis_))
{}

const std::int32_t updateGroupCallVerificationState::ID;

object_ptr<Update> updateGroupCallVerificationState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCallVerificationState> res = make_object<updateGroupCallVerificationState>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->generation_ = env->GetIntField(p, res->generation_fieldID);
  res->emojis_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emojis_fieldID));
  return std::move(res);
}

void updateGroupCallVerificationState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  env->SetIntField(s, generation_fieldID, generation_);
  { auto arr_tmp_ = jni::store_vector(env, emojis_); if (arr_tmp_) { env->SetObjectField(s, emojis_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateGroupCallVerificationState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCallVerificationState");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("generation", generation_);
    { s.store_vector_begin("emojis", emojis_.size()); for (const auto &_value : emojis_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateGroupCallVerificationState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCallVerificationState").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    generation_fieldID = jni::get_field_id(env, Class, "generation", "I");
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateNewGroupCallMessage::Class;
jfieldID updateNewGroupCallMessage::group_call_id_fieldID;
jfieldID updateNewGroupCallMessage::message_fieldID;

updateNewGroupCallMessage::updateNewGroupCallMessage()
  : group_call_id_()
  , message_()
{}

updateNewGroupCallMessage::updateNewGroupCallMessage(int32 group_call_id_, object_ptr<groupCallMessage> &&message_)
  : group_call_id_(group_call_id_)
  , message_(std::move(message_))
{}

const std::int32_t updateNewGroupCallMessage::ID;

object_ptr<Update> updateNewGroupCallMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewGroupCallMessage> res = make_object<updateNewGroupCallMessage>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->message_ = jni::fetch_tl_object<groupCallMessage>(env, jni::fetch_object(env, p, res->message_fieldID));
  return std::move(res);
}

void updateNewGroupCallMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewGroupCallMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewGroupCallMessage");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void updateNewGroupCallMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewGroupCallMessage").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCallMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewGroupCallPaidReaction::Class;
jfieldID updateNewGroupCallPaidReaction::group_call_id_fieldID;
jfieldID updateNewGroupCallPaidReaction::sender_id_fieldID;
jfieldID updateNewGroupCallPaidReaction::star_count_fieldID;

updateNewGroupCallPaidReaction::updateNewGroupCallPaidReaction()
  : group_call_id_()
  , sender_id_()
  , star_count_()
{}

updateNewGroupCallPaidReaction::updateNewGroupCallPaidReaction(int32 group_call_id_, object_ptr<MessageSender> &&sender_id_, int53 star_count_)
  : group_call_id_(group_call_id_)
  , sender_id_(std::move(sender_id_))
  , star_count_(star_count_)
{}

const std::int32_t updateNewGroupCallPaidReaction::ID;

object_ptr<Update> updateNewGroupCallPaidReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewGroupCallPaidReaction> res = make_object<updateNewGroupCallPaidReaction>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

void updateNewGroupCallPaidReaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, star_count_fieldID, star_count_);
}

void updateNewGroupCallPaidReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewGroupCallPaidReaction");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

void updateNewGroupCallPaidReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewGroupCallPaidReaction").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCallMessageSendFailed::Class;
jfieldID updateGroupCallMessageSendFailed::group_call_id_fieldID;
jfieldID updateGroupCallMessageSendFailed::message_id_fieldID;
jfieldID updateGroupCallMessageSendFailed::error_fieldID;

updateGroupCallMessageSendFailed::updateGroupCallMessageSendFailed()
  : group_call_id_()
  , message_id_()
  , error_()
{}

updateGroupCallMessageSendFailed::updateGroupCallMessageSendFailed(int32 group_call_id_, int32 message_id_, object_ptr<error> &&error_)
  : group_call_id_(group_call_id_)
  , message_id_(message_id_)
  , error_(std::move(error_))
{}

const std::int32_t updateGroupCallMessageSendFailed::ID;

object_ptr<Update> updateGroupCallMessageSendFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCallMessageSendFailed> res = make_object<updateGroupCallMessageSendFailed>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->message_id_ = env->GetIntField(p, res->message_id_fieldID);
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  return std::move(res);
}

void updateGroupCallMessageSendFailed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  env->SetIntField(s, message_id_fieldID, message_id_);
  if (error_ != nullptr) { jobject next; error_->store(env, next); if (next) { env->SetObjectField(s, error_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateGroupCallMessageSendFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCallMessageSendFailed");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_class_end();
  }
}

void updateGroupCallMessageSendFailed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCallMessageSendFailed").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "I");
    error_fieldID = jni::get_field_id(env, Class, "error", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Error;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCallMessagesDeleted::Class;
jfieldID updateGroupCallMessagesDeleted::group_call_id_fieldID;
jfieldID updateGroupCallMessagesDeleted::message_ids_fieldID;

updateGroupCallMessagesDeleted::updateGroupCallMessagesDeleted()
  : group_call_id_()
  , message_ids_()
{}

updateGroupCallMessagesDeleted::updateGroupCallMessagesDeleted(int32 group_call_id_, array<int32> &&message_ids_)
  : group_call_id_(group_call_id_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t updateGroupCallMessagesDeleted::ID;

object_ptr<Update> updateGroupCallMessagesDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCallMessagesDeleted> res = make_object<updateGroupCallMessagesDeleted>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return std::move(res);
}

void updateGroupCallMessagesDeleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  { auto arr_tmp_ = jni::store_vector(env, message_ids_); if (arr_tmp_) { env->SetObjectField(s, message_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateGroupCallMessagesDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCallMessagesDeleted");
    s.store_field("groupCallId", group_call_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateGroupCallMessagesDeleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCallMessagesDeleted").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateLiveStoryTopDonors::Class;
jfieldID updateLiveStoryTopDonors::group_call_id_fieldID;
jfieldID updateLiveStoryTopDonors::donors_fieldID;

updateLiveStoryTopDonors::updateLiveStoryTopDonors()
  : group_call_id_()
  , donors_()
{}

updateLiveStoryTopDonors::updateLiveStoryTopDonors(int32 group_call_id_, object_ptr<liveStoryDonors> &&donors_)
  : group_call_id_(group_call_id_)
  , donors_(std::move(donors_))
{}

const std::int32_t updateLiveStoryTopDonors::ID;

object_ptr<Update> updateLiveStoryTopDonors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateLiveStoryTopDonors> res = make_object<updateLiveStoryTopDonors>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->donors_ = jni::fetch_tl_object<liveStoryDonors>(env, jni::fetch_object(env, p, res->donors_fieldID));
  return std::move(res);
}

void updateLiveStoryTopDonors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  if (donors_ != nullptr) { jobject next; donors_->store(env, next); if (next) { env->SetObjectField(s, donors_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateLiveStoryTopDonors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateLiveStoryTopDonors");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("donors", static_cast<const BaseObject *>(donors_.get()));
    s.store_class_end();
  }
}

void updateLiveStoryTopDonors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateLiveStoryTopDonors").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    donors_fieldID = jni::get_field_id(env, Class, "donors", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LiveStoryDonors;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewCallSignalingData::Class;
jfieldID updateNewCallSignalingData::call_id_fieldID;
jfieldID updateNewCallSignalingData::data_fieldID;

updateNewCallSignalingData::updateNewCallSignalingData()
  : call_id_()
  , data_()
{}

updateNewCallSignalingData::updateNewCallSignalingData(int32 call_id_, bytes const &data_)
  : call_id_(call_id_)
  , data_(std::move(data_))
{}

const std::int32_t updateNewCallSignalingData::ID;

object_ptr<Update> updateNewCallSignalingData::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewCallSignalingData> res = make_object<updateNewCallSignalingData>();
  res->call_id_ = env->GetIntField(p, res->call_id_fieldID);
  res->data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_fieldID));
  return std::move(res);
}

void updateNewCallSignalingData::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, call_id_fieldID, call_id_);
  { jbyteArray nextBytes = jni::to_bytes(env, data_); if (nextBytes) { env->SetObjectField(s, data_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
}

void updateNewCallSignalingData::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewCallSignalingData");
    s.store_field("callId", call_id_);
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

void updateNewCallSignalingData::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewCallSignalingData").c_str());
    call_id_fieldID = jni::get_field_id(env, Class, "callId", "I");
    data_fieldID = jni::get_field_id(env, Class, "data", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass updateGiftAuctionState::Class;
jfieldID updateGiftAuctionState::state_fieldID;

updateGiftAuctionState::updateGiftAuctionState()
  : state_()
{}

updateGiftAuctionState::updateGiftAuctionState(object_ptr<giftAuctionState> &&state_)
  : state_(std::move(state_))
{}

const std::int32_t updateGiftAuctionState::ID;

object_ptr<Update> updateGiftAuctionState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGiftAuctionState> res = make_object<updateGiftAuctionState>();
  res->state_ = jni::fetch_tl_object<giftAuctionState>(env, jni::fetch_object(env, p, res->state_fieldID));
  return std::move(res);
}

void updateGiftAuctionState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateGiftAuctionState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGiftAuctionState");
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_class_end();
  }
}

void updateGiftAuctionState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGiftAuctionState").c_str());
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftAuctionState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateActiveGiftAuctions::Class;
jfieldID updateActiveGiftAuctions::states_fieldID;

updateActiveGiftAuctions::updateActiveGiftAuctions()
  : states_()
{}

updateActiveGiftAuctions::updateActiveGiftAuctions(array<object_ptr<giftAuctionState>> &&states_)
  : states_(std::move(states_))
{}

const std::int32_t updateActiveGiftAuctions::ID;

object_ptr<Update> updateActiveGiftAuctions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateActiveGiftAuctions> res = make_object<updateActiveGiftAuctions>();
  res->states_ = jni::FetchVector<giftAuctionState>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->states_fieldID));
  return std::move(res);
}

void updateActiveGiftAuctions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, states_); if (arr_tmp_) { env->SetObjectField(s, states_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateActiveGiftAuctions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateActiveGiftAuctions");
    { s.store_vector_begin("states", states_.size()); for (const auto &_value : states_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateActiveGiftAuctions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateActiveGiftAuctions").c_str());
    states_fieldID = jni::get_field_id(env, Class, "states", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GiftAuctionState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateUserPrivacySettingRules::Class;
jfieldID updateUserPrivacySettingRules::setting_fieldID;
jfieldID updateUserPrivacySettingRules::rules_fieldID;

updateUserPrivacySettingRules::updateUserPrivacySettingRules()
  : setting_()
  , rules_()
{}

updateUserPrivacySettingRules::updateUserPrivacySettingRules(object_ptr<UserPrivacySetting> &&setting_, object_ptr<userPrivacySettingRules> &&rules_)
  : setting_(std::move(setting_))
  , rules_(std::move(rules_))
{}

const std::int32_t updateUserPrivacySettingRules::ID;

object_ptr<Update> updateUserPrivacySettingRules::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUserPrivacySettingRules> res = make_object<updateUserPrivacySettingRules>();
  res->setting_ = jni::fetch_tl_object<UserPrivacySetting>(env, jni::fetch_object(env, p, res->setting_fieldID));
  res->rules_ = jni::fetch_tl_object<userPrivacySettingRules>(env, jni::fetch_object(env, p, res->rules_fieldID));
  return std::move(res);
}

void updateUserPrivacySettingRules::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (setting_ != nullptr) { jobject next; setting_->store(env, next); if (next) { env->SetObjectField(s, setting_fieldID, next); env->DeleteLocalRef(next); } }
  if (rules_ != nullptr) { jobject next; rules_->store(env, next); if (next) { env->SetObjectField(s, rules_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateUserPrivacySettingRules::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUserPrivacySettingRules");
    s.store_object_field("setting", static_cast<const BaseObject *>(setting_.get()));
    s.store_object_field("rules", static_cast<const BaseObject *>(rules_.get()));
    s.store_class_end();
  }
}

void updateUserPrivacySettingRules::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUserPrivacySettingRules").c_str());
    setting_fieldID = jni::get_field_id(env, Class, "setting", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserPrivacySetting;").c_str());
    rules_fieldID = jni::get_field_id(env, Class, "rules", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserPrivacySettingRules;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateUnreadMessageCount::Class;
jfieldID updateUnreadMessageCount::chat_list_fieldID;
jfieldID updateUnreadMessageCount::unread_count_fieldID;
jfieldID updateUnreadMessageCount::unread_unmuted_count_fieldID;

updateUnreadMessageCount::updateUnreadMessageCount()
  : chat_list_()
  , unread_count_()
  , unread_unmuted_count_()
{}

updateUnreadMessageCount::updateUnreadMessageCount(object_ptr<ChatList> &&chat_list_, int32 unread_count_, int32 unread_unmuted_count_)
  : chat_list_(std::move(chat_list_))
  , unread_count_(unread_count_)
  , unread_unmuted_count_(unread_unmuted_count_)
{}

const std::int32_t updateUnreadMessageCount::ID;

object_ptr<Update> updateUnreadMessageCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUnreadMessageCount> res = make_object<updateUnreadMessageCount>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->unread_count_ = env->GetIntField(p, res->unread_count_fieldID);
  res->unread_unmuted_count_ = env->GetIntField(p, res->unread_unmuted_count_fieldID);
  return std::move(res);
}

void updateUnreadMessageCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (chat_list_ != nullptr) { jobject next; chat_list_->store(env, next); if (next) { env->SetObjectField(s, chat_list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, unread_count_fieldID, unread_count_);
  env->SetIntField(s, unread_unmuted_count_fieldID, unread_unmuted_count_);
}

void updateUnreadMessageCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUnreadMessageCount");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_field("unreadCount", unread_count_);
    s.store_field("unreadUnmutedCount", unread_unmuted_count_);
    s.store_class_end();
  }
}

void updateUnreadMessageCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUnreadMessageCount").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    unread_count_fieldID = jni::get_field_id(env, Class, "unreadCount", "I");
    unread_unmuted_count_fieldID = jni::get_field_id(env, Class, "unreadUnmutedCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateUnreadChatCount::Class;
jfieldID updateUnreadChatCount::chat_list_fieldID;
jfieldID updateUnreadChatCount::total_count_fieldID;
jfieldID updateUnreadChatCount::unread_count_fieldID;
jfieldID updateUnreadChatCount::unread_unmuted_count_fieldID;
jfieldID updateUnreadChatCount::marked_as_unread_count_fieldID;
jfieldID updateUnreadChatCount::marked_as_unread_unmuted_count_fieldID;

updateUnreadChatCount::updateUnreadChatCount()
  : chat_list_()
  , total_count_()
  , unread_count_()
  , unread_unmuted_count_()
  , marked_as_unread_count_()
  , marked_as_unread_unmuted_count_()
{}

updateUnreadChatCount::updateUnreadChatCount(object_ptr<ChatList> &&chat_list_, int32 total_count_, int32 unread_count_, int32 unread_unmuted_count_, int32 marked_as_unread_count_, int32 marked_as_unread_unmuted_count_)
  : chat_list_(std::move(chat_list_))
  , total_count_(total_count_)
  , unread_count_(unread_count_)
  , unread_unmuted_count_(unread_unmuted_count_)
  , marked_as_unread_count_(marked_as_unread_count_)
  , marked_as_unread_unmuted_count_(marked_as_unread_unmuted_count_)
{}

const std::int32_t updateUnreadChatCount::ID;

object_ptr<Update> updateUnreadChatCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUnreadChatCount> res = make_object<updateUnreadChatCount>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->unread_count_ = env->GetIntField(p, res->unread_count_fieldID);
  res->unread_unmuted_count_ = env->GetIntField(p, res->unread_unmuted_count_fieldID);
  res->marked_as_unread_count_ = env->GetIntField(p, res->marked_as_unread_count_fieldID);
  res->marked_as_unread_unmuted_count_ = env->GetIntField(p, res->marked_as_unread_unmuted_count_fieldID);
  return std::move(res);
}

void updateUnreadChatCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (chat_list_ != nullptr) { jobject next; chat_list_->store(env, next); if (next) { env->SetObjectField(s, chat_list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, total_count_fieldID, total_count_);
  env->SetIntField(s, unread_count_fieldID, unread_count_);
  env->SetIntField(s, unread_unmuted_count_fieldID, unread_unmuted_count_);
  env->SetIntField(s, marked_as_unread_count_fieldID, marked_as_unread_count_);
  env->SetIntField(s, marked_as_unread_unmuted_count_fieldID, marked_as_unread_unmuted_count_);
}

void updateUnreadChatCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUnreadChatCount");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_field("totalCount", total_count_);
    s.store_field("unreadCount", unread_count_);
    s.store_field("unreadUnmutedCount", unread_unmuted_count_);
    s.store_field("markedAsUnreadCount", marked_as_unread_count_);
    s.store_field("markedAsUnreadUnmutedCount", marked_as_unread_unmuted_count_);
    s.store_class_end();
  }
}

void updateUnreadChatCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUnreadChatCount").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    unread_count_fieldID = jni::get_field_id(env, Class, "unreadCount", "I");
    unread_unmuted_count_fieldID = jni::get_field_id(env, Class, "unreadUnmutedCount", "I");
    marked_as_unread_count_fieldID = jni::get_field_id(env, Class, "markedAsUnreadCount", "I");
    marked_as_unread_unmuted_count_fieldID = jni::get_field_id(env, Class, "markedAsUnreadUnmutedCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateStory::Class;
jfieldID updateStory::story_fieldID;

updateStory::updateStory()
  : story_()
{}

updateStory::updateStory(object_ptr<story> &&story_)
  : story_(std::move(story_))
{}

const std::int32_t updateStory::ID;

object_ptr<Update> updateStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStory> res = make_object<updateStory>();
  res->story_ = jni::fetch_tl_object<story>(env, jni::fetch_object(env, p, res->story_fieldID));
  return std::move(res);
}

void updateStory::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (story_ != nullptr) { jobject next; story_->store(env, next); if (next) { env->SetObjectField(s, story_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStory");
    s.store_object_field("story", static_cast<const BaseObject *>(story_.get()));
    s.store_class_end();
  }
}

void updateStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStory").c_str());
    story_fieldID = jni::get_field_id(env, Class, "story", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Story;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateStoryDeleted::Class;
jfieldID updateStoryDeleted::story_poster_chat_id_fieldID;
jfieldID updateStoryDeleted::story_id_fieldID;

updateStoryDeleted::updateStoryDeleted()
  : story_poster_chat_id_()
  , story_id_()
{}

updateStoryDeleted::updateStoryDeleted(int53 story_poster_chat_id_, int32 story_id_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
{}

const std::int32_t updateStoryDeleted::ID;

object_ptr<Update> updateStoryDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStoryDeleted> res = make_object<updateStoryDeleted>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  return std::move(res);
}

void updateStoryDeleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, story_poster_chat_id_fieldID, story_poster_chat_id_);
  env->SetIntField(s, story_id_fieldID, story_id_);
}

void updateStoryDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStoryDeleted");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_class_end();
  }
}

void updateStoryDeleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStoryDeleted").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateStoryPostSucceeded::Class;
jfieldID updateStoryPostSucceeded::story_fieldID;
jfieldID updateStoryPostSucceeded::old_story_id_fieldID;

updateStoryPostSucceeded::updateStoryPostSucceeded()
  : story_()
  , old_story_id_()
{}

updateStoryPostSucceeded::updateStoryPostSucceeded(object_ptr<story> &&story_, int32 old_story_id_)
  : story_(std::move(story_))
  , old_story_id_(old_story_id_)
{}

const std::int32_t updateStoryPostSucceeded::ID;

object_ptr<Update> updateStoryPostSucceeded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStoryPostSucceeded> res = make_object<updateStoryPostSucceeded>();
  res->story_ = jni::fetch_tl_object<story>(env, jni::fetch_object(env, p, res->story_fieldID));
  res->old_story_id_ = env->GetIntField(p, res->old_story_id_fieldID);
  return std::move(res);
}

void updateStoryPostSucceeded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (story_ != nullptr) { jobject next; story_->store(env, next); if (next) { env->SetObjectField(s, story_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, old_story_id_fieldID, old_story_id_);
}

void updateStoryPostSucceeded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStoryPostSucceeded");
    s.store_object_field("story", static_cast<const BaseObject *>(story_.get()));
    s.store_field("oldStoryId", old_story_id_);
    s.store_class_end();
  }
}

void updateStoryPostSucceeded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStoryPostSucceeded").c_str());
    story_fieldID = jni::get_field_id(env, Class, "story", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Story;").c_str());
    old_story_id_fieldID = jni::get_field_id(env, Class, "oldStoryId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateStoryPostFailed::Class;
jfieldID updateStoryPostFailed::story_fieldID;
jfieldID updateStoryPostFailed::error_fieldID;
jfieldID updateStoryPostFailed::error_type_fieldID;

updateStoryPostFailed::updateStoryPostFailed()
  : story_()
  , error_()
  , error_type_()
{}

updateStoryPostFailed::updateStoryPostFailed(object_ptr<story> &&story_, object_ptr<error> &&error_, object_ptr<CanPostStoryResult> &&error_type_)
  : story_(std::move(story_))
  , error_(std::move(error_))
  , error_type_(std::move(error_type_))
{}

const std::int32_t updateStoryPostFailed::ID;

object_ptr<Update> updateStoryPostFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStoryPostFailed> res = make_object<updateStoryPostFailed>();
  res->story_ = jni::fetch_tl_object<story>(env, jni::fetch_object(env, p, res->story_fieldID));
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  res->error_type_ = jni::fetch_tl_object<CanPostStoryResult>(env, jni::fetch_object(env, p, res->error_type_fieldID));
  return std::move(res);
}

void updateStoryPostFailed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (story_ != nullptr) { jobject next; story_->store(env, next); if (next) { env->SetObjectField(s, story_fieldID, next); env->DeleteLocalRef(next); } }
  if (error_ != nullptr) { jobject next; error_->store(env, next); if (next) { env->SetObjectField(s, error_fieldID, next); env->DeleteLocalRef(next); } }
  if (error_type_ != nullptr) { jobject next; error_type_->store(env, next); if (next) { env->SetObjectField(s, error_type_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateStoryPostFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStoryPostFailed");
    s.store_object_field("story", static_cast<const BaseObject *>(story_.get()));
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_object_field("errorType", static_cast<const BaseObject *>(error_type_.get()));
    s.store_class_end();
  }
}

void updateStoryPostFailed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStoryPostFailed").c_str());
    story_fieldID = jni::get_field_id(env, Class, "story", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Story;").c_str());
    error_fieldID = jni::get_field_id(env, Class, "error", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Error;").c_str());
    error_type_fieldID = jni::get_field_id(env, Class, "errorType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CanPostStoryResult;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatActiveStories::Class;
jfieldID updateChatActiveStories::active_stories_fieldID;

updateChatActiveStories::updateChatActiveStories()
  : active_stories_()
{}

updateChatActiveStories::updateChatActiveStories(object_ptr<chatActiveStories> &&active_stories_)
  : active_stories_(std::move(active_stories_))
{}

const std::int32_t updateChatActiveStories::ID;

object_ptr<Update> updateChatActiveStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatActiveStories> res = make_object<updateChatActiveStories>();
  res->active_stories_ = jni::fetch_tl_object<chatActiveStories>(env, jni::fetch_object(env, p, res->active_stories_fieldID));
  return std::move(res);
}

void updateChatActiveStories::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (active_stories_ != nullptr) { jobject next; active_stories_->store(env, next); if (next) { env->SetObjectField(s, active_stories_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatActiveStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatActiveStories");
    s.store_object_field("activeStories", static_cast<const BaseObject *>(active_stories_.get()));
    s.store_class_end();
  }
}

void updateChatActiveStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatActiveStories").c_str());
    active_stories_fieldID = jni::get_field_id(env, Class, "activeStories", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatActiveStories;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateStoryListChatCount::Class;
jfieldID updateStoryListChatCount::story_list_fieldID;
jfieldID updateStoryListChatCount::chat_count_fieldID;

updateStoryListChatCount::updateStoryListChatCount()
  : story_list_()
  , chat_count_()
{}

updateStoryListChatCount::updateStoryListChatCount(object_ptr<StoryList> &&story_list_, int32 chat_count_)
  : story_list_(std::move(story_list_))
  , chat_count_(chat_count_)
{}

const std::int32_t updateStoryListChatCount::ID;

object_ptr<Update> updateStoryListChatCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStoryListChatCount> res = make_object<updateStoryListChatCount>();
  res->story_list_ = jni::fetch_tl_object<StoryList>(env, jni::fetch_object(env, p, res->story_list_fieldID));
  res->chat_count_ = env->GetIntField(p, res->chat_count_fieldID);
  return std::move(res);
}

void updateStoryListChatCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (story_list_ != nullptr) { jobject next; story_list_->store(env, next); if (next) { env->SetObjectField(s, story_list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, chat_count_fieldID, chat_count_);
}

void updateStoryListChatCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStoryListChatCount");
    s.store_object_field("storyList", static_cast<const BaseObject *>(story_list_.get()));
    s.store_field("chatCount", chat_count_);
    s.store_class_end();
  }
}

void updateStoryListChatCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStoryListChatCount").c_str());
    story_list_fieldID = jni::get_field_id(env, Class, "storyList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryList;").c_str());
    chat_count_fieldID = jni::get_field_id(env, Class, "chatCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateStoryStealthMode::Class;
jfieldID updateStoryStealthMode::active_until_date_fieldID;
jfieldID updateStoryStealthMode::cooldown_until_date_fieldID;

updateStoryStealthMode::updateStoryStealthMode()
  : active_until_date_()
  , cooldown_until_date_()
{}

updateStoryStealthMode::updateStoryStealthMode(int32 active_until_date_, int32 cooldown_until_date_)
  : active_until_date_(active_until_date_)
  , cooldown_until_date_(cooldown_until_date_)
{}

const std::int32_t updateStoryStealthMode::ID;

object_ptr<Update> updateStoryStealthMode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStoryStealthMode> res = make_object<updateStoryStealthMode>();
  res->active_until_date_ = env->GetIntField(p, res->active_until_date_fieldID);
  res->cooldown_until_date_ = env->GetIntField(p, res->cooldown_until_date_fieldID);
  return std::move(res);
}

void updateStoryStealthMode::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, active_until_date_fieldID, active_until_date_);
  env->SetIntField(s, cooldown_until_date_fieldID, cooldown_until_date_);
}

void updateStoryStealthMode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStoryStealthMode");
    s.store_field("activeUntilDate", active_until_date_);
    s.store_field("cooldownUntilDate", cooldown_until_date_);
    s.store_class_end();
  }
}

void updateStoryStealthMode::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStoryStealthMode").c_str());
    active_until_date_fieldID = jni::get_field_id(env, Class, "activeUntilDate", "I");
    cooldown_until_date_fieldID = jni::get_field_id(env, Class, "cooldownUntilDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateTrustedMiniAppBots::Class;
jfieldID updateTrustedMiniAppBots::bot_user_ids_fieldID;

updateTrustedMiniAppBots::updateTrustedMiniAppBots()
  : bot_user_ids_()
{}

updateTrustedMiniAppBots::updateTrustedMiniAppBots(array<int53> &&bot_user_ids_)
  : bot_user_ids_(std::move(bot_user_ids_))
{}

const std::int32_t updateTrustedMiniAppBots::ID;

object_ptr<Update> updateTrustedMiniAppBots::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateTrustedMiniAppBots> res = make_object<updateTrustedMiniAppBots>();
  res->bot_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->bot_user_ids_fieldID));
  return std::move(res);
}

void updateTrustedMiniAppBots::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, bot_user_ids_); if (arr_tmp_) { env->SetObjectField(s, bot_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateTrustedMiniAppBots::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateTrustedMiniAppBots");
    { s.store_vector_begin("botUserIds", bot_user_ids_.size()); for (const auto &_value : bot_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateTrustedMiniAppBots::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateTrustedMiniAppBots").c_str());
    bot_user_ids_fieldID = jni::get_field_id(env, Class, "botUserIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass updateOption::Class;
jfieldID updateOption::name_fieldID;
jfieldID updateOption::value_fieldID;

updateOption::updateOption()
  : name_()
  , value_()
{}

updateOption::updateOption(string const &name_, object_ptr<OptionValue> &&value_)
  : name_(name_)
  , value_(std::move(value_))
{}

const std::int32_t updateOption::ID;

object_ptr<Update> updateOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateOption> res = make_object<updateOption>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->value_ = jni::fetch_tl_object<OptionValue>(env, jni::fetch_object(env, p, res->value_fieldID));
  return std::move(res);
}

void updateOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (value_ != nullptr) { jobject next; value_->store(env, next); if (next) { env->SetObjectField(s, value_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateOption");
    s.store_field("name", name_);
    s.store_object_field("value", static_cast<const BaseObject *>(value_.get()));
    s.store_class_end();
  }
}

void updateOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateOption").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    value_fieldID = jni::get_field_id(env, Class, "value", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$OptionValue;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateStickerSet::Class;
jfieldID updateStickerSet::sticker_set_fieldID;

updateStickerSet::updateStickerSet()
  : sticker_set_()
{}

updateStickerSet::updateStickerSet(object_ptr<stickerSet> &&sticker_set_)
  : sticker_set_(std::move(sticker_set_))
{}

const std::int32_t updateStickerSet::ID;

object_ptr<Update> updateStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStickerSet> res = make_object<updateStickerSet>();
  res->sticker_set_ = jni::fetch_tl_object<stickerSet>(env, jni::fetch_object(env, p, res->sticker_set_fieldID));
  return std::move(res);
}

void updateStickerSet::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sticker_set_ != nullptr) { jobject next; sticker_set_->store(env, next); if (next) { env->SetObjectField(s, sticker_set_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateStickerSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStickerSet");
    s.store_object_field("stickerSet", static_cast<const BaseObject *>(sticker_set_.get()));
    s.store_class_end();
  }
}

void updateStickerSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStickerSet").c_str());
    sticker_set_fieldID = jni::get_field_id(env, Class, "stickerSet", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerSet;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateInstalledStickerSets::Class;
jfieldID updateInstalledStickerSets::sticker_type_fieldID;
jfieldID updateInstalledStickerSets::sticker_set_ids_fieldID;

updateInstalledStickerSets::updateInstalledStickerSets()
  : sticker_type_()
  , sticker_set_ids_()
{}

updateInstalledStickerSets::updateInstalledStickerSets(object_ptr<StickerType> &&sticker_type_, array<int64> &&sticker_set_ids_)
  : sticker_type_(std::move(sticker_type_))
  , sticker_set_ids_(std::move(sticker_set_ids_))
{}

const std::int32_t updateInstalledStickerSets::ID;

object_ptr<Update> updateInstalledStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateInstalledStickerSets> res = make_object<updateInstalledStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->sticker_set_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->sticker_set_ids_fieldID));
  return std::move(res);
}

void updateInstalledStickerSets::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sticker_type_ != nullptr) { jobject next; sticker_type_->store(env, next); if (next) { env->SetObjectField(s, sticker_type_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, sticker_set_ids_); if (arr_tmp_) { env->SetObjectField(s, sticker_set_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateInstalledStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateInstalledStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    { s.store_vector_begin("stickerSetIds", sticker_set_ids_.size()); for (const auto &_value : sticker_set_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateInstalledStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateInstalledStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    sticker_set_ids_fieldID = jni::get_field_id(env, Class, "stickerSetIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass updateTrendingStickerSets::Class;
jfieldID updateTrendingStickerSets::sticker_type_fieldID;
jfieldID updateTrendingStickerSets::sticker_sets_fieldID;

updateTrendingStickerSets::updateTrendingStickerSets()
  : sticker_type_()
  , sticker_sets_()
{}

updateTrendingStickerSets::updateTrendingStickerSets(object_ptr<StickerType> &&sticker_type_, object_ptr<trendingStickerSets> &&sticker_sets_)
  : sticker_type_(std::move(sticker_type_))
  , sticker_sets_(std::move(sticker_sets_))
{}

const std::int32_t updateTrendingStickerSets::ID;

object_ptr<Update> updateTrendingStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateTrendingStickerSets> res = make_object<updateTrendingStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->sticker_sets_ = jni::fetch_tl_object<trendingStickerSets>(env, jni::fetch_object(env, p, res->sticker_sets_fieldID));
  return std::move(res);
}

void updateTrendingStickerSets::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sticker_type_ != nullptr) { jobject next; sticker_type_->store(env, next); if (next) { env->SetObjectField(s, sticker_type_fieldID, next); env->DeleteLocalRef(next); } }
  if (sticker_sets_ != nullptr) { jobject next; sticker_sets_->store(env, next); if (next) { env->SetObjectField(s, sticker_sets_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateTrendingStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateTrendingStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_object_field("stickerSets", static_cast<const BaseObject *>(sticker_sets_.get()));
    s.store_class_end();
  }
}

void updateTrendingStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateTrendingStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    sticker_sets_fieldID = jni::get_field_id(env, Class, "stickerSets", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TrendingStickerSets;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateRecentStickers::Class;
jfieldID updateRecentStickers::is_attached_fieldID;
jfieldID updateRecentStickers::sticker_ids_fieldID;

updateRecentStickers::updateRecentStickers()
  : is_attached_()
  , sticker_ids_()
{}

updateRecentStickers::updateRecentStickers(bool is_attached_, array<int32> &&sticker_ids_)
  : is_attached_(is_attached_)
  , sticker_ids_(std::move(sticker_ids_))
{}

const std::int32_t updateRecentStickers::ID;

object_ptr<Update> updateRecentStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateRecentStickers> res = make_object<updateRecentStickers>();
  res->is_attached_ = (env->GetBooleanField(p, res->is_attached_fieldID) != 0);
  res->sticker_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->sticker_ids_fieldID));
  return std::move(res);
}

void updateRecentStickers::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_attached_fieldID, is_attached_);
  { auto arr_tmp_ = jni::store_vector(env, sticker_ids_); if (arr_tmp_) { env->SetObjectField(s, sticker_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateRecentStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateRecentStickers");
    s.store_field("isAttached", is_attached_);
    { s.store_vector_begin("stickerIds", sticker_ids_.size()); for (const auto &_value : sticker_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateRecentStickers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateRecentStickers").c_str());
    is_attached_fieldID = jni::get_field_id(env, Class, "isAttached", "Z");
    sticker_ids_fieldID = jni::get_field_id(env, Class, "stickerIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateFavoriteStickers::Class;
jfieldID updateFavoriteStickers::sticker_ids_fieldID;

updateFavoriteStickers::updateFavoriteStickers()
  : sticker_ids_()
{}

updateFavoriteStickers::updateFavoriteStickers(array<int32> &&sticker_ids_)
  : sticker_ids_(std::move(sticker_ids_))
{}

const std::int32_t updateFavoriteStickers::ID;

object_ptr<Update> updateFavoriteStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFavoriteStickers> res = make_object<updateFavoriteStickers>();
  res->sticker_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->sticker_ids_fieldID));
  return std::move(res);
}

void updateFavoriteStickers::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, sticker_ids_); if (arr_tmp_) { env->SetObjectField(s, sticker_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateFavoriteStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFavoriteStickers");
    { s.store_vector_begin("stickerIds", sticker_ids_.size()); for (const auto &_value : sticker_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateFavoriteStickers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFavoriteStickers").c_str());
    sticker_ids_fieldID = jni::get_field_id(env, Class, "stickerIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateSavedAnimations::Class;
jfieldID updateSavedAnimations::animation_ids_fieldID;

updateSavedAnimations::updateSavedAnimations()
  : animation_ids_()
{}

updateSavedAnimations::updateSavedAnimations(array<int32> &&animation_ids_)
  : animation_ids_(std::move(animation_ids_))
{}

const std::int32_t updateSavedAnimations::ID;

object_ptr<Update> updateSavedAnimations::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSavedAnimations> res = make_object<updateSavedAnimations>();
  res->animation_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->animation_ids_fieldID));
  return std::move(res);
}

void updateSavedAnimations::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, animation_ids_); if (arr_tmp_) { env->SetObjectField(s, animation_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateSavedAnimations::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSavedAnimations");
    { s.store_vector_begin("animationIds", animation_ids_.size()); for (const auto &_value : animation_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateSavedAnimations::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSavedAnimations").c_str());
    animation_ids_fieldID = jni::get_field_id(env, Class, "animationIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateSavedNotificationSounds::Class;
jfieldID updateSavedNotificationSounds::notification_sound_ids_fieldID;

updateSavedNotificationSounds::updateSavedNotificationSounds()
  : notification_sound_ids_()
{}

updateSavedNotificationSounds::updateSavedNotificationSounds(array<int64> &&notification_sound_ids_)
  : notification_sound_ids_(std::move(notification_sound_ids_))
{}

const std::int32_t updateSavedNotificationSounds::ID;

object_ptr<Update> updateSavedNotificationSounds::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSavedNotificationSounds> res = make_object<updateSavedNotificationSounds>();
  res->notification_sound_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->notification_sound_ids_fieldID));
  return std::move(res);
}

void updateSavedNotificationSounds::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, notification_sound_ids_); if (arr_tmp_) { env->SetObjectField(s, notification_sound_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateSavedNotificationSounds::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSavedNotificationSounds");
    { s.store_vector_begin("notificationSoundIds", notification_sound_ids_.size()); for (const auto &_value : notification_sound_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateSavedNotificationSounds::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSavedNotificationSounds").c_str());
    notification_sound_ids_fieldID = jni::get_field_id(env, Class, "notificationSoundIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass updateDefaultBackground::Class;
jfieldID updateDefaultBackground::for_dark_theme_fieldID;
jfieldID updateDefaultBackground::background_fieldID;

updateDefaultBackground::updateDefaultBackground()
  : for_dark_theme_()
  , background_()
{}

updateDefaultBackground::updateDefaultBackground(bool for_dark_theme_, object_ptr<background> &&background_)
  : for_dark_theme_(for_dark_theme_)
  , background_(std::move(background_))
{}

const std::int32_t updateDefaultBackground::ID;

object_ptr<Update> updateDefaultBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateDefaultBackground> res = make_object<updateDefaultBackground>();
  res->for_dark_theme_ = (env->GetBooleanField(p, res->for_dark_theme_fieldID) != 0);
  res->background_ = jni::fetch_tl_object<background>(env, jni::fetch_object(env, p, res->background_fieldID));
  return std::move(res);
}

void updateDefaultBackground::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, for_dark_theme_fieldID, for_dark_theme_);
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateDefaultBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateDefaultBackground");
    s.store_field("forDarkTheme", for_dark_theme_);
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_class_end();
  }
}

void updateDefaultBackground::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateDefaultBackground").c_str());
    for_dark_theme_fieldID = jni::get_field_id(env, Class, "forDarkTheme", "Z");
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Background;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateEmojiChatThemes::Class;
jfieldID updateEmojiChatThemes::chat_themes_fieldID;

updateEmojiChatThemes::updateEmojiChatThemes()
  : chat_themes_()
{}

updateEmojiChatThemes::updateEmojiChatThemes(array<object_ptr<emojiChatTheme>> &&chat_themes_)
  : chat_themes_(std::move(chat_themes_))
{}

const std::int32_t updateEmojiChatThemes::ID;

object_ptr<Update> updateEmojiChatThemes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateEmojiChatThemes> res = make_object<updateEmojiChatThemes>();
  res->chat_themes_ = jni::FetchVector<emojiChatTheme>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->chat_themes_fieldID));
  return std::move(res);
}

void updateEmojiChatThemes::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, chat_themes_); if (arr_tmp_) { env->SetObjectField(s, chat_themes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateEmojiChatThemes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateEmojiChatThemes");
    { s.store_vector_begin("chatThemes", chat_themes_.size()); for (const auto &_value : chat_themes_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateEmojiChatThemes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateEmojiChatThemes").c_str());
    chat_themes_fieldID = jni::get_field_id(env, Class, "chatThemes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$EmojiChatTheme;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateAccentColors::Class;
jfieldID updateAccentColors::colors_fieldID;
jfieldID updateAccentColors::available_accent_color_ids_fieldID;

updateAccentColors::updateAccentColors()
  : colors_()
  , available_accent_color_ids_()
{}

updateAccentColors::updateAccentColors(array<object_ptr<accentColor>> &&colors_, array<int32> &&available_accent_color_ids_)
  : colors_(std::move(colors_))
  , available_accent_color_ids_(std::move(available_accent_color_ids_))
{}

const std::int32_t updateAccentColors::ID;

object_ptr<Update> updateAccentColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAccentColors> res = make_object<updateAccentColors>();
  res->colors_ = jni::FetchVector<accentColor>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->colors_fieldID));
  res->available_accent_color_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->available_accent_color_ids_fieldID));
  return std::move(res);
}

void updateAccentColors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, colors_); if (arr_tmp_) { env->SetObjectField(s, colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, available_accent_color_ids_); if (arr_tmp_) { env->SetObjectField(s, available_accent_color_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateAccentColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAccentColors");
    { s.store_vector_begin("colors", colors_.size()); for (const auto &_value : colors_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("availableAccentColorIds", available_accent_color_ids_.size()); for (const auto &_value : available_accent_color_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateAccentColors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAccentColors").c_str());
    colors_fieldID = jni::get_field_id(env, Class, "colors", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AccentColor;").c_str());
    available_accent_color_ids_fieldID = jni::get_field_id(env, Class, "availableAccentColorIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateProfileAccentColors::Class;
jfieldID updateProfileAccentColors::colors_fieldID;
jfieldID updateProfileAccentColors::available_accent_color_ids_fieldID;

updateProfileAccentColors::updateProfileAccentColors()
  : colors_()
  , available_accent_color_ids_()
{}

updateProfileAccentColors::updateProfileAccentColors(array<object_ptr<profileAccentColor>> &&colors_, array<int32> &&available_accent_color_ids_)
  : colors_(std::move(colors_))
  , available_accent_color_ids_(std::move(available_accent_color_ids_))
{}

const std::int32_t updateProfileAccentColors::ID;

object_ptr<Update> updateProfileAccentColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateProfileAccentColors> res = make_object<updateProfileAccentColors>();
  res->colors_ = jni::FetchVector<profileAccentColor>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->colors_fieldID));
  res->available_accent_color_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->available_accent_color_ids_fieldID));
  return std::move(res);
}

void updateProfileAccentColors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, colors_); if (arr_tmp_) { env->SetObjectField(s, colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, available_accent_color_ids_); if (arr_tmp_) { env->SetObjectField(s, available_accent_color_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateProfileAccentColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateProfileAccentColors");
    { s.store_vector_begin("colors", colors_.size()); for (const auto &_value : colors_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("availableAccentColorIds", available_accent_color_ids_.size()); for (const auto &_value : available_accent_color_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateProfileAccentColors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateProfileAccentColors").c_str());
    colors_fieldID = jni::get_field_id(env, Class, "colors", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ProfileAccentColor;").c_str());
    available_accent_color_ids_fieldID = jni::get_field_id(env, Class, "availableAccentColorIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateLanguagePackStrings::Class;
jfieldID updateLanguagePackStrings::localization_target_fieldID;
jfieldID updateLanguagePackStrings::language_pack_id_fieldID;
jfieldID updateLanguagePackStrings::strings_fieldID;

updateLanguagePackStrings::updateLanguagePackStrings()
  : localization_target_()
  , language_pack_id_()
  , strings_()
{}

updateLanguagePackStrings::updateLanguagePackStrings(string const &localization_target_, string const &language_pack_id_, array<object_ptr<languagePackString>> &&strings_)
  : localization_target_(localization_target_)
  , language_pack_id_(language_pack_id_)
  , strings_(std::move(strings_))
{}

const std::int32_t updateLanguagePackStrings::ID;

object_ptr<Update> updateLanguagePackStrings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateLanguagePackStrings> res = make_object<updateLanguagePackStrings>();
  res->localization_target_ = jni::fetch_string(env, p, res->localization_target_fieldID);
  res->language_pack_id_ = jni::fetch_string(env, p, res->language_pack_id_fieldID);
  res->strings_ = jni::FetchVector<languagePackString>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->strings_fieldID));
  return std::move(res);
}

void updateLanguagePackStrings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, localization_target_); if (nextString) { env->SetObjectField(s, localization_target_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, language_pack_id_); if (nextString) { env->SetObjectField(s, language_pack_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, strings_); if (arr_tmp_) { env->SetObjectField(s, strings_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateLanguagePackStrings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateLanguagePackStrings");
    s.store_field("localizationTarget", localization_target_);
    s.store_field("languagePackId", language_pack_id_);
    { s.store_vector_begin("strings", strings_.size()); for (const auto &_value : strings_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateLanguagePackStrings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateLanguagePackStrings").c_str());
    localization_target_fieldID = jni::get_field_id(env, Class, "localizationTarget", "Ljava/lang/String;");
    language_pack_id_fieldID = jni::get_field_id(env, Class, "languagePackId", "Ljava/lang/String;");
    strings_fieldID = jni::get_field_id(env, Class, "strings", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$LanguagePackString;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateConnectionState::Class;
jfieldID updateConnectionState::state_fieldID;

updateConnectionState::updateConnectionState()
  : state_()
{}

updateConnectionState::updateConnectionState(object_ptr<ConnectionState> &&state_)
  : state_(std::move(state_))
{}

const std::int32_t updateConnectionState::ID;

object_ptr<Update> updateConnectionState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateConnectionState> res = make_object<updateConnectionState>();
  res->state_ = jni::fetch_tl_object<ConnectionState>(env, jni::fetch_object(env, p, res->state_fieldID));
  return std::move(res);
}

void updateConnectionState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateConnectionState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateConnectionState");
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_class_end();
  }
}

void updateConnectionState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateConnectionState").c_str());
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ConnectionState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateFreezeState::Class;
jfieldID updateFreezeState::is_frozen_fieldID;
jfieldID updateFreezeState::freezing_date_fieldID;
jfieldID updateFreezeState::deletion_date_fieldID;
jfieldID updateFreezeState::appeal_link_fieldID;

updateFreezeState::updateFreezeState()
  : is_frozen_()
  , freezing_date_()
  , deletion_date_()
  , appeal_link_()
{}

updateFreezeState::updateFreezeState(bool is_frozen_, int32 freezing_date_, int32 deletion_date_, string const &appeal_link_)
  : is_frozen_(is_frozen_)
  , freezing_date_(freezing_date_)
  , deletion_date_(deletion_date_)
  , appeal_link_(appeal_link_)
{}

const std::int32_t updateFreezeState::ID;

object_ptr<Update> updateFreezeState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateFreezeState> res = make_object<updateFreezeState>();
  res->is_frozen_ = (env->GetBooleanField(p, res->is_frozen_fieldID) != 0);
  res->freezing_date_ = env->GetIntField(p, res->freezing_date_fieldID);
  res->deletion_date_ = env->GetIntField(p, res->deletion_date_fieldID);
  res->appeal_link_ = jni::fetch_string(env, p, res->appeal_link_fieldID);
  return std::move(res);
}

void updateFreezeState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_frozen_fieldID, is_frozen_);
  env->SetIntField(s, freezing_date_fieldID, freezing_date_);
  env->SetIntField(s, deletion_date_fieldID, deletion_date_);
  { jstring nextString = jni::to_jstring(env, appeal_link_); if (nextString) { env->SetObjectField(s, appeal_link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateFreezeState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateFreezeState");
    s.store_field("isFrozen", is_frozen_);
    s.store_field("freezingDate", freezing_date_);
    s.store_field("deletionDate", deletion_date_);
    s.store_field("appealLink", appeal_link_);
    s.store_class_end();
  }
}

void updateFreezeState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateFreezeState").c_str());
    is_frozen_fieldID = jni::get_field_id(env, Class, "isFrozen", "Z");
    freezing_date_fieldID = jni::get_field_id(env, Class, "freezingDate", "I");
    deletion_date_fieldID = jni::get_field_id(env, Class, "deletionDate", "I");
    appeal_link_fieldID = jni::get_field_id(env, Class, "appealLink", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateAgeVerificationParameters::Class;
jfieldID updateAgeVerificationParameters::parameters_fieldID;

updateAgeVerificationParameters::updateAgeVerificationParameters()
  : parameters_()
{}

updateAgeVerificationParameters::updateAgeVerificationParameters(object_ptr<ageVerificationParameters> &&parameters_)
  : parameters_(std::move(parameters_))
{}

const std::int32_t updateAgeVerificationParameters::ID;

object_ptr<Update> updateAgeVerificationParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAgeVerificationParameters> res = make_object<updateAgeVerificationParameters>();
  res->parameters_ = jni::fetch_tl_object<ageVerificationParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  return std::move(res);
}

void updateAgeVerificationParameters::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (parameters_ != nullptr) { jobject next; parameters_->store(env, next); if (next) { env->SetObjectField(s, parameters_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateAgeVerificationParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAgeVerificationParameters");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_class_end();
  }
}

void updateAgeVerificationParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAgeVerificationParameters").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AgeVerificationParameters;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateTermsOfService::Class;
jfieldID updateTermsOfService::terms_of_service_id_fieldID;
jfieldID updateTermsOfService::terms_of_service_fieldID;

updateTermsOfService::updateTermsOfService()
  : terms_of_service_id_()
  , terms_of_service_()
{}

updateTermsOfService::updateTermsOfService(string const &terms_of_service_id_, object_ptr<termsOfService> &&terms_of_service_)
  : terms_of_service_id_(terms_of_service_id_)
  , terms_of_service_(std::move(terms_of_service_))
{}

const std::int32_t updateTermsOfService::ID;

object_ptr<Update> updateTermsOfService::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateTermsOfService> res = make_object<updateTermsOfService>();
  res->terms_of_service_id_ = jni::fetch_string(env, p, res->terms_of_service_id_fieldID);
  res->terms_of_service_ = jni::fetch_tl_object<termsOfService>(env, jni::fetch_object(env, p, res->terms_of_service_fieldID));
  return std::move(res);
}

void updateTermsOfService::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, terms_of_service_id_); if (nextString) { env->SetObjectField(s, terms_of_service_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (terms_of_service_ != nullptr) { jobject next; terms_of_service_->store(env, next); if (next) { env->SetObjectField(s, terms_of_service_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateTermsOfService::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateTermsOfService");
    s.store_field("termsOfServiceId", terms_of_service_id_);
    s.store_object_field("termsOfService", static_cast<const BaseObject *>(terms_of_service_.get()));
    s.store_class_end();
  }
}

void updateTermsOfService::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateTermsOfService").c_str());
    terms_of_service_id_fieldID = jni::get_field_id(env, Class, "termsOfServiceId", "Ljava/lang/String;");
    terms_of_service_fieldID = jni::get_field_id(env, Class, "termsOfService", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TermsOfService;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateUnconfirmedSession::Class;
jfieldID updateUnconfirmedSession::session_fieldID;

updateUnconfirmedSession::updateUnconfirmedSession()
  : session_()
{}

updateUnconfirmedSession::updateUnconfirmedSession(object_ptr<unconfirmedSession> &&session_)
  : session_(std::move(session_))
{}

const std::int32_t updateUnconfirmedSession::ID;

object_ptr<Update> updateUnconfirmedSession::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateUnconfirmedSession> res = make_object<updateUnconfirmedSession>();
  res->session_ = jni::fetch_tl_object<unconfirmedSession>(env, jni::fetch_object(env, p, res->session_fieldID));
  return std::move(res);
}

void updateUnconfirmedSession::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (session_ != nullptr) { jobject next; session_->store(env, next); if (next) { env->SetObjectField(s, session_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateUnconfirmedSession::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateUnconfirmedSession");
    s.store_object_field("session", static_cast<const BaseObject *>(session_.get()));
    s.store_class_end();
  }
}

void updateUnconfirmedSession::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateUnconfirmedSession").c_str());
    session_fieldID = jni::get_field_id(env, Class, "session", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UnconfirmedSession;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateAttachmentMenuBots::Class;
jfieldID updateAttachmentMenuBots::bots_fieldID;

updateAttachmentMenuBots::updateAttachmentMenuBots()
  : bots_()
{}

updateAttachmentMenuBots::updateAttachmentMenuBots(array<object_ptr<attachmentMenuBot>> &&bots_)
  : bots_(std::move(bots_))
{}

const std::int32_t updateAttachmentMenuBots::ID;

object_ptr<Update> updateAttachmentMenuBots::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAttachmentMenuBots> res = make_object<updateAttachmentMenuBots>();
  res->bots_ = jni::FetchVector<attachmentMenuBot>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->bots_fieldID));
  return std::move(res);
}

void updateAttachmentMenuBots::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, bots_); if (arr_tmp_) { env->SetObjectField(s, bots_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateAttachmentMenuBots::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAttachmentMenuBots");
    { s.store_vector_begin("bots", bots_.size()); for (const auto &_value : bots_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateAttachmentMenuBots::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAttachmentMenuBots").c_str());
    bots_fieldID = jni::get_field_id(env, Class, "bots", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AttachmentMenuBot;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateWebAppMessageSent::Class;
jfieldID updateWebAppMessageSent::web_app_launch_id_fieldID;

updateWebAppMessageSent::updateWebAppMessageSent()
  : web_app_launch_id_()
{}

updateWebAppMessageSent::updateWebAppMessageSent(int64 web_app_launch_id_)
  : web_app_launch_id_(web_app_launch_id_)
{}

const std::int32_t updateWebAppMessageSent::ID;

object_ptr<Update> updateWebAppMessageSent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateWebAppMessageSent> res = make_object<updateWebAppMessageSent>();
  res->web_app_launch_id_ = env->GetLongField(p, res->web_app_launch_id_fieldID);
  return std::move(res);
}

void updateWebAppMessageSent::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, web_app_launch_id_fieldID, web_app_launch_id_);
}

void updateWebAppMessageSent::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateWebAppMessageSent");
    s.store_field("webAppLaunchId", web_app_launch_id_);
    s.store_class_end();
  }
}

void updateWebAppMessageSent::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateWebAppMessageSent").c_str());
    web_app_launch_id_fieldID = jni::get_field_id(env, Class, "webAppLaunchId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateActiveEmojiReactions::Class;
jfieldID updateActiveEmojiReactions::emojis_fieldID;

updateActiveEmojiReactions::updateActiveEmojiReactions()
  : emojis_()
{}

updateActiveEmojiReactions::updateActiveEmojiReactions(array<string> &&emojis_)
  : emojis_(std::move(emojis_))
{}

const std::int32_t updateActiveEmojiReactions::ID;

object_ptr<Update> updateActiveEmojiReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateActiveEmojiReactions> res = make_object<updateActiveEmojiReactions>();
  res->emojis_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emojis_fieldID));
  return std::move(res);
}

void updateActiveEmojiReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, emojis_); if (arr_tmp_) { env->SetObjectField(s, emojis_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateActiveEmojiReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateActiveEmojiReactions");
    { s.store_vector_begin("emojis", emojis_.size()); for (const auto &_value : emojis_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateActiveEmojiReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateActiveEmojiReactions").c_str());
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateAvailableMessageEffects::Class;
jfieldID updateAvailableMessageEffects::reaction_effect_ids_fieldID;
jfieldID updateAvailableMessageEffects::sticker_effect_ids_fieldID;

updateAvailableMessageEffects::updateAvailableMessageEffects()
  : reaction_effect_ids_()
  , sticker_effect_ids_()
{}

updateAvailableMessageEffects::updateAvailableMessageEffects(array<int64> &&reaction_effect_ids_, array<int64> &&sticker_effect_ids_)
  : reaction_effect_ids_(std::move(reaction_effect_ids_))
  , sticker_effect_ids_(std::move(sticker_effect_ids_))
{}

const std::int32_t updateAvailableMessageEffects::ID;

object_ptr<Update> updateAvailableMessageEffects::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAvailableMessageEffects> res = make_object<updateAvailableMessageEffects>();
  res->reaction_effect_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->reaction_effect_ids_fieldID));
  res->sticker_effect_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->sticker_effect_ids_fieldID));
  return std::move(res);
}

void updateAvailableMessageEffects::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, reaction_effect_ids_); if (arr_tmp_) { env->SetObjectField(s, reaction_effect_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, sticker_effect_ids_); if (arr_tmp_) { env->SetObjectField(s, sticker_effect_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateAvailableMessageEffects::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAvailableMessageEffects");
    { s.store_vector_begin("reactionEffectIds", reaction_effect_ids_.size()); for (const auto &_value : reaction_effect_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("stickerEffectIds", sticker_effect_ids_.size()); for (const auto &_value : sticker_effect_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateAvailableMessageEffects::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAvailableMessageEffects").c_str());
    reaction_effect_ids_fieldID = jni::get_field_id(env, Class, "reactionEffectIds", "[J");
    sticker_effect_ids_fieldID = jni::get_field_id(env, Class, "stickerEffectIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass updateDefaultReactionType::Class;
jfieldID updateDefaultReactionType::reaction_type_fieldID;

updateDefaultReactionType::updateDefaultReactionType()
  : reaction_type_()
{}

updateDefaultReactionType::updateDefaultReactionType(object_ptr<ReactionType> &&reaction_type_)
  : reaction_type_(std::move(reaction_type_))
{}

const std::int32_t updateDefaultReactionType::ID;

object_ptr<Update> updateDefaultReactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateDefaultReactionType> res = make_object<updateDefaultReactionType>();
  res->reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->reaction_type_fieldID));
  return std::move(res);
}

void updateDefaultReactionType::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (reaction_type_ != nullptr) { jobject next; reaction_type_->store(env, next); if (next) { env->SetObjectField(s, reaction_type_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateDefaultReactionType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateDefaultReactionType");
    s.store_object_field("reactionType", static_cast<const BaseObject *>(reaction_type_.get()));
    s.store_class_end();
  }
}

void updateDefaultReactionType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateDefaultReactionType").c_str());
    reaction_type_fieldID = jni::get_field_id(env, Class, "reactionType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateDefaultPaidReactionType::Class;
jfieldID updateDefaultPaidReactionType::type_fieldID;

updateDefaultPaidReactionType::updateDefaultPaidReactionType()
  : type_()
{}

updateDefaultPaidReactionType::updateDefaultPaidReactionType(object_ptr<PaidReactionType> &&type_)
  : type_(std::move(type_))
{}

const std::int32_t updateDefaultPaidReactionType::ID;

object_ptr<Update> updateDefaultPaidReactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateDefaultPaidReactionType> res = make_object<updateDefaultPaidReactionType>();
  res->type_ = jni::fetch_tl_object<PaidReactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return std::move(res);
}

void updateDefaultPaidReactionType::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateDefaultPaidReactionType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateDefaultPaidReactionType");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void updateDefaultPaidReactionType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateDefaultPaidReactionType").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PaidReactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSavedMessagesTags::Class;
jfieldID updateSavedMessagesTags::saved_messages_topic_id_fieldID;
jfieldID updateSavedMessagesTags::tags_fieldID;

updateSavedMessagesTags::updateSavedMessagesTags()
  : saved_messages_topic_id_()
  , tags_()
{}

updateSavedMessagesTags::updateSavedMessagesTags(int53 saved_messages_topic_id_, object_ptr<savedMessagesTags> &&tags_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
  , tags_(std::move(tags_))
{}

const std::int32_t updateSavedMessagesTags::ID;

object_ptr<Update> updateSavedMessagesTags::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSavedMessagesTags> res = make_object<updateSavedMessagesTags>();
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  res->tags_ = jni::fetch_tl_object<savedMessagesTags>(env, jni::fetch_object(env, p, res->tags_fieldID));
  return std::move(res);
}

void updateSavedMessagesTags::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, saved_messages_topic_id_fieldID, saved_messages_topic_id_);
  if (tags_ != nullptr) { jobject next; tags_->store(env, next); if (next) { env->SetObjectField(s, tags_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateSavedMessagesTags::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSavedMessagesTags");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_object_field("tags", static_cast<const BaseObject *>(tags_.get()));
    s.store_class_end();
  }
}

void updateSavedMessagesTags::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSavedMessagesTags").c_str());
    saved_messages_topic_id_fieldID = jni::get_field_id(env, Class, "savedMessagesTopicId", "J");
    tags_fieldID = jni::get_field_id(env, Class, "tags", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SavedMessagesTags;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateActiveLiveLocationMessages::Class;
jfieldID updateActiveLiveLocationMessages::messages_fieldID;

updateActiveLiveLocationMessages::updateActiveLiveLocationMessages()
  : messages_()
{}

updateActiveLiveLocationMessages::updateActiveLiveLocationMessages(array<object_ptr<message>> &&messages_)
  : messages_(std::move(messages_))
{}

const std::int32_t updateActiveLiveLocationMessages::ID;

object_ptr<Update> updateActiveLiveLocationMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateActiveLiveLocationMessages> res = make_object<updateActiveLiveLocationMessages>();
  res->messages_ = jni::FetchVector<message>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->messages_fieldID));
  return std::move(res);
}

void updateActiveLiveLocationMessages::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, messages_); if (arr_tmp_) { env->SetObjectField(s, messages_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateActiveLiveLocationMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateActiveLiveLocationMessages");
    { s.store_vector_begin("messages", messages_.size()); for (const auto &_value : messages_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateActiveLiveLocationMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateActiveLiveLocationMessages").c_str());
    messages_fieldID = jni::get_field_id(env, Class, "messages", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateOwnedStarCount::Class;
jfieldID updateOwnedStarCount::star_amount_fieldID;

updateOwnedStarCount::updateOwnedStarCount()
  : star_amount_()
{}

updateOwnedStarCount::updateOwnedStarCount(object_ptr<starAmount> &&star_amount_)
  : star_amount_(std::move(star_amount_))
{}

const std::int32_t updateOwnedStarCount::ID;

object_ptr<Update> updateOwnedStarCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateOwnedStarCount> res = make_object<updateOwnedStarCount>();
  res->star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->star_amount_fieldID));
  return std::move(res);
}

void updateOwnedStarCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (star_amount_ != nullptr) { jobject next; star_amount_->store(env, next); if (next) { env->SetObjectField(s, star_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateOwnedStarCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateOwnedStarCount");
    s.store_object_field("starAmount", static_cast<const BaseObject *>(star_amount_.get()));
    s.store_class_end();
  }
}

void updateOwnedStarCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateOwnedStarCount").c_str());
    star_amount_fieldID = jni::get_field_id(env, Class, "starAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateOwnedTonCount::Class;
jfieldID updateOwnedTonCount::ton_amount_fieldID;

updateOwnedTonCount::updateOwnedTonCount()
  : ton_amount_()
{}

updateOwnedTonCount::updateOwnedTonCount(int53 ton_amount_)
  : ton_amount_(ton_amount_)
{}

const std::int32_t updateOwnedTonCount::ID;

object_ptr<Update> updateOwnedTonCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateOwnedTonCount> res = make_object<updateOwnedTonCount>();
  res->ton_amount_ = env->GetLongField(p, res->ton_amount_fieldID);
  return std::move(res);
}

void updateOwnedTonCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, ton_amount_fieldID, ton_amount_);
}

void updateOwnedTonCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateOwnedTonCount");
    s.store_field("tonAmount", ton_amount_);
    s.store_class_end();
  }
}

void updateOwnedTonCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateOwnedTonCount").c_str());
    ton_amount_fieldID = jni::get_field_id(env, Class, "tonAmount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatRevenueAmount::Class;
jfieldID updateChatRevenueAmount::chat_id_fieldID;
jfieldID updateChatRevenueAmount::revenue_amount_fieldID;

updateChatRevenueAmount::updateChatRevenueAmount()
  : chat_id_()
  , revenue_amount_()
{}

updateChatRevenueAmount::updateChatRevenueAmount(int53 chat_id_, object_ptr<chatRevenueAmount> &&revenue_amount_)
  : chat_id_(chat_id_)
  , revenue_amount_(std::move(revenue_amount_))
{}

const std::int32_t updateChatRevenueAmount::ID;

object_ptr<Update> updateChatRevenueAmount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatRevenueAmount> res = make_object<updateChatRevenueAmount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->revenue_amount_ = jni::fetch_tl_object<chatRevenueAmount>(env, jni::fetch_object(env, p, res->revenue_amount_fieldID));
  return std::move(res);
}

void updateChatRevenueAmount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (revenue_amount_ != nullptr) { jobject next; revenue_amount_->store(env, next); if (next) { env->SetObjectField(s, revenue_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatRevenueAmount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatRevenueAmount");
    s.store_field("chatId", chat_id_);
    s.store_object_field("revenueAmount", static_cast<const BaseObject *>(revenue_amount_.get()));
    s.store_class_end();
  }
}

void updateChatRevenueAmount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatRevenueAmount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    revenue_amount_fieldID = jni::get_field_id(env, Class, "revenueAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatRevenueAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateStarRevenueStatus::Class;
jfieldID updateStarRevenueStatus::owner_id_fieldID;
jfieldID updateStarRevenueStatus::status_fieldID;

updateStarRevenueStatus::updateStarRevenueStatus()
  : owner_id_()
  , status_()
{}

updateStarRevenueStatus::updateStarRevenueStatus(object_ptr<MessageSender> &&owner_id_, object_ptr<starRevenueStatus> &&status_)
  : owner_id_(std::move(owner_id_))
  , status_(std::move(status_))
{}

const std::int32_t updateStarRevenueStatus::ID;

object_ptr<Update> updateStarRevenueStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStarRevenueStatus> res = make_object<updateStarRevenueStatus>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->status_ = jni::fetch_tl_object<starRevenueStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  return std::move(res);
}

void updateStarRevenueStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateStarRevenueStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStarRevenueStatus");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_class_end();
  }
}

void updateStarRevenueStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStarRevenueStatus").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarRevenueStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateTonRevenueStatus::Class;
jfieldID updateTonRevenueStatus::status_fieldID;

updateTonRevenueStatus::updateTonRevenueStatus()
  : status_()
{}

updateTonRevenueStatus::updateTonRevenueStatus(object_ptr<tonRevenueStatus> &&status_)
  : status_(std::move(status_))
{}

const std::int32_t updateTonRevenueStatus::ID;

object_ptr<Update> updateTonRevenueStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateTonRevenueStatus> res = make_object<updateTonRevenueStatus>();
  res->status_ = jni::fetch_tl_object<tonRevenueStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  return std::move(res);
}

void updateTonRevenueStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateTonRevenueStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateTonRevenueStatus");
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_class_end();
  }
}

void updateTonRevenueStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateTonRevenueStatus").c_str());
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TonRevenueStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSpeechRecognitionTrial::Class;
jfieldID updateSpeechRecognitionTrial::max_media_duration_fieldID;
jfieldID updateSpeechRecognitionTrial::weekly_count_fieldID;
jfieldID updateSpeechRecognitionTrial::left_count_fieldID;
jfieldID updateSpeechRecognitionTrial::next_reset_date_fieldID;

updateSpeechRecognitionTrial::updateSpeechRecognitionTrial()
  : max_media_duration_()
  , weekly_count_()
  , left_count_()
  , next_reset_date_()
{}

updateSpeechRecognitionTrial::updateSpeechRecognitionTrial(int32 max_media_duration_, int32 weekly_count_, int32 left_count_, int32 next_reset_date_)
  : max_media_duration_(max_media_duration_)
  , weekly_count_(weekly_count_)
  , left_count_(left_count_)
  , next_reset_date_(next_reset_date_)
{}

const std::int32_t updateSpeechRecognitionTrial::ID;

object_ptr<Update> updateSpeechRecognitionTrial::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSpeechRecognitionTrial> res = make_object<updateSpeechRecognitionTrial>();
  res->max_media_duration_ = env->GetIntField(p, res->max_media_duration_fieldID);
  res->weekly_count_ = env->GetIntField(p, res->weekly_count_fieldID);
  res->left_count_ = env->GetIntField(p, res->left_count_fieldID);
  res->next_reset_date_ = env->GetIntField(p, res->next_reset_date_fieldID);
  return std::move(res);
}

void updateSpeechRecognitionTrial::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, max_media_duration_fieldID, max_media_duration_);
  env->SetIntField(s, weekly_count_fieldID, weekly_count_);
  env->SetIntField(s, left_count_fieldID, left_count_);
  env->SetIntField(s, next_reset_date_fieldID, next_reset_date_);
}

void updateSpeechRecognitionTrial::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSpeechRecognitionTrial");
    s.store_field("maxMediaDuration", max_media_duration_);
    s.store_field("weeklyCount", weekly_count_);
    s.store_field("leftCount", left_count_);
    s.store_field("nextResetDate", next_reset_date_);
    s.store_class_end();
  }
}

void updateSpeechRecognitionTrial::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSpeechRecognitionTrial").c_str());
    max_media_duration_fieldID = jni::get_field_id(env, Class, "maxMediaDuration", "I");
    weekly_count_fieldID = jni::get_field_id(env, Class, "weeklyCount", "I");
    left_count_fieldID = jni::get_field_id(env, Class, "leftCount", "I");
    next_reset_date_fieldID = jni::get_field_id(env, Class, "nextResetDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updateGroupCallMessageLevels::Class;
jfieldID updateGroupCallMessageLevels::levels_fieldID;

updateGroupCallMessageLevels::updateGroupCallMessageLevels()
  : levels_()
{}

updateGroupCallMessageLevels::updateGroupCallMessageLevels(array<object_ptr<groupCallMessageLevel>> &&levels_)
  : levels_(std::move(levels_))
{}

const std::int32_t updateGroupCallMessageLevels::ID;

object_ptr<Update> updateGroupCallMessageLevels::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateGroupCallMessageLevels> res = make_object<updateGroupCallMessageLevels>();
  res->levels_ = jni::FetchVector<groupCallMessageLevel>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->levels_fieldID));
  return std::move(res);
}

void updateGroupCallMessageLevels::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, levels_); if (arr_tmp_) { env->SetObjectField(s, levels_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateGroupCallMessageLevels::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateGroupCallMessageLevels");
    { s.store_vector_begin("levels", levels_.size()); for (const auto &_value : levels_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateGroupCallMessageLevels::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateGroupCallMessageLevels").c_str());
    levels_fieldID = jni::get_field_id(env, Class, "levels", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GroupCallMessageLevel;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateDiceEmojis::Class;
jfieldID updateDiceEmojis::emojis_fieldID;

updateDiceEmojis::updateDiceEmojis()
  : emojis_()
{}

updateDiceEmojis::updateDiceEmojis(array<string> &&emojis_)
  : emojis_(std::move(emojis_))
{}

const std::int32_t updateDiceEmojis::ID;

object_ptr<Update> updateDiceEmojis::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateDiceEmojis> res = make_object<updateDiceEmojis>();
  res->emojis_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emojis_fieldID));
  return std::move(res);
}

void updateDiceEmojis::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, emojis_); if (arr_tmp_) { env->SetObjectField(s, emojis_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateDiceEmojis::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateDiceEmojis");
    { s.store_vector_begin("emojis", emojis_.size()); for (const auto &_value : emojis_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateDiceEmojis::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateDiceEmojis").c_str());
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateStakeDiceState::Class;
jfieldID updateStakeDiceState::state_fieldID;

updateStakeDiceState::updateStakeDiceState()
  : state_()
{}

updateStakeDiceState::updateStakeDiceState(object_ptr<stakeDiceState> &&state_)
  : state_(std::move(state_))
{}

const std::int32_t updateStakeDiceState::ID;

object_ptr<Update> updateStakeDiceState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateStakeDiceState> res = make_object<updateStakeDiceState>();
  res->state_ = jni::fetch_tl_object<stakeDiceState>(env, jni::fetch_object(env, p, res->state_fieldID));
  return std::move(res);
}

void updateStakeDiceState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateStakeDiceState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateStakeDiceState");
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_class_end();
  }
}

void updateStakeDiceState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateStakeDiceState").c_str());
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StakeDiceState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateAnimatedEmojiMessageClicked::Class;
jfieldID updateAnimatedEmojiMessageClicked::chat_id_fieldID;
jfieldID updateAnimatedEmojiMessageClicked::message_id_fieldID;
jfieldID updateAnimatedEmojiMessageClicked::sticker_fieldID;

updateAnimatedEmojiMessageClicked::updateAnimatedEmojiMessageClicked()
  : chat_id_()
  , message_id_()
  , sticker_()
{}

updateAnimatedEmojiMessageClicked::updateAnimatedEmojiMessageClicked(int53 chat_id_, int53 message_id_, object_ptr<sticker> &&sticker_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t updateAnimatedEmojiMessageClicked::ID;

object_ptr<Update> updateAnimatedEmojiMessageClicked::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAnimatedEmojiMessageClicked> res = make_object<updateAnimatedEmojiMessageClicked>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void updateAnimatedEmojiMessageClicked::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateAnimatedEmojiMessageClicked::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAnimatedEmojiMessageClicked");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void updateAnimatedEmojiMessageClicked::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAnimatedEmojiMessageClicked").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateAnimationSearchParameters::Class;
jfieldID updateAnimationSearchParameters::provider_fieldID;
jfieldID updateAnimationSearchParameters::emojis_fieldID;

updateAnimationSearchParameters::updateAnimationSearchParameters()
  : provider_()
  , emojis_()
{}

updateAnimationSearchParameters::updateAnimationSearchParameters(string const &provider_, array<string> &&emojis_)
  : provider_(provider_)
  , emojis_(std::move(emojis_))
{}

const std::int32_t updateAnimationSearchParameters::ID;

object_ptr<Update> updateAnimationSearchParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAnimationSearchParameters> res = make_object<updateAnimationSearchParameters>();
  res->provider_ = jni::fetch_string(env, p, res->provider_fieldID);
  res->emojis_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emojis_fieldID));
  return std::move(res);
}

void updateAnimationSearchParameters::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, provider_); if (nextString) { env->SetObjectField(s, provider_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, emojis_); if (arr_tmp_) { env->SetObjectField(s, emojis_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateAnimationSearchParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAnimationSearchParameters");
    s.store_field("provider", provider_);
    { s.store_vector_begin("emojis", emojis_.size()); for (const auto &_value : emojis_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateAnimationSearchParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAnimationSearchParameters").c_str());
    provider_fieldID = jni::get_field_id(env, Class, "provider", "Ljava/lang/String;");
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateTextCompositionStyles::Class;
jfieldID updateTextCompositionStyles::styles_fieldID;

updateTextCompositionStyles::updateTextCompositionStyles()
  : styles_()
{}

updateTextCompositionStyles::updateTextCompositionStyles(array<object_ptr<textCompositionStyle>> &&styles_)
  : styles_(std::move(styles_))
{}

const std::int32_t updateTextCompositionStyles::ID;

object_ptr<Update> updateTextCompositionStyles::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateTextCompositionStyles> res = make_object<updateTextCompositionStyles>();
  res->styles_ = jni::FetchVector<textCompositionStyle>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->styles_fieldID));
  return std::move(res);
}

void updateTextCompositionStyles::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, styles_); if (arr_tmp_) { env->SetObjectField(s, styles_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateTextCompositionStyles::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateTextCompositionStyles");
    { s.store_vector_begin("styles", styles_.size()); for (const auto &_value : styles_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateTextCompositionStyles::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateTextCompositionStyles").c_str());
    styles_fieldID = jni::get_field_id(env, Class, "styles", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$TextCompositionStyle;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSuggestedActions::Class;
jfieldID updateSuggestedActions::added_actions_fieldID;
jfieldID updateSuggestedActions::removed_actions_fieldID;

updateSuggestedActions::updateSuggestedActions()
  : added_actions_()
  , removed_actions_()
{}

updateSuggestedActions::updateSuggestedActions(array<object_ptr<SuggestedAction>> &&added_actions_, array<object_ptr<SuggestedAction>> &&removed_actions_)
  : added_actions_(std::move(added_actions_))
  , removed_actions_(std::move(removed_actions_))
{}

const std::int32_t updateSuggestedActions::ID;

object_ptr<Update> updateSuggestedActions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSuggestedActions> res = make_object<updateSuggestedActions>();
  res->added_actions_ = jni::FetchVector<SuggestedAction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->added_actions_fieldID));
  res->removed_actions_ = jni::FetchVector<SuggestedAction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->removed_actions_fieldID));
  return std::move(res);
}

void updateSuggestedActions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, added_actions_); if (arr_tmp_) { env->SetObjectField(s, added_actions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, removed_actions_); if (arr_tmp_) { env->SetObjectField(s, removed_actions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateSuggestedActions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSuggestedActions");
    { s.store_vector_begin("addedActions", added_actions_.size()); for (const auto &_value : added_actions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("removedActions", removed_actions_.size()); for (const auto &_value : removed_actions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateSuggestedActions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSuggestedActions").c_str());
    added_actions_fieldID = jni::get_field_id(env, Class, "addedActions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$SuggestedAction;").c_str());
    removed_actions_fieldID = jni::get_field_id(env, Class, "removedActions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$SuggestedAction;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateSpeedLimitNotification::Class;
jfieldID updateSpeedLimitNotification::is_upload_fieldID;

updateSpeedLimitNotification::updateSpeedLimitNotification()
  : is_upload_()
{}

updateSpeedLimitNotification::updateSpeedLimitNotification(bool is_upload_)
  : is_upload_(is_upload_)
{}

const std::int32_t updateSpeedLimitNotification::ID;

object_ptr<Update> updateSpeedLimitNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateSpeedLimitNotification> res = make_object<updateSpeedLimitNotification>();
  res->is_upload_ = (env->GetBooleanField(p, res->is_upload_fieldID) != 0);
  return std::move(res);
}

void updateSpeedLimitNotification::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_upload_fieldID, is_upload_);
}

void updateSpeedLimitNotification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateSpeedLimitNotification");
    s.store_field("isUpload", is_upload_);
    s.store_class_end();
  }
}

void updateSpeedLimitNotification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateSpeedLimitNotification").c_str());
    is_upload_fieldID = jni::get_field_id(env, Class, "isUpload", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass updateContactCloseBirthdays::Class;
jfieldID updateContactCloseBirthdays::close_birthday_users_fieldID;

updateContactCloseBirthdays::updateContactCloseBirthdays()
  : close_birthday_users_()
{}

updateContactCloseBirthdays::updateContactCloseBirthdays(array<object_ptr<closeBirthdayUser>> &&close_birthday_users_)
  : close_birthday_users_(std::move(close_birthday_users_))
{}

const std::int32_t updateContactCloseBirthdays::ID;

object_ptr<Update> updateContactCloseBirthdays::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateContactCloseBirthdays> res = make_object<updateContactCloseBirthdays>();
  res->close_birthday_users_ = jni::FetchVector<closeBirthdayUser>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->close_birthday_users_fieldID));
  return std::move(res);
}

void updateContactCloseBirthdays::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, close_birthday_users_); if (arr_tmp_) { env->SetObjectField(s, close_birthday_users_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateContactCloseBirthdays::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateContactCloseBirthdays");
    { s.store_vector_begin("closeBirthdayUsers", close_birthday_users_.size()); for (const auto &_value : close_birthday_users_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateContactCloseBirthdays::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateContactCloseBirthdays").c_str());
    close_birthday_users_fieldID = jni::get_field_id(env, Class, "closeBirthdayUsers", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$CloseBirthdayUser;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateAutosaveSettings::Class;
jfieldID updateAutosaveSettings::scope_fieldID;
jfieldID updateAutosaveSettings::settings_fieldID;

updateAutosaveSettings::updateAutosaveSettings()
  : scope_()
  , settings_()
{}

updateAutosaveSettings::updateAutosaveSettings(object_ptr<AutosaveSettingsScope> &&scope_, object_ptr<scopeAutosaveSettings> &&settings_)
  : scope_(std::move(scope_))
  , settings_(std::move(settings_))
{}

const std::int32_t updateAutosaveSettings::ID;

object_ptr<Update> updateAutosaveSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateAutosaveSettings> res = make_object<updateAutosaveSettings>();
  res->scope_ = jni::fetch_tl_object<AutosaveSettingsScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->settings_ = jni::fetch_tl_object<scopeAutosaveSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return std::move(res);
}

void updateAutosaveSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (scope_ != nullptr) { jobject next; scope_->store(env, next); if (next) { env->SetObjectField(s, scope_fieldID, next); env->DeleteLocalRef(next); } }
  if (settings_ != nullptr) { jobject next; settings_->store(env, next); if (next) { env->SetObjectField(s, settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateAutosaveSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateAutosaveSettings");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

void updateAutosaveSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateAutosaveSettings").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AutosaveSettingsScope;").c_str());
    settings_fieldID = jni::get_field_id(env, Class, "settings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeAutosaveSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateBusinessConnection::Class;
jfieldID updateBusinessConnection::connection_fieldID;

updateBusinessConnection::updateBusinessConnection()
  : connection_()
{}

updateBusinessConnection::updateBusinessConnection(object_ptr<businessConnection> &&connection_)
  : connection_(std::move(connection_))
{}

const std::int32_t updateBusinessConnection::ID;

object_ptr<Update> updateBusinessConnection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateBusinessConnection> res = make_object<updateBusinessConnection>();
  res->connection_ = jni::fetch_tl_object<businessConnection>(env, jni::fetch_object(env, p, res->connection_fieldID));
  return std::move(res);
}

void updateBusinessConnection::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (connection_ != nullptr) { jobject next; connection_->store(env, next); if (next) { env->SetObjectField(s, connection_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateBusinessConnection::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateBusinessConnection");
    s.store_object_field("connection", static_cast<const BaseObject *>(connection_.get()));
    s.store_class_end();
  }
}

void updateBusinessConnection::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateBusinessConnection").c_str());
    connection_fieldID = jni::get_field_id(env, Class, "connection", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessConnection;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewBusinessMessage::Class;
jfieldID updateNewBusinessMessage::connection_id_fieldID;
jfieldID updateNewBusinessMessage::message_fieldID;

updateNewBusinessMessage::updateNewBusinessMessage()
  : connection_id_()
  , message_()
{}

updateNewBusinessMessage::updateNewBusinessMessage(string const &connection_id_, object_ptr<businessMessage> &&message_)
  : connection_id_(connection_id_)
  , message_(std::move(message_))
{}

const std::int32_t updateNewBusinessMessage::ID;

object_ptr<Update> updateNewBusinessMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewBusinessMessage> res = make_object<updateNewBusinessMessage>();
  res->connection_id_ = jni::fetch_string(env, p, res->connection_id_fieldID);
  res->message_ = jni::fetch_tl_object<businessMessage>(env, jni::fetch_object(env, p, res->message_fieldID));
  return std::move(res);
}

void updateNewBusinessMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, connection_id_); if (nextString) { env->SetObjectField(s, connection_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewBusinessMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewBusinessMessage");
    s.store_field("connectionId", connection_id_);
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void updateNewBusinessMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewBusinessMessage").c_str());
    connection_id_fieldID = jni::get_field_id(env, Class, "connectionId", "Ljava/lang/String;");
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateBusinessMessageEdited::Class;
jfieldID updateBusinessMessageEdited::connection_id_fieldID;
jfieldID updateBusinessMessageEdited::message_fieldID;

updateBusinessMessageEdited::updateBusinessMessageEdited()
  : connection_id_()
  , message_()
{}

updateBusinessMessageEdited::updateBusinessMessageEdited(string const &connection_id_, object_ptr<businessMessage> &&message_)
  : connection_id_(connection_id_)
  , message_(std::move(message_))
{}

const std::int32_t updateBusinessMessageEdited::ID;

object_ptr<Update> updateBusinessMessageEdited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateBusinessMessageEdited> res = make_object<updateBusinessMessageEdited>();
  res->connection_id_ = jni::fetch_string(env, p, res->connection_id_fieldID);
  res->message_ = jni::fetch_tl_object<businessMessage>(env, jni::fetch_object(env, p, res->message_fieldID));
  return std::move(res);
}

void updateBusinessMessageEdited::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, connection_id_); if (nextString) { env->SetObjectField(s, connection_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateBusinessMessageEdited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateBusinessMessageEdited");
    s.store_field("connectionId", connection_id_);
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void updateBusinessMessageEdited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateBusinessMessageEdited").c_str());
    connection_id_fieldID = jni::get_field_id(env, Class, "connectionId", "Ljava/lang/String;");
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateBusinessMessagesDeleted::Class;
jfieldID updateBusinessMessagesDeleted::connection_id_fieldID;
jfieldID updateBusinessMessagesDeleted::chat_id_fieldID;
jfieldID updateBusinessMessagesDeleted::message_ids_fieldID;

updateBusinessMessagesDeleted::updateBusinessMessagesDeleted()
  : connection_id_()
  , chat_id_()
  , message_ids_()
{}

updateBusinessMessagesDeleted::updateBusinessMessagesDeleted(string const &connection_id_, int53 chat_id_, array<int53> &&message_ids_)
  : connection_id_(connection_id_)
  , chat_id_(chat_id_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t updateBusinessMessagesDeleted::ID;

object_ptr<Update> updateBusinessMessagesDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateBusinessMessagesDeleted> res = make_object<updateBusinessMessagesDeleted>();
  res->connection_id_ = jni::fetch_string(env, p, res->connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return std::move(res);
}

void updateBusinessMessagesDeleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, connection_id_); if (nextString) { env->SetObjectField(s, connection_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  { auto arr_tmp_ = jni::store_vector(env, message_ids_); if (arr_tmp_) { env->SetObjectField(s, message_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateBusinessMessagesDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateBusinessMessagesDeleted");
    s.store_field("connectionId", connection_id_);
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateBusinessMessagesDeleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateBusinessMessagesDeleted").c_str());
    connection_id_fieldID = jni::get_field_id(env, Class, "connectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass updateNewInlineQuery::Class;
jfieldID updateNewInlineQuery::id_fieldID;
jfieldID updateNewInlineQuery::sender_user_id_fieldID;
jfieldID updateNewInlineQuery::user_location_fieldID;
jfieldID updateNewInlineQuery::chat_type_fieldID;
jfieldID updateNewInlineQuery::query_fieldID;
jfieldID updateNewInlineQuery::offset_fieldID;

updateNewInlineQuery::updateNewInlineQuery()
  : id_()
  , sender_user_id_()
  , user_location_()
  , chat_type_()
  , query_()
  , offset_()
{}

updateNewInlineQuery::updateNewInlineQuery(int64 id_, int53 sender_user_id_, object_ptr<location> &&user_location_, object_ptr<ChatType> &&chat_type_, string const &query_, string const &offset_)
  : id_(id_)
  , sender_user_id_(sender_user_id_)
  , user_location_(std::move(user_location_))
  , chat_type_(std::move(chat_type_))
  , query_(query_)
  , offset_(offset_)
{}

const std::int32_t updateNewInlineQuery::ID;

object_ptr<Update> updateNewInlineQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewInlineQuery> res = make_object<updateNewInlineQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->user_location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->user_location_fieldID));
  res->chat_type_ = jni::fetch_tl_object<ChatType>(env, jni::fetch_object(env, p, res->chat_type_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  return std::move(res);
}

void updateNewInlineQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  if (user_location_ != nullptr) { jobject next; user_location_->store(env, next); if (next) { env->SetObjectField(s, user_location_fieldID, next); env->DeleteLocalRef(next); } }
  if (chat_type_ != nullptr) { jobject next; chat_type_->store(env, next); if (next) { env->SetObjectField(s, chat_type_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, query_); if (nextString) { env->SetObjectField(s, query_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, offset_); if (nextString) { env->SetObjectField(s, offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateNewInlineQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewInlineQuery");
    s.store_field("id", id_);
    s.store_field("senderUserId", sender_user_id_);
    s.store_object_field("userLocation", static_cast<const BaseObject *>(user_location_.get()));
    s.store_object_field("chatType", static_cast<const BaseObject *>(chat_type_.get()));
    s.store_field("query", query_);
    s.store_field("offset", offset_);
    s.store_class_end();
  }
}

void updateNewInlineQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewInlineQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    user_location_fieldID = jni::get_field_id(env, Class, "userLocation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    chat_type_fieldID = jni::get_field_id(env, Class, "chatType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatType;").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateNewChosenInlineResult::Class;
jfieldID updateNewChosenInlineResult::sender_user_id_fieldID;
jfieldID updateNewChosenInlineResult::user_location_fieldID;
jfieldID updateNewChosenInlineResult::query_fieldID;
jfieldID updateNewChosenInlineResult::result_id_fieldID;
jfieldID updateNewChosenInlineResult::inline_message_id_fieldID;

updateNewChosenInlineResult::updateNewChosenInlineResult()
  : sender_user_id_()
  , user_location_()
  , query_()
  , result_id_()
  , inline_message_id_()
{}

updateNewChosenInlineResult::updateNewChosenInlineResult(int53 sender_user_id_, object_ptr<location> &&user_location_, string const &query_, string const &result_id_, string const &inline_message_id_)
  : sender_user_id_(sender_user_id_)
  , user_location_(std::move(user_location_))
  , query_(query_)
  , result_id_(result_id_)
  , inline_message_id_(inline_message_id_)
{}

const std::int32_t updateNewChosenInlineResult::ID;

object_ptr<Update> updateNewChosenInlineResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewChosenInlineResult> res = make_object<updateNewChosenInlineResult>();
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->user_location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->user_location_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->result_id_ = jni::fetch_string(env, p, res->result_id_fieldID);
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  return std::move(res);
}

void updateNewChosenInlineResult::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  if (user_location_ != nullptr) { jobject next; user_location_->store(env, next); if (next) { env->SetObjectField(s, user_location_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, query_); if (nextString) { env->SetObjectField(s, query_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, result_id_); if (nextString) { env->SetObjectField(s, result_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, inline_message_id_); if (nextString) { env->SetObjectField(s, inline_message_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateNewChosenInlineResult::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewChosenInlineResult");
    s.store_field("senderUserId", sender_user_id_);
    s.store_object_field("userLocation", static_cast<const BaseObject *>(user_location_.get()));
    s.store_field("query", query_);
    s.store_field("resultId", result_id_);
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_class_end();
  }
}

void updateNewChosenInlineResult::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewChosenInlineResult").c_str());
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    user_location_fieldID = jni::get_field_id(env, Class, "userLocation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    result_id_fieldID = jni::get_field_id(env, Class, "resultId", "Ljava/lang/String;");
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateNewGuestQuery::Class;
jfieldID updateNewGuestQuery::id_fieldID;
jfieldID updateNewGuestQuery::message_fieldID;
jfieldID updateNewGuestQuery::reference_messages_fieldID;

updateNewGuestQuery::updateNewGuestQuery()
  : id_()
  , message_()
  , reference_messages_()
{}

updateNewGuestQuery::updateNewGuestQuery(int64 id_, object_ptr<message> &&message_, array<object_ptr<message>> &&reference_messages_)
  : id_(id_)
  , message_(std::move(message_))
  , reference_messages_(std::move(reference_messages_))
{}

const std::int32_t updateNewGuestQuery::ID;

object_ptr<Update> updateNewGuestQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewGuestQuery> res = make_object<updateNewGuestQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->reference_messages_ = jni::FetchVector<message>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->reference_messages_fieldID));
  return std::move(res);
}

void updateNewGuestQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, reference_messages_); if (arr_tmp_) { env->SetObjectField(s, reference_messages_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateNewGuestQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewGuestQuery");
    s.store_field("id", id_);
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    { s.store_vector_begin("referenceMessages", reference_messages_.size()); for (const auto &_value : reference_messages_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateNewGuestQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewGuestQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    reference_messages_fieldID = jni::get_field_id(env, Class, "referenceMessages", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewCallbackQuery::Class;
jfieldID updateNewCallbackQuery::id_fieldID;
jfieldID updateNewCallbackQuery::sender_user_id_fieldID;
jfieldID updateNewCallbackQuery::chat_id_fieldID;
jfieldID updateNewCallbackQuery::message_id_fieldID;
jfieldID updateNewCallbackQuery::chat_instance_fieldID;
jfieldID updateNewCallbackQuery::payload_fieldID;

updateNewCallbackQuery::updateNewCallbackQuery()
  : id_()
  , sender_user_id_()
  , chat_id_()
  , message_id_()
  , chat_instance_()
  , payload_()
{}

updateNewCallbackQuery::updateNewCallbackQuery(int64 id_, int53 sender_user_id_, int53 chat_id_, int53 message_id_, int64 chat_instance_, object_ptr<CallbackQueryPayload> &&payload_)
  : id_(id_)
  , sender_user_id_(sender_user_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , chat_instance_(chat_instance_)
  , payload_(std::move(payload_))
{}

const std::int32_t updateNewCallbackQuery::ID;

object_ptr<Update> updateNewCallbackQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewCallbackQuery> res = make_object<updateNewCallbackQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->chat_instance_ = env->GetLongField(p, res->chat_instance_fieldID);
  res->payload_ = jni::fetch_tl_object<CallbackQueryPayload>(env, jni::fetch_object(env, p, res->payload_fieldID));
  return std::move(res);
}

void updateNewCallbackQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetLongField(s, chat_instance_fieldID, chat_instance_);
  if (payload_ != nullptr) { jobject next; payload_->store(env, next); if (next) { env->SetObjectField(s, payload_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewCallbackQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewCallbackQuery");
    s.store_field("id", id_);
    s.store_field("senderUserId", sender_user_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("chatInstance", chat_instance_);
    s.store_object_field("payload", static_cast<const BaseObject *>(payload_.get()));
    s.store_class_end();
  }
}

void updateNewCallbackQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewCallbackQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    chat_instance_fieldID = jni::get_field_id(env, Class, "chatInstance", "J");
    payload_fieldID = jni::get_field_id(env, Class, "payload", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallbackQueryPayload;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewInlineCallbackQuery::Class;
jfieldID updateNewInlineCallbackQuery::id_fieldID;
jfieldID updateNewInlineCallbackQuery::sender_user_id_fieldID;
jfieldID updateNewInlineCallbackQuery::inline_message_id_fieldID;
jfieldID updateNewInlineCallbackQuery::chat_instance_fieldID;
jfieldID updateNewInlineCallbackQuery::payload_fieldID;

updateNewInlineCallbackQuery::updateNewInlineCallbackQuery()
  : id_()
  , sender_user_id_()
  , inline_message_id_()
  , chat_instance_()
  , payload_()
{}

updateNewInlineCallbackQuery::updateNewInlineCallbackQuery(int64 id_, int53 sender_user_id_, string const &inline_message_id_, int64 chat_instance_, object_ptr<CallbackQueryPayload> &&payload_)
  : id_(id_)
  , sender_user_id_(sender_user_id_)
  , inline_message_id_(inline_message_id_)
  , chat_instance_(chat_instance_)
  , payload_(std::move(payload_))
{}

const std::int32_t updateNewInlineCallbackQuery::ID;

object_ptr<Update> updateNewInlineCallbackQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewInlineCallbackQuery> res = make_object<updateNewInlineCallbackQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  res->chat_instance_ = env->GetLongField(p, res->chat_instance_fieldID);
  res->payload_ = jni::fetch_tl_object<CallbackQueryPayload>(env, jni::fetch_object(env, p, res->payload_fieldID));
  return std::move(res);
}

void updateNewInlineCallbackQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  { jstring nextString = jni::to_jstring(env, inline_message_id_); if (nextString) { env->SetObjectField(s, inline_message_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, chat_instance_fieldID, chat_instance_);
  if (payload_ != nullptr) { jobject next; payload_->store(env, next); if (next) { env->SetObjectField(s, payload_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewInlineCallbackQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewInlineCallbackQuery");
    s.store_field("id", id_);
    s.store_field("senderUserId", sender_user_id_);
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_field("chatInstance", chat_instance_);
    s.store_object_field("payload", static_cast<const BaseObject *>(payload_.get()));
    s.store_class_end();
  }
}

void updateNewInlineCallbackQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewInlineCallbackQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    chat_instance_fieldID = jni::get_field_id(env, Class, "chatInstance", "J");
    payload_fieldID = jni::get_field_id(env, Class, "payload", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallbackQueryPayload;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewBusinessCallbackQuery::Class;
jfieldID updateNewBusinessCallbackQuery::id_fieldID;
jfieldID updateNewBusinessCallbackQuery::sender_user_id_fieldID;
jfieldID updateNewBusinessCallbackQuery::connection_id_fieldID;
jfieldID updateNewBusinessCallbackQuery::message_fieldID;
jfieldID updateNewBusinessCallbackQuery::chat_instance_fieldID;
jfieldID updateNewBusinessCallbackQuery::payload_fieldID;

updateNewBusinessCallbackQuery::updateNewBusinessCallbackQuery()
  : id_()
  , sender_user_id_()
  , connection_id_()
  , message_()
  , chat_instance_()
  , payload_()
{}

updateNewBusinessCallbackQuery::updateNewBusinessCallbackQuery(int64 id_, int53 sender_user_id_, string const &connection_id_, object_ptr<businessMessage> &&message_, int64 chat_instance_, object_ptr<CallbackQueryPayload> &&payload_)
  : id_(id_)
  , sender_user_id_(sender_user_id_)
  , connection_id_(connection_id_)
  , message_(std::move(message_))
  , chat_instance_(chat_instance_)
  , payload_(std::move(payload_))
{}

const std::int32_t updateNewBusinessCallbackQuery::ID;

object_ptr<Update> updateNewBusinessCallbackQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewBusinessCallbackQuery> res = make_object<updateNewBusinessCallbackQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->connection_id_ = jni::fetch_string(env, p, res->connection_id_fieldID);
  res->message_ = jni::fetch_tl_object<businessMessage>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->chat_instance_ = env->GetLongField(p, res->chat_instance_fieldID);
  res->payload_ = jni::fetch_tl_object<CallbackQueryPayload>(env, jni::fetch_object(env, p, res->payload_fieldID));
  return std::move(res);
}

void updateNewBusinessCallbackQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  { jstring nextString = jni::to_jstring(env, connection_id_); if (nextString) { env->SetObjectField(s, connection_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, chat_instance_fieldID, chat_instance_);
  if (payload_ != nullptr) { jobject next; payload_->store(env, next); if (next) { env->SetObjectField(s, payload_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewBusinessCallbackQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewBusinessCallbackQuery");
    s.store_field("id", id_);
    s.store_field("senderUserId", sender_user_id_);
    s.store_field("connectionId", connection_id_);
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_field("chatInstance", chat_instance_);
    s.store_object_field("payload", static_cast<const BaseObject *>(payload_.get()));
    s.store_class_end();
  }
}

void updateNewBusinessCallbackQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewBusinessCallbackQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    connection_id_fieldID = jni::get_field_id(env, Class, "connectionId", "Ljava/lang/String;");
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessMessage;").c_str());
    chat_instance_fieldID = jni::get_field_id(env, Class, "chatInstance", "J");
    payload_fieldID = jni::get_field_id(env, Class, "payload", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallbackQueryPayload;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewShippingQuery::Class;
jfieldID updateNewShippingQuery::id_fieldID;
jfieldID updateNewShippingQuery::sender_user_id_fieldID;
jfieldID updateNewShippingQuery::invoice_payload_fieldID;
jfieldID updateNewShippingQuery::shipping_address_fieldID;

updateNewShippingQuery::updateNewShippingQuery()
  : id_()
  , sender_user_id_()
  , invoice_payload_()
  , shipping_address_()
{}

updateNewShippingQuery::updateNewShippingQuery(int64 id_, int53 sender_user_id_, string const &invoice_payload_, object_ptr<address> &&shipping_address_)
  : id_(id_)
  , sender_user_id_(sender_user_id_)
  , invoice_payload_(invoice_payload_)
  , shipping_address_(std::move(shipping_address_))
{}

const std::int32_t updateNewShippingQuery::ID;

object_ptr<Update> updateNewShippingQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewShippingQuery> res = make_object<updateNewShippingQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->invoice_payload_ = jni::fetch_string(env, p, res->invoice_payload_fieldID);
  res->shipping_address_ = jni::fetch_tl_object<address>(env, jni::fetch_object(env, p, res->shipping_address_fieldID));
  return std::move(res);
}

void updateNewShippingQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  { jstring nextString = jni::to_jstring(env, invoice_payload_); if (nextString) { env->SetObjectField(s, invoice_payload_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (shipping_address_ != nullptr) { jobject next; shipping_address_->store(env, next); if (next) { env->SetObjectField(s, shipping_address_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewShippingQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewShippingQuery");
    s.store_field("id", id_);
    s.store_field("senderUserId", sender_user_id_);
    s.store_field("invoicePayload", invoice_payload_);
    s.store_object_field("shippingAddress", static_cast<const BaseObject *>(shipping_address_.get()));
    s.store_class_end();
  }
}

void updateNewShippingQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewShippingQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    invoice_payload_fieldID = jni::get_field_id(env, Class, "invoicePayload", "Ljava/lang/String;");
    shipping_address_fieldID = jni::get_field_id(env, Class, "shippingAddress", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Address;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewPreCheckoutQuery::Class;
jfieldID updateNewPreCheckoutQuery::id_fieldID;
jfieldID updateNewPreCheckoutQuery::sender_user_id_fieldID;
jfieldID updateNewPreCheckoutQuery::currency_fieldID;
jfieldID updateNewPreCheckoutQuery::total_amount_fieldID;
jfieldID updateNewPreCheckoutQuery::invoice_payload_fieldID;
jfieldID updateNewPreCheckoutQuery::shipping_option_id_fieldID;
jfieldID updateNewPreCheckoutQuery::order_info_fieldID;

updateNewPreCheckoutQuery::updateNewPreCheckoutQuery()
  : id_()
  , sender_user_id_()
  , currency_()
  , total_amount_()
  , invoice_payload_()
  , shipping_option_id_()
  , order_info_()
{}

updateNewPreCheckoutQuery::updateNewPreCheckoutQuery(int64 id_, int53 sender_user_id_, string const &currency_, int53 total_amount_, bytes const &invoice_payload_, string const &shipping_option_id_, object_ptr<orderInfo> &&order_info_)
  : id_(id_)
  , sender_user_id_(sender_user_id_)
  , currency_(currency_)
  , total_amount_(total_amount_)
  , invoice_payload_(std::move(invoice_payload_))
  , shipping_option_id_(shipping_option_id_)
  , order_info_(std::move(order_info_))
{}

const std::int32_t updateNewPreCheckoutQuery::ID;

object_ptr<Update> updateNewPreCheckoutQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewPreCheckoutQuery> res = make_object<updateNewPreCheckoutQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->invoice_payload_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->invoice_payload_fieldID));
  res->shipping_option_id_ = jni::fetch_string(env, p, res->shipping_option_id_fieldID);
  res->order_info_ = jni::fetch_tl_object<orderInfo>(env, jni::fetch_object(env, p, res->order_info_fieldID));
  return std::move(res);
}

void updateNewPreCheckoutQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, sender_user_id_fieldID, sender_user_id_);
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, total_amount_fieldID, total_amount_);
  { jbyteArray nextBytes = jni::to_bytes(env, invoice_payload_); if (nextBytes) { env->SetObjectField(s, invoice_payload_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  { jstring nextString = jni::to_jstring(env, shipping_option_id_); if (nextString) { env->SetObjectField(s, shipping_option_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (order_info_ != nullptr) { jobject next; order_info_->store(env, next); if (next) { env->SetObjectField(s, order_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewPreCheckoutQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewPreCheckoutQuery");
    s.store_field("id", id_);
    s.store_field("senderUserId", sender_user_id_);
    s.store_field("currency", currency_);
    s.store_field("totalAmount", total_amount_);
    s.store_bytes_field("invoicePayload", invoice_payload_);
    s.store_field("shippingOptionId", shipping_option_id_);
    s.store_object_field("orderInfo", static_cast<const BaseObject *>(order_info_.get()));
    s.store_class_end();
  }
}

void updateNewPreCheckoutQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewPreCheckoutQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_user_id_fieldID = jni::get_field_id(env, Class, "senderUserId", "J");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    invoice_payload_fieldID = jni::get_field_id(env, Class, "invoicePayload", "[B");
    shipping_option_id_fieldID = jni::get_field_id(env, Class, "shippingOptionId", "Ljava/lang/String;");
    order_info_fieldID = jni::get_field_id(env, Class, "orderInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$OrderInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewCustomEvent::Class;
jfieldID updateNewCustomEvent::event_fieldID;

updateNewCustomEvent::updateNewCustomEvent()
  : event_()
{}

updateNewCustomEvent::updateNewCustomEvent(string const &event_)
  : event_(event_)
{}

const std::int32_t updateNewCustomEvent::ID;

object_ptr<Update> updateNewCustomEvent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewCustomEvent> res = make_object<updateNewCustomEvent>();
  res->event_ = jni::fetch_string(env, p, res->event_fieldID);
  return std::move(res);
}

void updateNewCustomEvent::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, event_); if (nextString) { env->SetObjectField(s, event_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updateNewCustomEvent::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewCustomEvent");
    s.store_field("event", event_);
    s.store_class_end();
  }
}

void updateNewCustomEvent::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewCustomEvent").c_str());
    event_fieldID = jni::get_field_id(env, Class, "event", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass updateNewCustomQuery::Class;
jfieldID updateNewCustomQuery::id_fieldID;
jfieldID updateNewCustomQuery::data_fieldID;
jfieldID updateNewCustomQuery::timeout_fieldID;

updateNewCustomQuery::updateNewCustomQuery()
  : id_()
  , data_()
  , timeout_()
{}

updateNewCustomQuery::updateNewCustomQuery(int64 id_, string const &data_, int32 timeout_)
  : id_(id_)
  , data_(data_)
  , timeout_(timeout_)
{}

const std::int32_t updateNewCustomQuery::ID;

object_ptr<Update> updateNewCustomQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewCustomQuery> res = make_object<updateNewCustomQuery>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  res->timeout_ = env->GetIntField(p, res->timeout_fieldID);
  return std::move(res);
}

void updateNewCustomQuery::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, data_); if (nextString) { env->SetObjectField(s, data_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, timeout_fieldID, timeout_);
}

void updateNewCustomQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewCustomQuery");
    s.store_field("id", id_);
    s.store_field("data", data_);
    s.store_field("timeout", timeout_);
    s.store_class_end();
  }
}

void updateNewCustomQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewCustomQuery").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    data_fieldID = jni::get_field_id(env, Class, "data", "Ljava/lang/String;");
    timeout_fieldID = jni::get_field_id(env, Class, "timeout", "I");
    return true;
  }();
  (void)is_inited;
}

jclass updatePoll::Class;
jfieldID updatePoll::poll_fieldID;

updatePoll::updatePoll()
  : poll_()
{}

updatePoll::updatePoll(object_ptr<poll> &&poll_)
  : poll_(std::move(poll_))
{}

const std::int32_t updatePoll::ID;

object_ptr<Update> updatePoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updatePoll> res = make_object<updatePoll>();
  res->poll_ = jni::fetch_tl_object<poll>(env, jni::fetch_object(env, p, res->poll_fieldID));
  return std::move(res);
}

void updatePoll::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (poll_ != nullptr) { jobject next; poll_->store(env, next); if (next) { env->SetObjectField(s, poll_fieldID, next); env->DeleteLocalRef(next); } }
}

void updatePoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdatePoll");
    s.store_object_field("poll", static_cast<const BaseObject *>(poll_.get()));
    s.store_class_end();
  }
}

void updatePoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdatePoll").c_str());
    poll_fieldID = jni::get_field_id(env, Class, "poll", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Poll;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updatePollAnswer::Class;
jfieldID updatePollAnswer::poll_id_fieldID;
jfieldID updatePollAnswer::voter_id_fieldID;
jfieldID updatePollAnswer::option_ids_fieldID;
jfieldID updatePollAnswer::option_positions_fieldID;

updatePollAnswer::updatePollAnswer()
  : poll_id_()
  , voter_id_()
  , option_ids_()
  , option_positions_()
{}

updatePollAnswer::updatePollAnswer(int64 poll_id_, object_ptr<MessageSender> &&voter_id_, array<string> &&option_ids_, array<int32> &&option_positions_)
  : poll_id_(poll_id_)
  , voter_id_(std::move(voter_id_))
  , option_ids_(std::move(option_ids_))
  , option_positions_(std::move(option_positions_))
{}

const std::int32_t updatePollAnswer::ID;

object_ptr<Update> updatePollAnswer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updatePollAnswer> res = make_object<updatePollAnswer>();
  res->poll_id_ = env->GetLongField(p, res->poll_id_fieldID);
  res->voter_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->voter_id_fieldID));
  res->option_ids_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->option_ids_fieldID));
  res->option_positions_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->option_positions_fieldID));
  return std::move(res);
}

void updatePollAnswer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, poll_id_fieldID, poll_id_);
  if (voter_id_ != nullptr) { jobject next; voter_id_->store(env, next); if (next) { env->SetObjectField(s, voter_id_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, option_ids_); if (arr_tmp_) { env->SetObjectField(s, option_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, option_positions_); if (arr_tmp_) { env->SetObjectField(s, option_positions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updatePollAnswer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdatePollAnswer");
    s.store_field("pollId", poll_id_);
    s.store_object_field("voterId", static_cast<const BaseObject *>(voter_id_.get()));
    { s.store_vector_begin("optionIds", option_ids_.size()); for (const auto &_value : option_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("optionPositions", option_positions_.size()); for (const auto &_value : option_positions_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updatePollAnswer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdatePollAnswer").c_str());
    poll_id_fieldID = jni::get_field_id(env, Class, "pollId", "J");
    voter_id_fieldID = jni::get_field_id(env, Class, "voterId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    option_ids_fieldID = jni::get_field_id(env, Class, "optionIds", "[Ljava/lang/String;");
    option_positions_fieldID = jni::get_field_id(env, Class, "optionPositions", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass updateManagedBot::Class;
jfieldID updateManagedBot::user_id_fieldID;
jfieldID updateManagedBot::bot_user_id_fieldID;

updateManagedBot::updateManagedBot()
  : user_id_()
  , bot_user_id_()
{}

updateManagedBot::updateManagedBot(int53 user_id_, int53 bot_user_id_)
  : user_id_(user_id_)
  , bot_user_id_(bot_user_id_)
{}

const std::int32_t updateManagedBot::ID;

object_ptr<Update> updateManagedBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateManagedBot> res = make_object<updateManagedBot>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return std::move(res);
}

void updateManagedBot::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetLongField(s, bot_user_id_fieldID, bot_user_id_);
}

void updateManagedBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateManagedBot");
    s.store_field("userId", user_id_);
    s.store_field("botUserId", bot_user_id_);
    s.store_class_end();
  }
}

void updateManagedBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateManagedBot").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass updateChatMember::Class;
jfieldID updateChatMember::chat_id_fieldID;
jfieldID updateChatMember::actor_user_id_fieldID;
jfieldID updateChatMember::date_fieldID;
jfieldID updateChatMember::invite_link_fieldID;
jfieldID updateChatMember::via_join_request_fieldID;
jfieldID updateChatMember::via_chat_folder_invite_link_fieldID;
jfieldID updateChatMember::old_chat_member_fieldID;
jfieldID updateChatMember::new_chat_member_fieldID;

updateChatMember::updateChatMember()
  : chat_id_()
  , actor_user_id_()
  , date_()
  , invite_link_()
  , via_join_request_()
  , via_chat_folder_invite_link_()
  , old_chat_member_()
  , new_chat_member_()
{}

updateChatMember::updateChatMember(int53 chat_id_, int53 actor_user_id_, int32 date_, object_ptr<chatInviteLink> &&invite_link_, bool via_join_request_, bool via_chat_folder_invite_link_, object_ptr<chatMember> &&old_chat_member_, object_ptr<chatMember> &&new_chat_member_)
  : chat_id_(chat_id_)
  , actor_user_id_(actor_user_id_)
  , date_(date_)
  , invite_link_(std::move(invite_link_))
  , via_join_request_(via_join_request_)
  , via_chat_folder_invite_link_(via_chat_folder_invite_link_)
  , old_chat_member_(std::move(old_chat_member_))
  , new_chat_member_(std::move(new_chat_member_))
{}

const std::int32_t updateChatMember::ID;

object_ptr<Update> updateChatMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatMember> res = make_object<updateChatMember>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->actor_user_id_ = env->GetLongField(p, res->actor_user_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  res->via_join_request_ = (env->GetBooleanField(p, res->via_join_request_fieldID) != 0);
  res->via_chat_folder_invite_link_ = (env->GetBooleanField(p, res->via_chat_folder_invite_link_fieldID) != 0);
  res->old_chat_member_ = jni::fetch_tl_object<chatMember>(env, jni::fetch_object(env, p, res->old_chat_member_fieldID));
  res->new_chat_member_ = jni::fetch_tl_object<chatMember>(env, jni::fetch_object(env, p, res->new_chat_member_fieldID));
  return std::move(res);
}

void updateChatMember::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, actor_user_id_fieldID, actor_user_id_);
  env->SetIntField(s, date_fieldID, date_);
  if (invite_link_ != nullptr) { jobject next; invite_link_->store(env, next); if (next) { env->SetObjectField(s, invite_link_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, via_join_request_fieldID, via_join_request_);
  env->SetBooleanField(s, via_chat_folder_invite_link_fieldID, via_chat_folder_invite_link_);
  if (old_chat_member_ != nullptr) { jobject next; old_chat_member_->store(env, next); if (next) { env->SetObjectField(s, old_chat_member_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_chat_member_ != nullptr) { jobject next; new_chat_member_->store(env, next); if (next) { env->SetObjectField(s, new_chat_member_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatMember");
    s.store_field("chatId", chat_id_);
    s.store_field("actorUserId", actor_user_id_);
    s.store_field("date", date_);
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    s.store_field("viaJoinRequest", via_join_request_);
    s.store_field("viaChatFolderInviteLink", via_chat_folder_invite_link_);
    s.store_object_field("oldChatMember", static_cast<const BaseObject *>(old_chat_member_.get()));
    s.store_object_field("newChatMember", static_cast<const BaseObject *>(new_chat_member_.get()));
    s.store_class_end();
  }
}

void updateChatMember::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatMember").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    actor_user_id_fieldID = jni::get_field_id(env, Class, "actorUserId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    via_join_request_fieldID = jni::get_field_id(env, Class, "viaJoinRequest", "Z");
    via_chat_folder_invite_link_fieldID = jni::get_field_id(env, Class, "viaChatFolderInviteLink", "Z");
    old_chat_member_fieldID = jni::get_field_id(env, Class, "oldChatMember", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMember;").c_str());
    new_chat_member_fieldID = jni::get_field_id(env, Class, "newChatMember", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMember;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateNewChatJoinRequest::Class;
jfieldID updateNewChatJoinRequest::chat_id_fieldID;
jfieldID updateNewChatJoinRequest::request_fieldID;
jfieldID updateNewChatJoinRequest::user_chat_id_fieldID;
jfieldID updateNewChatJoinRequest::invite_link_fieldID;

updateNewChatJoinRequest::updateNewChatJoinRequest()
  : chat_id_()
  , request_()
  , user_chat_id_()
  , invite_link_()
{}

updateNewChatJoinRequest::updateNewChatJoinRequest(int53 chat_id_, object_ptr<chatJoinRequest> &&request_, int53 user_chat_id_, object_ptr<chatInviteLink> &&invite_link_)
  : chat_id_(chat_id_)
  , request_(std::move(request_))
  , user_chat_id_(user_chat_id_)
  , invite_link_(std::move(invite_link_))
{}

const std::int32_t updateNewChatJoinRequest::ID;

object_ptr<Update> updateNewChatJoinRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateNewChatJoinRequest> res = make_object<updateNewChatJoinRequest>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->request_ = jni::fetch_tl_object<chatJoinRequest>(env, jni::fetch_object(env, p, res->request_fieldID));
  res->user_chat_id_ = env->GetLongField(p, res->user_chat_id_fieldID);
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  return std::move(res);
}

void updateNewChatJoinRequest::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (request_ != nullptr) { jobject next; request_->store(env, next); if (next) { env->SetObjectField(s, request_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, user_chat_id_fieldID, user_chat_id_);
  if (invite_link_ != nullptr) { jobject next; invite_link_->store(env, next); if (next) { env->SetObjectField(s, invite_link_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateNewChatJoinRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateNewChatJoinRequest");
    s.store_field("chatId", chat_id_);
    s.store_object_field("request", static_cast<const BaseObject *>(request_.get()));
    s.store_field("userChatId", user_chat_id_);
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    s.store_class_end();
  }
}

void updateNewChatJoinRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateNewChatJoinRequest").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    request_fieldID = jni::get_field_id(env, Class, "request", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatJoinRequest;").c_str());
    user_chat_id_fieldID = jni::get_field_id(env, Class, "userChatId", "J");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateChatBoost::Class;
jfieldID updateChatBoost::chat_id_fieldID;
jfieldID updateChatBoost::boost_fieldID;

updateChatBoost::updateChatBoost()
  : chat_id_()
  , boost_()
{}

updateChatBoost::updateChatBoost(int53 chat_id_, object_ptr<chatBoost> &&boost_)
  : chat_id_(chat_id_)
  , boost_(std::move(boost_))
{}

const std::int32_t updateChatBoost::ID;

object_ptr<Update> updateChatBoost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateChatBoost> res = make_object<updateChatBoost>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->boost_ = jni::fetch_tl_object<chatBoost>(env, jni::fetch_object(env, p, res->boost_fieldID));
  return std::move(res);
}

void updateChatBoost::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (boost_ != nullptr) { jobject next; boost_->store(env, next); if (next) { env->SetObjectField(s, boost_fieldID, next); env->DeleteLocalRef(next); } }
}

void updateChatBoost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateChatBoost");
    s.store_field("chatId", chat_id_);
    s.store_object_field("boost", static_cast<const BaseObject *>(boost_.get()));
    s.store_class_end();
  }
}

void updateChatBoost::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateChatBoost").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    boost_fieldID = jni::get_field_id(env, Class, "boost", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBoost;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageReaction::Class;
jfieldID updateMessageReaction::chat_id_fieldID;
jfieldID updateMessageReaction::message_id_fieldID;
jfieldID updateMessageReaction::actor_id_fieldID;
jfieldID updateMessageReaction::date_fieldID;
jfieldID updateMessageReaction::old_reaction_types_fieldID;
jfieldID updateMessageReaction::new_reaction_types_fieldID;

updateMessageReaction::updateMessageReaction()
  : chat_id_()
  , message_id_()
  , actor_id_()
  , date_()
  , old_reaction_types_()
  , new_reaction_types_()
{}

updateMessageReaction::updateMessageReaction(int53 chat_id_, int53 message_id_, object_ptr<MessageSender> &&actor_id_, int32 date_, array<object_ptr<ReactionType>> &&old_reaction_types_, array<object_ptr<ReactionType>> &&new_reaction_types_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , actor_id_(std::move(actor_id_))
  , date_(date_)
  , old_reaction_types_(std::move(old_reaction_types_))
  , new_reaction_types_(std::move(new_reaction_types_))
{}

const std::int32_t updateMessageReaction::ID;

object_ptr<Update> updateMessageReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageReaction> res = make_object<updateMessageReaction>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->actor_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->actor_id_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->old_reaction_types_ = jni::FetchVector<ReactionType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->old_reaction_types_fieldID));
  res->new_reaction_types_ = jni::FetchVector<ReactionType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->new_reaction_types_fieldID));
  return std::move(res);
}

void updateMessageReaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (actor_id_ != nullptr) { jobject next; actor_id_->store(env, next); if (next) { env->SetObjectField(s, actor_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  { auto arr_tmp_ = jni::store_vector(env, old_reaction_types_); if (arr_tmp_) { env->SetObjectField(s, old_reaction_types_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, new_reaction_types_); if (arr_tmp_) { env->SetObjectField(s, new_reaction_types_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateMessageReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageReaction");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("actorId", static_cast<const BaseObject *>(actor_id_.get()));
    s.store_field("date", date_);
    { s.store_vector_begin("oldReactionTypes", old_reaction_types_.size()); for (const auto &_value : old_reaction_types_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("newReactionTypes", new_reaction_types_.size()); for (const auto &_value : new_reaction_types_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateMessageReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageReaction").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    actor_id_fieldID = jni::get_field_id(env, Class, "actorId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    old_reaction_types_fieldID = jni::get_field_id(env, Class, "oldReactionTypes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    new_reaction_types_fieldID = jni::get_field_id(env, Class, "newReactionTypes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updateMessageReactions::Class;
jfieldID updateMessageReactions::chat_id_fieldID;
jfieldID updateMessageReactions::message_id_fieldID;
jfieldID updateMessageReactions::date_fieldID;
jfieldID updateMessageReactions::reactions_fieldID;

updateMessageReactions::updateMessageReactions()
  : chat_id_()
  , message_id_()
  , date_()
  , reactions_()
{}

updateMessageReactions::updateMessageReactions(int53 chat_id_, int53 message_id_, int32 date_, array<object_ptr<messageReaction>> &&reactions_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , date_(date_)
  , reactions_(std::move(reactions_))
{}

const std::int32_t updateMessageReactions::ID;

object_ptr<Update> updateMessageReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updateMessageReactions> res = make_object<updateMessageReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->reactions_ = jni::FetchVector<messageReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->reactions_fieldID));
  return std::move(res);
}

void updateMessageReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetIntField(s, date_fieldID, date_);
  { auto arr_tmp_ = jni::store_vector(env, reactions_); if (arr_tmp_) { env->SetObjectField(s, reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void updateMessageReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdateMessageReactions");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("date", date_);
    { s.store_vector_begin("reactions", reactions_.size()); for (const auto &_value : reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void updateMessageReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdateMessageReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    reactions_fieldID = jni::get_field_id(env, Class, "reactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageReaction;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updatePaidMediaPurchased::Class;
jfieldID updatePaidMediaPurchased::user_id_fieldID;
jfieldID updatePaidMediaPurchased::payload_fieldID;

updatePaidMediaPurchased::updatePaidMediaPurchased()
  : user_id_()
  , payload_()
{}

updatePaidMediaPurchased::updatePaidMediaPurchased(int53 user_id_, string const &payload_)
  : user_id_(user_id_)
  , payload_(payload_)
{}

const std::int32_t updatePaidMediaPurchased::ID;

object_ptr<Update> updatePaidMediaPurchased::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updatePaidMediaPurchased> res = make_object<updatePaidMediaPurchased>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  return std::move(res);
}

void updatePaidMediaPurchased::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  { jstring nextString = jni::to_jstring(env, payload_); if (nextString) { env->SetObjectField(s, payload_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void updatePaidMediaPurchased::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpdatePaidMediaPurchased");
    s.store_field("userId", user_id_);
    s.store_field("payload", payload_);
    s.store_class_end();
  }
}

void updatePaidMediaPurchased::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpdatePaidMediaPurchased").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    payload_fieldID = jni::get_field_id(env, Class, "payload", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass acceptCall::Class;
jfieldID acceptCall::call_id_fieldID;
jfieldID acceptCall::protocol_fieldID;

acceptCall::acceptCall()
  : call_id_()
  , protocol_()
{}

acceptCall::acceptCall(int32 call_id_, object_ptr<callProtocol> &&protocol_)
  : call_id_(call_id_)
  , protocol_(std::move(protocol_))
{}

const std::int32_t acceptCall::ID;

object_ptr<acceptCall> acceptCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<acceptCall> res = make_object<acceptCall>();
  res->call_id_ = env->GetIntField(p, res->call_id_fieldID);
  res->protocol_ = jni::fetch_tl_object<callProtocol>(env, jni::fetch_object(env, p, res->protocol_fieldID));
  return res;
}

void acceptCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AcceptCall");
    s.store_field("callId", call_id_);
    s.store_object_field("protocol", static_cast<const BaseObject *>(protocol_.get()));
    s.store_class_end();
  }
}

acceptCall::ReturnType acceptCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void acceptCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AcceptCall").c_str());
    call_id_fieldID = jni::get_field_id(env, Class, "callId", "I");
    protocol_fieldID = jni::get_field_id(env, Class, "protocol", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallProtocol;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addFileToDownloads::Class;
jfieldID addFileToDownloads::file_id_fieldID;
jfieldID addFileToDownloads::chat_id_fieldID;
jfieldID addFileToDownloads::message_id_fieldID;
jfieldID addFileToDownloads::priority_fieldID;

addFileToDownloads::addFileToDownloads()
  : file_id_()
  , chat_id_()
  , message_id_()
  , priority_()
{}

addFileToDownloads::addFileToDownloads(int32 file_id_, int53 chat_id_, int53 message_id_, int32 priority_)
  : file_id_(file_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , priority_(priority_)
{}

const std::int32_t addFileToDownloads::ID;

object_ptr<addFileToDownloads> addFileToDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addFileToDownloads> res = make_object<addFileToDownloads>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->priority_ = env->GetIntField(p, res->priority_fieldID);
  return res;
}

void addFileToDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddFileToDownloads");
    s.store_field("fileId", file_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("priority", priority_);
    s.store_class_end();
  }
}

addFileToDownloads::ReturnType addFileToDownloads::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return file::fetch(env, p);
}

void addFileToDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddFileToDownloads").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    priority_fieldID = jni::get_field_id(env, Class, "priority", "I");
    return true;
  }();
  (void)is_inited;
}

jclass addSavedNotificationSound::Class;
jfieldID addSavedNotificationSound::sound_fieldID;

addSavedNotificationSound::addSavedNotificationSound()
  : sound_()
{}

addSavedNotificationSound::addSavedNotificationSound(object_ptr<InputFile> &&sound_)
  : sound_(std::move(sound_))
{}

const std::int32_t addSavedNotificationSound::ID;

object_ptr<addSavedNotificationSound> addSavedNotificationSound::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addSavedNotificationSound> res = make_object<addSavedNotificationSound>();
  res->sound_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sound_fieldID));
  return res;
}

void addSavedNotificationSound::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddSavedNotificationSound");
    s.store_object_field("sound", static_cast<const BaseObject *>(sound_.get()));
    s.store_class_end();
  }
}

addSavedNotificationSound::ReturnType addSavedNotificationSound::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return notificationSound::fetch(env, p);
}

void addSavedNotificationSound::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddSavedNotificationSound").c_str());
    sound_fieldID = jni::get_field_id(env, Class, "sound", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass answerCallbackQuery::Class;
jfieldID answerCallbackQuery::callback_query_id_fieldID;
jfieldID answerCallbackQuery::text_fieldID;
jfieldID answerCallbackQuery::show_alert_fieldID;
jfieldID answerCallbackQuery::url_fieldID;
jfieldID answerCallbackQuery::cache_time_fieldID;

answerCallbackQuery::answerCallbackQuery()
  : callback_query_id_()
  , text_()
  , show_alert_()
  , url_()
  , cache_time_()
{}

answerCallbackQuery::answerCallbackQuery(int64 callback_query_id_, string const &text_, bool show_alert_, string const &url_, int32 cache_time_)
  : callback_query_id_(callback_query_id_)
  , text_(text_)
  , show_alert_(show_alert_)
  , url_(url_)
  , cache_time_(cache_time_)
{}

const std::int32_t answerCallbackQuery::ID;

object_ptr<answerCallbackQuery> answerCallbackQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<answerCallbackQuery> res = make_object<answerCallbackQuery>();
  res->callback_query_id_ = env->GetLongField(p, res->callback_query_id_fieldID);
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->show_alert_ = (env->GetBooleanField(p, res->show_alert_fieldID) != 0);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->cache_time_ = env->GetIntField(p, res->cache_time_fieldID);
  return res;
}

void answerCallbackQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnswerCallbackQuery");
    s.store_field("callbackQueryId", callback_query_id_);
    s.store_field("text", text_);
    s.store_field("showAlert", show_alert_);
    s.store_field("url", url_);
    s.store_field("cacheTime", cache_time_);
    s.store_class_end();
  }
}

answerCallbackQuery::ReturnType answerCallbackQuery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void answerCallbackQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnswerCallbackQuery").c_str());
    callback_query_id_fieldID = jni::get_field_id(env, Class, "callbackQueryId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    show_alert_fieldID = jni::get_field_id(env, Class, "showAlert", "Z");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    cache_time_fieldID = jni::get_field_id(env, Class, "cacheTime", "I");
    return true;
  }();
  (void)is_inited;
}

jclass answerShippingQuery::Class;
jfieldID answerShippingQuery::shipping_query_id_fieldID;
jfieldID answerShippingQuery::shipping_options_fieldID;
jfieldID answerShippingQuery::error_message_fieldID;

answerShippingQuery::answerShippingQuery()
  : shipping_query_id_()
  , shipping_options_()
  , error_message_()
{}

answerShippingQuery::answerShippingQuery(int64 shipping_query_id_, array<object_ptr<shippingOption>> &&shipping_options_, string const &error_message_)
  : shipping_query_id_(shipping_query_id_)
  , shipping_options_(std::move(shipping_options_))
  , error_message_(error_message_)
{}

const std::int32_t answerShippingQuery::ID;

object_ptr<answerShippingQuery> answerShippingQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<answerShippingQuery> res = make_object<answerShippingQuery>();
  res->shipping_query_id_ = env->GetLongField(p, res->shipping_query_id_fieldID);
  res->shipping_options_ = jni::FetchVector<shippingOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->shipping_options_fieldID));
  res->error_message_ = jni::fetch_string(env, p, res->error_message_fieldID);
  return res;
}

void answerShippingQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnswerShippingQuery");
    s.store_field("shippingQueryId", shipping_query_id_);
    { s.store_vector_begin("shippingOptions", shipping_options_.size()); for (const auto &_value : shipping_options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("errorMessage", error_message_);
    s.store_class_end();
  }
}

answerShippingQuery::ReturnType answerShippingQuery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void answerShippingQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnswerShippingQuery").c_str());
    shipping_query_id_fieldID = jni::get_field_id(env, Class, "shippingQueryId", "J");
    shipping_options_fieldID = jni::get_field_id(env, Class, "shippingOptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ShippingOption;").c_str());
    error_message_fieldID = jni::get_field_id(env, Class, "errorMessage", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass canPurchaseFromStore::Class;
jfieldID canPurchaseFromStore::purpose_fieldID;

canPurchaseFromStore::canPurchaseFromStore()
  : purpose_()
{}

canPurchaseFromStore::canPurchaseFromStore(object_ptr<StorePaymentPurpose> &&purpose_)
  : purpose_(std::move(purpose_))
{}

const std::int32_t canPurchaseFromStore::ID;

object_ptr<canPurchaseFromStore> canPurchaseFromStore::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canPurchaseFromStore> res = make_object<canPurchaseFromStore>();
  res->purpose_ = jni::fetch_tl_object<StorePaymentPurpose>(env, jni::fetch_object(env, p, res->purpose_fieldID));
  return res;
}

void canPurchaseFromStore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanPurchaseFromStore");
    s.store_object_field("purpose", static_cast<const BaseObject *>(purpose_.get()));
    s.store_class_end();
  }
}

canPurchaseFromStore::ReturnType canPurchaseFromStore::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void canPurchaseFromStore::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanPurchaseFromStore").c_str());
    purpose_fieldID = jni::get_field_id(env, Class, "purpose", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StorePaymentPurpose;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass canTransferOwnership::Class;

canTransferOwnership::canTransferOwnership() {
}

const std::int32_t canTransferOwnership::ID;

object_ptr<canTransferOwnership> canTransferOwnership::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<canTransferOwnership>();
}

void canTransferOwnership::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanTransferOwnership");
    s.store_class_end();
  }
}

canTransferOwnership::ReturnType canTransferOwnership::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return CanTransferOwnershipResult::fetch(env, p);
}

void canTransferOwnership::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CanTransferOwnership").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass cancelPreliminaryUploadFile::Class;
jfieldID cancelPreliminaryUploadFile::file_id_fieldID;

cancelPreliminaryUploadFile::cancelPreliminaryUploadFile()
  : file_id_()
{}

cancelPreliminaryUploadFile::cancelPreliminaryUploadFile(int32 file_id_)
  : file_id_(file_id_)
{}

const std::int32_t cancelPreliminaryUploadFile::ID;

object_ptr<cancelPreliminaryUploadFile> cancelPreliminaryUploadFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<cancelPreliminaryUploadFile> res = make_object<cancelPreliminaryUploadFile>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  return res;
}

void cancelPreliminaryUploadFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CancelPreliminaryUploadFile");
    s.store_field("fileId", file_id_);
    s.store_class_end();
  }
}

cancelPreliminaryUploadFile::ReturnType cancelPreliminaryUploadFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void cancelPreliminaryUploadFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CancelPreliminaryUploadFile").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass checkAuthenticationPremiumPurchase::Class;
jfieldID checkAuthenticationPremiumPurchase::premium_day_count_fieldID;
jfieldID checkAuthenticationPremiumPurchase::currency_fieldID;
jfieldID checkAuthenticationPremiumPurchase::amount_fieldID;

checkAuthenticationPremiumPurchase::checkAuthenticationPremiumPurchase()
  : premium_day_count_()
  , currency_()
  , amount_()
{}

checkAuthenticationPremiumPurchase::checkAuthenticationPremiumPurchase(int32 premium_day_count_, string const &currency_, int53 amount_)
  : premium_day_count_(premium_day_count_)
  , currency_(currency_)
  , amount_(amount_)
{}

const std::int32_t checkAuthenticationPremiumPurchase::ID;

object_ptr<checkAuthenticationPremiumPurchase> checkAuthenticationPremiumPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkAuthenticationPremiumPurchase> res = make_object<checkAuthenticationPremiumPurchase>();
  res->premium_day_count_ = env->GetIntField(p, res->premium_day_count_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  return res;
}

void checkAuthenticationPremiumPurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckAuthenticationPremiumPurchase");
    s.store_field("premiumDayCount", premium_day_count_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_class_end();
  }
}

checkAuthenticationPremiumPurchase::ReturnType checkAuthenticationPremiumPurchase::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void checkAuthenticationPremiumPurchase::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CheckAuthenticationPremiumPurchase").c_str());
    premium_day_count_fieldID = jni::get_field_id(env, Class, "premiumDayCount", "I");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass checkOauthRequestMatchCode::Class;
jfieldID checkOauthRequestMatchCode::url_fieldID;
jfieldID checkOauthRequestMatchCode::match_code_fieldID;

checkOauthRequestMatchCode::checkOauthRequestMatchCode()
  : url_()
  , match_code_()
{}

checkOauthRequestMatchCode::checkOauthRequestMatchCode(string const &url_, string const &match_code_)
  : url_(url_)
  , match_code_(match_code_)
{}

const std::int32_t checkOauthRequestMatchCode::ID;

object_ptr<checkOauthRequestMatchCode> checkOauthRequestMatchCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkOauthRequestMatchCode> res = make_object<checkOauthRequestMatchCode>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->match_code_ = jni::fetch_string(env, p, res->match_code_fieldID);
  return res;
}

void checkOauthRequestMatchCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckOauthRequestMatchCode");
    s.store_field("url", url_);
    s.store_field("matchCode", match_code_);
    s.store_class_end();
  }
}

checkOauthRequestMatchCode::ReturnType checkOauthRequestMatchCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void checkOauthRequestMatchCode::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CheckOauthRequestMatchCode").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    match_code_fieldID = jni::get_field_id(env, Class, "matchCode", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass checkStickerSetName::Class;
jfieldID checkStickerSetName::name_fieldID;

checkStickerSetName::checkStickerSetName()
  : name_()
{}

checkStickerSetName::checkStickerSetName(string const &name_)
  : name_(name_)
{}

const std::int32_t checkStickerSetName::ID;

object_ptr<checkStickerSetName> checkStickerSetName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkStickerSetName> res = make_object<checkStickerSetName>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void checkStickerSetName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckStickerSetName");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

checkStickerSetName::ReturnType checkStickerSetName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return CheckStickerSetNameResult::fetch(env, p);
}

void checkStickerSetName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CheckStickerSetName").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass clearRecentEmojiStatuses::Class;

clearRecentEmojiStatuses::clearRecentEmojiStatuses() {
}

const std::int32_t clearRecentEmojiStatuses::ID;

object_ptr<clearRecentEmojiStatuses> clearRecentEmojiStatuses::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<clearRecentEmojiStatuses>();
}

void clearRecentEmojiStatuses::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ClearRecentEmojiStatuses");
    s.store_class_end();
  }
}

clearRecentEmojiStatuses::ReturnType clearRecentEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void clearRecentEmojiStatuses::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ClearRecentEmojiStatuses").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass close::Class;

close::close() {
}

const std::int32_t close::ID;

object_ptr<close> close::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<close>();
}

void close::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Close");
    s.store_class_end();
  }
}

close::ReturnType close::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void close::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Close").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass composeTextWithAi::Class;
jfieldID composeTextWithAi::text_fieldID;
jfieldID composeTextWithAi::translate_to_language_code_fieldID;
jfieldID composeTextWithAi::style_name_fieldID;
jfieldID composeTextWithAi::add_emojis_fieldID;

composeTextWithAi::composeTextWithAi()
  : text_()
  , translate_to_language_code_()
  , style_name_()
  , add_emojis_()
{}

composeTextWithAi::composeTextWithAi(object_ptr<formattedText> &&text_, string const &translate_to_language_code_, string const &style_name_, bool add_emojis_)
  : text_(std::move(text_))
  , translate_to_language_code_(translate_to_language_code_)
  , style_name_(style_name_)
  , add_emojis_(add_emojis_)
{}

const std::int32_t composeTextWithAi::ID;

object_ptr<composeTextWithAi> composeTextWithAi::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<composeTextWithAi> res = make_object<composeTextWithAi>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->translate_to_language_code_ = jni::fetch_string(env, p, res->translate_to_language_code_fieldID);
  res->style_name_ = jni::fetch_string(env, p, res->style_name_fieldID);
  res->add_emojis_ = (env->GetBooleanField(p, res->add_emojis_fieldID) != 0);
  return res;
}

void composeTextWithAi::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ComposeTextWithAi");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("translateToLanguageCode", translate_to_language_code_);
    s.store_field("styleName", style_name_);
    s.store_field("addEmojis", add_emojis_);
    s.store_class_end();
  }
}

composeTextWithAi::ReturnType composeTextWithAi::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

void composeTextWithAi::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ComposeTextWithAi").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    translate_to_language_code_fieldID = jni::get_field_id(env, Class, "translateToLanguageCode", "Ljava/lang/String;");
    style_name_fieldID = jni::get_field_id(env, Class, "styleName", "Ljava/lang/String;");
    add_emojis_fieldID = jni::get_field_id(env, Class, "addEmojis", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createNewSecretChat::Class;
jfieldID createNewSecretChat::user_id_fieldID;

createNewSecretChat::createNewSecretChat()
  : user_id_()
{}

createNewSecretChat::createNewSecretChat(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t createNewSecretChat::ID;

object_ptr<createNewSecretChat> createNewSecretChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createNewSecretChat> res = make_object<createNewSecretChat>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  return res;
}

void createNewSecretChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateNewSecretChat");
    s.store_field("userId", user_id_);
    s.store_class_end();
  }
}

createNewSecretChat::ReturnType createNewSecretChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

void createNewSecretChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateNewSecretChat").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass deleteChat::Class;
jfieldID deleteChat::chat_id_fieldID;

deleteChat::deleteChat()
  : chat_id_()
{}

deleteChat::deleteChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t deleteChat::ID;

object_ptr<deleteChat> deleteChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteChat> res = make_object<deleteChat>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void deleteChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteChat");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

deleteChat::ReturnType deleteChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteChat").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass deleteGiftCollection::Class;
jfieldID deleteGiftCollection::owner_id_fieldID;
jfieldID deleteGiftCollection::collection_id_fieldID;

deleteGiftCollection::deleteGiftCollection()
  : owner_id_()
  , collection_id_()
{}

deleteGiftCollection::deleteGiftCollection(object_ptr<MessageSender> &&owner_id_, int32 collection_id_)
  : owner_id_(std::move(owner_id_))
  , collection_id_(collection_id_)
{}

const std::int32_t deleteGiftCollection::ID;

object_ptr<deleteGiftCollection> deleteGiftCollection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteGiftCollection> res = make_object<deleteGiftCollection>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->collection_id_ = env->GetIntField(p, res->collection_id_fieldID);
  return res;
}

void deleteGiftCollection::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteGiftCollection");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("collectionId", collection_id_);
    s.store_class_end();
  }
}

deleteGiftCollection::ReturnType deleteGiftCollection::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteGiftCollection::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteGiftCollection").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    collection_id_fieldID = jni::get_field_id(env, Class, "collectionId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass deletePassportElement::Class;
jfieldID deletePassportElement::type_fieldID;

deletePassportElement::deletePassportElement()
  : type_()
{}

deletePassportElement::deletePassportElement(object_ptr<PassportElementType> &&type_)
  : type_(std::move(type_))
{}

const std::int32_t deletePassportElement::ID;

object_ptr<deletePassportElement> deletePassportElement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deletePassportElement> res = make_object<deletePassportElement>();
  res->type_ = jni::fetch_tl_object<PassportElementType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void deletePassportElement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeletePassportElement");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

deletePassportElement::ReturnType deletePassportElement::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deletePassportElement::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeletePassportElement").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PassportElementType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass deleteTextCompositionStyle::Class;
jfieldID deleteTextCompositionStyle::name_fieldID;

deleteTextCompositionStyle::deleteTextCompositionStyle()
  : name_()
{}

deleteTextCompositionStyle::deleteTextCompositionStyle(string const &name_)
  : name_(name_)
{}

const std::int32_t deleteTextCompositionStyle::ID;

object_ptr<deleteTextCompositionStyle> deleteTextCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteTextCompositionStyle> res = make_object<deleteTextCompositionStyle>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void deleteTextCompositionStyle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteTextCompositionStyle");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

deleteTextCompositionStyle::ReturnType deleteTextCompositionStyle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteTextCompositionStyle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteTextCompositionStyle").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass editBusinessMessageText::Class;
jfieldID editBusinessMessageText::business_connection_id_fieldID;
jfieldID editBusinessMessageText::chat_id_fieldID;
jfieldID editBusinessMessageText::message_id_fieldID;
jfieldID editBusinessMessageText::reply_markup_fieldID;
jfieldID editBusinessMessageText::input_message_content_fieldID;

editBusinessMessageText::editBusinessMessageText()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
  , input_message_content_()
{}

editBusinessMessageText::editBusinessMessageText(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editBusinessMessageText::ID;

object_ptr<editBusinessMessageText> editBusinessMessageText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessMessageText> res = make_object<editBusinessMessageText>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void editBusinessMessageText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessMessageText");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

editBusinessMessageText::ReturnType editBusinessMessageText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void editBusinessMessageText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessMessageText").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    input_message_content_fieldID = jni::get_field_id(env, Class, "inputMessageContent", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editTextCompositionStyle::Class;
jfieldID editTextCompositionStyle::name_fieldID;
jfieldID editTextCompositionStyle::title_fieldID;
jfieldID editTextCompositionStyle::custom_emoji_id_fieldID;
jfieldID editTextCompositionStyle::prompt_fieldID;
jfieldID editTextCompositionStyle::show_creator_fieldID;

editTextCompositionStyle::editTextCompositionStyle()
  : name_()
  , title_()
  , custom_emoji_id_()
  , prompt_()
  , show_creator_()
{}

editTextCompositionStyle::editTextCompositionStyle(string const &name_, string const &title_, int64 custom_emoji_id_, string const &prompt_, bool show_creator_)
  : name_(name_)
  , title_(title_)
  , custom_emoji_id_(custom_emoji_id_)
  , prompt_(prompt_)
  , show_creator_(show_creator_)
{}

const std::int32_t editTextCompositionStyle::ID;

object_ptr<editTextCompositionStyle> editTextCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editTextCompositionStyle> res = make_object<editTextCompositionStyle>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  res->prompt_ = jni::fetch_string(env, p, res->prompt_fieldID);
  res->show_creator_ = (env->GetBooleanField(p, res->show_creator_fieldID) != 0);
  return res;
}

void editTextCompositionStyle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditTextCompositionStyle");
    s.store_field("name", name_);
    s.store_field("title", title_);
    s.store_field("customEmojiId", custom_emoji_id_);
    s.store_field("prompt", prompt_);
    s.store_field("showCreator", show_creator_);
    s.store_class_end();
  }
}

editTextCompositionStyle::ReturnType editTextCompositionStyle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return textCompositionStyle::fetch(env, p);
}

void editTextCompositionStyle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditTextCompositionStyle").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    custom_emoji_id_fieldID = jni::get_field_id(env, Class, "customEmojiId", "J");
    prompt_fieldID = jni::get_field_id(env, Class, "prompt", "Ljava/lang/String;");
    show_creator_fieldID = jni::get_field_id(env, Class, "showCreator", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getAllStickerEmojis::Class;
jfieldID getAllStickerEmojis::sticker_type_fieldID;
jfieldID getAllStickerEmojis::query_fieldID;
jfieldID getAllStickerEmojis::chat_id_fieldID;
jfieldID getAllStickerEmojis::return_only_main_emoji_fieldID;

getAllStickerEmojis::getAllStickerEmojis()
  : sticker_type_()
  , query_()
  , chat_id_()
  , return_only_main_emoji_()
{}

getAllStickerEmojis::getAllStickerEmojis(object_ptr<StickerType> &&sticker_type_, string const &query_, int53 chat_id_, bool return_only_main_emoji_)
  : sticker_type_(std::move(sticker_type_))
  , query_(query_)
  , chat_id_(chat_id_)
  , return_only_main_emoji_(return_only_main_emoji_)
{}

const std::int32_t getAllStickerEmojis::ID;

object_ptr<getAllStickerEmojis> getAllStickerEmojis::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getAllStickerEmojis> res = make_object<getAllStickerEmojis>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->return_only_main_emoji_ = (env->GetBooleanField(p, res->return_only_main_emoji_fieldID) != 0);
  return res;
}

void getAllStickerEmojis::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetAllStickerEmojis");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("query", query_);
    s.store_field("chatId", chat_id_);
    s.store_field("returnOnlyMainEmoji", return_only_main_emoji_);
    s.store_class_end();
  }
}

getAllStickerEmojis::ReturnType getAllStickerEmojis::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojis::fetch(env, p);
}

void getAllStickerEmojis::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetAllStickerEmojis").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return_only_main_emoji_fieldID = jni::get_field_id(env, Class, "returnOnlyMainEmoji", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getAnimatedEmoji::Class;
jfieldID getAnimatedEmoji::emoji_fieldID;

getAnimatedEmoji::getAnimatedEmoji()
  : emoji_()
{}

getAnimatedEmoji::getAnimatedEmoji(string const &emoji_)
  : emoji_(emoji_)
{}

const std::int32_t getAnimatedEmoji::ID;

object_ptr<getAnimatedEmoji> getAnimatedEmoji::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getAnimatedEmoji> res = make_object<getAnimatedEmoji>();
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  return res;
}

void getAnimatedEmoji::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetAnimatedEmoji");
    s.store_field("emoji", emoji_);
    s.store_class_end();
  }
}

getAnimatedEmoji::ReturnType getAnimatedEmoji::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return animatedEmoji::fetch(env, p);
}

void getAnimatedEmoji::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetAnimatedEmoji").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getAvailableGifts::Class;

getAvailableGifts::getAvailableGifts() {
}

const std::int32_t getAvailableGifts::ID;

object_ptr<getAvailableGifts> getAvailableGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getAvailableGifts>();
}

void getAvailableGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetAvailableGifts");
    s.store_class_end();
  }
}

getAvailableGifts::ReturnType getAvailableGifts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return availableGifts::fetch(env, p);
}

void getAvailableGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetAvailableGifts").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getBotSimilarBotCount::Class;
jfieldID getBotSimilarBotCount::bot_user_id_fieldID;
jfieldID getBotSimilarBotCount::return_local_fieldID;

getBotSimilarBotCount::getBotSimilarBotCount()
  : bot_user_id_()
  , return_local_()
{}

getBotSimilarBotCount::getBotSimilarBotCount(int53 bot_user_id_, bool return_local_)
  : bot_user_id_(bot_user_id_)
  , return_local_(return_local_)
{}

const std::int32_t getBotSimilarBotCount::ID;

object_ptr<getBotSimilarBotCount> getBotSimilarBotCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotSimilarBotCount> res = make_object<getBotSimilarBotCount>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->return_local_ = (env->GetBooleanField(p, res->return_local_fieldID) != 0);
  return res;
}

void getBotSimilarBotCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBotSimilarBotCount");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("returnLocal", return_local_);
    s.store_class_end();
  }
}

getBotSimilarBotCount::ReturnType getBotSimilarBotCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return count::fetch(env, p);
}

void getBotSimilarBotCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetBotSimilarBotCount").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    return_local_fieldID = jni::get_field_id(env, Class, "returnLocal", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getBotSimilarBots::Class;
jfieldID getBotSimilarBots::bot_user_id_fieldID;

getBotSimilarBots::getBotSimilarBots()
  : bot_user_id_()
{}

getBotSimilarBots::getBotSimilarBots(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t getBotSimilarBots::ID;

object_ptr<getBotSimilarBots> getBotSimilarBots::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotSimilarBots> res = make_object<getBotSimilarBots>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return res;
}

void getBotSimilarBots::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBotSimilarBots");
    s.store_field("botUserId", bot_user_id_);
    s.store_class_end();
  }
}

getBotSimilarBots::ReturnType getBotSimilarBots::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return users::fetch(env, p);
}

void getBotSimilarBots::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetBotSimilarBots").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getChatBoostStatus::Class;
jfieldID getChatBoostStatus::chat_id_fieldID;

getChatBoostStatus::getChatBoostStatus()
  : chat_id_()
{}

getChatBoostStatus::getChatBoostStatus(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatBoostStatus::ID;

object_ptr<getChatBoostStatus> getChatBoostStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatBoostStatus> res = make_object<getChatBoostStatus>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void getChatBoostStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatBoostStatus");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

getChatBoostStatus::ReturnType getChatBoostStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostStatus::fetch(env, p);
}

void getChatBoostStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatBoostStatus").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getChatFolderChatsToLeave::Class;
jfieldID getChatFolderChatsToLeave::chat_folder_id_fieldID;

getChatFolderChatsToLeave::getChatFolderChatsToLeave()
  : chat_folder_id_()
{}

getChatFolderChatsToLeave::getChatFolderChatsToLeave(int32 chat_folder_id_)
  : chat_folder_id_(chat_folder_id_)
{}

const std::int32_t getChatFolderChatsToLeave::ID;

object_ptr<getChatFolderChatsToLeave> getChatFolderChatsToLeave::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatFolderChatsToLeave> res = make_object<getChatFolderChatsToLeave>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  return res;
}

void getChatFolderChatsToLeave::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatFolderChatsToLeave");
    s.store_field("chatFolderId", chat_folder_id_);
    s.store_class_end();
  }
}

getChatFolderChatsToLeave::ReturnType getChatFolderChatsToLeave::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getChatFolderChatsToLeave::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatFolderChatsToLeave").c_str());
    chat_folder_id_fieldID = jni::get_field_id(env, Class, "chatFolderId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getChatFolderNewChats::Class;
jfieldID getChatFolderNewChats::chat_folder_id_fieldID;

getChatFolderNewChats::getChatFolderNewChats()
  : chat_folder_id_()
{}

getChatFolderNewChats::getChatFolderNewChats(int32 chat_folder_id_)
  : chat_folder_id_(chat_folder_id_)
{}

const std::int32_t getChatFolderNewChats::ID;

object_ptr<getChatFolderNewChats> getChatFolderNewChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatFolderNewChats> res = make_object<getChatFolderNewChats>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  return res;
}

void getChatFolderNewChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatFolderNewChats");
    s.store_field("chatFolderId", chat_folder_id_);
    s.store_class_end();
  }
}

getChatFolderNewChats::ReturnType getChatFolderNewChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getChatFolderNewChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatFolderNewChats").c_str());
    chat_folder_id_fieldID = jni::get_field_id(env, Class, "chatFolderId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getChatMessageCalendar::Class;
jfieldID getChatMessageCalendar::chat_id_fieldID;
jfieldID getChatMessageCalendar::topic_id_fieldID;
jfieldID getChatMessageCalendar::filter_fieldID;
jfieldID getChatMessageCalendar::from_message_id_fieldID;

getChatMessageCalendar::getChatMessageCalendar()
  : chat_id_()
  , topic_id_()
  , filter_()
  , from_message_id_()
{}

getChatMessageCalendar::getChatMessageCalendar(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<SearchMessagesFilter> &&filter_, int53 from_message_id_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , filter_(std::move(filter_))
  , from_message_id_(from_message_id_)
{}

const std::int32_t getChatMessageCalendar::ID;

object_ptr<getChatMessageCalendar> getChatMessageCalendar::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatMessageCalendar> res = make_object<getChatMessageCalendar>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  return res;
}

void getChatMessageCalendar::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatMessageCalendar");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_field("fromMessageId", from_message_id_);
    s.store_class_end();
  }
}

getChatMessageCalendar::ReturnType getChatMessageCalendar::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageCalendar::fetch(env, p);
}

void getChatMessageCalendar::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatMessageCalendar").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesFilter;").c_str());
    from_message_id_fieldID = jni::get_field_id(env, Class, "fromMessageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getChatMessagePosition::Class;
jfieldID getChatMessagePosition::chat_id_fieldID;
jfieldID getChatMessagePosition::topic_id_fieldID;
jfieldID getChatMessagePosition::filter_fieldID;
jfieldID getChatMessagePosition::message_id_fieldID;

getChatMessagePosition::getChatMessagePosition()
  : chat_id_()
  , topic_id_()
  , filter_()
  , message_id_()
{}

getChatMessagePosition::getChatMessagePosition(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<SearchMessagesFilter> &&filter_, int53 message_id_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , filter_(std::move(filter_))
  , message_id_(message_id_)
{}

const std::int32_t getChatMessagePosition::ID;

object_ptr<getChatMessagePosition> getChatMessagePosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatMessagePosition> res = make_object<getChatMessagePosition>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return res;
}

void getChatMessagePosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatMessagePosition");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

getChatMessagePosition::ReturnType getChatMessagePosition::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return count::fetch(env, p);
}

void getChatMessagePosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatMessagePosition").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesFilter;").c_str());
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getChatNotificationSettingsExceptions::Class;
jfieldID getChatNotificationSettingsExceptions::scope_fieldID;
jfieldID getChatNotificationSettingsExceptions::compare_sound_fieldID;

getChatNotificationSettingsExceptions::getChatNotificationSettingsExceptions()
  : scope_()
  , compare_sound_()
{}

getChatNotificationSettingsExceptions::getChatNotificationSettingsExceptions(object_ptr<NotificationSettingsScope> &&scope_, bool compare_sound_)
  : scope_(std::move(scope_))
  , compare_sound_(compare_sound_)
{}

const std::int32_t getChatNotificationSettingsExceptions::ID;

object_ptr<getChatNotificationSettingsExceptions> getChatNotificationSettingsExceptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatNotificationSettingsExceptions> res = make_object<getChatNotificationSettingsExceptions>();
  res->scope_ = jni::fetch_tl_object<NotificationSettingsScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->compare_sound_ = (env->GetBooleanField(p, res->compare_sound_fieldID) != 0);
  return res;
}

void getChatNotificationSettingsExceptions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatNotificationSettingsExceptions");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_field("compareSound", compare_sound_);
    s.store_class_end();
  }
}

getChatNotificationSettingsExceptions::ReturnType getChatNotificationSettingsExceptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getChatNotificationSettingsExceptions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatNotificationSettingsExceptions").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NotificationSettingsScope;").c_str());
    compare_sound_fieldID = jni::get_field_id(env, Class, "compareSound", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getChatStoryAlbums::Class;
jfieldID getChatStoryAlbums::chat_id_fieldID;

getChatStoryAlbums::getChatStoryAlbums()
  : chat_id_()
{}

getChatStoryAlbums::getChatStoryAlbums(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatStoryAlbums::ID;

object_ptr<getChatStoryAlbums> getChatStoryAlbums::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatStoryAlbums> res = make_object<getChatStoryAlbums>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void getChatStoryAlbums::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatStoryAlbums");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

getChatStoryAlbums::ReturnType getChatStoryAlbums::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyAlbums::fetch(env, p);
}

void getChatStoryAlbums::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatStoryAlbums").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getChatStoryInteractions::Class;
jfieldID getChatStoryInteractions::story_poster_chat_id_fieldID;
jfieldID getChatStoryInteractions::story_id_fieldID;
jfieldID getChatStoryInteractions::reaction_type_fieldID;
jfieldID getChatStoryInteractions::prefer_forwards_fieldID;
jfieldID getChatStoryInteractions::offset_fieldID;
jfieldID getChatStoryInteractions::limit_fieldID;

getChatStoryInteractions::getChatStoryInteractions()
  : story_poster_chat_id_()
  , story_id_()
  , reaction_type_()
  , prefer_forwards_()
  , offset_()
  , limit_()
{}

getChatStoryInteractions::getChatStoryInteractions(int53 story_poster_chat_id_, int32 story_id_, object_ptr<ReactionType> &&reaction_type_, bool prefer_forwards_, string const &offset_, int32 limit_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , reaction_type_(std::move(reaction_type_))
  , prefer_forwards_(prefer_forwards_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getChatStoryInteractions::ID;

object_ptr<getChatStoryInteractions> getChatStoryInteractions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatStoryInteractions> res = make_object<getChatStoryInteractions>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->reaction_type_fieldID));
  res->prefer_forwards_ = (env->GetBooleanField(p, res->prefer_forwards_fieldID) != 0);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatStoryInteractions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatStoryInteractions");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_object_field("reactionType", static_cast<const BaseObject *>(reaction_type_.get()));
    s.store_field("preferForwards", prefer_forwards_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatStoryInteractions::ReturnType getChatStoryInteractions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyInteractions::fetch(env, p);
}

void getChatStoryInteractions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatStoryInteractions").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    reaction_type_fieldID = jni::get_field_id(env, Class, "reactionType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    prefer_forwards_fieldID = jni::get_field_id(env, Class, "preferForwards", "Z");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getDefaultChatEmojiStatuses::Class;

getDefaultChatEmojiStatuses::getDefaultChatEmojiStatuses() {
}

const std::int32_t getDefaultChatEmojiStatuses::ID;

object_ptr<getDefaultChatEmojiStatuses> getDefaultChatEmojiStatuses::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getDefaultChatEmojiStatuses>();
}

void getDefaultChatEmojiStatuses::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetDefaultChatEmojiStatuses");
    s.store_class_end();
  }
}

getDefaultChatEmojiStatuses::ReturnType getDefaultChatEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatusCustomEmojis::fetch(env, p);
}

void getDefaultChatEmojiStatuses::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetDefaultChatEmojiStatuses").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getFavoriteStickers::Class;

getFavoriteStickers::getFavoriteStickers() {
}

const std::int32_t getFavoriteStickers::ID;

object_ptr<getFavoriteStickers> getFavoriteStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getFavoriteStickers>();
}

void getFavoriteStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetFavoriteStickers");
    s.store_class_end();
  }
}

getFavoriteStickers::ReturnType getFavoriteStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

void getFavoriteStickers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetFavoriteStickers").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getFileDownloadedPrefixSize::Class;
jfieldID getFileDownloadedPrefixSize::file_id_fieldID;
jfieldID getFileDownloadedPrefixSize::offset_fieldID;

getFileDownloadedPrefixSize::getFileDownloadedPrefixSize()
  : file_id_()
  , offset_()
{}

getFileDownloadedPrefixSize::getFileDownloadedPrefixSize(int32 file_id_, int53 offset_)
  : file_id_(file_id_)
  , offset_(offset_)
{}

const std::int32_t getFileDownloadedPrefixSize::ID;

object_ptr<getFileDownloadedPrefixSize> getFileDownloadedPrefixSize::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getFileDownloadedPrefixSize> res = make_object<getFileDownloadedPrefixSize>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->offset_ = env->GetLongField(p, res->offset_fieldID);
  return res;
}

void getFileDownloadedPrefixSize::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetFileDownloadedPrefixSize");
    s.store_field("fileId", file_id_);
    s.store_field("offset", offset_);
    s.store_class_end();
  }
}

getFileDownloadedPrefixSize::ReturnType getFileDownloadedPrefixSize::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return fileDownloadedPrefixSize::fetch(env, p);
}

void getFileDownloadedPrefixSize::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetFileDownloadedPrefixSize").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getInactiveSupergroupChats::Class;

getInactiveSupergroupChats::getInactiveSupergroupChats() {
}

const std::int32_t getInactiveSupergroupChats::ID;

object_ptr<getInactiveSupergroupChats> getInactiveSupergroupChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getInactiveSupergroupChats>();
}

void getInactiveSupergroupChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetInactiveSupergroupChats");
    s.store_class_end();
  }
}

getInactiveSupergroupChats::ReturnType getInactiveSupergroupChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getInactiveSupergroupChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetInactiveSupergroupChats").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getInlineGameHighScores::Class;
jfieldID getInlineGameHighScores::inline_message_id_fieldID;
jfieldID getInlineGameHighScores::user_id_fieldID;

getInlineGameHighScores::getInlineGameHighScores()
  : inline_message_id_()
  , user_id_()
{}

getInlineGameHighScores::getInlineGameHighScores(string const &inline_message_id_, int53 user_id_)
  : inline_message_id_(inline_message_id_)
  , user_id_(user_id_)
{}

const std::int32_t getInlineGameHighScores::ID;

object_ptr<getInlineGameHighScores> getInlineGameHighScores::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getInlineGameHighScores> res = make_object<getInlineGameHighScores>();
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  return res;
}

void getInlineGameHighScores::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetInlineGameHighScores");
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_field("userId", user_id_);
    s.store_class_end();
  }
}

getInlineGameHighScores::ReturnType getInlineGameHighScores::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return gameHighScores::fetch(env, p);
}

void getInlineGameHighScores::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetInlineGameHighScores").c_str());
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getInstalledStickerSets::Class;
jfieldID getInstalledStickerSets::sticker_type_fieldID;

getInstalledStickerSets::getInstalledStickerSets()
  : sticker_type_()
{}

getInstalledStickerSets::getInstalledStickerSets(object_ptr<StickerType> &&sticker_type_)
  : sticker_type_(std::move(sticker_type_))
{}

const std::int32_t getInstalledStickerSets::ID;

object_ptr<getInstalledStickerSets> getInstalledStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getInstalledStickerSets> res = make_object<getInstalledStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  return res;
}

void getInstalledStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetInstalledStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_class_end();
  }
}

getInstalledStickerSets::ReturnType getInstalledStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSets::fetch(env, p);
}

void getInstalledStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetInstalledStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getLoginPasskeys::Class;

getLoginPasskeys::getLoginPasskeys() {
}

const std::int32_t getLoginPasskeys::ID;

object_ptr<getLoginPasskeys> getLoginPasskeys::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getLoginPasskeys>();
}

void getLoginPasskeys::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLoginPasskeys");
    s.store_class_end();
  }
}

getLoginPasskeys::ReturnType getLoginPasskeys::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passkeys::fetch(env, p);
}

void getLoginPasskeys::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetLoginPasskeys").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getMessage::Class;
jfieldID getMessage::chat_id_fieldID;
jfieldID getMessage::message_id_fieldID;

getMessage::getMessage()
  : chat_id_()
  , message_id_()
{}

getMessage::getMessage(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t getMessage::ID;

object_ptr<getMessage> getMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessage> res = make_object<getMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return res;
}

void getMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

getMessage::ReturnType getMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void getMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getMessageAuthor::Class;
jfieldID getMessageAuthor::chat_id_fieldID;
jfieldID getMessageAuthor::message_id_fieldID;

getMessageAuthor::getMessageAuthor()
  : chat_id_()
  , message_id_()
{}

getMessageAuthor::getMessageAuthor(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t getMessageAuthor::ID;

object_ptr<getMessageAuthor> getMessageAuthor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageAuthor> res = make_object<getMessageAuthor>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return res;
}

void getMessageAuthor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageAuthor");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

getMessageAuthor::ReturnType getMessageAuthor::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return user::fetch(env, p);
}

void getMessageAuthor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessageAuthor").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getMessageImportConfirmationText::Class;
jfieldID getMessageImportConfirmationText::chat_id_fieldID;

getMessageImportConfirmationText::getMessageImportConfirmationText()
  : chat_id_()
{}

getMessageImportConfirmationText::getMessageImportConfirmationText(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getMessageImportConfirmationText::ID;

object_ptr<getMessageImportConfirmationText> getMessageImportConfirmationText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageImportConfirmationText> res = make_object<getMessageImportConfirmationText>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void getMessageImportConfirmationText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageImportConfirmationText");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

getMessageImportConfirmationText::ReturnType getMessageImportConfirmationText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void getMessageImportConfirmationText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessageImportConfirmationText").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getOwnedStickerSets::Class;
jfieldID getOwnedStickerSets::offset_sticker_set_id_fieldID;
jfieldID getOwnedStickerSets::limit_fieldID;

getOwnedStickerSets::getOwnedStickerSets()
  : offset_sticker_set_id_()
  , limit_()
{}

getOwnedStickerSets::getOwnedStickerSets(int64 offset_sticker_set_id_, int32 limit_)
  : offset_sticker_set_id_(offset_sticker_set_id_)
  , limit_(limit_)
{}

const std::int32_t getOwnedStickerSets::ID;

object_ptr<getOwnedStickerSets> getOwnedStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getOwnedStickerSets> res = make_object<getOwnedStickerSets>();
  res->offset_sticker_set_id_ = env->GetLongField(p, res->offset_sticker_set_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getOwnedStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetOwnedStickerSets");
    s.store_field("offsetStickerSetId", offset_sticker_set_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getOwnedStickerSets::ReturnType getOwnedStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSets::fetch(env, p);
}

void getOwnedStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetOwnedStickerSets").c_str());
    offset_sticker_set_id_fieldID = jni::get_field_id(env, Class, "offsetStickerSetId", "J");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getPassportElement::Class;
jfieldID getPassportElement::type_fieldID;
jfieldID getPassportElement::password_fieldID;

getPassportElement::getPassportElement()
  : type_()
  , password_()
{}

getPassportElement::getPassportElement(object_ptr<PassportElementType> &&type_, string const &password_)
  : type_(std::move(type_))
  , password_(password_)
{}

const std::int32_t getPassportElement::ID;

object_ptr<getPassportElement> getPassportElement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPassportElement> res = make_object<getPassportElement>();
  res->type_ = jni::fetch_tl_object<PassportElementType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void getPassportElement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPassportElement");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("password", password_);
    s.store_class_end();
  }
}

getPassportElement::ReturnType getPassportElement::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return PassportElement::fetch(env, p);
}

void getPassportElement::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetPassportElement").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PassportElementType;").c_str());
    password_fieldID = jni::get_field_id(env, Class, "password", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getPremiumInfoSticker::Class;
jfieldID getPremiumInfoSticker::month_count_fieldID;

getPremiumInfoSticker::getPremiumInfoSticker()
  : month_count_()
{}

getPremiumInfoSticker::getPremiumInfoSticker(int32 month_count_)
  : month_count_(month_count_)
{}

const std::int32_t getPremiumInfoSticker::ID;

object_ptr<getPremiumInfoSticker> getPremiumInfoSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPremiumInfoSticker> res = make_object<getPremiumInfoSticker>();
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  return res;
}

void getPremiumInfoSticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPremiumInfoSticker");
    s.store_field("monthCount", month_count_);
    s.store_class_end();
  }
}

getPremiumInfoSticker::ReturnType getPremiumInfoSticker::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return sticker::fetch(env, p);
}

void getPremiumInfoSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetPremiumInfoSticker").c_str());
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getPremiumStickers::Class;
jfieldID getPremiumStickers::limit_fieldID;

getPremiumStickers::getPremiumStickers()
  : limit_()
{}

getPremiumStickers::getPremiumStickers(int32 limit_)
  : limit_(limit_)
{}

const std::int32_t getPremiumStickers::ID;

object_ptr<getPremiumStickers> getPremiumStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPremiumStickers> res = make_object<getPremiumStickers>();
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getPremiumStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPremiumStickers");
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getPremiumStickers::ReturnType getPremiumStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

void getPremiumStickers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetPremiumStickers").c_str());
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getStakeDiceState::Class;

getStakeDiceState::getStakeDiceState() {
}

const std::int32_t getStakeDiceState::ID;

object_ptr<getStakeDiceState> getStakeDiceState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getStakeDiceState>();
}

void getStakeDiceState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStakeDiceState");
    s.store_class_end();
  }
}

getStakeDiceState::ReturnType getStakeDiceState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stakeDiceState::fetch(env, p);
}

void getStakeDiceState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStakeDiceState").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getStarAdAccountUrl::Class;
jfieldID getStarAdAccountUrl::owner_id_fieldID;

getStarAdAccountUrl::getStarAdAccountUrl()
  : owner_id_()
{}

getStarAdAccountUrl::getStarAdAccountUrl(object_ptr<MessageSender> &&owner_id_)
  : owner_id_(std::move(owner_id_))
{}

const std::int32_t getStarAdAccountUrl::ID;

object_ptr<getStarAdAccountUrl> getStarAdAccountUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStarAdAccountUrl> res = make_object<getStarAdAccountUrl>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  return res;
}

void getStarAdAccountUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStarAdAccountUrl");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_class_end();
  }
}

getStarAdAccountUrl::ReturnType getStarAdAccountUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void getStarAdAccountUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStarAdAccountUrl").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getStickerSetName::Class;
jfieldID getStickerSetName::set_id_fieldID;

getStickerSetName::getStickerSetName()
  : set_id_()
{}

getStickerSetName::getStickerSetName(int64 set_id_)
  : set_id_(set_id_)
{}

const std::int32_t getStickerSetName::ID;

object_ptr<getStickerSetName> getStickerSetName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStickerSetName> res = make_object<getStickerSetName>();
  res->set_id_ = env->GetLongField(p, res->set_id_fieldID);
  return res;
}

void getStickerSetName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStickerSetName");
    s.store_field("setId", set_id_);
    s.store_class_end();
  }
}

getStickerSetName::ReturnType getStickerSetName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void getStickerSetName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStickerSetName").c_str());
    set_id_fieldID = jni::get_field_id(env, Class, "setId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getStoryAlbumStories::Class;
jfieldID getStoryAlbumStories::chat_id_fieldID;
jfieldID getStoryAlbumStories::story_album_id_fieldID;
jfieldID getStoryAlbumStories::offset_fieldID;
jfieldID getStoryAlbumStories::limit_fieldID;

getStoryAlbumStories::getStoryAlbumStories()
  : chat_id_()
  , story_album_id_()
  , offset_()
  , limit_()
{}

getStoryAlbumStories::getStoryAlbumStories(int53 chat_id_, int32 story_album_id_, int32 offset_, int32 limit_)
  : chat_id_(chat_id_)
  , story_album_id_(story_album_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getStoryAlbumStories::ID;

object_ptr<getStoryAlbumStories> getStoryAlbumStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStoryAlbumStories> res = make_object<getStoryAlbumStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_album_id_ = env->GetIntField(p, res->story_album_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getStoryAlbumStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStoryAlbumStories");
    s.store_field("chatId", chat_id_);
    s.store_field("storyAlbumId", story_album_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getStoryAlbumStories::ReturnType getStoryAlbumStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stories::fetch(env, p);
}

void getStoryAlbumStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStoryAlbumStories").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    story_album_id_fieldID = jni::get_field_id(env, Class, "storyAlbumId", "I");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getSuitablePersonalChats::Class;

getSuitablePersonalChats::getSuitablePersonalChats() {
}

const std::int32_t getSuitablePersonalChats::ID;

object_ptr<getSuitablePersonalChats> getSuitablePersonalChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  return make_object<getSuitablePersonalChats>();
}

void getSuitablePersonalChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSuitablePersonalChats");
    s.store_class_end();
  }
}

getSuitablePersonalChats::ReturnType getSuitablePersonalChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getSuitablePersonalChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetSuitablePersonalChats").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getTrendingStickerSets::Class;
jfieldID getTrendingStickerSets::sticker_type_fieldID;
jfieldID getTrendingStickerSets::offset_fieldID;
jfieldID getTrendingStickerSets::limit_fieldID;

getTrendingStickerSets::getTrendingStickerSets()
  : sticker_type_()
  , offset_()
  , limit_()
{}

getTrendingStickerSets::getTrendingStickerSets(object_ptr<StickerType> &&sticker_type_, int32 offset_, int32 limit_)
  : sticker_type_(std::move(sticker_type_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getTrendingStickerSets::ID;

object_ptr<getTrendingStickerSets> getTrendingStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getTrendingStickerSets> res = make_object<getTrendingStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getTrendingStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetTrendingStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getTrendingStickerSets::ReturnType getTrendingStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return trendingStickerSets::fetch(env, p);
}

void getTrendingStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetTrendingStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    offset_fieldID = jni::get_field_id(env, Class, "offset", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getUserPrivacySettingRules::Class;
jfieldID getUserPrivacySettingRules::setting_fieldID;

getUserPrivacySettingRules::getUserPrivacySettingRules()
  : setting_()
{}

getUserPrivacySettingRules::getUserPrivacySettingRules(object_ptr<UserPrivacySetting> &&setting_)
  : setting_(std::move(setting_))
{}

const std::int32_t getUserPrivacySettingRules::ID;

object_ptr<getUserPrivacySettingRules> getUserPrivacySettingRules::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getUserPrivacySettingRules> res = make_object<getUserPrivacySettingRules>();
  res->setting_ = jni::fetch_tl_object<UserPrivacySetting>(env, jni::fetch_object(env, p, res->setting_fieldID));
  return res;
}

void getUserPrivacySettingRules::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetUserPrivacySettingRules");
    s.store_object_field("setting", static_cast<const BaseObject *>(setting_.get()));
    s.store_class_end();
  }
}

getUserPrivacySettingRules::ReturnType getUserPrivacySettingRules::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return userPrivacySettingRules::fetch(env, p);
}

void getUserPrivacySettingRules::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetUserPrivacySettingRules").c_str());
    setting_fieldID = jni::get_field_id(env, Class, "setting", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserPrivacySetting;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass isProfileAudio::Class;
jfieldID isProfileAudio::file_id_fieldID;

isProfileAudio::isProfileAudio()
  : file_id_()
{}

isProfileAudio::isProfileAudio(int32 file_id_)
  : file_id_(file_id_)
{}

const std::int32_t isProfileAudio::ID;

object_ptr<isProfileAudio> isProfileAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<isProfileAudio> res = make_object<isProfileAudio>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  return res;
}

void isProfileAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "IsProfileAudio");
    s.store_field("fileId", file_id_);
    s.store_class_end();
  }
}

isProfileAudio::ReturnType isProfileAudio::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void isProfileAudio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$IsProfileAudio").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass joinChatByInviteLink::Class;
jfieldID joinChatByInviteLink::invite_link_fieldID;

joinChatByInviteLink::joinChatByInviteLink()
  : invite_link_()
{}

joinChatByInviteLink::joinChatByInviteLink(string const &invite_link_)
  : invite_link_(invite_link_)
{}

const std::int32_t joinChatByInviteLink::ID;

object_ptr<joinChatByInviteLink> joinChatByInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<joinChatByInviteLink> res = make_object<joinChatByInviteLink>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return res;
}

void joinChatByInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "JoinChatByInviteLink");
    s.store_field("inviteLink", invite_link_);
    s.store_class_end();
  }
}

joinChatByInviteLink::ReturnType joinChatByInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

void joinChatByInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$JoinChatByInviteLink").c_str());
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass leaveGroupCall::Class;
jfieldID leaveGroupCall::group_call_id_fieldID;

leaveGroupCall::leaveGroupCall()
  : group_call_id_()
{}

leaveGroupCall::leaveGroupCall(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t leaveGroupCall::ID;

object_ptr<leaveGroupCall> leaveGroupCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<leaveGroupCall> res = make_object<leaveGroupCall>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  return res;
}

void leaveGroupCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LeaveGroupCall");
    s.store_field("groupCallId", group_call_id_);
    s.store_class_end();
  }
}

leaveGroupCall::ReturnType leaveGroupCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void leaveGroupCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LeaveGroupCall").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass markChecklistTasksAsDone::Class;
jfieldID markChecklistTasksAsDone::chat_id_fieldID;
jfieldID markChecklistTasksAsDone::message_id_fieldID;
jfieldID markChecklistTasksAsDone::marked_as_done_task_ids_fieldID;
jfieldID markChecklistTasksAsDone::marked_as_not_done_task_ids_fieldID;

markChecklistTasksAsDone::markChecklistTasksAsDone()
  : chat_id_()
  , message_id_()
  , marked_as_done_task_ids_()
  , marked_as_not_done_task_ids_()
{}

markChecklistTasksAsDone::markChecklistTasksAsDone(int53 chat_id_, int53 message_id_, array<int32> &&marked_as_done_task_ids_, array<int32> &&marked_as_not_done_task_ids_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , marked_as_done_task_ids_(std::move(marked_as_done_task_ids_))
  , marked_as_not_done_task_ids_(std::move(marked_as_not_done_task_ids_))
{}

const std::int32_t markChecklistTasksAsDone::ID;

object_ptr<markChecklistTasksAsDone> markChecklistTasksAsDone::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<markChecklistTasksAsDone> res = make_object<markChecklistTasksAsDone>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->marked_as_done_task_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->marked_as_done_task_ids_fieldID));
  res->marked_as_not_done_task_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->marked_as_not_done_task_ids_fieldID));
  return res;
}

void markChecklistTasksAsDone::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MarkChecklistTasksAsDone");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    { s.store_vector_begin("markedAsDoneTaskIds", marked_as_done_task_ids_.size()); for (const auto &_value : marked_as_done_task_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("markedAsNotDoneTaskIds", marked_as_not_done_task_ids_.size()); for (const auto &_value : marked_as_not_done_task_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

markChecklistTasksAsDone::ReturnType markChecklistTasksAsDone::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void markChecklistTasksAsDone::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MarkChecklistTasksAsDone").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    marked_as_done_task_ids_fieldID = jni::get_field_id(env, Class, "markedAsDoneTaskIds", "[I");
    marked_as_not_done_task_ids_fieldID = jni::get_field_id(env, Class, "markedAsNotDoneTaskIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass openWebApp::Class;
jfieldID openWebApp::chat_id_fieldID;
jfieldID openWebApp::bot_user_id_fieldID;
jfieldID openWebApp::url_fieldID;
jfieldID openWebApp::topic_id_fieldID;
jfieldID openWebApp::reply_to_fieldID;
jfieldID openWebApp::parameters_fieldID;

openWebApp::openWebApp()
  : chat_id_()
  , bot_user_id_()
  , url_()
  , topic_id_()
  , reply_to_()
  , parameters_()
{}

openWebApp::openWebApp(int53 chat_id_, int53 bot_user_id_, string const &url_, object_ptr<MessageTopic> &&topic_id_, object_ptr<InputMessageReplyTo> &&reply_to_, object_ptr<webAppOpenParameters> &&parameters_)
  : chat_id_(chat_id_)
  , bot_user_id_(bot_user_id_)
  , url_(url_)
  , topic_id_(std::move(topic_id_))
  , reply_to_(std::move(reply_to_))
  , parameters_(std::move(parameters_))
{}

const std::int32_t openWebApp::ID;

object_ptr<openWebApp> openWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<openWebApp> res = make_object<openWebApp>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->parameters_ = jni::fetch_tl_object<webAppOpenParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  return res;
}

void openWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OpenWebApp");
    s.store_field("chatId", chat_id_);
    s.store_field("botUserId", bot_user_id_);
    s.store_field("url", url_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_class_end();
  }
}

openWebApp::ReturnType openWebApp::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return webAppInfo::fetch(env, p);
}

void openWebApp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$OpenWebApp").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$WebAppOpenParameters;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass processPushNotification::Class;
jfieldID processPushNotification::payload_fieldID;

processPushNotification::processPushNotification()
  : payload_()
{}

processPushNotification::processPushNotification(string const &payload_)
  : payload_(payload_)
{}

const std::int32_t processPushNotification::ID;

object_ptr<processPushNotification> processPushNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<processPushNotification> res = make_object<processPushNotification>();
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  return res;
}

void processPushNotification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProcessPushNotification");
    s.store_field("payload", payload_);
    s.store_class_end();
  }
}

processPushNotification::ReturnType processPushNotification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void processPushNotification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ProcessPushNotification").c_str());
    payload_fieldID = jni::get_field_id(env, Class, "payload", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass readAllChatPollVotes::Class;
jfieldID readAllChatPollVotes::chat_id_fieldID;

readAllChatPollVotes::readAllChatPollVotes()
  : chat_id_()
{}

readAllChatPollVotes::readAllChatPollVotes(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t readAllChatPollVotes::ID;

object_ptr<readAllChatPollVotes> readAllChatPollVotes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<readAllChatPollVotes> res = make_object<readAllChatPollVotes>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void readAllChatPollVotes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReadAllChatPollVotes");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

readAllChatPollVotes::ReturnType readAllChatPollVotes::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void readAllChatPollVotes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReadAllChatPollVotes").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass readAllForumTopicReactions::Class;
jfieldID readAllForumTopicReactions::chat_id_fieldID;
jfieldID readAllForumTopicReactions::forum_topic_id_fieldID;

readAllForumTopicReactions::readAllForumTopicReactions()
  : chat_id_()
  , forum_topic_id_()
{}

readAllForumTopicReactions::readAllForumTopicReactions(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t readAllForumTopicReactions::ID;

object_ptr<readAllForumTopicReactions> readAllForumTopicReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<readAllForumTopicReactions> res = make_object<readAllForumTopicReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  return res;
}

void readAllForumTopicReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReadAllForumTopicReactions");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_class_end();
  }
}

readAllForumTopicReactions::ReturnType readAllForumTopicReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void readAllForumTopicReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReadAllForumTopicReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    forum_topic_id_fieldID = jni::get_field_id(env, Class, "forumTopicId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass removeGiftCollectionGifts::Class;
jfieldID removeGiftCollectionGifts::owner_id_fieldID;
jfieldID removeGiftCollectionGifts::collection_id_fieldID;
jfieldID removeGiftCollectionGifts::received_gift_ids_fieldID;

removeGiftCollectionGifts::removeGiftCollectionGifts()
  : owner_id_()
  , collection_id_()
  , received_gift_ids_()
{}

removeGiftCollectionGifts::removeGiftCollectionGifts(object_ptr<MessageSender> &&owner_id_, int32 collection_id_, array<string> &&received_gift_ids_)
  : owner_id_(std::move(owner_id_))
  , collection_id_(collection_id_)
  , received_gift_ids_(std::move(received_gift_ids_))
{}

const std::int32_t removeGiftCollectionGifts::ID;

object_ptr<removeGiftCollectionGifts> removeGiftCollectionGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeGiftCollectionGifts> res = make_object<removeGiftCollectionGifts>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->collection_id_ = env->GetIntField(p, res->collection_id_fieldID);
  res->received_gift_ids_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->received_gift_ids_fieldID));
  return res;
}

void removeGiftCollectionGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveGiftCollectionGifts");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("collectionId", collection_id_);
    { s.store_vector_begin("receivedGiftIds", received_gift_ids_.size()); for (const auto &_value : received_gift_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

removeGiftCollectionGifts::ReturnType removeGiftCollectionGifts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftCollection::fetch(env, p);
}

void removeGiftCollectionGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveGiftCollectionGifts").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    collection_id_fieldID = jni::get_field_id(env, Class, "collectionId", "I");
    received_gift_ids_fieldID = jni::get_field_id(env, Class, "receivedGiftIds", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass removeRecentSticker::Class;
jfieldID removeRecentSticker::is_attached_fieldID;
jfieldID removeRecentSticker::sticker_fieldID;

removeRecentSticker::removeRecentSticker()
  : is_attached_()
  , sticker_()
{}

removeRecentSticker::removeRecentSticker(bool is_attached_, object_ptr<InputFile> &&sticker_)
  : is_attached_(is_attached_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t removeRecentSticker::ID;

object_ptr<removeRecentSticker> removeRecentSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeRecentSticker> res = make_object<removeRecentSticker>();
  res->is_attached_ = (env->GetBooleanField(p, res->is_attached_fieldID) != 0);
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void removeRecentSticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveRecentSticker");
    s.store_field("isAttached", is_attached_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

removeRecentSticker::ReturnType removeRecentSticker::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeRecentSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveRecentSticker").c_str());
    is_attached_fieldID = jni::get_field_id(env, Class, "isAttached", "Z");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass removeStickerFromSet::Class;
jfieldID removeStickerFromSet::sticker_fieldID;

removeStickerFromSet::removeStickerFromSet()
  : sticker_()
{}

removeStickerFromSet::removeStickerFromSet(object_ptr<InputFile> &&sticker_)
  : sticker_(std::move(sticker_))
{}

const std::int32_t removeStickerFromSet::ID;

object_ptr<removeStickerFromSet> removeStickerFromSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeStickerFromSet> res = make_object<removeStickerFromSet>();
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void removeStickerFromSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveStickerFromSet");
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

removeStickerFromSet::ReturnType removeStickerFromSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeStickerFromSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveStickerFromSet").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reorderGiftCollectionGifts::Class;
jfieldID reorderGiftCollectionGifts::owner_id_fieldID;
jfieldID reorderGiftCollectionGifts::collection_id_fieldID;
jfieldID reorderGiftCollectionGifts::received_gift_ids_fieldID;

reorderGiftCollectionGifts::reorderGiftCollectionGifts()
  : owner_id_()
  , collection_id_()
  , received_gift_ids_()
{}

reorderGiftCollectionGifts::reorderGiftCollectionGifts(object_ptr<MessageSender> &&owner_id_, int32 collection_id_, array<string> &&received_gift_ids_)
  : owner_id_(std::move(owner_id_))
  , collection_id_(collection_id_)
  , received_gift_ids_(std::move(received_gift_ids_))
{}

const std::int32_t reorderGiftCollectionGifts::ID;

object_ptr<reorderGiftCollectionGifts> reorderGiftCollectionGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderGiftCollectionGifts> res = make_object<reorderGiftCollectionGifts>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->collection_id_ = env->GetIntField(p, res->collection_id_fieldID);
  res->received_gift_ids_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->received_gift_ids_fieldID));
  return res;
}

void reorderGiftCollectionGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderGiftCollectionGifts");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("collectionId", collection_id_);
    { s.store_vector_begin("receivedGiftIds", received_gift_ids_.size()); for (const auto &_value : received_gift_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

reorderGiftCollectionGifts::ReturnType reorderGiftCollectionGifts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftCollection::fetch(env, p);
}

void reorderGiftCollectionGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReorderGiftCollectionGifts").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    collection_id_fieldID = jni::get_field_id(env, Class, "collectionId", "I");
    received_gift_ids_fieldID = jni::get_field_id(env, Class, "receivedGiftIds", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass replacePrimaryChatInviteLink::Class;
jfieldID replacePrimaryChatInviteLink::chat_id_fieldID;

replacePrimaryChatInviteLink::replacePrimaryChatInviteLink()
  : chat_id_()
{}

replacePrimaryChatInviteLink::replacePrimaryChatInviteLink(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t replacePrimaryChatInviteLink::ID;

object_ptr<replacePrimaryChatInviteLink> replacePrimaryChatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<replacePrimaryChatInviteLink> res = make_object<replacePrimaryChatInviteLink>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void replacePrimaryChatInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReplacePrimaryChatInviteLink");
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

replacePrimaryChatInviteLink::ReturnType replacePrimaryChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLink::fetch(env, p);
}

void replacePrimaryChatInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReplacePrimaryChatInviteLink").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass reportChatPhoto::Class;
jfieldID reportChatPhoto::chat_id_fieldID;
jfieldID reportChatPhoto::file_id_fieldID;
jfieldID reportChatPhoto::reason_fieldID;
jfieldID reportChatPhoto::text_fieldID;

reportChatPhoto::reportChatPhoto()
  : chat_id_()
  , file_id_()
  , reason_()
  , text_()
{}

reportChatPhoto::reportChatPhoto(int53 chat_id_, int32 file_id_, object_ptr<ReportReason> &&reason_, string const &text_)
  : chat_id_(chat_id_)
  , file_id_(file_id_)
  , reason_(std::move(reason_))
  , text_(text_)
{}

const std::int32_t reportChatPhoto::ID;

object_ptr<reportChatPhoto> reportChatPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportChatPhoto> res = make_object<reportChatPhoto>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->reason_ = jni::fetch_tl_object<ReportReason>(env, jni::fetch_object(env, p, res->reason_fieldID));
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  return res;
}

void reportChatPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportChatPhoto");
    s.store_field("chatId", chat_id_);
    s.store_field("fileId", file_id_);
    s.store_object_field("reason", static_cast<const BaseObject *>(reason_.get()));
    s.store_field("text", text_);
    s.store_class_end();
  }
}

reportChatPhoto::ReturnType reportChatPhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reportChatPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportChatPhoto").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    reason_fieldID = jni::get_field_id(env, Class, "reason", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReportReason;").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass reportMessageReactions::Class;
jfieldID reportMessageReactions::chat_id_fieldID;
jfieldID reportMessageReactions::message_id_fieldID;
jfieldID reportMessageReactions::sender_id_fieldID;

reportMessageReactions::reportMessageReactions()
  : chat_id_()
  , message_id_()
  , sender_id_()
{}

reportMessageReactions::reportMessageReactions(int53 chat_id_, int53 message_id_, object_ptr<MessageSender> &&sender_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , sender_id_(std::move(sender_id_))
{}

const std::int32_t reportMessageReactions::ID;

object_ptr<reportMessageReactions> reportMessageReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportMessageReactions> res = make_object<reportMessageReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  return res;
}

void reportMessageReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportMessageReactions");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_class_end();
  }
}

reportMessageReactions::ReturnType reportMessageReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reportMessageReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportMessageReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass savePreparedKeyboardButton::Class;
jfieldID savePreparedKeyboardButton::user_id_fieldID;
jfieldID savePreparedKeyboardButton::button_fieldID;

savePreparedKeyboardButton::savePreparedKeyboardButton()
  : user_id_()
  , button_()
{}

savePreparedKeyboardButton::savePreparedKeyboardButton(int53 user_id_, object_ptr<keyboardButton> &&button_)
  : user_id_(user_id_)
  , button_(std::move(button_))
{}

const std::int32_t savePreparedKeyboardButton::ID;

object_ptr<savePreparedKeyboardButton> savePreparedKeyboardButton::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<savePreparedKeyboardButton> res = make_object<savePreparedKeyboardButton>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->button_ = jni::fetch_tl_object<keyboardButton>(env, jni::fetch_object(env, p, res->button_fieldID));
  return res;
}

void savePreparedKeyboardButton::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SavePreparedKeyboardButton");
    s.store_field("userId", user_id_);
    s.store_object_field("button", static_cast<const BaseObject *>(button_.get()));
    s.store_class_end();
  }
}

savePreparedKeyboardButton::ReturnType savePreparedKeyboardButton::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void savePreparedKeyboardButton::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SavePreparedKeyboardButton").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    button_fieldID = jni::get_field_id(env, Class, "button", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$KeyboardButton;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass searchEmojis::Class;
jfieldID searchEmojis::text_fieldID;
jfieldID searchEmojis::input_language_codes_fieldID;

searchEmojis::searchEmojis()
  : text_()
  , input_language_codes_()
{}

searchEmojis::searchEmojis(string const &text_, array<string> &&input_language_codes_)
  : text_(text_)
  , input_language_codes_(std::move(input_language_codes_))
{}

const std::int32_t searchEmojis::ID;

object_ptr<searchEmojis> searchEmojis::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchEmojis> res = make_object<searchEmojis>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->input_language_codes_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->input_language_codes_fieldID));
  return res;
}

void searchEmojis::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchEmojis");
    s.store_field("text", text_);
    { s.store_vector_begin("inputLanguageCodes", input_language_codes_.size()); for (const auto &_value : input_language_codes_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

searchEmojis::ReturnType searchEmojis::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiKeywords::fetch(env, p);
}

void searchEmojis::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchEmojis").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    input_language_codes_fieldID = jni::get_field_id(env, Class, "inputLanguageCodes", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass searchRecentlyFoundChats::Class;
jfieldID searchRecentlyFoundChats::query_fieldID;
jfieldID searchRecentlyFoundChats::limit_fieldID;

searchRecentlyFoundChats::searchRecentlyFoundChats()
  : query_()
  , limit_()
{}

searchRecentlyFoundChats::searchRecentlyFoundChats(string const &query_, int32 limit_)
  : query_(query_)
  , limit_(limit_)
{}

const std::int32_t searchRecentlyFoundChats::ID;

object_ptr<searchRecentlyFoundChats> searchRecentlyFoundChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchRecentlyFoundChats> res = make_object<searchRecentlyFoundChats>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchRecentlyFoundChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchRecentlyFoundChats");
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchRecentlyFoundChats::ReturnType searchRecentlyFoundChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void searchRecentlyFoundChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchRecentlyFoundChats").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchTextCompositionStyle::Class;
jfieldID searchTextCompositionStyle::name_fieldID;

searchTextCompositionStyle::searchTextCompositionStyle()
  : name_()
{}

searchTextCompositionStyle::searchTextCompositionStyle(string const &name_)
  : name_(name_)
{}

const std::int32_t searchTextCompositionStyle::ID;

object_ptr<searchTextCompositionStyle> searchTextCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchTextCompositionStyle> res = make_object<searchTextCompositionStyle>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void searchTextCompositionStyle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchTextCompositionStyle");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

searchTextCompositionStyle::ReturnType searchTextCompositionStyle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return textCompositionStyle::fetch(env, p);
}

void searchTextCompositionStyle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchTextCompositionStyle").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass sendBusinessMessageAlbum::Class;
jfieldID sendBusinessMessageAlbum::business_connection_id_fieldID;
jfieldID sendBusinessMessageAlbum::chat_id_fieldID;
jfieldID sendBusinessMessageAlbum::reply_to_fieldID;
jfieldID sendBusinessMessageAlbum::disable_notification_fieldID;
jfieldID sendBusinessMessageAlbum::protect_content_fieldID;
jfieldID sendBusinessMessageAlbum::effect_id_fieldID;
jfieldID sendBusinessMessageAlbum::input_message_contents_fieldID;

sendBusinessMessageAlbum::sendBusinessMessageAlbum()
  : business_connection_id_()
  , chat_id_()
  , reply_to_()
  , disable_notification_()
  , protect_content_()
  , effect_id_()
  , input_message_contents_()
{}

sendBusinessMessageAlbum::sendBusinessMessageAlbum(string const &business_connection_id_, int53 chat_id_, object_ptr<InputMessageReplyTo> &&reply_to_, bool disable_notification_, bool protect_content_, int64 effect_id_, array<object_ptr<InputMessageContent>> &&input_message_contents_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , reply_to_(std::move(reply_to_))
  , disable_notification_(disable_notification_)
  , protect_content_(protect_content_)
  , effect_id_(effect_id_)
  , input_message_contents_(std::move(input_message_contents_))
{}

const std::int32_t sendBusinessMessageAlbum::ID;

object_ptr<sendBusinessMessageAlbum> sendBusinessMessageAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendBusinessMessageAlbum> res = make_object<sendBusinessMessageAlbum>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->disable_notification_ = (env->GetBooleanField(p, res->disable_notification_fieldID) != 0);
  res->protect_content_ = (env->GetBooleanField(p, res->protect_content_fieldID) != 0);
  res->effect_id_ = env->GetLongField(p, res->effect_id_fieldID);
  res->input_message_contents_ = jni::FetchVector<InputMessageContent>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->input_message_contents_fieldID));
  return res;
}

void sendBusinessMessageAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendBusinessMessageAlbum");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_field("disableNotification", disable_notification_);
    s.store_field("protectContent", protect_content_);
    s.store_field("effectId", effect_id_);
    { s.store_vector_begin("inputMessageContents", input_message_contents_.size()); for (const auto &_value : input_message_contents_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

sendBusinessMessageAlbum::ReturnType sendBusinessMessageAlbum::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessages::fetch(env, p);
}

void sendBusinessMessageAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendBusinessMessageAlbum").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    disable_notification_fieldID = jni::get_field_id(env, Class, "disableNotification", "Z");
    protect_content_fieldID = jni::get_field_id(env, Class, "protectContent", "Z");
    effect_id_fieldID = jni::get_field_id(env, Class, "effectId", "J");
    input_message_contents_fieldID = jni::get_field_id(env, Class, "inputMessageContents", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass sendCustomRequest::Class;
jfieldID sendCustomRequest::method_fieldID;
jfieldID sendCustomRequest::parameters_fieldID;

sendCustomRequest::sendCustomRequest()
  : method_()
  , parameters_()
{}

sendCustomRequest::sendCustomRequest(string const &method_, string const &parameters_)
  : method_(method_)
  , parameters_(parameters_)
{}

const std::int32_t sendCustomRequest::ID;

object_ptr<sendCustomRequest> sendCustomRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendCustomRequest> res = make_object<sendCustomRequest>();
  res->method_ = jni::fetch_string(env, p, res->method_fieldID);
  res->parameters_ = jni::fetch_string(env, p, res->parameters_fieldID);
  return res;
}

void sendCustomRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendCustomRequest");
    s.store_field("method", method_);
    s.store_field("parameters", parameters_);
    s.store_class_end();
  }
}

sendCustomRequest::ReturnType sendCustomRequest::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return customRequestResult::fetch(env, p);
}

void sendCustomRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendCustomRequest").c_str());
    method_fieldID = jni::get_field_id(env, Class, "method", "Ljava/lang/String;");
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass sendMessageAlbum::Class;
jfieldID sendMessageAlbum::chat_id_fieldID;
jfieldID sendMessageAlbum::topic_id_fieldID;
jfieldID sendMessageAlbum::reply_to_fieldID;
jfieldID sendMessageAlbum::options_fieldID;
jfieldID sendMessageAlbum::input_message_contents_fieldID;

sendMessageAlbum::sendMessageAlbum()
  : chat_id_()
  , topic_id_()
  , reply_to_()
  , options_()
  , input_message_contents_()
{}

sendMessageAlbum::sendMessageAlbum(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<InputMessageReplyTo> &&reply_to_, object_ptr<messageSendOptions> &&options_, array<object_ptr<InputMessageContent>> &&input_message_contents_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , reply_to_(std::move(reply_to_))
  , options_(std::move(options_))
  , input_message_contents_(std::move(input_message_contents_))
{}

const std::int32_t sendMessageAlbum::ID;

object_ptr<sendMessageAlbum> sendMessageAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendMessageAlbum> res = make_object<sendMessageAlbum>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->options_ = jni::fetch_tl_object<messageSendOptions>(env, jni::fetch_object(env, p, res->options_fieldID));
  res->input_message_contents_ = jni::FetchVector<InputMessageContent>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->input_message_contents_fieldID));
  return res;
}

void sendMessageAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendMessageAlbum");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_object_field("options", static_cast<const BaseObject *>(options_.get()));
    { s.store_vector_begin("inputMessageContents", input_message_contents_.size()); for (const auto &_value : input_message_contents_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

sendMessageAlbum::ReturnType sendMessageAlbum::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void sendMessageAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendMessageAlbum").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    options_fieldID = jni::get_field_id(env, Class, "options", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSendOptions;").c_str());
    input_message_contents_fieldID = jni::get_field_id(env, Class, "inputMessageContents", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass sendPhoneNumberFirebaseSms::Class;
jfieldID sendPhoneNumberFirebaseSms::token_fieldID;

sendPhoneNumberFirebaseSms::sendPhoneNumberFirebaseSms()
  : token_()
{}

sendPhoneNumberFirebaseSms::sendPhoneNumberFirebaseSms(string const &token_)
  : token_(token_)
{}

const std::int32_t sendPhoneNumberFirebaseSms::ID;

object_ptr<sendPhoneNumberFirebaseSms> sendPhoneNumberFirebaseSms::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendPhoneNumberFirebaseSms> res = make_object<sendPhoneNumberFirebaseSms>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return res;
}

void sendPhoneNumberFirebaseSms::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendPhoneNumberFirebaseSms");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

sendPhoneNumberFirebaseSms::ReturnType sendPhoneNumberFirebaseSms::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendPhoneNumberFirebaseSms::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendPhoneNumberFirebaseSms").c_str());
    token_fieldID = jni::get_field_id(env, Class, "token", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setAccentColor::Class;
jfieldID setAccentColor::accent_color_id_fieldID;
jfieldID setAccentColor::background_custom_emoji_id_fieldID;

setAccentColor::setAccentColor()
  : accent_color_id_()
  , background_custom_emoji_id_()
{}

setAccentColor::setAccentColor(int32 accent_color_id_, int64 background_custom_emoji_id_)
  : accent_color_id_(accent_color_id_)
  , background_custom_emoji_id_(background_custom_emoji_id_)
{}

const std::int32_t setAccentColor::ID;

object_ptr<setAccentColor> setAccentColor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAccentColor> res = make_object<setAccentColor>();
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->background_custom_emoji_id_ = env->GetLongField(p, res->background_custom_emoji_id_fieldID);
  return res;
}

void setAccentColor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetAccentColor");
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("backgroundCustomEmojiId", background_custom_emoji_id_);
    s.store_class_end();
  }
}

setAccentColor::ReturnType setAccentColor::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setAccentColor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetAccentColor").c_str());
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "backgroundCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setAuthenticationEmailAddress::Class;
jfieldID setAuthenticationEmailAddress::email_address_fieldID;

setAuthenticationEmailAddress::setAuthenticationEmailAddress()
  : email_address_()
{}

setAuthenticationEmailAddress::setAuthenticationEmailAddress(string const &email_address_)
  : email_address_(email_address_)
{}

const std::int32_t setAuthenticationEmailAddress::ID;

object_ptr<setAuthenticationEmailAddress> setAuthenticationEmailAddress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAuthenticationEmailAddress> res = make_object<setAuthenticationEmailAddress>();
  res->email_address_ = jni::fetch_string(env, p, res->email_address_fieldID);
  return res;
}

void setAuthenticationEmailAddress::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetAuthenticationEmailAddress");
    s.store_field("emailAddress", email_address_);
    s.store_class_end();
  }
}

setAuthenticationEmailAddress::ReturnType setAuthenticationEmailAddress::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setAuthenticationEmailAddress::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetAuthenticationEmailAddress").c_str());
    email_address_fieldID = jni::get_field_id(env, Class, "emailAddress", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessAccountProfilePhoto::Class;
jfieldID setBusinessAccountProfilePhoto::business_connection_id_fieldID;
jfieldID setBusinessAccountProfilePhoto::photo_fieldID;
jfieldID setBusinessAccountProfilePhoto::is_public_fieldID;

setBusinessAccountProfilePhoto::setBusinessAccountProfilePhoto()
  : business_connection_id_()
  , photo_()
  , is_public_()
{}

setBusinessAccountProfilePhoto::setBusinessAccountProfilePhoto(string const &business_connection_id_, object_ptr<InputChatPhoto> &&photo_, bool is_public_)
  : business_connection_id_(business_connection_id_)
  , photo_(std::move(photo_))
  , is_public_(is_public_)
{}

const std::int32_t setBusinessAccountProfilePhoto::ID;

object_ptr<setBusinessAccountProfilePhoto> setBusinessAccountProfilePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessAccountProfilePhoto> res = make_object<setBusinessAccountProfilePhoto>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->photo_ = jni::fetch_tl_object<InputChatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->is_public_ = (env->GetBooleanField(p, res->is_public_fieldID) != 0);
  return res;
}

void setBusinessAccountProfilePhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessAccountProfilePhoto");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("isPublic", is_public_);
    s.store_class_end();
  }
}

setBusinessAccountProfilePhoto::ReturnType setBusinessAccountProfilePhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBusinessAccountProfilePhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBusinessAccountProfilePhoto").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputChatPhoto;").c_str());
    is_public_fieldID = jni::get_field_id(env, Class, "isPublic", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessConnectedBot::Class;
jfieldID setBusinessConnectedBot::bot_fieldID;

setBusinessConnectedBot::setBusinessConnectedBot()
  : bot_()
{}

setBusinessConnectedBot::setBusinessConnectedBot(object_ptr<businessConnectedBot> &&bot_)
  : bot_(std::move(bot_))
{}

const std::int32_t setBusinessConnectedBot::ID;

object_ptr<setBusinessConnectedBot> setBusinessConnectedBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessConnectedBot> res = make_object<setBusinessConnectedBot>();
  res->bot_ = jni::fetch_tl_object<businessConnectedBot>(env, jni::fetch_object(env, p, res->bot_fieldID));
  return res;
}

void setBusinessConnectedBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessConnectedBot");
    s.store_object_field("bot", static_cast<const BaseObject *>(bot_.get()));
    s.store_class_end();
  }
}

setBusinessConnectedBot::ReturnType setBusinessConnectedBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBusinessConnectedBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBusinessConnectedBot").c_str());
    bot_fieldID = jni::get_field_id(env, Class, "bot", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessConnectedBot;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessMessageIsPinned::Class;
jfieldID setBusinessMessageIsPinned::business_connection_id_fieldID;
jfieldID setBusinessMessageIsPinned::chat_id_fieldID;
jfieldID setBusinessMessageIsPinned::message_id_fieldID;
jfieldID setBusinessMessageIsPinned::is_pinned_fieldID;

setBusinessMessageIsPinned::setBusinessMessageIsPinned()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , is_pinned_()
{}

setBusinessMessageIsPinned::setBusinessMessageIsPinned(string const &business_connection_id_, int53 chat_id_, int53 message_id_, bool is_pinned_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t setBusinessMessageIsPinned::ID;

object_ptr<setBusinessMessageIsPinned> setBusinessMessageIsPinned::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessMessageIsPinned> res = make_object<setBusinessMessageIsPinned>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return res;
}

void setBusinessMessageIsPinned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessMessageIsPinned");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

setBusinessMessageIsPinned::ReturnType setBusinessMessageIsPinned::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBusinessMessageIsPinned::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBusinessMessageIsPinned").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setChatDirectMessagesGroup::Class;
jfieldID setChatDirectMessagesGroup::chat_id_fieldID;
jfieldID setChatDirectMessagesGroup::is_enabled_fieldID;
jfieldID setChatDirectMessagesGroup::paid_message_star_count_fieldID;

setChatDirectMessagesGroup::setChatDirectMessagesGroup()
  : chat_id_()
  , is_enabled_()
  , paid_message_star_count_()
{}

setChatDirectMessagesGroup::setChatDirectMessagesGroup(int53 chat_id_, bool is_enabled_, int53 paid_message_star_count_)
  : chat_id_(chat_id_)
  , is_enabled_(is_enabled_)
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t setChatDirectMessagesGroup::ID;

object_ptr<setChatDirectMessagesGroup> setChatDirectMessagesGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatDirectMessagesGroup> res = make_object<setChatDirectMessagesGroup>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_enabled_ = (env->GetBooleanField(p, res->is_enabled_fieldID) != 0);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

void setChatDirectMessagesGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatDirectMessagesGroup");
    s.store_field("chatId", chat_id_);
    s.store_field("isEnabled", is_enabled_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

setChatDirectMessagesGroup::ReturnType setChatDirectMessagesGroup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatDirectMessagesGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatDirectMessagesGroup").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    is_enabled_fieldID = jni::get_field_id(env, Class, "isEnabled", "Z");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setChatEmojiStatus::Class;
jfieldID setChatEmojiStatus::chat_id_fieldID;
jfieldID setChatEmojiStatus::emoji_status_fieldID;

setChatEmojiStatus::setChatEmojiStatus()
  : chat_id_()
  , emoji_status_()
{}

setChatEmojiStatus::setChatEmojiStatus(int53 chat_id_, object_ptr<emojiStatus> &&emoji_status_)
  : chat_id_(chat_id_)
  , emoji_status_(std::move(emoji_status_))
{}

const std::int32_t setChatEmojiStatus::ID;

object_ptr<setChatEmojiStatus> setChatEmojiStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatEmojiStatus> res = make_object<setChatEmojiStatus>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->emoji_status_fieldID));
  return res;
}

void setChatEmojiStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatEmojiStatus");
    s.store_field("chatId", chat_id_);
    s.store_object_field("emojiStatus", static_cast<const BaseObject *>(emoji_status_.get()));
    s.store_class_end();
  }
}

setChatEmojiStatus::ReturnType setChatEmojiStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatEmojiStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatEmojiStatus").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    emoji_status_fieldID = jni::get_field_id(env, Class, "emojiStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setChatPinnedStories::Class;
jfieldID setChatPinnedStories::chat_id_fieldID;
jfieldID setChatPinnedStories::story_ids_fieldID;

setChatPinnedStories::setChatPinnedStories()
  : chat_id_()
  , story_ids_()
{}

setChatPinnedStories::setChatPinnedStories(int53 chat_id_, array<int32> &&story_ids_)
  : chat_id_(chat_id_)
  , story_ids_(std::move(story_ids_))
{}

const std::int32_t setChatPinnedStories::ID;

object_ptr<setChatPinnedStories> setChatPinnedStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatPinnedStories> res = make_object<setChatPinnedStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->story_ids_fieldID));
  return res;
}

void setChatPinnedStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatPinnedStories");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("storyIds", story_ids_.size()); for (const auto &_value : story_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

setChatPinnedStories::ReturnType setChatPinnedStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatPinnedStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatPinnedStories").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    story_ids_fieldID = jni::get_field_id(env, Class, "storyIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass setCommands::Class;
jfieldID setCommands::scope_fieldID;
jfieldID setCommands::language_code_fieldID;
jfieldID setCommands::commands_fieldID;

setCommands::setCommands()
  : scope_()
  , language_code_()
  , commands_()
{}

setCommands::setCommands(object_ptr<BotCommandScope> &&scope_, string const &language_code_, array<object_ptr<botCommand>> &&commands_)
  : scope_(std::move(scope_))
  , language_code_(language_code_)
  , commands_(std::move(commands_))
{}

const std::int32_t setCommands::ID;

object_ptr<setCommands> setCommands::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setCommands> res = make_object<setCommands>();
  res->scope_ = jni::fetch_tl_object<BotCommandScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->commands_ = jni::FetchVector<botCommand>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->commands_fieldID));
  return res;
}

void setCommands::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetCommands");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_field("languageCode", language_code_);
    { s.store_vector_begin("commands", commands_.size()); for (const auto &_value : commands_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

setCommands::ReturnType setCommands::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setCommands::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetCommands").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotCommandScope;").c_str());
    language_code_fieldID = jni::get_field_id(env, Class, "languageCode", "Ljava/lang/String;");
    commands_fieldID = jni::get_field_id(env, Class, "commands", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BotCommand;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setInlineGameScore::Class;
jfieldID setInlineGameScore::inline_message_id_fieldID;
jfieldID setInlineGameScore::edit_message_fieldID;
jfieldID setInlineGameScore::user_id_fieldID;
jfieldID setInlineGameScore::score_fieldID;
jfieldID setInlineGameScore::force_fieldID;

setInlineGameScore::setInlineGameScore()
  : inline_message_id_()
  , edit_message_()
  , user_id_()
  , score_()
  , force_()
{}

setInlineGameScore::setInlineGameScore(string const &inline_message_id_, bool edit_message_, int53 user_id_, int32 score_, bool force_)
  : inline_message_id_(inline_message_id_)
  , edit_message_(edit_message_)
  , user_id_(user_id_)
  , score_(score_)
  , force_(force_)
{}

const std::int32_t setInlineGameScore::ID;

object_ptr<setInlineGameScore> setInlineGameScore::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setInlineGameScore> res = make_object<setInlineGameScore>();
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  res->edit_message_ = (env->GetBooleanField(p, res->edit_message_fieldID) != 0);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->score_ = env->GetIntField(p, res->score_fieldID);
  res->force_ = (env->GetBooleanField(p, res->force_fieldID) != 0);
  return res;
}

void setInlineGameScore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetInlineGameScore");
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_field("editMessage", edit_message_);
    s.store_field("userId", user_id_);
    s.store_field("score", score_);
    s.store_field("force", force_);
    s.store_class_end();
  }
}

setInlineGameScore::ReturnType setInlineGameScore::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setInlineGameScore::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetInlineGameScore").c_str());
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    edit_message_fieldID = jni::get_field_id(env, Class, "editMessage", "Z");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    score_fieldID = jni::get_field_id(env, Class, "score", "I");
    force_fieldID = jni::get_field_id(env, Class, "force", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setMenuButton::Class;
jfieldID setMenuButton::user_id_fieldID;
jfieldID setMenuButton::menu_button_fieldID;

setMenuButton::setMenuButton()
  : user_id_()
  , menu_button_()
{}

setMenuButton::setMenuButton(int53 user_id_, object_ptr<botMenuButton> &&menu_button_)
  : user_id_(user_id_)
  , menu_button_(std::move(menu_button_))
{}

const std::int32_t setMenuButton::ID;

object_ptr<setMenuButton> setMenuButton::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setMenuButton> res = make_object<setMenuButton>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->menu_button_ = jni::fetch_tl_object<botMenuButton>(env, jni::fetch_object(env, p, res->menu_button_fieldID));
  return res;
}

void setMenuButton::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetMenuButton");
    s.store_field("userId", user_id_);
    s.store_object_field("menuButton", static_cast<const BaseObject *>(menu_button_.get()));
    s.store_class_end();
  }
}

setMenuButton::ReturnType setMenuButton::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setMenuButton::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetMenuButton").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    menu_button_fieldID = jni::get_field_id(env, Class, "menuButton", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotMenuButton;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setProfilePhoto::Class;
jfieldID setProfilePhoto::photo_fieldID;
jfieldID setProfilePhoto::is_public_fieldID;

setProfilePhoto::setProfilePhoto()
  : photo_()
  , is_public_()
{}

setProfilePhoto::setProfilePhoto(object_ptr<InputChatPhoto> &&photo_, bool is_public_)
  : photo_(std::move(photo_))
  , is_public_(is_public_)
{}

const std::int32_t setProfilePhoto::ID;

object_ptr<setProfilePhoto> setProfilePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setProfilePhoto> res = make_object<setProfilePhoto>();
  res->photo_ = jni::fetch_tl_object<InputChatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->is_public_ = (env->GetBooleanField(p, res->is_public_fieldID) != 0);
  return res;
}

void setProfilePhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetProfilePhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("isPublic", is_public_);
    s.store_class_end();
  }
}

setProfilePhoto::ReturnType setProfilePhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setProfilePhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetProfilePhoto").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputChatPhoto;").c_str());
    is_public_fieldID = jni::get_field_id(env, Class, "isPublic", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setSupergroupCustomEmojiStickerSet::Class;
jfieldID setSupergroupCustomEmojiStickerSet::supergroup_id_fieldID;
jfieldID setSupergroupCustomEmojiStickerSet::custom_emoji_sticker_set_id_fieldID;

setSupergroupCustomEmojiStickerSet::setSupergroupCustomEmojiStickerSet()
  : supergroup_id_()
  , custom_emoji_sticker_set_id_()
{}

setSupergroupCustomEmojiStickerSet::setSupergroupCustomEmojiStickerSet(int53 supergroup_id_, int64 custom_emoji_sticker_set_id_)
  : supergroup_id_(supergroup_id_)
  , custom_emoji_sticker_set_id_(custom_emoji_sticker_set_id_)
{}

const std::int32_t setSupergroupCustomEmojiStickerSet::ID;

object_ptr<setSupergroupCustomEmojiStickerSet> setSupergroupCustomEmojiStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setSupergroupCustomEmojiStickerSet> res = make_object<setSupergroupCustomEmojiStickerSet>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->custom_emoji_sticker_set_id_ = env->GetLongField(p, res->custom_emoji_sticker_set_id_fieldID);
  return res;
}

void setSupergroupCustomEmojiStickerSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetSupergroupCustomEmojiStickerSet");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("customEmojiStickerSetId", custom_emoji_sticker_set_id_);
    s.store_class_end();
  }
}

setSupergroupCustomEmojiStickerSet::ReturnType setSupergroupCustomEmojiStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setSupergroupCustomEmojiStickerSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetSupergroupCustomEmojiStickerSet").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    custom_emoji_sticker_set_id_fieldID = jni::get_field_id(env, Class, "customEmojiStickerSetId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setUserPrivacySettingRules::Class;
jfieldID setUserPrivacySettingRules::setting_fieldID;
jfieldID setUserPrivacySettingRules::rules_fieldID;

setUserPrivacySettingRules::setUserPrivacySettingRules()
  : setting_()
  , rules_()
{}

setUserPrivacySettingRules::setUserPrivacySettingRules(object_ptr<UserPrivacySetting> &&setting_, object_ptr<userPrivacySettingRules> &&rules_)
  : setting_(std::move(setting_))
  , rules_(std::move(rules_))
{}

const std::int32_t setUserPrivacySettingRules::ID;

object_ptr<setUserPrivacySettingRules> setUserPrivacySettingRules::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setUserPrivacySettingRules> res = make_object<setUserPrivacySettingRules>();
  res->setting_ = jni::fetch_tl_object<UserPrivacySetting>(env, jni::fetch_object(env, p, res->setting_fieldID));
  res->rules_ = jni::fetch_tl_object<userPrivacySettingRules>(env, jni::fetch_object(env, p, res->rules_fieldID));
  return res;
}

void setUserPrivacySettingRules::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetUserPrivacySettingRules");
    s.store_object_field("setting", static_cast<const BaseObject *>(setting_.get()));
    s.store_object_field("rules", static_cast<const BaseObject *>(rules_.get()));
    s.store_class_end();
  }
}

setUserPrivacySettingRules::ReturnType setUserPrivacySettingRules::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setUserPrivacySettingRules::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetUserPrivacySettingRules").c_str());
    setting_fieldID = jni::get_field_id(env, Class, "setting", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserPrivacySetting;").c_str());
    rules_fieldID = jni::get_field_id(env, Class, "rules", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserPrivacySettingRules;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setVideoChatTitle::Class;
jfieldID setVideoChatTitle::group_call_id_fieldID;
jfieldID setVideoChatTitle::title_fieldID;

setVideoChatTitle::setVideoChatTitle()
  : group_call_id_()
  , title_()
{}

setVideoChatTitle::setVideoChatTitle(int32 group_call_id_, string const &title_)
  : group_call_id_(group_call_id_)
  , title_(title_)
{}

const std::int32_t setVideoChatTitle::ID;

object_ptr<setVideoChatTitle> setVideoChatTitle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setVideoChatTitle> res = make_object<setVideoChatTitle>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  return res;
}

void setVideoChatTitle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetVideoChatTitle");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("title", title_);
    s.store_class_end();
  }
}

setVideoChatTitle::ReturnType setVideoChatTitle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setVideoChatTitle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetVideoChatTitle").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass synchronizeLanguagePack::Class;
jfieldID synchronizeLanguagePack::language_pack_id_fieldID;

synchronizeLanguagePack::synchronizeLanguagePack()
  : language_pack_id_()
{}

synchronizeLanguagePack::synchronizeLanguagePack(string const &language_pack_id_)
  : language_pack_id_(language_pack_id_)
{}

const std::int32_t synchronizeLanguagePack::ID;

object_ptr<synchronizeLanguagePack> synchronizeLanguagePack::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<synchronizeLanguagePack> res = make_object<synchronizeLanguagePack>();
  res->language_pack_id_ = jni::fetch_string(env, p, res->language_pack_id_fieldID);
  return res;
}

void synchronizeLanguagePack::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SynchronizeLanguagePack");
    s.store_field("languagePackId", language_pack_id_);
    s.store_class_end();
  }
}

synchronizeLanguagePack::ReturnType synchronizeLanguagePack::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void synchronizeLanguagePack::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SynchronizeLanguagePack").c_str());
    language_pack_id_fieldID = jni::get_field_id(env, Class, "languagePackId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass testCallVectorString::Class;
jfieldID testCallVectorString::x_fieldID;

testCallVectorString::testCallVectorString()
  : x_()
{}

testCallVectorString::testCallVectorString(array<string> &&x_)
  : x_(std::move(x_))
{}

const std::int32_t testCallVectorString::ID;

object_ptr<testCallVectorString> testCallVectorString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testCallVectorString> res = make_object<testCallVectorString>();
  res->x_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->x_fieldID));
  return res;
}

void testCallVectorString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestCallVectorString");
    { s.store_vector_begin("x", x_.size()); for (const auto &_value : x_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

testCallVectorString::ReturnType testCallVectorString::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testVectorString::fetch(env, p);
}

void testCallVectorString::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TestCallVectorString").c_str());
    x_fieldID = jni::get_field_id(env, Class, "x", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass toggleBotIsAddedToAttachmentMenu::Class;
jfieldID toggleBotIsAddedToAttachmentMenu::bot_user_id_fieldID;
jfieldID toggleBotIsAddedToAttachmentMenu::is_added_fieldID;
jfieldID toggleBotIsAddedToAttachmentMenu::allow_write_access_fieldID;

toggleBotIsAddedToAttachmentMenu::toggleBotIsAddedToAttachmentMenu()
  : bot_user_id_()
  , is_added_()
  , allow_write_access_()
{}

toggleBotIsAddedToAttachmentMenu::toggleBotIsAddedToAttachmentMenu(int53 bot_user_id_, bool is_added_, bool allow_write_access_)
  : bot_user_id_(bot_user_id_)
  , is_added_(is_added_)
  , allow_write_access_(allow_write_access_)
{}

const std::int32_t toggleBotIsAddedToAttachmentMenu::ID;

object_ptr<toggleBotIsAddedToAttachmentMenu> toggleBotIsAddedToAttachmentMenu::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleBotIsAddedToAttachmentMenu> res = make_object<toggleBotIsAddedToAttachmentMenu>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->is_added_ = (env->GetBooleanField(p, res->is_added_fieldID) != 0);
  res->allow_write_access_ = (env->GetBooleanField(p, res->allow_write_access_fieldID) != 0);
  return res;
}

void toggleBotIsAddedToAttachmentMenu::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleBotIsAddedToAttachmentMenu");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("isAdded", is_added_);
    s.store_field("allowWriteAccess", allow_write_access_);
    s.store_class_end();
  }
}

toggleBotIsAddedToAttachmentMenu::ReturnType toggleBotIsAddedToAttachmentMenu::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleBotIsAddedToAttachmentMenu::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleBotIsAddedToAttachmentMenu").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    is_added_fieldID = jni::get_field_id(env, Class, "isAdded", "Z");
    allow_write_access_fieldID = jni::get_field_id(env, Class, "allowWriteAccess", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleChatViewAsTopics::Class;
jfieldID toggleChatViewAsTopics::chat_id_fieldID;
jfieldID toggleChatViewAsTopics::view_as_topics_fieldID;

toggleChatViewAsTopics::toggleChatViewAsTopics()
  : chat_id_()
  , view_as_topics_()
{}

toggleChatViewAsTopics::toggleChatViewAsTopics(int53 chat_id_, bool view_as_topics_)
  : chat_id_(chat_id_)
  , view_as_topics_(view_as_topics_)
{}

const std::int32_t toggleChatViewAsTopics::ID;

object_ptr<toggleChatViewAsTopics> toggleChatViewAsTopics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatViewAsTopics> res = make_object<toggleChatViewAsTopics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->view_as_topics_ = (env->GetBooleanField(p, res->view_as_topics_fieldID) != 0);
  return res;
}

void toggleChatViewAsTopics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleChatViewAsTopics");
    s.store_field("chatId", chat_id_);
    s.store_field("viewAsTopics", view_as_topics_);
    s.store_class_end();
  }
}

toggleChatViewAsTopics::ReturnType toggleChatViewAsTopics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleChatViewAsTopics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleChatViewAsTopics").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    view_as_topics_fieldID = jni::get_field_id(env, Class, "viewAsTopics", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleStoryIsPostedToChatPage::Class;
jfieldID toggleStoryIsPostedToChatPage::story_poster_chat_id_fieldID;
jfieldID toggleStoryIsPostedToChatPage::story_id_fieldID;
jfieldID toggleStoryIsPostedToChatPage::is_posted_to_chat_page_fieldID;

toggleStoryIsPostedToChatPage::toggleStoryIsPostedToChatPage()
  : story_poster_chat_id_()
  , story_id_()
  , is_posted_to_chat_page_()
{}

toggleStoryIsPostedToChatPage::toggleStoryIsPostedToChatPage(int53 story_poster_chat_id_, int32 story_id_, bool is_posted_to_chat_page_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , is_posted_to_chat_page_(is_posted_to_chat_page_)
{}

const std::int32_t toggleStoryIsPostedToChatPage::ID;

object_ptr<toggleStoryIsPostedToChatPage> toggleStoryIsPostedToChatPage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleStoryIsPostedToChatPage> res = make_object<toggleStoryIsPostedToChatPage>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->is_posted_to_chat_page_ = (env->GetBooleanField(p, res->is_posted_to_chat_page_fieldID) != 0);
  return res;
}

void toggleStoryIsPostedToChatPage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleStoryIsPostedToChatPage");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_field("isPostedToChatPage", is_posted_to_chat_page_);
    s.store_class_end();
  }
}

toggleStoryIsPostedToChatPage::ReturnType toggleStoryIsPostedToChatPage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleStoryIsPostedToChatPage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleStoryIsPostedToChatPage").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    is_posted_to_chat_page_fieldID = jni::get_field_id(env, Class, "isPostedToChatPage", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleSupergroupJoinToSendMessages::Class;
jfieldID toggleSupergroupJoinToSendMessages::supergroup_id_fieldID;
jfieldID toggleSupergroupJoinToSendMessages::join_to_send_messages_fieldID;

toggleSupergroupJoinToSendMessages::toggleSupergroupJoinToSendMessages()
  : supergroup_id_()
  , join_to_send_messages_()
{}

toggleSupergroupJoinToSendMessages::toggleSupergroupJoinToSendMessages(int53 supergroup_id_, bool join_to_send_messages_)
  : supergroup_id_(supergroup_id_)
  , join_to_send_messages_(join_to_send_messages_)
{}

const std::int32_t toggleSupergroupJoinToSendMessages::ID;

object_ptr<toggleSupergroupJoinToSendMessages> toggleSupergroupJoinToSendMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupJoinToSendMessages> res = make_object<toggleSupergroupJoinToSendMessages>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->join_to_send_messages_ = (env->GetBooleanField(p, res->join_to_send_messages_fieldID) != 0);
  return res;
}

void toggleSupergroupJoinToSendMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSupergroupJoinToSendMessages");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("joinToSendMessages", join_to_send_messages_);
    s.store_class_end();
  }
}

toggleSupergroupJoinToSendMessages::ReturnType toggleSupergroupJoinToSendMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleSupergroupJoinToSendMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleSupergroupJoinToSendMessages").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    join_to_send_messages_fieldID = jni::get_field_id(env, Class, "joinToSendMessages", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleSupergroupSignMessages::Class;
jfieldID toggleSupergroupSignMessages::supergroup_id_fieldID;
jfieldID toggleSupergroupSignMessages::sign_messages_fieldID;
jfieldID toggleSupergroupSignMessages::show_message_sender_fieldID;

toggleSupergroupSignMessages::toggleSupergroupSignMessages()
  : supergroup_id_()
  , sign_messages_()
  , show_message_sender_()
{}

toggleSupergroupSignMessages::toggleSupergroupSignMessages(int53 supergroup_id_, bool sign_messages_, bool show_message_sender_)
  : supergroup_id_(supergroup_id_)
  , sign_messages_(sign_messages_)
  , show_message_sender_(show_message_sender_)
{}

const std::int32_t toggleSupergroupSignMessages::ID;

object_ptr<toggleSupergroupSignMessages> toggleSupergroupSignMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupSignMessages> res = make_object<toggleSupergroupSignMessages>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->sign_messages_ = (env->GetBooleanField(p, res->sign_messages_fieldID) != 0);
  res->show_message_sender_ = (env->GetBooleanField(p, res->show_message_sender_fieldID) != 0);
  return res;
}

void toggleSupergroupSignMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSupergroupSignMessages");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("signMessages", sign_messages_);
    s.store_field("showMessageSender", show_message_sender_);
    s.store_class_end();
  }
}

toggleSupergroupSignMessages::ReturnType toggleSupergroupSignMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleSupergroupSignMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleSupergroupSignMessages").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    sign_messages_fieldID = jni::get_field_id(env, Class, "signMessages", "Z");
    show_message_sender_fieldID = jni::get_field_id(env, Class, "showMessageSender", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass translateMessageText::Class;
jfieldID translateMessageText::chat_id_fieldID;
jfieldID translateMessageText::message_id_fieldID;
jfieldID translateMessageText::to_language_code_fieldID;
jfieldID translateMessageText::tone_fieldID;

translateMessageText::translateMessageText()
  : chat_id_()
  , message_id_()
  , to_language_code_()
  , tone_()
{}

translateMessageText::translateMessageText(int53 chat_id_, int53 message_id_, string const &to_language_code_, string const &tone_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , to_language_code_(to_language_code_)
  , tone_(tone_)
{}

const std::int32_t translateMessageText::ID;

object_ptr<translateMessageText> translateMessageText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<translateMessageText> res = make_object<translateMessageText>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->to_language_code_ = jni::fetch_string(env, p, res->to_language_code_fieldID);
  res->tone_ = jni::fetch_string(env, p, res->tone_fieldID);
  return res;
}

void translateMessageText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TranslateMessageText");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("toLanguageCode", to_language_code_);
    s.store_field("tone", tone_);
    s.store_class_end();
  }
}

translateMessageText::ReturnType translateMessageText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

void translateMessageText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TranslateMessageText").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    to_language_code_fieldID = jni::get_field_id(env, Class, "toLanguageCode", "Ljava/lang/String;");
    tone_fieldID = jni::get_field_id(env, Class, "tone", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
