#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 accountInfo::Class;
jfieldID accountInfo::registration_month_fieldID;
jfieldID accountInfo::registration_year_fieldID;
jfieldID accountInfo::phone_number_country_code_fieldID;
jfieldID accountInfo::last_name_change_date_fieldID;
jfieldID accountInfo::last_photo_change_date_fieldID;

accountInfo::accountInfo()
  : registration_month_()
  , registration_year_()
  , phone_number_country_code_()
  , last_name_change_date_()
  , last_photo_change_date_()
{}

accountInfo::accountInfo(int32 registration_month_, int32 registration_year_, string const &phone_number_country_code_, int32 last_name_change_date_, int32 last_photo_change_date_)
  : registration_month_(registration_month_)
  , registration_year_(registration_year_)
  , phone_number_country_code_(phone_number_country_code_)
  , last_name_change_date_(last_name_change_date_)
  , last_photo_change_date_(last_photo_change_date_)
{}

const std::int32_t accountInfo::ID;

object_ptr<accountInfo> accountInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<accountInfo> res = make_object<accountInfo>();
  res->registration_month_ = env->GetIntField(p, res->registration_month_fieldID);
  res->registration_year_ = env->GetIntField(p, res->registration_year_fieldID);
  res->phone_number_country_code_ = jni::fetch_string(env, p, res->phone_number_country_code_fieldID);
  res->last_name_change_date_ = env->GetIntField(p, res->last_name_change_date_fieldID);
  res->last_photo_change_date_ = env->GetIntField(p, res->last_photo_change_date_fieldID);
  return res;
}

void accountInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, registration_month_fieldID, registration_month_);
  env->SetIntField(s, registration_year_fieldID, registration_year_);
  { jstring nextString = jni::to_jstring(env, phone_number_country_code_); if (nextString) { env->SetObjectField(s, phone_number_country_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, last_name_change_date_fieldID, last_name_change_date_);
  env->SetIntField(s, last_photo_change_date_fieldID, last_photo_change_date_);
}

void accountInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AccountInfo");
    s.store_field("registrationMonth", registration_month_);
    s.store_field("registrationYear", registration_year_);
    s.store_field("phoneNumberCountryCode", phone_number_country_code_);
    s.store_field("lastNameChangeDate", last_name_change_date_);
    s.store_field("lastPhotoChangeDate", last_photo_change_date_);
    s.store_class_end();
  }
}

void accountInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AccountInfo").c_str());
    registration_month_fieldID = jni::get_field_id(env, Class, "registrationMonth", "I");
    registration_year_fieldID = jni::get_field_id(env, Class, "registrationYear", "I");
    phone_number_country_code_fieldID = jni::get_field_id(env, Class, "phoneNumberCountryCode", "Ljava/lang/String;");
    last_name_change_date_fieldID = jni::get_field_id(env, Class, "lastNameChangeDate", "I");
    last_photo_change_date_fieldID = jni::get_field_id(env, Class, "lastPhotoChangeDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass affiliateProgramParameters::Class;
jfieldID affiliateProgramParameters::commission_per_mille_fieldID;
jfieldID affiliateProgramParameters::month_count_fieldID;

affiliateProgramParameters::affiliateProgramParameters()
  : commission_per_mille_()
  , month_count_()
{}

affiliateProgramParameters::affiliateProgramParameters(int32 commission_per_mille_, int32 month_count_)
  : commission_per_mille_(commission_per_mille_)
  , month_count_(month_count_)
{}

const std::int32_t affiliateProgramParameters::ID;

object_ptr<affiliateProgramParameters> affiliateProgramParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<affiliateProgramParameters> res = make_object<affiliateProgramParameters>();
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  return res;
}

void affiliateProgramParameters::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  env->SetIntField(s, month_count_fieldID, month_count_);
}

void affiliateProgramParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AffiliateProgramParameters");
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_field("monthCount", month_count_);
    s.store_class_end();
  }
}

void affiliateProgramParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateProgramParameters").c_str());
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass animation::Class;
jfieldID animation::duration_fieldID;
jfieldID animation::width_fieldID;
jfieldID animation::height_fieldID;
jfieldID animation::file_name_fieldID;
jfieldID animation::mime_type_fieldID;
jfieldID animation::has_stickers_fieldID;
jfieldID animation::minithumbnail_fieldID;
jfieldID animation::thumbnail_fieldID;
jfieldID animation::animation_fieldID;

animation::animation()
  : duration_()
  , width_()
  , height_()
  , file_name_()
  , mime_type_()
  , has_stickers_()
  , minithumbnail_()
  , thumbnail_()
  , animation_()
{}

animation::animation(int32 duration_, int32 width_, int32 height_, string const &file_name_, string const &mime_type_, bool has_stickers_, object_ptr<minithumbnail> &&minithumbnail_, object_ptr<thumbnail> &&thumbnail_, object_ptr<file> &&animation_)
  : duration_(duration_)
  , width_(width_)
  , height_(height_)
  , file_name_(file_name_)
  , mime_type_(mime_type_)
  , has_stickers_(has_stickers_)
  , minithumbnail_(std::move(minithumbnail_))
  , thumbnail_(std::move(thumbnail_))
  , animation_(std::move(animation_))
{}

const std::int32_t animation::ID;

object_ptr<animation> animation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<animation> res = make_object<animation>();
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->has_stickers_ = (env->GetBooleanField(p, res->has_stickers_fieldID) != 0);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->animation_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->animation_fieldID));
  return res;
}

void animation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  { jstring nextString = jni::to_jstring(env, file_name_); if (nextString) { env->SetObjectField(s, file_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, has_stickers_fieldID, has_stickers_);
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_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); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
}

void animation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Animation");
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("fileName", file_name_);
    s.store_field("mimeType", mime_type_);
    s.store_field("hasStickers", has_stickers_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_class_end();
  }
}

void animation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Animation").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    file_name_fieldID = jni::get_field_id(env, Class, "fileName", "Ljava/lang/String;");
    mime_type_fieldID = jni::get_field_id(env, Class, "mimeType", "Ljava/lang/String;");
    has_stickers_fieldID = jni::get_field_id(env, Class, "hasStickers", "Z");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass animations::Class;
jfieldID animations::animations_fieldID;

animations::animations()
  : animations_()
{}

animations::animations(array<object_ptr<animation>> &&animations_)
  : animations_(std::move(animations_))
{}

const std::int32_t animations::ID;

object_ptr<animations> animations::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<animations> res = make_object<animations>();
  res->animations_ = jni::FetchVector<animation>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->animations_fieldID));
  return res;
}

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

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

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

jclass attachmentMenuBot::Class;
jfieldID attachmentMenuBot::bot_user_id_fieldID;
jfieldID attachmentMenuBot::supports_self_chat_fieldID;
jfieldID attachmentMenuBot::supports_user_chats_fieldID;
jfieldID attachmentMenuBot::supports_bot_chats_fieldID;
jfieldID attachmentMenuBot::supports_group_chats_fieldID;
jfieldID attachmentMenuBot::supports_channel_chats_fieldID;
jfieldID attachmentMenuBot::request_write_access_fieldID;
jfieldID attachmentMenuBot::is_added_fieldID;
jfieldID attachmentMenuBot::show_in_attachment_menu_fieldID;
jfieldID attachmentMenuBot::show_in_side_menu_fieldID;
jfieldID attachmentMenuBot::show_disclaimer_in_side_menu_fieldID;
jfieldID attachmentMenuBot::name_fieldID;
jfieldID attachmentMenuBot::name_color_fieldID;
jfieldID attachmentMenuBot::default_icon_fieldID;
jfieldID attachmentMenuBot::ios_static_icon_fieldID;
jfieldID attachmentMenuBot::ios_animated_icon_fieldID;
jfieldID attachmentMenuBot::ios_side_menu_icon_fieldID;
jfieldID attachmentMenuBot::android_icon_fieldID;
jfieldID attachmentMenuBot::android_side_menu_icon_fieldID;
jfieldID attachmentMenuBot::macos_icon_fieldID;
jfieldID attachmentMenuBot::macos_side_menu_icon_fieldID;
jfieldID attachmentMenuBot::icon_color_fieldID;
jfieldID attachmentMenuBot::web_app_placeholder_fieldID;

attachmentMenuBot::attachmentMenuBot()
  : bot_user_id_()
  , supports_self_chat_()
  , supports_user_chats_()
  , supports_bot_chats_()
  , supports_group_chats_()
  , supports_channel_chats_()
  , request_write_access_()
  , is_added_()
  , show_in_attachment_menu_()
  , show_in_side_menu_()
  , show_disclaimer_in_side_menu_()
  , name_()
  , name_color_()
  , default_icon_()
  , ios_static_icon_()
  , ios_animated_icon_()
  , ios_side_menu_icon_()
  , android_icon_()
  , android_side_menu_icon_()
  , macos_icon_()
  , macos_side_menu_icon_()
  , icon_color_()
  , web_app_placeholder_()
{}

attachmentMenuBot::attachmentMenuBot(int53 bot_user_id_, bool supports_self_chat_, bool supports_user_chats_, bool supports_bot_chats_, bool supports_group_chats_, bool supports_channel_chats_, bool request_write_access_, bool is_added_, bool show_in_attachment_menu_, bool show_in_side_menu_, bool show_disclaimer_in_side_menu_, string const &name_, object_ptr<attachmentMenuBotColor> &&name_color_, object_ptr<file> &&default_icon_, object_ptr<file> &&ios_static_icon_, object_ptr<file> &&ios_animated_icon_, object_ptr<file> &&ios_side_menu_icon_, object_ptr<file> &&android_icon_, object_ptr<file> &&android_side_menu_icon_, object_ptr<file> &&macos_icon_, object_ptr<file> &&macos_side_menu_icon_, object_ptr<attachmentMenuBotColor> &&icon_color_, object_ptr<file> &&web_app_placeholder_)
  : bot_user_id_(bot_user_id_)
  , supports_self_chat_(supports_self_chat_)
  , supports_user_chats_(supports_user_chats_)
  , supports_bot_chats_(supports_bot_chats_)
  , supports_group_chats_(supports_group_chats_)
  , supports_channel_chats_(supports_channel_chats_)
  , request_write_access_(request_write_access_)
  , is_added_(is_added_)
  , show_in_attachment_menu_(show_in_attachment_menu_)
  , show_in_side_menu_(show_in_side_menu_)
  , show_disclaimer_in_side_menu_(show_disclaimer_in_side_menu_)
  , name_(name_)
  , name_color_(std::move(name_color_))
  , default_icon_(std::move(default_icon_))
  , ios_static_icon_(std::move(ios_static_icon_))
  , ios_animated_icon_(std::move(ios_animated_icon_))
  , ios_side_menu_icon_(std::move(ios_side_menu_icon_))
  , android_icon_(std::move(android_icon_))
  , android_side_menu_icon_(std::move(android_side_menu_icon_))
  , macos_icon_(std::move(macos_icon_))
  , macos_side_menu_icon_(std::move(macos_side_menu_icon_))
  , icon_color_(std::move(icon_color_))
  , web_app_placeholder_(std::move(web_app_placeholder_))
{}

const std::int32_t attachmentMenuBot::ID;

object_ptr<attachmentMenuBot> attachmentMenuBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<attachmentMenuBot> res = make_object<attachmentMenuBot>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->supports_self_chat_ = (env->GetBooleanField(p, res->supports_self_chat_fieldID) != 0);
  res->supports_user_chats_ = (env->GetBooleanField(p, res->supports_user_chats_fieldID) != 0);
  res->supports_bot_chats_ = (env->GetBooleanField(p, res->supports_bot_chats_fieldID) != 0);
  res->supports_group_chats_ = (env->GetBooleanField(p, res->supports_group_chats_fieldID) != 0);
  res->supports_channel_chats_ = (env->GetBooleanField(p, res->supports_channel_chats_fieldID) != 0);
  res->request_write_access_ = (env->GetBooleanField(p, res->request_write_access_fieldID) != 0);
  res->is_added_ = (env->GetBooleanField(p, res->is_added_fieldID) != 0);
  res->show_in_attachment_menu_ = (env->GetBooleanField(p, res->show_in_attachment_menu_fieldID) != 0);
  res->show_in_side_menu_ = (env->GetBooleanField(p, res->show_in_side_menu_fieldID) != 0);
  res->show_disclaimer_in_side_menu_ = (env->GetBooleanField(p, res->show_disclaimer_in_side_menu_fieldID) != 0);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->name_color_ = jni::fetch_tl_object<attachmentMenuBotColor>(env, jni::fetch_object(env, p, res->name_color_fieldID));
  res->default_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->default_icon_fieldID));
  res->ios_static_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->ios_static_icon_fieldID));
  res->ios_animated_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->ios_animated_icon_fieldID));
  res->ios_side_menu_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->ios_side_menu_icon_fieldID));
  res->android_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->android_icon_fieldID));
  res->android_side_menu_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->android_side_menu_icon_fieldID));
  res->macos_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->macos_icon_fieldID));
  res->macos_side_menu_icon_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->macos_side_menu_icon_fieldID));
  res->icon_color_ = jni::fetch_tl_object<attachmentMenuBotColor>(env, jni::fetch_object(env, p, res->icon_color_fieldID));
  res->web_app_placeholder_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->web_app_placeholder_fieldID));
  return res;
}

void attachmentMenuBot::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_);
  env->SetBooleanField(s, supports_self_chat_fieldID, supports_self_chat_);
  env->SetBooleanField(s, supports_user_chats_fieldID, supports_user_chats_);
  env->SetBooleanField(s, supports_bot_chats_fieldID, supports_bot_chats_);
  env->SetBooleanField(s, supports_group_chats_fieldID, supports_group_chats_);
  env->SetBooleanField(s, supports_channel_chats_fieldID, supports_channel_chats_);
  env->SetBooleanField(s, request_write_access_fieldID, request_write_access_);
  env->SetBooleanField(s, is_added_fieldID, is_added_);
  env->SetBooleanField(s, show_in_attachment_menu_fieldID, show_in_attachment_menu_);
  env->SetBooleanField(s, show_in_side_menu_fieldID, show_in_side_menu_);
  env->SetBooleanField(s, show_disclaimer_in_side_menu_fieldID, show_disclaimer_in_side_menu_);
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (name_color_ != nullptr) { jobject next; name_color_->store(env, next); if (next) { env->SetObjectField(s, name_color_fieldID, next); env->DeleteLocalRef(next); } }
  if (default_icon_ != nullptr) { jobject next; default_icon_->store(env, next); if (next) { env->SetObjectField(s, default_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (ios_static_icon_ != nullptr) { jobject next; ios_static_icon_->store(env, next); if (next) { env->SetObjectField(s, ios_static_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (ios_animated_icon_ != nullptr) { jobject next; ios_animated_icon_->store(env, next); if (next) { env->SetObjectField(s, ios_animated_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (ios_side_menu_icon_ != nullptr) { jobject next; ios_side_menu_icon_->store(env, next); if (next) { env->SetObjectField(s, ios_side_menu_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (android_icon_ != nullptr) { jobject next; android_icon_->store(env, next); if (next) { env->SetObjectField(s, android_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (android_side_menu_icon_ != nullptr) { jobject next; android_side_menu_icon_->store(env, next); if (next) { env->SetObjectField(s, android_side_menu_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (macos_icon_ != nullptr) { jobject next; macos_icon_->store(env, next); if (next) { env->SetObjectField(s, macos_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (macos_side_menu_icon_ != nullptr) { jobject next; macos_side_menu_icon_->store(env, next); if (next) { env->SetObjectField(s, macos_side_menu_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (icon_color_ != nullptr) { jobject next; icon_color_->store(env, next); if (next) { env->SetObjectField(s, icon_color_fieldID, next); env->DeleteLocalRef(next); } }
  if (web_app_placeholder_ != nullptr) { jobject next; web_app_placeholder_->store(env, next); if (next) { env->SetObjectField(s, web_app_placeholder_fieldID, next); env->DeleteLocalRef(next); } }
}

void attachmentMenuBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AttachmentMenuBot");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("supportsSelfChat", supports_self_chat_);
    s.store_field("supportsUserChats", supports_user_chats_);
    s.store_field("supportsBotChats", supports_bot_chats_);
    s.store_field("supportsGroupChats", supports_group_chats_);
    s.store_field("supportsChannelChats", supports_channel_chats_);
    s.store_field("requestWriteAccess", request_write_access_);
    s.store_field("isAdded", is_added_);
    s.store_field("showInAttachmentMenu", show_in_attachment_menu_);
    s.store_field("showInSideMenu", show_in_side_menu_);
    s.store_field("showDisclaimerInSideMenu", show_disclaimer_in_side_menu_);
    s.store_field("name", name_);
    s.store_object_field("nameColor", static_cast<const BaseObject *>(name_color_.get()));
    s.store_object_field("defaultIcon", static_cast<const BaseObject *>(default_icon_.get()));
    s.store_object_field("iosStaticIcon", static_cast<const BaseObject *>(ios_static_icon_.get()));
    s.store_object_field("iosAnimatedIcon", static_cast<const BaseObject *>(ios_animated_icon_.get()));
    s.store_object_field("iosSideMenuIcon", static_cast<const BaseObject *>(ios_side_menu_icon_.get()));
    s.store_object_field("androidIcon", static_cast<const BaseObject *>(android_icon_.get()));
    s.store_object_field("androidSideMenuIcon", static_cast<const BaseObject *>(android_side_menu_icon_.get()));
    s.store_object_field("macosIcon", static_cast<const BaseObject *>(macos_icon_.get()));
    s.store_object_field("macosSideMenuIcon", static_cast<const BaseObject *>(macos_side_menu_icon_.get()));
    s.store_object_field("iconColor", static_cast<const BaseObject *>(icon_color_.get()));
    s.store_object_field("webAppPlaceholder", static_cast<const BaseObject *>(web_app_placeholder_.get()));
    s.store_class_end();
  }
}

void attachmentMenuBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AttachmentMenuBot").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    supports_self_chat_fieldID = jni::get_field_id(env, Class, "supportsSelfChat", "Z");
    supports_user_chats_fieldID = jni::get_field_id(env, Class, "supportsUserChats", "Z");
    supports_bot_chats_fieldID = jni::get_field_id(env, Class, "supportsBotChats", "Z");
    supports_group_chats_fieldID = jni::get_field_id(env, Class, "supportsGroupChats", "Z");
    supports_channel_chats_fieldID = jni::get_field_id(env, Class, "supportsChannelChats", "Z");
    request_write_access_fieldID = jni::get_field_id(env, Class, "requestWriteAccess", "Z");
    is_added_fieldID = jni::get_field_id(env, Class, "isAdded", "Z");
    show_in_attachment_menu_fieldID = jni::get_field_id(env, Class, "showInAttachmentMenu", "Z");
    show_in_side_menu_fieldID = jni::get_field_id(env, Class, "showInSideMenu", "Z");
    show_disclaimer_in_side_menu_fieldID = jni::get_field_id(env, Class, "showDisclaimerInSideMenu", "Z");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    name_color_fieldID = jni::get_field_id(env, Class, "nameColor", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AttachmentMenuBotColor;").c_str());
    default_icon_fieldID = jni::get_field_id(env, Class, "defaultIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    ios_static_icon_fieldID = jni::get_field_id(env, Class, "iosStaticIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    ios_animated_icon_fieldID = jni::get_field_id(env, Class, "iosAnimatedIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    ios_side_menu_icon_fieldID = jni::get_field_id(env, Class, "iosSideMenuIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    android_icon_fieldID = jni::get_field_id(env, Class, "androidIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    android_side_menu_icon_fieldID = jni::get_field_id(env, Class, "androidSideMenuIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    macos_icon_fieldID = jni::get_field_id(env, Class, "macosIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    macos_side_menu_icon_fieldID = jni::get_field_id(env, Class, "macosSideMenuIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    icon_color_fieldID = jni::get_field_id(env, Class, "iconColor", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AttachmentMenuBotColor;").c_str());
    web_app_placeholder_fieldID = jni::get_field_id(env, Class, "webAppPlaceholder", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass audios::Class;
jfieldID audios::total_count_fieldID;
jfieldID audios::audios_fieldID;

audios::audios()
  : total_count_()
  , audios_()
{}

audios::audios(int32 total_count_, array<object_ptr<audio>> &&audios_)
  : total_count_(total_count_)
  , audios_(std::move(audios_))
{}

const std::int32_t audios::ID;

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

void audios::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, audios_); if (arr_tmp_) { env->SetObjectField(s, audios_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

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

jclass BusinessAwayMessageSchedule::Class;

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

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

jclass businessAwayMessageScheduleAlways::Class;

businessAwayMessageScheduleAlways::businessAwayMessageScheduleAlways() {
}

const std::int32_t businessAwayMessageScheduleAlways::ID;

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

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

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

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

jclass businessAwayMessageScheduleOutsideOfOpeningHours::Class;

businessAwayMessageScheduleOutsideOfOpeningHours::businessAwayMessageScheduleOutsideOfOpeningHours() {
}

const std::int32_t businessAwayMessageScheduleOutsideOfOpeningHours::ID;

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

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

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

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

jclass businessAwayMessageScheduleCustom::Class;
jfieldID businessAwayMessageScheduleCustom::start_date_fieldID;
jfieldID businessAwayMessageScheduleCustom::end_date_fieldID;

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

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

const std::int32_t businessAwayMessageScheduleCustom::ID;

object_ptr<BusinessAwayMessageSchedule> businessAwayMessageScheduleCustom::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessAwayMessageScheduleCustom> res = make_object<businessAwayMessageScheduleCustom>();
  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 businessAwayMessageScheduleCustom::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 businessAwayMessageScheduleCustom::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessAwayMessageScheduleCustom");
    s.store_field("startDate", start_date_);
    s.store_field("endDate", end_date_);
    s.store_class_end();
  }
}

void businessAwayMessageScheduleCustom::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessAwayMessageScheduleCustom").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 businessInfo::Class;
jfieldID businessInfo::location_fieldID;
jfieldID businessInfo::opening_hours_fieldID;
jfieldID businessInfo::local_opening_hours_fieldID;
jfieldID businessInfo::next_open_in_fieldID;
jfieldID businessInfo::next_close_in_fieldID;
jfieldID businessInfo::greeting_message_settings_fieldID;
jfieldID businessInfo::away_message_settings_fieldID;
jfieldID businessInfo::start_page_fieldID;

businessInfo::businessInfo()
  : location_()
  , opening_hours_()
  , local_opening_hours_()
  , next_open_in_()
  , next_close_in_()
  , greeting_message_settings_()
  , away_message_settings_()
  , start_page_()
{}

businessInfo::businessInfo(object_ptr<businessLocation> &&location_, object_ptr<businessOpeningHours> &&opening_hours_, object_ptr<businessOpeningHours> &&local_opening_hours_, int32 next_open_in_, int32 next_close_in_, object_ptr<businessGreetingMessageSettings> &&greeting_message_settings_, object_ptr<businessAwayMessageSettings> &&away_message_settings_, object_ptr<businessStartPage> &&start_page_)
  : location_(std::move(location_))
  , opening_hours_(std::move(opening_hours_))
  , local_opening_hours_(std::move(local_opening_hours_))
  , next_open_in_(next_open_in_)
  , next_close_in_(next_close_in_)
  , greeting_message_settings_(std::move(greeting_message_settings_))
  , away_message_settings_(std::move(away_message_settings_))
  , start_page_(std::move(start_page_))
{}

const std::int32_t businessInfo::ID;

object_ptr<businessInfo> businessInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessInfo> res = make_object<businessInfo>();
  res->location_ = jni::fetch_tl_object<businessLocation>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->opening_hours_ = jni::fetch_tl_object<businessOpeningHours>(env, jni::fetch_object(env, p, res->opening_hours_fieldID));
  res->local_opening_hours_ = jni::fetch_tl_object<businessOpeningHours>(env, jni::fetch_object(env, p, res->local_opening_hours_fieldID));
  res->next_open_in_ = env->GetIntField(p, res->next_open_in_fieldID);
  res->next_close_in_ = env->GetIntField(p, res->next_close_in_fieldID);
  res->greeting_message_settings_ = jni::fetch_tl_object<businessGreetingMessageSettings>(env, jni::fetch_object(env, p, res->greeting_message_settings_fieldID));
  res->away_message_settings_ = jni::fetch_tl_object<businessAwayMessageSettings>(env, jni::fetch_object(env, p, res->away_message_settings_fieldID));
  res->start_page_ = jni::fetch_tl_object<businessStartPage>(env, jni::fetch_object(env, p, res->start_page_fieldID));
  return res;
}

void businessInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  if (opening_hours_ != nullptr) { jobject next; opening_hours_->store(env, next); if (next) { env->SetObjectField(s, opening_hours_fieldID, next); env->DeleteLocalRef(next); } }
  if (local_opening_hours_ != nullptr) { jobject next; local_opening_hours_->store(env, next); if (next) { env->SetObjectField(s, local_opening_hours_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, next_open_in_fieldID, next_open_in_);
  env->SetIntField(s, next_close_in_fieldID, next_close_in_);
  if (greeting_message_settings_ != nullptr) { jobject next; greeting_message_settings_->store(env, next); if (next) { env->SetObjectField(s, greeting_message_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (away_message_settings_ != nullptr) { jobject next; away_message_settings_->store(env, next); if (next) { env->SetObjectField(s, away_message_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (start_page_ != nullptr) { jobject next; start_page_->store(env, next); if (next) { env->SetObjectField(s, start_page_fieldID, next); env->DeleteLocalRef(next); } }
}

void businessInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessInfo");
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_object_field("openingHours", static_cast<const BaseObject *>(opening_hours_.get()));
    s.store_object_field("localOpeningHours", static_cast<const BaseObject *>(local_opening_hours_.get()));
    s.store_field("nextOpenIn", next_open_in_);
    s.store_field("nextCloseIn", next_close_in_);
    s.store_object_field("greetingMessageSettings", static_cast<const BaseObject *>(greeting_message_settings_.get()));
    s.store_object_field("awayMessageSettings", static_cast<const BaseObject *>(away_message_settings_.get()));
    s.store_object_field("startPage", static_cast<const BaseObject *>(start_page_.get()));
    s.store_class_end();
  }
}

void businessInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessInfo").c_str());
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessLocation;").c_str());
    opening_hours_fieldID = jni::get_field_id(env, Class, "openingHours", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessOpeningHours;").c_str());
    local_opening_hours_fieldID = jni::get_field_id(env, Class, "localOpeningHours", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessOpeningHours;").c_str());
    next_open_in_fieldID = jni::get_field_id(env, Class, "nextOpenIn", "I");
    next_close_in_fieldID = jni::get_field_id(env, Class, "nextCloseIn", "I");
    greeting_message_settings_fieldID = jni::get_field_id(env, Class, "greetingMessageSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessGreetingMessageSettings;").c_str());
    away_message_settings_fieldID = jni::get_field_id(env, Class, "awayMessageSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessAwayMessageSettings;").c_str());
    start_page_fieldID = jni::get_field_id(env, Class, "startPage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessStartPage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass businessMessage::Class;
jfieldID businessMessage::message_fieldID;
jfieldID businessMessage::reply_to_message_fieldID;

businessMessage::businessMessage()
  : message_()
  , reply_to_message_()
{}

businessMessage::businessMessage(object_ptr<message> &&message_, object_ptr<message> &&reply_to_message_)
  : message_(std::move(message_))
  , reply_to_message_(std::move(reply_to_message_))
{}

const std::int32_t businessMessage::ID;

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

void businessMessage::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); } }
  if (reply_to_message_ != nullptr) { jobject next; reply_to_message_->store(env, next); if (next) { env->SetObjectField(s, reply_to_message_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass ChatEventAction::Class;

object_ptr<ChatEventAction> ChatEventAction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case chatEventMessageEdited::ID:
      return chatEventMessageEdited::fetch(env, p);
    case chatEventMessageDeleted::ID:
      return chatEventMessageDeleted::fetch(env, p);
    case chatEventMessagePinned::ID:
      return chatEventMessagePinned::fetch(env, p);
    case chatEventMessageUnpinned::ID:
      return chatEventMessageUnpinned::fetch(env, p);
    case chatEventPollStopped::ID:
      return chatEventPollStopped::fetch(env, p);
    case chatEventMemberJoined::ID:
      return chatEventMemberJoined::fetch(env, p);
    case chatEventMemberJoinedByInviteLink::ID:
      return chatEventMemberJoinedByInviteLink::fetch(env, p);
    case chatEventMemberJoinedByRequest::ID:
      return chatEventMemberJoinedByRequest::fetch(env, p);
    case chatEventMemberInvited::ID:
      return chatEventMemberInvited::fetch(env, p);
    case chatEventMemberLeft::ID:
      return chatEventMemberLeft::fetch(env, p);
    case chatEventMemberPromoted::ID:
      return chatEventMemberPromoted::fetch(env, p);
    case chatEventMemberRestricted::ID:
      return chatEventMemberRestricted::fetch(env, p);
    case chatEventMemberTagChanged::ID:
      return chatEventMemberTagChanged::fetch(env, p);
    case chatEventMemberSubscriptionExtended::ID:
      return chatEventMemberSubscriptionExtended::fetch(env, p);
    case chatEventAvailableReactionsChanged::ID:
      return chatEventAvailableReactionsChanged::fetch(env, p);
    case chatEventBackgroundChanged::ID:
      return chatEventBackgroundChanged::fetch(env, p);
    case chatEventDescriptionChanged::ID:
      return chatEventDescriptionChanged::fetch(env, p);
    case chatEventEmojiStatusChanged::ID:
      return chatEventEmojiStatusChanged::fetch(env, p);
    case chatEventLinkedChatChanged::ID:
      return chatEventLinkedChatChanged::fetch(env, p);
    case chatEventLocationChanged::ID:
      return chatEventLocationChanged::fetch(env, p);
    case chatEventMessageAutoDeleteTimeChanged::ID:
      return chatEventMessageAutoDeleteTimeChanged::fetch(env, p);
    case chatEventPermissionsChanged::ID:
      return chatEventPermissionsChanged::fetch(env, p);
    case chatEventPhotoChanged::ID:
      return chatEventPhotoChanged::fetch(env, p);
    case chatEventSlowModeDelayChanged::ID:
      return chatEventSlowModeDelayChanged::fetch(env, p);
    case chatEventStickerSetChanged::ID:
      return chatEventStickerSetChanged::fetch(env, p);
    case chatEventCustomEmojiStickerSetChanged::ID:
      return chatEventCustomEmojiStickerSetChanged::fetch(env, p);
    case chatEventTitleChanged::ID:
      return chatEventTitleChanged::fetch(env, p);
    case chatEventUsernameChanged::ID:
      return chatEventUsernameChanged::fetch(env, p);
    case chatEventActiveUsernamesChanged::ID:
      return chatEventActiveUsernamesChanged::fetch(env, p);
    case chatEventAccentColorChanged::ID:
      return chatEventAccentColorChanged::fetch(env, p);
    case chatEventProfileAccentColorChanged::ID:
      return chatEventProfileAccentColorChanged::fetch(env, p);
    case chatEventHasProtectedContentToggled::ID:
      return chatEventHasProtectedContentToggled::fetch(env, p);
    case chatEventInvitesToggled::ID:
      return chatEventInvitesToggled::fetch(env, p);
    case chatEventIsAllHistoryAvailableToggled::ID:
      return chatEventIsAllHistoryAvailableToggled::fetch(env, p);
    case chatEventHasAggressiveAntiSpamEnabledToggled::ID:
      return chatEventHasAggressiveAntiSpamEnabledToggled::fetch(env, p);
    case chatEventSignMessagesToggled::ID:
      return chatEventSignMessagesToggled::fetch(env, p);
    case chatEventShowMessageSenderToggled::ID:
      return chatEventShowMessageSenderToggled::fetch(env, p);
    case chatEventAutomaticTranslationToggled::ID:
      return chatEventAutomaticTranslationToggled::fetch(env, p);
    case chatEventInviteLinkEdited::ID:
      return chatEventInviteLinkEdited::fetch(env, p);
    case chatEventInviteLinkRevoked::ID:
      return chatEventInviteLinkRevoked::fetch(env, p);
    case chatEventInviteLinkDeleted::ID:
      return chatEventInviteLinkDeleted::fetch(env, p);
    case chatEventVideoChatCreated::ID:
      return chatEventVideoChatCreated::fetch(env, p);
    case chatEventVideoChatEnded::ID:
      return chatEventVideoChatEnded::fetch(env, p);
    case chatEventVideoChatMuteNewParticipantsToggled::ID:
      return chatEventVideoChatMuteNewParticipantsToggled::fetch(env, p);
    case chatEventVideoChatParticipantIsMutedToggled::ID:
      return chatEventVideoChatParticipantIsMutedToggled::fetch(env, p);
    case chatEventVideoChatParticipantVolumeLevelChanged::ID:
      return chatEventVideoChatParticipantVolumeLevelChanged::fetch(env, p);
    case chatEventIsForumToggled::ID:
      return chatEventIsForumToggled::fetch(env, p);
    case chatEventForumTopicCreated::ID:
      return chatEventForumTopicCreated::fetch(env, p);
    case chatEventForumTopicEdited::ID:
      return chatEventForumTopicEdited::fetch(env, p);
    case chatEventForumTopicToggleIsClosed::ID:
      return chatEventForumTopicToggleIsClosed::fetch(env, p);
    case chatEventForumTopicToggleIsHidden::ID:
      return chatEventForumTopicToggleIsHidden::fetch(env, p);
    case chatEventForumTopicDeleted::ID:
      return chatEventForumTopicDeleted::fetch(env, p);
    case chatEventForumTopicPinned::ID:
      return chatEventForumTopicPinned::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass chatEventMessageEdited::Class;
jfieldID chatEventMessageEdited::old_message_fieldID;
jfieldID chatEventMessageEdited::new_message_fieldID;

chatEventMessageEdited::chatEventMessageEdited()
  : old_message_()
  , new_message_()
{}

chatEventMessageEdited::chatEventMessageEdited(object_ptr<message> &&old_message_, object_ptr<message> &&new_message_)
  : old_message_(std::move(old_message_))
  , new_message_(std::move(new_message_))
{}

const std::int32_t chatEventMessageEdited::ID;

object_ptr<ChatEventAction> chatEventMessageEdited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMessageEdited> res = make_object<chatEventMessageEdited>();
  res->old_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->old_message_fieldID));
  res->new_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->new_message_fieldID));
  return std::move(res);
}

void chatEventMessageEdited::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_message_ != nullptr) { jobject next; old_message_->store(env, next); if (next) { env->SetObjectField(s, old_message_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_message_ != nullptr) { jobject next; new_message_->store(env, next); if (next) { env->SetObjectField(s, new_message_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventMessageEdited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMessageEdited");
    s.store_object_field("oldMessage", static_cast<const BaseObject *>(old_message_.get()));
    s.store_object_field("newMessage", static_cast<const BaseObject *>(new_message_.get()));
    s.store_class_end();
  }
}

void chatEventMessageEdited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMessageEdited").c_str());
    old_message_fieldID = jni::get_field_id(env, Class, "oldMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    new_message_fieldID = jni::get_field_id(env, Class, "newMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMessageDeleted::Class;
jfieldID chatEventMessageDeleted::message_fieldID;
jfieldID chatEventMessageDeleted::can_report_anti_spam_false_positive_fieldID;

chatEventMessageDeleted::chatEventMessageDeleted()
  : message_()
  , can_report_anti_spam_false_positive_()
{}

chatEventMessageDeleted::chatEventMessageDeleted(object_ptr<message> &&message_, bool can_report_anti_spam_false_positive_)
  : message_(std::move(message_))
  , can_report_anti_spam_false_positive_(can_report_anti_spam_false_positive_)
{}

const std::int32_t chatEventMessageDeleted::ID;

object_ptr<ChatEventAction> chatEventMessageDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMessageDeleted> res = make_object<chatEventMessageDeleted>();
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->can_report_anti_spam_false_positive_ = (env->GetBooleanField(p, res->can_report_anti_spam_false_positive_fieldID) != 0);
  return std::move(res);
}

void chatEventMessageDeleted::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->SetBooleanField(s, can_report_anti_spam_false_positive_fieldID, can_report_anti_spam_false_positive_);
}

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

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

jclass chatEventMessagePinned::Class;
jfieldID chatEventMessagePinned::message_fieldID;

chatEventMessagePinned::chatEventMessagePinned()
  : message_()
{}

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

const std::int32_t chatEventMessagePinned::ID;

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

void chatEventMessagePinned::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 chatEventMessagePinned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMessagePinned");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void chatEventMessagePinned::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMessagePinned").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 chatEventMessageUnpinned::Class;
jfieldID chatEventMessageUnpinned::message_fieldID;

chatEventMessageUnpinned::chatEventMessageUnpinned()
  : message_()
{}

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

const std::int32_t chatEventMessageUnpinned::ID;

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

void chatEventMessageUnpinned::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 chatEventMessageUnpinned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMessageUnpinned");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void chatEventMessageUnpinned::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMessageUnpinned").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 chatEventPollStopped::Class;
jfieldID chatEventPollStopped::message_fieldID;

chatEventPollStopped::chatEventPollStopped()
  : message_()
{}

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

const std::int32_t chatEventPollStopped::ID;

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

void chatEventPollStopped::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 chatEventPollStopped::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventPollStopped");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_class_end();
  }
}

void chatEventPollStopped::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventPollStopped").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 chatEventMemberJoined::Class;

chatEventMemberJoined::chatEventMemberJoined() {
}

const std::int32_t chatEventMemberJoined::ID;

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

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

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

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

jclass chatEventMemberJoinedByInviteLink::Class;
jfieldID chatEventMemberJoinedByInviteLink::invite_link_fieldID;
jfieldID chatEventMemberJoinedByInviteLink::via_chat_folder_invite_link_fieldID;

chatEventMemberJoinedByInviteLink::chatEventMemberJoinedByInviteLink()
  : invite_link_()
  , via_chat_folder_invite_link_()
{}

chatEventMemberJoinedByInviteLink::chatEventMemberJoinedByInviteLink(object_ptr<chatInviteLink> &&invite_link_, bool via_chat_folder_invite_link_)
  : invite_link_(std::move(invite_link_))
  , via_chat_folder_invite_link_(via_chat_folder_invite_link_)
{}

const std::int32_t chatEventMemberJoinedByInviteLink::ID;

object_ptr<ChatEventAction> chatEventMemberJoinedByInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberJoinedByInviteLink> res = make_object<chatEventMemberJoinedByInviteLink>();
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  res->via_chat_folder_invite_link_ = (env->GetBooleanField(p, res->via_chat_folder_invite_link_fieldID) != 0);
  return std::move(res);
}

void chatEventMemberJoinedByInviteLink::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  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_chat_folder_invite_link_fieldID, via_chat_folder_invite_link_);
}

void chatEventMemberJoinedByInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberJoinedByInviteLink");
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    s.store_field("viaChatFolderInviteLink", via_chat_folder_invite_link_);
    s.store_class_end();
  }
}

void chatEventMemberJoinedByInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberJoinedByInviteLink").c_str());
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    via_chat_folder_invite_link_fieldID = jni::get_field_id(env, Class, "viaChatFolderInviteLink", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMemberJoinedByRequest::Class;
jfieldID chatEventMemberJoinedByRequest::approver_user_id_fieldID;
jfieldID chatEventMemberJoinedByRequest::invite_link_fieldID;

chatEventMemberJoinedByRequest::chatEventMemberJoinedByRequest()
  : approver_user_id_()
  , invite_link_()
{}

chatEventMemberJoinedByRequest::chatEventMemberJoinedByRequest(int53 approver_user_id_, object_ptr<chatInviteLink> &&invite_link_)
  : approver_user_id_(approver_user_id_)
  , invite_link_(std::move(invite_link_))
{}

const std::int32_t chatEventMemberJoinedByRequest::ID;

object_ptr<ChatEventAction> chatEventMemberJoinedByRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberJoinedByRequest> res = make_object<chatEventMemberJoinedByRequest>();
  res->approver_user_id_ = env->GetLongField(p, res->approver_user_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 chatEventMemberJoinedByRequest::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, approver_user_id_fieldID, approver_user_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 chatEventMemberJoinedByRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberJoinedByRequest");
    s.store_field("approverUserId", approver_user_id_);
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    s.store_class_end();
  }
}

void chatEventMemberJoinedByRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberJoinedByRequest").c_str());
    approver_user_id_fieldID = jni::get_field_id(env, Class, "approverUserId", "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 chatEventMemberInvited::Class;
jfieldID chatEventMemberInvited::user_id_fieldID;
jfieldID chatEventMemberInvited::status_fieldID;

chatEventMemberInvited::chatEventMemberInvited()
  : user_id_()
  , status_()
{}

chatEventMemberInvited::chatEventMemberInvited(int53 user_id_, object_ptr<ChatMemberStatus> &&status_)
  : user_id_(user_id_)
  , status_(std::move(status_))
{}

const std::int32_t chatEventMemberInvited::ID;

object_ptr<ChatEventAction> chatEventMemberInvited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberInvited> res = make_object<chatEventMemberInvited>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  return std::move(res);
}

void chatEventMemberInvited::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 chatEventMemberInvited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberInvited");
    s.store_field("userId", user_id_);
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_class_end();
  }
}

void chatEventMemberInvited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberInvited").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$ChatMemberStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMemberLeft::Class;

chatEventMemberLeft::chatEventMemberLeft() {
}

const std::int32_t chatEventMemberLeft::ID;

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

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

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

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

jclass chatEventMemberPromoted::Class;
jfieldID chatEventMemberPromoted::user_id_fieldID;
jfieldID chatEventMemberPromoted::old_status_fieldID;
jfieldID chatEventMemberPromoted::new_status_fieldID;

chatEventMemberPromoted::chatEventMemberPromoted()
  : user_id_()
  , old_status_()
  , new_status_()
{}

chatEventMemberPromoted::chatEventMemberPromoted(int53 user_id_, object_ptr<ChatMemberStatus> &&old_status_, object_ptr<ChatMemberStatus> &&new_status_)
  : user_id_(user_id_)
  , old_status_(std::move(old_status_))
  , new_status_(std::move(new_status_))
{}

const std::int32_t chatEventMemberPromoted::ID;

object_ptr<ChatEventAction> chatEventMemberPromoted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberPromoted> res = make_object<chatEventMemberPromoted>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->old_status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->old_status_fieldID));
  res->new_status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->new_status_fieldID));
  return std::move(res);
}

void chatEventMemberPromoted::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 (old_status_ != nullptr) { jobject next; old_status_->store(env, next); if (next) { env->SetObjectField(s, old_status_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_status_ != nullptr) { jobject next; new_status_->store(env, next); if (next) { env->SetObjectField(s, new_status_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventMemberPromoted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberPromoted");
    s.store_field("userId", user_id_);
    s.store_object_field("oldStatus", static_cast<const BaseObject *>(old_status_.get()));
    s.store_object_field("newStatus", static_cast<const BaseObject *>(new_status_.get()));
    s.store_class_end();
  }
}

void chatEventMemberPromoted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberPromoted").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    old_status_fieldID = jni::get_field_id(env, Class, "oldStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    new_status_fieldID = jni::get_field_id(env, Class, "newStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMemberRestricted::Class;
jfieldID chatEventMemberRestricted::member_id_fieldID;
jfieldID chatEventMemberRestricted::old_status_fieldID;
jfieldID chatEventMemberRestricted::new_status_fieldID;

chatEventMemberRestricted::chatEventMemberRestricted()
  : member_id_()
  , old_status_()
  , new_status_()
{}

chatEventMemberRestricted::chatEventMemberRestricted(object_ptr<MessageSender> &&member_id_, object_ptr<ChatMemberStatus> &&old_status_, object_ptr<ChatMemberStatus> &&new_status_)
  : member_id_(std::move(member_id_))
  , old_status_(std::move(old_status_))
  , new_status_(std::move(new_status_))
{}

const std::int32_t chatEventMemberRestricted::ID;

object_ptr<ChatEventAction> chatEventMemberRestricted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberRestricted> res = make_object<chatEventMemberRestricted>();
  res->member_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->member_id_fieldID));
  res->old_status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->old_status_fieldID));
  res->new_status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->new_status_fieldID));
  return std::move(res);
}

void chatEventMemberRestricted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (member_id_ != nullptr) { jobject next; member_id_->store(env, next); if (next) { env->SetObjectField(s, member_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (old_status_ != nullptr) { jobject next; old_status_->store(env, next); if (next) { env->SetObjectField(s, old_status_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_status_ != nullptr) { jobject next; new_status_->store(env, next); if (next) { env->SetObjectField(s, new_status_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventMemberRestricted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberRestricted");
    s.store_object_field("memberId", static_cast<const BaseObject *>(member_id_.get()));
    s.store_object_field("oldStatus", static_cast<const BaseObject *>(old_status_.get()));
    s.store_object_field("newStatus", static_cast<const BaseObject *>(new_status_.get()));
    s.store_class_end();
  }
}

void chatEventMemberRestricted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberRestricted").c_str());
    member_id_fieldID = jni::get_field_id(env, Class, "memberId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    old_status_fieldID = jni::get_field_id(env, Class, "oldStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    new_status_fieldID = jni::get_field_id(env, Class, "newStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMemberTagChanged::Class;
jfieldID chatEventMemberTagChanged::user_id_fieldID;
jfieldID chatEventMemberTagChanged::old_tag_fieldID;
jfieldID chatEventMemberTagChanged::new_tag_fieldID;

chatEventMemberTagChanged::chatEventMemberTagChanged()
  : user_id_()
  , old_tag_()
  , new_tag_()
{}

chatEventMemberTagChanged::chatEventMemberTagChanged(int53 user_id_, string const &old_tag_, string const &new_tag_)
  : user_id_(user_id_)
  , old_tag_(old_tag_)
  , new_tag_(new_tag_)
{}

const std::int32_t chatEventMemberTagChanged::ID;

object_ptr<ChatEventAction> chatEventMemberTagChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberTagChanged> res = make_object<chatEventMemberTagChanged>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->old_tag_ = jni::fetch_string(env, p, res->old_tag_fieldID);
  res->new_tag_ = jni::fetch_string(env, p, res->new_tag_fieldID);
  return std::move(res);
}

void chatEventMemberTagChanged::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, old_tag_); if (nextString) { env->SetObjectField(s, old_tag_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, new_tag_); if (nextString) { env->SetObjectField(s, new_tag_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chatEventMemberTagChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberTagChanged");
    s.store_field("userId", user_id_);
    s.store_field("oldTag", old_tag_);
    s.store_field("newTag", new_tag_);
    s.store_class_end();
  }
}

void chatEventMemberTagChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberTagChanged").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    old_tag_fieldID = jni::get_field_id(env, Class, "oldTag", "Ljava/lang/String;");
    new_tag_fieldID = jni::get_field_id(env, Class, "newTag", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMemberSubscriptionExtended::Class;
jfieldID chatEventMemberSubscriptionExtended::user_id_fieldID;
jfieldID chatEventMemberSubscriptionExtended::old_status_fieldID;
jfieldID chatEventMemberSubscriptionExtended::new_status_fieldID;

chatEventMemberSubscriptionExtended::chatEventMemberSubscriptionExtended()
  : user_id_()
  , old_status_()
  , new_status_()
{}

chatEventMemberSubscriptionExtended::chatEventMemberSubscriptionExtended(int53 user_id_, object_ptr<ChatMemberStatus> &&old_status_, object_ptr<ChatMemberStatus> &&new_status_)
  : user_id_(user_id_)
  , old_status_(std::move(old_status_))
  , new_status_(std::move(new_status_))
{}

const std::int32_t chatEventMemberSubscriptionExtended::ID;

object_ptr<ChatEventAction> chatEventMemberSubscriptionExtended::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMemberSubscriptionExtended> res = make_object<chatEventMemberSubscriptionExtended>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->old_status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->old_status_fieldID));
  res->new_status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->new_status_fieldID));
  return std::move(res);
}

void chatEventMemberSubscriptionExtended::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 (old_status_ != nullptr) { jobject next; old_status_->store(env, next); if (next) { env->SetObjectField(s, old_status_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_status_ != nullptr) { jobject next; new_status_->store(env, next); if (next) { env->SetObjectField(s, new_status_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventMemberSubscriptionExtended::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMemberSubscriptionExtended");
    s.store_field("userId", user_id_);
    s.store_object_field("oldStatus", static_cast<const BaseObject *>(old_status_.get()));
    s.store_object_field("newStatus", static_cast<const BaseObject *>(new_status_.get()));
    s.store_class_end();
  }
}

void chatEventMemberSubscriptionExtended::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMemberSubscriptionExtended").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    old_status_fieldID = jni::get_field_id(env, Class, "oldStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    new_status_fieldID = jni::get_field_id(env, Class, "newStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventAvailableReactionsChanged::Class;
jfieldID chatEventAvailableReactionsChanged::old_available_reactions_fieldID;
jfieldID chatEventAvailableReactionsChanged::new_available_reactions_fieldID;

chatEventAvailableReactionsChanged::chatEventAvailableReactionsChanged()
  : old_available_reactions_()
  , new_available_reactions_()
{}

chatEventAvailableReactionsChanged::chatEventAvailableReactionsChanged(object_ptr<ChatAvailableReactions> &&old_available_reactions_, object_ptr<ChatAvailableReactions> &&new_available_reactions_)
  : old_available_reactions_(std::move(old_available_reactions_))
  , new_available_reactions_(std::move(new_available_reactions_))
{}

const std::int32_t chatEventAvailableReactionsChanged::ID;

object_ptr<ChatEventAction> chatEventAvailableReactionsChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventAvailableReactionsChanged> res = make_object<chatEventAvailableReactionsChanged>();
  res->old_available_reactions_ = jni::fetch_tl_object<ChatAvailableReactions>(env, jni::fetch_object(env, p, res->old_available_reactions_fieldID));
  res->new_available_reactions_ = jni::fetch_tl_object<ChatAvailableReactions>(env, jni::fetch_object(env, p, res->new_available_reactions_fieldID));
  return std::move(res);
}

void chatEventAvailableReactionsChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_available_reactions_ != nullptr) { jobject next; old_available_reactions_->store(env, next); if (next) { env->SetObjectField(s, old_available_reactions_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_available_reactions_ != nullptr) { jobject next; new_available_reactions_->store(env, next); if (next) { env->SetObjectField(s, new_available_reactions_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventAvailableReactionsChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventAvailableReactionsChanged");
    s.store_object_field("oldAvailableReactions", static_cast<const BaseObject *>(old_available_reactions_.get()));
    s.store_object_field("newAvailableReactions", static_cast<const BaseObject *>(new_available_reactions_.get()));
    s.store_class_end();
  }
}

void chatEventAvailableReactionsChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventAvailableReactionsChanged").c_str());
    old_available_reactions_fieldID = jni::get_field_id(env, Class, "oldAvailableReactions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAvailableReactions;").c_str());
    new_available_reactions_fieldID = jni::get_field_id(env, Class, "newAvailableReactions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAvailableReactions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventBackgroundChanged::Class;
jfieldID chatEventBackgroundChanged::old_background_fieldID;
jfieldID chatEventBackgroundChanged::new_background_fieldID;

chatEventBackgroundChanged::chatEventBackgroundChanged()
  : old_background_()
  , new_background_()
{}

chatEventBackgroundChanged::chatEventBackgroundChanged(object_ptr<chatBackground> &&old_background_, object_ptr<chatBackground> &&new_background_)
  : old_background_(std::move(old_background_))
  , new_background_(std::move(new_background_))
{}

const std::int32_t chatEventBackgroundChanged::ID;

object_ptr<ChatEventAction> chatEventBackgroundChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventBackgroundChanged> res = make_object<chatEventBackgroundChanged>();
  res->old_background_ = jni::fetch_tl_object<chatBackground>(env, jni::fetch_object(env, p, res->old_background_fieldID));
  res->new_background_ = jni::fetch_tl_object<chatBackground>(env, jni::fetch_object(env, p, res->new_background_fieldID));
  return std::move(res);
}

void chatEventBackgroundChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_background_ != nullptr) { jobject next; old_background_->store(env, next); if (next) { env->SetObjectField(s, old_background_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_background_ != nullptr) { jobject next; new_background_->store(env, next); if (next) { env->SetObjectField(s, new_background_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventBackgroundChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventBackgroundChanged");
    s.store_object_field("oldBackground", static_cast<const BaseObject *>(old_background_.get()));
    s.store_object_field("newBackground", static_cast<const BaseObject *>(new_background_.get()));
    s.store_class_end();
  }
}

void chatEventBackgroundChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventBackgroundChanged").c_str());
    old_background_fieldID = jni::get_field_id(env, Class, "oldBackground", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBackground;").c_str());
    new_background_fieldID = jni::get_field_id(env, Class, "newBackground", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBackground;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventDescriptionChanged::Class;
jfieldID chatEventDescriptionChanged::old_description_fieldID;
jfieldID chatEventDescriptionChanged::new_description_fieldID;

chatEventDescriptionChanged::chatEventDescriptionChanged()
  : old_description_()
  , new_description_()
{}

chatEventDescriptionChanged::chatEventDescriptionChanged(string const &old_description_, string const &new_description_)
  : old_description_(old_description_)
  , new_description_(new_description_)
{}

const std::int32_t chatEventDescriptionChanged::ID;

object_ptr<ChatEventAction> chatEventDescriptionChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventDescriptionChanged> res = make_object<chatEventDescriptionChanged>();
  res->old_description_ = jni::fetch_string(env, p, res->old_description_fieldID);
  res->new_description_ = jni::fetch_string(env, p, res->new_description_fieldID);
  return std::move(res);
}

void chatEventDescriptionChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, old_description_); if (nextString) { env->SetObjectField(s, old_description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, new_description_); if (nextString) { env->SetObjectField(s, new_description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chatEventDescriptionChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventDescriptionChanged");
    s.store_field("oldDescription", old_description_);
    s.store_field("newDescription", new_description_);
    s.store_class_end();
  }
}

void chatEventDescriptionChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventDescriptionChanged").c_str());
    old_description_fieldID = jni::get_field_id(env, Class, "oldDescription", "Ljava/lang/String;");
    new_description_fieldID = jni::get_field_id(env, Class, "newDescription", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventEmojiStatusChanged::Class;
jfieldID chatEventEmojiStatusChanged::old_emoji_status_fieldID;
jfieldID chatEventEmojiStatusChanged::new_emoji_status_fieldID;

chatEventEmojiStatusChanged::chatEventEmojiStatusChanged()
  : old_emoji_status_()
  , new_emoji_status_()
{}

chatEventEmojiStatusChanged::chatEventEmojiStatusChanged(object_ptr<emojiStatus> &&old_emoji_status_, object_ptr<emojiStatus> &&new_emoji_status_)
  : old_emoji_status_(std::move(old_emoji_status_))
  , new_emoji_status_(std::move(new_emoji_status_))
{}

const std::int32_t chatEventEmojiStatusChanged::ID;

object_ptr<ChatEventAction> chatEventEmojiStatusChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventEmojiStatusChanged> res = make_object<chatEventEmojiStatusChanged>();
  res->old_emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->old_emoji_status_fieldID));
  res->new_emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->new_emoji_status_fieldID));
  return std::move(res);
}

void chatEventEmojiStatusChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_emoji_status_ != nullptr) { jobject next; old_emoji_status_->store(env, next); if (next) { env->SetObjectField(s, old_emoji_status_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_emoji_status_ != nullptr) { jobject next; new_emoji_status_->store(env, next); if (next) { env->SetObjectField(s, new_emoji_status_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventEmojiStatusChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventEmojiStatusChanged");
    s.store_object_field("oldEmojiStatus", static_cast<const BaseObject *>(old_emoji_status_.get()));
    s.store_object_field("newEmojiStatus", static_cast<const BaseObject *>(new_emoji_status_.get()));
    s.store_class_end();
  }
}

void chatEventEmojiStatusChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventEmojiStatusChanged").c_str());
    old_emoji_status_fieldID = jni::get_field_id(env, Class, "oldEmojiStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatus;").c_str());
    new_emoji_status_fieldID = jni::get_field_id(env, Class, "newEmojiStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventLinkedChatChanged::Class;
jfieldID chatEventLinkedChatChanged::old_linked_chat_id_fieldID;
jfieldID chatEventLinkedChatChanged::new_linked_chat_id_fieldID;

chatEventLinkedChatChanged::chatEventLinkedChatChanged()
  : old_linked_chat_id_()
  , new_linked_chat_id_()
{}

chatEventLinkedChatChanged::chatEventLinkedChatChanged(int53 old_linked_chat_id_, int53 new_linked_chat_id_)
  : old_linked_chat_id_(old_linked_chat_id_)
  , new_linked_chat_id_(new_linked_chat_id_)
{}

const std::int32_t chatEventLinkedChatChanged::ID;

object_ptr<ChatEventAction> chatEventLinkedChatChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventLinkedChatChanged> res = make_object<chatEventLinkedChatChanged>();
  res->old_linked_chat_id_ = env->GetLongField(p, res->old_linked_chat_id_fieldID);
  res->new_linked_chat_id_ = env->GetLongField(p, res->new_linked_chat_id_fieldID);
  return std::move(res);
}

void chatEventLinkedChatChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, old_linked_chat_id_fieldID, old_linked_chat_id_);
  env->SetLongField(s, new_linked_chat_id_fieldID, new_linked_chat_id_);
}

void chatEventLinkedChatChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventLinkedChatChanged");
    s.store_field("oldLinkedChatId", old_linked_chat_id_);
    s.store_field("newLinkedChatId", new_linked_chat_id_);
    s.store_class_end();
  }
}

void chatEventLinkedChatChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventLinkedChatChanged").c_str());
    old_linked_chat_id_fieldID = jni::get_field_id(env, Class, "oldLinkedChatId", "J");
    new_linked_chat_id_fieldID = jni::get_field_id(env, Class, "newLinkedChatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventLocationChanged::Class;
jfieldID chatEventLocationChanged::old_location_fieldID;
jfieldID chatEventLocationChanged::new_location_fieldID;

chatEventLocationChanged::chatEventLocationChanged()
  : old_location_()
  , new_location_()
{}

chatEventLocationChanged::chatEventLocationChanged(object_ptr<chatLocation> &&old_location_, object_ptr<chatLocation> &&new_location_)
  : old_location_(std::move(old_location_))
  , new_location_(std::move(new_location_))
{}

const std::int32_t chatEventLocationChanged::ID;

object_ptr<ChatEventAction> chatEventLocationChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventLocationChanged> res = make_object<chatEventLocationChanged>();
  res->old_location_ = jni::fetch_tl_object<chatLocation>(env, jni::fetch_object(env, p, res->old_location_fieldID));
  res->new_location_ = jni::fetch_tl_object<chatLocation>(env, jni::fetch_object(env, p, res->new_location_fieldID));
  return std::move(res);
}

void chatEventLocationChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_location_ != nullptr) { jobject next; old_location_->store(env, next); if (next) { env->SetObjectField(s, old_location_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_location_ != nullptr) { jobject next; new_location_->store(env, next); if (next) { env->SetObjectField(s, new_location_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventLocationChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventLocationChanged");
    s.store_object_field("oldLocation", static_cast<const BaseObject *>(old_location_.get()));
    s.store_object_field("newLocation", static_cast<const BaseObject *>(new_location_.get()));
    s.store_class_end();
  }
}

void chatEventLocationChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventLocationChanged").c_str());
    old_location_fieldID = jni::get_field_id(env, Class, "oldLocation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatLocation;").c_str());
    new_location_fieldID = jni::get_field_id(env, Class, "newLocation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatLocation;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventMessageAutoDeleteTimeChanged::Class;
jfieldID chatEventMessageAutoDeleteTimeChanged::old_message_auto_delete_time_fieldID;
jfieldID chatEventMessageAutoDeleteTimeChanged::new_message_auto_delete_time_fieldID;

chatEventMessageAutoDeleteTimeChanged::chatEventMessageAutoDeleteTimeChanged()
  : old_message_auto_delete_time_()
  , new_message_auto_delete_time_()
{}

chatEventMessageAutoDeleteTimeChanged::chatEventMessageAutoDeleteTimeChanged(int32 old_message_auto_delete_time_, int32 new_message_auto_delete_time_)
  : old_message_auto_delete_time_(old_message_auto_delete_time_)
  , new_message_auto_delete_time_(new_message_auto_delete_time_)
{}

const std::int32_t chatEventMessageAutoDeleteTimeChanged::ID;

object_ptr<ChatEventAction> chatEventMessageAutoDeleteTimeChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventMessageAutoDeleteTimeChanged> res = make_object<chatEventMessageAutoDeleteTimeChanged>();
  res->old_message_auto_delete_time_ = env->GetIntField(p, res->old_message_auto_delete_time_fieldID);
  res->new_message_auto_delete_time_ = env->GetIntField(p, res->new_message_auto_delete_time_fieldID);
  return std::move(res);
}

void chatEventMessageAutoDeleteTimeChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, old_message_auto_delete_time_fieldID, old_message_auto_delete_time_);
  env->SetIntField(s, new_message_auto_delete_time_fieldID, new_message_auto_delete_time_);
}

void chatEventMessageAutoDeleteTimeChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventMessageAutoDeleteTimeChanged");
    s.store_field("oldMessageAutoDeleteTime", old_message_auto_delete_time_);
    s.store_field("newMessageAutoDeleteTime", new_message_auto_delete_time_);
    s.store_class_end();
  }
}

void chatEventMessageAutoDeleteTimeChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventMessageAutoDeleteTimeChanged").c_str());
    old_message_auto_delete_time_fieldID = jni::get_field_id(env, Class, "oldMessageAutoDeleteTime", "I");
    new_message_auto_delete_time_fieldID = jni::get_field_id(env, Class, "newMessageAutoDeleteTime", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventPermissionsChanged::Class;
jfieldID chatEventPermissionsChanged::old_permissions_fieldID;
jfieldID chatEventPermissionsChanged::new_permissions_fieldID;

chatEventPermissionsChanged::chatEventPermissionsChanged()
  : old_permissions_()
  , new_permissions_()
{}

chatEventPermissionsChanged::chatEventPermissionsChanged(object_ptr<chatPermissions> &&old_permissions_, object_ptr<chatPermissions> &&new_permissions_)
  : old_permissions_(std::move(old_permissions_))
  , new_permissions_(std::move(new_permissions_))
{}

const std::int32_t chatEventPermissionsChanged::ID;

object_ptr<ChatEventAction> chatEventPermissionsChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventPermissionsChanged> res = make_object<chatEventPermissionsChanged>();
  res->old_permissions_ = jni::fetch_tl_object<chatPermissions>(env, jni::fetch_object(env, p, res->old_permissions_fieldID));
  res->new_permissions_ = jni::fetch_tl_object<chatPermissions>(env, jni::fetch_object(env, p, res->new_permissions_fieldID));
  return std::move(res);
}

void chatEventPermissionsChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_permissions_ != nullptr) { jobject next; old_permissions_->store(env, next); if (next) { env->SetObjectField(s, old_permissions_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_permissions_ != nullptr) { jobject next; new_permissions_->store(env, next); if (next) { env->SetObjectField(s, new_permissions_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventPermissionsChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventPermissionsChanged");
    s.store_object_field("oldPermissions", static_cast<const BaseObject *>(old_permissions_.get()));
    s.store_object_field("newPermissions", static_cast<const BaseObject *>(new_permissions_.get()));
    s.store_class_end();
  }
}

void chatEventPermissionsChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventPermissionsChanged").c_str());
    old_permissions_fieldID = jni::get_field_id(env, Class, "oldPermissions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPermissions;").c_str());
    new_permissions_fieldID = jni::get_field_id(env, Class, "newPermissions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPermissions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventPhotoChanged::Class;
jfieldID chatEventPhotoChanged::old_photo_fieldID;
jfieldID chatEventPhotoChanged::new_photo_fieldID;

chatEventPhotoChanged::chatEventPhotoChanged()
  : old_photo_()
  , new_photo_()
{}

chatEventPhotoChanged::chatEventPhotoChanged(object_ptr<chatPhoto> &&old_photo_, object_ptr<chatPhoto> &&new_photo_)
  : old_photo_(std::move(old_photo_))
  , new_photo_(std::move(new_photo_))
{}

const std::int32_t chatEventPhotoChanged::ID;

object_ptr<ChatEventAction> chatEventPhotoChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventPhotoChanged> res = make_object<chatEventPhotoChanged>();
  res->old_photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->old_photo_fieldID));
  res->new_photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->new_photo_fieldID));
  return std::move(res);
}

void chatEventPhotoChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_photo_ != nullptr) { jobject next; old_photo_->store(env, next); if (next) { env->SetObjectField(s, old_photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_photo_ != nullptr) { jobject next; new_photo_->store(env, next); if (next) { env->SetObjectField(s, new_photo_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventPhotoChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventPhotoChanged");
    s.store_object_field("oldPhoto", static_cast<const BaseObject *>(old_photo_.get()));
    s.store_object_field("newPhoto", static_cast<const BaseObject *>(new_photo_.get()));
    s.store_class_end();
  }
}

void chatEventPhotoChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventPhotoChanged").c_str());
    old_photo_fieldID = jni::get_field_id(env, Class, "oldPhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    new_photo_fieldID = jni::get_field_id(env, Class, "newPhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventSlowModeDelayChanged::Class;
jfieldID chatEventSlowModeDelayChanged::old_slow_mode_delay_fieldID;
jfieldID chatEventSlowModeDelayChanged::new_slow_mode_delay_fieldID;

chatEventSlowModeDelayChanged::chatEventSlowModeDelayChanged()
  : old_slow_mode_delay_()
  , new_slow_mode_delay_()
{}

chatEventSlowModeDelayChanged::chatEventSlowModeDelayChanged(int32 old_slow_mode_delay_, int32 new_slow_mode_delay_)
  : old_slow_mode_delay_(old_slow_mode_delay_)
  , new_slow_mode_delay_(new_slow_mode_delay_)
{}

const std::int32_t chatEventSlowModeDelayChanged::ID;

object_ptr<ChatEventAction> chatEventSlowModeDelayChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventSlowModeDelayChanged> res = make_object<chatEventSlowModeDelayChanged>();
  res->old_slow_mode_delay_ = env->GetIntField(p, res->old_slow_mode_delay_fieldID);
  res->new_slow_mode_delay_ = env->GetIntField(p, res->new_slow_mode_delay_fieldID);
  return std::move(res);
}

void chatEventSlowModeDelayChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, old_slow_mode_delay_fieldID, old_slow_mode_delay_);
  env->SetIntField(s, new_slow_mode_delay_fieldID, new_slow_mode_delay_);
}

void chatEventSlowModeDelayChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventSlowModeDelayChanged");
    s.store_field("oldSlowModeDelay", old_slow_mode_delay_);
    s.store_field("newSlowModeDelay", new_slow_mode_delay_);
    s.store_class_end();
  }
}

void chatEventSlowModeDelayChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventSlowModeDelayChanged").c_str());
    old_slow_mode_delay_fieldID = jni::get_field_id(env, Class, "oldSlowModeDelay", "I");
    new_slow_mode_delay_fieldID = jni::get_field_id(env, Class, "newSlowModeDelay", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventStickerSetChanged::Class;
jfieldID chatEventStickerSetChanged::old_sticker_set_id_fieldID;
jfieldID chatEventStickerSetChanged::new_sticker_set_id_fieldID;

chatEventStickerSetChanged::chatEventStickerSetChanged()
  : old_sticker_set_id_()
  , new_sticker_set_id_()
{}

chatEventStickerSetChanged::chatEventStickerSetChanged(int64 old_sticker_set_id_, int64 new_sticker_set_id_)
  : old_sticker_set_id_(old_sticker_set_id_)
  , new_sticker_set_id_(new_sticker_set_id_)
{}

const std::int32_t chatEventStickerSetChanged::ID;

object_ptr<ChatEventAction> chatEventStickerSetChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventStickerSetChanged> res = make_object<chatEventStickerSetChanged>();
  res->old_sticker_set_id_ = env->GetLongField(p, res->old_sticker_set_id_fieldID);
  res->new_sticker_set_id_ = env->GetLongField(p, res->new_sticker_set_id_fieldID);
  return std::move(res);
}

void chatEventStickerSetChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, old_sticker_set_id_fieldID, old_sticker_set_id_);
  env->SetLongField(s, new_sticker_set_id_fieldID, new_sticker_set_id_);
}

void chatEventStickerSetChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventStickerSetChanged");
    s.store_field("oldStickerSetId", old_sticker_set_id_);
    s.store_field("newStickerSetId", new_sticker_set_id_);
    s.store_class_end();
  }
}

void chatEventStickerSetChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventStickerSetChanged").c_str());
    old_sticker_set_id_fieldID = jni::get_field_id(env, Class, "oldStickerSetId", "J");
    new_sticker_set_id_fieldID = jni::get_field_id(env, Class, "newStickerSetId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventCustomEmojiStickerSetChanged::Class;
jfieldID chatEventCustomEmojiStickerSetChanged::old_sticker_set_id_fieldID;
jfieldID chatEventCustomEmojiStickerSetChanged::new_sticker_set_id_fieldID;

chatEventCustomEmojiStickerSetChanged::chatEventCustomEmojiStickerSetChanged()
  : old_sticker_set_id_()
  , new_sticker_set_id_()
{}

chatEventCustomEmojiStickerSetChanged::chatEventCustomEmojiStickerSetChanged(int64 old_sticker_set_id_, int64 new_sticker_set_id_)
  : old_sticker_set_id_(old_sticker_set_id_)
  , new_sticker_set_id_(new_sticker_set_id_)
{}

const std::int32_t chatEventCustomEmojiStickerSetChanged::ID;

object_ptr<ChatEventAction> chatEventCustomEmojiStickerSetChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventCustomEmojiStickerSetChanged> res = make_object<chatEventCustomEmojiStickerSetChanged>();
  res->old_sticker_set_id_ = env->GetLongField(p, res->old_sticker_set_id_fieldID);
  res->new_sticker_set_id_ = env->GetLongField(p, res->new_sticker_set_id_fieldID);
  return std::move(res);
}

void chatEventCustomEmojiStickerSetChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, old_sticker_set_id_fieldID, old_sticker_set_id_);
  env->SetLongField(s, new_sticker_set_id_fieldID, new_sticker_set_id_);
}

void chatEventCustomEmojiStickerSetChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventCustomEmojiStickerSetChanged");
    s.store_field("oldStickerSetId", old_sticker_set_id_);
    s.store_field("newStickerSetId", new_sticker_set_id_);
    s.store_class_end();
  }
}

void chatEventCustomEmojiStickerSetChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventCustomEmojiStickerSetChanged").c_str());
    old_sticker_set_id_fieldID = jni::get_field_id(env, Class, "oldStickerSetId", "J");
    new_sticker_set_id_fieldID = jni::get_field_id(env, Class, "newStickerSetId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventTitleChanged::Class;
jfieldID chatEventTitleChanged::old_title_fieldID;
jfieldID chatEventTitleChanged::new_title_fieldID;

chatEventTitleChanged::chatEventTitleChanged()
  : old_title_()
  , new_title_()
{}

chatEventTitleChanged::chatEventTitleChanged(string const &old_title_, string const &new_title_)
  : old_title_(old_title_)
  , new_title_(new_title_)
{}

const std::int32_t chatEventTitleChanged::ID;

object_ptr<ChatEventAction> chatEventTitleChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventTitleChanged> res = make_object<chatEventTitleChanged>();
  res->old_title_ = jni::fetch_string(env, p, res->old_title_fieldID);
  res->new_title_ = jni::fetch_string(env, p, res->new_title_fieldID);
  return std::move(res);
}

void chatEventTitleChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, old_title_); if (nextString) { env->SetObjectField(s, old_title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, new_title_); if (nextString) { env->SetObjectField(s, new_title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chatEventTitleChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventTitleChanged");
    s.store_field("oldTitle", old_title_);
    s.store_field("newTitle", new_title_);
    s.store_class_end();
  }
}

void chatEventTitleChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventTitleChanged").c_str());
    old_title_fieldID = jni::get_field_id(env, Class, "oldTitle", "Ljava/lang/String;");
    new_title_fieldID = jni::get_field_id(env, Class, "newTitle", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventUsernameChanged::Class;
jfieldID chatEventUsernameChanged::old_username_fieldID;
jfieldID chatEventUsernameChanged::new_username_fieldID;

chatEventUsernameChanged::chatEventUsernameChanged()
  : old_username_()
  , new_username_()
{}

chatEventUsernameChanged::chatEventUsernameChanged(string const &old_username_, string const &new_username_)
  : old_username_(old_username_)
  , new_username_(new_username_)
{}

const std::int32_t chatEventUsernameChanged::ID;

object_ptr<ChatEventAction> chatEventUsernameChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventUsernameChanged> res = make_object<chatEventUsernameChanged>();
  res->old_username_ = jni::fetch_string(env, p, res->old_username_fieldID);
  res->new_username_ = jni::fetch_string(env, p, res->new_username_fieldID);
  return std::move(res);
}

void chatEventUsernameChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, old_username_); if (nextString) { env->SetObjectField(s, old_username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, new_username_); if (nextString) { env->SetObjectField(s, new_username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chatEventUsernameChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventUsernameChanged");
    s.store_field("oldUsername", old_username_);
    s.store_field("newUsername", new_username_);
    s.store_class_end();
  }
}

void chatEventUsernameChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventUsernameChanged").c_str());
    old_username_fieldID = jni::get_field_id(env, Class, "oldUsername", "Ljava/lang/String;");
    new_username_fieldID = jni::get_field_id(env, Class, "newUsername", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventActiveUsernamesChanged::Class;
jfieldID chatEventActiveUsernamesChanged::old_usernames_fieldID;
jfieldID chatEventActiveUsernamesChanged::new_usernames_fieldID;

chatEventActiveUsernamesChanged::chatEventActiveUsernamesChanged()
  : old_usernames_()
  , new_usernames_()
{}

chatEventActiveUsernamesChanged::chatEventActiveUsernamesChanged(array<string> &&old_usernames_, array<string> &&new_usernames_)
  : old_usernames_(std::move(old_usernames_))
  , new_usernames_(std::move(new_usernames_))
{}

const std::int32_t chatEventActiveUsernamesChanged::ID;

object_ptr<ChatEventAction> chatEventActiveUsernamesChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventActiveUsernamesChanged> res = make_object<chatEventActiveUsernamesChanged>();
  res->old_usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->old_usernames_fieldID));
  res->new_usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->new_usernames_fieldID));
  return std::move(res);
}

void chatEventActiveUsernamesChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, old_usernames_); if (arr_tmp_) { env->SetObjectField(s, old_usernames_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, new_usernames_); if (arr_tmp_) { env->SetObjectField(s, new_usernames_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void chatEventActiveUsernamesChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventActiveUsernamesChanged");
    { s.store_vector_begin("oldUsernames", old_usernames_.size()); for (const auto &_value : old_usernames_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("newUsernames", new_usernames_.size()); for (const auto &_value : new_usernames_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void chatEventActiveUsernamesChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventActiveUsernamesChanged").c_str());
    old_usernames_fieldID = jni::get_field_id(env, Class, "oldUsernames", "[Ljava/lang/String;");
    new_usernames_fieldID = jni::get_field_id(env, Class, "newUsernames", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventAccentColorChanged::Class;
jfieldID chatEventAccentColorChanged::old_accent_color_id_fieldID;
jfieldID chatEventAccentColorChanged::old_background_custom_emoji_id_fieldID;
jfieldID chatEventAccentColorChanged::new_accent_color_id_fieldID;
jfieldID chatEventAccentColorChanged::new_background_custom_emoji_id_fieldID;

chatEventAccentColorChanged::chatEventAccentColorChanged()
  : old_accent_color_id_()
  , old_background_custom_emoji_id_()
  , new_accent_color_id_()
  , new_background_custom_emoji_id_()
{}

chatEventAccentColorChanged::chatEventAccentColorChanged(int32 old_accent_color_id_, int64 old_background_custom_emoji_id_, int32 new_accent_color_id_, int64 new_background_custom_emoji_id_)
  : old_accent_color_id_(old_accent_color_id_)
  , old_background_custom_emoji_id_(old_background_custom_emoji_id_)
  , new_accent_color_id_(new_accent_color_id_)
  , new_background_custom_emoji_id_(new_background_custom_emoji_id_)
{}

const std::int32_t chatEventAccentColorChanged::ID;

object_ptr<ChatEventAction> chatEventAccentColorChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventAccentColorChanged> res = make_object<chatEventAccentColorChanged>();
  res->old_accent_color_id_ = env->GetIntField(p, res->old_accent_color_id_fieldID);
  res->old_background_custom_emoji_id_ = env->GetLongField(p, res->old_background_custom_emoji_id_fieldID);
  res->new_accent_color_id_ = env->GetIntField(p, res->new_accent_color_id_fieldID);
  res->new_background_custom_emoji_id_ = env->GetLongField(p, res->new_background_custom_emoji_id_fieldID);
  return std::move(res);
}

void chatEventAccentColorChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, old_accent_color_id_fieldID, old_accent_color_id_);
  env->SetLongField(s, old_background_custom_emoji_id_fieldID, old_background_custom_emoji_id_);
  env->SetIntField(s, new_accent_color_id_fieldID, new_accent_color_id_);
  env->SetLongField(s, new_background_custom_emoji_id_fieldID, new_background_custom_emoji_id_);
}

void chatEventAccentColorChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventAccentColorChanged");
    s.store_field("oldAccentColorId", old_accent_color_id_);
    s.store_field("oldBackgroundCustomEmojiId", old_background_custom_emoji_id_);
    s.store_field("newAccentColorId", new_accent_color_id_);
    s.store_field("newBackgroundCustomEmojiId", new_background_custom_emoji_id_);
    s.store_class_end();
  }
}

void chatEventAccentColorChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventAccentColorChanged").c_str());
    old_accent_color_id_fieldID = jni::get_field_id(env, Class, "oldAccentColorId", "I");
    old_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "oldBackgroundCustomEmojiId", "J");
    new_accent_color_id_fieldID = jni::get_field_id(env, Class, "newAccentColorId", "I");
    new_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "newBackgroundCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventProfileAccentColorChanged::Class;
jfieldID chatEventProfileAccentColorChanged::old_profile_accent_color_id_fieldID;
jfieldID chatEventProfileAccentColorChanged::old_profile_background_custom_emoji_id_fieldID;
jfieldID chatEventProfileAccentColorChanged::new_profile_accent_color_id_fieldID;
jfieldID chatEventProfileAccentColorChanged::new_profile_background_custom_emoji_id_fieldID;

chatEventProfileAccentColorChanged::chatEventProfileAccentColorChanged()
  : old_profile_accent_color_id_()
  , old_profile_background_custom_emoji_id_()
  , new_profile_accent_color_id_()
  , new_profile_background_custom_emoji_id_()
{}

chatEventProfileAccentColorChanged::chatEventProfileAccentColorChanged(int32 old_profile_accent_color_id_, int64 old_profile_background_custom_emoji_id_, int32 new_profile_accent_color_id_, int64 new_profile_background_custom_emoji_id_)
  : old_profile_accent_color_id_(old_profile_accent_color_id_)
  , old_profile_background_custom_emoji_id_(old_profile_background_custom_emoji_id_)
  , new_profile_accent_color_id_(new_profile_accent_color_id_)
  , new_profile_background_custom_emoji_id_(new_profile_background_custom_emoji_id_)
{}

const std::int32_t chatEventProfileAccentColorChanged::ID;

object_ptr<ChatEventAction> chatEventProfileAccentColorChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventProfileAccentColorChanged> res = make_object<chatEventProfileAccentColorChanged>();
  res->old_profile_accent_color_id_ = env->GetIntField(p, res->old_profile_accent_color_id_fieldID);
  res->old_profile_background_custom_emoji_id_ = env->GetLongField(p, res->old_profile_background_custom_emoji_id_fieldID);
  res->new_profile_accent_color_id_ = env->GetIntField(p, res->new_profile_accent_color_id_fieldID);
  res->new_profile_background_custom_emoji_id_ = env->GetLongField(p, res->new_profile_background_custom_emoji_id_fieldID);
  return std::move(res);
}

void chatEventProfileAccentColorChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, old_profile_accent_color_id_fieldID, old_profile_accent_color_id_);
  env->SetLongField(s, old_profile_background_custom_emoji_id_fieldID, old_profile_background_custom_emoji_id_);
  env->SetIntField(s, new_profile_accent_color_id_fieldID, new_profile_accent_color_id_);
  env->SetLongField(s, new_profile_background_custom_emoji_id_fieldID, new_profile_background_custom_emoji_id_);
}

void chatEventProfileAccentColorChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventProfileAccentColorChanged");
    s.store_field("oldProfileAccentColorId", old_profile_accent_color_id_);
    s.store_field("oldProfileBackgroundCustomEmojiId", old_profile_background_custom_emoji_id_);
    s.store_field("newProfileAccentColorId", new_profile_accent_color_id_);
    s.store_field("newProfileBackgroundCustomEmojiId", new_profile_background_custom_emoji_id_);
    s.store_class_end();
  }
}

void chatEventProfileAccentColorChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventProfileAccentColorChanged").c_str());
    old_profile_accent_color_id_fieldID = jni::get_field_id(env, Class, "oldProfileAccentColorId", "I");
    old_profile_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "oldProfileBackgroundCustomEmojiId", "J");
    new_profile_accent_color_id_fieldID = jni::get_field_id(env, Class, "newProfileAccentColorId", "I");
    new_profile_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "newProfileBackgroundCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventHasProtectedContentToggled::Class;
jfieldID chatEventHasProtectedContentToggled::has_protected_content_fieldID;

chatEventHasProtectedContentToggled::chatEventHasProtectedContentToggled()
  : has_protected_content_()
{}

chatEventHasProtectedContentToggled::chatEventHasProtectedContentToggled(bool has_protected_content_)
  : has_protected_content_(has_protected_content_)
{}

const std::int32_t chatEventHasProtectedContentToggled::ID;

object_ptr<ChatEventAction> chatEventHasProtectedContentToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventHasProtectedContentToggled> res = make_object<chatEventHasProtectedContentToggled>();
  res->has_protected_content_ = (env->GetBooleanField(p, res->has_protected_content_fieldID) != 0);
  return std::move(res);
}

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

void chatEventHasProtectedContentToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventHasProtectedContentToggled");
    s.store_field("hasProtectedContent", has_protected_content_);
    s.store_class_end();
  }
}

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

jclass chatEventInvitesToggled::Class;
jfieldID chatEventInvitesToggled::can_invite_users_fieldID;

chatEventInvitesToggled::chatEventInvitesToggled()
  : can_invite_users_()
{}

chatEventInvitesToggled::chatEventInvitesToggled(bool can_invite_users_)
  : can_invite_users_(can_invite_users_)
{}

const std::int32_t chatEventInvitesToggled::ID;

object_ptr<ChatEventAction> chatEventInvitesToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventInvitesToggled> res = make_object<chatEventInvitesToggled>();
  res->can_invite_users_ = (env->GetBooleanField(p, res->can_invite_users_fieldID) != 0);
  return std::move(res);
}

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

void chatEventInvitesToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventInvitesToggled");
    s.store_field("canInviteUsers", can_invite_users_);
    s.store_class_end();
  }
}

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

jclass chatEventIsAllHistoryAvailableToggled::Class;
jfieldID chatEventIsAllHistoryAvailableToggled::is_all_history_available_fieldID;

chatEventIsAllHistoryAvailableToggled::chatEventIsAllHistoryAvailableToggled()
  : is_all_history_available_()
{}

chatEventIsAllHistoryAvailableToggled::chatEventIsAllHistoryAvailableToggled(bool is_all_history_available_)
  : is_all_history_available_(is_all_history_available_)
{}

const std::int32_t chatEventIsAllHistoryAvailableToggled::ID;

object_ptr<ChatEventAction> chatEventIsAllHistoryAvailableToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventIsAllHistoryAvailableToggled> res = make_object<chatEventIsAllHistoryAvailableToggled>();
  res->is_all_history_available_ = (env->GetBooleanField(p, res->is_all_history_available_fieldID) != 0);
  return std::move(res);
}

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

void chatEventIsAllHistoryAvailableToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventIsAllHistoryAvailableToggled");
    s.store_field("isAllHistoryAvailable", is_all_history_available_);
    s.store_class_end();
  }
}

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

jclass chatEventHasAggressiveAntiSpamEnabledToggled::Class;
jfieldID chatEventHasAggressiveAntiSpamEnabledToggled::has_aggressive_anti_spam_enabled_fieldID;

chatEventHasAggressiveAntiSpamEnabledToggled::chatEventHasAggressiveAntiSpamEnabledToggled()
  : has_aggressive_anti_spam_enabled_()
{}

chatEventHasAggressiveAntiSpamEnabledToggled::chatEventHasAggressiveAntiSpamEnabledToggled(bool has_aggressive_anti_spam_enabled_)
  : has_aggressive_anti_spam_enabled_(has_aggressive_anti_spam_enabled_)
{}

const std::int32_t chatEventHasAggressiveAntiSpamEnabledToggled::ID;

object_ptr<ChatEventAction> chatEventHasAggressiveAntiSpamEnabledToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventHasAggressiveAntiSpamEnabledToggled> res = make_object<chatEventHasAggressiveAntiSpamEnabledToggled>();
  res->has_aggressive_anti_spam_enabled_ = (env->GetBooleanField(p, res->has_aggressive_anti_spam_enabled_fieldID) != 0);
  return std::move(res);
}

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

void chatEventHasAggressiveAntiSpamEnabledToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventHasAggressiveAntiSpamEnabledToggled");
    s.store_field("hasAggressiveAntiSpamEnabled", has_aggressive_anti_spam_enabled_);
    s.store_class_end();
  }
}

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

jclass chatEventSignMessagesToggled::Class;
jfieldID chatEventSignMessagesToggled::sign_messages_fieldID;

chatEventSignMessagesToggled::chatEventSignMessagesToggled()
  : sign_messages_()
{}

chatEventSignMessagesToggled::chatEventSignMessagesToggled(bool sign_messages_)
  : sign_messages_(sign_messages_)
{}

const std::int32_t chatEventSignMessagesToggled::ID;

object_ptr<ChatEventAction> chatEventSignMessagesToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventSignMessagesToggled> res = make_object<chatEventSignMessagesToggled>();
  res->sign_messages_ = (env->GetBooleanField(p, res->sign_messages_fieldID) != 0);
  return std::move(res);
}

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

void chatEventSignMessagesToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventSignMessagesToggled");
    s.store_field("signMessages", sign_messages_);
    s.store_class_end();
  }
}

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

jclass chatEventShowMessageSenderToggled::Class;
jfieldID chatEventShowMessageSenderToggled::show_message_sender_fieldID;

chatEventShowMessageSenderToggled::chatEventShowMessageSenderToggled()
  : show_message_sender_()
{}

chatEventShowMessageSenderToggled::chatEventShowMessageSenderToggled(bool show_message_sender_)
  : show_message_sender_(show_message_sender_)
{}

const std::int32_t chatEventShowMessageSenderToggled::ID;

object_ptr<ChatEventAction> chatEventShowMessageSenderToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventShowMessageSenderToggled> res = make_object<chatEventShowMessageSenderToggled>();
  res->show_message_sender_ = (env->GetBooleanField(p, res->show_message_sender_fieldID) != 0);
  return std::move(res);
}

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

void chatEventShowMessageSenderToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventShowMessageSenderToggled");
    s.store_field("showMessageSender", show_message_sender_);
    s.store_class_end();
  }
}

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

jclass chatEventAutomaticTranslationToggled::Class;
jfieldID chatEventAutomaticTranslationToggled::has_automatic_translation_fieldID;

chatEventAutomaticTranslationToggled::chatEventAutomaticTranslationToggled()
  : has_automatic_translation_()
{}

chatEventAutomaticTranslationToggled::chatEventAutomaticTranslationToggled(bool has_automatic_translation_)
  : has_automatic_translation_(has_automatic_translation_)
{}

const std::int32_t chatEventAutomaticTranslationToggled::ID;

object_ptr<ChatEventAction> chatEventAutomaticTranslationToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventAutomaticTranslationToggled> res = make_object<chatEventAutomaticTranslationToggled>();
  res->has_automatic_translation_ = (env->GetBooleanField(p, res->has_automatic_translation_fieldID) != 0);
  return std::move(res);
}

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

void chatEventAutomaticTranslationToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventAutomaticTranslationToggled");
    s.store_field("hasAutomaticTranslation", has_automatic_translation_);
    s.store_class_end();
  }
}

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

jclass chatEventInviteLinkEdited::Class;
jfieldID chatEventInviteLinkEdited::old_invite_link_fieldID;
jfieldID chatEventInviteLinkEdited::new_invite_link_fieldID;

chatEventInviteLinkEdited::chatEventInviteLinkEdited()
  : old_invite_link_()
  , new_invite_link_()
{}

chatEventInviteLinkEdited::chatEventInviteLinkEdited(object_ptr<chatInviteLink> &&old_invite_link_, object_ptr<chatInviteLink> &&new_invite_link_)
  : old_invite_link_(std::move(old_invite_link_))
  , new_invite_link_(std::move(new_invite_link_))
{}

const std::int32_t chatEventInviteLinkEdited::ID;

object_ptr<ChatEventAction> chatEventInviteLinkEdited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventInviteLinkEdited> res = make_object<chatEventInviteLinkEdited>();
  res->old_invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->old_invite_link_fieldID));
  res->new_invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->new_invite_link_fieldID));
  return std::move(res);
}

void chatEventInviteLinkEdited::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_invite_link_ != nullptr) { jobject next; old_invite_link_->store(env, next); if (next) { env->SetObjectField(s, old_invite_link_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_invite_link_ != nullptr) { jobject next; new_invite_link_->store(env, next); if (next) { env->SetObjectField(s, new_invite_link_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventInviteLinkEdited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventInviteLinkEdited");
    s.store_object_field("oldInviteLink", static_cast<const BaseObject *>(old_invite_link_.get()));
    s.store_object_field("newInviteLink", static_cast<const BaseObject *>(new_invite_link_.get()));
    s.store_class_end();
  }
}

void chatEventInviteLinkEdited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventInviteLinkEdited").c_str());
    old_invite_link_fieldID = jni::get_field_id(env, Class, "oldInviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    new_invite_link_fieldID = jni::get_field_id(env, Class, "newInviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventInviteLinkRevoked::Class;
jfieldID chatEventInviteLinkRevoked::invite_link_fieldID;

chatEventInviteLinkRevoked::chatEventInviteLinkRevoked()
  : invite_link_()
{}

chatEventInviteLinkRevoked::chatEventInviteLinkRevoked(object_ptr<chatInviteLink> &&invite_link_)
  : invite_link_(std::move(invite_link_))
{}

const std::int32_t chatEventInviteLinkRevoked::ID;

object_ptr<ChatEventAction> chatEventInviteLinkRevoked::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventInviteLinkRevoked> res = make_object<chatEventInviteLinkRevoked>();
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  return std::move(res);
}

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

void chatEventInviteLinkRevoked::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventInviteLinkRevoked");
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    s.store_class_end();
  }
}

void chatEventInviteLinkRevoked::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventInviteLinkRevoked").c_str());
    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 chatEventInviteLinkDeleted::Class;
jfieldID chatEventInviteLinkDeleted::invite_link_fieldID;

chatEventInviteLinkDeleted::chatEventInviteLinkDeleted()
  : invite_link_()
{}

chatEventInviteLinkDeleted::chatEventInviteLinkDeleted(object_ptr<chatInviteLink> &&invite_link_)
  : invite_link_(std::move(invite_link_))
{}

const std::int32_t chatEventInviteLinkDeleted::ID;

object_ptr<ChatEventAction> chatEventInviteLinkDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventInviteLinkDeleted> res = make_object<chatEventInviteLinkDeleted>();
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  return std::move(res);
}

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

void chatEventInviteLinkDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventInviteLinkDeleted");
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    s.store_class_end();
  }
}

void chatEventInviteLinkDeleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventInviteLinkDeleted").c_str());
    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 chatEventVideoChatCreated::Class;
jfieldID chatEventVideoChatCreated::group_call_id_fieldID;

chatEventVideoChatCreated::chatEventVideoChatCreated()
  : group_call_id_()
{}

chatEventVideoChatCreated::chatEventVideoChatCreated(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t chatEventVideoChatCreated::ID;

object_ptr<ChatEventAction> chatEventVideoChatCreated::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventVideoChatCreated> res = make_object<chatEventVideoChatCreated>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  return std::move(res);
}

void chatEventVideoChatCreated::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_);
}

void chatEventVideoChatCreated::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventVideoChatCreated");
    s.store_field("groupCallId", group_call_id_);
    s.store_class_end();
  }
}

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

jclass chatEventVideoChatEnded::Class;
jfieldID chatEventVideoChatEnded::group_call_id_fieldID;

chatEventVideoChatEnded::chatEventVideoChatEnded()
  : group_call_id_()
{}

chatEventVideoChatEnded::chatEventVideoChatEnded(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t chatEventVideoChatEnded::ID;

object_ptr<ChatEventAction> chatEventVideoChatEnded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventVideoChatEnded> res = make_object<chatEventVideoChatEnded>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  return std::move(res);
}

void chatEventVideoChatEnded::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_);
}

void chatEventVideoChatEnded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventVideoChatEnded");
    s.store_field("groupCallId", group_call_id_);
    s.store_class_end();
  }
}

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

jclass chatEventVideoChatMuteNewParticipantsToggled::Class;
jfieldID chatEventVideoChatMuteNewParticipantsToggled::mute_new_participants_fieldID;

chatEventVideoChatMuteNewParticipantsToggled::chatEventVideoChatMuteNewParticipantsToggled()
  : mute_new_participants_()
{}

chatEventVideoChatMuteNewParticipantsToggled::chatEventVideoChatMuteNewParticipantsToggled(bool mute_new_participants_)
  : mute_new_participants_(mute_new_participants_)
{}

const std::int32_t chatEventVideoChatMuteNewParticipantsToggled::ID;

object_ptr<ChatEventAction> chatEventVideoChatMuteNewParticipantsToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventVideoChatMuteNewParticipantsToggled> res = make_object<chatEventVideoChatMuteNewParticipantsToggled>();
  res->mute_new_participants_ = (env->GetBooleanField(p, res->mute_new_participants_fieldID) != 0);
  return std::move(res);
}

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

void chatEventVideoChatMuteNewParticipantsToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventVideoChatMuteNewParticipantsToggled");
    s.store_field("muteNewParticipants", mute_new_participants_);
    s.store_class_end();
  }
}

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

jclass chatEventVideoChatParticipantIsMutedToggled::Class;
jfieldID chatEventVideoChatParticipantIsMutedToggled::participant_id_fieldID;
jfieldID chatEventVideoChatParticipantIsMutedToggled::is_muted_fieldID;

chatEventVideoChatParticipantIsMutedToggled::chatEventVideoChatParticipantIsMutedToggled()
  : participant_id_()
  , is_muted_()
{}

chatEventVideoChatParticipantIsMutedToggled::chatEventVideoChatParticipantIsMutedToggled(object_ptr<MessageSender> &&participant_id_, bool is_muted_)
  : participant_id_(std::move(participant_id_))
  , is_muted_(is_muted_)
{}

const std::int32_t chatEventVideoChatParticipantIsMutedToggled::ID;

object_ptr<ChatEventAction> chatEventVideoChatParticipantIsMutedToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventVideoChatParticipantIsMutedToggled> res = make_object<chatEventVideoChatParticipantIsMutedToggled>();
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->is_muted_ = (env->GetBooleanField(p, res->is_muted_fieldID) != 0);
  return std::move(res);
}

void chatEventVideoChatParticipantIsMutedToggled::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (participant_id_ != nullptr) { jobject next; participant_id_->store(env, next); if (next) { env->SetObjectField(s, participant_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_muted_fieldID, is_muted_);
}

void chatEventVideoChatParticipantIsMutedToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventVideoChatParticipantIsMutedToggled");
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_field("isMuted", is_muted_);
    s.store_class_end();
  }
}

void chatEventVideoChatParticipantIsMutedToggled::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventVideoChatParticipantIsMutedToggled").c_str());
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_muted_fieldID = jni::get_field_id(env, Class, "isMuted", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventVideoChatParticipantVolumeLevelChanged::Class;
jfieldID chatEventVideoChatParticipantVolumeLevelChanged::participant_id_fieldID;
jfieldID chatEventVideoChatParticipantVolumeLevelChanged::volume_level_fieldID;

chatEventVideoChatParticipantVolumeLevelChanged::chatEventVideoChatParticipantVolumeLevelChanged()
  : participant_id_()
  , volume_level_()
{}

chatEventVideoChatParticipantVolumeLevelChanged::chatEventVideoChatParticipantVolumeLevelChanged(object_ptr<MessageSender> &&participant_id_, int32 volume_level_)
  : participant_id_(std::move(participant_id_))
  , volume_level_(volume_level_)
{}

const std::int32_t chatEventVideoChatParticipantVolumeLevelChanged::ID;

object_ptr<ChatEventAction> chatEventVideoChatParticipantVolumeLevelChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventVideoChatParticipantVolumeLevelChanged> res = make_object<chatEventVideoChatParticipantVolumeLevelChanged>();
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->volume_level_ = env->GetIntField(p, res->volume_level_fieldID);
  return std::move(res);
}

void chatEventVideoChatParticipantVolumeLevelChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (participant_id_ != nullptr) { jobject next; participant_id_->store(env, next); if (next) { env->SetObjectField(s, participant_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, volume_level_fieldID, volume_level_);
}

void chatEventVideoChatParticipantVolumeLevelChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventVideoChatParticipantVolumeLevelChanged");
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_field("volumeLevel", volume_level_);
    s.store_class_end();
  }
}

void chatEventVideoChatParticipantVolumeLevelChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventVideoChatParticipantVolumeLevelChanged").c_str());
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    volume_level_fieldID = jni::get_field_id(env, Class, "volumeLevel", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventIsForumToggled::Class;
jfieldID chatEventIsForumToggled::is_forum_fieldID;

chatEventIsForumToggled::chatEventIsForumToggled()
  : is_forum_()
{}

chatEventIsForumToggled::chatEventIsForumToggled(bool is_forum_)
  : is_forum_(is_forum_)
{}

const std::int32_t chatEventIsForumToggled::ID;

object_ptr<ChatEventAction> chatEventIsForumToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventIsForumToggled> res = make_object<chatEventIsForumToggled>();
  res->is_forum_ = (env->GetBooleanField(p, res->is_forum_fieldID) != 0);
  return std::move(res);
}

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

void chatEventIsForumToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventIsForumToggled");
    s.store_field("isForum", is_forum_);
    s.store_class_end();
  }
}

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

jclass chatEventForumTopicCreated::Class;
jfieldID chatEventForumTopicCreated::topic_info_fieldID;

chatEventForumTopicCreated::chatEventForumTopicCreated()
  : topic_info_()
{}

chatEventForumTopicCreated::chatEventForumTopicCreated(object_ptr<forumTopicInfo> &&topic_info_)
  : topic_info_(std::move(topic_info_))
{}

const std::int32_t chatEventForumTopicCreated::ID;

object_ptr<ChatEventAction> chatEventForumTopicCreated::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventForumTopicCreated> res = make_object<chatEventForumTopicCreated>();
  res->topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->topic_info_fieldID));
  return std::move(res);
}

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

void chatEventForumTopicCreated::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventForumTopicCreated");
    s.store_object_field("topicInfo", static_cast<const BaseObject *>(topic_info_.get()));
    s.store_class_end();
  }
}

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

jclass chatEventForumTopicEdited::Class;
jfieldID chatEventForumTopicEdited::old_topic_info_fieldID;
jfieldID chatEventForumTopicEdited::new_topic_info_fieldID;

chatEventForumTopicEdited::chatEventForumTopicEdited()
  : old_topic_info_()
  , new_topic_info_()
{}

chatEventForumTopicEdited::chatEventForumTopicEdited(object_ptr<forumTopicInfo> &&old_topic_info_, object_ptr<forumTopicInfo> &&new_topic_info_)
  : old_topic_info_(std::move(old_topic_info_))
  , new_topic_info_(std::move(new_topic_info_))
{}

const std::int32_t chatEventForumTopicEdited::ID;

object_ptr<ChatEventAction> chatEventForumTopicEdited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventForumTopicEdited> res = make_object<chatEventForumTopicEdited>();
  res->old_topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->old_topic_info_fieldID));
  res->new_topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->new_topic_info_fieldID));
  return std::move(res);
}

void chatEventForumTopicEdited::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_topic_info_ != nullptr) { jobject next; old_topic_info_->store(env, next); if (next) { env->SetObjectField(s, old_topic_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_topic_info_ != nullptr) { jobject next; new_topic_info_->store(env, next); if (next) { env->SetObjectField(s, new_topic_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventForumTopicEdited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventForumTopicEdited");
    s.store_object_field("oldTopicInfo", static_cast<const BaseObject *>(old_topic_info_.get()));
    s.store_object_field("newTopicInfo", static_cast<const BaseObject *>(new_topic_info_.get()));
    s.store_class_end();
  }
}

void chatEventForumTopicEdited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventForumTopicEdited").c_str());
    old_topic_info_fieldID = jni::get_field_id(env, Class, "oldTopicInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicInfo;").c_str());
    new_topic_info_fieldID = jni::get_field_id(env, Class, "newTopicInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatEventForumTopicToggleIsClosed::Class;
jfieldID chatEventForumTopicToggleIsClosed::topic_info_fieldID;

chatEventForumTopicToggleIsClosed::chatEventForumTopicToggleIsClosed()
  : topic_info_()
{}

chatEventForumTopicToggleIsClosed::chatEventForumTopicToggleIsClosed(object_ptr<forumTopicInfo> &&topic_info_)
  : topic_info_(std::move(topic_info_))
{}

const std::int32_t chatEventForumTopicToggleIsClosed::ID;

object_ptr<ChatEventAction> chatEventForumTopicToggleIsClosed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventForumTopicToggleIsClosed> res = make_object<chatEventForumTopicToggleIsClosed>();
  res->topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->topic_info_fieldID));
  return std::move(res);
}

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

void chatEventForumTopicToggleIsClosed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventForumTopicToggleIsClosed");
    s.store_object_field("topicInfo", static_cast<const BaseObject *>(topic_info_.get()));
    s.store_class_end();
  }
}

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

jclass chatEventForumTopicToggleIsHidden::Class;
jfieldID chatEventForumTopicToggleIsHidden::topic_info_fieldID;

chatEventForumTopicToggleIsHidden::chatEventForumTopicToggleIsHidden()
  : topic_info_()
{}

chatEventForumTopicToggleIsHidden::chatEventForumTopicToggleIsHidden(object_ptr<forumTopicInfo> &&topic_info_)
  : topic_info_(std::move(topic_info_))
{}

const std::int32_t chatEventForumTopicToggleIsHidden::ID;

object_ptr<ChatEventAction> chatEventForumTopicToggleIsHidden::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventForumTopicToggleIsHidden> res = make_object<chatEventForumTopicToggleIsHidden>();
  res->topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->topic_info_fieldID));
  return std::move(res);
}

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

void chatEventForumTopicToggleIsHidden::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventForumTopicToggleIsHidden");
    s.store_object_field("topicInfo", static_cast<const BaseObject *>(topic_info_.get()));
    s.store_class_end();
  }
}

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

jclass chatEventForumTopicDeleted::Class;
jfieldID chatEventForumTopicDeleted::topic_info_fieldID;

chatEventForumTopicDeleted::chatEventForumTopicDeleted()
  : topic_info_()
{}

chatEventForumTopicDeleted::chatEventForumTopicDeleted(object_ptr<forumTopicInfo> &&topic_info_)
  : topic_info_(std::move(topic_info_))
{}

const std::int32_t chatEventForumTopicDeleted::ID;

object_ptr<ChatEventAction> chatEventForumTopicDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventForumTopicDeleted> res = make_object<chatEventForumTopicDeleted>();
  res->topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->topic_info_fieldID));
  return std::move(res);
}

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

void chatEventForumTopicDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventForumTopicDeleted");
    s.store_object_field("topicInfo", static_cast<const BaseObject *>(topic_info_.get()));
    s.store_class_end();
  }
}

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

jclass chatEventForumTopicPinned::Class;
jfieldID chatEventForumTopicPinned::old_topic_info_fieldID;
jfieldID chatEventForumTopicPinned::new_topic_info_fieldID;

chatEventForumTopicPinned::chatEventForumTopicPinned()
  : old_topic_info_()
  , new_topic_info_()
{}

chatEventForumTopicPinned::chatEventForumTopicPinned(object_ptr<forumTopicInfo> &&old_topic_info_, object_ptr<forumTopicInfo> &&new_topic_info_)
  : old_topic_info_(std::move(old_topic_info_))
  , new_topic_info_(std::move(new_topic_info_))
{}

const std::int32_t chatEventForumTopicPinned::ID;

object_ptr<ChatEventAction> chatEventForumTopicPinned::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventForumTopicPinned> res = make_object<chatEventForumTopicPinned>();
  res->old_topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->old_topic_info_fieldID));
  res->new_topic_info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->new_topic_info_fieldID));
  return std::move(res);
}

void chatEventForumTopicPinned::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (old_topic_info_ != nullptr) { jobject next; old_topic_info_->store(env, next); if (next) { env->SetObjectField(s, old_topic_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (new_topic_info_ != nullptr) { jobject next; new_topic_info_->store(env, next); if (next) { env->SetObjectField(s, new_topic_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatEventForumTopicPinned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventForumTopicPinned");
    s.store_object_field("oldTopicInfo", static_cast<const BaseObject *>(old_topic_info_.get()));
    s.store_object_field("newTopicInfo", static_cast<const BaseObject *>(new_topic_info_.get()));
    s.store_class_end();
  }
}

void chatEventForumTopicPinned::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventForumTopicPinned").c_str());
    old_topic_info_fieldID = jni::get_field_id(env, Class, "oldTopicInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicInfo;").c_str());
    new_topic_info_fieldID = jni::get_field_id(env, Class, "newTopicInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatInviteLinks::Class;
jfieldID chatInviteLinks::total_count_fieldID;
jfieldID chatInviteLinks::invite_links_fieldID;

chatInviteLinks::chatInviteLinks()
  : total_count_()
  , invite_links_()
{}

chatInviteLinks::chatInviteLinks(int32 total_count_, array<object_ptr<chatInviteLink>> &&invite_links_)
  : total_count_(total_count_)
  , invite_links_(std::move(invite_links_))
{}

const std::int32_t chatInviteLinks::ID;

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

void chatInviteLinks::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, invite_links_); if (arr_tmp_) { env->SetObjectField(s, invite_links_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

void chatInviteLinks::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatInviteLinks").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    invite_links_fieldID = jni::get_field_id(env, Class, "inviteLinks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatPosition::Class;
jfieldID chatPosition::list_fieldID;
jfieldID chatPosition::order_fieldID;
jfieldID chatPosition::is_pinned_fieldID;
jfieldID chatPosition::source_fieldID;

chatPosition::chatPosition()
  : list_()
  , order_()
  , is_pinned_()
  , source_()
{}

chatPosition::chatPosition(object_ptr<ChatList> &&list_, int64 order_, bool is_pinned_, object_ptr<ChatSource> &&source_)
  : list_(std::move(list_))
  , order_(order_)
  , is_pinned_(is_pinned_)
  , source_(std::move(source_))
{}

const std::int32_t chatPosition::ID;

object_ptr<chatPosition> chatPosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatPosition> res = make_object<chatPosition>();
  res->list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->list_fieldID));
  res->order_ = env->GetLongField(p, res->order_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  res->source_ = jni::fetch_tl_object<ChatSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  return res;
}

void chatPosition::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (list_ != nullptr) { jobject next; list_->store(env, next); if (next) { env->SetObjectField(s, list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, order_fieldID, order_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
  if (source_ != nullptr) { jobject next; source_->store(env, next); if (next) { env->SetObjectField(s, source_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatPosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatPosition");
    s.store_object_field("list", static_cast<const BaseObject *>(list_.get()));
    s.store_field("order", order_);
    s.store_field("isPinned", is_pinned_);
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_class_end();
  }
}

void chatPosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatPosition").c_str());
    list_fieldID = jni::get_field_id(env, Class, "list", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    order_fieldID = jni::get_field_id(env, Class, "order", "J");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatSource;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatStatisticsInteractionInfo::Class;
jfieldID chatStatisticsInteractionInfo::object_type_fieldID;
jfieldID chatStatisticsInteractionInfo::view_count_fieldID;
jfieldID chatStatisticsInteractionInfo::forward_count_fieldID;
jfieldID chatStatisticsInteractionInfo::reaction_count_fieldID;

chatStatisticsInteractionInfo::chatStatisticsInteractionInfo()
  : object_type_()
  , view_count_()
  , forward_count_()
  , reaction_count_()
{}

chatStatisticsInteractionInfo::chatStatisticsInteractionInfo(object_ptr<ChatStatisticsObjectType> &&object_type_, int32 view_count_, int32 forward_count_, int32 reaction_count_)
  : object_type_(std::move(object_type_))
  , view_count_(view_count_)
  , forward_count_(forward_count_)
  , reaction_count_(reaction_count_)
{}

const std::int32_t chatStatisticsInteractionInfo::ID;

object_ptr<chatStatisticsInteractionInfo> chatStatisticsInteractionInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatStatisticsInteractionInfo> res = make_object<chatStatisticsInteractionInfo>();
  res->object_type_ = jni::fetch_tl_object<ChatStatisticsObjectType>(env, jni::fetch_object(env, p, res->object_type_fieldID));
  res->view_count_ = env->GetIntField(p, res->view_count_fieldID);
  res->forward_count_ = env->GetIntField(p, res->forward_count_fieldID);
  res->reaction_count_ = env->GetIntField(p, res->reaction_count_fieldID);
  return res;
}

void chatStatisticsInteractionInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (object_type_ != nullptr) { jobject next; object_type_->store(env, next); if (next) { env->SetObjectField(s, object_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, view_count_fieldID, view_count_);
  env->SetIntField(s, forward_count_fieldID, forward_count_);
  env->SetIntField(s, reaction_count_fieldID, reaction_count_);
}

void chatStatisticsInteractionInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatStatisticsInteractionInfo");
    s.store_object_field("objectType", static_cast<const BaseObject *>(object_type_.get()));
    s.store_field("viewCount", view_count_);
    s.store_field("forwardCount", forward_count_);
    s.store_field("reactionCount", reaction_count_);
    s.store_class_end();
  }
}

void chatStatisticsInteractionInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatStatisticsInteractionInfo").c_str());
    object_type_fieldID = jni::get_field_id(env, Class, "objectType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatStatisticsObjectType;").c_str());
    view_count_fieldID = jni::get_field_id(env, Class, "viewCount", "I");
    forward_count_fieldID = jni::get_field_id(env, Class, "forwardCount", "I");
    reaction_count_fieldID = jni::get_field_id(env, Class, "reactionCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass checklistTask::Class;
jfieldID checklistTask::id_fieldID;
jfieldID checklistTask::text_fieldID;
jfieldID checklistTask::completed_by_fieldID;
jfieldID checklistTask::completion_date_fieldID;

checklistTask::checklistTask()
  : id_()
  , text_()
  , completed_by_()
  , completion_date_()
{}

checklistTask::checklistTask(int32 id_, object_ptr<formattedText> &&text_, object_ptr<MessageSender> &&completed_by_, int32 completion_date_)
  : id_(id_)
  , text_(std::move(text_))
  , completed_by_(std::move(completed_by_))
  , completion_date_(completion_date_)
{}

const std::int32_t checklistTask::ID;

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

void checklistTask::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); } }
  if (completed_by_ != nullptr) { jobject next; completed_by_->store(env, next); if (next) { env->SetObjectField(s, completed_by_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, completion_date_fieldID, completion_date_);
}

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

void checklistTask::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChecklistTask").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());
    completed_by_fieldID = jni::get_field_id(env, Class, "completedBy", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    completion_date_fieldID = jni::get_field_id(env, Class, "completionDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass collectibleItemInfo::Class;
jfieldID collectibleItemInfo::purchase_date_fieldID;
jfieldID collectibleItemInfo::currency_fieldID;
jfieldID collectibleItemInfo::amount_fieldID;
jfieldID collectibleItemInfo::cryptocurrency_fieldID;
jfieldID collectibleItemInfo::cryptocurrency_amount_fieldID;
jfieldID collectibleItemInfo::url_fieldID;

collectibleItemInfo::collectibleItemInfo()
  : purchase_date_()
  , currency_()
  , amount_()
  , cryptocurrency_()
  , cryptocurrency_amount_()
  , url_()
{}

collectibleItemInfo::collectibleItemInfo(int32 purchase_date_, string const &currency_, int53 amount_, string const &cryptocurrency_, int64 cryptocurrency_amount_, string const &url_)
  : purchase_date_(purchase_date_)
  , currency_(currency_)
  , amount_(amount_)
  , cryptocurrency_(cryptocurrency_)
  , cryptocurrency_amount_(cryptocurrency_amount_)
  , url_(url_)
{}

const std::int32_t collectibleItemInfo::ID;

object_ptr<collectibleItemInfo> collectibleItemInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<collectibleItemInfo> res = make_object<collectibleItemInfo>();
  res->purchase_date_ = env->GetIntField(p, res->purchase_date_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->cryptocurrency_ = jni::fetch_string(env, p, res->cryptocurrency_fieldID);
  res->cryptocurrency_amount_ = env->GetLongField(p, res->cryptocurrency_amount_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return res;
}

void collectibleItemInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, purchase_date_fieldID, purchase_date_);
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  { jstring nextString = jni::to_jstring(env, cryptocurrency_); if (nextString) { env->SetObjectField(s, cryptocurrency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, cryptocurrency_amount_fieldID, cryptocurrency_amount_);
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void collectibleItemInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CollectibleItemInfo");
    s.store_field("purchaseDate", purchase_date_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("cryptocurrency", cryptocurrency_);
    s.store_field("cryptocurrencyAmount", cryptocurrency_amount_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void collectibleItemInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CollectibleItemInfo").c_str());
    purchase_date_fieldID = jni::get_field_id(env, Class, "purchaseDate", "I");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    cryptocurrency_fieldID = jni::get_field_id(env, Class, "cryptocurrency", "Ljava/lang/String;");
    cryptocurrency_amount_fieldID = jni::get_field_id(env, Class, "cryptocurrencyAmount", "J");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass connectedWebsites::Class;
jfieldID connectedWebsites::websites_fieldID;

connectedWebsites::connectedWebsites()
  : websites_()
{}

connectedWebsites::connectedWebsites(array<object_ptr<connectedWebsite>> &&websites_)
  : websites_(std::move(websites_))
{}

const std::int32_t connectedWebsites::ID;

object_ptr<connectedWebsites> connectedWebsites::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<connectedWebsites> res = make_object<connectedWebsites>();
  res->websites_ = jni::FetchVector<connectedWebsite>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->websites_fieldID));
  return res;
}

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

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

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

jclass countryInfo::Class;
jfieldID countryInfo::country_code_fieldID;
jfieldID countryInfo::name_fieldID;
jfieldID countryInfo::english_name_fieldID;
jfieldID countryInfo::is_hidden_fieldID;
jfieldID countryInfo::calling_codes_fieldID;

countryInfo::countryInfo()
  : country_code_()
  , name_()
  , english_name_()
  , is_hidden_()
  , calling_codes_()
{}

countryInfo::countryInfo(string const &country_code_, string const &name_, string const &english_name_, bool is_hidden_, array<string> &&calling_codes_)
  : country_code_(country_code_)
  , name_(name_)
  , english_name_(english_name_)
  , is_hidden_(is_hidden_)
  , calling_codes_(std::move(calling_codes_))
{}

const std::int32_t countryInfo::ID;

object_ptr<countryInfo> countryInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<countryInfo> res = make_object<countryInfo>();
  res->country_code_ = jni::fetch_string(env, p, res->country_code_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->english_name_ = jni::fetch_string(env, p, res->english_name_fieldID);
  res->is_hidden_ = (env->GetBooleanField(p, res->is_hidden_fieldID) != 0);
  res->calling_codes_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->calling_codes_fieldID));
  return res;
}

void countryInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, country_code_); if (nextString) { env->SetObjectField(s, country_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, english_name_); if (nextString) { env->SetObjectField(s, english_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_hidden_fieldID, is_hidden_);
  { auto arr_tmp_ = jni::store_vector(env, calling_codes_); if (arr_tmp_) { env->SetObjectField(s, calling_codes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void countryInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CountryInfo");
    s.store_field("countryCode", country_code_);
    s.store_field("name", name_);
    s.store_field("englishName", english_name_);
    s.store_field("isHidden", is_hidden_);
    { s.store_vector_begin("callingCodes", calling_codes_.size()); for (const auto &_value : calling_codes_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void countryInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CountryInfo").c_str());
    country_code_fieldID = jni::get_field_id(env, Class, "countryCode", "Ljava/lang/String;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    english_name_fieldID = jni::get_field_id(env, Class, "englishName", "Ljava/lang/String;");
    is_hidden_fieldID = jni::get_field_id(env, Class, "isHidden", "Z");
    calling_codes_fieldID = jni::get_field_id(env, Class, "callingCodes", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass downloadedFileCounts::Class;
jfieldID downloadedFileCounts::active_count_fieldID;
jfieldID downloadedFileCounts::paused_count_fieldID;
jfieldID downloadedFileCounts::completed_count_fieldID;

downloadedFileCounts::downloadedFileCounts()
  : active_count_()
  , paused_count_()
  , completed_count_()
{}

downloadedFileCounts::downloadedFileCounts(int32 active_count_, int32 paused_count_, int32 completed_count_)
  : active_count_(active_count_)
  , paused_count_(paused_count_)
  , completed_count_(completed_count_)
{}

const std::int32_t downloadedFileCounts::ID;

object_ptr<downloadedFileCounts> downloadedFileCounts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<downloadedFileCounts> res = make_object<downloadedFileCounts>();
  res->active_count_ = env->GetIntField(p, res->active_count_fieldID);
  res->paused_count_ = env->GetIntField(p, res->paused_count_fieldID);
  res->completed_count_ = env->GetIntField(p, res->completed_count_fieldID);
  return res;
}

void downloadedFileCounts::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, active_count_fieldID, active_count_);
  env->SetIntField(s, paused_count_fieldID, paused_count_);
  env->SetIntField(s, completed_count_fieldID, completed_count_);
}

void downloadedFileCounts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DownloadedFileCounts");
    s.store_field("activeCount", active_count_);
    s.store_field("pausedCount", paused_count_);
    s.store_field("completedCount", completed_count_);
    s.store_class_end();
  }
}

void downloadedFileCounts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DownloadedFileCounts").c_str());
    active_count_fieldID = jni::get_field_id(env, Class, "activeCount", "I");
    paused_count_fieldID = jni::get_field_id(env, Class, "pausedCount", "I");
    completed_count_fieldID = jni::get_field_id(env, Class, "completedCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass EmojiCategorySource::Class;

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

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

jclass emojiCategorySourceSearch::Class;
jfieldID emojiCategorySourceSearch::emojis_fieldID;

emojiCategorySourceSearch::emojiCategorySourceSearch()
  : emojis_()
{}

emojiCategorySourceSearch::emojiCategorySourceSearch(array<string> &&emojis_)
  : emojis_(std::move(emojis_))
{}

const std::int32_t emojiCategorySourceSearch::ID;

object_ptr<EmojiCategorySource> emojiCategorySourceSearch::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiCategorySourceSearch> res = make_object<emojiCategorySourceSearch>();
  res->emojis_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emojis_fieldID));
  return std::move(res);
}

void emojiCategorySourceSearch::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 emojiCategorySourceSearch::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiCategorySourceSearch");
    { 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 emojiCategorySourceSearch::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiCategorySourceSearch").c_str());
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass emojiCategorySourcePremium::Class;

emojiCategorySourcePremium::emojiCategorySourcePremium() {
}

const std::int32_t emojiCategorySourcePremium::ID;

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

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

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

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

jclass giftAuctionAcquiredGift::Class;
jfieldID giftAuctionAcquiredGift::receiver_id_fieldID;
jfieldID giftAuctionAcquiredGift::date_fieldID;
jfieldID giftAuctionAcquiredGift::star_count_fieldID;
jfieldID giftAuctionAcquiredGift::auction_round_number_fieldID;
jfieldID giftAuctionAcquiredGift::auction_round_position_fieldID;
jfieldID giftAuctionAcquiredGift::unique_gift_number_fieldID;
jfieldID giftAuctionAcquiredGift::text_fieldID;
jfieldID giftAuctionAcquiredGift::is_private_fieldID;

giftAuctionAcquiredGift::giftAuctionAcquiredGift()
  : receiver_id_()
  , date_()
  , star_count_()
  , auction_round_number_()
  , auction_round_position_()
  , unique_gift_number_()
  , text_()
  , is_private_()
{}

giftAuctionAcquiredGift::giftAuctionAcquiredGift(object_ptr<MessageSender> &&receiver_id_, int32 date_, int53 star_count_, int32 auction_round_number_, int32 auction_round_position_, int32 unique_gift_number_, object_ptr<formattedText> &&text_, bool is_private_)
  : receiver_id_(std::move(receiver_id_))
  , date_(date_)
  , star_count_(star_count_)
  , auction_round_number_(auction_round_number_)
  , auction_round_position_(auction_round_position_)
  , unique_gift_number_(unique_gift_number_)
  , text_(std::move(text_))
  , is_private_(is_private_)
{}

const std::int32_t giftAuctionAcquiredGift::ID;

object_ptr<giftAuctionAcquiredGift> giftAuctionAcquiredGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftAuctionAcquiredGift> res = make_object<giftAuctionAcquiredGift>();
  res->receiver_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->receiver_id_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->auction_round_number_ = env->GetIntField(p, res->auction_round_number_fieldID);
  res->auction_round_position_ = env->GetIntField(p, res->auction_round_position_fieldID);
  res->unique_gift_number_ = env->GetIntField(p, res->unique_gift_number_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->is_private_ = (env->GetBooleanField(p, res->is_private_fieldID) != 0);
  return res;
}

void giftAuctionAcquiredGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (receiver_id_ != nullptr) { jobject next; receiver_id_->store(env, next); if (next) { env->SetObjectField(s, receiver_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  env->SetLongField(s, star_count_fieldID, star_count_);
  env->SetIntField(s, auction_round_number_fieldID, auction_round_number_);
  env->SetIntField(s, auction_round_position_fieldID, auction_round_position_);
  env->SetIntField(s, unique_gift_number_fieldID, unique_gift_number_);
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_private_fieldID, is_private_);
}

void giftAuctionAcquiredGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftAuctionAcquiredGift");
    s.store_object_field("receiverId", static_cast<const BaseObject *>(receiver_id_.get()));
    s.store_field("date", date_);
    s.store_field("starCount", star_count_);
    s.store_field("auctionRoundNumber", auction_round_number_);
    s.store_field("auctionRoundPosition", auction_round_position_);
    s.store_field("uniqueGiftNumber", unique_gift_number_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("isPrivate", is_private_);
    s.store_class_end();
  }
}

void giftAuctionAcquiredGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftAuctionAcquiredGift").c_str());
    receiver_id_fieldID = jni::get_field_id(env, Class, "receiverId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    auction_round_number_fieldID = jni::get_field_id(env, Class, "auctionRoundNumber", "I");
    auction_round_position_fieldID = jni::get_field_id(env, Class, "auctionRoundPosition", "I");
    unique_gift_number_fieldID = jni::get_field_id(env, Class, "uniqueGiftNumber", "I");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    is_private_fieldID = jni::get_field_id(env, Class, "isPrivate", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass giftCollections::Class;
jfieldID giftCollections::collections_fieldID;

giftCollections::giftCollections()
  : collections_()
{}

giftCollections::giftCollections(array<object_ptr<giftCollection>> &&collections_)
  : collections_(std::move(collections_))
{}

const std::int32_t giftCollections::ID;

object_ptr<giftCollections> giftCollections::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftCollections> res = make_object<giftCollections>();
  res->collections_ = jni::FetchVector<giftCollection>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->collections_fieldID));
  return res;
}

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

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

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

jclass inlineQueryResultsButton::Class;
jfieldID inlineQueryResultsButton::text_fieldID;
jfieldID inlineQueryResultsButton::type_fieldID;

inlineQueryResultsButton::inlineQueryResultsButton()
  : text_()
  , type_()
{}

inlineQueryResultsButton::inlineQueryResultsButton(string const &text_, object_ptr<InlineQueryResultsButtonType> &&type_)
  : text_(text_)
  , type_(std::move(type_))
{}

const std::int32_t inlineQueryResultsButton::ID;

object_ptr<inlineQueryResultsButton> inlineQueryResultsButton::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultsButton> res = make_object<inlineQueryResultsButton>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->type_ = jni::fetch_tl_object<InlineQueryResultsButtonType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void inlineQueryResultsButton::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); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass InputMessageContent::Class;

object_ptr<InputMessageContent> InputMessageContent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case inputMessageText::ID:
      return inputMessageText::fetch(env, p);
    case inputMessageAnimation::ID:
      return inputMessageAnimation::fetch(env, p);
    case inputMessageAudio::ID:
      return inputMessageAudio::fetch(env, p);
    case inputMessageDocument::ID:
      return inputMessageDocument::fetch(env, p);
    case inputMessagePaidMedia::ID:
      return inputMessagePaidMedia::fetch(env, p);
    case inputMessagePhoto::ID:
      return inputMessagePhoto::fetch(env, p);
    case inputMessageSticker::ID:
      return inputMessageSticker::fetch(env, p);
    case inputMessageVideo::ID:
      return inputMessageVideo::fetch(env, p);
    case inputMessageVideoNote::ID:
      return inputMessageVideoNote::fetch(env, p);
    case inputMessageVoiceNote::ID:
      return inputMessageVoiceNote::fetch(env, p);
    case inputMessageLocation::ID:
      return inputMessageLocation::fetch(env, p);
    case inputMessageVenue::ID:
      return inputMessageVenue::fetch(env, p);
    case inputMessageContact::ID:
      return inputMessageContact::fetch(env, p);
    case inputMessageDice::ID:
      return inputMessageDice::fetch(env, p);
    case inputMessageGame::ID:
      return inputMessageGame::fetch(env, p);
    case inputMessageInvoice::ID:
      return inputMessageInvoice::fetch(env, p);
    case inputMessagePoll::ID:
      return inputMessagePoll::fetch(env, p);
    case inputMessageStakeDice::ID:
      return inputMessageStakeDice::fetch(env, p);
    case inputMessageStory::ID:
      return inputMessageStory::fetch(env, p);
    case inputMessageChecklist::ID:
      return inputMessageChecklist::fetch(env, p);
    case inputMessageForwarded::ID:
      return inputMessageForwarded::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass inputMessageText::Class;
jfieldID inputMessageText::text_fieldID;
jfieldID inputMessageText::link_preview_options_fieldID;
jfieldID inputMessageText::clear_draft_fieldID;

inputMessageText::inputMessageText()
  : text_()
  , link_preview_options_()
  , clear_draft_()
{}

inputMessageText::inputMessageText(object_ptr<formattedText> &&text_, object_ptr<linkPreviewOptions> &&link_preview_options_, bool clear_draft_)
  : text_(std::move(text_))
  , link_preview_options_(std::move(link_preview_options_))
  , clear_draft_(clear_draft_)
{}

const std::int32_t inputMessageText::ID;

object_ptr<InputMessageContent> inputMessageText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageText> res = make_object<inputMessageText>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->link_preview_options_ = jni::fetch_tl_object<linkPreviewOptions>(env, jni::fetch_object(env, p, res->link_preview_options_fieldID));
  res->clear_draft_ = (env->GetBooleanField(p, res->clear_draft_fieldID) != 0);
  return std::move(res);
}

void inputMessageText::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); } }
  if (link_preview_options_ != nullptr) { jobject next; link_preview_options_->store(env, next); if (next) { env->SetObjectField(s, link_preview_options_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, clear_draft_fieldID, clear_draft_);
}

void inputMessageText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageText");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_object_field("linkPreviewOptions", static_cast<const BaseObject *>(link_preview_options_.get()));
    s.store_field("clearDraft", clear_draft_);
    s.store_class_end();
  }
}

void inputMessageText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageText").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    link_preview_options_fieldID = jni::get_field_id(env, Class, "linkPreviewOptions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LinkPreviewOptions;").c_str());
    clear_draft_fieldID = jni::get_field_id(env, Class, "clearDraft", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageAnimation::Class;
jfieldID inputMessageAnimation::animation_fieldID;
jfieldID inputMessageAnimation::thumbnail_fieldID;
jfieldID inputMessageAnimation::added_sticker_file_ids_fieldID;
jfieldID inputMessageAnimation::duration_fieldID;
jfieldID inputMessageAnimation::width_fieldID;
jfieldID inputMessageAnimation::height_fieldID;
jfieldID inputMessageAnimation::caption_fieldID;
jfieldID inputMessageAnimation::show_caption_above_media_fieldID;
jfieldID inputMessageAnimation::has_spoiler_fieldID;

inputMessageAnimation::inputMessageAnimation()
  : animation_()
  , thumbnail_()
  , added_sticker_file_ids_()
  , duration_()
  , width_()
  , height_()
  , caption_()
  , show_caption_above_media_()
  , has_spoiler_()
{}

inputMessageAnimation::inputMessageAnimation(object_ptr<InputFile> &&animation_, object_ptr<inputThumbnail> &&thumbnail_, array<int32> &&added_sticker_file_ids_, int32 duration_, int32 width_, int32 height_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, bool has_spoiler_)
  : animation_(std::move(animation_))
  , thumbnail_(std::move(thumbnail_))
  , added_sticker_file_ids_(std::move(added_sticker_file_ids_))
  , duration_(duration_)
  , width_(width_)
  , height_(height_)
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , has_spoiler_(has_spoiler_)
{}

const std::int32_t inputMessageAnimation::ID;

object_ptr<InputMessageContent> inputMessageAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageAnimation> res = make_object<inputMessageAnimation>();
  res->animation_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->added_sticker_file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->added_sticker_file_ids_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->has_spoiler_ = (env->GetBooleanField(p, res->has_spoiler_fieldID) != 0);
  return std::move(res);
}

void inputMessageAnimation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_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); } }
  { auto arr_tmp_ = jni::store_vector(env, added_sticker_file_ids_); if (arr_tmp_) { env->SetObjectField(s, added_sticker_file_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  env->SetBooleanField(s, has_spoiler_fieldID, has_spoiler_);
}

void inputMessageAnimation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageAnimation");
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    { s.store_vector_begin("addedStickerFileIds", added_sticker_file_ids_.size()); for (const auto &_value : added_sticker_file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_field("hasSpoiler", has_spoiler_);
    s.store_class_end();
  }
}

void inputMessageAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageAnimation").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    added_sticker_file_ids_fieldID = jni::get_field_id(env, Class, "addedStickerFileIds", "[I");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    has_spoiler_fieldID = jni::get_field_id(env, Class, "hasSpoiler", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageAudio::Class;
jfieldID inputMessageAudio::audio_fieldID;
jfieldID inputMessageAudio::album_cover_thumbnail_fieldID;
jfieldID inputMessageAudio::duration_fieldID;
jfieldID inputMessageAudio::title_fieldID;
jfieldID inputMessageAudio::performer_fieldID;
jfieldID inputMessageAudio::caption_fieldID;

inputMessageAudio::inputMessageAudio()
  : audio_()
  , album_cover_thumbnail_()
  , duration_()
  , title_()
  , performer_()
  , caption_()
{}

inputMessageAudio::inputMessageAudio(object_ptr<InputFile> &&audio_, object_ptr<inputThumbnail> &&album_cover_thumbnail_, int32 duration_, string const &title_, string const &performer_, object_ptr<formattedText> &&caption_)
  : audio_(std::move(audio_))
  , album_cover_thumbnail_(std::move(album_cover_thumbnail_))
  , duration_(duration_)
  , title_(title_)
  , performer_(performer_)
  , caption_(std::move(caption_))
{}

const std::int32_t inputMessageAudio::ID;

object_ptr<InputMessageContent> inputMessageAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageAudio> res = make_object<inputMessageAudio>();
  res->audio_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->audio_fieldID));
  res->album_cover_thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->album_cover_thumbnail_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->performer_ = jni::fetch_string(env, p, res->performer_fieldID);
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void inputMessageAudio::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (audio_ != nullptr) { jobject next; audio_->store(env, next); if (next) { env->SetObjectField(s, audio_fieldID, next); env->DeleteLocalRef(next); } }
  if (album_cover_thumbnail_ != nullptr) { jobject next; album_cover_thumbnail_->store(env, next); if (next) { env->SetObjectField(s, album_cover_thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, duration_fieldID, duration_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, performer_); if (nextString) { env->SetObjectField(s, performer_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputMessageAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageAudio");
    s.store_object_field("audio", static_cast<const BaseObject *>(audio_.get()));
    s.store_object_field("albumCoverThumbnail", static_cast<const BaseObject *>(album_cover_thumbnail_.get()));
    s.store_field("duration", duration_);
    s.store_field("title", title_);
    s.store_field("performer", performer_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

void inputMessageAudio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageAudio").c_str());
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    album_cover_thumbnail_fieldID = jni::get_field_id(env, Class, "albumCoverThumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    performer_fieldID = jni::get_field_id(env, Class, "performer", "Ljava/lang/String;");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageDocument::Class;
jfieldID inputMessageDocument::document_fieldID;
jfieldID inputMessageDocument::thumbnail_fieldID;
jfieldID inputMessageDocument::disable_content_type_detection_fieldID;
jfieldID inputMessageDocument::caption_fieldID;

inputMessageDocument::inputMessageDocument()
  : document_()
  , thumbnail_()
  , disable_content_type_detection_()
  , caption_()
{}

inputMessageDocument::inputMessageDocument(object_ptr<InputFile> &&document_, object_ptr<inputThumbnail> &&thumbnail_, bool disable_content_type_detection_, object_ptr<formattedText> &&caption_)
  : document_(std::move(document_))
  , thumbnail_(std::move(thumbnail_))
  , disable_content_type_detection_(disable_content_type_detection_)
  , caption_(std::move(caption_))
{}

const std::int32_t inputMessageDocument::ID;

object_ptr<InputMessageContent> inputMessageDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageDocument> res = make_object<inputMessageDocument>();
  res->document_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->disable_content_type_detection_ = (env->GetBooleanField(p, res->disable_content_type_detection_fieldID) != 0);
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void inputMessageDocument::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (document_ != nullptr) { jobject next; document_->store(env, next); if (next) { env->SetObjectField(s, document_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); } }
  env->SetBooleanField(s, disable_content_type_detection_fieldID, disable_content_type_detection_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputMessageDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageDocument");
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("disableContentTypeDetection", disable_content_type_detection_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

void inputMessageDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageDocument").c_str());
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    disable_content_type_detection_fieldID = jni::get_field_id(env, Class, "disableContentTypeDetection", "Z");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputMessagePaidMedia::Class;
jfieldID inputMessagePaidMedia::star_count_fieldID;
jfieldID inputMessagePaidMedia::paid_media_fieldID;
jfieldID inputMessagePaidMedia::caption_fieldID;
jfieldID inputMessagePaidMedia::show_caption_above_media_fieldID;
jfieldID inputMessagePaidMedia::payload_fieldID;

inputMessagePaidMedia::inputMessagePaidMedia()
  : star_count_()
  , paid_media_()
  , caption_()
  , show_caption_above_media_()
  , payload_()
{}

inputMessagePaidMedia::inputMessagePaidMedia(int53 star_count_, array<object_ptr<inputPaidMedia>> &&paid_media_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, string const &payload_)
  : star_count_(star_count_)
  , paid_media_(std::move(paid_media_))
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , payload_(payload_)
{}

const std::int32_t inputMessagePaidMedia::ID;

object_ptr<InputMessageContent> inputMessagePaidMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessagePaidMedia> res = make_object<inputMessagePaidMedia>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->paid_media_ = jni::FetchVector<inputPaidMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->paid_media_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  return std::move(res);
}

void inputMessagePaidMedia::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_);
  { auto arr_tmp_ = jni::store_vector(env, paid_media_); if (arr_tmp_) { env->SetObjectField(s, paid_media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  { jstring nextString = jni::to_jstring(env, payload_); if (nextString) { env->SetObjectField(s, payload_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inputMessagePaidMedia::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessagePaidMedia");
    s.store_field("starCount", star_count_);
    { s.store_vector_begin("paidMedia", paid_media_.size()); for (const auto &_value : paid_media_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_field("payload", payload_);
    s.store_class_end();
  }
}

void inputMessagePaidMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessagePaidMedia").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    paid_media_fieldID = jni::get_field_id(env, Class, "paidMedia", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputPaidMedia;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    payload_fieldID = jni::get_field_id(env, Class, "payload", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessagePhoto::Class;
jfieldID inputMessagePhoto::photo_fieldID;
jfieldID inputMessagePhoto::thumbnail_fieldID;
jfieldID inputMessagePhoto::video_fieldID;
jfieldID inputMessagePhoto::added_sticker_file_ids_fieldID;
jfieldID inputMessagePhoto::width_fieldID;
jfieldID inputMessagePhoto::height_fieldID;
jfieldID inputMessagePhoto::caption_fieldID;
jfieldID inputMessagePhoto::show_caption_above_media_fieldID;
jfieldID inputMessagePhoto::self_destruct_type_fieldID;
jfieldID inputMessagePhoto::has_spoiler_fieldID;

inputMessagePhoto::inputMessagePhoto()
  : photo_()
  , thumbnail_()
  , video_()
  , added_sticker_file_ids_()
  , width_()
  , height_()
  , caption_()
  , show_caption_above_media_()
  , self_destruct_type_()
  , has_spoiler_()
{}

inputMessagePhoto::inputMessagePhoto(object_ptr<InputFile> &&photo_, object_ptr<inputThumbnail> &&thumbnail_, object_ptr<InputFile> &&video_, array<int32> &&added_sticker_file_ids_, int32 width_, int32 height_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, object_ptr<MessageSelfDestructType> &&self_destruct_type_, bool has_spoiler_)
  : photo_(std::move(photo_))
  , thumbnail_(std::move(thumbnail_))
  , video_(std::move(video_))
  , added_sticker_file_ids_(std::move(added_sticker_file_ids_))
  , width_(width_)
  , height_(height_)
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , self_destruct_type_(std::move(self_destruct_type_))
  , has_spoiler_(has_spoiler_)
{}

const std::int32_t inputMessagePhoto::ID;

object_ptr<InputMessageContent> inputMessagePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessagePhoto> res = make_object<inputMessagePhoto>();
  res->photo_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->video_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->added_sticker_file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->added_sticker_file_ids_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->self_destruct_type_ = jni::fetch_tl_object<MessageSelfDestructType>(env, jni::fetch_object(env, p, res->self_destruct_type_fieldID));
  res->has_spoiler_ = (env->GetBooleanField(p, res->has_spoiler_fieldID) != 0);
  return std::move(res);
}

void inputMessagePhoto::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); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, added_sticker_file_ids_); if (arr_tmp_) { env->SetObjectField(s, added_sticker_file_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  if (self_destruct_type_ != nullptr) { jobject next; self_destruct_type_->store(env, next); if (next) { env->SetObjectField(s, self_destruct_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, has_spoiler_fieldID, has_spoiler_);
}

void inputMessagePhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessagePhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    { s.store_vector_begin("addedStickerFileIds", added_sticker_file_ids_.size()); for (const auto &_value : added_sticker_file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_object_field("selfDestructType", static_cast<const BaseObject *>(self_destruct_type_.get()));
    s.store_field("hasSpoiler", has_spoiler_);
    s.store_class_end();
  }
}

void inputMessagePhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessagePhoto").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    added_sticker_file_ids_fieldID = jni::get_field_id(env, Class, "addedStickerFileIds", "[I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    self_destruct_type_fieldID = jni::get_field_id(env, Class, "selfDestructType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSelfDestructType;").c_str());
    has_spoiler_fieldID = jni::get_field_id(env, Class, "hasSpoiler", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageSticker::Class;
jfieldID inputMessageSticker::sticker_fieldID;
jfieldID inputMessageSticker::thumbnail_fieldID;
jfieldID inputMessageSticker::width_fieldID;
jfieldID inputMessageSticker::height_fieldID;
jfieldID inputMessageSticker::emoji_fieldID;

inputMessageSticker::inputMessageSticker()
  : sticker_()
  , thumbnail_()
  , width_()
  , height_()
  , emoji_()
{}

inputMessageSticker::inputMessageSticker(object_ptr<InputFile> &&sticker_, object_ptr<inputThumbnail> &&thumbnail_, int32 width_, int32 height_, string const &emoji_)
  : sticker_(std::move(sticker_))
  , thumbnail_(std::move(thumbnail_))
  , width_(width_)
  , height_(height_)
  , emoji_(emoji_)
{}

const std::int32_t inputMessageSticker::ID;

object_ptr<InputMessageContent> inputMessageSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageSticker> res = make_object<inputMessageSticker>();
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  return std::move(res);
}

void inputMessageSticker::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_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); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inputMessageSticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageSticker");
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("emoji", emoji_);
    s.store_class_end();
  }
}

void inputMessageSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageSticker").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageVideo::Class;
jfieldID inputMessageVideo::video_fieldID;
jfieldID inputMessageVideo::thumbnail_fieldID;
jfieldID inputMessageVideo::cover_fieldID;
jfieldID inputMessageVideo::start_timestamp_fieldID;
jfieldID inputMessageVideo::added_sticker_file_ids_fieldID;
jfieldID inputMessageVideo::duration_fieldID;
jfieldID inputMessageVideo::width_fieldID;
jfieldID inputMessageVideo::height_fieldID;
jfieldID inputMessageVideo::supports_streaming_fieldID;
jfieldID inputMessageVideo::caption_fieldID;
jfieldID inputMessageVideo::show_caption_above_media_fieldID;
jfieldID inputMessageVideo::self_destruct_type_fieldID;
jfieldID inputMessageVideo::has_spoiler_fieldID;

inputMessageVideo::inputMessageVideo()
  : video_()
  , thumbnail_()
  , cover_()
  , start_timestamp_()
  , added_sticker_file_ids_()
  , duration_()
  , width_()
  , height_()
  , supports_streaming_()
  , caption_()
  , show_caption_above_media_()
  , self_destruct_type_()
  , has_spoiler_()
{}

inputMessageVideo::inputMessageVideo(object_ptr<InputFile> &&video_, object_ptr<inputThumbnail> &&thumbnail_, object_ptr<InputFile> &&cover_, int32 start_timestamp_, array<int32> &&added_sticker_file_ids_, int32 duration_, int32 width_, int32 height_, bool supports_streaming_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, object_ptr<MessageSelfDestructType> &&self_destruct_type_, bool has_spoiler_)
  : video_(std::move(video_))
  , thumbnail_(std::move(thumbnail_))
  , cover_(std::move(cover_))
  , start_timestamp_(start_timestamp_)
  , added_sticker_file_ids_(std::move(added_sticker_file_ids_))
  , duration_(duration_)
  , width_(width_)
  , height_(height_)
  , supports_streaming_(supports_streaming_)
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , self_destruct_type_(std::move(self_destruct_type_))
  , has_spoiler_(has_spoiler_)
{}

const std::int32_t inputMessageVideo::ID;

object_ptr<InputMessageContent> inputMessageVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageVideo> res = make_object<inputMessageVideo>();
  res->video_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->cover_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->cover_fieldID));
  res->start_timestamp_ = env->GetIntField(p, res->start_timestamp_fieldID);
  res->added_sticker_file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->added_sticker_file_ids_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->supports_streaming_ = (env->GetBooleanField(p, res->supports_streaming_fieldID) != 0);
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->self_destruct_type_ = jni::fetch_tl_object<MessageSelfDestructType>(env, jni::fetch_object(env, p, res->self_destruct_type_fieldID));
  res->has_spoiler_ = (env->GetBooleanField(p, res->has_spoiler_fieldID) != 0);
  return std::move(res);
}

void inputMessageVideo::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); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (cover_ != nullptr) { jobject next; cover_->store(env, next); if (next) { env->SetObjectField(s, cover_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, start_timestamp_fieldID, start_timestamp_);
  { auto arr_tmp_ = jni::store_vector(env, added_sticker_file_ids_); if (arr_tmp_) { env->SetObjectField(s, added_sticker_file_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  env->SetBooleanField(s, supports_streaming_fieldID, supports_streaming_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  if (self_destruct_type_ != nullptr) { jobject next; self_destruct_type_->store(env, next); if (next) { env->SetObjectField(s, self_destruct_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, has_spoiler_fieldID, has_spoiler_);
}

void inputMessageVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("cover", static_cast<const BaseObject *>(cover_.get()));
    s.store_field("startTimestamp", start_timestamp_);
    { s.store_vector_begin("addedStickerFileIds", added_sticker_file_ids_.size()); for (const auto &_value : added_sticker_file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("supportsStreaming", supports_streaming_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_object_field("selfDestructType", static_cast<const BaseObject *>(self_destruct_type_.get()));
    s.store_field("hasSpoiler", has_spoiler_);
    s.store_class_end();
  }
}

void inputMessageVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    cover_fieldID = jni::get_field_id(env, Class, "cover", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    start_timestamp_fieldID = jni::get_field_id(env, Class, "startTimestamp", "I");
    added_sticker_file_ids_fieldID = jni::get_field_id(env, Class, "addedStickerFileIds", "[I");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    supports_streaming_fieldID = jni::get_field_id(env, Class, "supportsStreaming", "Z");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    self_destruct_type_fieldID = jni::get_field_id(env, Class, "selfDestructType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSelfDestructType;").c_str());
    has_spoiler_fieldID = jni::get_field_id(env, Class, "hasSpoiler", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageVideoNote::Class;
jfieldID inputMessageVideoNote::video_note_fieldID;
jfieldID inputMessageVideoNote::thumbnail_fieldID;
jfieldID inputMessageVideoNote::duration_fieldID;
jfieldID inputMessageVideoNote::length_fieldID;
jfieldID inputMessageVideoNote::self_destruct_type_fieldID;

inputMessageVideoNote::inputMessageVideoNote()
  : video_note_()
  , thumbnail_()
  , duration_()
  , length_()
  , self_destruct_type_()
{}

inputMessageVideoNote::inputMessageVideoNote(object_ptr<InputFile> &&video_note_, object_ptr<inputThumbnail> &&thumbnail_, int32 duration_, int32 length_, object_ptr<MessageSelfDestructType> &&self_destruct_type_)
  : video_note_(std::move(video_note_))
  , thumbnail_(std::move(thumbnail_))
  , duration_(duration_)
  , length_(length_)
  , self_destruct_type_(std::move(self_destruct_type_))
{}

const std::int32_t inputMessageVideoNote::ID;

object_ptr<InputMessageContent> inputMessageVideoNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageVideoNote> res = make_object<inputMessageVideoNote>();
  res->video_note_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->video_note_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->length_ = env->GetIntField(p, res->length_fieldID);
  res->self_destruct_type_ = jni::fetch_tl_object<MessageSelfDestructType>(env, jni::fetch_object(env, p, res->self_destruct_type_fieldID));
  return std::move(res);
}

void inputMessageVideoNote::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (video_note_ != nullptr) { jobject next; video_note_->store(env, next); if (next) { env->SetObjectField(s, video_note_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); } }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, length_fieldID, length_);
  if (self_destruct_type_ != nullptr) { jobject next; self_destruct_type_->store(env, next); if (next) { env->SetObjectField(s, self_destruct_type_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputMessageVideoNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageVideoNote");
    s.store_object_field("videoNote", static_cast<const BaseObject *>(video_note_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("duration", duration_);
    s.store_field("length", length_);
    s.store_object_field("selfDestructType", static_cast<const BaseObject *>(self_destruct_type_.get()));
    s.store_class_end();
  }
}

void inputMessageVideoNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageVideoNote").c_str());
    video_note_fieldID = jni::get_field_id(env, Class, "videoNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    length_fieldID = jni::get_field_id(env, Class, "length", "I");
    self_destruct_type_fieldID = jni::get_field_id(env, Class, "selfDestructType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSelfDestructType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageVoiceNote::Class;
jfieldID inputMessageVoiceNote::voice_note_fieldID;
jfieldID inputMessageVoiceNote::duration_fieldID;
jfieldID inputMessageVoiceNote::waveform_fieldID;
jfieldID inputMessageVoiceNote::caption_fieldID;
jfieldID inputMessageVoiceNote::self_destruct_type_fieldID;

inputMessageVoiceNote::inputMessageVoiceNote()
  : voice_note_()
  , duration_()
  , waveform_()
  , caption_()
  , self_destruct_type_()
{}

inputMessageVoiceNote::inputMessageVoiceNote(object_ptr<InputFile> &&voice_note_, int32 duration_, bytes const &waveform_, object_ptr<formattedText> &&caption_, object_ptr<MessageSelfDestructType> &&self_destruct_type_)
  : voice_note_(std::move(voice_note_))
  , duration_(duration_)
  , waveform_(std::move(waveform_))
  , caption_(std::move(caption_))
  , self_destruct_type_(std::move(self_destruct_type_))
{}

const std::int32_t inputMessageVoiceNote::ID;

object_ptr<InputMessageContent> inputMessageVoiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageVoiceNote> res = make_object<inputMessageVoiceNote>();
  res->voice_note_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->voice_note_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->waveform_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->waveform_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->self_destruct_type_ = jni::fetch_tl_object<MessageSelfDestructType>(env, jni::fetch_object(env, p, res->self_destruct_type_fieldID));
  return std::move(res);
}

void inputMessageVoiceNote::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (voice_note_ != nullptr) { jobject next; voice_note_->store(env, next); if (next) { env->SetObjectField(s, voice_note_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, duration_fieldID, duration_);
  { jbyteArray nextBytes = jni::to_bytes(env, waveform_); if (nextBytes) { env->SetObjectField(s, waveform_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  if (self_destruct_type_ != nullptr) { jobject next; self_destruct_type_->store(env, next); if (next) { env->SetObjectField(s, self_destruct_type_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputMessageVoiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageVoiceNote");
    s.store_object_field("voiceNote", static_cast<const BaseObject *>(voice_note_.get()));
    s.store_field("duration", duration_);
    s.store_bytes_field("waveform", waveform_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_object_field("selfDestructType", static_cast<const BaseObject *>(self_destruct_type_.get()));
    s.store_class_end();
  }
}

void inputMessageVoiceNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageVoiceNote").c_str());
    voice_note_fieldID = jni::get_field_id(env, Class, "voiceNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    waveform_fieldID = jni::get_field_id(env, Class, "waveform", "[B");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    self_destruct_type_fieldID = jni::get_field_id(env, Class, "selfDestructType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSelfDestructType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageLocation::Class;
jfieldID inputMessageLocation::location_fieldID;
jfieldID inputMessageLocation::live_period_fieldID;
jfieldID inputMessageLocation::heading_fieldID;
jfieldID inputMessageLocation::proximity_alert_radius_fieldID;

inputMessageLocation::inputMessageLocation()
  : location_()
  , live_period_()
  , heading_()
  , proximity_alert_radius_()
{}

inputMessageLocation::inputMessageLocation(object_ptr<location> &&location_, int32 live_period_, int32 heading_, int32 proximity_alert_radius_)
  : location_(std::move(location_))
  , live_period_(live_period_)
  , heading_(heading_)
  , proximity_alert_radius_(proximity_alert_radius_)
{}

const std::int32_t inputMessageLocation::ID;

object_ptr<InputMessageContent> inputMessageLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageLocation> res = make_object<inputMessageLocation>();
  res->location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->live_period_ = env->GetIntField(p, res->live_period_fieldID);
  res->heading_ = env->GetIntField(p, res->heading_fieldID);
  res->proximity_alert_radius_ = env->GetIntField(p, res->proximity_alert_radius_fieldID);
  return std::move(res);
}

void inputMessageLocation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, live_period_fieldID, live_period_);
  env->SetIntField(s, heading_fieldID, heading_);
  env->SetIntField(s, proximity_alert_radius_fieldID, proximity_alert_radius_);
}

void inputMessageLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageLocation");
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("livePeriod", live_period_);
    s.store_field("heading", heading_);
    s.store_field("proximityAlertRadius", proximity_alert_radius_);
    s.store_class_end();
  }
}

void inputMessageLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageLocation").c_str());
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    live_period_fieldID = jni::get_field_id(env, Class, "livePeriod", "I");
    heading_fieldID = jni::get_field_id(env, Class, "heading", "I");
    proximity_alert_radius_fieldID = jni::get_field_id(env, Class, "proximityAlertRadius", "I");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageVenue::Class;
jfieldID inputMessageVenue::venue_fieldID;

inputMessageVenue::inputMessageVenue()
  : venue_()
{}

inputMessageVenue::inputMessageVenue(object_ptr<venue> &&venue_)
  : venue_(std::move(venue_))
{}

const std::int32_t inputMessageVenue::ID;

object_ptr<InputMessageContent> inputMessageVenue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageVenue> res = make_object<inputMessageVenue>();
  res->venue_ = jni::fetch_tl_object<venue>(env, jni::fetch_object(env, p, res->venue_fieldID));
  return std::move(res);
}

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

void inputMessageVenue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageVenue");
    s.store_object_field("venue", static_cast<const BaseObject *>(venue_.get()));
    s.store_class_end();
  }
}

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

jclass inputMessageContact::Class;
jfieldID inputMessageContact::contact_fieldID;

inputMessageContact::inputMessageContact()
  : contact_()
{}

inputMessageContact::inputMessageContact(object_ptr<contact> &&contact_)
  : contact_(std::move(contact_))
{}

const std::int32_t inputMessageContact::ID;

object_ptr<InputMessageContent> inputMessageContact::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageContact> res = make_object<inputMessageContact>();
  res->contact_ = jni::fetch_tl_object<contact>(env, jni::fetch_object(env, p, res->contact_fieldID));
  return std::move(res);
}

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

void inputMessageContact::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageContact");
    s.store_object_field("contact", static_cast<const BaseObject *>(contact_.get()));
    s.store_class_end();
  }
}

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

jclass inputMessageDice::Class;
jfieldID inputMessageDice::emoji_fieldID;
jfieldID inputMessageDice::clear_draft_fieldID;

inputMessageDice::inputMessageDice()
  : emoji_()
  , clear_draft_()
{}

inputMessageDice::inputMessageDice(string const &emoji_, bool clear_draft_)
  : emoji_(emoji_)
  , clear_draft_(clear_draft_)
{}

const std::int32_t inputMessageDice::ID;

object_ptr<InputMessageContent> inputMessageDice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageDice> res = make_object<inputMessageDice>();
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->clear_draft_ = (env->GetBooleanField(p, res->clear_draft_fieldID) != 0);
  return std::move(res);
}

void inputMessageDice::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, clear_draft_fieldID, clear_draft_);
}

void inputMessageDice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageDice");
    s.store_field("emoji", emoji_);
    s.store_field("clearDraft", clear_draft_);
    s.store_class_end();
  }
}

void inputMessageDice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageDice").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    clear_draft_fieldID = jni::get_field_id(env, Class, "clearDraft", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageGame::Class;
jfieldID inputMessageGame::bot_user_id_fieldID;
jfieldID inputMessageGame::game_short_name_fieldID;

inputMessageGame::inputMessageGame()
  : bot_user_id_()
  , game_short_name_()
{}

inputMessageGame::inputMessageGame(int53 bot_user_id_, string const &game_short_name_)
  : bot_user_id_(bot_user_id_)
  , game_short_name_(game_short_name_)
{}

const std::int32_t inputMessageGame::ID;

object_ptr<InputMessageContent> inputMessageGame::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageGame> res = make_object<inputMessageGame>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->game_short_name_ = jni::fetch_string(env, p, res->game_short_name_fieldID);
  return std::move(res);
}

void inputMessageGame::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, game_short_name_); if (nextString) { env->SetObjectField(s, game_short_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inputMessageGame::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageGame");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("gameShortName", game_short_name_);
    s.store_class_end();
  }
}

void inputMessageGame::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageGame").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    game_short_name_fieldID = jni::get_field_id(env, Class, "gameShortName", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageInvoice::Class;
jfieldID inputMessageInvoice::invoice_fieldID;
jfieldID inputMessageInvoice::title_fieldID;
jfieldID inputMessageInvoice::description_fieldID;
jfieldID inputMessageInvoice::photo_url_fieldID;
jfieldID inputMessageInvoice::photo_size_fieldID;
jfieldID inputMessageInvoice::photo_width_fieldID;
jfieldID inputMessageInvoice::photo_height_fieldID;
jfieldID inputMessageInvoice::payload_fieldID;
jfieldID inputMessageInvoice::provider_token_fieldID;
jfieldID inputMessageInvoice::provider_data_fieldID;
jfieldID inputMessageInvoice::start_parameter_fieldID;
jfieldID inputMessageInvoice::paid_media_fieldID;
jfieldID inputMessageInvoice::paid_media_caption_fieldID;

inputMessageInvoice::inputMessageInvoice()
  : invoice_()
  , title_()
  , description_()
  , photo_url_()
  , photo_size_()
  , photo_width_()
  , photo_height_()
  , payload_()
  , provider_token_()
  , provider_data_()
  , start_parameter_()
  , paid_media_()
  , paid_media_caption_()
{}

inputMessageInvoice::inputMessageInvoice(object_ptr<invoice> &&invoice_, string const &title_, string const &description_, string const &photo_url_, int32 photo_size_, int32 photo_width_, int32 photo_height_, bytes const &payload_, string const &provider_token_, string const &provider_data_, string const &start_parameter_, object_ptr<inputPaidMedia> &&paid_media_, object_ptr<formattedText> &&paid_media_caption_)
  : invoice_(std::move(invoice_))
  , title_(title_)
  , description_(description_)
  , photo_url_(photo_url_)
  , photo_size_(photo_size_)
  , photo_width_(photo_width_)
  , photo_height_(photo_height_)
  , payload_(std::move(payload_))
  , provider_token_(provider_token_)
  , provider_data_(provider_data_)
  , start_parameter_(start_parameter_)
  , paid_media_(std::move(paid_media_))
  , paid_media_caption_(std::move(paid_media_caption_))
{}

const std::int32_t inputMessageInvoice::ID;

object_ptr<InputMessageContent> inputMessageInvoice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageInvoice> res = make_object<inputMessageInvoice>();
  res->invoice_ = jni::fetch_tl_object<invoice>(env, jni::fetch_object(env, p, res->invoice_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->photo_url_ = jni::fetch_string(env, p, res->photo_url_fieldID);
  res->photo_size_ = env->GetIntField(p, res->photo_size_fieldID);
  res->photo_width_ = env->GetIntField(p, res->photo_width_fieldID);
  res->photo_height_ = env->GetIntField(p, res->photo_height_fieldID);
  res->payload_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->payload_fieldID));
  res->provider_token_ = jni::fetch_string(env, p, res->provider_token_fieldID);
  res->provider_data_ = jni::fetch_string(env, p, res->provider_data_fieldID);
  res->start_parameter_ = jni::fetch_string(env, p, res->start_parameter_fieldID);
  res->paid_media_ = jni::fetch_tl_object<inputPaidMedia>(env, jni::fetch_object(env, p, res->paid_media_fieldID));
  res->paid_media_caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->paid_media_caption_fieldID));
  return std::move(res);
}

void inputMessageInvoice::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); } }
  { 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); } }
  { jstring nextString = jni::to_jstring(env, photo_url_); if (nextString) { env->SetObjectField(s, photo_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, photo_size_fieldID, photo_size_);
  env->SetIntField(s, photo_width_fieldID, photo_width_);
  env->SetIntField(s, photo_height_fieldID, photo_height_);
  { jbyteArray nextBytes = jni::to_bytes(env, payload_); if (nextBytes) { env->SetObjectField(s, payload_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  { jstring nextString = jni::to_jstring(env, provider_token_); if (nextString) { env->SetObjectField(s, provider_token_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, provider_data_); if (nextString) { env->SetObjectField(s, provider_data_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, start_parameter_); if (nextString) { env->SetObjectField(s, start_parameter_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (paid_media_ != nullptr) { jobject next; paid_media_->store(env, next); if (next) { env->SetObjectField(s, paid_media_fieldID, next); env->DeleteLocalRef(next); } }
  if (paid_media_caption_ != nullptr) { jobject next; paid_media_caption_->store(env, next); if (next) { env->SetObjectField(s, paid_media_caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputMessageInvoice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageInvoice");
    s.store_object_field("invoice", static_cast<const BaseObject *>(invoice_.get()));
    s.store_field("title", title_);
    s.store_field("description", description_);
    s.store_field("photoUrl", photo_url_);
    s.store_field("photoSize", photo_size_);
    s.store_field("photoWidth", photo_width_);
    s.store_field("photoHeight", photo_height_);
    s.store_bytes_field("payload", payload_);
    s.store_field("providerToken", provider_token_);
    s.store_field("providerData", provider_data_);
    s.store_field("startParameter", start_parameter_);
    s.store_object_field("paidMedia", static_cast<const BaseObject *>(paid_media_.get()));
    s.store_object_field("paidMediaCaption", static_cast<const BaseObject *>(paid_media_caption_.get()));
    s.store_class_end();
  }
}

void inputMessageInvoice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageInvoice").c_str());
    invoice_fieldID = jni::get_field_id(env, Class, "invoice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Invoice;").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;");
    photo_url_fieldID = jni::get_field_id(env, Class, "photoUrl", "Ljava/lang/String;");
    photo_size_fieldID = jni::get_field_id(env, Class, "photoSize", "I");
    photo_width_fieldID = jni::get_field_id(env, Class, "photoWidth", "I");
    photo_height_fieldID = jni::get_field_id(env, Class, "photoHeight", "I");
    payload_fieldID = jni::get_field_id(env, Class, "payload", "[B");
    provider_token_fieldID = jni::get_field_id(env, Class, "providerToken", "Ljava/lang/String;");
    provider_data_fieldID = jni::get_field_id(env, Class, "providerData", "Ljava/lang/String;");
    start_parameter_fieldID = jni::get_field_id(env, Class, "startParameter", "Ljava/lang/String;");
    paid_media_fieldID = jni::get_field_id(env, Class, "paidMedia", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputPaidMedia;").c_str());
    paid_media_caption_fieldID = jni::get_field_id(env, Class, "paidMediaCaption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputMessagePoll::Class;
jfieldID inputMessagePoll::question_fieldID;
jfieldID inputMessagePoll::options_fieldID;
jfieldID inputMessagePoll::description_fieldID;
jfieldID inputMessagePoll::media_fieldID;
jfieldID inputMessagePoll::is_anonymous_fieldID;
jfieldID inputMessagePoll::allows_multiple_answers_fieldID;
jfieldID inputMessagePoll::allows_revoting_fieldID;
jfieldID inputMessagePoll::members_only_fieldID;
jfieldID inputMessagePoll::country_codes_fieldID;
jfieldID inputMessagePoll::shuffle_options_fieldID;
jfieldID inputMessagePoll::hide_results_until_closes_fieldID;
jfieldID inputMessagePoll::type_fieldID;
jfieldID inputMessagePoll::open_period_fieldID;
jfieldID inputMessagePoll::close_date_fieldID;
jfieldID inputMessagePoll::is_closed_fieldID;

inputMessagePoll::inputMessagePoll()
  : question_()
  , options_()
  , description_()
  , media_()
  , is_anonymous_()
  , allows_multiple_answers_()
  , allows_revoting_()
  , members_only_()
  , country_codes_()
  , shuffle_options_()
  , hide_results_until_closes_()
  , type_()
  , open_period_()
  , close_date_()
  , is_closed_()
{}

inputMessagePoll::inputMessagePoll(object_ptr<formattedText> &&question_, array<object_ptr<inputPollOption>> &&options_, object_ptr<formattedText> &&description_, object_ptr<InputMessageContent> &&media_, bool is_anonymous_, bool allows_multiple_answers_, bool allows_revoting_, bool members_only_, array<string> &&country_codes_, bool shuffle_options_, bool hide_results_until_closes_, object_ptr<InputPollType> &&type_, int32 open_period_, int32 close_date_, bool is_closed_)
  : question_(std::move(question_))
  , options_(std::move(options_))
  , description_(std::move(description_))
  , media_(std::move(media_))
  , is_anonymous_(is_anonymous_)
  , allows_multiple_answers_(allows_multiple_answers_)
  , allows_revoting_(allows_revoting_)
  , members_only_(members_only_)
  , country_codes_(std::move(country_codes_))
  , shuffle_options_(shuffle_options_)
  , hide_results_until_closes_(hide_results_until_closes_)
  , type_(std::move(type_))
  , open_period_(open_period_)
  , close_date_(close_date_)
  , is_closed_(is_closed_)
{}

const std::int32_t inputMessagePoll::ID;

object_ptr<InputMessageContent> inputMessagePoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessagePoll> res = make_object<inputMessagePoll>();
  res->question_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->question_fieldID));
  res->options_ = jni::FetchVector<inputPollOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  res->description_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->description_fieldID));
  res->media_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->media_fieldID));
  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->shuffle_options_ = (env->GetBooleanField(p, res->shuffle_options_fieldID) != 0);
  res->hide_results_until_closes_ = (env->GetBooleanField(p, res->hide_results_until_closes_fieldID) != 0);
  res->type_ = jni::fetch_tl_object<InputPollType>(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);
  return std::move(res);
}

void inputMessagePoll::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  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_); } }
  if (description_ != nullptr) { jobject next; description_->store(env, next); if (next) { env->SetObjectField(s, description_fieldID, next); env->DeleteLocalRef(next); } }
  if (media_ != nullptr) { jobject next; media_->store(env, next); if (next) { env->SetObjectField(s, media_fieldID, next); env->DeleteLocalRef(next); } }
  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_); } }
  env->SetBooleanField(s, shuffle_options_fieldID, shuffle_options_);
  env->SetBooleanField(s, hide_results_until_closes_fieldID, hide_results_until_closes_);
  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_);
}

void inputMessagePoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessagePoll");
    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_object_field("description", static_cast<const BaseObject *>(description_.get()));
    s.store_object_field("media", static_cast<const BaseObject *>(media_.get()));
    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_field("shuffleOptions", shuffle_options_);
    s.store_field("hideResultsUntilCloses", hide_results_until_closes_);
    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_class_end();
  }
}

void inputMessagePoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessagePoll").c_str());
    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$InputPollOption;").c_str());
    description_fieldID = jni::get_field_id(env, Class, "description", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    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;");
    shuffle_options_fieldID = jni::get_field_id(env, Class, "shuffleOptions", "Z");
    hide_results_until_closes_fieldID = jni::get_field_id(env, Class, "hideResultsUntilCloses", "Z");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputPollType;").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");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageStakeDice::Class;
jfieldID inputMessageStakeDice::state_hash_fieldID;
jfieldID inputMessageStakeDice::stake_toncoin_amount_fieldID;
jfieldID inputMessageStakeDice::clear_draft_fieldID;

inputMessageStakeDice::inputMessageStakeDice()
  : state_hash_()
  , stake_toncoin_amount_()
  , clear_draft_()
{}

inputMessageStakeDice::inputMessageStakeDice(string const &state_hash_, int53 stake_toncoin_amount_, bool clear_draft_)
  : state_hash_(state_hash_)
  , stake_toncoin_amount_(stake_toncoin_amount_)
  , clear_draft_(clear_draft_)
{}

const std::int32_t inputMessageStakeDice::ID;

object_ptr<InputMessageContent> inputMessageStakeDice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageStakeDice> res = make_object<inputMessageStakeDice>();
  res->state_hash_ = jni::fetch_string(env, p, res->state_hash_fieldID);
  res->stake_toncoin_amount_ = env->GetLongField(p, res->stake_toncoin_amount_fieldID);
  res->clear_draft_ = (env->GetBooleanField(p, res->clear_draft_fieldID) != 0);
  return std::move(res);
}

void inputMessageStakeDice::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, state_hash_); if (nextString) { env->SetObjectField(s, state_hash_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, stake_toncoin_amount_fieldID, stake_toncoin_amount_);
  env->SetBooleanField(s, clear_draft_fieldID, clear_draft_);
}

void inputMessageStakeDice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageStakeDice");
    s.store_field("stateHash", state_hash_);
    s.store_field("stakeToncoinAmount", stake_toncoin_amount_);
    s.store_field("clearDraft", clear_draft_);
    s.store_class_end();
  }
}

void inputMessageStakeDice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageStakeDice").c_str());
    state_hash_fieldID = jni::get_field_id(env, Class, "stateHash", "Ljava/lang/String;");
    stake_toncoin_amount_fieldID = jni::get_field_id(env, Class, "stakeToncoinAmount", "J");
    clear_draft_fieldID = jni::get_field_id(env, Class, "clearDraft", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputMessageStory::Class;
jfieldID inputMessageStory::story_poster_chat_id_fieldID;
jfieldID inputMessageStory::story_id_fieldID;

inputMessageStory::inputMessageStory()
  : story_poster_chat_id_()
  , story_id_()
{}

inputMessageStory::inputMessageStory(int53 story_poster_chat_id_, int32 story_id_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
{}

const std::int32_t inputMessageStory::ID;

object_ptr<InputMessageContent> inputMessageStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageStory> res = make_object<inputMessageStory>();
  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 inputMessageStory::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 inputMessageStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_class_end();
  }
}

void inputMessageStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageStory").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 inputMessageChecklist::Class;
jfieldID inputMessageChecklist::checklist_fieldID;

inputMessageChecklist::inputMessageChecklist()
  : checklist_()
{}

inputMessageChecklist::inputMessageChecklist(object_ptr<inputChecklist> &&checklist_)
  : checklist_(std::move(checklist_))
{}

const std::int32_t inputMessageChecklist::ID;

object_ptr<InputMessageContent> inputMessageChecklist::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageChecklist> res = make_object<inputMessageChecklist>();
  res->checklist_ = jni::fetch_tl_object<inputChecklist>(env, jni::fetch_object(env, p, res->checklist_fieldID));
  return std::move(res);
}

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

void inputMessageChecklist::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageChecklist");
    s.store_object_field("checklist", static_cast<const BaseObject *>(checklist_.get()));
    s.store_class_end();
  }
}

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

jclass inputMessageForwarded::Class;
jfieldID inputMessageForwarded::from_chat_id_fieldID;
jfieldID inputMessageForwarded::message_id_fieldID;
jfieldID inputMessageForwarded::in_game_share_fieldID;
jfieldID inputMessageForwarded::replace_video_start_timestamp_fieldID;
jfieldID inputMessageForwarded::new_video_start_timestamp_fieldID;
jfieldID inputMessageForwarded::copy_options_fieldID;

inputMessageForwarded::inputMessageForwarded()
  : from_chat_id_()
  , message_id_()
  , in_game_share_()
  , replace_video_start_timestamp_()
  , new_video_start_timestamp_()
  , copy_options_()
{}

inputMessageForwarded::inputMessageForwarded(int53 from_chat_id_, int53 message_id_, bool in_game_share_, bool replace_video_start_timestamp_, int32 new_video_start_timestamp_, object_ptr<messageCopyOptions> &&copy_options_)
  : from_chat_id_(from_chat_id_)
  , message_id_(message_id_)
  , in_game_share_(in_game_share_)
  , replace_video_start_timestamp_(replace_video_start_timestamp_)
  , new_video_start_timestamp_(new_video_start_timestamp_)
  , copy_options_(std::move(copy_options_))
{}

const std::int32_t inputMessageForwarded::ID;

object_ptr<InputMessageContent> inputMessageForwarded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputMessageForwarded> res = make_object<inputMessageForwarded>();
  res->from_chat_id_ = env->GetLongField(p, res->from_chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->in_game_share_ = (env->GetBooleanField(p, res->in_game_share_fieldID) != 0);
  res->replace_video_start_timestamp_ = (env->GetBooleanField(p, res->replace_video_start_timestamp_fieldID) != 0);
  res->new_video_start_timestamp_ = env->GetIntField(p, res->new_video_start_timestamp_fieldID);
  res->copy_options_ = jni::fetch_tl_object<messageCopyOptions>(env, jni::fetch_object(env, p, res->copy_options_fieldID));
  return std::move(res);
}

void inputMessageForwarded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, from_chat_id_fieldID, from_chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetBooleanField(s, in_game_share_fieldID, in_game_share_);
  env->SetBooleanField(s, replace_video_start_timestamp_fieldID, replace_video_start_timestamp_);
  env->SetIntField(s, new_video_start_timestamp_fieldID, new_video_start_timestamp_);
  if (copy_options_ != nullptr) { jobject next; copy_options_->store(env, next); if (next) { env->SetObjectField(s, copy_options_fieldID, next); env->DeleteLocalRef(next); } }
}

void inputMessageForwarded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputMessageForwarded");
    s.store_field("fromChatId", from_chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("inGameShare", in_game_share_);
    s.store_field("replaceVideoStartTimestamp", replace_video_start_timestamp_);
    s.store_field("newVideoStartTimestamp", new_video_start_timestamp_);
    s.store_object_field("copyOptions", static_cast<const BaseObject *>(copy_options_.get()));
    s.store_class_end();
  }
}

void inputMessageForwarded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputMessageForwarded").c_str());
    from_chat_id_fieldID = jni::get_field_id(env, Class, "fromChatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    in_game_share_fieldID = jni::get_field_id(env, Class, "inGameShare", "Z");
    replace_video_start_timestamp_fieldID = jni::get_field_id(env, Class, "replaceVideoStartTimestamp", "Z");
    new_video_start_timestamp_fieldID = jni::get_field_id(env, Class, "newVideoStartTimestamp", "I");
    copy_options_fieldID = jni::get_field_id(env, Class, "copyOptions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageCopyOptions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputPaidMedia::Class;
jfieldID inputPaidMedia::type_fieldID;
jfieldID inputPaidMedia::media_fieldID;
jfieldID inputPaidMedia::thumbnail_fieldID;
jfieldID inputPaidMedia::added_sticker_file_ids_fieldID;
jfieldID inputPaidMedia::width_fieldID;
jfieldID inputPaidMedia::height_fieldID;

inputPaidMedia::inputPaidMedia()
  : type_()
  , media_()
  , thumbnail_()
  , added_sticker_file_ids_()
  , width_()
  , height_()
{}

inputPaidMedia::inputPaidMedia(object_ptr<InputPaidMediaType> &&type_, object_ptr<InputFile> &&media_, object_ptr<inputThumbnail> &&thumbnail_, array<int32> &&added_sticker_file_ids_, int32 width_, int32 height_)
  : type_(std::move(type_))
  , media_(std::move(media_))
  , thumbnail_(std::move(thumbnail_))
  , added_sticker_file_ids_(std::move(added_sticker_file_ids_))
  , width_(width_)
  , height_(height_)
{}

const std::int32_t inputPaidMedia::ID;

object_ptr<inputPaidMedia> inputPaidMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPaidMedia> res = make_object<inputPaidMedia>();
  res->type_ = jni::fetch_tl_object<InputPaidMediaType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->media_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->media_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<inputThumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->added_sticker_file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->added_sticker_file_ids_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  return res;
}

void inputPaidMedia::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 (media_ != nullptr) { jobject next; media_->store(env, next); if (next) { env->SetObjectField(s, media_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); } }
  { auto arr_tmp_ = jni::store_vector(env, added_sticker_file_ids_); if (arr_tmp_) { env->SetObjectField(s, added_sticker_file_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
}

void inputPaidMedia::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPaidMedia");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_object_field("media", static_cast<const BaseObject *>(media_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    { s.store_vector_begin("addedStickerFileIds", added_sticker_file_ids_.size()); for (const auto &_value : added_sticker_file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_class_end();
  }
}

void inputPaidMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputPaidMedia").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputPaidMediaType;").c_str());
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputThumbnail;").c_str());
    added_sticker_file_ids_fieldID = jni::get_field_id(env, Class, "addedStickerFileIds", "[I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    return true;
  }();
  (void)is_inited;
}

jclass InputPassportElementErrorSource::Class;

object_ptr<InputPassportElementErrorSource> InputPassportElementErrorSource::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case inputPassportElementErrorSourceUnspecified::ID:
      return inputPassportElementErrorSourceUnspecified::fetch(env, p);
    case inputPassportElementErrorSourceDataField::ID:
      return inputPassportElementErrorSourceDataField::fetch(env, p);
    case inputPassportElementErrorSourceFrontSide::ID:
      return inputPassportElementErrorSourceFrontSide::fetch(env, p);
    case inputPassportElementErrorSourceReverseSide::ID:
      return inputPassportElementErrorSourceReverseSide::fetch(env, p);
    case inputPassportElementErrorSourceSelfie::ID:
      return inputPassportElementErrorSourceSelfie::fetch(env, p);
    case inputPassportElementErrorSourceTranslationFile::ID:
      return inputPassportElementErrorSourceTranslationFile::fetch(env, p);
    case inputPassportElementErrorSourceTranslationFiles::ID:
      return inputPassportElementErrorSourceTranslationFiles::fetch(env, p);
    case inputPassportElementErrorSourceFile::ID:
      return inputPassportElementErrorSourceFile::fetch(env, p);
    case inputPassportElementErrorSourceFiles::ID:
      return inputPassportElementErrorSourceFiles::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass inputPassportElementErrorSourceUnspecified::Class;
jfieldID inputPassportElementErrorSourceUnspecified::element_hash_fieldID;

inputPassportElementErrorSourceUnspecified::inputPassportElementErrorSourceUnspecified()
  : element_hash_()
{}

inputPassportElementErrorSourceUnspecified::inputPassportElementErrorSourceUnspecified(bytes const &element_hash_)
  : element_hash_(std::move(element_hash_))
{}

const std::int32_t inputPassportElementErrorSourceUnspecified::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceUnspecified::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceUnspecified> res = make_object<inputPassportElementErrorSourceUnspecified>();
  res->element_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->element_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceUnspecified::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceUnspecified");
    s.store_bytes_field("elementHash", element_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceDataField::Class;
jfieldID inputPassportElementErrorSourceDataField::field_name_fieldID;
jfieldID inputPassportElementErrorSourceDataField::data_hash_fieldID;

inputPassportElementErrorSourceDataField::inputPassportElementErrorSourceDataField()
  : field_name_()
  , data_hash_()
{}

inputPassportElementErrorSourceDataField::inputPassportElementErrorSourceDataField(string const &field_name_, bytes const &data_hash_)
  : field_name_(field_name_)
  , data_hash_(std::move(data_hash_))
{}

const std::int32_t inputPassportElementErrorSourceDataField::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceDataField::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceDataField> res = make_object<inputPassportElementErrorSourceDataField>();
  res->field_name_ = jni::fetch_string(env, p, res->field_name_fieldID);
  res->data_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceDataField::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceDataField");
    s.store_field("fieldName", field_name_);
    s.store_bytes_field("dataHash", data_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceFrontSide::Class;
jfieldID inputPassportElementErrorSourceFrontSide::file_hash_fieldID;

inputPassportElementErrorSourceFrontSide::inputPassportElementErrorSourceFrontSide()
  : file_hash_()
{}

inputPassportElementErrorSourceFrontSide::inputPassportElementErrorSourceFrontSide(bytes const &file_hash_)
  : file_hash_(std::move(file_hash_))
{}

const std::int32_t inputPassportElementErrorSourceFrontSide::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceFrontSide::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceFrontSide> res = make_object<inputPassportElementErrorSourceFrontSide>();
  res->file_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->file_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceFrontSide::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceFrontSide");
    s.store_bytes_field("fileHash", file_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceReverseSide::Class;
jfieldID inputPassportElementErrorSourceReverseSide::file_hash_fieldID;

inputPassportElementErrorSourceReverseSide::inputPassportElementErrorSourceReverseSide()
  : file_hash_()
{}

inputPassportElementErrorSourceReverseSide::inputPassportElementErrorSourceReverseSide(bytes const &file_hash_)
  : file_hash_(std::move(file_hash_))
{}

const std::int32_t inputPassportElementErrorSourceReverseSide::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceReverseSide::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceReverseSide> res = make_object<inputPassportElementErrorSourceReverseSide>();
  res->file_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->file_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceReverseSide::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceReverseSide");
    s.store_bytes_field("fileHash", file_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceSelfie::Class;
jfieldID inputPassportElementErrorSourceSelfie::file_hash_fieldID;

inputPassportElementErrorSourceSelfie::inputPassportElementErrorSourceSelfie()
  : file_hash_()
{}

inputPassportElementErrorSourceSelfie::inputPassportElementErrorSourceSelfie(bytes const &file_hash_)
  : file_hash_(std::move(file_hash_))
{}

const std::int32_t inputPassportElementErrorSourceSelfie::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceSelfie::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceSelfie> res = make_object<inputPassportElementErrorSourceSelfie>();
  res->file_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->file_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceSelfie::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceSelfie");
    s.store_bytes_field("fileHash", file_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceTranslationFile::Class;
jfieldID inputPassportElementErrorSourceTranslationFile::file_hash_fieldID;

inputPassportElementErrorSourceTranslationFile::inputPassportElementErrorSourceTranslationFile()
  : file_hash_()
{}

inputPassportElementErrorSourceTranslationFile::inputPassportElementErrorSourceTranslationFile(bytes const &file_hash_)
  : file_hash_(std::move(file_hash_))
{}

const std::int32_t inputPassportElementErrorSourceTranslationFile::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceTranslationFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceTranslationFile> res = make_object<inputPassportElementErrorSourceTranslationFile>();
  res->file_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->file_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceTranslationFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceTranslationFile");
    s.store_bytes_field("fileHash", file_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceTranslationFiles::Class;
jfieldID inputPassportElementErrorSourceTranslationFiles::file_hashes_fieldID;

inputPassportElementErrorSourceTranslationFiles::inputPassportElementErrorSourceTranslationFiles()
  : file_hashes_()
{}

inputPassportElementErrorSourceTranslationFiles::inputPassportElementErrorSourceTranslationFiles(array<bytes> &&file_hashes_)
  : file_hashes_(std::move(file_hashes_))
{}

const std::int32_t inputPassportElementErrorSourceTranslationFiles::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceTranslationFiles::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceTranslationFiles> res = make_object<inputPassportElementErrorSourceTranslationFiles>();
  res->file_hashes_ = jni::FetchVector<jbyteArray>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->file_hashes_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceTranslationFiles::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceTranslationFiles");
    { s.store_vector_begin("fileHashes", file_hashes_.size()); for (const auto &_value : file_hashes_) { s.store_bytes_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceFile::Class;
jfieldID inputPassportElementErrorSourceFile::file_hash_fieldID;

inputPassportElementErrorSourceFile::inputPassportElementErrorSourceFile()
  : file_hash_()
{}

inputPassportElementErrorSourceFile::inputPassportElementErrorSourceFile(bytes const &file_hash_)
  : file_hash_(std::move(file_hash_))
{}

const std::int32_t inputPassportElementErrorSourceFile::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceFile> res = make_object<inputPassportElementErrorSourceFile>();
  res->file_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->file_hash_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceFile");
    s.store_bytes_field("fileHash", file_hash_);
    s.store_class_end();
  }
}

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

jclass inputPassportElementErrorSourceFiles::Class;
jfieldID inputPassportElementErrorSourceFiles::file_hashes_fieldID;

inputPassportElementErrorSourceFiles::inputPassportElementErrorSourceFiles()
  : file_hashes_()
{}

inputPassportElementErrorSourceFiles::inputPassportElementErrorSourceFiles(array<bytes> &&file_hashes_)
  : file_hashes_(std::move(file_hashes_))
{}

const std::int32_t inputPassportElementErrorSourceFiles::ID;

object_ptr<InputPassportElementErrorSource> inputPassportElementErrorSourceFiles::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementErrorSourceFiles> res = make_object<inputPassportElementErrorSourceFiles>();
  res->file_hashes_ = jni::FetchVector<jbyteArray>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->file_hashes_fieldID));
  return std::move(res);
}

void inputPassportElementErrorSourceFiles::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementErrorSourceFiles");
    { s.store_vector_begin("fileHashes", file_hashes_.size()); for (const auto &_value : file_hashes_) { s.store_bytes_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass inputTextQuote::Class;
jfieldID inputTextQuote::text_fieldID;
jfieldID inputTextQuote::position_fieldID;

inputTextQuote::inputTextQuote()
  : text_()
  , position_()
{}

inputTextQuote::inputTextQuote(object_ptr<formattedText> &&text_, int32 position_)
  : text_(std::move(text_))
  , position_(position_)
{}

const std::int32_t inputTextQuote::ID;

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

void inputTextQuote::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->SetIntField(s, position_fieldID, position_);
}

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

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

jclass InviteGroupCallParticipantResult::Class;

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

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

jclass inviteGroupCallParticipantResultUserPrivacyRestricted::Class;

inviteGroupCallParticipantResultUserPrivacyRestricted::inviteGroupCallParticipantResultUserPrivacyRestricted() {
}

const std::int32_t inviteGroupCallParticipantResultUserPrivacyRestricted::ID;

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

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

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

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

jclass inviteGroupCallParticipantResultUserAlreadyParticipant::Class;

inviteGroupCallParticipantResultUserAlreadyParticipant::inviteGroupCallParticipantResultUserAlreadyParticipant() {
}

const std::int32_t inviteGroupCallParticipantResultUserAlreadyParticipant::ID;

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

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

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

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

jclass inviteGroupCallParticipantResultUserWasBanned::Class;

inviteGroupCallParticipantResultUserWasBanned::inviteGroupCallParticipantResultUserWasBanned() {
}

const std::int32_t inviteGroupCallParticipantResultUserWasBanned::ID;

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

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

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

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

jclass inviteGroupCallParticipantResultSuccess::Class;
jfieldID inviteGroupCallParticipantResultSuccess::chat_id_fieldID;
jfieldID inviteGroupCallParticipantResultSuccess::message_id_fieldID;

inviteGroupCallParticipantResultSuccess::inviteGroupCallParticipantResultSuccess()
  : chat_id_()
  , message_id_()
{}

inviteGroupCallParticipantResultSuccess::inviteGroupCallParticipantResultSuccess(int53 chat_id_, int53 message_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t inviteGroupCallParticipantResultSuccess::ID;

object_ptr<InviteGroupCallParticipantResult> inviteGroupCallParticipantResultSuccess::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inviteGroupCallParticipantResultSuccess> res = make_object<inviteGroupCallParticipantResultSuccess>();
  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 inviteGroupCallParticipantResultSuccess::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 inviteGroupCallParticipantResultSuccess::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InviteGroupCallParticipantResultSuccess");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

void inviteGroupCallParticipantResultSuccess::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InviteGroupCallParticipantResultSuccess").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 InviteLinkChatType::Class;

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

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

jclass inviteLinkChatTypeBasicGroup::Class;

inviteLinkChatTypeBasicGroup::inviteLinkChatTypeBasicGroup() {
}

const std::int32_t inviteLinkChatTypeBasicGroup::ID;

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

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

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

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

jclass inviteLinkChatTypeSupergroup::Class;

inviteLinkChatTypeSupergroup::inviteLinkChatTypeSupergroup() {
}

const std::int32_t inviteLinkChatTypeSupergroup::ID;

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

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

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

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

jclass inviteLinkChatTypeChannel::Class;

inviteLinkChatTypeChannel::inviteLinkChatTypeChannel() {
}

const std::int32_t inviteLinkChatTypeChannel::ID;

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

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

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

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

jclass languagePackString::Class;
jfieldID languagePackString::key_fieldID;
jfieldID languagePackString::value_fieldID;

languagePackString::languagePackString()
  : key_()
  , value_()
{}

languagePackString::languagePackString(string const &key_, object_ptr<LanguagePackStringValue> &&value_)
  : key_(key_)
  , value_(std::move(value_))
{}

const std::int32_t languagePackString::ID;

object_ptr<languagePackString> languagePackString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<languagePackString> res = make_object<languagePackString>();
  res->key_ = jni::fetch_string(env, p, res->key_fieldID);
  res->value_ = jni::fetch_tl_object<LanguagePackStringValue>(env, jni::fetch_object(env, p, res->value_fieldID));
  return res;
}

void languagePackString::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, key_); if (nextString) { env->SetObjectField(s, key_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 languagePackString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LanguagePackString");
    s.store_field("key", key_);
    s.store_object_field("value", static_cast<const BaseObject *>(value_.get()));
    s.store_class_end();
  }
}

void languagePackString::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LanguagePackString").c_str());
    key_fieldID = jni::get_field_id(env, Class, "key", "Ljava/lang/String;");
    value_fieldID = jni::get_field_id(env, Class, "value", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LanguagePackStringValue;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass mainWebApp::Class;
jfieldID mainWebApp::url_fieldID;
jfieldID mainWebApp::mode_fieldID;

mainWebApp::mainWebApp()
  : url_()
  , mode_()
{}

mainWebApp::mainWebApp(string const &url_, object_ptr<WebAppOpenMode> &&mode_)
  : url_(url_)
  , mode_(std::move(mode_))
{}

const std::int32_t mainWebApp::ID;

object_ptr<mainWebApp> mainWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<mainWebApp> res = make_object<mainWebApp>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->mode_ = jni::fetch_tl_object<WebAppOpenMode>(env, jni::fetch_object(env, p, res->mode_fieldID));
  return res;
}

void mainWebApp::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); } }
  if (mode_ != nullptr) { jobject next; mode_->store(env, next); if (next) { env->SetObjectField(s, mode_fieldID, next); env->DeleteLocalRef(next); } }
}

void mainWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MainWebApp");
    s.store_field("url", url_);
    s.store_object_field("mode", static_cast<const BaseObject *>(mode_.get()));
    s.store_class_end();
  }
}

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

jclass messageAutoDeleteTime::Class;
jfieldID messageAutoDeleteTime::time_fieldID;

messageAutoDeleteTime::messageAutoDeleteTime()
  : time_()
{}

messageAutoDeleteTime::messageAutoDeleteTime(int32 time_)
  : time_(time_)
{}

const std::int32_t messageAutoDeleteTime::ID;

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

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

void messageAutoDeleteTime::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageAutoDeleteTime");
    s.store_field("time", time_);
    s.store_class_end();
  }
}

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

jclass messageCalendar::Class;
jfieldID messageCalendar::total_count_fieldID;
jfieldID messageCalendar::days_fieldID;

messageCalendar::messageCalendar()
  : total_count_()
  , days_()
{}

messageCalendar::messageCalendar(int32 total_count_, array<object_ptr<messageCalendarDay>> &&days_)
  : total_count_(total_count_)
  , days_(std::move(days_))
{}

const std::int32_t messageCalendar::ID;

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

void messageCalendar::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, days_); if (arr_tmp_) { env->SetObjectField(s, days_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

void messageCalendar::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageCalendar").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    days_fieldID = jni::get_field_id(env, Class, "days", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageCalendarDay;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messagePosition::Class;
jfieldID messagePosition::position_fieldID;
jfieldID messagePosition::message_id_fieldID;
jfieldID messagePosition::date_fieldID;

messagePosition::messagePosition()
  : position_()
  , message_id_()
  , date_()
{}

messagePosition::messagePosition(int32 position_, int53 message_id_, int32 date_)
  : position_(position_)
  , message_id_(message_id_)
  , date_(date_)
{}

const std::int32_t messagePosition::ID;

object_ptr<messagePosition> messagePosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePosition> res = make_object<messagePosition>();
  res->position_ = env->GetIntField(p, res->position_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void messagePosition::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, position_fieldID, position_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetIntField(s, date_fieldID, date_);
}

void messagePosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePosition");
    s.store_field("position", position_);
    s.store_field("messageId", message_id_);
    s.store_field("date", date_);
    s.store_class_end();
  }
}

void messagePosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePosition").c_str());
    position_fieldID = jni::get_field_id(env, Class, "position", "I");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass MessageSchedulingState::Class;

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

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

jclass messageSchedulingStateSendAtDate::Class;
jfieldID messageSchedulingStateSendAtDate::send_date_fieldID;
jfieldID messageSchedulingStateSendAtDate::repeat_period_fieldID;

messageSchedulingStateSendAtDate::messageSchedulingStateSendAtDate()
  : send_date_()
  , repeat_period_()
{}

messageSchedulingStateSendAtDate::messageSchedulingStateSendAtDate(int32 send_date_, int32 repeat_period_)
  : send_date_(send_date_)
  , repeat_period_(repeat_period_)
{}

const std::int32_t messageSchedulingStateSendAtDate::ID;

object_ptr<MessageSchedulingState> messageSchedulingStateSendAtDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSchedulingStateSendAtDate> res = make_object<messageSchedulingStateSendAtDate>();
  res->send_date_ = env->GetIntField(p, res->send_date_fieldID);
  res->repeat_period_ = env->GetIntField(p, res->repeat_period_fieldID);
  return std::move(res);
}

void messageSchedulingStateSendAtDate::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, send_date_fieldID, send_date_);
  env->SetIntField(s, repeat_period_fieldID, repeat_period_);
}

void messageSchedulingStateSendAtDate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSchedulingStateSendAtDate");
    s.store_field("sendDate", send_date_);
    s.store_field("repeatPeriod", repeat_period_);
    s.store_class_end();
  }
}

void messageSchedulingStateSendAtDate::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSchedulingStateSendAtDate").c_str());
    send_date_fieldID = jni::get_field_id(env, Class, "sendDate", "I");
    repeat_period_fieldID = jni::get_field_id(env, Class, "repeatPeriod", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageSchedulingStateSendWhenOnline::Class;

messageSchedulingStateSendWhenOnline::messageSchedulingStateSendWhenOnline() {
}

const std::int32_t messageSchedulingStateSendWhenOnline::ID;

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

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

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

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

jclass messageSchedulingStateSendWhenVideoProcessed::Class;
jfieldID messageSchedulingStateSendWhenVideoProcessed::send_date_fieldID;

messageSchedulingStateSendWhenVideoProcessed::messageSchedulingStateSendWhenVideoProcessed()
  : send_date_()
{}

messageSchedulingStateSendWhenVideoProcessed::messageSchedulingStateSendWhenVideoProcessed(int32 send_date_)
  : send_date_(send_date_)
{}

const std::int32_t messageSchedulingStateSendWhenVideoProcessed::ID;

object_ptr<MessageSchedulingState> messageSchedulingStateSendWhenVideoProcessed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSchedulingStateSendWhenVideoProcessed> res = make_object<messageSchedulingStateSendWhenVideoProcessed>();
  res->send_date_ = env->GetIntField(p, res->send_date_fieldID);
  return std::move(res);
}

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

void messageSchedulingStateSendWhenVideoProcessed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSchedulingStateSendWhenVideoProcessed");
    s.store_field("sendDate", send_date_);
    s.store_class_end();
  }
}

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

jclass messageSendOptions::Class;
jfieldID messageSendOptions::suggested_post_info_fieldID;
jfieldID messageSendOptions::disable_notification_fieldID;
jfieldID messageSendOptions::from_background_fieldID;
jfieldID messageSendOptions::protect_content_fieldID;
jfieldID messageSendOptions::allow_paid_broadcast_fieldID;
jfieldID messageSendOptions::paid_message_star_count_fieldID;
jfieldID messageSendOptions::update_order_of_installed_sticker_sets_fieldID;
jfieldID messageSendOptions::scheduling_state_fieldID;
jfieldID messageSendOptions::effect_id_fieldID;
jfieldID messageSendOptions::sending_id_fieldID;
jfieldID messageSendOptions::only_preview_fieldID;

messageSendOptions::messageSendOptions()
  : suggested_post_info_()
  , disable_notification_()
  , from_background_()
  , protect_content_()
  , allow_paid_broadcast_()
  , paid_message_star_count_()
  , update_order_of_installed_sticker_sets_()
  , scheduling_state_()
  , effect_id_()
  , sending_id_()
  , only_preview_()
{}

messageSendOptions::messageSendOptions(object_ptr<inputSuggestedPostInfo> &&suggested_post_info_, bool disable_notification_, bool from_background_, bool protect_content_, bool allow_paid_broadcast_, int53 paid_message_star_count_, bool update_order_of_installed_sticker_sets_, object_ptr<MessageSchedulingState> &&scheduling_state_, int64 effect_id_, int32 sending_id_, bool only_preview_)
  : suggested_post_info_(std::move(suggested_post_info_))
  , disable_notification_(disable_notification_)
  , from_background_(from_background_)
  , protect_content_(protect_content_)
  , allow_paid_broadcast_(allow_paid_broadcast_)
  , paid_message_star_count_(paid_message_star_count_)
  , update_order_of_installed_sticker_sets_(update_order_of_installed_sticker_sets_)
  , scheduling_state_(std::move(scheduling_state_))
  , effect_id_(effect_id_)
  , sending_id_(sending_id_)
  , only_preview_(only_preview_)
{}

const std::int32_t messageSendOptions::ID;

object_ptr<messageSendOptions> messageSendOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSendOptions> res = make_object<messageSendOptions>();
  res->suggested_post_info_ = jni::fetch_tl_object<inputSuggestedPostInfo>(env, jni::fetch_object(env, p, res->suggested_post_info_fieldID));
  res->disable_notification_ = (env->GetBooleanField(p, res->disable_notification_fieldID) != 0);
  res->from_background_ = (env->GetBooleanField(p, res->from_background_fieldID) != 0);
  res->protect_content_ = (env->GetBooleanField(p, res->protect_content_fieldID) != 0);
  res->allow_paid_broadcast_ = (env->GetBooleanField(p, res->allow_paid_broadcast_fieldID) != 0);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  res->update_order_of_installed_sticker_sets_ = (env->GetBooleanField(p, res->update_order_of_installed_sticker_sets_fieldID) != 0);
  res->scheduling_state_ = jni::fetch_tl_object<MessageSchedulingState>(env, jni::fetch_object(env, p, res->scheduling_state_fieldID));
  res->effect_id_ = env->GetLongField(p, res->effect_id_fieldID);
  res->sending_id_ = env->GetIntField(p, res->sending_id_fieldID);
  res->only_preview_ = (env->GetBooleanField(p, res->only_preview_fieldID) != 0);
  return res;
}

void messageSendOptions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSendOptions");
    s.store_object_field("suggestedPostInfo", static_cast<const BaseObject *>(suggested_post_info_.get()));
    s.store_field("disableNotification", disable_notification_);
    s.store_field("fromBackground", from_background_);
    s.store_field("protectContent", protect_content_);
    s.store_field("allowPaidBroadcast", allow_paid_broadcast_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_field("updateOrderOfInstalledStickerSets", update_order_of_installed_sticker_sets_);
    s.store_object_field("schedulingState", static_cast<const BaseObject *>(scheduling_state_.get()));
    s.store_field("effectId", effect_id_);
    s.store_field("sendingId", sending_id_);
    s.store_field("onlyPreview", only_preview_);
    s.store_class_end();
  }
}

void messageSendOptions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSendOptions").c_str());
    suggested_post_info_fieldID = jni::get_field_id(env, Class, "suggestedPostInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputSuggestedPostInfo;").c_str());
    disable_notification_fieldID = jni::get_field_id(env, Class, "disableNotification", "Z");
    from_background_fieldID = jni::get_field_id(env, Class, "fromBackground", "Z");
    protect_content_fieldID = jni::get_field_id(env, Class, "protectContent", "Z");
    allow_paid_broadcast_fieldID = jni::get_field_id(env, Class, "allowPaidBroadcast", "Z");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    update_order_of_installed_sticker_sets_fieldID = jni::get_field_id(env, Class, "updateOrderOfInstalledStickerSets", "Z");
    scheduling_state_fieldID = jni::get_field_id(env, Class, "schedulingState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSchedulingState;").c_str());
    effect_id_fieldID = jni::get_field_id(env, Class, "effectId", "J");
    sending_id_fieldID = jni::get_field_id(env, Class, "sendingId", "I");
    only_preview_fieldID = jni::get_field_id(env, Class, "onlyPreview", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass NotificationGroupType::Class;

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

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

jclass notificationGroupTypeMessages::Class;

notificationGroupTypeMessages::notificationGroupTypeMessages() {
}

const std::int32_t notificationGroupTypeMessages::ID;

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

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

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

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

jclass notificationGroupTypeMentions::Class;

notificationGroupTypeMentions::notificationGroupTypeMentions() {
}

const std::int32_t notificationGroupTypeMentions::ID;

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

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

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

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

jclass notificationGroupTypeSecretChat::Class;

notificationGroupTypeSecretChat::notificationGroupTypeSecretChat() {
}

const std::int32_t notificationGroupTypeSecretChat::ID;

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

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

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

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

jclass notificationGroupTypeCalls::Class;

notificationGroupTypeCalls::notificationGroupTypeCalls() {
}

const std::int32_t notificationGroupTypeCalls::ID;

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

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

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

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

jclass notificationSound::Class;
jfieldID notificationSound::id_fieldID;
jfieldID notificationSound::duration_fieldID;
jfieldID notificationSound::date_fieldID;
jfieldID notificationSound::title_fieldID;
jfieldID notificationSound::data_fieldID;
jfieldID notificationSound::sound_fieldID;

notificationSound::notificationSound()
  : id_()
  , duration_()
  , date_()
  , title_()
  , data_()
  , sound_()
{}

notificationSound::notificationSound(int64 id_, int32 duration_, int32 date_, string const &title_, string const &data_, object_ptr<file> &&sound_)
  : id_(id_)
  , duration_(duration_)
  , date_(date_)
  , title_(title_)
  , data_(data_)
  , sound_(std::move(sound_))
{}

const std::int32_t notificationSound::ID;

object_ptr<notificationSound> notificationSound::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<notificationSound> res = make_object<notificationSound>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  res->sound_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->sound_fieldID));
  return res;
}

void notificationSound::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, date_fieldID, date_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, data_); if (nextString) { env->SetObjectField(s, data_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (sound_ != nullptr) { jobject next; sound_->store(env, next); if (next) { env->SetObjectField(s, sound_fieldID, next); env->DeleteLocalRef(next); } }
}

void notificationSound::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NotificationSound");
    s.store_field("id", id_);
    s.store_field("duration", duration_);
    s.store_field("date", date_);
    s.store_field("title", title_);
    s.store_field("data", data_);
    s.store_object_field("sound", static_cast<const BaseObject *>(sound_.get()));
    s.store_class_end();
  }
}

void notificationSound::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NotificationSound").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    data_fieldID = jni::get_field_id(env, Class, "data", "Ljava/lang/String;");
    sound_fieldID = jni::get_field_id(env, Class, "sound", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass OptionValue::Class;

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

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

jclass optionValueBoolean::Class;
jfieldID optionValueBoolean::value_fieldID;

optionValueBoolean::optionValueBoolean()
  : value_()
{}

optionValueBoolean::optionValueBoolean(bool value_)
  : value_(value_)
{}

const std::int32_t optionValueBoolean::ID;

object_ptr<OptionValue> optionValueBoolean::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<optionValueBoolean> res = make_object<optionValueBoolean>();
  res->value_ = (env->GetBooleanField(p, res->value_fieldID) != 0);
  return std::move(res);
}

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

void optionValueBoolean::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OptionValueBoolean");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass optionValueEmpty::Class;

optionValueEmpty::optionValueEmpty() {
}

const std::int32_t optionValueEmpty::ID;

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

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

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

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

jclass optionValueInteger::Class;
jfieldID optionValueInteger::value_fieldID;

optionValueInteger::optionValueInteger()
  : value_()
{}

optionValueInteger::optionValueInteger(int64 value_)
  : value_(value_)
{}

const std::int32_t optionValueInteger::ID;

object_ptr<OptionValue> optionValueInteger::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<optionValueInteger> res = make_object<optionValueInteger>();
  res->value_ = env->GetLongField(p, res->value_fieldID);
  return std::move(res);
}

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

void optionValueInteger::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OptionValueInteger");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass optionValueString::Class;
jfieldID optionValueString::value_fieldID;

optionValueString::optionValueString()
  : value_()
{}

optionValueString::optionValueString(string const &value_)
  : value_(value_)
{}

const std::int32_t optionValueString::ID;

object_ptr<OptionValue> optionValueString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<optionValueString> res = make_object<optionValueString>();
  res->value_ = jni::fetch_string(env, p, res->value_fieldID);
  return std::move(res);
}

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

void optionValueString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OptionValueString");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass pageBlockTableCell::Class;
jfieldID pageBlockTableCell::text_fieldID;
jfieldID pageBlockTableCell::is_header_fieldID;
jfieldID pageBlockTableCell::colspan_fieldID;
jfieldID pageBlockTableCell::rowspan_fieldID;
jfieldID pageBlockTableCell::align_fieldID;
jfieldID pageBlockTableCell::valign_fieldID;

pageBlockTableCell::pageBlockTableCell()
  : text_()
  , is_header_()
  , colspan_()
  , rowspan_()
  , align_()
  , valign_()
{}

pageBlockTableCell::pageBlockTableCell(object_ptr<RichText> &&text_, bool is_header_, int32 colspan_, int32 rowspan_, object_ptr<PageBlockHorizontalAlignment> &&align_, object_ptr<PageBlockVerticalAlignment> &&valign_)
  : text_(std::move(text_))
  , is_header_(is_header_)
  , colspan_(colspan_)
  , rowspan_(rowspan_)
  , align_(std::move(align_))
  , valign_(std::move(valign_))
{}

const std::int32_t pageBlockTableCell::ID;

object_ptr<pageBlockTableCell> pageBlockTableCell::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockTableCell> res = make_object<pageBlockTableCell>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->is_header_ = (env->GetBooleanField(p, res->is_header_fieldID) != 0);
  res->colspan_ = env->GetIntField(p, res->colspan_fieldID);
  res->rowspan_ = env->GetIntField(p, res->rowspan_fieldID);
  res->align_ = jni::fetch_tl_object<PageBlockHorizontalAlignment>(env, jni::fetch_object(env, p, res->align_fieldID));
  res->valign_ = jni::fetch_tl_object<PageBlockVerticalAlignment>(env, jni::fetch_object(env, p, res->valign_fieldID));
  return res;
}

void pageBlockTableCell::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, is_header_fieldID, is_header_);
  env->SetIntField(s, colspan_fieldID, colspan_);
  env->SetIntField(s, rowspan_fieldID, rowspan_);
  if (align_ != nullptr) { jobject next; align_->store(env, next); if (next) { env->SetObjectField(s, align_fieldID, next); env->DeleteLocalRef(next); } }
  if (valign_ != nullptr) { jobject next; valign_->store(env, next); if (next) { env->SetObjectField(s, valign_fieldID, next); env->DeleteLocalRef(next); } }
}

void pageBlockTableCell::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockTableCell");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("isHeader", is_header_);
    s.store_field("colspan", colspan_);
    s.store_field("rowspan", rowspan_);
    s.store_object_field("align", static_cast<const BaseObject *>(align_.get()));
    s.store_object_field("valign", static_cast<const BaseObject *>(valign_.get()));
    s.store_class_end();
  }
}

void pageBlockTableCell::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockTableCell").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    is_header_fieldID = jni::get_field_id(env, Class, "isHeader", "Z");
    colspan_fieldID = jni::get_field_id(env, Class, "colspan", "I");
    rowspan_fieldID = jni::get_field_id(env, Class, "rowspan", "I");
    align_fieldID = jni::get_field_id(env, Class, "align", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockHorizontalAlignment;").c_str());
    valign_fieldID = jni::get_field_id(env, Class, "valign", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockVerticalAlignment;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass paidReactor::Class;
jfieldID paidReactor::sender_id_fieldID;
jfieldID paidReactor::star_count_fieldID;
jfieldID paidReactor::is_top_fieldID;
jfieldID paidReactor::is_me_fieldID;
jfieldID paidReactor::is_anonymous_fieldID;

paidReactor::paidReactor()
  : sender_id_()
  , star_count_()
  , is_top_()
  , is_me_()
  , is_anonymous_()
{}

paidReactor::paidReactor(object_ptr<MessageSender> &&sender_id_, int53 star_count_, bool is_top_, bool is_me_, bool is_anonymous_)
  : sender_id_(std::move(sender_id_))
  , star_count_(star_count_)
  , is_top_(is_top_)
  , is_me_(is_me_)
  , is_anonymous_(is_anonymous_)
{}

const std::int32_t paidReactor::ID;

object_ptr<paidReactor> paidReactor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paidReactor> res = make_object<paidReactor>();
  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);
  res->is_top_ = (env->GetBooleanField(p, res->is_top_fieldID) != 0);
  res->is_me_ = (env->GetBooleanField(p, res->is_me_fieldID) != 0);
  res->is_anonymous_ = (env->GetBooleanField(p, res->is_anonymous_fieldID) != 0);
  return res;
}

void paidReactor::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  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_);
  env->SetBooleanField(s, is_top_fieldID, is_top_);
  env->SetBooleanField(s, is_me_fieldID, is_me_);
  env->SetBooleanField(s, is_anonymous_fieldID, is_anonymous_);
}

void paidReactor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaidReactor");
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("starCount", star_count_);
    s.store_field("isTop", is_top_);
    s.store_field("isMe", is_me_);
    s.store_field("isAnonymous", is_anonymous_);
    s.store_class_end();
  }
}

void paidReactor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaidReactor").c_str());
    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");
    is_top_fieldID = jni::get_field_id(env, Class, "isTop", "Z");
    is_me_fieldID = jni::get_field_id(env, Class, "isMe", "Z");
    is_anonymous_fieldID = jni::get_field_id(env, Class, "isAnonymous", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass passportElementError::Class;
jfieldID passportElementError::type_fieldID;
jfieldID passportElementError::message_fieldID;
jfieldID passportElementError::source_fieldID;

passportElementError::passportElementError()
  : type_()
  , message_()
  , source_()
{}

passportElementError::passportElementError(object_ptr<PassportElementType> &&type_, string const &message_, object_ptr<PassportElementErrorSource> &&source_)
  : type_(std::move(type_))
  , message_(message_)
  , source_(std::move(source_))
{}

const std::int32_t passportElementError::ID;

object_ptr<passportElementError> passportElementError::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passportElementError> res = make_object<passportElementError>();
  res->type_ = jni::fetch_tl_object<PassportElementType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->message_ = jni::fetch_string(env, p, res->message_fieldID);
  res->source_ = jni::fetch_tl_object<PassportElementErrorSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  return res;
}

void passportElementError::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); } }
  { jstring nextString = jni::to_jstring(env, message_); if (nextString) { env->SetObjectField(s, message_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (source_ != nullptr) { jobject next; source_->store(env, next); if (next) { env->SetObjectField(s, source_fieldID, next); env->DeleteLocalRef(next); } }
}

void passportElementError::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PassportElementError");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("message", message_);
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_class_end();
  }
}

void passportElementError::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PassportElementError").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PassportElementType;").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", "Ljava/lang/String;");
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PassportElementErrorSource;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PassportElementType::Class;

object_ptr<PassportElementType> PassportElementType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case passportElementTypePersonalDetails::ID:
      return passportElementTypePersonalDetails::fetch(env, p);
    case passportElementTypePassport::ID:
      return passportElementTypePassport::fetch(env, p);
    case passportElementTypeDriverLicense::ID:
      return passportElementTypeDriverLicense::fetch(env, p);
    case passportElementTypeIdentityCard::ID:
      return passportElementTypeIdentityCard::fetch(env, p);
    case passportElementTypeInternalPassport::ID:
      return passportElementTypeInternalPassport::fetch(env, p);
    case passportElementTypeAddress::ID:
      return passportElementTypeAddress::fetch(env, p);
    case passportElementTypeUtilityBill::ID:
      return passportElementTypeUtilityBill::fetch(env, p);
    case passportElementTypeBankStatement::ID:
      return passportElementTypeBankStatement::fetch(env, p);
    case passportElementTypeRentalAgreement::ID:
      return passportElementTypeRentalAgreement::fetch(env, p);
    case passportElementTypePassportRegistration::ID:
      return passportElementTypePassportRegistration::fetch(env, p);
    case passportElementTypeTemporaryRegistration::ID:
      return passportElementTypeTemporaryRegistration::fetch(env, p);
    case passportElementTypePhoneNumber::ID:
      return passportElementTypePhoneNumber::fetch(env, p);
    case passportElementTypeEmailAddress::ID:
      return passportElementTypeEmailAddress::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass passportElementTypePersonalDetails::Class;

passportElementTypePersonalDetails::passportElementTypePersonalDetails() {
}

const std::int32_t passportElementTypePersonalDetails::ID;

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

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

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

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

jclass passportElementTypePassport::Class;

passportElementTypePassport::passportElementTypePassport() {
}

const std::int32_t passportElementTypePassport::ID;

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

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

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

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

jclass passportElementTypeDriverLicense::Class;

passportElementTypeDriverLicense::passportElementTypeDriverLicense() {
}

const std::int32_t passportElementTypeDriverLicense::ID;

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

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

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

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

jclass passportElementTypeIdentityCard::Class;

passportElementTypeIdentityCard::passportElementTypeIdentityCard() {
}

const std::int32_t passportElementTypeIdentityCard::ID;

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

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

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

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

jclass passportElementTypeInternalPassport::Class;

passportElementTypeInternalPassport::passportElementTypeInternalPassport() {
}

const std::int32_t passportElementTypeInternalPassport::ID;

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

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

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

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

jclass passportElementTypeAddress::Class;

passportElementTypeAddress::passportElementTypeAddress() {
}

const std::int32_t passportElementTypeAddress::ID;

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

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

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

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

jclass passportElementTypeUtilityBill::Class;

passportElementTypeUtilityBill::passportElementTypeUtilityBill() {
}

const std::int32_t passportElementTypeUtilityBill::ID;

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

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

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

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

jclass passportElementTypeBankStatement::Class;

passportElementTypeBankStatement::passportElementTypeBankStatement() {
}

const std::int32_t passportElementTypeBankStatement::ID;

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

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

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

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

jclass passportElementTypeRentalAgreement::Class;

passportElementTypeRentalAgreement::passportElementTypeRentalAgreement() {
}

const std::int32_t passportElementTypeRentalAgreement::ID;

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

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

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

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

jclass passportElementTypePassportRegistration::Class;

passportElementTypePassportRegistration::passportElementTypePassportRegistration() {
}

const std::int32_t passportElementTypePassportRegistration::ID;

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

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

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

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

jclass passportElementTypeTemporaryRegistration::Class;

passportElementTypeTemporaryRegistration::passportElementTypeTemporaryRegistration() {
}

const std::int32_t passportElementTypeTemporaryRegistration::ID;

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

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

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

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

jclass passportElementTypePhoneNumber::Class;

passportElementTypePhoneNumber::passportElementTypePhoneNumber() {
}

const std::int32_t passportElementTypePhoneNumber::ID;

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

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

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

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

jclass passportElementTypeEmailAddress::Class;

passportElementTypeEmailAddress::passportElementTypeEmailAddress() {
}

const std::int32_t passportElementTypeEmailAddress::ID;

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

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

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

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

jclass paymentForm::Class;
jfieldID paymentForm::id_fieldID;
jfieldID paymentForm::type_fieldID;
jfieldID paymentForm::seller_bot_user_id_fieldID;
jfieldID paymentForm::product_info_fieldID;

paymentForm::paymentForm()
  : id_()
  , type_()
  , seller_bot_user_id_()
  , product_info_()
{}

paymentForm::paymentForm(int64 id_, object_ptr<PaymentFormType> &&type_, int53 seller_bot_user_id_, object_ptr<productInfo> &&product_info_)
  : id_(id_)
  , type_(std::move(type_))
  , seller_bot_user_id_(seller_bot_user_id_)
  , product_info_(std::move(product_info_))
{}

const std::int32_t paymentForm::ID;

object_ptr<paymentForm> paymentForm::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentForm> res = make_object<paymentForm>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->type_ = jni::fetch_tl_object<PaymentFormType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->seller_bot_user_id_ = env->GetLongField(p, res->seller_bot_user_id_fieldID);
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  return res;
}

void paymentForm::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, seller_bot_user_id_fieldID, seller_bot_user_id_);
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void paymentForm::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentForm");
    s.store_field("id", id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("sellerBotUserId", seller_bot_user_id_);
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_class_end();
  }
}

void paymentForm::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentForm").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PaymentFormType;").c_str());
    seller_bot_user_id_fieldID = jni::get_field_id(env, Class, "sellerBotUserId", "J");
    product_info_fieldID = jni::get_field_id(env, Class, "productInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProductInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PhoneNumberCodeType::Class;

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

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

jclass phoneNumberCodeTypeChange::Class;

phoneNumberCodeTypeChange::phoneNumberCodeTypeChange() {
}

const std::int32_t phoneNumberCodeTypeChange::ID;

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

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

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

jclass phoneNumberCodeTypeVerify::Class;

phoneNumberCodeTypeVerify::phoneNumberCodeTypeVerify() {
}

const std::int32_t phoneNumberCodeTypeVerify::ID;

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

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

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

jclass phoneNumberCodeTypeConfirmOwnership::Class;
jfieldID phoneNumberCodeTypeConfirmOwnership::hash_fieldID;

phoneNumberCodeTypeConfirmOwnership::phoneNumberCodeTypeConfirmOwnership()
  : hash_()
{}

phoneNumberCodeTypeConfirmOwnership::phoneNumberCodeTypeConfirmOwnership(string const &hash_)
  : hash_(hash_)
{}

const std::int32_t phoneNumberCodeTypeConfirmOwnership::ID;

object_ptr<PhoneNumberCodeType> phoneNumberCodeTypeConfirmOwnership::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<phoneNumberCodeTypeConfirmOwnership> res = make_object<phoneNumberCodeTypeConfirmOwnership>();
  res->hash_ = jni::fetch_string(env, p, res->hash_fieldID);
  return std::move(res);
}

void phoneNumberCodeTypeConfirmOwnership::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PhoneNumberCodeTypeConfirmOwnership");
    s.store_field("hash", hash_);
    s.store_class_end();
  }
}

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

jclass PollVoteRestrictionReason::Class;

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

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

jclass pollVoteRestrictionReasonClosed::Class;

pollVoteRestrictionReasonClosed::pollVoteRestrictionReasonClosed() {
}

const std::int32_t pollVoteRestrictionReasonClosed::ID;

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

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

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

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

jclass pollVoteRestrictionReasonYetUnsent::Class;

pollVoteRestrictionReasonYetUnsent::pollVoteRestrictionReasonYetUnsent() {
}

const std::int32_t pollVoteRestrictionReasonYetUnsent::ID;

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

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

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

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

jclass pollVoteRestrictionReasonScheduled::Class;

pollVoteRestrictionReasonScheduled::pollVoteRestrictionReasonScheduled() {
}

const std::int32_t pollVoteRestrictionReasonScheduled::ID;

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

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

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

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

jclass pollVoteRestrictionReasonCountryRestricted::Class;
jfieldID pollVoteRestrictionReasonCountryRestricted::country_code_fieldID;

pollVoteRestrictionReasonCountryRestricted::pollVoteRestrictionReasonCountryRestricted()
  : country_code_()
{}

pollVoteRestrictionReasonCountryRestricted::pollVoteRestrictionReasonCountryRestricted(string const &country_code_)
  : country_code_(country_code_)
{}

const std::int32_t pollVoteRestrictionReasonCountryRestricted::ID;

object_ptr<PollVoteRestrictionReason> pollVoteRestrictionReasonCountryRestricted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pollVoteRestrictionReasonCountryRestricted> res = make_object<pollVoteRestrictionReasonCountryRestricted>();
  res->country_code_ = jni::fetch_string(env, p, res->country_code_fieldID);
  return std::move(res);
}

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

void pollVoteRestrictionReasonCountryRestricted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PollVoteRestrictionReasonCountryRestricted");
    s.store_field("countryCode", country_code_);
    s.store_class_end();
  }
}

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

jclass pollVoteRestrictionReasonMembershipRequired::Class;
jfieldID pollVoteRestrictionReasonMembershipRequired::chat_id_fieldID;

pollVoteRestrictionReasonMembershipRequired::pollVoteRestrictionReasonMembershipRequired()
  : chat_id_()
{}

pollVoteRestrictionReasonMembershipRequired::pollVoteRestrictionReasonMembershipRequired(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t pollVoteRestrictionReasonMembershipRequired::ID;

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

void pollVoteRestrictionReasonMembershipRequired::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_);
}

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

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

jclass pollVoteRestrictionReasonOther::Class;

pollVoteRestrictionReasonOther::pollVoteRestrictionReasonOther() {
}

const std::int32_t pollVoteRestrictionReasonOther::ID;

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

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

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

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

jclass RichText::Class;

object_ptr<RichText> RichText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case richTextPlain::ID:
      return richTextPlain::fetch(env, p);
    case richTextBold::ID:
      return richTextBold::fetch(env, p);
    case richTextItalic::ID:
      return richTextItalic::fetch(env, p);
    case richTextUnderline::ID:
      return richTextUnderline::fetch(env, p);
    case richTextStrikethrough::ID:
      return richTextStrikethrough::fetch(env, p);
    case richTextFixed::ID:
      return richTextFixed::fetch(env, p);
    case richTextUrl::ID:
      return richTextUrl::fetch(env, p);
    case richTextEmailAddress::ID:
      return richTextEmailAddress::fetch(env, p);
    case richTextSubscript::ID:
      return richTextSubscript::fetch(env, p);
    case richTextSuperscript::ID:
      return richTextSuperscript::fetch(env, p);
    case richTextMarked::ID:
      return richTextMarked::fetch(env, p);
    case richTextPhoneNumber::ID:
      return richTextPhoneNumber::fetch(env, p);
    case richTextIcon::ID:
      return richTextIcon::fetch(env, p);
    case richTextReference::ID:
      return richTextReference::fetch(env, p);
    case richTextAnchor::ID:
      return richTextAnchor::fetch(env, p);
    case richTextAnchorLink::ID:
      return richTextAnchorLink::fetch(env, p);
    case richTexts::ID:
      return richTexts::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass richTextPlain::Class;
jfieldID richTextPlain::text_fieldID;

richTextPlain::richTextPlain()
  : text_()
{}

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

const std::int32_t richTextPlain::ID;

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

void richTextPlain::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 richTextPlain::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RichTextPlain");
    s.store_field("text", text_);
    s.store_class_end();
  }
}

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

jclass richTextBold::Class;
jfieldID richTextBold::text_fieldID;

richTextBold::richTextBold()
  : text_()
{}

richTextBold::richTextBold(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextBold::ID;

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

void richTextBold::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); } }
}

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

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

jclass richTextItalic::Class;
jfieldID richTextItalic::text_fieldID;

richTextItalic::richTextItalic()
  : text_()
{}

richTextItalic::richTextItalic(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextItalic::ID;

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

void richTextItalic::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); } }
}

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

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

jclass richTextUnderline::Class;
jfieldID richTextUnderline::text_fieldID;

richTextUnderline::richTextUnderline()
  : text_()
{}

richTextUnderline::richTextUnderline(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextUnderline::ID;

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

void richTextUnderline::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); } }
}

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

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

jclass richTextStrikethrough::Class;
jfieldID richTextStrikethrough::text_fieldID;

richTextStrikethrough::richTextStrikethrough()
  : text_()
{}

richTextStrikethrough::richTextStrikethrough(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextStrikethrough::ID;

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

void richTextStrikethrough::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); } }
}

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

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

jclass richTextFixed::Class;
jfieldID richTextFixed::text_fieldID;

richTextFixed::richTextFixed()
  : text_()
{}

richTextFixed::richTextFixed(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextFixed::ID;

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

void richTextFixed::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); } }
}

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

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

jclass richTextUrl::Class;
jfieldID richTextUrl::text_fieldID;
jfieldID richTextUrl::url_fieldID;
jfieldID richTextUrl::is_cached_fieldID;

richTextUrl::richTextUrl()
  : text_()
  , url_()
  , is_cached_()
{}

richTextUrl::richTextUrl(object_ptr<RichText> &&text_, string const &url_, bool is_cached_)
  : text_(std::move(text_))
  , url_(url_)
  , is_cached_(is_cached_)
{}

const std::int32_t richTextUrl::ID;

object_ptr<RichText> richTextUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextUrl> res = make_object<richTextUrl>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->is_cached_ = (env->GetBooleanField(p, res->is_cached_fieldID) != 0);
  return std::move(res);
}

void richTextUrl::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); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_cached_fieldID, is_cached_);
}

void richTextUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RichTextUrl");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("url", url_);
    s.store_field("isCached", is_cached_);
    s.store_class_end();
  }
}

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

jclass richTextEmailAddress::Class;
jfieldID richTextEmailAddress::text_fieldID;
jfieldID richTextEmailAddress::email_address_fieldID;

richTextEmailAddress::richTextEmailAddress()
  : text_()
  , email_address_()
{}

richTextEmailAddress::richTextEmailAddress(object_ptr<RichText> &&text_, string const &email_address_)
  : text_(std::move(text_))
  , email_address_(email_address_)
{}

const std::int32_t richTextEmailAddress::ID;

object_ptr<RichText> richTextEmailAddress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextEmailAddress> res = make_object<richTextEmailAddress>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->email_address_ = jni::fetch_string(env, p, res->email_address_fieldID);
  return std::move(res);
}

void richTextEmailAddress::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); } }
  { jstring nextString = jni::to_jstring(env, email_address_); if (nextString) { env->SetObjectField(s, email_address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass richTextSubscript::Class;
jfieldID richTextSubscript::text_fieldID;

richTextSubscript::richTextSubscript()
  : text_()
{}

richTextSubscript::richTextSubscript(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextSubscript::ID;

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

void richTextSubscript::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); } }
}

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

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

jclass richTextSuperscript::Class;
jfieldID richTextSuperscript::text_fieldID;

richTextSuperscript::richTextSuperscript()
  : text_()
{}

richTextSuperscript::richTextSuperscript(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextSuperscript::ID;

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

void richTextSuperscript::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); } }
}

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

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

jclass richTextMarked::Class;
jfieldID richTextMarked::text_fieldID;

richTextMarked::richTextMarked()
  : text_()
{}

richTextMarked::richTextMarked(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t richTextMarked::ID;

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

void richTextMarked::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); } }
}

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

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

jclass richTextPhoneNumber::Class;
jfieldID richTextPhoneNumber::text_fieldID;
jfieldID richTextPhoneNumber::phone_number_fieldID;

richTextPhoneNumber::richTextPhoneNumber()
  : text_()
  , phone_number_()
{}

richTextPhoneNumber::richTextPhoneNumber(object_ptr<RichText> &&text_, string const &phone_number_)
  : text_(std::move(text_))
  , phone_number_(phone_number_)
{}

const std::int32_t richTextPhoneNumber::ID;

object_ptr<RichText> richTextPhoneNumber::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextPhoneNumber> res = make_object<richTextPhoneNumber>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  return std::move(res);
}

void richTextPhoneNumber::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); } }
  { jstring nextString = jni::to_jstring(env, phone_number_); if (nextString) { env->SetObjectField(s, phone_number_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass richTextIcon::Class;
jfieldID richTextIcon::document_fieldID;
jfieldID richTextIcon::width_fieldID;
jfieldID richTextIcon::height_fieldID;

richTextIcon::richTextIcon()
  : document_()
  , width_()
  , height_()
{}

richTextIcon::richTextIcon(object_ptr<document> &&document_, int32 width_, int32 height_)
  : document_(std::move(document_))
  , width_(width_)
  , height_(height_)
{}

const std::int32_t richTextIcon::ID;

object_ptr<RichText> richTextIcon::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextIcon> res = make_object<richTextIcon>();
  res->document_ = jni::fetch_tl_object<document>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  return std::move(res);
}

void richTextIcon::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (document_ != nullptr) { jobject next; document_->store(env, next); if (next) { env->SetObjectField(s, document_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
}

void richTextIcon::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RichTextIcon");
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_class_end();
  }
}

void richTextIcon::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RichTextIcon").c_str());
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Document;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    return true;
  }();
  (void)is_inited;
}

jclass richTextReference::Class;
jfieldID richTextReference::text_fieldID;
jfieldID richTextReference::anchor_name_fieldID;
jfieldID richTextReference::url_fieldID;

richTextReference::richTextReference()
  : text_()
  , anchor_name_()
  , url_()
{}

richTextReference::richTextReference(object_ptr<RichText> &&text_, string const &anchor_name_, string const &url_)
  : text_(std::move(text_))
  , anchor_name_(anchor_name_)
  , url_(url_)
{}

const std::int32_t richTextReference::ID;

object_ptr<RichText> richTextReference::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextReference> res = make_object<richTextReference>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->anchor_name_ = jni::fetch_string(env, p, res->anchor_name_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void richTextReference::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); } }
  { jstring nextString = jni::to_jstring(env, anchor_name_); if (nextString) { env->SetObjectField(s, anchor_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void richTextReference::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RichTextReference");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("anchorName", anchor_name_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

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

jclass richTextAnchor::Class;
jfieldID richTextAnchor::name_fieldID;

richTextAnchor::richTextAnchor()
  : name_()
{}

richTextAnchor::richTextAnchor(string const &name_)
  : name_(name_)
{}

const std::int32_t richTextAnchor::ID;

object_ptr<RichText> richTextAnchor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextAnchor> res = make_object<richTextAnchor>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return std::move(res);
}

void richTextAnchor::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); } }
}

void richTextAnchor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RichTextAnchor");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

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

jclass richTextAnchorLink::Class;
jfieldID richTextAnchorLink::text_fieldID;
jfieldID richTextAnchorLink::anchor_name_fieldID;
jfieldID richTextAnchorLink::url_fieldID;

richTextAnchorLink::richTextAnchorLink()
  : text_()
  , anchor_name_()
  , url_()
{}

richTextAnchorLink::richTextAnchorLink(object_ptr<RichText> &&text_, string const &anchor_name_, string const &url_)
  : text_(std::move(text_))
  , anchor_name_(anchor_name_)
  , url_(url_)
{}

const std::int32_t richTextAnchorLink::ID;

object_ptr<RichText> richTextAnchorLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTextAnchorLink> res = make_object<richTextAnchorLink>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->anchor_name_ = jni::fetch_string(env, p, res->anchor_name_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void richTextAnchorLink::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); } }
  { jstring nextString = jni::to_jstring(env, anchor_name_); if (nextString) { env->SetObjectField(s, anchor_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void richTextAnchorLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RichTextAnchorLink");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("anchorName", anchor_name_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

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

jclass richTexts::Class;
jfieldID richTexts::texts_fieldID;

richTexts::richTexts()
  : texts_()
{}

richTexts::richTexts(array<object_ptr<RichText>> &&texts_)
  : texts_(std::move(texts_))
{}

const std::int32_t richTexts::ID;

object_ptr<RichText> richTexts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<richTexts> res = make_object<richTexts>();
  res->texts_ = jni::FetchVector<RichText>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->texts_fieldID));
  return std::move(res);
}

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

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

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

jclass savedMessagesTags::Class;
jfieldID savedMessagesTags::tags_fieldID;

savedMessagesTags::savedMessagesTags()
  : tags_()
{}

savedMessagesTags::savedMessagesTags(array<object_ptr<savedMessagesTag>> &&tags_)
  : tags_(std::move(tags_))
{}

const std::int32_t savedMessagesTags::ID;

object_ptr<savedMessagesTags> savedMessagesTags::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<savedMessagesTags> res = make_object<savedMessagesTags>();
  res->tags_ = jni::FetchVector<savedMessagesTag>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->tags_fieldID));
  return res;
}

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

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

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

jclass savedMessagesTopic::Class;
jfieldID savedMessagesTopic::id_fieldID;
jfieldID savedMessagesTopic::type_fieldID;
jfieldID savedMessagesTopic::is_pinned_fieldID;
jfieldID savedMessagesTopic::order_fieldID;
jfieldID savedMessagesTopic::last_message_fieldID;
jfieldID savedMessagesTopic::draft_message_fieldID;

savedMessagesTopic::savedMessagesTopic()
  : id_()
  , type_()
  , is_pinned_()
  , order_()
  , last_message_()
  , draft_message_()
{}

savedMessagesTopic::savedMessagesTopic(int53 id_, object_ptr<SavedMessagesTopicType> &&type_, bool is_pinned_, int64 order_, object_ptr<message> &&last_message_, object_ptr<draftMessage> &&draft_message_)
  : id_(id_)
  , type_(std::move(type_))
  , is_pinned_(is_pinned_)
  , order_(order_)
  , last_message_(std::move(last_message_))
  , draft_message_(std::move(draft_message_))
{}

const std::int32_t savedMessagesTopic::ID;

object_ptr<savedMessagesTopic> savedMessagesTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<savedMessagesTopic> res = make_object<savedMessagesTopic>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->type_ = jni::fetch_tl_object<SavedMessagesTopicType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  res->order_ = env->GetLongField(p, res->order_fieldID);
  res->last_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->last_message_fieldID));
  res->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  return res;
}

void savedMessagesTopic::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
  env->SetLongField(s, order_fieldID, order_);
  if (last_message_ != nullptr) { jobject next; last_message_->store(env, next); if (next) { env->SetObjectField(s, last_message_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 savedMessagesTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SavedMessagesTopic");
    s.store_field("id", id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("isPinned", is_pinned_);
    s.store_field("order", order_);
    s.store_object_field("lastMessage", static_cast<const BaseObject *>(last_message_.get()));
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_class_end();
  }
}

void savedMessagesTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SavedMessagesTopic").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SavedMessagesTopicType;").c_str());
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    order_fieldID = jni::get_field_id(env, Class, "order", "J");
    last_message_fieldID = jni::get_field_id(env, Class, "lastMessage", (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 SearchMessagesFilter::Class;

object_ptr<SearchMessagesFilter> SearchMessagesFilter::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case searchMessagesFilterEmpty::ID:
      return searchMessagesFilterEmpty::fetch(env, p);
    case searchMessagesFilterAnimation::ID:
      return searchMessagesFilterAnimation::fetch(env, p);
    case searchMessagesFilterAudio::ID:
      return searchMessagesFilterAudio::fetch(env, p);
    case searchMessagesFilterDocument::ID:
      return searchMessagesFilterDocument::fetch(env, p);
    case searchMessagesFilterPhoto::ID:
      return searchMessagesFilterPhoto::fetch(env, p);
    case searchMessagesFilterPoll::ID:
      return searchMessagesFilterPoll::fetch(env, p);
    case searchMessagesFilterVideo::ID:
      return searchMessagesFilterVideo::fetch(env, p);
    case searchMessagesFilterVoiceNote::ID:
      return searchMessagesFilterVoiceNote::fetch(env, p);
    case searchMessagesFilterPhotoAndVideo::ID:
      return searchMessagesFilterPhotoAndVideo::fetch(env, p);
    case searchMessagesFilterUrl::ID:
      return searchMessagesFilterUrl::fetch(env, p);
    case searchMessagesFilterChatPhoto::ID:
      return searchMessagesFilterChatPhoto::fetch(env, p);
    case searchMessagesFilterVideoNote::ID:
      return searchMessagesFilterVideoNote::fetch(env, p);
    case searchMessagesFilterVoiceAndVideoNote::ID:
      return searchMessagesFilterVoiceAndVideoNote::fetch(env, p);
    case searchMessagesFilterMention::ID:
      return searchMessagesFilterMention::fetch(env, p);
    case searchMessagesFilterUnreadMention::ID:
      return searchMessagesFilterUnreadMention::fetch(env, p);
    case searchMessagesFilterUnreadReaction::ID:
      return searchMessagesFilterUnreadReaction::fetch(env, p);
    case searchMessagesFilterUnreadPollVote::ID:
      return searchMessagesFilterUnreadPollVote::fetch(env, p);
    case searchMessagesFilterFailedToSend::ID:
      return searchMessagesFilterFailedToSend::fetch(env, p);
    case searchMessagesFilterPinned::ID:
      return searchMessagesFilterPinned::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass searchMessagesFilterEmpty::Class;

searchMessagesFilterEmpty::searchMessagesFilterEmpty() {
}

const std::int32_t searchMessagesFilterEmpty::ID;

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

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

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

jclass searchMessagesFilterAnimation::Class;

searchMessagesFilterAnimation::searchMessagesFilterAnimation() {
}

const std::int32_t searchMessagesFilterAnimation::ID;

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

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

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

jclass searchMessagesFilterAudio::Class;

searchMessagesFilterAudio::searchMessagesFilterAudio() {
}

const std::int32_t searchMessagesFilterAudio::ID;

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

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

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

jclass searchMessagesFilterDocument::Class;

searchMessagesFilterDocument::searchMessagesFilterDocument() {
}

const std::int32_t searchMessagesFilterDocument::ID;

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

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

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

jclass searchMessagesFilterPhoto::Class;

searchMessagesFilterPhoto::searchMessagesFilterPhoto() {
}

const std::int32_t searchMessagesFilterPhoto::ID;

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

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

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

jclass searchMessagesFilterPoll::Class;

searchMessagesFilterPoll::searchMessagesFilterPoll() {
}

const std::int32_t searchMessagesFilterPoll::ID;

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

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

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

jclass searchMessagesFilterVideo::Class;

searchMessagesFilterVideo::searchMessagesFilterVideo() {
}

const std::int32_t searchMessagesFilterVideo::ID;

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

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

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

jclass searchMessagesFilterVoiceNote::Class;

searchMessagesFilterVoiceNote::searchMessagesFilterVoiceNote() {
}

const std::int32_t searchMessagesFilterVoiceNote::ID;

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

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

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

jclass searchMessagesFilterPhotoAndVideo::Class;

searchMessagesFilterPhotoAndVideo::searchMessagesFilterPhotoAndVideo() {
}

const std::int32_t searchMessagesFilterPhotoAndVideo::ID;

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

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

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

jclass searchMessagesFilterUrl::Class;

searchMessagesFilterUrl::searchMessagesFilterUrl() {
}

const std::int32_t searchMessagesFilterUrl::ID;

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

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

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

jclass searchMessagesFilterChatPhoto::Class;

searchMessagesFilterChatPhoto::searchMessagesFilterChatPhoto() {
}

const std::int32_t searchMessagesFilterChatPhoto::ID;

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

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

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

jclass searchMessagesFilterVideoNote::Class;

searchMessagesFilterVideoNote::searchMessagesFilterVideoNote() {
}

const std::int32_t searchMessagesFilterVideoNote::ID;

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

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

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

jclass searchMessagesFilterVoiceAndVideoNote::Class;

searchMessagesFilterVoiceAndVideoNote::searchMessagesFilterVoiceAndVideoNote() {
}

const std::int32_t searchMessagesFilterVoiceAndVideoNote::ID;

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

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

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

jclass searchMessagesFilterMention::Class;

searchMessagesFilterMention::searchMessagesFilterMention() {
}

const std::int32_t searchMessagesFilterMention::ID;

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

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

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

jclass searchMessagesFilterUnreadMention::Class;

searchMessagesFilterUnreadMention::searchMessagesFilterUnreadMention() {
}

const std::int32_t searchMessagesFilterUnreadMention::ID;

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

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

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

jclass searchMessagesFilterUnreadReaction::Class;

searchMessagesFilterUnreadReaction::searchMessagesFilterUnreadReaction() {
}

const std::int32_t searchMessagesFilterUnreadReaction::ID;

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

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

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

jclass searchMessagesFilterUnreadPollVote::Class;

searchMessagesFilterUnreadPollVote::searchMessagesFilterUnreadPollVote() {
}

const std::int32_t searchMessagesFilterUnreadPollVote::ID;

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

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

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

jclass searchMessagesFilterFailedToSend::Class;

searchMessagesFilterFailedToSend::searchMessagesFilterFailedToSend() {
}

const std::int32_t searchMessagesFilterFailedToSend::ID;

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

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

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

jclass searchMessagesFilterPinned::Class;

searchMessagesFilterPinned::searchMessagesFilterPinned() {
}

const std::int32_t searchMessagesFilterPinned::ID;

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

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

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

jclass session::Class;
jfieldID session::id_fieldID;
jfieldID session::is_current_fieldID;
jfieldID session::is_password_pending_fieldID;
jfieldID session::is_unconfirmed_fieldID;
jfieldID session::can_accept_secret_chats_fieldID;
jfieldID session::can_accept_calls_fieldID;
jfieldID session::type_fieldID;
jfieldID session::api_id_fieldID;
jfieldID session::application_name_fieldID;
jfieldID session::application_version_fieldID;
jfieldID session::is_official_application_fieldID;
jfieldID session::device_model_fieldID;
jfieldID session::platform_fieldID;
jfieldID session::system_version_fieldID;
jfieldID session::log_in_date_fieldID;
jfieldID session::last_active_date_fieldID;
jfieldID session::ip_address_fieldID;
jfieldID session::location_fieldID;

session::session()
  : id_()
  , is_current_()
  , is_password_pending_()
  , is_unconfirmed_()
  , can_accept_secret_chats_()
  , can_accept_calls_()
  , type_()
  , api_id_()
  , application_name_()
  , application_version_()
  , is_official_application_()
  , device_model_()
  , platform_()
  , system_version_()
  , log_in_date_()
  , last_active_date_()
  , ip_address_()
  , location_()
{}

session::session(int64 id_, bool is_current_, bool is_password_pending_, bool is_unconfirmed_, bool can_accept_secret_chats_, bool can_accept_calls_, object_ptr<SessionType> &&type_, int32 api_id_, string const &application_name_, string const &application_version_, bool is_official_application_, string const &device_model_, string const &platform_, string const &system_version_, int32 log_in_date_, int32 last_active_date_, string const &ip_address_, string const &location_)
  : id_(id_)
  , is_current_(is_current_)
  , is_password_pending_(is_password_pending_)
  , is_unconfirmed_(is_unconfirmed_)
  , can_accept_secret_chats_(can_accept_secret_chats_)
  , can_accept_calls_(can_accept_calls_)
  , type_(std::move(type_))
  , api_id_(api_id_)
  , application_name_(application_name_)
  , application_version_(application_version_)
  , is_official_application_(is_official_application_)
  , device_model_(device_model_)
  , platform_(platform_)
  , system_version_(system_version_)
  , log_in_date_(log_in_date_)
  , last_active_date_(last_active_date_)
  , ip_address_(ip_address_)
  , location_(location_)
{}

const std::int32_t session::ID;

object_ptr<session> session::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<session> res = make_object<session>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->is_current_ = (env->GetBooleanField(p, res->is_current_fieldID) != 0);
  res->is_password_pending_ = (env->GetBooleanField(p, res->is_password_pending_fieldID) != 0);
  res->is_unconfirmed_ = (env->GetBooleanField(p, res->is_unconfirmed_fieldID) != 0);
  res->can_accept_secret_chats_ = (env->GetBooleanField(p, res->can_accept_secret_chats_fieldID) != 0);
  res->can_accept_calls_ = (env->GetBooleanField(p, res->can_accept_calls_fieldID) != 0);
  res->type_ = jni::fetch_tl_object<SessionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->api_id_ = env->GetIntField(p, res->api_id_fieldID);
  res->application_name_ = jni::fetch_string(env, p, res->application_name_fieldID);
  res->application_version_ = jni::fetch_string(env, p, res->application_version_fieldID);
  res->is_official_application_ = (env->GetBooleanField(p, res->is_official_application_fieldID) != 0);
  res->device_model_ = jni::fetch_string(env, p, res->device_model_fieldID);
  res->platform_ = jni::fetch_string(env, p, res->platform_fieldID);
  res->system_version_ = jni::fetch_string(env, p, res->system_version_fieldID);
  res->log_in_date_ = env->GetIntField(p, res->log_in_date_fieldID);
  res->last_active_date_ = env->GetIntField(p, res->last_active_date_fieldID);
  res->ip_address_ = jni::fetch_string(env, p, res->ip_address_fieldID);
  res->location_ = jni::fetch_string(env, p, res->location_fieldID);
  return res;
}

void session::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetBooleanField(s, is_current_fieldID, is_current_);
  env->SetBooleanField(s, is_password_pending_fieldID, is_password_pending_);
  env->SetBooleanField(s, is_unconfirmed_fieldID, is_unconfirmed_);
  env->SetBooleanField(s, can_accept_secret_chats_fieldID, can_accept_secret_chats_);
  env->SetBooleanField(s, can_accept_calls_fieldID, can_accept_calls_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, api_id_fieldID, api_id_);
  { jstring nextString = jni::to_jstring(env, application_name_); if (nextString) { env->SetObjectField(s, application_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, application_version_); if (nextString) { env->SetObjectField(s, application_version_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_official_application_fieldID, is_official_application_);
  { jstring nextString = jni::to_jstring(env, device_model_); if (nextString) { env->SetObjectField(s, device_model_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, platform_); if (nextString) { env->SetObjectField(s, platform_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, system_version_); if (nextString) { env->SetObjectField(s, system_version_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, log_in_date_fieldID, log_in_date_);
  env->SetIntField(s, last_active_date_fieldID, last_active_date_);
  { 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, location_); if (nextString) { env->SetObjectField(s, location_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void session::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Session");
    s.store_field("id", id_);
    s.store_field("isCurrent", is_current_);
    s.store_field("isPasswordPending", is_password_pending_);
    s.store_field("isUnconfirmed", is_unconfirmed_);
    s.store_field("canAcceptSecretChats", can_accept_secret_chats_);
    s.store_field("canAcceptCalls", can_accept_calls_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("apiId", api_id_);
    s.store_field("applicationName", application_name_);
    s.store_field("applicationVersion", application_version_);
    s.store_field("isOfficialApplication", is_official_application_);
    s.store_field("deviceModel", device_model_);
    s.store_field("platform", platform_);
    s.store_field("systemVersion", system_version_);
    s.store_field("logInDate", log_in_date_);
    s.store_field("lastActiveDate", last_active_date_);
    s.store_field("ipAddress", ip_address_);
    s.store_field("location", location_);
    s.store_class_end();
  }
}

void session::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Session").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    is_current_fieldID = jni::get_field_id(env, Class, "isCurrent", "Z");
    is_password_pending_fieldID = jni::get_field_id(env, Class, "isPasswordPending", "Z");
    is_unconfirmed_fieldID = jni::get_field_id(env, Class, "isUnconfirmed", "Z");
    can_accept_secret_chats_fieldID = jni::get_field_id(env, Class, "canAcceptSecretChats", "Z");
    can_accept_calls_fieldID = jni::get_field_id(env, Class, "canAcceptCalls", "Z");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SessionType;").c_str());
    api_id_fieldID = jni::get_field_id(env, Class, "apiId", "I");
    application_name_fieldID = jni::get_field_id(env, Class, "applicationName", "Ljava/lang/String;");
    application_version_fieldID = jni::get_field_id(env, Class, "applicationVersion", "Ljava/lang/String;");
    is_official_application_fieldID = jni::get_field_id(env, Class, "isOfficialApplication", "Z");
    device_model_fieldID = jni::get_field_id(env, Class, "deviceModel", "Ljava/lang/String;");
    platform_fieldID = jni::get_field_id(env, Class, "platform", "Ljava/lang/String;");
    system_version_fieldID = jni::get_field_id(env, Class, "systemVersion", "Ljava/lang/String;");
    log_in_date_fieldID = jni::get_field_id(env, Class, "logInDate", "I");
    last_active_date_fieldID = jni::get_field_id(env, Class, "lastActiveDate", "I");
    ip_address_fieldID = jni::get_field_id(env, Class, "ipAddress", "Ljava/lang/String;");
    location_fieldID = jni::get_field_id(env, Class, "location", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass SpeechRecognitionResult::Class;

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

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

jclass speechRecognitionResultPending::Class;
jfieldID speechRecognitionResultPending::partial_text_fieldID;

speechRecognitionResultPending::speechRecognitionResultPending()
  : partial_text_()
{}

speechRecognitionResultPending::speechRecognitionResultPending(string const &partial_text_)
  : partial_text_(partial_text_)
{}

const std::int32_t speechRecognitionResultPending::ID;

object_ptr<SpeechRecognitionResult> speechRecognitionResultPending::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<speechRecognitionResultPending> res = make_object<speechRecognitionResultPending>();
  res->partial_text_ = jni::fetch_string(env, p, res->partial_text_fieldID);
  return std::move(res);
}

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

void speechRecognitionResultPending::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SpeechRecognitionResultPending");
    s.store_field("partialText", partial_text_);
    s.store_class_end();
  }
}

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

jclass speechRecognitionResultText::Class;
jfieldID speechRecognitionResultText::text_fieldID;

speechRecognitionResultText::speechRecognitionResultText()
  : text_()
{}

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

const std::int32_t speechRecognitionResultText::ID;

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

void speechRecognitionResultText::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 speechRecognitionResultText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SpeechRecognitionResultText");
    s.store_field("text", text_);
    s.store_class_end();
  }
}

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

jclass speechRecognitionResultError::Class;
jfieldID speechRecognitionResultError::error_fieldID;

speechRecognitionResultError::speechRecognitionResultError()
  : error_()
{}

speechRecognitionResultError::speechRecognitionResultError(object_ptr<error> &&error_)
  : error_(std::move(error_))
{}

const std::int32_t speechRecognitionResultError::ID;

object_ptr<SpeechRecognitionResult> speechRecognitionResultError::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<speechRecognitionResultError> res = make_object<speechRecognitionResultError>();
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  return std::move(res);
}

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

void speechRecognitionResultError::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SpeechRecognitionResultError");
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_class_end();
  }
}

void speechRecognitionResultError::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SpeechRecognitionResultError").c_str());
    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 starRevenueStatistics::Class;
jfieldID starRevenueStatistics::revenue_by_day_graph_fieldID;
jfieldID starRevenueStatistics::status_fieldID;
jfieldID starRevenueStatistics::usd_rate_fieldID;

starRevenueStatistics::starRevenueStatistics()
  : revenue_by_day_graph_()
  , status_()
  , usd_rate_()
{}

starRevenueStatistics::starRevenueStatistics(object_ptr<StatisticalGraph> &&revenue_by_day_graph_, object_ptr<starRevenueStatus> &&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 starRevenueStatistics::ID;

object_ptr<starRevenueStatistics> starRevenueStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starRevenueStatistics> res = make_object<starRevenueStatistics>();
  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<starRevenueStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  res->usd_rate_ = env->GetDoubleField(p, res->usd_rate_fieldID);
  return res;
}

void starRevenueStatistics::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 starRevenueStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarRevenueStatistics");
    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 starRevenueStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarRevenueStatistics").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$StarRevenueStatus;").c_str());
    usd_rate_fieldID = jni::get_field_id(env, Class, "usdRate", "D");
    return true;
  }();
  (void)is_inited;
}

jclass starSubscriptionPricing::Class;
jfieldID starSubscriptionPricing::period_fieldID;
jfieldID starSubscriptionPricing::star_count_fieldID;

starSubscriptionPricing::starSubscriptionPricing()
  : period_()
  , star_count_()
{}

starSubscriptionPricing::starSubscriptionPricing(int32 period_, int53 star_count_)
  : period_(period_)
  , star_count_(star_count_)
{}

const std::int32_t starSubscriptionPricing::ID;

object_ptr<starSubscriptionPricing> starSubscriptionPricing::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starSubscriptionPricing> res = make_object<starSubscriptionPricing>();
  res->period_ = env->GetIntField(p, res->period_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

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

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

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

jclass StatisticalGraph::Class;

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

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

jclass statisticalGraphData::Class;
jfieldID statisticalGraphData::json_data_fieldID;
jfieldID statisticalGraphData::zoom_token_fieldID;

statisticalGraphData::statisticalGraphData()
  : json_data_()
  , zoom_token_()
{}

statisticalGraphData::statisticalGraphData(string const &json_data_, string const &zoom_token_)
  : json_data_(json_data_)
  , zoom_token_(zoom_token_)
{}

const std::int32_t statisticalGraphData::ID;

object_ptr<StatisticalGraph> statisticalGraphData::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<statisticalGraphData> res = make_object<statisticalGraphData>();
  res->json_data_ = jni::fetch_string(env, p, res->json_data_fieldID);
  res->zoom_token_ = jni::fetch_string(env, p, res->zoom_token_fieldID);
  return std::move(res);
}

void statisticalGraphData::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, json_data_); if (nextString) { env->SetObjectField(s, json_data_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, zoom_token_); if (nextString) { env->SetObjectField(s, zoom_token_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void statisticalGraphData::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StatisticalGraphData");
    s.store_field("jsonData", json_data_);
    s.store_field("zoomToken", zoom_token_);
    s.store_class_end();
  }
}

void statisticalGraphData::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StatisticalGraphData").c_str());
    json_data_fieldID = jni::get_field_id(env, Class, "jsonData", "Ljava/lang/String;");
    zoom_token_fieldID = jni::get_field_id(env, Class, "zoomToken", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass statisticalGraphAsync::Class;
jfieldID statisticalGraphAsync::token_fieldID;

statisticalGraphAsync::statisticalGraphAsync()
  : token_()
{}

statisticalGraphAsync::statisticalGraphAsync(string const &token_)
  : token_(token_)
{}

const std::int32_t statisticalGraphAsync::ID;

object_ptr<StatisticalGraph> statisticalGraphAsync::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<statisticalGraphAsync> res = make_object<statisticalGraphAsync>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return std::move(res);
}

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

void statisticalGraphAsync::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StatisticalGraphAsync");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

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

jclass statisticalGraphError::Class;
jfieldID statisticalGraphError::error_message_fieldID;

statisticalGraphError::statisticalGraphError()
  : error_message_()
{}

statisticalGraphError::statisticalGraphError(string const &error_message_)
  : error_message_(error_message_)
{}

const std::int32_t statisticalGraphError::ID;

object_ptr<StatisticalGraph> statisticalGraphError::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<statisticalGraphError> res = make_object<statisticalGraphError>();
  res->error_message_ = jni::fetch_string(env, p, res->error_message_fieldID);
  return std::move(res);
}

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

void statisticalGraphError::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StatisticalGraphError");
    s.store_field("errorMessage", error_message_);
    s.store_class_end();
  }
}

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

jclass StickerFullType::Class;

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

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

jclass stickerFullTypeRegular::Class;
jfieldID stickerFullTypeRegular::premium_animation_fieldID;

stickerFullTypeRegular::stickerFullTypeRegular()
  : premium_animation_()
{}

stickerFullTypeRegular::stickerFullTypeRegular(object_ptr<file> &&premium_animation_)
  : premium_animation_(std::move(premium_animation_))
{}

const std::int32_t stickerFullTypeRegular::ID;

object_ptr<StickerFullType> stickerFullTypeRegular::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stickerFullTypeRegular> res = make_object<stickerFullTypeRegular>();
  res->premium_animation_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->premium_animation_fieldID));
  return std::move(res);
}

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

void stickerFullTypeRegular::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StickerFullTypeRegular");
    s.store_object_field("premiumAnimation", static_cast<const BaseObject *>(premium_animation_.get()));
    s.store_class_end();
  }
}

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

jclass stickerFullTypeMask::Class;
jfieldID stickerFullTypeMask::mask_position_fieldID;

stickerFullTypeMask::stickerFullTypeMask()
  : mask_position_()
{}

stickerFullTypeMask::stickerFullTypeMask(object_ptr<maskPosition> &&mask_position_)
  : mask_position_(std::move(mask_position_))
{}

const std::int32_t stickerFullTypeMask::ID;

object_ptr<StickerFullType> stickerFullTypeMask::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stickerFullTypeMask> res = make_object<stickerFullTypeMask>();
  res->mask_position_ = jni::fetch_tl_object<maskPosition>(env, jni::fetch_object(env, p, res->mask_position_fieldID));
  return std::move(res);
}

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

void stickerFullTypeMask::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StickerFullTypeMask");
    s.store_object_field("maskPosition", static_cast<const BaseObject *>(mask_position_.get()));
    s.store_class_end();
  }
}

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

jclass stickerFullTypeCustomEmoji::Class;
jfieldID stickerFullTypeCustomEmoji::custom_emoji_id_fieldID;
jfieldID stickerFullTypeCustomEmoji::needs_repainting_fieldID;

stickerFullTypeCustomEmoji::stickerFullTypeCustomEmoji()
  : custom_emoji_id_()
  , needs_repainting_()
{}

stickerFullTypeCustomEmoji::stickerFullTypeCustomEmoji(int64 custom_emoji_id_, bool needs_repainting_)
  : custom_emoji_id_(custom_emoji_id_)
  , needs_repainting_(needs_repainting_)
{}

const std::int32_t stickerFullTypeCustomEmoji::ID;

object_ptr<StickerFullType> stickerFullTypeCustomEmoji::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stickerFullTypeCustomEmoji> res = make_object<stickerFullTypeCustomEmoji>();
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  res->needs_repainting_ = (env->GetBooleanField(p, res->needs_repainting_fieldID) != 0);
  return std::move(res);
}

void stickerFullTypeCustomEmoji::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_);
  env->SetBooleanField(s, needs_repainting_fieldID, needs_repainting_);
}

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

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

jclass storageStatistics::Class;
jfieldID storageStatistics::size_fieldID;
jfieldID storageStatistics::count_fieldID;
jfieldID storageStatistics::by_chat_fieldID;

storageStatistics::storageStatistics()
  : size_()
  , count_()
  , by_chat_()
{}

storageStatistics::storageStatistics(int53 size_, int32 count_, array<object_ptr<storageStatisticsByChat>> &&by_chat_)
  : size_(size_)
  , count_(count_)
  , by_chat_(std::move(by_chat_))
{}

const std::int32_t storageStatistics::ID;

object_ptr<storageStatistics> storageStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storageStatistics> res = make_object<storageStatistics>();
  res->size_ = env->GetLongField(p, res->size_fieldID);
  res->count_ = env->GetIntField(p, res->count_fieldID);
  res->by_chat_ = jni::FetchVector<storageStatisticsByChat>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->by_chat_fieldID));
  return res;
}

void storageStatistics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, size_fieldID, size_);
  env->SetIntField(s, count_fieldID, count_);
  { auto arr_tmp_ = jni::store_vector(env, by_chat_); if (arr_tmp_) { env->SetObjectField(s, by_chat_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void storageStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorageStatistics");
    s.store_field("size", size_);
    s.store_field("count", count_);
    { s.store_vector_begin("byChat", by_chat_.size()); for (const auto &_value : by_chat_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void storageStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorageStatistics").c_str());
    size_fieldID = jni::get_field_id(env, Class, "size", "J");
    count_fieldID = jni::get_field_id(env, Class, "count", "I");
    by_chat_fieldID = jni::get_field_id(env, Class, "byChat", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StorageStatisticsByChat;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass stories::Class;
jfieldID stories::total_count_fieldID;
jfieldID stories::stories_fieldID;
jfieldID stories::pinned_story_ids_fieldID;

stories::stories()
  : total_count_()
  , stories_()
  , pinned_story_ids_()
{}

stories::stories(int32 total_count_, array<object_ptr<story>> &&stories_, array<int32> &&pinned_story_ids_)
  : total_count_(total_count_)
  , stories_(std::move(stories_))
  , pinned_story_ids_(std::move(pinned_story_ids_))
{}

const std::int32_t stories::ID;

object_ptr<stories> stories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stories> res = make_object<stories>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->stories_ = jni::FetchVector<story>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->stories_fieldID));
  res->pinned_story_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->pinned_story_ids_fieldID));
  return res;
}

void stories::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, stories_); if (arr_tmp_) { env->SetObjectField(s, stories_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, pinned_story_ids_); if (arr_tmp_) { env->SetObjectField(s, pinned_story_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

void stories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Stories").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    stories_fieldID = jni::get_field_id(env, Class, "stories", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Story;").c_str());
    pinned_story_ids_fieldID = jni::get_field_id(env, Class, "pinnedStoryIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass supergroupFullInfo::Class;
jfieldID supergroupFullInfo::photo_fieldID;
jfieldID supergroupFullInfo::description_fieldID;
jfieldID supergroupFullInfo::member_count_fieldID;
jfieldID supergroupFullInfo::administrator_count_fieldID;
jfieldID supergroupFullInfo::restricted_count_fieldID;
jfieldID supergroupFullInfo::banned_count_fieldID;
jfieldID supergroupFullInfo::linked_chat_id_fieldID;
jfieldID supergroupFullInfo::direct_messages_chat_id_fieldID;
jfieldID supergroupFullInfo::slow_mode_delay_fieldID;
jfieldID supergroupFullInfo::slow_mode_delay_expires_in_fieldID;
jfieldID supergroupFullInfo::can_enable_paid_messages_fieldID;
jfieldID supergroupFullInfo::can_enable_paid_reaction_fieldID;
jfieldID supergroupFullInfo::can_get_members_fieldID;
jfieldID supergroupFullInfo::has_hidden_members_fieldID;
jfieldID supergroupFullInfo::can_hide_members_fieldID;
jfieldID supergroupFullInfo::can_set_sticker_set_fieldID;
jfieldID supergroupFullInfo::can_set_location_fieldID;
jfieldID supergroupFullInfo::can_get_statistics_fieldID;
jfieldID supergroupFullInfo::can_get_revenue_statistics_fieldID;
jfieldID supergroupFullInfo::can_get_star_revenue_statistics_fieldID;
jfieldID supergroupFullInfo::can_send_gift_fieldID;
jfieldID supergroupFullInfo::can_toggle_aggressive_anti_spam_fieldID;
jfieldID supergroupFullInfo::is_all_history_available_fieldID;
jfieldID supergroupFullInfo::can_have_sponsored_messages_fieldID;
jfieldID supergroupFullInfo::has_aggressive_anti_spam_enabled_fieldID;
jfieldID supergroupFullInfo::has_paid_media_allowed_fieldID;
jfieldID supergroupFullInfo::has_pinned_stories_fieldID;
jfieldID supergroupFullInfo::gift_count_fieldID;
jfieldID supergroupFullInfo::my_boost_count_fieldID;
jfieldID supergroupFullInfo::unrestrict_boost_count_fieldID;
jfieldID supergroupFullInfo::outgoing_paid_message_star_count_fieldID;
jfieldID supergroupFullInfo::sticker_set_id_fieldID;
jfieldID supergroupFullInfo::custom_emoji_sticker_set_id_fieldID;
jfieldID supergroupFullInfo::location_fieldID;
jfieldID supergroupFullInfo::invite_link_fieldID;
jfieldID supergroupFullInfo::bot_commands_fieldID;
jfieldID supergroupFullInfo::bot_verification_fieldID;
jfieldID supergroupFullInfo::main_profile_tab_fieldID;
jfieldID supergroupFullInfo::upgraded_from_basic_group_id_fieldID;
jfieldID supergroupFullInfo::upgraded_from_max_message_id_fieldID;

supergroupFullInfo::supergroupFullInfo()
  : photo_()
  , description_()
  , member_count_()
  , administrator_count_()
  , restricted_count_()
  , banned_count_()
  , linked_chat_id_()
  , direct_messages_chat_id_()
  , slow_mode_delay_()
  , slow_mode_delay_expires_in_()
  , can_enable_paid_messages_()
  , can_enable_paid_reaction_()
  , can_get_members_()
  , has_hidden_members_()
  , can_hide_members_()
  , can_set_sticker_set_()
  , can_set_location_()
  , can_get_statistics_()
  , can_get_revenue_statistics_()
  , can_get_star_revenue_statistics_()
  , can_send_gift_()
  , can_toggle_aggressive_anti_spam_()
  , is_all_history_available_()
  , can_have_sponsored_messages_()
  , has_aggressive_anti_spam_enabled_()
  , has_paid_media_allowed_()
  , has_pinned_stories_()
  , gift_count_()
  , my_boost_count_()
  , unrestrict_boost_count_()
  , outgoing_paid_message_star_count_()
  , sticker_set_id_()
  , custom_emoji_sticker_set_id_()
  , location_()
  , invite_link_()
  , bot_commands_()
  , bot_verification_()
  , main_profile_tab_()
  , upgraded_from_basic_group_id_()
  , upgraded_from_max_message_id_()
{}

supergroupFullInfo::supergroupFullInfo(object_ptr<chatPhoto> &&photo_, string const &description_, int32 member_count_, int32 administrator_count_, int32 restricted_count_, int32 banned_count_, int53 linked_chat_id_, int53 direct_messages_chat_id_, int32 slow_mode_delay_, double slow_mode_delay_expires_in_, bool can_enable_paid_messages_, bool can_enable_paid_reaction_, bool can_get_members_, bool has_hidden_members_, bool can_hide_members_, bool can_set_sticker_set_, bool can_set_location_, bool can_get_statistics_, bool can_get_revenue_statistics_, bool can_get_star_revenue_statistics_, bool can_send_gift_, bool can_toggle_aggressive_anti_spam_, bool is_all_history_available_, bool can_have_sponsored_messages_, bool has_aggressive_anti_spam_enabled_, bool has_paid_media_allowed_, bool has_pinned_stories_, int32 gift_count_, int32 my_boost_count_, int32 unrestrict_boost_count_, int53 outgoing_paid_message_star_count_, int64 sticker_set_id_, int64 custom_emoji_sticker_set_id_, object_ptr<chatLocation> &&location_, object_ptr<chatInviteLink> &&invite_link_, array<object_ptr<botCommands>> &&bot_commands_, object_ptr<botVerification> &&bot_verification_, object_ptr<ProfileTab> &&main_profile_tab_, int53 upgraded_from_basic_group_id_, int53 upgraded_from_max_message_id_)
  : photo_(std::move(photo_))
  , description_(description_)
  , member_count_(member_count_)
  , administrator_count_(administrator_count_)
  , restricted_count_(restricted_count_)
  , banned_count_(banned_count_)
  , linked_chat_id_(linked_chat_id_)
  , direct_messages_chat_id_(direct_messages_chat_id_)
  , slow_mode_delay_(slow_mode_delay_)
  , slow_mode_delay_expires_in_(slow_mode_delay_expires_in_)
  , can_enable_paid_messages_(can_enable_paid_messages_)
  , can_enable_paid_reaction_(can_enable_paid_reaction_)
  , can_get_members_(can_get_members_)
  , has_hidden_members_(has_hidden_members_)
  , can_hide_members_(can_hide_members_)
  , can_set_sticker_set_(can_set_sticker_set_)
  , can_set_location_(can_set_location_)
  , can_get_statistics_(can_get_statistics_)
  , can_get_revenue_statistics_(can_get_revenue_statistics_)
  , can_get_star_revenue_statistics_(can_get_star_revenue_statistics_)
  , can_send_gift_(can_send_gift_)
  , can_toggle_aggressive_anti_spam_(can_toggle_aggressive_anti_spam_)
  , is_all_history_available_(is_all_history_available_)
  , can_have_sponsored_messages_(can_have_sponsored_messages_)
  , has_aggressive_anti_spam_enabled_(has_aggressive_anti_spam_enabled_)
  , has_paid_media_allowed_(has_paid_media_allowed_)
  , has_pinned_stories_(has_pinned_stories_)
  , gift_count_(gift_count_)
  , my_boost_count_(my_boost_count_)
  , unrestrict_boost_count_(unrestrict_boost_count_)
  , outgoing_paid_message_star_count_(outgoing_paid_message_star_count_)
  , sticker_set_id_(sticker_set_id_)
  , custom_emoji_sticker_set_id_(custom_emoji_sticker_set_id_)
  , location_(std::move(location_))
  , invite_link_(std::move(invite_link_))
  , bot_commands_(std::move(bot_commands_))
  , bot_verification_(std::move(bot_verification_))
  , main_profile_tab_(std::move(main_profile_tab_))
  , upgraded_from_basic_group_id_(upgraded_from_basic_group_id_)
  , upgraded_from_max_message_id_(upgraded_from_max_message_id_)
{}

const std::int32_t supergroupFullInfo::ID;

object_ptr<supergroupFullInfo> supergroupFullInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<supergroupFullInfo> res = make_object<supergroupFullInfo>();
  res->photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->member_count_ = env->GetIntField(p, res->member_count_fieldID);
  res->administrator_count_ = env->GetIntField(p, res->administrator_count_fieldID);
  res->restricted_count_ = env->GetIntField(p, res->restricted_count_fieldID);
  res->banned_count_ = env->GetIntField(p, res->banned_count_fieldID);
  res->linked_chat_id_ = env->GetLongField(p, res->linked_chat_id_fieldID);
  res->direct_messages_chat_id_ = env->GetLongField(p, res->direct_messages_chat_id_fieldID);
  res->slow_mode_delay_ = env->GetIntField(p, res->slow_mode_delay_fieldID);
  res->slow_mode_delay_expires_in_ = env->GetDoubleField(p, res->slow_mode_delay_expires_in_fieldID);
  res->can_enable_paid_messages_ = (env->GetBooleanField(p, res->can_enable_paid_messages_fieldID) != 0);
  res->can_enable_paid_reaction_ = (env->GetBooleanField(p, res->can_enable_paid_reaction_fieldID) != 0);
  res->can_get_members_ = (env->GetBooleanField(p, res->can_get_members_fieldID) != 0);
  res->has_hidden_members_ = (env->GetBooleanField(p, res->has_hidden_members_fieldID) != 0);
  res->can_hide_members_ = (env->GetBooleanField(p, res->can_hide_members_fieldID) != 0);
  res->can_set_sticker_set_ = (env->GetBooleanField(p, res->can_set_sticker_set_fieldID) != 0);
  res->can_set_location_ = (env->GetBooleanField(p, res->can_set_location_fieldID) != 0);
  res->can_get_statistics_ = (env->GetBooleanField(p, res->can_get_statistics_fieldID) != 0);
  res->can_get_revenue_statistics_ = (env->GetBooleanField(p, res->can_get_revenue_statistics_fieldID) != 0);
  res->can_get_star_revenue_statistics_ = (env->GetBooleanField(p, res->can_get_star_revenue_statistics_fieldID) != 0);
  res->can_send_gift_ = (env->GetBooleanField(p, res->can_send_gift_fieldID) != 0);
  res->can_toggle_aggressive_anti_spam_ = (env->GetBooleanField(p, res->can_toggle_aggressive_anti_spam_fieldID) != 0);
  res->is_all_history_available_ = (env->GetBooleanField(p, res->is_all_history_available_fieldID) != 0);
  res->can_have_sponsored_messages_ = (env->GetBooleanField(p, res->can_have_sponsored_messages_fieldID) != 0);
  res->has_aggressive_anti_spam_enabled_ = (env->GetBooleanField(p, res->has_aggressive_anti_spam_enabled_fieldID) != 0);
  res->has_paid_media_allowed_ = (env->GetBooleanField(p, res->has_paid_media_allowed_fieldID) != 0);
  res->has_pinned_stories_ = (env->GetBooleanField(p, res->has_pinned_stories_fieldID) != 0);
  res->gift_count_ = env->GetIntField(p, res->gift_count_fieldID);
  res->my_boost_count_ = env->GetIntField(p, res->my_boost_count_fieldID);
  res->unrestrict_boost_count_ = env->GetIntField(p, res->unrestrict_boost_count_fieldID);
  res->outgoing_paid_message_star_count_ = env->GetLongField(p, res->outgoing_paid_message_star_count_fieldID);
  res->sticker_set_id_ = env->GetLongField(p, res->sticker_set_id_fieldID);
  res->custom_emoji_sticker_set_id_ = env->GetLongField(p, res->custom_emoji_sticker_set_id_fieldID);
  res->location_ = jni::fetch_tl_object<chatLocation>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  res->bot_commands_ = jni::FetchVector<botCommands>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->bot_commands_fieldID));
  res->bot_verification_ = jni::fetch_tl_object<botVerification>(env, jni::fetch_object(env, p, res->bot_verification_fieldID));
  res->main_profile_tab_ = jni::fetch_tl_object<ProfileTab>(env, jni::fetch_object(env, p, res->main_profile_tab_fieldID));
  res->upgraded_from_basic_group_id_ = env->GetLongField(p, res->upgraded_from_basic_group_id_fieldID);
  res->upgraded_from_max_message_id_ = env->GetLongField(p, res->upgraded_from_max_message_id_fieldID);
  return res;
}

void supergroupFullInfo::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); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, member_count_fieldID, member_count_);
  env->SetIntField(s, administrator_count_fieldID, administrator_count_);
  env->SetIntField(s, restricted_count_fieldID, restricted_count_);
  env->SetIntField(s, banned_count_fieldID, banned_count_);
  env->SetLongField(s, linked_chat_id_fieldID, linked_chat_id_);
  env->SetLongField(s, direct_messages_chat_id_fieldID, direct_messages_chat_id_);
  env->SetIntField(s, slow_mode_delay_fieldID, slow_mode_delay_);
  env->SetDoubleField(s, slow_mode_delay_expires_in_fieldID, slow_mode_delay_expires_in_);
  env->SetBooleanField(s, can_enable_paid_messages_fieldID, can_enable_paid_messages_);
  env->SetBooleanField(s, can_enable_paid_reaction_fieldID, can_enable_paid_reaction_);
  env->SetBooleanField(s, can_get_members_fieldID, can_get_members_);
  env->SetBooleanField(s, has_hidden_members_fieldID, has_hidden_members_);
  env->SetBooleanField(s, can_hide_members_fieldID, can_hide_members_);
  env->SetBooleanField(s, can_set_sticker_set_fieldID, can_set_sticker_set_);
  env->SetBooleanField(s, can_set_location_fieldID, can_set_location_);
  env->SetBooleanField(s, can_get_statistics_fieldID, can_get_statistics_);
  env->SetBooleanField(s, can_get_revenue_statistics_fieldID, can_get_revenue_statistics_);
  env->SetBooleanField(s, can_get_star_revenue_statistics_fieldID, can_get_star_revenue_statistics_);
  env->SetBooleanField(s, can_send_gift_fieldID, can_send_gift_);
  env->SetBooleanField(s, can_toggle_aggressive_anti_spam_fieldID, can_toggle_aggressive_anti_spam_);
  env->SetBooleanField(s, is_all_history_available_fieldID, is_all_history_available_);
  env->SetBooleanField(s, can_have_sponsored_messages_fieldID, can_have_sponsored_messages_);
  env->SetBooleanField(s, has_aggressive_anti_spam_enabled_fieldID, has_aggressive_anti_spam_enabled_);
  env->SetBooleanField(s, has_paid_media_allowed_fieldID, has_paid_media_allowed_);
  env->SetBooleanField(s, has_pinned_stories_fieldID, has_pinned_stories_);
  env->SetIntField(s, gift_count_fieldID, gift_count_);
  env->SetIntField(s, my_boost_count_fieldID, my_boost_count_);
  env->SetIntField(s, unrestrict_boost_count_fieldID, unrestrict_boost_count_);
  env->SetLongField(s, outgoing_paid_message_star_count_fieldID, outgoing_paid_message_star_count_);
  env->SetLongField(s, sticker_set_id_fieldID, sticker_set_id_);
  env->SetLongField(s, custom_emoji_sticker_set_id_fieldID, custom_emoji_sticker_set_id_);
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  if (invite_link_ != nullptr) { jobject next; invite_link_->store(env, next); if (next) { env->SetObjectField(s, invite_link_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, bot_commands_); if (arr_tmp_) { env->SetObjectField(s, bot_commands_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (bot_verification_ != nullptr) { jobject next; bot_verification_->store(env, next); if (next) { env->SetObjectField(s, bot_verification_fieldID, next); env->DeleteLocalRef(next); } }
  if (main_profile_tab_ != nullptr) { jobject next; main_profile_tab_->store(env, next); if (next) { env->SetObjectField(s, main_profile_tab_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, upgraded_from_basic_group_id_fieldID, upgraded_from_basic_group_id_);
  env->SetLongField(s, upgraded_from_max_message_id_fieldID, upgraded_from_max_message_id_);
}

void supergroupFullInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SupergroupFullInfo");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("description", description_);
    s.store_field("memberCount", member_count_);
    s.store_field("administratorCount", administrator_count_);
    s.store_field("restrictedCount", restricted_count_);
    s.store_field("bannedCount", banned_count_);
    s.store_field("linkedChatId", linked_chat_id_);
    s.store_field("directMessagesChatId", direct_messages_chat_id_);
    s.store_field("slowModeDelay", slow_mode_delay_);
    s.store_field("slowModeDelayExpiresIn", slow_mode_delay_expires_in_);
    s.store_field("canEnablePaidMessages", can_enable_paid_messages_);
    s.store_field("canEnablePaidReaction", can_enable_paid_reaction_);
    s.store_field("canGetMembers", can_get_members_);
    s.store_field("hasHiddenMembers", has_hidden_members_);
    s.store_field("canHideMembers", can_hide_members_);
    s.store_field("canSetStickerSet", can_set_sticker_set_);
    s.store_field("canSetLocation", can_set_location_);
    s.store_field("canGetStatistics", can_get_statistics_);
    s.store_field("canGetRevenueStatistics", can_get_revenue_statistics_);
    s.store_field("canGetStarRevenueStatistics", can_get_star_revenue_statistics_);
    s.store_field("canSendGift", can_send_gift_);
    s.store_field("canToggleAggressiveAntiSpam", can_toggle_aggressive_anti_spam_);
    s.store_field("isAllHistoryAvailable", is_all_history_available_);
    s.store_field("canHaveSponsoredMessages", can_have_sponsored_messages_);
    s.store_field("hasAggressiveAntiSpamEnabled", has_aggressive_anti_spam_enabled_);
    s.store_field("hasPaidMediaAllowed", has_paid_media_allowed_);
    s.store_field("hasPinnedStories", has_pinned_stories_);
    s.store_field("giftCount", gift_count_);
    s.store_field("myBoostCount", my_boost_count_);
    s.store_field("unrestrictBoostCount", unrestrict_boost_count_);
    s.store_field("outgoingPaidMessageStarCount", outgoing_paid_message_star_count_);
    s.store_field("stickerSetId", sticker_set_id_);
    s.store_field("customEmojiStickerSetId", custom_emoji_sticker_set_id_);
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    { s.store_vector_begin("botCommands", bot_commands_.size()); for (const auto &_value : bot_commands_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("botVerification", static_cast<const BaseObject *>(bot_verification_.get()));
    s.store_object_field("mainProfileTab", static_cast<const BaseObject *>(main_profile_tab_.get()));
    s.store_field("upgradedFromBasicGroupId", upgraded_from_basic_group_id_);
    s.store_field("upgradedFromMaxMessageId", upgraded_from_max_message_id_);
    s.store_class_end();
  }
}

void supergroupFullInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SupergroupFullInfo").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    member_count_fieldID = jni::get_field_id(env, Class, "memberCount", "I");
    administrator_count_fieldID = jni::get_field_id(env, Class, "administratorCount", "I");
    restricted_count_fieldID = jni::get_field_id(env, Class, "restrictedCount", "I");
    banned_count_fieldID = jni::get_field_id(env, Class, "bannedCount", "I");
    linked_chat_id_fieldID = jni::get_field_id(env, Class, "linkedChatId", "J");
    direct_messages_chat_id_fieldID = jni::get_field_id(env, Class, "directMessagesChatId", "J");
    slow_mode_delay_fieldID = jni::get_field_id(env, Class, "slowModeDelay", "I");
    slow_mode_delay_expires_in_fieldID = jni::get_field_id(env, Class, "slowModeDelayExpiresIn", "D");
    can_enable_paid_messages_fieldID = jni::get_field_id(env, Class, "canEnablePaidMessages", "Z");
    can_enable_paid_reaction_fieldID = jni::get_field_id(env, Class, "canEnablePaidReaction", "Z");
    can_get_members_fieldID = jni::get_field_id(env, Class, "canGetMembers", "Z");
    has_hidden_members_fieldID = jni::get_field_id(env, Class, "hasHiddenMembers", "Z");
    can_hide_members_fieldID = jni::get_field_id(env, Class, "canHideMembers", "Z");
    can_set_sticker_set_fieldID = jni::get_field_id(env, Class, "canSetStickerSet", "Z");
    can_set_location_fieldID = jni::get_field_id(env, Class, "canSetLocation", "Z");
    can_get_statistics_fieldID = jni::get_field_id(env, Class, "canGetStatistics", "Z");
    can_get_revenue_statistics_fieldID = jni::get_field_id(env, Class, "canGetRevenueStatistics", "Z");
    can_get_star_revenue_statistics_fieldID = jni::get_field_id(env, Class, "canGetStarRevenueStatistics", "Z");
    can_send_gift_fieldID = jni::get_field_id(env, Class, "canSendGift", "Z");
    can_toggle_aggressive_anti_spam_fieldID = jni::get_field_id(env, Class, "canToggleAggressiveAntiSpam", "Z");
    is_all_history_available_fieldID = jni::get_field_id(env, Class, "isAllHistoryAvailable", "Z");
    can_have_sponsored_messages_fieldID = jni::get_field_id(env, Class, "canHaveSponsoredMessages", "Z");
    has_aggressive_anti_spam_enabled_fieldID = jni::get_field_id(env, Class, "hasAggressiveAntiSpamEnabled", "Z");
    has_paid_media_allowed_fieldID = jni::get_field_id(env, Class, "hasPaidMediaAllowed", "Z");
    has_pinned_stories_fieldID = jni::get_field_id(env, Class, "hasPinnedStories", "Z");
    gift_count_fieldID = jni::get_field_id(env, Class, "giftCount", "I");
    my_boost_count_fieldID = jni::get_field_id(env, Class, "myBoostCount", "I");
    unrestrict_boost_count_fieldID = jni::get_field_id(env, Class, "unrestrictBoostCount", "I");
    outgoing_paid_message_star_count_fieldID = jni::get_field_id(env, Class, "outgoingPaidMessageStarCount", "J");
    sticker_set_id_fieldID = jni::get_field_id(env, Class, "stickerSetId", "J");
    custom_emoji_sticker_set_id_fieldID = jni::get_field_id(env, Class, "customEmojiStickerSetId", "J");
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatLocation;").c_str());
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    bot_commands_fieldID = jni::get_field_id(env, Class, "botCommands", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BotCommands;").c_str());
    bot_verification_fieldID = jni::get_field_id(env, Class, "botVerification", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotVerification;").c_str());
    main_profile_tab_fieldID = jni::get_field_id(env, Class, "mainProfileTab", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProfileTab;").c_str());
    upgraded_from_basic_group_id_fieldID = jni::get_field_id(env, Class, "upgradedFromBasicGroupId", "J");
    upgraded_from_max_message_id_fieldID = jni::get_field_id(env, Class, "upgradedFromMaxMessageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass tMeUrl::Class;
jfieldID tMeUrl::url_fieldID;
jfieldID tMeUrl::type_fieldID;

tMeUrl::tMeUrl()
  : url_()
  , type_()
{}

tMeUrl::tMeUrl(string const &url_, object_ptr<TMeUrlType> &&type_)
  : url_(url_)
  , type_(std::move(type_))
{}

const std::int32_t tMeUrl::ID;

object_ptr<tMeUrl> tMeUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tMeUrl> res = make_object<tMeUrl>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->type_ = jni::fetch_tl_object<TMeUrlType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void tMeUrl::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); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void tMeUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TMeUrl");
    s.store_field("url", url_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

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

jclass testBytes::Class;
jfieldID testBytes::value_fieldID;

testBytes::testBytes()
  : value_()
{}

testBytes::testBytes(bytes const &value_)
  : value_(std::move(value_))
{}

const std::int32_t testBytes::ID;

object_ptr<testBytes> testBytes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testBytes> res = make_object<testBytes>();
  res->value_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->value_fieldID));
  return res;
}

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

void testBytes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestBytes");
    s.store_bytes_field("value", value_);
    s.store_class_end();
  }
}

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

jclass testVectorIntObject::Class;
jfieldID testVectorIntObject::value_fieldID;

testVectorIntObject::testVectorIntObject()
  : value_()
{}

testVectorIntObject::testVectorIntObject(array<object_ptr<testInt>> &&value_)
  : value_(std::move(value_))
{}

const std::int32_t testVectorIntObject::ID;

object_ptr<testVectorIntObject> testVectorIntObject::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testVectorIntObject> res = make_object<testVectorIntObject>();
  res->value_ = jni::FetchVector<testInt>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->value_fieldID));
  return res;
}

void testVectorIntObject::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 testVectorIntObject::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestVectorIntObject");
    { s.store_vector_begin("value", value_.size()); for (const auto &_value : value_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass text::Class;
jfieldID text::text_fieldID;

text::text()
  : text_()
{}

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

const std::int32_t text::ID;

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

void text::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 text::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Text");
    s.store_field("text", text_);
    s.store_class_end();
  }
}

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

jclass textCompositionStyle::Class;
jfieldID textCompositionStyle::name_fieldID;
jfieldID textCompositionStyle::custom_emoji_id_fieldID;
jfieldID textCompositionStyle::title_fieldID;
jfieldID textCompositionStyle::is_custom_fieldID;
jfieldID textCompositionStyle::is_creator_fieldID;
jfieldID textCompositionStyle::install_count_fieldID;
jfieldID textCompositionStyle::prompt_fieldID;
jfieldID textCompositionStyle::creator_user_id_fieldID;
jfieldID textCompositionStyle::english_example_fieldID;

textCompositionStyle::textCompositionStyle()
  : name_()
  , custom_emoji_id_()
  , title_()
  , is_custom_()
  , is_creator_()
  , install_count_()
  , prompt_()
  , creator_user_id_()
  , english_example_()
{}

textCompositionStyle::textCompositionStyle(string const &name_, int64 custom_emoji_id_, string const &title_, bool is_custom_, bool is_creator_, int32 install_count_, string const &prompt_, int53 creator_user_id_, object_ptr<textCompositionStyleExample> &&english_example_)
  : name_(name_)
  , custom_emoji_id_(custom_emoji_id_)
  , title_(title_)
  , is_custom_(is_custom_)
  , is_creator_(is_creator_)
  , install_count_(install_count_)
  , prompt_(prompt_)
  , creator_user_id_(creator_user_id_)
  , english_example_(std::move(english_example_))
{}

const std::int32_t textCompositionStyle::ID;

object_ptr<textCompositionStyle> textCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<textCompositionStyle> res = make_object<textCompositionStyle>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->is_custom_ = (env->GetBooleanField(p, res->is_custom_fieldID) != 0);
  res->is_creator_ = (env->GetBooleanField(p, res->is_creator_fieldID) != 0);
  res->install_count_ = env->GetIntField(p, res->install_count_fieldID);
  res->prompt_ = jni::fetch_string(env, p, res->prompt_fieldID);
  res->creator_user_id_ = env->GetLongField(p, res->creator_user_id_fieldID);
  res->english_example_ = jni::fetch_tl_object<textCompositionStyleExample>(env, jni::fetch_object(env, p, res->english_example_fieldID));
  return res;
}

void textCompositionStyle::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); } }
  env->SetLongField(s, custom_emoji_id_fieldID, custom_emoji_id_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_custom_fieldID, is_custom_);
  env->SetBooleanField(s, is_creator_fieldID, is_creator_);
  env->SetIntField(s, install_count_fieldID, install_count_);
  { jstring nextString = jni::to_jstring(env, prompt_); if (nextString) { env->SetObjectField(s, prompt_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, creator_user_id_fieldID, creator_user_id_);
  if (english_example_ != nullptr) { jobject next; english_example_->store(env, next); if (next) { env->SetObjectField(s, english_example_fieldID, next); env->DeleteLocalRef(next); } }
}

void textCompositionStyle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TextCompositionStyle");
    s.store_field("name", name_);
    s.store_field("customEmojiId", custom_emoji_id_);
    s.store_field("title", title_);
    s.store_field("isCustom", is_custom_);
    s.store_field("isCreator", is_creator_);
    s.store_field("installCount", install_count_);
    s.store_field("prompt", prompt_);
    s.store_field("creatorUserId", creator_user_id_);
    s.store_object_field("englishExample", static_cast<const BaseObject *>(english_example_.get()));
    s.store_class_end();
  }
}

void textCompositionStyle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TextCompositionStyle").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    custom_emoji_id_fieldID = jni::get_field_id(env, Class, "customEmojiId", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    is_custom_fieldID = jni::get_field_id(env, Class, "isCustom", "Z");
    is_creator_fieldID = jni::get_field_id(env, Class, "isCreator", "Z");
    install_count_fieldID = jni::get_field_id(env, Class, "installCount", "I");
    prompt_fieldID = jni::get_field_id(env, Class, "prompt", "Ljava/lang/String;");
    creator_user_id_fieldID = jni::get_field_id(env, Class, "creatorUserId", "J");
    english_example_fieldID = jni::get_field_id(env, Class, "englishExample", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TextCompositionStyleExample;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftBackdrop::Class;
jfieldID upgradedGiftBackdrop::id_fieldID;
jfieldID upgradedGiftBackdrop::name_fieldID;
jfieldID upgradedGiftBackdrop::colors_fieldID;
jfieldID upgradedGiftBackdrop::rarity_fieldID;

upgradedGiftBackdrop::upgradedGiftBackdrop()
  : id_()
  , name_()
  , colors_()
  , rarity_()
{}

upgradedGiftBackdrop::upgradedGiftBackdrop(int32 id_, string const &name_, object_ptr<upgradedGiftBackdropColors> &&colors_, object_ptr<UpgradedGiftAttributeRarity> &&rarity_)
  : id_(id_)
  , name_(name_)
  , colors_(std::move(colors_))
  , rarity_(std::move(rarity_))
{}

const std::int32_t upgradedGiftBackdrop::ID;

object_ptr<upgradedGiftBackdrop> upgradedGiftBackdrop::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftBackdrop> res = make_object<upgradedGiftBackdrop>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->colors_ = jni::fetch_tl_object<upgradedGiftBackdropColors>(env, jni::fetch_object(env, p, res->colors_fieldID));
  res->rarity_ = jni::fetch_tl_object<UpgradedGiftAttributeRarity>(env, jni::fetch_object(env, p, res->rarity_fieldID));
  return res;
}

void upgradedGiftBackdrop::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (colors_ != nullptr) { jobject next; colors_->store(env, next); if (next) { env->SetObjectField(s, colors_fieldID, next); env->DeleteLocalRef(next); } }
  if (rarity_ != nullptr) { jobject next; rarity_->store(env, next); if (next) { env->SetObjectField(s, rarity_fieldID, next); env->DeleteLocalRef(next); } }
}

void upgradedGiftBackdrop::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftBackdrop");
    s.store_field("id", id_);
    s.store_field("name", name_);
    s.store_object_field("colors", static_cast<const BaseObject *>(colors_.get()));
    s.store_object_field("rarity", static_cast<const BaseObject *>(rarity_.get()));
    s.store_class_end();
  }
}

void upgradedGiftBackdrop::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftBackdrop").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    colors_fieldID = jni::get_field_id(env, Class, "colors", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftBackdropColors;").c_str());
    rarity_fieldID = jni::get_field_id(env, Class, "rarity", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftAttributeRarity;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftBackdropColors::Class;
jfieldID upgradedGiftBackdropColors::center_color_fieldID;
jfieldID upgradedGiftBackdropColors::edge_color_fieldID;
jfieldID upgradedGiftBackdropColors::symbol_color_fieldID;
jfieldID upgradedGiftBackdropColors::text_color_fieldID;

upgradedGiftBackdropColors::upgradedGiftBackdropColors()
  : center_color_()
  , edge_color_()
  , symbol_color_()
  , text_color_()
{}

upgradedGiftBackdropColors::upgradedGiftBackdropColors(int32 center_color_, int32 edge_color_, int32 symbol_color_, int32 text_color_)
  : center_color_(center_color_)
  , edge_color_(edge_color_)
  , symbol_color_(symbol_color_)
  , text_color_(text_color_)
{}

const std::int32_t upgradedGiftBackdropColors::ID;

object_ptr<upgradedGiftBackdropColors> upgradedGiftBackdropColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftBackdropColors> res = make_object<upgradedGiftBackdropColors>();
  res->center_color_ = env->GetIntField(p, res->center_color_fieldID);
  res->edge_color_ = env->GetIntField(p, res->edge_color_fieldID);
  res->symbol_color_ = env->GetIntField(p, res->symbol_color_fieldID);
  res->text_color_ = env->GetIntField(p, res->text_color_fieldID);
  return res;
}

void upgradedGiftBackdropColors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, center_color_fieldID, center_color_);
  env->SetIntField(s, edge_color_fieldID, edge_color_);
  env->SetIntField(s, symbol_color_fieldID, symbol_color_);
  env->SetIntField(s, text_color_fieldID, text_color_);
}

void upgradedGiftBackdropColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftBackdropColors");
    s.store_field("centerColor", center_color_);
    s.store_field("edgeColor", edge_color_);
    s.store_field("symbolColor", symbol_color_);
    s.store_field("textColor", text_color_);
    s.store_class_end();
  }
}

void upgradedGiftBackdropColors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftBackdropColors").c_str());
    center_color_fieldID = jni::get_field_id(env, Class, "centerColor", "I");
    edge_color_fieldID = jni::get_field_id(env, Class, "edgeColor", "I");
    symbol_color_fieldID = jni::get_field_id(env, Class, "symbolColor", "I");
    text_color_fieldID = jni::get_field_id(env, Class, "textColor", "I");
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftSymbol::Class;
jfieldID upgradedGiftSymbol::name_fieldID;
jfieldID upgradedGiftSymbol::sticker_fieldID;
jfieldID upgradedGiftSymbol::rarity_fieldID;

upgradedGiftSymbol::upgradedGiftSymbol()
  : name_()
  , sticker_()
  , rarity_()
{}

upgradedGiftSymbol::upgradedGiftSymbol(string const &name_, object_ptr<sticker> &&sticker_, object_ptr<UpgradedGiftAttributeRarity> &&rarity_)
  : name_(name_)
  , sticker_(std::move(sticker_))
  , rarity_(std::move(rarity_))
{}

const std::int32_t upgradedGiftSymbol::ID;

object_ptr<upgradedGiftSymbol> upgradedGiftSymbol::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftSymbol> res = make_object<upgradedGiftSymbol>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->rarity_ = jni::fetch_tl_object<UpgradedGiftAttributeRarity>(env, jni::fetch_object(env, p, res->rarity_fieldID));
  return res;
}

void upgradedGiftSymbol::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 (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
  if (rarity_ != nullptr) { jobject next; rarity_->store(env, next); if (next) { env->SetObjectField(s, rarity_fieldID, next); env->DeleteLocalRef(next); } }
}

void upgradedGiftSymbol::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftSymbol");
    s.store_field("name", name_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_object_field("rarity", static_cast<const BaseObject *>(rarity_.get()));
    s.store_class_end();
  }
}

void upgradedGiftSymbol::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftSymbol").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    rarity_fieldID = jni::get_field_id(env, Class, "rarity", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftAttributeRarity;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass userLink::Class;
jfieldID userLink::url_fieldID;
jfieldID userLink::expires_in_fieldID;

userLink::userLink()
  : url_()
  , expires_in_()
{}

userLink::userLink(string const &url_, int32 expires_in_)
  : url_(url_)
  , expires_in_(expires_in_)
{}

const std::int32_t userLink::ID;

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

void userLink::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->SetIntField(s, expires_in_fieldID, expires_in_);
}

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

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

jclass UserPrivacySetting::Class;

object_ptr<UserPrivacySetting> UserPrivacySetting::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case userPrivacySettingShowStatus::ID:
      return userPrivacySettingShowStatus::fetch(env, p);
    case userPrivacySettingShowProfilePhoto::ID:
      return userPrivacySettingShowProfilePhoto::fetch(env, p);
    case userPrivacySettingShowLinkInForwardedMessages::ID:
      return userPrivacySettingShowLinkInForwardedMessages::fetch(env, p);
    case userPrivacySettingShowPhoneNumber::ID:
      return userPrivacySettingShowPhoneNumber::fetch(env, p);
    case userPrivacySettingShowBio::ID:
      return userPrivacySettingShowBio::fetch(env, p);
    case userPrivacySettingShowBirthdate::ID:
      return userPrivacySettingShowBirthdate::fetch(env, p);
    case userPrivacySettingShowProfileAudio::ID:
      return userPrivacySettingShowProfileAudio::fetch(env, p);
    case userPrivacySettingAllowChatInvites::ID:
      return userPrivacySettingAllowChatInvites::fetch(env, p);
    case userPrivacySettingAllowCalls::ID:
      return userPrivacySettingAllowCalls::fetch(env, p);
    case userPrivacySettingAllowPeerToPeerCalls::ID:
      return userPrivacySettingAllowPeerToPeerCalls::fetch(env, p);
    case userPrivacySettingAllowFindingByPhoneNumber::ID:
      return userPrivacySettingAllowFindingByPhoneNumber::fetch(env, p);
    case userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages::ID:
      return userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages::fetch(env, p);
    case userPrivacySettingAutosaveGifts::ID:
      return userPrivacySettingAutosaveGifts::fetch(env, p);
    case userPrivacySettingAllowUnpaidMessages::ID:
      return userPrivacySettingAllowUnpaidMessages::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass userPrivacySettingShowStatus::Class;

userPrivacySettingShowStatus::userPrivacySettingShowStatus() {
}

const std::int32_t userPrivacySettingShowStatus::ID;

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

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

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

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

jclass userPrivacySettingShowProfilePhoto::Class;

userPrivacySettingShowProfilePhoto::userPrivacySettingShowProfilePhoto() {
}

const std::int32_t userPrivacySettingShowProfilePhoto::ID;

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

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

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

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

jclass userPrivacySettingShowLinkInForwardedMessages::Class;

userPrivacySettingShowLinkInForwardedMessages::userPrivacySettingShowLinkInForwardedMessages() {
}

const std::int32_t userPrivacySettingShowLinkInForwardedMessages::ID;

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

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

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

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

jclass userPrivacySettingShowPhoneNumber::Class;

userPrivacySettingShowPhoneNumber::userPrivacySettingShowPhoneNumber() {
}

const std::int32_t userPrivacySettingShowPhoneNumber::ID;

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

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

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

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

jclass userPrivacySettingShowBio::Class;

userPrivacySettingShowBio::userPrivacySettingShowBio() {
}

const std::int32_t userPrivacySettingShowBio::ID;

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

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

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

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

jclass userPrivacySettingShowBirthdate::Class;

userPrivacySettingShowBirthdate::userPrivacySettingShowBirthdate() {
}

const std::int32_t userPrivacySettingShowBirthdate::ID;

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

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

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

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

jclass userPrivacySettingShowProfileAudio::Class;

userPrivacySettingShowProfileAudio::userPrivacySettingShowProfileAudio() {
}

const std::int32_t userPrivacySettingShowProfileAudio::ID;

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

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

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

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

jclass userPrivacySettingAllowChatInvites::Class;

userPrivacySettingAllowChatInvites::userPrivacySettingAllowChatInvites() {
}

const std::int32_t userPrivacySettingAllowChatInvites::ID;

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

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

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

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

jclass userPrivacySettingAllowCalls::Class;

userPrivacySettingAllowCalls::userPrivacySettingAllowCalls() {
}

const std::int32_t userPrivacySettingAllowCalls::ID;

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

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

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

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

jclass userPrivacySettingAllowPeerToPeerCalls::Class;

userPrivacySettingAllowPeerToPeerCalls::userPrivacySettingAllowPeerToPeerCalls() {
}

const std::int32_t userPrivacySettingAllowPeerToPeerCalls::ID;

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

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

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

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

jclass userPrivacySettingAllowFindingByPhoneNumber::Class;

userPrivacySettingAllowFindingByPhoneNumber::userPrivacySettingAllowFindingByPhoneNumber() {
}

const std::int32_t userPrivacySettingAllowFindingByPhoneNumber::ID;

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

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

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

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

jclass userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages::Class;

userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages::userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages() {
}

const std::int32_t userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages::ID;

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

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

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

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

jclass userPrivacySettingAutosaveGifts::Class;

userPrivacySettingAutosaveGifts::userPrivacySettingAutosaveGifts() {
}

const std::int32_t userPrivacySettingAutosaveGifts::ID;

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

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

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

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

jclass userPrivacySettingAllowUnpaidMessages::Class;

userPrivacySettingAllowUnpaidMessages::userPrivacySettingAllowUnpaidMessages() {
}

const std::int32_t userPrivacySettingAllowUnpaidMessages::ID;

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

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

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

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

jclass videoChat::Class;
jfieldID videoChat::group_call_id_fieldID;
jfieldID videoChat::has_participants_fieldID;
jfieldID videoChat::default_participant_id_fieldID;

videoChat::videoChat()
  : group_call_id_()
  , has_participants_()
  , default_participant_id_()
{}

videoChat::videoChat(int32 group_call_id_, bool has_participants_, object_ptr<MessageSender> &&default_participant_id_)
  : group_call_id_(group_call_id_)
  , has_participants_(has_participants_)
  , default_participant_id_(std::move(default_participant_id_))
{}

const std::int32_t videoChat::ID;

object_ptr<videoChat> videoChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<videoChat> res = make_object<videoChat>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->has_participants_ = (env->GetBooleanField(p, res->has_participants_fieldID) != 0);
  res->default_participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->default_participant_id_fieldID));
  return res;
}

void videoChat::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->SetBooleanField(s, has_participants_fieldID, has_participants_);
  if (default_participant_id_ != nullptr) { jobject next; default_participant_id_->store(env, next); if (next) { env->SetObjectField(s, default_participant_id_fieldID, next); env->DeleteLocalRef(next); } }
}

void videoChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VideoChat");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("hasParticipants", has_participants_);
    s.store_object_field("defaultParticipantId", static_cast<const BaseObject *>(default_participant_id_.get()));
    s.store_class_end();
  }
}

void videoChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VideoChat").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    has_participants_fieldID = jni::get_field_id(env, Class, "hasParticipants", "Z");
    default_participant_id_fieldID = jni::get_field_id(env, Class, "defaultParticipantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass webAppInfo::Class;
jfieldID webAppInfo::launch_id_fieldID;
jfieldID webAppInfo::url_fieldID;

webAppInfo::webAppInfo()
  : launch_id_()
  , url_()
{}

webAppInfo::webAppInfo(int64 launch_id_, string const &url_)
  : launch_id_(launch_id_)
  , url_(url_)
{}

const std::int32_t webAppInfo::ID;

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

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

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

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

jclass webAppOpenParameters::Class;
jfieldID webAppOpenParameters::theme_fieldID;
jfieldID webAppOpenParameters::application_name_fieldID;
jfieldID webAppOpenParameters::mode_fieldID;

webAppOpenParameters::webAppOpenParameters()
  : theme_()
  , application_name_()
  , mode_()
{}

webAppOpenParameters::webAppOpenParameters(object_ptr<themeParameters> &&theme_, string const &application_name_, object_ptr<WebAppOpenMode> &&mode_)
  : theme_(std::move(theme_))
  , application_name_(application_name_)
  , mode_(std::move(mode_))
{}

const std::int32_t webAppOpenParameters::ID;

object_ptr<webAppOpenParameters> webAppOpenParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<webAppOpenParameters> res = make_object<webAppOpenParameters>();
  res->theme_ = jni::fetch_tl_object<themeParameters>(env, jni::fetch_object(env, p, res->theme_fieldID));
  res->application_name_ = jni::fetch_string(env, p, res->application_name_fieldID);
  res->mode_ = jni::fetch_tl_object<WebAppOpenMode>(env, jni::fetch_object(env, p, res->mode_fieldID));
  return res;
}

void webAppOpenParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "WebAppOpenParameters");
    s.store_object_field("theme", static_cast<const BaseObject *>(theme_.get()));
    s.store_field("applicationName", application_name_);
    s.store_object_field("mode", static_cast<const BaseObject *>(mode_.get()));
    s.store_class_end();
  }
}

void webAppOpenParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$WebAppOpenParameters").c_str());
    theme_fieldID = jni::get_field_id(env, Class, "theme", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThemeParameters;").c_str());
    application_name_fieldID = jni::get_field_id(env, Class, "applicationName", "Ljava/lang/String;");
    mode_fieldID = jni::get_field_id(env, Class, "mode", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$WebAppOpenMode;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass acceptOauthRequest::Class;
jfieldID acceptOauthRequest::url_fieldID;
jfieldID acceptOauthRequest::match_code_fieldID;
jfieldID acceptOauthRequest::allow_write_access_fieldID;
jfieldID acceptOauthRequest::allow_phone_number_access_fieldID;

acceptOauthRequest::acceptOauthRequest()
  : url_()
  , match_code_()
  , allow_write_access_()
  , allow_phone_number_access_()
{}

acceptOauthRequest::acceptOauthRequest(string const &url_, string const &match_code_, bool allow_write_access_, bool allow_phone_number_access_)
  : url_(url_)
  , match_code_(match_code_)
  , allow_write_access_(allow_write_access_)
  , allow_phone_number_access_(allow_phone_number_access_)
{}

const std::int32_t acceptOauthRequest::ID;

object_ptr<acceptOauthRequest> acceptOauthRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<acceptOauthRequest> res = make_object<acceptOauthRequest>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->match_code_ = jni::fetch_string(env, p, res->match_code_fieldID);
  res->allow_write_access_ = (env->GetBooleanField(p, res->allow_write_access_fieldID) != 0);
  res->allow_phone_number_access_ = (env->GetBooleanField(p, res->allow_phone_number_access_fieldID) != 0);
  return res;
}

void acceptOauthRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AcceptOauthRequest");
    s.store_field("url", url_);
    s.store_field("matchCode", match_code_);
    s.store_field("allowWriteAccess", allow_write_access_);
    s.store_field("allowPhoneNumberAccess", allow_phone_number_access_);
    s.store_class_end();
  }
}

acceptOauthRequest::ReturnType acceptOauthRequest::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void acceptOauthRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AcceptOauthRequest").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;");
    allow_write_access_fieldID = jni::get_field_id(env, Class, "allowWriteAccess", "Z");
    allow_phone_number_access_fieldID = jni::get_field_id(env, Class, "allowPhoneNumberAccess", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass addProfileAudio::Class;
jfieldID addProfileAudio::audio_fieldID;
jfieldID addProfileAudio::duration_fieldID;
jfieldID addProfileAudio::title_fieldID;
jfieldID addProfileAudio::performer_fieldID;

addProfileAudio::addProfileAudio()
  : audio_()
  , duration_()
  , title_()
  , performer_()
{}

addProfileAudio::addProfileAudio(object_ptr<InputFile> &&audio_, int32 duration_, string const &title_, string const &performer_)
  : audio_(std::move(audio_))
  , duration_(duration_)
  , title_(title_)
  , performer_(performer_)
{}

const std::int32_t addProfileAudio::ID;

object_ptr<addProfileAudio> addProfileAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addProfileAudio> res = make_object<addProfileAudio>();
  res->audio_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->audio_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->performer_ = jni::fetch_string(env, p, res->performer_fieldID);
  return res;
}

void addProfileAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddProfileAudio");
    s.store_object_field("audio", static_cast<const BaseObject *>(audio_.get()));
    s.store_field("duration", duration_);
    s.store_field("title", title_);
    s.store_field("performer", performer_);
    s.store_class_end();
  }
}

addProfileAudio::ReturnType addProfileAudio::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addProfileAudio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddProfileAudio").c_str());
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    performer_fieldID = jni::get_field_id(env, Class, "performer", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass banGroupCallParticipants::Class;
jfieldID banGroupCallParticipants::group_call_id_fieldID;
jfieldID banGroupCallParticipants::user_ids_fieldID;

banGroupCallParticipants::banGroupCallParticipants()
  : group_call_id_()
  , user_ids_()
{}

banGroupCallParticipants::banGroupCallParticipants(int32 group_call_id_, array<int64> &&user_ids_)
  : group_call_id_(group_call_id_)
  , user_ids_(std::move(user_ids_))
{}

const std::int32_t banGroupCallParticipants::ID;

object_ptr<banGroupCallParticipants> banGroupCallParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<banGroupCallParticipants> res = make_object<banGroupCallParticipants>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return res;
}

void banGroupCallParticipants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BanGroupCallParticipants");
    s.store_field("groupCallId", group_call_id_);
    { s.store_vector_begin("userIds", user_ids_.size()); for (const auto &_value : user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

banGroupCallParticipants::ReturnType banGroupCallParticipants::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void banGroupCallParticipants::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BanGroupCallParticipants").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass checkAuthenticationCode::Class;
jfieldID checkAuthenticationCode::code_fieldID;

checkAuthenticationCode::checkAuthenticationCode()
  : code_()
{}

checkAuthenticationCode::checkAuthenticationCode(string const &code_)
  : code_(code_)
{}

const std::int32_t checkAuthenticationCode::ID;

object_ptr<checkAuthenticationCode> checkAuthenticationCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkAuthenticationCode> res = make_object<checkAuthenticationCode>();
  res->code_ = jni::fetch_string(env, p, res->code_fieldID);
  return res;
}

void checkAuthenticationCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckAuthenticationCode");
    s.store_field("code", code_);
    s.store_class_end();
  }
}

checkAuthenticationCode::ReturnType checkAuthenticationCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass checkAuthenticationEmailCode::Class;
jfieldID checkAuthenticationEmailCode::code_fieldID;

checkAuthenticationEmailCode::checkAuthenticationEmailCode()
  : code_()
{}

checkAuthenticationEmailCode::checkAuthenticationEmailCode(object_ptr<EmailAddressAuthentication> &&code_)
  : code_(std::move(code_))
{}

const std::int32_t checkAuthenticationEmailCode::ID;

object_ptr<checkAuthenticationEmailCode> checkAuthenticationEmailCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkAuthenticationEmailCode> res = make_object<checkAuthenticationEmailCode>();
  res->code_ = jni::fetch_tl_object<EmailAddressAuthentication>(env, jni::fetch_object(env, p, res->code_fieldID));
  return res;
}

void checkAuthenticationEmailCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckAuthenticationEmailCode");
    s.store_object_field("code", static_cast<const BaseObject *>(code_.get()));
    s.store_class_end();
  }
}

checkAuthenticationEmailCode::ReturnType checkAuthenticationEmailCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass checkChatFolderInviteLink::Class;
jfieldID checkChatFolderInviteLink::invite_link_fieldID;

checkChatFolderInviteLink::checkChatFolderInviteLink()
  : invite_link_()
{}

checkChatFolderInviteLink::checkChatFolderInviteLink(string const &invite_link_)
  : invite_link_(invite_link_)
{}

const std::int32_t checkChatFolderInviteLink::ID;

object_ptr<checkChatFolderInviteLink> checkChatFolderInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkChatFolderInviteLink> res = make_object<checkChatFolderInviteLink>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return res;
}

void checkChatFolderInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckChatFolderInviteLink");
    s.store_field("inviteLink", invite_link_);
    s.store_class_end();
  }
}

checkChatFolderInviteLink::ReturnType checkChatFolderInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderInviteLinkInfo::fetch(env, p);
}

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

jclass checkPremiumGiftCode::Class;
jfieldID checkPremiumGiftCode::code_fieldID;

checkPremiumGiftCode::checkPremiumGiftCode()
  : code_()
{}

checkPremiumGiftCode::checkPremiumGiftCode(string const &code_)
  : code_(code_)
{}

const std::int32_t checkPremiumGiftCode::ID;

object_ptr<checkPremiumGiftCode> checkPremiumGiftCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkPremiumGiftCode> res = make_object<checkPremiumGiftCode>();
  res->code_ = jni::fetch_string(env, p, res->code_fieldID);
  return res;
}

void checkPremiumGiftCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckPremiumGiftCode");
    s.store_field("code", code_);
    s.store_class_end();
  }
}

checkPremiumGiftCode::ReturnType checkPremiumGiftCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return premiumGiftCodeInfo::fetch(env, p);
}

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

jclass cleanFileName::Class;
jfieldID cleanFileName::file_name_fieldID;

cleanFileName::cleanFileName()
  : file_name_()
{}

cleanFileName::cleanFileName(string const &file_name_)
  : file_name_(file_name_)
{}

const std::int32_t cleanFileName::ID;

object_ptr<cleanFileName> cleanFileName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<cleanFileName> res = make_object<cleanFileName>();
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  return res;
}

void cleanFileName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CleanFileName");
    s.store_field("fileName", file_name_);
    s.store_class_end();
  }
}

cleanFileName::ReturnType cleanFileName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass clickVideoMessageAdvertisement::Class;
jfieldID clickVideoMessageAdvertisement::advertisement_unique_id_fieldID;

clickVideoMessageAdvertisement::clickVideoMessageAdvertisement()
  : advertisement_unique_id_()
{}

clickVideoMessageAdvertisement::clickVideoMessageAdvertisement(int53 advertisement_unique_id_)
  : advertisement_unique_id_(advertisement_unique_id_)
{}

const std::int32_t clickVideoMessageAdvertisement::ID;

object_ptr<clickVideoMessageAdvertisement> clickVideoMessageAdvertisement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<clickVideoMessageAdvertisement> res = make_object<clickVideoMessageAdvertisement>();
  res->advertisement_unique_id_ = env->GetLongField(p, res->advertisement_unique_id_fieldID);
  return res;
}

void clickVideoMessageAdvertisement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ClickVideoMessageAdvertisement");
    s.store_field("advertisementUniqueId", advertisement_unique_id_);
    s.store_class_end();
  }
}

clickVideoMessageAdvertisement::ReturnType clickVideoMessageAdvertisement::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass confirmQrCodeAuthentication::Class;
jfieldID confirmQrCodeAuthentication::link_fieldID;

confirmQrCodeAuthentication::confirmQrCodeAuthentication()
  : link_()
{}

confirmQrCodeAuthentication::confirmQrCodeAuthentication(string const &link_)
  : link_(link_)
{}

const std::int32_t confirmQrCodeAuthentication::ID;

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

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

confirmQrCodeAuthentication::ReturnType confirmQrCodeAuthentication::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return session::fetch(env, p);
}

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

jclass createBasicGroupChat::Class;
jfieldID createBasicGroupChat::basic_group_id_fieldID;
jfieldID createBasicGroupChat::force_fieldID;

createBasicGroupChat::createBasicGroupChat()
  : basic_group_id_()
  , force_()
{}

createBasicGroupChat::createBasicGroupChat(int53 basic_group_id_, bool force_)
  : basic_group_id_(basic_group_id_)
  , force_(force_)
{}

const std::int32_t createBasicGroupChat::ID;

object_ptr<createBasicGroupChat> createBasicGroupChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createBasicGroupChat> res = make_object<createBasicGroupChat>();
  res->basic_group_id_ = env->GetLongField(p, res->basic_group_id_fieldID);
  res->force_ = (env->GetBooleanField(p, res->force_fieldID) != 0);
  return res;
}

void createBasicGroupChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateBasicGroupChat");
    s.store_field("basicGroupId", basic_group_id_);
    s.store_field("force", force_);
    s.store_class_end();
  }
}

createBasicGroupChat::ReturnType createBasicGroupChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

void createBasicGroupChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateBasicGroupChat").c_str());
    basic_group_id_fieldID = jni::get_field_id(env, Class, "basicGroupId", "J");
    force_fieldID = jni::get_field_id(env, Class, "force", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createChatInviteLink::Class;
jfieldID createChatInviteLink::chat_id_fieldID;
jfieldID createChatInviteLink::name_fieldID;
jfieldID createChatInviteLink::expiration_date_fieldID;
jfieldID createChatInviteLink::member_limit_fieldID;
jfieldID createChatInviteLink::creates_join_request_fieldID;

createChatInviteLink::createChatInviteLink()
  : chat_id_()
  , name_()
  , expiration_date_()
  , member_limit_()
  , creates_join_request_()
{}

createChatInviteLink::createChatInviteLink(int53 chat_id_, string const &name_, int32 expiration_date_, int32 member_limit_, bool creates_join_request_)
  : chat_id_(chat_id_)
  , name_(name_)
  , expiration_date_(expiration_date_)
  , member_limit_(member_limit_)
  , creates_join_request_(creates_join_request_)
{}

const std::int32_t createChatInviteLink::ID;

object_ptr<createChatInviteLink> createChatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createChatInviteLink> res = make_object<createChatInviteLink>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  res->member_limit_ = env->GetIntField(p, res->member_limit_fieldID);
  res->creates_join_request_ = (env->GetBooleanField(p, res->creates_join_request_fieldID) != 0);
  return res;
}

void createChatInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateChatInviteLink");
    s.store_field("chatId", chat_id_);
    s.store_field("name", name_);
    s.store_field("expirationDate", expiration_date_);
    s.store_field("memberLimit", member_limit_);
    s.store_field("createsJoinRequest", creates_join_request_);
    s.store_class_end();
  }
}

createChatInviteLink::ReturnType createChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLink::fetch(env, p);
}

void createChatInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateChatInviteLink").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    member_limit_fieldID = jni::get_field_id(env, Class, "memberLimit", "I");
    creates_join_request_fieldID = jni::get_field_id(env, Class, "createsJoinRequest", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createGroupCall::Class;
jfieldID createGroupCall::join_parameters_fieldID;

createGroupCall::createGroupCall()
  : join_parameters_()
{}

createGroupCall::createGroupCall(object_ptr<groupCallJoinParameters> &&join_parameters_)
  : join_parameters_(std::move(join_parameters_))
{}

const std::int32_t createGroupCall::ID;

object_ptr<createGroupCall> createGroupCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createGroupCall> res = make_object<createGroupCall>();
  res->join_parameters_ = jni::fetch_tl_object<groupCallJoinParameters>(env, jni::fetch_object(env, p, res->join_parameters_fieldID));
  return res;
}

void createGroupCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateGroupCall");
    s.store_object_field("joinParameters", static_cast<const BaseObject *>(join_parameters_.get()));
    s.store_class_end();
  }
}

createGroupCall::ReturnType createGroupCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return groupCallInfo::fetch(env, p);
}

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

jclass createNewSupergroupChat::Class;
jfieldID createNewSupergroupChat::title_fieldID;
jfieldID createNewSupergroupChat::is_forum_fieldID;
jfieldID createNewSupergroupChat::is_channel_fieldID;
jfieldID createNewSupergroupChat::description_fieldID;
jfieldID createNewSupergroupChat::location_fieldID;
jfieldID createNewSupergroupChat::message_auto_delete_time_fieldID;
jfieldID createNewSupergroupChat::for_import_fieldID;

createNewSupergroupChat::createNewSupergroupChat()
  : title_()
  , is_forum_()
  , is_channel_()
  , description_()
  , location_()
  , message_auto_delete_time_()
  , for_import_()
{}

createNewSupergroupChat::createNewSupergroupChat(string const &title_, bool is_forum_, bool is_channel_, string const &description_, object_ptr<chatLocation> &&location_, int32 message_auto_delete_time_, bool for_import_)
  : title_(title_)
  , is_forum_(is_forum_)
  , is_channel_(is_channel_)
  , description_(description_)
  , location_(std::move(location_))
  , message_auto_delete_time_(message_auto_delete_time_)
  , for_import_(for_import_)
{}

const std::int32_t createNewSupergroupChat::ID;

object_ptr<createNewSupergroupChat> createNewSupergroupChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createNewSupergroupChat> res = make_object<createNewSupergroupChat>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->is_forum_ = (env->GetBooleanField(p, res->is_forum_fieldID) != 0);
  res->is_channel_ = (env->GetBooleanField(p, res->is_channel_fieldID) != 0);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->location_ = jni::fetch_tl_object<chatLocation>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->message_auto_delete_time_ = env->GetIntField(p, res->message_auto_delete_time_fieldID);
  res->for_import_ = (env->GetBooleanField(p, res->for_import_fieldID) != 0);
  return res;
}

void createNewSupergroupChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateNewSupergroupChat");
    s.store_field("title", title_);
    s.store_field("isForum", is_forum_);
    s.store_field("isChannel", is_channel_);
    s.store_field("description", description_);
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("messageAutoDeleteTime", message_auto_delete_time_);
    s.store_field("forImport", for_import_);
    s.store_class_end();
  }
}

createNewSupergroupChat::ReturnType createNewSupergroupChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

void createNewSupergroupChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateNewSupergroupChat").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    is_forum_fieldID = jni::get_field_id(env, Class, "isForum", "Z");
    is_channel_fieldID = jni::get_field_id(env, Class, "isChannel", "Z");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatLocation;").c_str());
    message_auto_delete_time_fieldID = jni::get_field_id(env, Class, "messageAutoDeleteTime", "I");
    for_import_fieldID = jni::get_field_id(env, Class, "forImport", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass deleteAllRevokedChatInviteLinks::Class;
jfieldID deleteAllRevokedChatInviteLinks::chat_id_fieldID;
jfieldID deleteAllRevokedChatInviteLinks::creator_user_id_fieldID;

deleteAllRevokedChatInviteLinks::deleteAllRevokedChatInviteLinks()
  : chat_id_()
  , creator_user_id_()
{}

deleteAllRevokedChatInviteLinks::deleteAllRevokedChatInviteLinks(int53 chat_id_, int53 creator_user_id_)
  : chat_id_(chat_id_)
  , creator_user_id_(creator_user_id_)
{}

const std::int32_t deleteAllRevokedChatInviteLinks::ID;

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

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

deleteAllRevokedChatInviteLinks::ReturnType deleteAllRevokedChatInviteLinks::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteBusinessChatLink::Class;
jfieldID deleteBusinessChatLink::link_fieldID;

deleteBusinessChatLink::deleteBusinessChatLink()
  : link_()
{}

deleteBusinessChatLink::deleteBusinessChatLink(string const &link_)
  : link_(link_)
{}

const std::int32_t deleteBusinessChatLink::ID;

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

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

deleteBusinessChatLink::ReturnType deleteBusinessChatLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass editBusinessChatLink::Class;
jfieldID editBusinessChatLink::link_fieldID;
jfieldID editBusinessChatLink::link_info_fieldID;

editBusinessChatLink::editBusinessChatLink()
  : link_()
  , link_info_()
{}

editBusinessChatLink::editBusinessChatLink(string const &link_, object_ptr<inputBusinessChatLink> &&link_info_)
  : link_(link_)
  , link_info_(std::move(link_info_))
{}

const std::int32_t editBusinessChatLink::ID;

object_ptr<editBusinessChatLink> editBusinessChatLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessChatLink> res = make_object<editBusinessChatLink>();
  res->link_ = jni::fetch_string(env, p, res->link_fieldID);
  res->link_info_ = jni::fetch_tl_object<inputBusinessChatLink>(env, jni::fetch_object(env, p, res->link_info_fieldID));
  return res;
}

void editBusinessChatLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessChatLink");
    s.store_field("link", link_);
    s.store_object_field("linkInfo", static_cast<const BaseObject *>(link_info_.get()));
    s.store_class_end();
  }
}

editBusinessChatLink::ReturnType editBusinessChatLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessChatLink::fetch(env, p);
}

void editBusinessChatLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessChatLink").c_str());
    link_fieldID = jni::get_field_id(env, Class, "link", "Ljava/lang/String;");
    link_info_fieldID = jni::get_field_id(env, Class, "linkInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputBusinessChatLink;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editChatFolderInviteLink::Class;
jfieldID editChatFolderInviteLink::chat_folder_id_fieldID;
jfieldID editChatFolderInviteLink::invite_link_fieldID;
jfieldID editChatFolderInviteLink::name_fieldID;
jfieldID editChatFolderInviteLink::chat_ids_fieldID;

editChatFolderInviteLink::editChatFolderInviteLink()
  : chat_folder_id_()
  , invite_link_()
  , name_()
  , chat_ids_()
{}

editChatFolderInviteLink::editChatFolderInviteLink(int32 chat_folder_id_, string const &invite_link_, string const &name_, array<int53> &&chat_ids_)
  : chat_folder_id_(chat_folder_id_)
  , invite_link_(invite_link_)
  , name_(name_)
  , chat_ids_(std::move(chat_ids_))
{}

const std::int32_t editChatFolderInviteLink::ID;

object_ptr<editChatFolderInviteLink> editChatFolderInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editChatFolderInviteLink> res = make_object<editChatFolderInviteLink>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return res;
}

void editChatFolderInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditChatFolderInviteLink");
    s.store_field("chatFolderId", chat_folder_id_);
    s.store_field("inviteLink", invite_link_);
    s.store_field("name", name_);
    { s.store_vector_begin("chatIds", chat_ids_.size()); for (const auto &_value : chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

editChatFolderInviteLink::ReturnType editChatFolderInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderInviteLink::fetch(env, p);
}

void editChatFolderInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditChatFolderInviteLink").c_str());
    chat_folder_id_fieldID = jni::get_field_id(env, Class, "chatFolderId", "I");
    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;");
    chat_ids_fieldID = jni::get_field_id(env, Class, "chatIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass editForumTopic::Class;
jfieldID editForumTopic::chat_id_fieldID;
jfieldID editForumTopic::forum_topic_id_fieldID;
jfieldID editForumTopic::name_fieldID;
jfieldID editForumTopic::edit_icon_custom_emoji_fieldID;
jfieldID editForumTopic::icon_custom_emoji_id_fieldID;

editForumTopic::editForumTopic()
  : chat_id_()
  , forum_topic_id_()
  , name_()
  , edit_icon_custom_emoji_()
  , icon_custom_emoji_id_()
{}

editForumTopic::editForumTopic(int53 chat_id_, int32 forum_topic_id_, string const &name_, bool edit_icon_custom_emoji_, int64 icon_custom_emoji_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , name_(name_)
  , edit_icon_custom_emoji_(edit_icon_custom_emoji_)
  , icon_custom_emoji_id_(icon_custom_emoji_id_)
{}

const std::int32_t editForumTopic::ID;

object_ptr<editForumTopic> editForumTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editForumTopic> res = make_object<editForumTopic>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->edit_icon_custom_emoji_ = (env->GetBooleanField(p, res->edit_icon_custom_emoji_fieldID) != 0);
  res->icon_custom_emoji_id_ = env->GetLongField(p, res->icon_custom_emoji_id_fieldID);
  return res;
}

void editForumTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditForumTopic");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("name", name_);
    s.store_field("editIconCustomEmoji", edit_icon_custom_emoji_);
    s.store_field("iconCustomEmojiId", icon_custom_emoji_id_);
    s.store_class_end();
  }
}

editForumTopic::ReturnType editForumTopic::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editForumTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditForumTopic").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");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    edit_icon_custom_emoji_fieldID = jni::get_field_id(env, Class, "editIconCustomEmoji", "Z");
    icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "iconCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass editInlineMessageText::Class;
jfieldID editInlineMessageText::inline_message_id_fieldID;
jfieldID editInlineMessageText::reply_markup_fieldID;
jfieldID editInlineMessageText::input_message_content_fieldID;

editInlineMessageText::editInlineMessageText()
  : inline_message_id_()
  , reply_markup_()
  , input_message_content_()
{}

editInlineMessageText::editInlineMessageText(string const &inline_message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : inline_message_id_(inline_message_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editInlineMessageText::ID;

object_ptr<editInlineMessageText> editInlineMessageText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editInlineMessageText> res = make_object<editInlineMessageText>();
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_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 editInlineMessageText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditInlineMessageText");
    s.store_field("inlineMessageId", inline_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();
  }
}

editInlineMessageText::ReturnType editInlineMessageText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editInlineMessageText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditInlineMessageText").c_str());
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    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 editMessageCaption::Class;
jfieldID editMessageCaption::chat_id_fieldID;
jfieldID editMessageCaption::message_id_fieldID;
jfieldID editMessageCaption::reply_markup_fieldID;
jfieldID editMessageCaption::caption_fieldID;
jfieldID editMessageCaption::show_caption_above_media_fieldID;

editMessageCaption::editMessageCaption()
  : chat_id_()
  , message_id_()
  , reply_markup_()
  , caption_()
  , show_caption_above_media_()
{}

editMessageCaption::editMessageCaption(int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
{}

const std::int32_t editMessageCaption::ID;

object_ptr<editMessageCaption> editMessageCaption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editMessageCaption> res = make_object<editMessageCaption>();
  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->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  return res;
}

void editMessageCaption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditMessageCaption");
    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("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_class_end();
  }
}

editMessageCaption::ReturnType editMessageCaption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void editMessageCaption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditMessageCaption").c_str());
    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());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass editMessageReplyMarkup::Class;
jfieldID editMessageReplyMarkup::chat_id_fieldID;
jfieldID editMessageReplyMarkup::message_id_fieldID;
jfieldID editMessageReplyMarkup::reply_markup_fieldID;

editMessageReplyMarkup::editMessageReplyMarkup()
  : chat_id_()
  , message_id_()
  , reply_markup_()
{}

editMessageReplyMarkup::editMessageReplyMarkup(int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t editMessageReplyMarkup::ID;

object_ptr<editMessageReplyMarkup> editMessageReplyMarkup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editMessageReplyMarkup> res = make_object<editMessageReplyMarkup>();
  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));
  return res;
}

void editMessageReplyMarkup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditMessageReplyMarkup");
    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_class_end();
  }
}

editMessageReplyMarkup::ReturnType editMessageReplyMarkup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void editMessageReplyMarkup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditMessageReplyMarkup").c_str());
    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());
    return true;
  }();
  (void)is_inited;
}

jclass forwardMessages::Class;
jfieldID forwardMessages::chat_id_fieldID;
jfieldID forwardMessages::topic_id_fieldID;
jfieldID forwardMessages::from_chat_id_fieldID;
jfieldID forwardMessages::message_ids_fieldID;
jfieldID forwardMessages::options_fieldID;
jfieldID forwardMessages::send_copy_fieldID;
jfieldID forwardMessages::remove_caption_fieldID;

forwardMessages::forwardMessages()
  : chat_id_()
  , topic_id_()
  , from_chat_id_()
  , message_ids_()
  , options_()
  , send_copy_()
  , remove_caption_()
{}

forwardMessages::forwardMessages(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, int53 from_chat_id_, array<int53> &&message_ids_, object_ptr<messageSendOptions> &&options_, bool send_copy_, bool remove_caption_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , from_chat_id_(from_chat_id_)
  , message_ids_(std::move(message_ids_))
  , options_(std::move(options_))
  , send_copy_(send_copy_)
  , remove_caption_(remove_caption_)
{}

const std::int32_t forwardMessages::ID;

object_ptr<forwardMessages> forwardMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<forwardMessages> res = make_object<forwardMessages>();
  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->from_chat_id_ = env->GetLongField(p, res->from_chat_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  res->options_ = jni::fetch_tl_object<messageSendOptions>(env, jni::fetch_object(env, p, res->options_fieldID));
  res->send_copy_ = (env->GetBooleanField(p, res->send_copy_fieldID) != 0);
  res->remove_caption_ = (env->GetBooleanField(p, res->remove_caption_fieldID) != 0);
  return res;
}

void forwardMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ForwardMessages");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_field("fromChatId", from_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_object_field("options", static_cast<const BaseObject *>(options_.get()));
    s.store_field("sendCopy", send_copy_);
    s.store_field("removeCaption", remove_caption_);
    s.store_class_end();
  }
}

forwardMessages::ReturnType forwardMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void forwardMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ForwardMessages").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());
    from_chat_id_fieldID = jni::get_field_id(env, Class, "fromChatId", "J");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    options_fieldID = jni::get_field_id(env, Class, "options", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSendOptions;").c_str());
    send_copy_fieldID = jni::get_field_id(env, Class, "sendCopy", "Z");
    remove_caption_fieldID = jni::get_field_id(env, Class, "removeCaption", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getAttachmentMenuBot::Class;
jfieldID getAttachmentMenuBot::bot_user_id_fieldID;

getAttachmentMenuBot::getAttachmentMenuBot()
  : bot_user_id_()
{}

getAttachmentMenuBot::getAttachmentMenuBot(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t getAttachmentMenuBot::ID;

object_ptr<getAttachmentMenuBot> getAttachmentMenuBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getAttachmentMenuBot> res = make_object<getAttachmentMenuBot>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return res;
}

void getAttachmentMenuBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetAttachmentMenuBot");
    s.store_field("botUserId", bot_user_id_);
    s.store_class_end();
  }
}

getAttachmentMenuBot::ReturnType getAttachmentMenuBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return attachmentMenuBot::fetch(env, p);
}

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

jclass getBackgroundUrl::Class;
jfieldID getBackgroundUrl::name_fieldID;
jfieldID getBackgroundUrl::type_fieldID;

getBackgroundUrl::getBackgroundUrl()
  : name_()
  , type_()
{}

getBackgroundUrl::getBackgroundUrl(string const &name_, object_ptr<BackgroundType> &&type_)
  : name_(name_)
  , type_(std::move(type_))
{}

const std::int32_t getBackgroundUrl::ID;

object_ptr<getBackgroundUrl> getBackgroundUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBackgroundUrl> res = make_object<getBackgroundUrl>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->type_ = jni::fetch_tl_object<BackgroundType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void getBackgroundUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBackgroundUrl");
    s.store_field("name", name_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

getBackgroundUrl::ReturnType getBackgroundUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void getBackgroundUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetBackgroundUrl").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BackgroundType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getBankCardInfo::Class;
jfieldID getBankCardInfo::bank_card_number_fieldID;

getBankCardInfo::getBankCardInfo()
  : bank_card_number_()
{}

getBankCardInfo::getBankCardInfo(string const &bank_card_number_)
  : bank_card_number_(bank_card_number_)
{}

const std::int32_t getBankCardInfo::ID;

object_ptr<getBankCardInfo> getBankCardInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBankCardInfo> res = make_object<getBankCardInfo>();
  res->bank_card_number_ = jni::fetch_string(env, p, res->bank_card_number_fieldID);
  return res;
}

void getBankCardInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBankCardInfo");
    s.store_field("bankCardNumber", bank_card_number_);
    s.store_class_end();
  }
}

getBankCardInfo::ReturnType getBankCardInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return bankCardInfo::fetch(env, p);
}

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

jclass getBlockedMessageSenders::Class;
jfieldID getBlockedMessageSenders::block_list_fieldID;
jfieldID getBlockedMessageSenders::offset_fieldID;
jfieldID getBlockedMessageSenders::limit_fieldID;

getBlockedMessageSenders::getBlockedMessageSenders()
  : block_list_()
  , offset_()
  , limit_()
{}

getBlockedMessageSenders::getBlockedMessageSenders(object_ptr<BlockList> &&block_list_, int32 offset_, int32 limit_)
  : block_list_(std::move(block_list_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getBlockedMessageSenders::ID;

object_ptr<getBlockedMessageSenders> getBlockedMessageSenders::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBlockedMessageSenders> res = make_object<getBlockedMessageSenders>();
  res->block_list_ = jni::fetch_tl_object<BlockList>(env, jni::fetch_object(env, p, res->block_list_fieldID));
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getBlockedMessageSenders::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBlockedMessageSenders");
    s.store_object_field("blockList", static_cast<const BaseObject *>(block_list_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getBlockedMessageSenders::ReturnType getBlockedMessageSenders::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageSenders::fetch(env, p);
}

void getBlockedMessageSenders::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetBlockedMessageSenders").c_str());
    block_list_fieldID = jni::get_field_id(env, Class, "blockList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BlockList;").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 getBusinessAccountStarAmount::Class;
jfieldID getBusinessAccountStarAmount::business_connection_id_fieldID;

getBusinessAccountStarAmount::getBusinessAccountStarAmount()
  : business_connection_id_()
{}

getBusinessAccountStarAmount::getBusinessAccountStarAmount(string const &business_connection_id_)
  : business_connection_id_(business_connection_id_)
{}

const std::int32_t getBusinessAccountStarAmount::ID;

object_ptr<getBusinessAccountStarAmount> getBusinessAccountStarAmount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBusinessAccountStarAmount> res = make_object<getBusinessAccountStarAmount>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  return res;
}

void getBusinessAccountStarAmount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBusinessAccountStarAmount");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_class_end();
  }
}

getBusinessAccountStarAmount::ReturnType getBusinessAccountStarAmount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starAmount::fetch(env, p);
}

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

jclass getCallbackQueryAnswer::Class;
jfieldID getCallbackQueryAnswer::chat_id_fieldID;
jfieldID getCallbackQueryAnswer::message_id_fieldID;
jfieldID getCallbackQueryAnswer::payload_fieldID;

getCallbackQueryAnswer::getCallbackQueryAnswer()
  : chat_id_()
  , message_id_()
  , payload_()
{}

getCallbackQueryAnswer::getCallbackQueryAnswer(int53 chat_id_, int53 message_id_, object_ptr<CallbackQueryPayload> &&payload_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , payload_(std::move(payload_))
{}

const std::int32_t getCallbackQueryAnswer::ID;

object_ptr<getCallbackQueryAnswer> getCallbackQueryAnswer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getCallbackQueryAnswer> res = make_object<getCallbackQueryAnswer>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->payload_ = jni::fetch_tl_object<CallbackQueryPayload>(env, jni::fetch_object(env, p, res->payload_fieldID));
  return res;
}

void getCallbackQueryAnswer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetCallbackQueryAnswer");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("payload", static_cast<const BaseObject *>(payload_.get()));
    s.store_class_end();
  }
}

getCallbackQueryAnswer::ReturnType getCallbackQueryAnswer::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return callbackQueryAnswer::fetch(env, p);
}

void getCallbackQueryAnswer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetCallbackQueryAnswer").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "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 getChatMessageByDate::Class;
jfieldID getChatMessageByDate::chat_id_fieldID;
jfieldID getChatMessageByDate::date_fieldID;

getChatMessageByDate::getChatMessageByDate()
  : chat_id_()
  , date_()
{}

getChatMessageByDate::getChatMessageByDate(int53 chat_id_, int32 date_)
  : chat_id_(chat_id_)
  , date_(date_)
{}

const std::int32_t getChatMessageByDate::ID;

object_ptr<getChatMessageByDate> getChatMessageByDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatMessageByDate> res = make_object<getChatMessageByDate>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

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

getChatMessageByDate::ReturnType getChatMessageByDate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

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

jclass getChatSimilarChats::Class;
jfieldID getChatSimilarChats::chat_id_fieldID;

getChatSimilarChats::getChatSimilarChats()
  : chat_id_()
{}

getChatSimilarChats::getChatSimilarChats(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatSimilarChats::ID;

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

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

getChatSimilarChats::ReturnType getChatSimilarChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getChats::Class;
jfieldID getChats::chat_list_fieldID;
jfieldID getChats::limit_fieldID;

getChats::getChats()
  : chat_list_()
  , limit_()
{}

getChats::getChats(object_ptr<ChatList> &&chat_list_, int32 limit_)
  : chat_list_(std::move(chat_list_))
  , limit_(limit_)
{}

const std::int32_t getChats::ID;

object_ptr<getChats> getChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChats> res = make_object<getChats>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChats");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChats::ReturnType getChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChats").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getCountries::Class;

getCountries::getCountries() {
}

const std::int32_t getCountries::ID;

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

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

getCountries::ReturnType getCountries::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return countries::fetch(env, p);
}

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

jclass getDirectMessagesChatTopic::Class;
jfieldID getDirectMessagesChatTopic::chat_id_fieldID;
jfieldID getDirectMessagesChatTopic::topic_id_fieldID;

getDirectMessagesChatTopic::getDirectMessagesChatTopic()
  : chat_id_()
  , topic_id_()
{}

getDirectMessagesChatTopic::getDirectMessagesChatTopic(int53 chat_id_, int53 topic_id_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
{}

const std::int32_t getDirectMessagesChatTopic::ID;

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

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

getDirectMessagesChatTopic::ReturnType getDirectMessagesChatTopic::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return directMessagesChatTopic::fetch(env, p);
}

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

jclass getDirectMessagesChatTopicMessageByDate::Class;
jfieldID getDirectMessagesChatTopicMessageByDate::chat_id_fieldID;
jfieldID getDirectMessagesChatTopicMessageByDate::topic_id_fieldID;
jfieldID getDirectMessagesChatTopicMessageByDate::date_fieldID;

getDirectMessagesChatTopicMessageByDate::getDirectMessagesChatTopicMessageByDate()
  : chat_id_()
  , topic_id_()
  , date_()
{}

getDirectMessagesChatTopicMessageByDate::getDirectMessagesChatTopicMessageByDate(int53 chat_id_, int53 topic_id_, int32 date_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
  , date_(date_)
{}

const std::int32_t getDirectMessagesChatTopicMessageByDate::ID;

object_ptr<getDirectMessagesChatTopicMessageByDate> getDirectMessagesChatTopicMessageByDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getDirectMessagesChatTopicMessageByDate> res = make_object<getDirectMessagesChatTopicMessageByDate>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = env->GetLongField(p, res->topic_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void getDirectMessagesChatTopicMessageByDate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetDirectMessagesChatTopicMessageByDate");
    s.store_field("chatId", chat_id_);
    s.store_field("topicId", topic_id_);
    s.store_field("date", date_);
    s.store_class_end();
  }
}

getDirectMessagesChatTopicMessageByDate::ReturnType getDirectMessagesChatTopicMessageByDate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

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

jclass getEmojiCategories::Class;
jfieldID getEmojiCategories::type_fieldID;

getEmojiCategories::getEmojiCategories()
  : type_()
{}

getEmojiCategories::getEmojiCategories(object_ptr<EmojiCategoryType> &&type_)
  : type_(std::move(type_))
{}

const std::int32_t getEmojiCategories::ID;

object_ptr<getEmojiCategories> getEmojiCategories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getEmojiCategories> res = make_object<getEmojiCategories>();
  res->type_ = jni::fetch_tl_object<EmojiCategoryType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void getEmojiCategories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetEmojiCategories");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

getEmojiCategories::ReturnType getEmojiCategories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiCategories::fetch(env, p);
}

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

jclass getForumTopic::Class;
jfieldID getForumTopic::chat_id_fieldID;
jfieldID getForumTopic::forum_topic_id_fieldID;

getForumTopic::getForumTopic()
  : chat_id_()
  , forum_topic_id_()
{}

getForumTopic::getForumTopic(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t getForumTopic::ID;

object_ptr<getForumTopic> getForumTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getForumTopic> res = make_object<getForumTopic>();
  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 getForumTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetForumTopic");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_class_end();
  }
}

getForumTopic::ReturnType getForumTopic::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return forumTopic::fetch(env, p);
}

void getForumTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetForumTopic").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 getForumTopicDefaultIcons::Class;

getForumTopicDefaultIcons::getForumTopicDefaultIcons() {
}

const std::int32_t getForumTopicDefaultIcons::ID;

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

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

getForumTopicDefaultIcons::ReturnType getForumTopicDefaultIcons::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getForumTopicHistory::Class;
jfieldID getForumTopicHistory::chat_id_fieldID;
jfieldID getForumTopicHistory::forum_topic_id_fieldID;
jfieldID getForumTopicHistory::from_message_id_fieldID;
jfieldID getForumTopicHistory::offset_fieldID;
jfieldID getForumTopicHistory::limit_fieldID;

getForumTopicHistory::getForumTopicHistory()
  : chat_id_()
  , forum_topic_id_()
  , from_message_id_()
  , offset_()
  , limit_()
{}

getForumTopicHistory::getForumTopicHistory(int53 chat_id_, int32 forum_topic_id_, int53 from_message_id_, int32 offset_, int32 limit_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getForumTopicHistory::ID;

object_ptr<getForumTopicHistory> getForumTopicHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getForumTopicHistory> res = make_object<getForumTopicHistory>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getForumTopicHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetForumTopicHistory");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getForumTopicHistory::ReturnType getForumTopicHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void getForumTopicHistory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetForumTopicHistory").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");
    from_message_id_fieldID = jni::get_field_id(env, Class, "fromMessageId", "J");
    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 getGroupCallParticipants::Class;
jfieldID getGroupCallParticipants::input_group_call_fieldID;
jfieldID getGroupCallParticipants::limit_fieldID;

getGroupCallParticipants::getGroupCallParticipants()
  : input_group_call_()
  , limit_()
{}

getGroupCallParticipants::getGroupCallParticipants(object_ptr<InputGroupCall> &&input_group_call_, int32 limit_)
  : input_group_call_(std::move(input_group_call_))
  , limit_(limit_)
{}

const std::int32_t getGroupCallParticipants::ID;

object_ptr<getGroupCallParticipants> getGroupCallParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getGroupCallParticipants> res = make_object<getGroupCallParticipants>();
  res->input_group_call_ = jni::fetch_tl_object<InputGroupCall>(env, jni::fetch_object(env, p, res->input_group_call_fieldID));
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getGroupCallParticipants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGroupCallParticipants");
    s.store_object_field("inputGroupCall", static_cast<const BaseObject *>(input_group_call_.get()));
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getGroupCallParticipants::ReturnType getGroupCallParticipants::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return groupCallParticipants::fetch(env, p);
}

void getGroupCallParticipants::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetGroupCallParticipants").c_str());
    input_group_call_fieldID = jni::get_field_id(env, Class, "inputGroupCall", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputGroupCall;").c_str());
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getGroupsInCommon::Class;
jfieldID getGroupsInCommon::user_id_fieldID;
jfieldID getGroupsInCommon::offset_chat_id_fieldID;
jfieldID getGroupsInCommon::limit_fieldID;

getGroupsInCommon::getGroupsInCommon()
  : user_id_()
  , offset_chat_id_()
  , limit_()
{}

getGroupsInCommon::getGroupsInCommon(int53 user_id_, int53 offset_chat_id_, int32 limit_)
  : user_id_(user_id_)
  , offset_chat_id_(offset_chat_id_)
  , limit_(limit_)
{}

const std::int32_t getGroupsInCommon::ID;

object_ptr<getGroupsInCommon> getGroupsInCommon::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getGroupsInCommon> res = make_object<getGroupsInCommon>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->offset_chat_id_ = env->GetLongField(p, res->offset_chat_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getGroupsInCommon::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGroupsInCommon");
    s.store_field("userId", user_id_);
    s.store_field("offsetChatId", offset_chat_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getGroupsInCommon::ReturnType getGroupsInCommon::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getInlineQueryResults::Class;
jfieldID getInlineQueryResults::bot_user_id_fieldID;
jfieldID getInlineQueryResults::chat_id_fieldID;
jfieldID getInlineQueryResults::user_location_fieldID;
jfieldID getInlineQueryResults::query_fieldID;
jfieldID getInlineQueryResults::offset_fieldID;

getInlineQueryResults::getInlineQueryResults()
  : bot_user_id_()
  , chat_id_()
  , user_location_()
  , query_()
  , offset_()
{}

getInlineQueryResults::getInlineQueryResults(int53 bot_user_id_, int53 chat_id_, object_ptr<location> &&user_location_, string const &query_, string const &offset_)
  : bot_user_id_(bot_user_id_)
  , chat_id_(chat_id_)
  , user_location_(std::move(user_location_))
  , query_(query_)
  , offset_(offset_)
{}

const std::int32_t getInlineQueryResults::ID;

object_ptr<getInlineQueryResults> getInlineQueryResults::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getInlineQueryResults> res = make_object<getInlineQueryResults>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_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->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  return res;
}

void getInlineQueryResults::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetInlineQueryResults");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("chatId", chat_id_);
    s.store_object_field("userLocation", static_cast<const BaseObject *>(user_location_.get()));
    s.store_field("query", query_);
    s.store_field("offset", offset_);
    s.store_class_end();
  }
}

getInlineQueryResults::ReturnType getInlineQueryResults::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return inlineQueryResults::fetch(env, p);
}

void getInlineQueryResults::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetInlineQueryResults").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "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;");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getJsonString::Class;
jfieldID getJsonString::json_value_fieldID;

getJsonString::getJsonString()
  : json_value_()
{}

getJsonString::getJsonString(object_ptr<JsonValue> &&json_value_)
  : json_value_(std::move(json_value_))
{}

const std::int32_t getJsonString::ID;

object_ptr<getJsonString> getJsonString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getJsonString> res = make_object<getJsonString>();
  res->json_value_ = jni::fetch_tl_object<JsonValue>(env, jni::fetch_object(env, p, res->json_value_fieldID));
  return res;
}

void getJsonString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetJsonString");
    s.store_object_field("jsonValue", static_cast<const BaseObject *>(json_value_.get()));
    s.store_class_end();
  }
}

getJsonString::ReturnType getJsonString::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getMainWebApp::Class;
jfieldID getMainWebApp::chat_id_fieldID;
jfieldID getMainWebApp::bot_user_id_fieldID;
jfieldID getMainWebApp::start_parameter_fieldID;
jfieldID getMainWebApp::parameters_fieldID;

getMainWebApp::getMainWebApp()
  : chat_id_()
  , bot_user_id_()
  , start_parameter_()
  , parameters_()
{}

getMainWebApp::getMainWebApp(int53 chat_id_, int53 bot_user_id_, string const &start_parameter_, object_ptr<webAppOpenParameters> &&parameters_)
  : chat_id_(chat_id_)
  , bot_user_id_(bot_user_id_)
  , start_parameter_(start_parameter_)
  , parameters_(std::move(parameters_))
{}

const std::int32_t getMainWebApp::ID;

object_ptr<getMainWebApp> getMainWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMainWebApp> res = make_object<getMainWebApp>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->start_parameter_ = jni::fetch_string(env, p, res->start_parameter_fieldID);
  res->parameters_ = jni::fetch_tl_object<webAppOpenParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  return res;
}

void getMainWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMainWebApp");
    s.store_field("chatId", chat_id_);
    s.store_field("botUserId", bot_user_id_);
    s.store_field("startParameter", start_parameter_);
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_class_end();
  }
}

getMainWebApp::ReturnType getMainWebApp::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return mainWebApp::fetch(env, p);
}

void getMainWebApp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMainWebApp").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");
    start_parameter_fieldID = jni::get_field_id(env, Class, "startParameter", "Ljava/lang/String;");
    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 getMe::Class;

getMe::getMe() {
}

const std::int32_t getMe::ID;

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

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

getMe::ReturnType getMe::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return user::fetch(env, p);
}

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

jclass getMessageStatistics::Class;
jfieldID getMessageStatistics::chat_id_fieldID;
jfieldID getMessageStatistics::message_id_fieldID;
jfieldID getMessageStatistics::is_dark_fieldID;

getMessageStatistics::getMessageStatistics()
  : chat_id_()
  , message_id_()
  , is_dark_()
{}

getMessageStatistics::getMessageStatistics(int53 chat_id_, int53 message_id_, bool is_dark_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , is_dark_(is_dark_)
{}

const std::int32_t getMessageStatistics::ID;

object_ptr<getMessageStatistics> getMessageStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageStatistics> res = make_object<getMessageStatistics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_dark_ = (env->GetBooleanField(p, res->is_dark_fieldID) != 0);
  return res;
}

void getMessageStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageStatistics");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getMessageStatistics::ReturnType getMessageStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageStatistics::fetch(env, p);
}

void getMessageStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessageStatistics").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_dark_fieldID = jni::get_field_id(env, Class, "isDark", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getPersonalChatHistory::Class;
jfieldID getPersonalChatHistory::user_id_fieldID;
jfieldID getPersonalChatHistory::limit_fieldID;

getPersonalChatHistory::getPersonalChatHistory()
  : user_id_()
  , limit_()
{}

getPersonalChatHistory::getPersonalChatHistory(int53 user_id_, int32 limit_)
  : user_id_(user_id_)
  , limit_(limit_)
{}

const std::int32_t getPersonalChatHistory::ID;

object_ptr<getPersonalChatHistory> getPersonalChatHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPersonalChatHistory> res = make_object<getPersonalChatHistory>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

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

getPersonalChatHistory::ReturnType getPersonalChatHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

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

jclass getPushReceiverId::Class;
jfieldID getPushReceiverId::payload_fieldID;

getPushReceiverId::getPushReceiverId()
  : payload_()
{}

getPushReceiverId::getPushReceiverId(string const &payload_)
  : payload_(payload_)
{}

const std::int32_t getPushReceiverId::ID;

object_ptr<getPushReceiverId> getPushReceiverId::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPushReceiverId> res = make_object<getPushReceiverId>();
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  return res;
}

void getPushReceiverId::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPushReceiverId");
    s.store_field("payload", payload_);
    s.store_class_end();
  }
}

getPushReceiverId::ReturnType getPushReceiverId::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return pushReceiverId::fetch(env, p);
}

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

jclass getReadDatePrivacySettings::Class;

getReadDatePrivacySettings::getReadDatePrivacySettings() {
}

const std::int32_t getReadDatePrivacySettings::ID;

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

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

getReadDatePrivacySettings::ReturnType getReadDatePrivacySettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return readDatePrivacySettings::fetch(env, p);
}

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

jclass getStorageStatisticsFast::Class;

getStorageStatisticsFast::getStorageStatisticsFast() {
}

const std::int32_t getStorageStatisticsFast::ID;

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

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

getStorageStatisticsFast::ReturnType getStorageStatisticsFast::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storageStatisticsFast::fetch(env, p);
}

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

jclass getTonWithdrawalUrl::Class;
jfieldID getTonWithdrawalUrl::password_fieldID;

getTonWithdrawalUrl::getTonWithdrawalUrl()
  : password_()
{}

getTonWithdrawalUrl::getTonWithdrawalUrl(string const &password_)
  : password_(password_)
{}

const std::int32_t getTonWithdrawalUrl::ID;

object_ptr<getTonWithdrawalUrl> getTonWithdrawalUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getTonWithdrawalUrl> res = make_object<getTonWithdrawalUrl>();
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void getTonWithdrawalUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetTonWithdrawalUrl");
    s.store_field("password", password_);
    s.store_class_end();
  }
}

getTonWithdrawalUrl::ReturnType getTonWithdrawalUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass getWebAppLinkUrl::Class;
jfieldID getWebAppLinkUrl::chat_id_fieldID;
jfieldID getWebAppLinkUrl::bot_user_id_fieldID;
jfieldID getWebAppLinkUrl::web_app_short_name_fieldID;
jfieldID getWebAppLinkUrl::start_parameter_fieldID;
jfieldID getWebAppLinkUrl::allow_write_access_fieldID;
jfieldID getWebAppLinkUrl::parameters_fieldID;

getWebAppLinkUrl::getWebAppLinkUrl()
  : chat_id_()
  , bot_user_id_()
  , web_app_short_name_()
  , start_parameter_()
  , allow_write_access_()
  , parameters_()
{}

getWebAppLinkUrl::getWebAppLinkUrl(int53 chat_id_, int53 bot_user_id_, string const &web_app_short_name_, string const &start_parameter_, bool allow_write_access_, object_ptr<webAppOpenParameters> &&parameters_)
  : chat_id_(chat_id_)
  , bot_user_id_(bot_user_id_)
  , web_app_short_name_(web_app_short_name_)
  , start_parameter_(start_parameter_)
  , allow_write_access_(allow_write_access_)
  , parameters_(std::move(parameters_))
{}

const std::int32_t getWebAppLinkUrl::ID;

object_ptr<getWebAppLinkUrl> getWebAppLinkUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getWebAppLinkUrl> res = make_object<getWebAppLinkUrl>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->web_app_short_name_ = jni::fetch_string(env, p, res->web_app_short_name_fieldID);
  res->start_parameter_ = jni::fetch_string(env, p, res->start_parameter_fieldID);
  res->allow_write_access_ = (env->GetBooleanField(p, res->allow_write_access_fieldID) != 0);
  res->parameters_ = jni::fetch_tl_object<webAppOpenParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  return res;
}

void getWebAppLinkUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetWebAppLinkUrl");
    s.store_field("chatId", chat_id_);
    s.store_field("botUserId", bot_user_id_);
    s.store_field("webAppShortName", web_app_short_name_);
    s.store_field("startParameter", start_parameter_);
    s.store_field("allowWriteAccess", allow_write_access_);
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_class_end();
  }
}

getWebAppLinkUrl::ReturnType getWebAppLinkUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void getWebAppLinkUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetWebAppLinkUrl").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");
    web_app_short_name_fieldID = jni::get_field_id(env, Class, "webAppShortName", "Ljava/lang/String;");
    start_parameter_fieldID = jni::get_field_id(env, Class, "startParameter", "Ljava/lang/String;");
    allow_write_access_fieldID = jni::get_field_id(env, Class, "allowWriteAccess", "Z");
    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 isLoginEmailAddressRequired::Class;

isLoginEmailAddressRequired::isLoginEmailAddressRequired() {
}

const std::int32_t isLoginEmailAddressRequired::ID;

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

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

isLoginEmailAddressRequired::ReturnType isLoginEmailAddressRequired::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass joinChat::Class;
jfieldID joinChat::chat_id_fieldID;

joinChat::joinChat()
  : chat_id_()
{}

joinChat::joinChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t joinChat::ID;

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

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

joinChat::ReturnType joinChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass loadActiveStories::Class;
jfieldID loadActiveStories::story_list_fieldID;

loadActiveStories::loadActiveStories()
  : story_list_()
{}

loadActiveStories::loadActiveStories(object_ptr<StoryList> &&story_list_)
  : story_list_(std::move(story_list_))
{}

const std::int32_t loadActiveStories::ID;

object_ptr<loadActiveStories> loadActiveStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<loadActiveStories> res = make_object<loadActiveStories>();
  res->story_list_ = jni::fetch_tl_object<StoryList>(env, jni::fetch_object(env, p, res->story_list_fieldID));
  return res;
}

void loadActiveStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoadActiveStories");
    s.store_object_field("storyList", static_cast<const BaseObject *>(story_list_.get()));
    s.store_class_end();
  }
}

loadActiveStories::ReturnType loadActiveStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass loadChats::Class;
jfieldID loadChats::chat_list_fieldID;
jfieldID loadChats::limit_fieldID;

loadChats::loadChats()
  : chat_list_()
  , limit_()
{}

loadChats::loadChats(object_ptr<ChatList> &&chat_list_, int32 limit_)
  : chat_list_(std::move(chat_list_))
  , limit_(limit_)
{}

const std::int32_t loadChats::ID;

object_ptr<loadChats> loadChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<loadChats> res = make_object<loadChats>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void loadChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoadChats");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

loadChats::ReturnType loadChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void loadChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LoadChats").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass loadGroupCallParticipants::Class;
jfieldID loadGroupCallParticipants::group_call_id_fieldID;
jfieldID loadGroupCallParticipants::limit_fieldID;

loadGroupCallParticipants::loadGroupCallParticipants()
  : group_call_id_()
  , limit_()
{}

loadGroupCallParticipants::loadGroupCallParticipants(int32 group_call_id_, int32 limit_)
  : group_call_id_(group_call_id_)
  , limit_(limit_)
{}

const std::int32_t loadGroupCallParticipants::ID;

object_ptr<loadGroupCallParticipants> loadGroupCallParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<loadGroupCallParticipants> res = make_object<loadGroupCallParticipants>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void loadGroupCallParticipants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoadGroupCallParticipants");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

loadGroupCallParticipants::ReturnType loadGroupCallParticipants::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void loadGroupCallParticipants::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LoadGroupCallParticipants").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass loadQuickReplyShortcutMessages::Class;
jfieldID loadQuickReplyShortcutMessages::shortcut_id_fieldID;

loadQuickReplyShortcutMessages::loadQuickReplyShortcutMessages()
  : shortcut_id_()
{}

loadQuickReplyShortcutMessages::loadQuickReplyShortcutMessages(int32 shortcut_id_)
  : shortcut_id_(shortcut_id_)
{}

const std::int32_t loadQuickReplyShortcutMessages::ID;

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

void loadQuickReplyShortcutMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoadQuickReplyShortcutMessages");
    s.store_field("shortcutId", shortcut_id_);
    s.store_class_end();
  }
}

loadQuickReplyShortcutMessages::ReturnType loadQuickReplyShortcutMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass openChat::Class;
jfieldID openChat::chat_id_fieldID;

openChat::openChat()
  : chat_id_()
{}

openChat::openChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t openChat::ID;

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

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

openChat::ReturnType openChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass openGiftAuction::Class;
jfieldID openGiftAuction::gift_id_fieldID;

openGiftAuction::openGiftAuction()
  : gift_id_()
{}

openGiftAuction::openGiftAuction(int64 gift_id_)
  : gift_id_(gift_id_)
{}

const std::int32_t openGiftAuction::ID;

object_ptr<openGiftAuction> openGiftAuction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<openGiftAuction> res = make_object<openGiftAuction>();
  res->gift_id_ = env->GetLongField(p, res->gift_id_fieldID);
  return res;
}

void openGiftAuction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OpenGiftAuction");
    s.store_field("giftId", gift_id_);
    s.store_class_end();
  }
}

openGiftAuction::ReturnType openGiftAuction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass openSponsoredChat::Class;
jfieldID openSponsoredChat::sponsored_chat_unique_id_fieldID;

openSponsoredChat::openSponsoredChat()
  : sponsored_chat_unique_id_()
{}

openSponsoredChat::openSponsoredChat(int53 sponsored_chat_unique_id_)
  : sponsored_chat_unique_id_(sponsored_chat_unique_id_)
{}

const std::int32_t openSponsoredChat::ID;

object_ptr<openSponsoredChat> openSponsoredChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<openSponsoredChat> res = make_object<openSponsoredChat>();
  res->sponsored_chat_unique_id_ = env->GetLongField(p, res->sponsored_chat_unique_id_fieldID);
  return res;
}

void openSponsoredChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OpenSponsoredChat");
    s.store_field("sponsoredChatUniqueId", sponsored_chat_unique_id_);
    s.store_class_end();
  }
}

openSponsoredChat::ReturnType openSponsoredChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass openStory::Class;
jfieldID openStory::story_poster_chat_id_fieldID;
jfieldID openStory::story_id_fieldID;

openStory::openStory()
  : story_poster_chat_id_()
  , story_id_()
{}

openStory::openStory(int53 story_poster_chat_id_, int32 story_id_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
{}

const std::int32_t openStory::ID;

object_ptr<openStory> openStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<openStory> res = make_object<openStory>();
  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 res;
}

void openStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OpenStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_class_end();
  }
}

openStory::ReturnType openStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void openStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$OpenStory").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 parseMarkdown::Class;
jfieldID parseMarkdown::text_fieldID;

parseMarkdown::parseMarkdown()
  : text_()
{}

parseMarkdown::parseMarkdown(object_ptr<formattedText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t parseMarkdown::ID;

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

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

parseMarkdown::ReturnType parseMarkdown::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

void parseMarkdown::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ParseMarkdown").c_str());
    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 registerUser::Class;
jfieldID registerUser::first_name_fieldID;
jfieldID registerUser::last_name_fieldID;
jfieldID registerUser::disable_notification_fieldID;

registerUser::registerUser()
  : first_name_()
  , last_name_()
  , disable_notification_()
{}

registerUser::registerUser(string const &first_name_, string const &last_name_, bool disable_notification_)
  : first_name_(first_name_)
  , last_name_(last_name_)
  , disable_notification_(disable_notification_)
{}

const std::int32_t registerUser::ID;

object_ptr<registerUser> registerUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<registerUser> res = make_object<registerUser>();
  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->disable_notification_ = (env->GetBooleanField(p, res->disable_notification_fieldID) != 0);
  return res;
}

void registerUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RegisterUser");
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_field("disableNotification", disable_notification_);
    s.store_class_end();
  }
}

registerUser::ReturnType registerUser::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void registerUser::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RegisterUser").c_str());
    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;");
    disable_notification_fieldID = jni::get_field_id(env, Class, "disableNotification", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass removePendingLiveStoryReactions::Class;
jfieldID removePendingLiveStoryReactions::group_call_id_fieldID;

removePendingLiveStoryReactions::removePendingLiveStoryReactions()
  : group_call_id_()
{}

removePendingLiveStoryReactions::removePendingLiveStoryReactions(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t removePendingLiveStoryReactions::ID;

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

void removePendingLiveStoryReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemovePendingLiveStoryReactions");
    s.store_field("groupCallId", group_call_id_);
    s.store_class_end();
  }
}

removePendingLiveStoryReactions::ReturnType removePendingLiveStoryReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeRecentHashtag::Class;
jfieldID removeRecentHashtag::hashtag_fieldID;

removeRecentHashtag::removeRecentHashtag()
  : hashtag_()
{}

removeRecentHashtag::removeRecentHashtag(string const &hashtag_)
  : hashtag_(hashtag_)
{}

const std::int32_t removeRecentHashtag::ID;

object_ptr<removeRecentHashtag> removeRecentHashtag::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeRecentHashtag> res = make_object<removeRecentHashtag>();
  res->hashtag_ = jni::fetch_string(env, p, res->hashtag_fieldID);
  return res;
}

void removeRecentHashtag::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveRecentHashtag");
    s.store_field("hashtag", hashtag_);
    s.store_class_end();
  }
}

removeRecentHashtag::ReturnType removeRecentHashtag::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reorderBotActiveUsernames::Class;
jfieldID reorderBotActiveUsernames::bot_user_id_fieldID;
jfieldID reorderBotActiveUsernames::usernames_fieldID;

reorderBotActiveUsernames::reorderBotActiveUsernames()
  : bot_user_id_()
  , usernames_()
{}

reorderBotActiveUsernames::reorderBotActiveUsernames(int53 bot_user_id_, array<string> &&usernames_)
  : bot_user_id_(bot_user_id_)
  , usernames_(std::move(usernames_))
{}

const std::int32_t reorderBotActiveUsernames::ID;

object_ptr<reorderBotActiveUsernames> reorderBotActiveUsernames::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderBotActiveUsernames> res = make_object<reorderBotActiveUsernames>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->usernames_fieldID));
  return res;
}

void reorderBotActiveUsernames::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderBotActiveUsernames");
    s.store_field("botUserId", bot_user_id_);
    { s.store_vector_begin("usernames", usernames_.size()); for (const auto &_value : usernames_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

reorderBotActiveUsernames::ReturnType reorderBotActiveUsernames::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reorderBotActiveUsernames::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReorderBotActiveUsernames").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    usernames_fieldID = jni::get_field_id(env, Class, "usernames", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass resendAuthenticationCode::Class;
jfieldID resendAuthenticationCode::reason_fieldID;

resendAuthenticationCode::resendAuthenticationCode()
  : reason_()
{}

resendAuthenticationCode::resendAuthenticationCode(object_ptr<ResendCodeReason> &&reason_)
  : reason_(std::move(reason_))
{}

const std::int32_t resendAuthenticationCode::ID;

object_ptr<resendAuthenticationCode> resendAuthenticationCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<resendAuthenticationCode> res = make_object<resendAuthenticationCode>();
  res->reason_ = jni::fetch_tl_object<ResendCodeReason>(env, jni::fetch_object(env, p, res->reason_fieldID));
  return res;
}

void resendAuthenticationCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ResendAuthenticationCode");
    s.store_object_field("reason", static_cast<const BaseObject *>(reason_.get()));
    s.store_class_end();
  }
}

resendAuthenticationCode::ReturnType resendAuthenticationCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass revokeChatInviteLink::Class;
jfieldID revokeChatInviteLink::chat_id_fieldID;
jfieldID revokeChatInviteLink::invite_link_fieldID;

revokeChatInviteLink::revokeChatInviteLink()
  : chat_id_()
  , invite_link_()
{}

revokeChatInviteLink::revokeChatInviteLink(int53 chat_id_, string const &invite_link_)
  : chat_id_(chat_id_)
  , invite_link_(invite_link_)
{}

const std::int32_t revokeChatInviteLink::ID;

object_ptr<revokeChatInviteLink> revokeChatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<revokeChatInviteLink> res = make_object<revokeChatInviteLink>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return res;
}

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

revokeChatInviteLink::ReturnType revokeChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLinks::fetch(env, p);
}

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

jclass searchChatAffiliateProgram::Class;
jfieldID searchChatAffiliateProgram::username_fieldID;
jfieldID searchChatAffiliateProgram::referrer_fieldID;

searchChatAffiliateProgram::searchChatAffiliateProgram()
  : username_()
  , referrer_()
{}

searchChatAffiliateProgram::searchChatAffiliateProgram(string const &username_, string const &referrer_)
  : username_(username_)
  , referrer_(referrer_)
{}

const std::int32_t searchChatAffiliateProgram::ID;

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

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

searchChatAffiliateProgram::ReturnType searchChatAffiliateProgram::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

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

jclass searchChatsOnServer::Class;
jfieldID searchChatsOnServer::query_fieldID;
jfieldID searchChatsOnServer::limit_fieldID;

searchChatsOnServer::searchChatsOnServer()
  : query_()
  , limit_()
{}

searchChatsOnServer::searchChatsOnServer(string const &query_, int32 limit_)
  : query_(query_)
  , limit_(limit_)
{}

const std::int32_t searchChatsOnServer::ID;

object_ptr<searchChatsOnServer> searchChatsOnServer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchChatsOnServer> res = make_object<searchChatsOnServer>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchChatsOnServer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchChatsOnServer");
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchChatsOnServer::ReturnType searchChatsOnServer::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void searchChatsOnServer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchChatsOnServer").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 searchFileDownloads::Class;
jfieldID searchFileDownloads::query_fieldID;
jfieldID searchFileDownloads::only_active_fieldID;
jfieldID searchFileDownloads::only_completed_fieldID;
jfieldID searchFileDownloads::offset_fieldID;
jfieldID searchFileDownloads::limit_fieldID;

searchFileDownloads::searchFileDownloads()
  : query_()
  , only_active_()
  , only_completed_()
  , offset_()
  , limit_()
{}

searchFileDownloads::searchFileDownloads(string const &query_, bool only_active_, bool only_completed_, string const &offset_, int32 limit_)
  : query_(query_)
  , only_active_(only_active_)
  , only_completed_(only_completed_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchFileDownloads::ID;

object_ptr<searchFileDownloads> searchFileDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchFileDownloads> res = make_object<searchFileDownloads>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->only_active_ = (env->GetBooleanField(p, res->only_active_fieldID) != 0);
  res->only_completed_ = (env->GetBooleanField(p, res->only_completed_fieldID) != 0);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchFileDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchFileDownloads");
    s.store_field("query", query_);
    s.store_field("onlyActive", only_active_);
    s.store_field("onlyCompleted", only_completed_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchFileDownloads::ReturnType searchFileDownloads::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundFileDownloads::fetch(env, p);
}

void searchFileDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchFileDownloads").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    only_active_fieldID = jni::get_field_id(env, Class, "onlyActive", "Z");
    only_completed_fieldID = jni::get_field_id(env, Class, "onlyCompleted", "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 searchGiftsForResale::Class;
jfieldID searchGiftsForResale::gift_id_fieldID;
jfieldID searchGiftsForResale::order_fieldID;
jfieldID searchGiftsForResale::for_crafting_fieldID;
jfieldID searchGiftsForResale::for_stars_fieldID;
jfieldID searchGiftsForResale::attributes_fieldID;
jfieldID searchGiftsForResale::offset_fieldID;
jfieldID searchGiftsForResale::limit_fieldID;

searchGiftsForResale::searchGiftsForResale()
  : gift_id_()
  , order_()
  , for_crafting_()
  , for_stars_()
  , attributes_()
  , offset_()
  , limit_()
{}

searchGiftsForResale::searchGiftsForResale(int64 gift_id_, object_ptr<GiftForResaleOrder> &&order_, bool for_crafting_, bool for_stars_, array<object_ptr<UpgradedGiftAttributeId>> &&attributes_, string const &offset_, int32 limit_)
  : gift_id_(gift_id_)
  , order_(std::move(order_))
  , for_crafting_(for_crafting_)
  , for_stars_(for_stars_)
  , attributes_(std::move(attributes_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchGiftsForResale::ID;

object_ptr<searchGiftsForResale> searchGiftsForResale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchGiftsForResale> res = make_object<searchGiftsForResale>();
  res->gift_id_ = env->GetLongField(p, res->gift_id_fieldID);
  res->order_ = jni::fetch_tl_object<GiftForResaleOrder>(env, jni::fetch_object(env, p, res->order_fieldID));
  res->for_crafting_ = (env->GetBooleanField(p, res->for_crafting_fieldID) != 0);
  res->for_stars_ = (env->GetBooleanField(p, res->for_stars_fieldID) != 0);
  res->attributes_ = jni::FetchVector<UpgradedGiftAttributeId>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->attributes_fieldID));
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchGiftsForResale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchGiftsForResale");
    s.store_field("giftId", gift_id_);
    s.store_object_field("order", static_cast<const BaseObject *>(order_.get()));
    s.store_field("forCrafting", for_crafting_);
    s.store_field("forStars", for_stars_);
    { s.store_vector_begin("attributes", attributes_.size()); for (const auto &_value : attributes_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchGiftsForResale::ReturnType searchGiftsForResale::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftsForResale::fetch(env, p);
}

void searchGiftsForResale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchGiftsForResale").c_str());
    gift_id_fieldID = jni::get_field_id(env, Class, "giftId", "J");
    order_fieldID = jni::get_field_id(env, Class, "order", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftForResaleOrder;").c_str());
    for_crafting_fieldID = jni::get_field_id(env, Class, "forCrafting", "Z");
    for_stars_fieldID = jni::get_field_id(env, Class, "forStars", "Z");
    attributes_fieldID = jni::get_field_id(env, Class, "attributes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftAttributeId;").c_str());
    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 searchPublicMessagesByTag::Class;
jfieldID searchPublicMessagesByTag::tag_fieldID;
jfieldID searchPublicMessagesByTag::offset_fieldID;
jfieldID searchPublicMessagesByTag::limit_fieldID;

searchPublicMessagesByTag::searchPublicMessagesByTag()
  : tag_()
  , offset_()
  , limit_()
{}

searchPublicMessagesByTag::searchPublicMessagesByTag(string const &tag_, string const &offset_, int32 limit_)
  : tag_(tag_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchPublicMessagesByTag::ID;

object_ptr<searchPublicMessagesByTag> searchPublicMessagesByTag::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchPublicMessagesByTag> res = make_object<searchPublicMessagesByTag>();
  res->tag_ = jni::fetch_string(env, p, res->tag_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchPublicMessagesByTag::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchPublicMessagesByTag");
    s.store_field("tag", tag_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchPublicMessagesByTag::ReturnType searchPublicMessagesByTag::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundMessages::fetch(env, p);
}

void searchPublicMessagesByTag::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchPublicMessagesByTag").c_str());
    tag_fieldID = jni::get_field_id(env, Class, "tag", "Ljava/lang/String;");
    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 searchWebApp::Class;
jfieldID searchWebApp::bot_user_id_fieldID;
jfieldID searchWebApp::web_app_short_name_fieldID;

searchWebApp::searchWebApp()
  : bot_user_id_()
  , web_app_short_name_()
{}

searchWebApp::searchWebApp(int53 bot_user_id_, string const &web_app_short_name_)
  : bot_user_id_(bot_user_id_)
  , web_app_short_name_(web_app_short_name_)
{}

const std::int32_t searchWebApp::ID;

object_ptr<searchWebApp> searchWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchWebApp> res = make_object<searchWebApp>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->web_app_short_name_ = jni::fetch_string(env, p, res->web_app_short_name_fieldID);
  return res;
}

void searchWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchWebApp");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("webAppShortName", web_app_short_name_);
    s.store_class_end();
  }
}

searchWebApp::ReturnType searchWebApp::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundWebApp::fetch(env, p);
}

void searchWebApp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchWebApp").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    web_app_short_name_fieldID = jni::get_field_id(env, Class, "webAppShortName", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass sendAuthenticationFirebaseSms::Class;
jfieldID sendAuthenticationFirebaseSms::token_fieldID;

sendAuthenticationFirebaseSms::sendAuthenticationFirebaseSms()
  : token_()
{}

sendAuthenticationFirebaseSms::sendAuthenticationFirebaseSms(string const &token_)
  : token_(token_)
{}

const std::int32_t sendAuthenticationFirebaseSms::ID;

object_ptr<sendAuthenticationFirebaseSms> sendAuthenticationFirebaseSms::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendAuthenticationFirebaseSms> res = make_object<sendAuthenticationFirebaseSms>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return res;
}

void sendAuthenticationFirebaseSms::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendAuthenticationFirebaseSms");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

sendAuthenticationFirebaseSms::ReturnType sendAuthenticationFirebaseSms::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass sendCallDebugInformation::Class;
jfieldID sendCallDebugInformation::call_id_fieldID;
jfieldID sendCallDebugInformation::debug_information_fieldID;

sendCallDebugInformation::sendCallDebugInformation()
  : call_id_()
  , debug_information_()
{}

sendCallDebugInformation::sendCallDebugInformation(object_ptr<InputCall> &&call_id_, string const &debug_information_)
  : call_id_(std::move(call_id_))
  , debug_information_(debug_information_)
{}

const std::int32_t sendCallDebugInformation::ID;

object_ptr<sendCallDebugInformation> sendCallDebugInformation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendCallDebugInformation> res = make_object<sendCallDebugInformation>();
  res->call_id_ = jni::fetch_tl_object<InputCall>(env, jni::fetch_object(env, p, res->call_id_fieldID));
  res->debug_information_ = jni::fetch_string(env, p, res->debug_information_fieldID);
  return res;
}

void sendCallDebugInformation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendCallDebugInformation");
    s.store_object_field("callId", static_cast<const BaseObject *>(call_id_.get()));
    s.store_field("debugInformation", debug_information_);
    s.store_class_end();
  }
}

sendCallDebugInformation::ReturnType sendCallDebugInformation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendCallDebugInformation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendCallDebugInformation").c_str());
    call_id_fieldID = jni::get_field_id(env, Class, "callId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputCall;").c_str());
    debug_information_fieldID = jni::get_field_id(env, Class, "debugInformation", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass sendMessage::Class;
jfieldID sendMessage::chat_id_fieldID;
jfieldID sendMessage::topic_id_fieldID;
jfieldID sendMessage::reply_to_fieldID;
jfieldID sendMessage::options_fieldID;
jfieldID sendMessage::reply_markup_fieldID;
jfieldID sendMessage::input_message_content_fieldID;

sendMessage::sendMessage()
  : chat_id_()
  , topic_id_()
  , reply_to_()
  , options_()
  , reply_markup_()
  , input_message_content_()
{}

sendMessage::sendMessage(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<InputMessageReplyTo> &&reply_to_, object_ptr<messageSendOptions> &&options_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , reply_to_(std::move(reply_to_))
  , options_(std::move(options_))
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t sendMessage::ID;

object_ptr<sendMessage> sendMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendMessage> res = make_object<sendMessage>();
  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->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 sendMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendMessage");
    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_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();
  }
}

sendMessage::ReturnType sendMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void sendMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendMessage").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());
    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 sendPhoneNumberCode::Class;
jfieldID sendPhoneNumberCode::phone_number_fieldID;
jfieldID sendPhoneNumberCode::settings_fieldID;
jfieldID sendPhoneNumberCode::type_fieldID;

sendPhoneNumberCode::sendPhoneNumberCode()
  : phone_number_()
  , settings_()
  , type_()
{}

sendPhoneNumberCode::sendPhoneNumberCode(string const &phone_number_, object_ptr<phoneNumberAuthenticationSettings> &&settings_, object_ptr<PhoneNumberCodeType> &&type_)
  : phone_number_(phone_number_)
  , settings_(std::move(settings_))
  , type_(std::move(type_))
{}

const std::int32_t sendPhoneNumberCode::ID;

object_ptr<sendPhoneNumberCode> sendPhoneNumberCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendPhoneNumberCode> res = make_object<sendPhoneNumberCode>();
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->settings_ = jni::fetch_tl_object<phoneNumberAuthenticationSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  res->type_ = jni::fetch_tl_object<PhoneNumberCodeType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void sendPhoneNumberCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendPhoneNumberCode");
    s.store_field("phoneNumber", phone_number_);
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

sendPhoneNumberCode::ReturnType sendPhoneNumberCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return authenticationCodeInfo::fetch(env, p);
}

void sendPhoneNumberCode::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendPhoneNumberCode").c_str());
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    settings_fieldID = jni::get_field_id(env, Class, "settings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PhoneNumberAuthenticationSettings;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PhoneNumberCodeType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setAuthenticationPremiumPurchaseTransaction::Class;
jfieldID setAuthenticationPremiumPurchaseTransaction::transaction_fieldID;
jfieldID setAuthenticationPremiumPurchaseTransaction::is_restore_fieldID;
jfieldID setAuthenticationPremiumPurchaseTransaction::premium_day_count_fieldID;
jfieldID setAuthenticationPremiumPurchaseTransaction::currency_fieldID;
jfieldID setAuthenticationPremiumPurchaseTransaction::amount_fieldID;

setAuthenticationPremiumPurchaseTransaction::setAuthenticationPremiumPurchaseTransaction()
  : transaction_()
  , is_restore_()
  , premium_day_count_()
  , currency_()
  , amount_()
{}

setAuthenticationPremiumPurchaseTransaction::setAuthenticationPremiumPurchaseTransaction(object_ptr<StoreTransaction> &&transaction_, bool is_restore_, int32 premium_day_count_, string const &currency_, int53 amount_)
  : transaction_(std::move(transaction_))
  , is_restore_(is_restore_)
  , premium_day_count_(premium_day_count_)
  , currency_(currency_)
  , amount_(amount_)
{}

const std::int32_t setAuthenticationPremiumPurchaseTransaction::ID;

object_ptr<setAuthenticationPremiumPurchaseTransaction> setAuthenticationPremiumPurchaseTransaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAuthenticationPremiumPurchaseTransaction> res = make_object<setAuthenticationPremiumPurchaseTransaction>();
  res->transaction_ = jni::fetch_tl_object<StoreTransaction>(env, jni::fetch_object(env, p, res->transaction_fieldID));
  res->is_restore_ = (env->GetBooleanField(p, res->is_restore_fieldID) != 0);
  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 setAuthenticationPremiumPurchaseTransaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetAuthenticationPremiumPurchaseTransaction");
    s.store_object_field("transaction", static_cast<const BaseObject *>(transaction_.get()));
    s.store_field("isRestore", is_restore_);
    s.store_field("premiumDayCount", premium_day_count_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_class_end();
  }
}

setAuthenticationPremiumPurchaseTransaction::ReturnType setAuthenticationPremiumPurchaseTransaction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setAuthenticationPremiumPurchaseTransaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetAuthenticationPremiumPurchaseTransaction").c_str());
    transaction_fieldID = jni::get_field_id(env, Class, "transaction", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoreTransaction;").c_str());
    is_restore_fieldID = jni::get_field_id(env, Class, "isRestore", "Z");
    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 setBotProfilePhoto::Class;
jfieldID setBotProfilePhoto::bot_user_id_fieldID;
jfieldID setBotProfilePhoto::photo_fieldID;

setBotProfilePhoto::setBotProfilePhoto()
  : bot_user_id_()
  , photo_()
{}

setBotProfilePhoto::setBotProfilePhoto(int53 bot_user_id_, object_ptr<InputChatPhoto> &&photo_)
  : bot_user_id_(bot_user_id_)
  , photo_(std::move(photo_))
{}

const std::int32_t setBotProfilePhoto::ID;

object_ptr<setBotProfilePhoto> setBotProfilePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBotProfilePhoto> res = make_object<setBotProfilePhoto>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->photo_ = jni::fetch_tl_object<InputChatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return res;
}

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

setBotProfilePhoto::ReturnType setBotProfilePhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBotUpdatesStatus::Class;
jfieldID setBotUpdatesStatus::pending_update_count_fieldID;
jfieldID setBotUpdatesStatus::error_message_fieldID;

setBotUpdatesStatus::setBotUpdatesStatus()
  : pending_update_count_()
  , error_message_()
{}

setBotUpdatesStatus::setBotUpdatesStatus(int32 pending_update_count_, string const &error_message_)
  : pending_update_count_(pending_update_count_)
  , error_message_(error_message_)
{}

const std::int32_t setBotUpdatesStatus::ID;

object_ptr<setBotUpdatesStatus> setBotUpdatesStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBotUpdatesStatus> res = make_object<setBotUpdatesStatus>();
  res->pending_update_count_ = env->GetIntField(p, res->pending_update_count_fieldID);
  res->error_message_ = jni::fetch_string(env, p, res->error_message_fieldID);
  return res;
}

void setBotUpdatesStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBotUpdatesStatus");
    s.store_field("pendingUpdateCount", pending_update_count_);
    s.store_field("errorMessage", error_message_);
    s.store_class_end();
  }
}

setBotUpdatesStatus::ReturnType setBotUpdatesStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBotUpdatesStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBotUpdatesStatus").c_str());
    pending_update_count_fieldID = jni::get_field_id(env, Class, "pendingUpdateCount", "I");
    error_message_fieldID = jni::get_field_id(env, Class, "errorMessage", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessAccountBio::Class;
jfieldID setBusinessAccountBio::business_connection_id_fieldID;
jfieldID setBusinessAccountBio::bio_fieldID;

setBusinessAccountBio::setBusinessAccountBio()
  : business_connection_id_()
  , bio_()
{}

setBusinessAccountBio::setBusinessAccountBio(string const &business_connection_id_, string const &bio_)
  : business_connection_id_(business_connection_id_)
  , bio_(bio_)
{}

const std::int32_t setBusinessAccountBio::ID;

object_ptr<setBusinessAccountBio> setBusinessAccountBio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessAccountBio> res = make_object<setBusinessAccountBio>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->bio_ = jni::fetch_string(env, p, res->bio_fieldID);
  return res;
}

void setBusinessAccountBio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessAccountBio");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("bio", bio_);
    s.store_class_end();
  }
}

setBusinessAccountBio::ReturnType setBusinessAccountBio::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBusinessAccountBio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBusinessAccountBio").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    bio_fieldID = jni::get_field_id(env, Class, "bio", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setChatAccentColor::Class;
jfieldID setChatAccentColor::chat_id_fieldID;
jfieldID setChatAccentColor::accent_color_id_fieldID;
jfieldID setChatAccentColor::background_custom_emoji_id_fieldID;

setChatAccentColor::setChatAccentColor()
  : chat_id_()
  , accent_color_id_()
  , background_custom_emoji_id_()
{}

setChatAccentColor::setChatAccentColor(int53 chat_id_, int32 accent_color_id_, int64 background_custom_emoji_id_)
  : chat_id_(chat_id_)
  , accent_color_id_(accent_color_id_)
  , background_custom_emoji_id_(background_custom_emoji_id_)
{}

const std::int32_t setChatAccentColor::ID;

object_ptr<setChatAccentColor> setChatAccentColor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatAccentColor> res = make_object<setChatAccentColor>();
  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);
  return res;
}

void setChatAccentColor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatAccentColor");
    s.store_field("chatId", chat_id_);
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("backgroundCustomEmojiId", background_custom_emoji_id_);
    s.store_class_end();
  }
}

setChatAccentColor::ReturnType setChatAccentColor::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatAccentColor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatAccentColor").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");
    return true;
  }();
  (void)is_inited;
}

jclass setChatClientData::Class;
jfieldID setChatClientData::chat_id_fieldID;
jfieldID setChatClientData::client_data_fieldID;

setChatClientData::setChatClientData()
  : chat_id_()
  , client_data_()
{}

setChatClientData::setChatClientData(int53 chat_id_, string const &client_data_)
  : chat_id_(chat_id_)
  , client_data_(client_data_)
{}

const std::int32_t setChatClientData::ID;

object_ptr<setChatClientData> setChatClientData::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatClientData> res = make_object<setChatClientData>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->client_data_ = jni::fetch_string(env, p, res->client_data_fieldID);
  return res;
}

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

setChatClientData::ReturnType setChatClientData::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatDraftMessage::Class;
jfieldID setChatDraftMessage::chat_id_fieldID;
jfieldID setChatDraftMessage::topic_id_fieldID;
jfieldID setChatDraftMessage::draft_message_fieldID;

setChatDraftMessage::setChatDraftMessage()
  : chat_id_()
  , topic_id_()
  , draft_message_()
{}

setChatDraftMessage::setChatDraftMessage(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<draftMessage> &&draft_message_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , draft_message_(std::move(draft_message_))
{}

const std::int32_t setChatDraftMessage::ID;

object_ptr<setChatDraftMessage> setChatDraftMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatDraftMessage> res = make_object<setChatDraftMessage>();
  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->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  return res;
}

void setChatDraftMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatDraftMessage");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_class_end();
  }
}

setChatDraftMessage::ReturnType setChatDraftMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatDraftMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatDraftMessage").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());
    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 setChatLocation::Class;
jfieldID setChatLocation::chat_id_fieldID;
jfieldID setChatLocation::location_fieldID;

setChatLocation::setChatLocation()
  : chat_id_()
  , location_()
{}

setChatLocation::setChatLocation(int53 chat_id_, object_ptr<chatLocation> &&location_)
  : chat_id_(chat_id_)
  , location_(std::move(location_))
{}

const std::int32_t setChatLocation::ID;

object_ptr<setChatLocation> setChatLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatLocation> res = make_object<setChatLocation>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->location_ = jni::fetch_tl_object<chatLocation>(env, jni::fetch_object(env, p, res->location_fieldID));
  return res;
}

void setChatLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatLocation");
    s.store_field("chatId", chat_id_);
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_class_end();
  }
}

setChatLocation::ReturnType setChatLocation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatMemberStatus::Class;
jfieldID setChatMemberStatus::chat_id_fieldID;
jfieldID setChatMemberStatus::member_id_fieldID;
jfieldID setChatMemberStatus::status_fieldID;

setChatMemberStatus::setChatMemberStatus()
  : chat_id_()
  , member_id_()
  , status_()
{}

setChatMemberStatus::setChatMemberStatus(int53 chat_id_, object_ptr<MessageSender> &&member_id_, object_ptr<ChatMemberStatus> &&status_)
  : chat_id_(chat_id_)
  , member_id_(std::move(member_id_))
  , status_(std::move(status_))
{}

const std::int32_t setChatMemberStatus::ID;

object_ptr<setChatMemberStatus> setChatMemberStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatMemberStatus> res = make_object<setChatMemberStatus>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->member_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->member_id_fieldID));
  res->status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  return res;
}

void setChatMemberStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatMemberStatus");
    s.store_field("chatId", chat_id_);
    s.store_object_field("memberId", static_cast<const BaseObject *>(member_id_.get()));
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_class_end();
  }
}

setChatMemberStatus::ReturnType setChatMemberStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatMemberStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatMemberStatus").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    member_id_fieldID = jni::get_field_id(env, Class, "memberId", (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$ChatMemberStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setChatTitle::Class;
jfieldID setChatTitle::chat_id_fieldID;
jfieldID setChatTitle::title_fieldID;

setChatTitle::setChatTitle()
  : chat_id_()
  , title_()
{}

setChatTitle::setChatTitle(int53 chat_id_, string const &title_)
  : chat_id_(chat_id_)
  , title_(title_)
{}

const std::int32_t setChatTitle::ID;

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

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

setChatTitle::ReturnType setChatTitle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatTitle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatTitle").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 setEmojiStatus::Class;
jfieldID setEmojiStatus::emoji_status_fieldID;

setEmojiStatus::setEmojiStatus()
  : emoji_status_()
{}

setEmojiStatus::setEmojiStatus(object_ptr<emojiStatus> &&emoji_status_)
  : emoji_status_(std::move(emoji_status_))
{}

const std::int32_t setEmojiStatus::ID;

object_ptr<setEmojiStatus> setEmojiStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setEmojiStatus> res = make_object<setEmojiStatus>();
  res->emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->emoji_status_fieldID));
  return res;
}

void setEmojiStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetEmojiStatus");
    s.store_object_field("emojiStatus", static_cast<const BaseObject *>(emoji_status_.get()));
    s.store_class_end();
  }
}

setEmojiStatus::ReturnType setEmojiStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setEmojiStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetEmojiStatus").c_str());
    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 setGiftCollectionName::Class;
jfieldID setGiftCollectionName::owner_id_fieldID;
jfieldID setGiftCollectionName::collection_id_fieldID;
jfieldID setGiftCollectionName::name_fieldID;

setGiftCollectionName::setGiftCollectionName()
  : owner_id_()
  , collection_id_()
  , name_()
{}

setGiftCollectionName::setGiftCollectionName(object_ptr<MessageSender> &&owner_id_, int32 collection_id_, string const &name_)
  : owner_id_(std::move(owner_id_))
  , collection_id_(collection_id_)
  , name_(name_)
{}

const std::int32_t setGiftCollectionName::ID;

object_ptr<setGiftCollectionName> setGiftCollectionName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setGiftCollectionName> res = make_object<setGiftCollectionName>();
  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->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void setGiftCollectionName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetGiftCollectionName");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("collectionId", collection_id_);
    s.store_field("name", name_);
    s.store_class_end();
  }
}

setGiftCollectionName::ReturnType setGiftCollectionName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftCollection::fetch(env, p);
}

void setGiftCollectionName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetGiftCollectionName").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");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setName::Class;
jfieldID setName::first_name_fieldID;
jfieldID setName::last_name_fieldID;

setName::setName()
  : first_name_()
  , last_name_()
{}

setName::setName(string const &first_name_, string const &last_name_)
  : first_name_(first_name_)
  , last_name_(last_name_)
{}

const std::int32_t setName::ID;

object_ptr<setName> setName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setName> res = make_object<setName>();
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  return res;
}

void setName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetName");
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_class_end();
  }
}

setName::ReturnType setName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetName").c_str());
    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;");
    return true;
  }();
  (void)is_inited;
}

jclass setPersonalChat::Class;
jfieldID setPersonalChat::chat_id_fieldID;

setPersonalChat::setPersonalChat()
  : chat_id_()
{}

setPersonalChat::setPersonalChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t setPersonalChat::ID;

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

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

setPersonalChat::ReturnType setPersonalChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setQuickReplyShortcutName::Class;
jfieldID setQuickReplyShortcutName::shortcut_id_fieldID;
jfieldID setQuickReplyShortcutName::name_fieldID;

setQuickReplyShortcutName::setQuickReplyShortcutName()
  : shortcut_id_()
  , name_()
{}

setQuickReplyShortcutName::setQuickReplyShortcutName(int32 shortcut_id_, string const &name_)
  : shortcut_id_(shortcut_id_)
  , name_(name_)
{}

const std::int32_t setQuickReplyShortcutName::ID;

object_ptr<setQuickReplyShortcutName> setQuickReplyShortcutName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setQuickReplyShortcutName> res = make_object<setQuickReplyShortcutName>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void setQuickReplyShortcutName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetQuickReplyShortcutName");
    s.store_field("shortcutId", shortcut_id_);
    s.store_field("name", name_);
    s.store_class_end();
  }
}

setQuickReplyShortcutName::ReturnType setQuickReplyShortcutName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setQuickReplyShortcutName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetQuickReplyShortcutName").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setRecoveryEmailAddress::Class;
jfieldID setRecoveryEmailAddress::password_fieldID;
jfieldID setRecoveryEmailAddress::new_recovery_email_address_fieldID;

setRecoveryEmailAddress::setRecoveryEmailAddress()
  : password_()
  , new_recovery_email_address_()
{}

setRecoveryEmailAddress::setRecoveryEmailAddress(string const &password_, string const &new_recovery_email_address_)
  : password_(password_)
  , new_recovery_email_address_(new_recovery_email_address_)
{}

const std::int32_t setRecoveryEmailAddress::ID;

object_ptr<setRecoveryEmailAddress> setRecoveryEmailAddress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setRecoveryEmailAddress> res = make_object<setRecoveryEmailAddress>();
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  res->new_recovery_email_address_ = jni::fetch_string(env, p, res->new_recovery_email_address_fieldID);
  return res;
}

void setRecoveryEmailAddress::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetRecoveryEmailAddress");
    s.store_field("password", password_);
    s.store_field("newRecoveryEmailAddress", new_recovery_email_address_);
    s.store_class_end();
  }
}

setRecoveryEmailAddress::ReturnType setRecoveryEmailAddress::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

void setRecoveryEmailAddress::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetRecoveryEmailAddress").c_str());
    password_fieldID = jni::get_field_id(env, Class, "password", "Ljava/lang/String;");
    new_recovery_email_address_fieldID = jni::get_field_id(env, Class, "newRecoveryEmailAddress", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setStoryAlbumName::Class;
jfieldID setStoryAlbumName::chat_id_fieldID;
jfieldID setStoryAlbumName::story_album_id_fieldID;
jfieldID setStoryAlbumName::name_fieldID;

setStoryAlbumName::setStoryAlbumName()
  : chat_id_()
  , story_album_id_()
  , name_()
{}

setStoryAlbumName::setStoryAlbumName(int53 chat_id_, int32 story_album_id_, string const &name_)
  : chat_id_(chat_id_)
  , story_album_id_(story_album_id_)
  , name_(name_)
{}

const std::int32_t setStoryAlbumName::ID;

object_ptr<setStoryAlbumName> setStoryAlbumName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setStoryAlbumName> res = make_object<setStoryAlbumName>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_album_id_ = env->GetIntField(p, res->story_album_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void setStoryAlbumName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetStoryAlbumName");
    s.store_field("chatId", chat_id_);
    s.store_field("storyAlbumId", story_album_id_);
    s.store_field("name", name_);
    s.store_class_end();
  }
}

setStoryAlbumName::ReturnType setStoryAlbumName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyAlbum::fetch(env, p);
}

void setStoryAlbumName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetStoryAlbumName").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");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setSupergroupMainProfileTab::Class;
jfieldID setSupergroupMainProfileTab::supergroup_id_fieldID;
jfieldID setSupergroupMainProfileTab::main_profile_tab_fieldID;

setSupergroupMainProfileTab::setSupergroupMainProfileTab()
  : supergroup_id_()
  , main_profile_tab_()
{}

setSupergroupMainProfileTab::setSupergroupMainProfileTab(int53 supergroup_id_, object_ptr<ProfileTab> &&main_profile_tab_)
  : supergroup_id_(supergroup_id_)
  , main_profile_tab_(std::move(main_profile_tab_))
{}

const std::int32_t setSupergroupMainProfileTab::ID;

object_ptr<setSupergroupMainProfileTab> setSupergroupMainProfileTab::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setSupergroupMainProfileTab> res = make_object<setSupergroupMainProfileTab>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->main_profile_tab_ = jni::fetch_tl_object<ProfileTab>(env, jni::fetch_object(env, p, res->main_profile_tab_fieldID));
  return res;
}

void setSupergroupMainProfileTab::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetSupergroupMainProfileTab");
    s.store_field("supergroupId", supergroup_id_);
    s.store_object_field("mainProfileTab", static_cast<const BaseObject *>(main_profile_tab_.get()));
    s.store_class_end();
  }
}

setSupergroupMainProfileTab::ReturnType setSupergroupMainProfileTab::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setSupergroupMainProfileTab::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetSupergroupMainProfileTab").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    main_profile_tab_fieldID = jni::get_field_id(env, Class, "mainProfileTab", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProfileTab;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setSupergroupUnrestrictBoostCount::Class;
jfieldID setSupergroupUnrestrictBoostCount::supergroup_id_fieldID;
jfieldID setSupergroupUnrestrictBoostCount::unrestrict_boost_count_fieldID;

setSupergroupUnrestrictBoostCount::setSupergroupUnrestrictBoostCount()
  : supergroup_id_()
  , unrestrict_boost_count_()
{}

setSupergroupUnrestrictBoostCount::setSupergroupUnrestrictBoostCount(int53 supergroup_id_, int32 unrestrict_boost_count_)
  : supergroup_id_(supergroup_id_)
  , unrestrict_boost_count_(unrestrict_boost_count_)
{}

const std::int32_t setSupergroupUnrestrictBoostCount::ID;

object_ptr<setSupergroupUnrestrictBoostCount> setSupergroupUnrestrictBoostCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setSupergroupUnrestrictBoostCount> res = make_object<setSupergroupUnrestrictBoostCount>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->unrestrict_boost_count_ = env->GetIntField(p, res->unrestrict_boost_count_fieldID);
  return res;
}

void setSupergroupUnrestrictBoostCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetSupergroupUnrestrictBoostCount");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("unrestrictBoostCount", unrestrict_boost_count_);
    s.store_class_end();
  }
}

setSupergroupUnrestrictBoostCount::ReturnType setSupergroupUnrestrictBoostCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setSupergroupUnrestrictBoostCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetSupergroupUnrestrictBoostCount").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    unrestrict_boost_count_fieldID = jni::get_field_id(env, Class, "unrestrictBoostCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass sharePhoneNumber::Class;
jfieldID sharePhoneNumber::user_id_fieldID;

sharePhoneNumber::sharePhoneNumber()
  : user_id_()
{}

sharePhoneNumber::sharePhoneNumber(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t sharePhoneNumber::ID;

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

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

sharePhoneNumber::ReturnType sharePhoneNumber::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass stopBusinessPoll::Class;
jfieldID stopBusinessPoll::business_connection_id_fieldID;
jfieldID stopBusinessPoll::chat_id_fieldID;
jfieldID stopBusinessPoll::message_id_fieldID;
jfieldID stopBusinessPoll::reply_markup_fieldID;

stopBusinessPoll::stopBusinessPoll()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
{}

stopBusinessPoll::stopBusinessPoll(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t stopBusinessPoll::ID;

object_ptr<stopBusinessPoll> stopBusinessPoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stopBusinessPoll> res = make_object<stopBusinessPoll>();
  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));
  return res;
}

void stopBusinessPoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StopBusinessPoll");
    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_class_end();
  }
}

stopBusinessPoll::ReturnType stopBusinessPoll::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void stopBusinessPoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StopBusinessPoll").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());
    return true;
  }();
  (void)is_inited;
}

jclass toggleGeneralForumTopicIsHidden::Class;
jfieldID toggleGeneralForumTopicIsHidden::chat_id_fieldID;
jfieldID toggleGeneralForumTopicIsHidden::is_hidden_fieldID;

toggleGeneralForumTopicIsHidden::toggleGeneralForumTopicIsHidden()
  : chat_id_()
  , is_hidden_()
{}

toggleGeneralForumTopicIsHidden::toggleGeneralForumTopicIsHidden(int53 chat_id_, bool is_hidden_)
  : chat_id_(chat_id_)
  , is_hidden_(is_hidden_)
{}

const std::int32_t toggleGeneralForumTopicIsHidden::ID;

object_ptr<toggleGeneralForumTopicIsHidden> toggleGeneralForumTopicIsHidden::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGeneralForumTopicIsHidden> res = make_object<toggleGeneralForumTopicIsHidden>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_hidden_ = (env->GetBooleanField(p, res->is_hidden_fieldID) != 0);
  return res;
}

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

toggleGeneralForumTopicIsHidden::ReturnType toggleGeneralForumTopicIsHidden::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleGiftIsSaved::Class;
jfieldID toggleGiftIsSaved::received_gift_id_fieldID;
jfieldID toggleGiftIsSaved::is_saved_fieldID;

toggleGiftIsSaved::toggleGiftIsSaved()
  : received_gift_id_()
  , is_saved_()
{}

toggleGiftIsSaved::toggleGiftIsSaved(string const &received_gift_id_, bool is_saved_)
  : received_gift_id_(received_gift_id_)
  , is_saved_(is_saved_)
{}

const std::int32_t toggleGiftIsSaved::ID;

object_ptr<toggleGiftIsSaved> toggleGiftIsSaved::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGiftIsSaved> res = make_object<toggleGiftIsSaved>();
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->is_saved_ = (env->GetBooleanField(p, res->is_saved_fieldID) != 0);
  return res;
}

void toggleGiftIsSaved::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleGiftIsSaved");
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_field("isSaved", is_saved_);
    s.store_class_end();
  }
}

toggleGiftIsSaved::ReturnType toggleGiftIsSaved::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleGiftIsSaved::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleGiftIsSaved").c_str());
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    is_saved_fieldID = jni::get_field_id(env, Class, "isSaved", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleGroupCallIsMyVideoPaused::Class;
jfieldID toggleGroupCallIsMyVideoPaused::group_call_id_fieldID;
jfieldID toggleGroupCallIsMyVideoPaused::is_my_video_paused_fieldID;

toggleGroupCallIsMyVideoPaused::toggleGroupCallIsMyVideoPaused()
  : group_call_id_()
  , is_my_video_paused_()
{}

toggleGroupCallIsMyVideoPaused::toggleGroupCallIsMyVideoPaused(int32 group_call_id_, bool is_my_video_paused_)
  : group_call_id_(group_call_id_)
  , is_my_video_paused_(is_my_video_paused_)
{}

const std::int32_t toggleGroupCallIsMyVideoPaused::ID;

object_ptr<toggleGroupCallIsMyVideoPaused> toggleGroupCallIsMyVideoPaused::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGroupCallIsMyVideoPaused> res = make_object<toggleGroupCallIsMyVideoPaused>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->is_my_video_paused_ = (env->GetBooleanField(p, res->is_my_video_paused_fieldID) != 0);
  return res;
}

void toggleGroupCallIsMyVideoPaused::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleGroupCallIsMyVideoPaused");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("isMyVideoPaused", is_my_video_paused_);
    s.store_class_end();
  }
}

toggleGroupCallIsMyVideoPaused::ReturnType toggleGroupCallIsMyVideoPaused::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleGroupCallIsMyVideoPaused::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleGroupCallIsMyVideoPaused").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    is_my_video_paused_fieldID = jni::get_field_id(env, Class, "isMyVideoPaused", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleGroupCallParticipantIsMuted::Class;
jfieldID toggleGroupCallParticipantIsMuted::group_call_id_fieldID;
jfieldID toggleGroupCallParticipantIsMuted::participant_id_fieldID;
jfieldID toggleGroupCallParticipantIsMuted::is_muted_fieldID;

toggleGroupCallParticipantIsMuted::toggleGroupCallParticipantIsMuted()
  : group_call_id_()
  , participant_id_()
  , is_muted_()
{}

toggleGroupCallParticipantIsMuted::toggleGroupCallParticipantIsMuted(int32 group_call_id_, object_ptr<MessageSender> &&participant_id_, bool is_muted_)
  : group_call_id_(group_call_id_)
  , participant_id_(std::move(participant_id_))
  , is_muted_(is_muted_)
{}

const std::int32_t toggleGroupCallParticipantIsMuted::ID;

object_ptr<toggleGroupCallParticipantIsMuted> toggleGroupCallParticipantIsMuted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGroupCallParticipantIsMuted> res = make_object<toggleGroupCallParticipantIsMuted>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->is_muted_ = (env->GetBooleanField(p, res->is_muted_fieldID) != 0);
  return res;
}

void toggleGroupCallParticipantIsMuted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleGroupCallParticipantIsMuted");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_field("isMuted", is_muted_);
    s.store_class_end();
  }
}

toggleGroupCallParticipantIsMuted::ReturnType toggleGroupCallParticipantIsMuted::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleGroupCallParticipantIsMuted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleGroupCallParticipantIsMuted").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_muted_fieldID = jni::get_field_id(env, Class, "isMuted", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass unpinAllChatMessages::Class;
jfieldID unpinAllChatMessages::chat_id_fieldID;

unpinAllChatMessages::unpinAllChatMessages()
  : chat_id_()
{}

unpinAllChatMessages::unpinAllChatMessages(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t unpinAllChatMessages::ID;

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

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

unpinAllChatMessages::ReturnType unpinAllChatMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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