#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 advertisementSponsor::Class;
jfieldID advertisementSponsor::url_fieldID;
jfieldID advertisementSponsor::photo_fieldID;
jfieldID advertisementSponsor::info_fieldID;

advertisementSponsor::advertisementSponsor()
  : url_()
  , photo_()
  , info_()
{}

advertisementSponsor::advertisementSponsor(string const &url_, object_ptr<photo> &&photo_, string const &info_)
  : url_(url_)
  , photo_(std::move(photo_))
  , info_(info_)
{}

const std::int32_t advertisementSponsor::ID;

object_ptr<advertisementSponsor> advertisementSponsor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<advertisementSponsor> res = make_object<advertisementSponsor>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->info_ = jni::fetch_string(env, p, res->info_fieldID);
  return res;
}

void advertisementSponsor::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 (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, info_); if (nextString) { env->SetObjectField(s, info_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void advertisementSponsor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AdvertisementSponsor");
    s.store_field("url", url_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("info", info_);
    s.store_class_end();
  }
}

void advertisementSponsor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AdvertisementSponsor").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    info_fieldID = jni::get_field_id(env, Class, "info", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass authenticationCodeInfo::Class;
jfieldID authenticationCodeInfo::phone_number_fieldID;
jfieldID authenticationCodeInfo::type_fieldID;
jfieldID authenticationCodeInfo::next_type_fieldID;
jfieldID authenticationCodeInfo::timeout_fieldID;

authenticationCodeInfo::authenticationCodeInfo()
  : phone_number_()
  , type_()
  , next_type_()
  , timeout_()
{}

authenticationCodeInfo::authenticationCodeInfo(string const &phone_number_, object_ptr<AuthenticationCodeType> &&type_, object_ptr<AuthenticationCodeType> &&next_type_, int32 timeout_)
  : phone_number_(phone_number_)
  , type_(std::move(type_))
  , next_type_(std::move(next_type_))
  , timeout_(timeout_)
{}

const std::int32_t authenticationCodeInfo::ID;

object_ptr<authenticationCodeInfo> authenticationCodeInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<authenticationCodeInfo> res = make_object<authenticationCodeInfo>();
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->type_ = jni::fetch_tl_object<AuthenticationCodeType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->next_type_ = jni::fetch_tl_object<AuthenticationCodeType>(env, jni::fetch_object(env, p, res->next_type_fieldID));
  res->timeout_ = env->GetIntField(p, res->timeout_fieldID);
  return res;
}

void authenticationCodeInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, phone_number_); if (nextString) { env->SetObjectField(s, phone_number_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); } }
  if (next_type_ != nullptr) { jobject next; next_type_->store(env, next); if (next) { env->SetObjectField(s, next_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, timeout_fieldID, timeout_);
}

void authenticationCodeInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AuthenticationCodeInfo");
    s.store_field("phoneNumber", phone_number_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_object_field("nextType", static_cast<const BaseObject *>(next_type_.get()));
    s.store_field("timeout", timeout_);
    s.store_class_end();
  }
}

void authenticationCodeInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AuthenticationCodeInfo").c_str());
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AuthenticationCodeType;").c_str());
    next_type_fieldID = jni::get_field_id(env, Class, "nextType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AuthenticationCodeType;").c_str());
    timeout_fieldID = jni::get_field_id(env, Class, "timeout", "I");
    return true;
  }();
  (void)is_inited;
}

jclass autoDownloadSettingsPresets::Class;
jfieldID autoDownloadSettingsPresets::low_fieldID;
jfieldID autoDownloadSettingsPresets::medium_fieldID;
jfieldID autoDownloadSettingsPresets::high_fieldID;

autoDownloadSettingsPresets::autoDownloadSettingsPresets()
  : low_()
  , medium_()
  , high_()
{}

autoDownloadSettingsPresets::autoDownloadSettingsPresets(object_ptr<autoDownloadSettings> &&low_, object_ptr<autoDownloadSettings> &&medium_, object_ptr<autoDownloadSettings> &&high_)
  : low_(std::move(low_))
  , medium_(std::move(medium_))
  , high_(std::move(high_))
{}

const std::int32_t autoDownloadSettingsPresets::ID;

object_ptr<autoDownloadSettingsPresets> autoDownloadSettingsPresets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<autoDownloadSettingsPresets> res = make_object<autoDownloadSettingsPresets>();
  res->low_ = jni::fetch_tl_object<autoDownloadSettings>(env, jni::fetch_object(env, p, res->low_fieldID));
  res->medium_ = jni::fetch_tl_object<autoDownloadSettings>(env, jni::fetch_object(env, p, res->medium_fieldID));
  res->high_ = jni::fetch_tl_object<autoDownloadSettings>(env, jni::fetch_object(env, p, res->high_fieldID));
  return res;
}

void autoDownloadSettingsPresets::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (low_ != nullptr) { jobject next; low_->store(env, next); if (next) { env->SetObjectField(s, low_fieldID, next); env->DeleteLocalRef(next); } }
  if (medium_ != nullptr) { jobject next; medium_->store(env, next); if (next) { env->SetObjectField(s, medium_fieldID, next); env->DeleteLocalRef(next); } }
  if (high_ != nullptr) { jobject next; high_->store(env, next); if (next) { env->SetObjectField(s, high_fieldID, next); env->DeleteLocalRef(next); } }
}

void autoDownloadSettingsPresets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AutoDownloadSettingsPresets");
    s.store_object_field("low", static_cast<const BaseObject *>(low_.get()));
    s.store_object_field("medium", static_cast<const BaseObject *>(medium_.get()));
    s.store_object_field("high", static_cast<const BaseObject *>(high_.get()));
    s.store_class_end();
  }
}

void autoDownloadSettingsPresets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AutoDownloadSettingsPresets").c_str());
    low_fieldID = jni::get_field_id(env, Class, "low", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AutoDownloadSettings;").c_str());
    medium_fieldID = jni::get_field_id(env, Class, "medium", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AutoDownloadSettings;").c_str());
    high_fieldID = jni::get_field_id(env, Class, "high", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AutoDownloadSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass autosaveSettings::Class;
jfieldID autosaveSettings::private_chat_settings_fieldID;
jfieldID autosaveSettings::group_settings_fieldID;
jfieldID autosaveSettings::channel_settings_fieldID;
jfieldID autosaveSettings::exceptions_fieldID;

autosaveSettings::autosaveSettings()
  : private_chat_settings_()
  , group_settings_()
  , channel_settings_()
  , exceptions_()
{}

autosaveSettings::autosaveSettings(object_ptr<scopeAutosaveSettings> &&private_chat_settings_, object_ptr<scopeAutosaveSettings> &&group_settings_, object_ptr<scopeAutosaveSettings> &&channel_settings_, array<object_ptr<autosaveSettingsException>> &&exceptions_)
  : private_chat_settings_(std::move(private_chat_settings_))
  , group_settings_(std::move(group_settings_))
  , channel_settings_(std::move(channel_settings_))
  , exceptions_(std::move(exceptions_))
{}

const std::int32_t autosaveSettings::ID;

object_ptr<autosaveSettings> autosaveSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<autosaveSettings> res = make_object<autosaveSettings>();
  res->private_chat_settings_ = jni::fetch_tl_object<scopeAutosaveSettings>(env, jni::fetch_object(env, p, res->private_chat_settings_fieldID));
  res->group_settings_ = jni::fetch_tl_object<scopeAutosaveSettings>(env, jni::fetch_object(env, p, res->group_settings_fieldID));
  res->channel_settings_ = jni::fetch_tl_object<scopeAutosaveSettings>(env, jni::fetch_object(env, p, res->channel_settings_fieldID));
  res->exceptions_ = jni::FetchVector<autosaveSettingsException>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->exceptions_fieldID));
  return res;
}

void autosaveSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (private_chat_settings_ != nullptr) { jobject next; private_chat_settings_->store(env, next); if (next) { env->SetObjectField(s, private_chat_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (group_settings_ != nullptr) { jobject next; group_settings_->store(env, next); if (next) { env->SetObjectField(s, group_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (channel_settings_ != nullptr) { jobject next; channel_settings_->store(env, next); if (next) { env->SetObjectField(s, channel_settings_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, exceptions_); if (arr_tmp_) { env->SetObjectField(s, exceptions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void autosaveSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AutosaveSettings");
    s.store_object_field("privateChatSettings", static_cast<const BaseObject *>(private_chat_settings_.get()));
    s.store_object_field("groupSettings", static_cast<const BaseObject *>(group_settings_.get()));
    s.store_object_field("channelSettings", static_cast<const BaseObject *>(channel_settings_.get()));
    { s.store_vector_begin("exceptions", exceptions_.size()); for (const auto &_value : exceptions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void autosaveSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AutosaveSettings").c_str());
    private_chat_settings_fieldID = jni::get_field_id(env, Class, "privateChatSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeAutosaveSettings;").c_str());
    group_settings_fieldID = jni::get_field_id(env, Class, "groupSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeAutosaveSettings;").c_str());
    channel_settings_fieldID = jni::get_field_id(env, Class, "channelSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeAutosaveSettings;").c_str());
    exceptions_fieldID = jni::get_field_id(env, Class, "exceptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AutosaveSettingsException;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass backgrounds::Class;
jfieldID backgrounds::backgrounds_fieldID;

backgrounds::backgrounds()
  : backgrounds_()
{}

backgrounds::backgrounds(array<object_ptr<background>> &&backgrounds_)
  : backgrounds_(std::move(backgrounds_))
{}

const std::int32_t backgrounds::ID;

object_ptr<backgrounds> backgrounds::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<backgrounds> res = make_object<backgrounds>();
  res->backgrounds_ = jni::FetchVector<background>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->backgrounds_fieldID));
  return res;
}

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

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

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

jclass botVerification::Class;
jfieldID botVerification::bot_user_id_fieldID;
jfieldID botVerification::icon_custom_emoji_id_fieldID;
jfieldID botVerification::custom_description_fieldID;

botVerification::botVerification()
  : bot_user_id_()
  , icon_custom_emoji_id_()
  , custom_description_()
{}

botVerification::botVerification(int53 bot_user_id_, int64 icon_custom_emoji_id_, object_ptr<formattedText> &&custom_description_)
  : bot_user_id_(bot_user_id_)
  , icon_custom_emoji_id_(icon_custom_emoji_id_)
  , custom_description_(std::move(custom_description_))
{}

const std::int32_t botVerification::ID;

object_ptr<botVerification> botVerification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botVerification> res = make_object<botVerification>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->icon_custom_emoji_id_ = env->GetLongField(p, res->icon_custom_emoji_id_fieldID);
  res->custom_description_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->custom_description_fieldID));
  return res;
}

void botVerification::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->SetLongField(s, icon_custom_emoji_id_fieldID, icon_custom_emoji_id_);
  if (custom_description_ != nullptr) { jobject next; custom_description_->store(env, next); if (next) { env->SetObjectField(s, custom_description_fieldID, next); env->DeleteLocalRef(next); } }
}

void botVerification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotVerification");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("iconCustomEmojiId", icon_custom_emoji_id_);
    s.store_object_field("customDescription", static_cast<const BaseObject *>(custom_description_.get()));
    s.store_class_end();
  }
}

void botVerification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotVerification").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "iconCustomEmojiId", "J");
    custom_description_fieldID = jni::get_field_id(env, Class, "customDescription", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass businessConnection::Class;
jfieldID businessConnection::id_fieldID;
jfieldID businessConnection::user_id_fieldID;
jfieldID businessConnection::user_chat_id_fieldID;
jfieldID businessConnection::date_fieldID;
jfieldID businessConnection::rights_fieldID;
jfieldID businessConnection::is_enabled_fieldID;

businessConnection::businessConnection()
  : id_()
  , user_id_()
  , user_chat_id_()
  , date_()
  , rights_()
  , is_enabled_()
{}

businessConnection::businessConnection(string const &id_, int53 user_id_, int53 user_chat_id_, int32 date_, object_ptr<businessBotRights> &&rights_, bool is_enabled_)
  : id_(id_)
  , user_id_(user_id_)
  , user_chat_id_(user_chat_id_)
  , date_(date_)
  , rights_(std::move(rights_))
  , is_enabled_(is_enabled_)
{}

const std::int32_t businessConnection::ID;

object_ptr<businessConnection> businessConnection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessConnection> res = make_object<businessConnection>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->user_chat_id_ = env->GetLongField(p, res->user_chat_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->rights_ = jni::fetch_tl_object<businessBotRights>(env, jni::fetch_object(env, p, res->rights_fieldID));
  res->is_enabled_ = (env->GetBooleanField(p, res->is_enabled_fieldID) != 0);
  return res;
}

void businessConnection::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetLongField(s, user_chat_id_fieldID, user_chat_id_);
  env->SetIntField(s, date_fieldID, date_);
  if (rights_ != nullptr) { jobject next; rights_->store(env, next); if (next) { env->SetObjectField(s, rights_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_enabled_fieldID, is_enabled_);
}

void businessConnection::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessConnection");
    s.store_field("id", id_);
    s.store_field("userId", user_id_);
    s.store_field("userChatId", user_chat_id_);
    s.store_field("date", date_);
    s.store_object_field("rights", static_cast<const BaseObject *>(rights_.get()));
    s.store_field("isEnabled", is_enabled_);
    s.store_class_end();
  }
}

void businessConnection::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessConnection").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    user_chat_id_fieldID = jni::get_field_id(env, Class, "userChatId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    rights_fieldID = jni::get_field_id(env, Class, "rights", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessBotRights;").c_str());
    is_enabled_fieldID = jni::get_field_id(env, Class, "isEnabled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass CallbackQueryPayload::Class;

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

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

jclass callbackQueryPayloadData::Class;
jfieldID callbackQueryPayloadData::data_fieldID;

callbackQueryPayloadData::callbackQueryPayloadData()
  : data_()
{}

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

const std::int32_t callbackQueryPayloadData::ID;

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

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

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

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

jclass callbackQueryPayloadDataWithPassword::Class;
jfieldID callbackQueryPayloadDataWithPassword::password_fieldID;
jfieldID callbackQueryPayloadDataWithPassword::data_fieldID;

callbackQueryPayloadDataWithPassword::callbackQueryPayloadDataWithPassword()
  : password_()
  , data_()
{}

callbackQueryPayloadDataWithPassword::callbackQueryPayloadDataWithPassword(string const &password_, bytes const &data_)
  : password_(password_)
  , data_(std::move(data_))
{}

const std::int32_t callbackQueryPayloadDataWithPassword::ID;

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

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

void callbackQueryPayloadDataWithPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CallbackQueryPayloadDataWithPassword");
    s.store_field("password", password_);
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

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

jclass callbackQueryPayloadGame::Class;
jfieldID callbackQueryPayloadGame::game_short_name_fieldID;

callbackQueryPayloadGame::callbackQueryPayloadGame()
  : game_short_name_()
{}

callbackQueryPayloadGame::callbackQueryPayloadGame(string const &game_short_name_)
  : game_short_name_(game_short_name_)
{}

const std::int32_t callbackQueryPayloadGame::ID;

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

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

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

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

jclass chatAdministrator::Class;
jfieldID chatAdministrator::user_id_fieldID;
jfieldID chatAdministrator::custom_title_fieldID;
jfieldID chatAdministrator::is_owner_fieldID;
jfieldID chatAdministrator::can_be_edited_fieldID;

chatAdministrator::chatAdministrator()
  : user_id_()
  , custom_title_()
  , is_owner_()
  , can_be_edited_()
{}

chatAdministrator::chatAdministrator(int53 user_id_, string const &custom_title_, bool is_owner_, bool can_be_edited_)
  : user_id_(user_id_)
  , custom_title_(custom_title_)
  , is_owner_(is_owner_)
  , can_be_edited_(can_be_edited_)
{}

const std::int32_t chatAdministrator::ID;

object_ptr<chatAdministrator> chatAdministrator::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatAdministrator> res = make_object<chatAdministrator>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->custom_title_ = jni::fetch_string(env, p, res->custom_title_fieldID);
  res->is_owner_ = (env->GetBooleanField(p, res->is_owner_fieldID) != 0);
  res->can_be_edited_ = (env->GetBooleanField(p, res->can_be_edited_fieldID) != 0);
  return res;
}

void chatAdministrator::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, custom_title_); if (nextString) { env->SetObjectField(s, custom_title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_owner_fieldID, is_owner_);
  env->SetBooleanField(s, can_be_edited_fieldID, can_be_edited_);
}

void chatAdministrator::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatAdministrator");
    s.store_field("userId", user_id_);
    s.store_field("customTitle", custom_title_);
    s.store_field("isOwner", is_owner_);
    s.store_field("canBeEdited", can_be_edited_);
    s.store_class_end();
  }
}

void chatAdministrator::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatAdministrator").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    custom_title_fieldID = jni::get_field_id(env, Class, "customTitle", "Ljava/lang/String;");
    is_owner_fieldID = jni::get_field_id(env, Class, "isOwner", "Z");
    can_be_edited_fieldID = jni::get_field_id(env, Class, "canBeEdited", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass ChatAvailableReactions::Class;

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

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

jclass chatAvailableReactionsAll::Class;
jfieldID chatAvailableReactionsAll::max_reaction_count_fieldID;

chatAvailableReactionsAll::chatAvailableReactionsAll()
  : max_reaction_count_()
{}

chatAvailableReactionsAll::chatAvailableReactionsAll(int32 max_reaction_count_)
  : max_reaction_count_(max_reaction_count_)
{}

const std::int32_t chatAvailableReactionsAll::ID;

object_ptr<ChatAvailableReactions> chatAvailableReactionsAll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatAvailableReactionsAll> res = make_object<chatAvailableReactionsAll>();
  res->max_reaction_count_ = env->GetIntField(p, res->max_reaction_count_fieldID);
  return std::move(res);
}

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

void chatAvailableReactionsAll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatAvailableReactionsAll");
    s.store_field("maxReactionCount", max_reaction_count_);
    s.store_class_end();
  }
}

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

jclass chatAvailableReactionsSome::Class;
jfieldID chatAvailableReactionsSome::reactions_fieldID;
jfieldID chatAvailableReactionsSome::max_reaction_count_fieldID;

chatAvailableReactionsSome::chatAvailableReactionsSome()
  : reactions_()
  , max_reaction_count_()
{}

chatAvailableReactionsSome::chatAvailableReactionsSome(array<object_ptr<ReactionType>> &&reactions_, int32 max_reaction_count_)
  : reactions_(std::move(reactions_))
  , max_reaction_count_(max_reaction_count_)
{}

const std::int32_t chatAvailableReactionsSome::ID;

object_ptr<ChatAvailableReactions> chatAvailableReactionsSome::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatAvailableReactionsSome> res = make_object<chatAvailableReactionsSome>();
  res->reactions_ = jni::FetchVector<ReactionType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->reactions_fieldID));
  res->max_reaction_count_ = env->GetIntField(p, res->max_reaction_count_fieldID);
  return std::move(res);
}

void chatAvailableReactionsSome::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, reactions_); if (arr_tmp_) { env->SetObjectField(s, reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, max_reaction_count_fieldID, max_reaction_count_);
}

void chatAvailableReactionsSome::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatAvailableReactionsSome");
    { s.store_vector_begin("reactions", reactions_.size()); for (const auto &_value : reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("maxReactionCount", max_reaction_count_);
    s.store_class_end();
  }
}

void chatAvailableReactionsSome::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatAvailableReactionsSome").c_str());
    reactions_fieldID = jni::get_field_id(env, Class, "reactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    max_reaction_count_fieldID = jni::get_field_id(env, Class, "maxReactionCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatBackground::Class;
jfieldID chatBackground::background_fieldID;
jfieldID chatBackground::dark_theme_dimming_fieldID;

chatBackground::chatBackground()
  : background_()
  , dark_theme_dimming_()
{}

chatBackground::chatBackground(object_ptr<background> &&background_, int32 dark_theme_dimming_)
  : background_(std::move(background_))
  , dark_theme_dimming_(dark_theme_dimming_)
{}

const std::int32_t chatBackground::ID;

object_ptr<chatBackground> chatBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBackground> res = make_object<chatBackground>();
  res->background_ = jni::fetch_tl_object<background>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->dark_theme_dimming_ = env->GetIntField(p, res->dark_theme_dimming_fieldID);
  return res;
}

void chatBackground::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, dark_theme_dimming_fieldID, dark_theme_dimming_);
}

void chatBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBackground");
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_field("darkThemeDimming", dark_theme_dimming_);
    s.store_class_end();
  }
}

void chatBackground::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBackground").c_str());
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Background;").c_str());
    dark_theme_dimming_fieldID = jni::get_field_id(env, Class, "darkThemeDimming", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatBoostFeatures::Class;
jfieldID chatBoostFeatures::features_fieldID;
jfieldID chatBoostFeatures::min_profile_background_custom_emoji_boost_level_fieldID;
jfieldID chatBoostFeatures::min_background_custom_emoji_boost_level_fieldID;
jfieldID chatBoostFeatures::min_emoji_status_boost_level_fieldID;
jfieldID chatBoostFeatures::min_chat_theme_background_boost_level_fieldID;
jfieldID chatBoostFeatures::min_custom_background_boost_level_fieldID;
jfieldID chatBoostFeatures::min_custom_emoji_sticker_set_boost_level_fieldID;
jfieldID chatBoostFeatures::min_automatic_translation_boost_level_fieldID;
jfieldID chatBoostFeatures::min_speech_recognition_boost_level_fieldID;
jfieldID chatBoostFeatures::min_sponsored_message_disable_boost_level_fieldID;

chatBoostFeatures::chatBoostFeatures()
  : features_()
  , min_profile_background_custom_emoji_boost_level_()
  , min_background_custom_emoji_boost_level_()
  , min_emoji_status_boost_level_()
  , min_chat_theme_background_boost_level_()
  , min_custom_background_boost_level_()
  , min_custom_emoji_sticker_set_boost_level_()
  , min_automatic_translation_boost_level_()
  , min_speech_recognition_boost_level_()
  , min_sponsored_message_disable_boost_level_()
{}

chatBoostFeatures::chatBoostFeatures(array<object_ptr<chatBoostLevelFeatures>> &&features_, int32 min_profile_background_custom_emoji_boost_level_, int32 min_background_custom_emoji_boost_level_, int32 min_emoji_status_boost_level_, int32 min_chat_theme_background_boost_level_, int32 min_custom_background_boost_level_, int32 min_custom_emoji_sticker_set_boost_level_, int32 min_automatic_translation_boost_level_, int32 min_speech_recognition_boost_level_, int32 min_sponsored_message_disable_boost_level_)
  : features_(std::move(features_))
  , min_profile_background_custom_emoji_boost_level_(min_profile_background_custom_emoji_boost_level_)
  , min_background_custom_emoji_boost_level_(min_background_custom_emoji_boost_level_)
  , min_emoji_status_boost_level_(min_emoji_status_boost_level_)
  , min_chat_theme_background_boost_level_(min_chat_theme_background_boost_level_)
  , min_custom_background_boost_level_(min_custom_background_boost_level_)
  , min_custom_emoji_sticker_set_boost_level_(min_custom_emoji_sticker_set_boost_level_)
  , min_automatic_translation_boost_level_(min_automatic_translation_boost_level_)
  , min_speech_recognition_boost_level_(min_speech_recognition_boost_level_)
  , min_sponsored_message_disable_boost_level_(min_sponsored_message_disable_boost_level_)
{}

const std::int32_t chatBoostFeatures::ID;

object_ptr<chatBoostFeatures> chatBoostFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostFeatures> res = make_object<chatBoostFeatures>();
  res->features_ = jni::FetchVector<chatBoostLevelFeatures>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->features_fieldID));
  res->min_profile_background_custom_emoji_boost_level_ = env->GetIntField(p, res->min_profile_background_custom_emoji_boost_level_fieldID);
  res->min_background_custom_emoji_boost_level_ = env->GetIntField(p, res->min_background_custom_emoji_boost_level_fieldID);
  res->min_emoji_status_boost_level_ = env->GetIntField(p, res->min_emoji_status_boost_level_fieldID);
  res->min_chat_theme_background_boost_level_ = env->GetIntField(p, res->min_chat_theme_background_boost_level_fieldID);
  res->min_custom_background_boost_level_ = env->GetIntField(p, res->min_custom_background_boost_level_fieldID);
  res->min_custom_emoji_sticker_set_boost_level_ = env->GetIntField(p, res->min_custom_emoji_sticker_set_boost_level_fieldID);
  res->min_automatic_translation_boost_level_ = env->GetIntField(p, res->min_automatic_translation_boost_level_fieldID);
  res->min_speech_recognition_boost_level_ = env->GetIntField(p, res->min_speech_recognition_boost_level_fieldID);
  res->min_sponsored_message_disable_boost_level_ = env->GetIntField(p, res->min_sponsored_message_disable_boost_level_fieldID);
  return res;
}

void chatBoostFeatures::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, features_); if (arr_tmp_) { env->SetObjectField(s, features_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, min_profile_background_custom_emoji_boost_level_fieldID, min_profile_background_custom_emoji_boost_level_);
  env->SetIntField(s, min_background_custom_emoji_boost_level_fieldID, min_background_custom_emoji_boost_level_);
  env->SetIntField(s, min_emoji_status_boost_level_fieldID, min_emoji_status_boost_level_);
  env->SetIntField(s, min_chat_theme_background_boost_level_fieldID, min_chat_theme_background_boost_level_);
  env->SetIntField(s, min_custom_background_boost_level_fieldID, min_custom_background_boost_level_);
  env->SetIntField(s, min_custom_emoji_sticker_set_boost_level_fieldID, min_custom_emoji_sticker_set_boost_level_);
  env->SetIntField(s, min_automatic_translation_boost_level_fieldID, min_automatic_translation_boost_level_);
  env->SetIntField(s, min_speech_recognition_boost_level_fieldID, min_speech_recognition_boost_level_);
  env->SetIntField(s, min_sponsored_message_disable_boost_level_fieldID, min_sponsored_message_disable_boost_level_);
}

void chatBoostFeatures::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBoostFeatures");
    { s.store_vector_begin("features", features_.size()); for (const auto &_value : features_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("minProfileBackgroundCustomEmojiBoostLevel", min_profile_background_custom_emoji_boost_level_);
    s.store_field("minBackgroundCustomEmojiBoostLevel", min_background_custom_emoji_boost_level_);
    s.store_field("minEmojiStatusBoostLevel", min_emoji_status_boost_level_);
    s.store_field("minChatThemeBackgroundBoostLevel", min_chat_theme_background_boost_level_);
    s.store_field("minCustomBackgroundBoostLevel", min_custom_background_boost_level_);
    s.store_field("minCustomEmojiStickerSetBoostLevel", min_custom_emoji_sticker_set_boost_level_);
    s.store_field("minAutomaticTranslationBoostLevel", min_automatic_translation_boost_level_);
    s.store_field("minSpeechRecognitionBoostLevel", min_speech_recognition_boost_level_);
    s.store_field("minSponsoredMessageDisableBoostLevel", min_sponsored_message_disable_boost_level_);
    s.store_class_end();
  }
}

void chatBoostFeatures::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBoostFeatures").c_str());
    features_fieldID = jni::get_field_id(env, Class, "features", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatBoostLevelFeatures;").c_str());
    min_profile_background_custom_emoji_boost_level_fieldID = jni::get_field_id(env, Class, "minProfileBackgroundCustomEmojiBoostLevel", "I");
    min_background_custom_emoji_boost_level_fieldID = jni::get_field_id(env, Class, "minBackgroundCustomEmojiBoostLevel", "I");
    min_emoji_status_boost_level_fieldID = jni::get_field_id(env, Class, "minEmojiStatusBoostLevel", "I");
    min_chat_theme_background_boost_level_fieldID = jni::get_field_id(env, Class, "minChatThemeBackgroundBoostLevel", "I");
    min_custom_background_boost_level_fieldID = jni::get_field_id(env, Class, "minCustomBackgroundBoostLevel", "I");
    min_custom_emoji_sticker_set_boost_level_fieldID = jni::get_field_id(env, Class, "minCustomEmojiStickerSetBoostLevel", "I");
    min_automatic_translation_boost_level_fieldID = jni::get_field_id(env, Class, "minAutomaticTranslationBoostLevel", "I");
    min_speech_recognition_boost_level_fieldID = jni::get_field_id(env, Class, "minSpeechRecognitionBoostLevel", "I");
    min_sponsored_message_disable_boost_level_fieldID = jni::get_field_id(env, Class, "minSponsoredMessageDisableBoostLevel", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatEventLogFilters::Class;
jfieldID chatEventLogFilters::message_edits_fieldID;
jfieldID chatEventLogFilters::message_deletions_fieldID;
jfieldID chatEventLogFilters::message_pins_fieldID;
jfieldID chatEventLogFilters::member_joins_fieldID;
jfieldID chatEventLogFilters::member_leaves_fieldID;
jfieldID chatEventLogFilters::member_invites_fieldID;
jfieldID chatEventLogFilters::member_promotions_fieldID;
jfieldID chatEventLogFilters::member_restrictions_fieldID;
jfieldID chatEventLogFilters::member_tag_changes_fieldID;
jfieldID chatEventLogFilters::info_changes_fieldID;
jfieldID chatEventLogFilters::setting_changes_fieldID;
jfieldID chatEventLogFilters::invite_link_changes_fieldID;
jfieldID chatEventLogFilters::video_chat_changes_fieldID;
jfieldID chatEventLogFilters::forum_changes_fieldID;
jfieldID chatEventLogFilters::subscription_extensions_fieldID;

chatEventLogFilters::chatEventLogFilters()
  : message_edits_()
  , message_deletions_()
  , message_pins_()
  , member_joins_()
  , member_leaves_()
  , member_invites_()
  , member_promotions_()
  , member_restrictions_()
  , member_tag_changes_()
  , info_changes_()
  , setting_changes_()
  , invite_link_changes_()
  , video_chat_changes_()
  , forum_changes_()
  , subscription_extensions_()
{}

chatEventLogFilters::chatEventLogFilters(bool message_edits_, bool message_deletions_, bool message_pins_, bool member_joins_, bool member_leaves_, bool member_invites_, bool member_promotions_, bool member_restrictions_, bool member_tag_changes_, bool info_changes_, bool setting_changes_, bool invite_link_changes_, bool video_chat_changes_, bool forum_changes_, bool subscription_extensions_)
  : message_edits_(message_edits_)
  , message_deletions_(message_deletions_)
  , message_pins_(message_pins_)
  , member_joins_(member_joins_)
  , member_leaves_(member_leaves_)
  , member_invites_(member_invites_)
  , member_promotions_(member_promotions_)
  , member_restrictions_(member_restrictions_)
  , member_tag_changes_(member_tag_changes_)
  , info_changes_(info_changes_)
  , setting_changes_(setting_changes_)
  , invite_link_changes_(invite_link_changes_)
  , video_chat_changes_(video_chat_changes_)
  , forum_changes_(forum_changes_)
  , subscription_extensions_(subscription_extensions_)
{}

const std::int32_t chatEventLogFilters::ID;

object_ptr<chatEventLogFilters> chatEventLogFilters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEventLogFilters> res = make_object<chatEventLogFilters>();
  res->message_edits_ = (env->GetBooleanField(p, res->message_edits_fieldID) != 0);
  res->message_deletions_ = (env->GetBooleanField(p, res->message_deletions_fieldID) != 0);
  res->message_pins_ = (env->GetBooleanField(p, res->message_pins_fieldID) != 0);
  res->member_joins_ = (env->GetBooleanField(p, res->member_joins_fieldID) != 0);
  res->member_leaves_ = (env->GetBooleanField(p, res->member_leaves_fieldID) != 0);
  res->member_invites_ = (env->GetBooleanField(p, res->member_invites_fieldID) != 0);
  res->member_promotions_ = (env->GetBooleanField(p, res->member_promotions_fieldID) != 0);
  res->member_restrictions_ = (env->GetBooleanField(p, res->member_restrictions_fieldID) != 0);
  res->member_tag_changes_ = (env->GetBooleanField(p, res->member_tag_changes_fieldID) != 0);
  res->info_changes_ = (env->GetBooleanField(p, res->info_changes_fieldID) != 0);
  res->setting_changes_ = (env->GetBooleanField(p, res->setting_changes_fieldID) != 0);
  res->invite_link_changes_ = (env->GetBooleanField(p, res->invite_link_changes_fieldID) != 0);
  res->video_chat_changes_ = (env->GetBooleanField(p, res->video_chat_changes_fieldID) != 0);
  res->forum_changes_ = (env->GetBooleanField(p, res->forum_changes_fieldID) != 0);
  res->subscription_extensions_ = (env->GetBooleanField(p, res->subscription_extensions_fieldID) != 0);
  return res;
}

void chatEventLogFilters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatEventLogFilters");
    s.store_field("messageEdits", message_edits_);
    s.store_field("messageDeletions", message_deletions_);
    s.store_field("messagePins", message_pins_);
    s.store_field("memberJoins", member_joins_);
    s.store_field("memberLeaves", member_leaves_);
    s.store_field("memberInvites", member_invites_);
    s.store_field("memberPromotions", member_promotions_);
    s.store_field("memberRestrictions", member_restrictions_);
    s.store_field("memberTagChanges", member_tag_changes_);
    s.store_field("infoChanges", info_changes_);
    s.store_field("settingChanges", setting_changes_);
    s.store_field("inviteLinkChanges", invite_link_changes_);
    s.store_field("videoChatChanges", video_chat_changes_);
    s.store_field("forumChanges", forum_changes_);
    s.store_field("subscriptionExtensions", subscription_extensions_);
    s.store_class_end();
  }
}

void chatEventLogFilters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatEventLogFilters").c_str());
    message_edits_fieldID = jni::get_field_id(env, Class, "messageEdits", "Z");
    message_deletions_fieldID = jni::get_field_id(env, Class, "messageDeletions", "Z");
    message_pins_fieldID = jni::get_field_id(env, Class, "messagePins", "Z");
    member_joins_fieldID = jni::get_field_id(env, Class, "memberJoins", "Z");
    member_leaves_fieldID = jni::get_field_id(env, Class, "memberLeaves", "Z");
    member_invites_fieldID = jni::get_field_id(env, Class, "memberInvites", "Z");
    member_promotions_fieldID = jni::get_field_id(env, Class, "memberPromotions", "Z");
    member_restrictions_fieldID = jni::get_field_id(env, Class, "memberRestrictions", "Z");
    member_tag_changes_fieldID = jni::get_field_id(env, Class, "memberTagChanges", "Z");
    info_changes_fieldID = jni::get_field_id(env, Class, "infoChanges", "Z");
    setting_changes_fieldID = jni::get_field_id(env, Class, "settingChanges", "Z");
    invite_link_changes_fieldID = jni::get_field_id(env, Class, "inviteLinkChanges", "Z");
    video_chat_changes_fieldID = jni::get_field_id(env, Class, "videoChatChanges", "Z");
    forum_changes_fieldID = jni::get_field_id(env, Class, "forumChanges", "Z");
    subscription_extensions_fieldID = jni::get_field_id(env, Class, "subscriptionExtensions", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatFolderInfo::Class;
jfieldID chatFolderInfo::id_fieldID;
jfieldID chatFolderInfo::name_fieldID;
jfieldID chatFolderInfo::icon_fieldID;
jfieldID chatFolderInfo::color_id_fieldID;
jfieldID chatFolderInfo::is_shareable_fieldID;
jfieldID chatFolderInfo::has_my_invite_links_fieldID;

chatFolderInfo::chatFolderInfo()
  : id_()
  , name_()
  , icon_()
  , color_id_()
  , is_shareable_()
  , has_my_invite_links_()
{}

chatFolderInfo::chatFolderInfo(int32 id_, object_ptr<chatFolderName> &&name_, object_ptr<chatFolderIcon> &&icon_, int32 color_id_, bool is_shareable_, bool has_my_invite_links_)
  : id_(id_)
  , name_(std::move(name_))
  , icon_(std::move(icon_))
  , color_id_(color_id_)
  , is_shareable_(is_shareable_)
  , has_my_invite_links_(has_my_invite_links_)
{}

const std::int32_t chatFolderInfo::ID;

object_ptr<chatFolderInfo> chatFolderInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatFolderInfo> res = make_object<chatFolderInfo>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->name_ = jni::fetch_tl_object<chatFolderName>(env, jni::fetch_object(env, p, res->name_fieldID));
  res->icon_ = jni::fetch_tl_object<chatFolderIcon>(env, jni::fetch_object(env, p, res->icon_fieldID));
  res->color_id_ = env->GetIntField(p, res->color_id_fieldID);
  res->is_shareable_ = (env->GetBooleanField(p, res->is_shareable_fieldID) != 0);
  res->has_my_invite_links_ = (env->GetBooleanField(p, res->has_my_invite_links_fieldID) != 0);
  return res;
}

void chatFolderInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  if (name_ != nullptr) { jobject next; name_->store(env, next); if (next) { env->SetObjectField(s, name_fieldID, next); env->DeleteLocalRef(next); } }
  if (icon_ != nullptr) { jobject next; icon_->store(env, next); if (next) { env->SetObjectField(s, icon_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, color_id_fieldID, color_id_);
  env->SetBooleanField(s, is_shareable_fieldID, is_shareable_);
  env->SetBooleanField(s, has_my_invite_links_fieldID, has_my_invite_links_);
}

void chatFolderInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatFolderInfo");
    s.store_field("id", id_);
    s.store_object_field("name", static_cast<const BaseObject *>(name_.get()));
    s.store_object_field("icon", static_cast<const BaseObject *>(icon_.get()));
    s.store_field("colorId", color_id_);
    s.store_field("isShareable", is_shareable_);
    s.store_field("hasMyInviteLinks", has_my_invite_links_);
    s.store_class_end();
  }
}

void chatFolderInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatFolderInfo").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatFolderName;").c_str());
    icon_fieldID = jni::get_field_id(env, Class, "icon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatFolderIcon;").c_str());
    color_id_fieldID = jni::get_field_id(env, Class, "colorId", "I");
    is_shareable_fieldID = jni::get_field_id(env, Class, "isShareable", "Z");
    has_my_invite_links_fieldID = jni::get_field_id(env, Class, "hasMyInviteLinks", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatInviteLinkCount::Class;
jfieldID chatInviteLinkCount::user_id_fieldID;
jfieldID chatInviteLinkCount::invite_link_count_fieldID;
jfieldID chatInviteLinkCount::revoked_invite_link_count_fieldID;

chatInviteLinkCount::chatInviteLinkCount()
  : user_id_()
  , invite_link_count_()
  , revoked_invite_link_count_()
{}

chatInviteLinkCount::chatInviteLinkCount(int53 user_id_, int32 invite_link_count_, int32 revoked_invite_link_count_)
  : user_id_(user_id_)
  , invite_link_count_(invite_link_count_)
  , revoked_invite_link_count_(revoked_invite_link_count_)
{}

const std::int32_t chatInviteLinkCount::ID;

object_ptr<chatInviteLinkCount> chatInviteLinkCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatInviteLinkCount> res = make_object<chatInviteLinkCount>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->invite_link_count_ = env->GetIntField(p, res->invite_link_count_fieldID);
  res->revoked_invite_link_count_ = env->GetIntField(p, res->revoked_invite_link_count_fieldID);
  return res;
}

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

void chatInviteLinkCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatInviteLinkCount");
    s.store_field("userId", user_id_);
    s.store_field("inviteLinkCount", invite_link_count_);
    s.store_field("revokedInviteLinkCount", revoked_invite_link_count_);
    s.store_class_end();
  }
}

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

jclass chatInviteLinkInfo::Class;
jfieldID chatInviteLinkInfo::chat_id_fieldID;
jfieldID chatInviteLinkInfo::accessible_for_fieldID;
jfieldID chatInviteLinkInfo::type_fieldID;
jfieldID chatInviteLinkInfo::title_fieldID;
jfieldID chatInviteLinkInfo::photo_fieldID;
jfieldID chatInviteLinkInfo::accent_color_id_fieldID;
jfieldID chatInviteLinkInfo::description_fieldID;
jfieldID chatInviteLinkInfo::member_count_fieldID;
jfieldID chatInviteLinkInfo::member_user_ids_fieldID;
jfieldID chatInviteLinkInfo::subscription_info_fieldID;
jfieldID chatInviteLinkInfo::creates_join_request_fieldID;
jfieldID chatInviteLinkInfo::is_public_fieldID;
jfieldID chatInviteLinkInfo::verification_status_fieldID;

chatInviteLinkInfo::chatInviteLinkInfo()
  : chat_id_()
  , accessible_for_()
  , type_()
  , title_()
  , photo_()
  , accent_color_id_()
  , description_()
  , member_count_()
  , member_user_ids_()
  , subscription_info_()
  , creates_join_request_()
  , is_public_()
  , verification_status_()
{}

chatInviteLinkInfo::chatInviteLinkInfo(int53 chat_id_, int32 accessible_for_, object_ptr<InviteLinkChatType> &&type_, string const &title_, object_ptr<chatPhotoInfo> &&photo_, int32 accent_color_id_, string const &description_, int32 member_count_, array<int53> &&member_user_ids_, object_ptr<chatInviteLinkSubscriptionInfo> &&subscription_info_, bool creates_join_request_, bool is_public_, object_ptr<verificationStatus> &&verification_status_)
  : chat_id_(chat_id_)
  , accessible_for_(accessible_for_)
  , type_(std::move(type_))
  , title_(title_)
  , photo_(std::move(photo_))
  , accent_color_id_(accent_color_id_)
  , description_(description_)
  , member_count_(member_count_)
  , member_user_ids_(std::move(member_user_ids_))
  , subscription_info_(std::move(subscription_info_))
  , creates_join_request_(creates_join_request_)
  , is_public_(is_public_)
  , verification_status_(std::move(verification_status_))
{}

const std::int32_t chatInviteLinkInfo::ID;

object_ptr<chatInviteLinkInfo> chatInviteLinkInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatInviteLinkInfo> res = make_object<chatInviteLinkInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->accessible_for_ = env->GetIntField(p, res->accessible_for_fieldID);
  res->type_ = jni::fetch_tl_object<InviteLinkChatType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->photo_ = jni::fetch_tl_object<chatPhotoInfo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->member_count_ = env->GetIntField(p, res->member_count_fieldID);
  res->member_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->member_user_ids_fieldID));
  res->subscription_info_ = jni::fetch_tl_object<chatInviteLinkSubscriptionInfo>(env, jni::fetch_object(env, p, res->subscription_info_fieldID));
  res->creates_join_request_ = (env->GetBooleanField(p, res->creates_join_request_fieldID) != 0);
  res->is_public_ = (env->GetBooleanField(p, res->is_public_fieldID) != 0);
  res->verification_status_ = jni::fetch_tl_object<verificationStatus>(env, jni::fetch_object(env, p, res->verification_status_fieldID));
  return res;
}

void chatInviteLinkInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, accessible_for_fieldID, accessible_for_);
  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, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, accent_color_id_fieldID, accent_color_id_);
  { 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_);
  { auto arr_tmp_ = jni::store_vector(env, member_user_ids_); if (arr_tmp_) { env->SetObjectField(s, member_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (subscription_info_ != nullptr) { jobject next; subscription_info_->store(env, next); if (next) { env->SetObjectField(s, subscription_info_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, creates_join_request_fieldID, creates_join_request_);
  env->SetBooleanField(s, is_public_fieldID, is_public_);
  if (verification_status_ != nullptr) { jobject next; verification_status_->store(env, next); if (next) { env->SetObjectField(s, verification_status_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatInviteLinkInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatInviteLinkInfo");
    s.store_field("chatId", chat_id_);
    s.store_field("accessibleFor", accessible_for_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("title", title_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("description", description_);
    s.store_field("memberCount", member_count_);
    { s.store_vector_begin("memberUserIds", member_user_ids_.size()); for (const auto &_value : member_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_object_field("subscriptionInfo", static_cast<const BaseObject *>(subscription_info_.get()));
    s.store_field("createsJoinRequest", creates_join_request_);
    s.store_field("isPublic", is_public_);
    s.store_object_field("verificationStatus", static_cast<const BaseObject *>(verification_status_.get()));
    s.store_class_end();
  }
}

void chatInviteLinkInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatInviteLinkInfo").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    accessible_for_fieldID = jni::get_field_id(env, Class, "accessibleFor", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InviteLinkChatType;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhotoInfo;").c_str());
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    member_count_fieldID = jni::get_field_id(env, Class, "memberCount", "I");
    member_user_ids_fieldID = jni::get_field_id(env, Class, "memberUserIds", "[J");
    subscription_info_fieldID = jni::get_field_id(env, Class, "subscriptionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLinkSubscriptionInfo;").c_str());
    creates_join_request_fieldID = jni::get_field_id(env, Class, "createsJoinRequest", "Z");
    is_public_fieldID = jni::get_field_id(env, Class, "isPublic", "Z");
    verification_status_fieldID = jni::get_field_id(env, Class, "verificationStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VerificationStatus;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass ChatList::Class;

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

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

jclass chatListMain::Class;

chatListMain::chatListMain() {
}

const std::int32_t chatListMain::ID;

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

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

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

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

jclass chatListArchive::Class;

chatListArchive::chatListArchive() {
}

const std::int32_t chatListArchive::ID;

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

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

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

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

jclass chatListFolder::Class;
jfieldID chatListFolder::chat_folder_id_fieldID;

chatListFolder::chatListFolder()
  : chat_folder_id_()
{}

chatListFolder::chatListFolder(int32 chat_folder_id_)
  : chat_folder_id_(chat_folder_id_)
{}

const std::int32_t chatListFolder::ID;

object_ptr<ChatList> chatListFolder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatListFolder> res = make_object<chatListFolder>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  return std::move(res);
}

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

void chatListFolder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatListFolder");
    s.store_field("chatFolderId", chat_folder_id_);
    s.store_class_end();
  }
}

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

jclass chatLocation::Class;
jfieldID chatLocation::location_fieldID;
jfieldID chatLocation::address_fieldID;

chatLocation::chatLocation()
  : location_()
  , address_()
{}

chatLocation::chatLocation(object_ptr<location> &&location_, string const &address_)
  : location_(std::move(location_))
  , address_(address_)
{}

const std::int32_t chatLocation::ID;

object_ptr<chatLocation> chatLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatLocation> res = make_object<chatLocation>();
  res->location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->address_ = jni::fetch_string(env, p, res->address_fieldID);
  return res;
}

void chatLocation::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); } }
  { jstring nextString = jni::to_jstring(env, address_); if (nextString) { env->SetObjectField(s, address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chatLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatLocation");
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("address", address_);
    s.store_class_end();
  }
}

void chatLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatLocation").c_str());
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    address_fieldID = jni::get_field_id(env, Class, "address", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatMember::Class;
jfieldID chatMember::member_id_fieldID;
jfieldID chatMember::tag_fieldID;
jfieldID chatMember::inviter_user_id_fieldID;
jfieldID chatMember::joined_chat_date_fieldID;
jfieldID chatMember::status_fieldID;

chatMember::chatMember()
  : member_id_()
  , tag_()
  , inviter_user_id_()
  , joined_chat_date_()
  , status_()
{}

chatMember::chatMember(object_ptr<MessageSender> &&member_id_, string const &tag_, int53 inviter_user_id_, int32 joined_chat_date_, object_ptr<ChatMemberStatus> &&status_)
  : member_id_(std::move(member_id_))
  , tag_(tag_)
  , inviter_user_id_(inviter_user_id_)
  , joined_chat_date_(joined_chat_date_)
  , status_(std::move(status_))
{}

const std::int32_t chatMember::ID;

object_ptr<chatMember> chatMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatMember> res = make_object<chatMember>();
  res->member_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->member_id_fieldID));
  res->tag_ = jni::fetch_string(env, p, res->tag_fieldID);
  res->inviter_user_id_ = env->GetLongField(p, res->inviter_user_id_fieldID);
  res->joined_chat_date_ = env->GetIntField(p, res->joined_chat_date_fieldID);
  res->status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  return res;
}

void chatMember::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); } }
  { jstring nextString = jni::to_jstring(env, tag_); if (nextString) { env->SetObjectField(s, tag_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, inviter_user_id_fieldID, inviter_user_id_);
  env->SetIntField(s, joined_chat_date_fieldID, joined_chat_date_);
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatMember");
    s.store_object_field("memberId", static_cast<const BaseObject *>(member_id_.get()));
    s.store_field("tag", tag_);
    s.store_field("inviterUserId", inviter_user_id_);
    s.store_field("joinedChatDate", joined_chat_date_);
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_class_end();
  }
}

void chatMember::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatMember").c_str());
    member_id_fieldID = jni::get_field_id(env, Class, "memberId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    tag_fieldID = jni::get_field_id(env, Class, "tag", "Ljava/lang/String;");
    inviter_user_id_fieldID = jni::get_field_id(env, Class, "inviterUserId", "J");
    joined_chat_date_fieldID = jni::get_field_id(env, Class, "joinedChatDate", "I");
    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 connectedWebsite::Class;
jfieldID connectedWebsite::id_fieldID;
jfieldID connectedWebsite::domain_name_fieldID;
jfieldID connectedWebsite::bot_user_id_fieldID;
jfieldID connectedWebsite::browser_fieldID;
jfieldID connectedWebsite::platform_fieldID;
jfieldID connectedWebsite::log_in_date_fieldID;
jfieldID connectedWebsite::last_active_date_fieldID;
jfieldID connectedWebsite::ip_address_fieldID;
jfieldID connectedWebsite::location_fieldID;

connectedWebsite::connectedWebsite()
  : id_()
  , domain_name_()
  , bot_user_id_()
  , browser_()
  , platform_()
  , log_in_date_()
  , last_active_date_()
  , ip_address_()
  , location_()
{}

connectedWebsite::connectedWebsite(int64 id_, string const &domain_name_, int53 bot_user_id_, string const &browser_, string const &platform_, int32 log_in_date_, int32 last_active_date_, string const &ip_address_, string const &location_)
  : id_(id_)
  , domain_name_(domain_name_)
  , bot_user_id_(bot_user_id_)
  , browser_(browser_)
  , platform_(platform_)
  , log_in_date_(log_in_date_)
  , last_active_date_(last_active_date_)
  , ip_address_(ip_address_)
  , location_(location_)
{}

const std::int32_t connectedWebsite::ID;

object_ptr<connectedWebsite> connectedWebsite::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<connectedWebsite> res = make_object<connectedWebsite>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->domain_name_ = jni::fetch_string(env, p, res->domain_name_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->browser_ = jni::fetch_string(env, p, res->browser_fieldID);
  res->platform_ = jni::fetch_string(env, p, res->platform_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 connectedWebsite::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, domain_name_); if (nextString) { env->SetObjectField(s, domain_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, bot_user_id_fieldID, bot_user_id_);
  { jstring nextString = jni::to_jstring(env, browser_); if (nextString) { env->SetObjectField(s, browser_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, platform_); if (nextString) { env->SetObjectField(s, platform_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 connectedWebsite::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectedWebsite");
    s.store_field("id", id_);
    s.store_field("domainName", domain_name_);
    s.store_field("botUserId", bot_user_id_);
    s.store_field("browser", browser_);
    s.store_field("platform", platform_);
    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 connectedWebsite::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectedWebsite").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    domain_name_fieldID = jni::get_field_id(env, Class, "domainName", "Ljava/lang/String;");
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    browser_fieldID = jni::get_field_id(env, Class, "browser", "Ljava/lang/String;");
    platform_fieldID = jni::get_field_id(env, Class, "platform", "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 count::Class;
jfieldID count::count_fieldID;

count::count()
  : count_()
{}

count::count(int32 count_)
  : count_(count_)
{}

const std::int32_t count::ID;

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

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

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

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

jclass DiffEntityType::Class;

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

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

jclass diffEntityTypeInsert::Class;

diffEntityTypeInsert::diffEntityTypeInsert() {
}

const std::int32_t diffEntityTypeInsert::ID;

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

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

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

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

jclass diffEntityTypeReplace::Class;
jfieldID diffEntityTypeReplace::old_text_fieldID;

diffEntityTypeReplace::diffEntityTypeReplace()
  : old_text_()
{}

diffEntityTypeReplace::diffEntityTypeReplace(string const &old_text_)
  : old_text_(old_text_)
{}

const std::int32_t diffEntityTypeReplace::ID;

object_ptr<DiffEntityType> diffEntityTypeReplace::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<diffEntityTypeReplace> res = make_object<diffEntityTypeReplace>();
  res->old_text_ = jni::fetch_string(env, p, res->old_text_fieldID);
  return std::move(res);
}

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

void diffEntityTypeReplace::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DiffEntityTypeReplace");
    s.store_field("oldText", old_text_);
    s.store_class_end();
  }
}

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

jclass diffEntityTypeDelete::Class;

diffEntityTypeDelete::diffEntityTypeDelete() {
}

const std::int32_t diffEntityTypeDelete::ID;

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

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

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

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

jclass failedToAddMember::Class;
jfieldID failedToAddMember::user_id_fieldID;
jfieldID failedToAddMember::premium_would_allow_invite_fieldID;
jfieldID failedToAddMember::premium_required_to_send_messages_fieldID;

failedToAddMember::failedToAddMember()
  : user_id_()
  , premium_would_allow_invite_()
  , premium_required_to_send_messages_()
{}

failedToAddMember::failedToAddMember(int53 user_id_, bool premium_would_allow_invite_, bool premium_required_to_send_messages_)
  : user_id_(user_id_)
  , premium_would_allow_invite_(premium_would_allow_invite_)
  , premium_required_to_send_messages_(premium_required_to_send_messages_)
{}

const std::int32_t failedToAddMember::ID;

object_ptr<failedToAddMember> failedToAddMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<failedToAddMember> res = make_object<failedToAddMember>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->premium_would_allow_invite_ = (env->GetBooleanField(p, res->premium_would_allow_invite_fieldID) != 0);
  res->premium_required_to_send_messages_ = (env->GetBooleanField(p, res->premium_required_to_send_messages_fieldID) != 0);
  return res;
}

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

void failedToAddMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FailedToAddMember");
    s.store_field("userId", user_id_);
    s.store_field("premiumWouldAllowInvite", premium_would_allow_invite_);
    s.store_field("premiumRequiredToSendMessages", premium_required_to_send_messages_);
    s.store_class_end();
  }
}

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

jclass foundAffiliatePrograms::Class;
jfieldID foundAffiliatePrograms::total_count_fieldID;
jfieldID foundAffiliatePrograms::programs_fieldID;
jfieldID foundAffiliatePrograms::next_offset_fieldID;

foundAffiliatePrograms::foundAffiliatePrograms()
  : total_count_()
  , programs_()
  , next_offset_()
{}

foundAffiliatePrograms::foundAffiliatePrograms(int32 total_count_, array<object_ptr<foundAffiliateProgram>> &&programs_, string const &next_offset_)
  : total_count_(total_count_)
  , programs_(std::move(programs_))
  , next_offset_(next_offset_)
{}

const std::int32_t foundAffiliatePrograms::ID;

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

void foundAffiliatePrograms::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, programs_); if (arr_tmp_) { env->SetObjectField(s, programs_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass foundChatBoosts::Class;
jfieldID foundChatBoosts::total_count_fieldID;
jfieldID foundChatBoosts::boosts_fieldID;
jfieldID foundChatBoosts::next_offset_fieldID;

foundChatBoosts::foundChatBoosts()
  : total_count_()
  , boosts_()
  , next_offset_()
{}

foundChatBoosts::foundChatBoosts(int32 total_count_, array<object_ptr<chatBoost>> &&boosts_, string const &next_offset_)
  : total_count_(total_count_)
  , boosts_(std::move(boosts_))
  , next_offset_(next_offset_)
{}

const std::int32_t foundChatBoosts::ID;

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

void foundChatBoosts::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, boosts_); if (arr_tmp_) { env->SetObjectField(s, boosts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass giftResaleParameters::Class;
jfieldID giftResaleParameters::star_count_fieldID;
jfieldID giftResaleParameters::toncoin_cent_count_fieldID;
jfieldID giftResaleParameters::toncoin_only_fieldID;

giftResaleParameters::giftResaleParameters()
  : star_count_()
  , toncoin_cent_count_()
  , toncoin_only_()
{}

giftResaleParameters::giftResaleParameters(int53 star_count_, int53 toncoin_cent_count_, bool toncoin_only_)
  : star_count_(star_count_)
  , toncoin_cent_count_(toncoin_cent_count_)
  , toncoin_only_(toncoin_only_)
{}

const std::int32_t giftResaleParameters::ID;

object_ptr<giftResaleParameters> giftResaleParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftResaleParameters> res = make_object<giftResaleParameters>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->toncoin_cent_count_ = env->GetLongField(p, res->toncoin_cent_count_fieldID);
  res->toncoin_only_ = (env->GetBooleanField(p, res->toncoin_only_fieldID) != 0);
  return res;
}

void giftResaleParameters::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_);
  env->SetLongField(s, toncoin_cent_count_fieldID, toncoin_cent_count_);
  env->SetBooleanField(s, toncoin_only_fieldID, toncoin_only_);
}

void giftResaleParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftResaleParameters");
    s.store_field("starCount", star_count_);
    s.store_field("toncoinCentCount", toncoin_cent_count_);
    s.store_field("toncoinOnly", toncoin_only_);
    s.store_class_end();
  }
}

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

jclass GiftResalePrice::Class;

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

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

jclass giftResalePriceStar::Class;
jfieldID giftResalePriceStar::star_count_fieldID;

giftResalePriceStar::giftResalePriceStar()
  : star_count_()
{}

giftResalePriceStar::giftResalePriceStar(int53 star_count_)
  : star_count_(star_count_)
{}

const std::int32_t giftResalePriceStar::ID;

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

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

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

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

jclass giftResalePriceTon::Class;
jfieldID giftResalePriceTon::toncoin_cent_count_fieldID;

giftResalePriceTon::giftResalePriceTon()
  : toncoin_cent_count_()
{}

giftResalePriceTon::giftResalePriceTon(int53 toncoin_cent_count_)
  : toncoin_cent_count_(toncoin_cent_count_)
{}

const std::int32_t giftResalePriceTon::ID;

object_ptr<GiftResalePrice> giftResalePriceTon::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftResalePriceTon> res = make_object<giftResalePriceTon>();
  res->toncoin_cent_count_ = env->GetLongField(p, res->toncoin_cent_count_fieldID);
  return std::move(res);
}

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

void giftResalePriceTon::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftResalePriceTon");
    s.store_field("toncoinCentCount", toncoin_cent_count_);
    s.store_class_end();
  }
}

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

jclass GroupCallDataChannel::Class;

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

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

jclass groupCallDataChannelMain::Class;

groupCallDataChannelMain::groupCallDataChannelMain() {
}

const std::int32_t groupCallDataChannelMain::ID;

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

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

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

jclass groupCallDataChannelScreenSharing::Class;

groupCallDataChannelScreenSharing::groupCallDataChannelScreenSharing() {
}

const std::int32_t groupCallDataChannelScreenSharing::ID;

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

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

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

jclass groupCallId::Class;
jfieldID groupCallId::id_fieldID;

groupCallId::groupCallId()
  : id_()
{}

groupCallId::groupCallId(int32 id_)
  : id_(id_)
{}

const std::int32_t groupCallId::ID;

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

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

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

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

jclass groupCallStream::Class;
jfieldID groupCallStream::channel_id_fieldID;
jfieldID groupCallStream::scale_fieldID;
jfieldID groupCallStream::time_offset_fieldID;

groupCallStream::groupCallStream()
  : channel_id_()
  , scale_()
  , time_offset_()
{}

groupCallStream::groupCallStream(int32 channel_id_, int32 scale_, int53 time_offset_)
  : channel_id_(channel_id_)
  , scale_(scale_)
  , time_offset_(time_offset_)
{}

const std::int32_t groupCallStream::ID;

object_ptr<groupCallStream> groupCallStream::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallStream> res = make_object<groupCallStream>();
  res->channel_id_ = env->GetIntField(p, res->channel_id_fieldID);
  res->scale_ = env->GetIntField(p, res->scale_fieldID);
  res->time_offset_ = env->GetLongField(p, res->time_offset_fieldID);
  return res;
}

void groupCallStream::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, channel_id_fieldID, channel_id_);
  env->SetIntField(s, scale_fieldID, scale_);
  env->SetLongField(s, time_offset_fieldID, time_offset_);
}

void groupCallStream::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallStream");
    s.store_field("channelId", channel_id_);
    s.store_field("scale", scale_);
    s.store_field("timeOffset", time_offset_);
    s.store_class_end();
  }
}

void groupCallStream::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallStream").c_str());
    channel_id_fieldID = jni::get_field_id(env, Class, "channelId", "I");
    scale_fieldID = jni::get_field_id(env, Class, "scale", "I");
    time_offset_fieldID = jni::get_field_id(env, Class, "timeOffset", "J");
    return true;
  }();
  (void)is_inited;
}

jclass hashtags::Class;
jfieldID hashtags::hashtags_fieldID;

hashtags::hashtags()
  : hashtags_()
{}

hashtags::hashtags(array<string> &&hashtags_)
  : hashtags_(std::move(hashtags_))
{}

const std::int32_t hashtags::ID;

object_ptr<hashtags> hashtags::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<hashtags> res = make_object<hashtags>();
  res->hashtags_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->hashtags_fieldID));
  return res;
}

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

void hashtags::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Hashtags");
    { s.store_vector_begin("hashtags", hashtags_.size()); for (const auto &_value : hashtags_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass inlineQueryResults::Class;
jfieldID inlineQueryResults::inline_query_id_fieldID;
jfieldID inlineQueryResults::button_fieldID;
jfieldID inlineQueryResults::results_fieldID;
jfieldID inlineQueryResults::next_offset_fieldID;

inlineQueryResults::inlineQueryResults()
  : inline_query_id_()
  , button_()
  , results_()
  , next_offset_()
{}

inlineQueryResults::inlineQueryResults(int64 inline_query_id_, object_ptr<inlineQueryResultsButton> &&button_, array<object_ptr<InlineQueryResult>> &&results_, string const &next_offset_)
  : inline_query_id_(inline_query_id_)
  , button_(std::move(button_))
  , results_(std::move(results_))
  , next_offset_(next_offset_)
{}

const std::int32_t inlineQueryResults::ID;

object_ptr<inlineQueryResults> inlineQueryResults::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResults> res = make_object<inlineQueryResults>();
  res->inline_query_id_ = env->GetLongField(p, res->inline_query_id_fieldID);
  res->button_ = jni::fetch_tl_object<inlineQueryResultsButton>(env, jni::fetch_object(env, p, res->button_fieldID));
  res->results_ = jni::FetchVector<InlineQueryResult>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->results_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void inlineQueryResults::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, inline_query_id_fieldID, inline_query_id_);
  if (button_ != nullptr) { jobject next; button_->store(env, next); if (next) { env->SetObjectField(s, button_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, results_); if (arr_tmp_) { env->SetObjectField(s, results_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void inlineQueryResults::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResults");
    s.store_field("inlineQueryId", inline_query_id_);
    s.store_object_field("button", static_cast<const BaseObject *>(button_.get()));
    { s.store_vector_begin("results", results_.size()); for (const auto &_value : results_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("nextOffset", next_offset_);
    s.store_class_end();
  }
}

void inlineQueryResults::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InlineQueryResults").c_str());
    inline_query_id_fieldID = jni::get_field_id(env, Class, "inlineQueryId", "J");
    button_fieldID = jni::get_field_id(env, Class, "button", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InlineQueryResultsButton;").c_str());
    results_fieldID = jni::get_field_id(env, Class, "results", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InlineQueryResult;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass InputFile::Class;

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

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

jclass inputFileId::Class;
jfieldID inputFileId::id_fieldID;

inputFileId::inputFileId()
  : id_()
{}

inputFileId::inputFileId(int32 id_)
  : id_(id_)
{}

const std::int32_t inputFileId::ID;

object_ptr<InputFile> inputFileId::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputFileId> res = make_object<inputFileId>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  return std::move(res);
}

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

void inputFileId::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputFileId");
    s.store_field("id", id_);
    s.store_class_end();
  }
}

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

jclass inputFileRemote::Class;
jfieldID inputFileRemote::id_fieldID;

inputFileRemote::inputFileRemote()
  : id_()
{}

inputFileRemote::inputFileRemote(string const &id_)
  : id_(id_)
{}

const std::int32_t inputFileRemote::ID;

object_ptr<InputFile> inputFileRemote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputFileRemote> res = make_object<inputFileRemote>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  return std::move(res);
}

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

void inputFileRemote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputFileRemote");
    s.store_field("id", id_);
    s.store_class_end();
  }
}

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

jclass inputFileLocal::Class;
jfieldID inputFileLocal::path_fieldID;

inputFileLocal::inputFileLocal()
  : path_()
{}

inputFileLocal::inputFileLocal(string const &path_)
  : path_(path_)
{}

const std::int32_t inputFileLocal::ID;

object_ptr<InputFile> inputFileLocal::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputFileLocal> res = make_object<inputFileLocal>();
  res->path_ = jni::fetch_string(env, p, res->path_fieldID);
  return std::move(res);
}

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

void inputFileLocal::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputFileLocal");
    s.store_field("path", path_);
    s.store_class_end();
  }
}

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

jclass inputFileGenerated::Class;
jfieldID inputFileGenerated::original_path_fieldID;
jfieldID inputFileGenerated::conversion_fieldID;
jfieldID inputFileGenerated::expected_size_fieldID;

inputFileGenerated::inputFileGenerated()
  : original_path_()
  , conversion_()
  , expected_size_()
{}

inputFileGenerated::inputFileGenerated(string const &original_path_, string const &conversion_, int53 expected_size_)
  : original_path_(original_path_)
  , conversion_(conversion_)
  , expected_size_(expected_size_)
{}

const std::int32_t inputFileGenerated::ID;

object_ptr<InputFile> inputFileGenerated::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputFileGenerated> res = make_object<inputFileGenerated>();
  res->original_path_ = jni::fetch_string(env, p, res->original_path_fieldID);
  res->conversion_ = jni::fetch_string(env, p, res->conversion_fieldID);
  res->expected_size_ = env->GetLongField(p, res->expected_size_fieldID);
  return std::move(res);
}

void inputFileGenerated::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, original_path_); if (nextString) { env->SetObjectField(s, original_path_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, conversion_); if (nextString) { env->SetObjectField(s, conversion_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, expected_size_fieldID, expected_size_);
}

void inputFileGenerated::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputFileGenerated");
    s.store_field("originalPath", original_path_);
    s.store_field("conversion", conversion_);
    s.store_field("expectedSize", expected_size_);
    s.store_class_end();
  }
}

void inputFileGenerated::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputFileGenerated").c_str());
    original_path_fieldID = jni::get_field_id(env, Class, "originalPath", "Ljava/lang/String;");
    conversion_fieldID = jni::get_field_id(env, Class, "conversion", "Ljava/lang/String;");
    expected_size_fieldID = jni::get_field_id(env, Class, "expectedSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass InputGroupCall::Class;

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

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

jclass inputGroupCallLink::Class;
jfieldID inputGroupCallLink::link_fieldID;

inputGroupCallLink::inputGroupCallLink()
  : link_()
{}

inputGroupCallLink::inputGroupCallLink(string const &link_)
  : link_(link_)
{}

const std::int32_t inputGroupCallLink::ID;

object_ptr<InputGroupCall> inputGroupCallLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputGroupCallLink> res = make_object<inputGroupCallLink>();
  res->link_ = jni::fetch_string(env, p, res->link_fieldID);
  return std::move(res);
}

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

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

jclass inputGroupCallMessage::Class;
jfieldID inputGroupCallMessage::chat_id_fieldID;
jfieldID inputGroupCallMessage::message_id_fieldID;

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

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

const std::int32_t inputGroupCallMessage::ID;

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

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

inputStoryArea::inputStoryArea()
  : position_()
  , type_()
{}

inputStoryArea::inputStoryArea(object_ptr<storyAreaPosition> &&position_, object_ptr<InputStoryAreaType> &&type_)
  : position_(std::move(position_))
  , type_(std::move(type_))
{}

const std::int32_t inputStoryArea::ID;

object_ptr<inputStoryArea> inputStoryArea::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryArea> res = make_object<inputStoryArea>();
  res->position_ = jni::fetch_tl_object<storyAreaPosition>(env, jni::fetch_object(env, p, res->position_fieldID));
  res->type_ = jni::fetch_tl_object<InputStoryAreaType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void inputStoryArea::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryArea");
    s.store_object_field("position", static_cast<const BaseObject *>(position_.get()));
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void inputStoryArea::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputStoryArea").c_str());
    position_fieldID = jni::get_field_id(env, Class, "position", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryAreaPosition;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryAreaType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass JsonValue::Class;

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

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

jclass jsonValueNull::Class;

jsonValueNull::jsonValueNull() {
}

const std::int32_t jsonValueNull::ID;

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

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

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

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

jclass jsonValueBoolean::Class;
jfieldID jsonValueBoolean::value_fieldID;

jsonValueBoolean::jsonValueBoolean()
  : value_()
{}

jsonValueBoolean::jsonValueBoolean(bool value_)
  : value_(value_)
{}

const std::int32_t jsonValueBoolean::ID;

object_ptr<JsonValue> jsonValueBoolean::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<jsonValueBoolean> res = make_object<jsonValueBoolean>();
  res->value_ = (env->GetBooleanField(p, res->value_fieldID) != 0);
  return std::move(res);
}

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

void jsonValueBoolean::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "JsonValueBoolean");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass jsonValueNumber::Class;
jfieldID jsonValueNumber::value_fieldID;

jsonValueNumber::jsonValueNumber()
  : value_()
{}

jsonValueNumber::jsonValueNumber(double value_)
  : value_(value_)
{}

const std::int32_t jsonValueNumber::ID;

object_ptr<JsonValue> jsonValueNumber::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<jsonValueNumber> res = make_object<jsonValueNumber>();
  res->value_ = env->GetDoubleField(p, res->value_fieldID);
  return std::move(res);
}

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

void jsonValueNumber::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "JsonValueNumber");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass jsonValueString::Class;
jfieldID jsonValueString::value_fieldID;

jsonValueString::jsonValueString()
  : value_()
{}

jsonValueString::jsonValueString(string const &value_)
  : value_(value_)
{}

const std::int32_t jsonValueString::ID;

object_ptr<JsonValue> jsonValueString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<jsonValueString> res = make_object<jsonValueString>();
  res->value_ = jni::fetch_string(env, p, res->value_fieldID);
  return std::move(res);
}

void jsonValueString::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 jsonValueString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "JsonValueString");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass jsonValueArray::Class;
jfieldID jsonValueArray::values_fieldID;

jsonValueArray::jsonValueArray()
  : values_()
{}

jsonValueArray::jsonValueArray(array<object_ptr<JsonValue>> &&values_)
  : values_(std::move(values_))
{}

const std::int32_t jsonValueArray::ID;

object_ptr<JsonValue> jsonValueArray::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<jsonValueArray> res = make_object<jsonValueArray>();
  res->values_ = jni::FetchVector<JsonValue>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->values_fieldID));
  return std::move(res);
}

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

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

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

jclass jsonValueObject::Class;
jfieldID jsonValueObject::members_fieldID;

jsonValueObject::jsonValueObject()
  : members_()
{}

jsonValueObject::jsonValueObject(array<object_ptr<jsonObjectMember>> &&members_)
  : members_(std::move(members_))
{}

const std::int32_t jsonValueObject::ID;

object_ptr<JsonValue> jsonValueObject::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<jsonValueObject> res = make_object<jsonValueObject>();
  res->members_ = jni::FetchVector<jsonObjectMember>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->members_fieldID));
  return std::move(res);
}

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

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

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

jclass LanguagePackStringValue::Class;

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

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

jclass languagePackStringValueOrdinary::Class;
jfieldID languagePackStringValueOrdinary::value_fieldID;

languagePackStringValueOrdinary::languagePackStringValueOrdinary()
  : value_()
{}

languagePackStringValueOrdinary::languagePackStringValueOrdinary(string const &value_)
  : value_(value_)
{}

const std::int32_t languagePackStringValueOrdinary::ID;

object_ptr<LanguagePackStringValue> languagePackStringValueOrdinary::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<languagePackStringValueOrdinary> res = make_object<languagePackStringValueOrdinary>();
  res->value_ = jni::fetch_string(env, p, res->value_fieldID);
  return std::move(res);
}

void languagePackStringValueOrdinary::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 languagePackStringValueOrdinary::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LanguagePackStringValueOrdinary");
    s.store_field("value", value_);
    s.store_class_end();
  }
}

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

jclass languagePackStringValuePluralized::Class;
jfieldID languagePackStringValuePluralized::zero_value_fieldID;
jfieldID languagePackStringValuePluralized::one_value_fieldID;
jfieldID languagePackStringValuePluralized::two_value_fieldID;
jfieldID languagePackStringValuePluralized::few_value_fieldID;
jfieldID languagePackStringValuePluralized::many_value_fieldID;
jfieldID languagePackStringValuePluralized::other_value_fieldID;

languagePackStringValuePluralized::languagePackStringValuePluralized()
  : zero_value_()
  , one_value_()
  , two_value_()
  , few_value_()
  , many_value_()
  , other_value_()
{}

languagePackStringValuePluralized::languagePackStringValuePluralized(string const &zero_value_, string const &one_value_, string const &two_value_, string const &few_value_, string const &many_value_, string const &other_value_)
  : zero_value_(zero_value_)
  , one_value_(one_value_)
  , two_value_(two_value_)
  , few_value_(few_value_)
  , many_value_(many_value_)
  , other_value_(other_value_)
{}

const std::int32_t languagePackStringValuePluralized::ID;

object_ptr<LanguagePackStringValue> languagePackStringValuePluralized::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<languagePackStringValuePluralized> res = make_object<languagePackStringValuePluralized>();
  res->zero_value_ = jni::fetch_string(env, p, res->zero_value_fieldID);
  res->one_value_ = jni::fetch_string(env, p, res->one_value_fieldID);
  res->two_value_ = jni::fetch_string(env, p, res->two_value_fieldID);
  res->few_value_ = jni::fetch_string(env, p, res->few_value_fieldID);
  res->many_value_ = jni::fetch_string(env, p, res->many_value_fieldID);
  res->other_value_ = jni::fetch_string(env, p, res->other_value_fieldID);
  return std::move(res);
}

void languagePackStringValuePluralized::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, zero_value_); if (nextString) { env->SetObjectField(s, zero_value_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, one_value_); if (nextString) { env->SetObjectField(s, one_value_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, two_value_); if (nextString) { env->SetObjectField(s, two_value_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, few_value_); if (nextString) { env->SetObjectField(s, few_value_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, many_value_); if (nextString) { env->SetObjectField(s, many_value_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, other_value_); if (nextString) { env->SetObjectField(s, other_value_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void languagePackStringValuePluralized::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LanguagePackStringValuePluralized");
    s.store_field("zeroValue", zero_value_);
    s.store_field("oneValue", one_value_);
    s.store_field("twoValue", two_value_);
    s.store_field("fewValue", few_value_);
    s.store_field("manyValue", many_value_);
    s.store_field("otherValue", other_value_);
    s.store_class_end();
  }
}

void languagePackStringValuePluralized::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LanguagePackStringValuePluralized").c_str());
    zero_value_fieldID = jni::get_field_id(env, Class, "zeroValue", "Ljava/lang/String;");
    one_value_fieldID = jni::get_field_id(env, Class, "oneValue", "Ljava/lang/String;");
    two_value_fieldID = jni::get_field_id(env, Class, "twoValue", "Ljava/lang/String;");
    few_value_fieldID = jni::get_field_id(env, Class, "fewValue", "Ljava/lang/String;");
    many_value_fieldID = jni::get_field_id(env, Class, "manyValue", "Ljava/lang/String;");
    other_value_fieldID = jni::get_field_id(env, Class, "otherValue", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass languagePackStringValueDeleted::Class;

languagePackStringValueDeleted::languagePackStringValueDeleted() {
}

const std::int32_t languagePackStringValueDeleted::ID;

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

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

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

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

jclass message::Class;
jfieldID message::id_fieldID;
jfieldID message::sender_id_fieldID;
jfieldID message::chat_id_fieldID;
jfieldID message::sending_state_fieldID;
jfieldID message::scheduling_state_fieldID;
jfieldID message::is_outgoing_fieldID;
jfieldID message::is_pinned_fieldID;
jfieldID message::is_from_offline_fieldID;
jfieldID message::can_be_saved_fieldID;
jfieldID message::has_timestamped_media_fieldID;
jfieldID message::is_channel_post_fieldID;
jfieldID message::is_paid_star_suggested_post_fieldID;
jfieldID message::is_paid_ton_suggested_post_fieldID;
jfieldID message::contains_unread_mention_fieldID;
jfieldID message::contains_unread_poll_votes_fieldID;
jfieldID message::date_fieldID;
jfieldID message::edit_date_fieldID;
jfieldID message::forward_info_fieldID;
jfieldID message::import_info_fieldID;
jfieldID message::interaction_info_fieldID;
jfieldID message::unread_reactions_fieldID;
jfieldID message::fact_check_fieldID;
jfieldID message::suggested_post_info_fieldID;
jfieldID message::reply_to_fieldID;
jfieldID message::topic_id_fieldID;
jfieldID message::self_destruct_type_fieldID;
jfieldID message::self_destruct_in_fieldID;
jfieldID message::auto_delete_in_fieldID;
jfieldID message::via_bot_user_id_fieldID;
jfieldID message::guest_bot_caller_id_fieldID;
jfieldID message::sender_business_bot_user_id_fieldID;
jfieldID message::sender_boost_count_fieldID;
jfieldID message::sender_tag_fieldID;
jfieldID message::paid_message_star_count_fieldID;
jfieldID message::author_signature_fieldID;
jfieldID message::media_album_id_fieldID;
jfieldID message::effect_id_fieldID;
jfieldID message::restriction_info_fieldID;
jfieldID message::summary_language_code_fieldID;
jfieldID message::content_fieldID;
jfieldID message::reply_markup_fieldID;

message::message()
  : id_()
  , sender_id_()
  , chat_id_()
  , sending_state_()
  , scheduling_state_()
  , is_outgoing_()
  , is_pinned_()
  , is_from_offline_()
  , can_be_saved_()
  , has_timestamped_media_()
  , is_channel_post_()
  , is_paid_star_suggested_post_()
  , is_paid_ton_suggested_post_()
  , contains_unread_mention_()
  , contains_unread_poll_votes_()
  , date_()
  , edit_date_()
  , forward_info_()
  , import_info_()
  , interaction_info_()
  , unread_reactions_()
  , fact_check_()
  , suggested_post_info_()
  , reply_to_()
  , topic_id_()
  , self_destruct_type_()
  , self_destruct_in_()
  , auto_delete_in_()
  , via_bot_user_id_()
  , guest_bot_caller_id_()
  , sender_business_bot_user_id_()
  , sender_boost_count_()
  , sender_tag_()
  , paid_message_star_count_()
  , author_signature_()
  , media_album_id_()
  , effect_id_()
  , restriction_info_()
  , summary_language_code_()
  , content_()
  , reply_markup_()
{}

message::message(int53 id_, object_ptr<MessageSender> &&sender_id_, int53 chat_id_, object_ptr<MessageSendingState> &&sending_state_, object_ptr<MessageSchedulingState> &&scheduling_state_, bool is_outgoing_, bool is_pinned_, bool is_from_offline_, bool can_be_saved_, bool has_timestamped_media_, bool is_channel_post_, bool is_paid_star_suggested_post_, bool is_paid_ton_suggested_post_, bool contains_unread_mention_, bool contains_unread_poll_votes_, int32 date_, int32 edit_date_, object_ptr<messageForwardInfo> &&forward_info_, object_ptr<messageImportInfo> &&import_info_, object_ptr<messageInteractionInfo> &&interaction_info_, array<object_ptr<unreadReaction>> &&unread_reactions_, object_ptr<factCheck> &&fact_check_, object_ptr<suggestedPostInfo> &&suggested_post_info_, object_ptr<MessageReplyTo> &&reply_to_, object_ptr<MessageTopic> &&topic_id_, object_ptr<MessageSelfDestructType> &&self_destruct_type_, double self_destruct_in_, double auto_delete_in_, int53 via_bot_user_id_, object_ptr<MessageSender> &&guest_bot_caller_id_, int53 sender_business_bot_user_id_, int32 sender_boost_count_, string const &sender_tag_, int53 paid_message_star_count_, string const &author_signature_, int64 media_album_id_, int64 effect_id_, object_ptr<restrictionInfo> &&restriction_info_, string const &summary_language_code_, object_ptr<MessageContent> &&content_, object_ptr<ReplyMarkup> &&reply_markup_)
  : id_(id_)
  , sender_id_(std::move(sender_id_))
  , chat_id_(chat_id_)
  , sending_state_(std::move(sending_state_))
  , scheduling_state_(std::move(scheduling_state_))
  , is_outgoing_(is_outgoing_)
  , is_pinned_(is_pinned_)
  , is_from_offline_(is_from_offline_)
  , can_be_saved_(can_be_saved_)
  , has_timestamped_media_(has_timestamped_media_)
  , is_channel_post_(is_channel_post_)
  , is_paid_star_suggested_post_(is_paid_star_suggested_post_)
  , is_paid_ton_suggested_post_(is_paid_ton_suggested_post_)
  , contains_unread_mention_(contains_unread_mention_)
  , contains_unread_poll_votes_(contains_unread_poll_votes_)
  , date_(date_)
  , edit_date_(edit_date_)
  , forward_info_(std::move(forward_info_))
  , import_info_(std::move(import_info_))
  , interaction_info_(std::move(interaction_info_))
  , unread_reactions_(std::move(unread_reactions_))
  , fact_check_(std::move(fact_check_))
  , suggested_post_info_(std::move(suggested_post_info_))
  , reply_to_(std::move(reply_to_))
  , topic_id_(std::move(topic_id_))
  , self_destruct_type_(std::move(self_destruct_type_))
  , self_destruct_in_(self_destruct_in_)
  , auto_delete_in_(auto_delete_in_)
  , via_bot_user_id_(via_bot_user_id_)
  , guest_bot_caller_id_(std::move(guest_bot_caller_id_))
  , sender_business_bot_user_id_(sender_business_bot_user_id_)
  , sender_boost_count_(sender_boost_count_)
  , sender_tag_(sender_tag_)
  , paid_message_star_count_(paid_message_star_count_)
  , author_signature_(author_signature_)
  , media_album_id_(media_album_id_)
  , effect_id_(effect_id_)
  , restriction_info_(std::move(restriction_info_))
  , summary_language_code_(summary_language_code_)
  , content_(std::move(content_))
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t message::ID;

object_ptr<message> message::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<message> res = make_object<message>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->sending_state_ = jni::fetch_tl_object<MessageSendingState>(env, jni::fetch_object(env, p, res->sending_state_fieldID));
  res->scheduling_state_ = jni::fetch_tl_object<MessageSchedulingState>(env, jni::fetch_object(env, p, res->scheduling_state_fieldID));
  res->is_outgoing_ = (env->GetBooleanField(p, res->is_outgoing_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  res->is_from_offline_ = (env->GetBooleanField(p, res->is_from_offline_fieldID) != 0);
  res->can_be_saved_ = (env->GetBooleanField(p, res->can_be_saved_fieldID) != 0);
  res->has_timestamped_media_ = (env->GetBooleanField(p, res->has_timestamped_media_fieldID) != 0);
  res->is_channel_post_ = (env->GetBooleanField(p, res->is_channel_post_fieldID) != 0);
  res->is_paid_star_suggested_post_ = (env->GetBooleanField(p, res->is_paid_star_suggested_post_fieldID) != 0);
  res->is_paid_ton_suggested_post_ = (env->GetBooleanField(p, res->is_paid_ton_suggested_post_fieldID) != 0);
  res->contains_unread_mention_ = (env->GetBooleanField(p, res->contains_unread_mention_fieldID) != 0);
  res->contains_unread_poll_votes_ = (env->GetBooleanField(p, res->contains_unread_poll_votes_fieldID) != 0);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->edit_date_ = env->GetIntField(p, res->edit_date_fieldID);
  res->forward_info_ = jni::fetch_tl_object<messageForwardInfo>(env, jni::fetch_object(env, p, res->forward_info_fieldID));
  res->import_info_ = jni::fetch_tl_object<messageImportInfo>(env, jni::fetch_object(env, p, res->import_info_fieldID));
  res->interaction_info_ = jni::fetch_tl_object<messageInteractionInfo>(env, jni::fetch_object(env, p, res->interaction_info_fieldID));
  res->unread_reactions_ = jni::FetchVector<unreadReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->unread_reactions_fieldID));
  res->fact_check_ = jni::fetch_tl_object<factCheck>(env, jni::fetch_object(env, p, res->fact_check_fieldID));
  res->suggested_post_info_ = jni::fetch_tl_object<suggestedPostInfo>(env, jni::fetch_object(env, p, res->suggested_post_info_fieldID));
  res->reply_to_ = jni::fetch_tl_object<MessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->self_destruct_type_ = jni::fetch_tl_object<MessageSelfDestructType>(env, jni::fetch_object(env, p, res->self_destruct_type_fieldID));
  res->self_destruct_in_ = env->GetDoubleField(p, res->self_destruct_in_fieldID);
  res->auto_delete_in_ = env->GetDoubleField(p, res->auto_delete_in_fieldID);
  res->via_bot_user_id_ = env->GetLongField(p, res->via_bot_user_id_fieldID);
  res->guest_bot_caller_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->guest_bot_caller_id_fieldID));
  res->sender_business_bot_user_id_ = env->GetLongField(p, res->sender_business_bot_user_id_fieldID);
  res->sender_boost_count_ = env->GetIntField(p, res->sender_boost_count_fieldID);
  res->sender_tag_ = jni::fetch_string(env, p, res->sender_tag_fieldID);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  res->author_signature_ = jni::fetch_string(env, p, res->author_signature_fieldID);
  res->media_album_id_ = env->GetLongField(p, res->media_album_id_fieldID);
  res->effect_id_ = env->GetLongField(p, res->effect_id_fieldID);
  res->restriction_info_ = jni::fetch_tl_object<restrictionInfo>(env, jni::fetch_object(env, p, res->restriction_info_fieldID));
  res->summary_language_code_ = jni::fetch_string(env, p, res->summary_language_code_fieldID);
  res->content_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  return res;
}

void message::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (sending_state_ != nullptr) { jobject next; sending_state_->store(env, next); if (next) { env->SetObjectField(s, sending_state_fieldID, next); env->DeleteLocalRef(next); } }
  if (scheduling_state_ != nullptr) { jobject next; scheduling_state_->store(env, next); if (next) { env->SetObjectField(s, scheduling_state_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_outgoing_fieldID, is_outgoing_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
  env->SetBooleanField(s, is_from_offline_fieldID, is_from_offline_);
  env->SetBooleanField(s, can_be_saved_fieldID, can_be_saved_);
  env->SetBooleanField(s, has_timestamped_media_fieldID, has_timestamped_media_);
  env->SetBooleanField(s, is_channel_post_fieldID, is_channel_post_);
  env->SetBooleanField(s, is_paid_star_suggested_post_fieldID, is_paid_star_suggested_post_);
  env->SetBooleanField(s, is_paid_ton_suggested_post_fieldID, is_paid_ton_suggested_post_);
  env->SetBooleanField(s, contains_unread_mention_fieldID, contains_unread_mention_);
  env->SetBooleanField(s, contains_unread_poll_votes_fieldID, contains_unread_poll_votes_);
  env->SetIntField(s, date_fieldID, date_);
  env->SetIntField(s, edit_date_fieldID, edit_date_);
  if (forward_info_ != nullptr) { jobject next; forward_info_->store(env, next); if (next) { env->SetObjectField(s, forward_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (import_info_ != nullptr) { jobject next; import_info_->store(env, next); if (next) { env->SetObjectField(s, import_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (interaction_info_ != nullptr) { jobject next; interaction_info_->store(env, next); if (next) { env->SetObjectField(s, interaction_info_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, unread_reactions_); if (arr_tmp_) { env->SetObjectField(s, unread_reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (fact_check_ != nullptr) { jobject next; fact_check_->store(env, next); if (next) { env->SetObjectField(s, fact_check_fieldID, next); env->DeleteLocalRef(next); } }
  if (suggested_post_info_ != nullptr) { jobject next; suggested_post_info_->store(env, next); if (next) { env->SetObjectField(s, suggested_post_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (reply_to_ != nullptr) { jobject next; reply_to_->store(env, next); if (next) { env->SetObjectField(s, reply_to_fieldID, next); env->DeleteLocalRef(next); } }
  if (topic_id_ != nullptr) { jobject next; topic_id_->store(env, next); if (next) { env->SetObjectField(s, topic_id_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); } }
  env->SetDoubleField(s, self_destruct_in_fieldID, self_destruct_in_);
  env->SetDoubleField(s, auto_delete_in_fieldID, auto_delete_in_);
  env->SetLongField(s, via_bot_user_id_fieldID, via_bot_user_id_);
  if (guest_bot_caller_id_ != nullptr) { jobject next; guest_bot_caller_id_->store(env, next); if (next) { env->SetObjectField(s, guest_bot_caller_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, sender_business_bot_user_id_fieldID, sender_business_bot_user_id_);
  env->SetIntField(s, sender_boost_count_fieldID, sender_boost_count_);
  { jstring nextString = jni::to_jstring(env, sender_tag_); if (nextString) { env->SetObjectField(s, sender_tag_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, paid_message_star_count_fieldID, paid_message_star_count_);
  { jstring nextString = jni::to_jstring(env, author_signature_); if (nextString) { env->SetObjectField(s, author_signature_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, media_album_id_fieldID, media_album_id_);
  env->SetLongField(s, effect_id_fieldID, effect_id_);
  if (restriction_info_ != nullptr) { jobject next; restriction_info_->store(env, next); if (next) { env->SetObjectField(s, restriction_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, summary_language_code_); if (nextString) { env->SetObjectField(s, summary_language_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
  if (reply_markup_ != nullptr) { jobject next; reply_markup_->store(env, next); if (next) { env->SetObjectField(s, reply_markup_fieldID, next); env->DeleteLocalRef(next); } }
}

void message::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Message");
    s.store_field("id", id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("chatId", chat_id_);
    s.store_object_field("sendingState", static_cast<const BaseObject *>(sending_state_.get()));
    s.store_object_field("schedulingState", static_cast<const BaseObject *>(scheduling_state_.get()));
    s.store_field("isOutgoing", is_outgoing_);
    s.store_field("isPinned", is_pinned_);
    s.store_field("isFromOffline", is_from_offline_);
    s.store_field("canBeSaved", can_be_saved_);
    s.store_field("hasTimestampedMedia", has_timestamped_media_);
    s.store_field("isChannelPost", is_channel_post_);
    s.store_field("isPaidStarSuggestedPost", is_paid_star_suggested_post_);
    s.store_field("isPaidTonSuggestedPost", is_paid_ton_suggested_post_);
    s.store_field("containsUnreadMention", contains_unread_mention_);
    s.store_field("containsUnreadPollVotes", contains_unread_poll_votes_);
    s.store_field("date", date_);
    s.store_field("editDate", edit_date_);
    s.store_object_field("forwardInfo", static_cast<const BaseObject *>(forward_info_.get()));
    s.store_object_field("importInfo", static_cast<const BaseObject *>(import_info_.get()));
    s.store_object_field("interactionInfo", static_cast<const BaseObject *>(interaction_info_.get()));
    { s.store_vector_begin("unreadReactions", unread_reactions_.size()); for (const auto &_value : unread_reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("factCheck", static_cast<const BaseObject *>(fact_check_.get()));
    s.store_object_field("suggestedPostInfo", static_cast<const BaseObject *>(suggested_post_info_.get()));
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("selfDestructType", static_cast<const BaseObject *>(self_destruct_type_.get()));
    s.store_field("selfDestructIn", self_destruct_in_);
    s.store_field("autoDeleteIn", auto_delete_in_);
    s.store_field("viaBotUserId", via_bot_user_id_);
    s.store_object_field("guestBotCallerId", static_cast<const BaseObject *>(guest_bot_caller_id_.get()));
    s.store_field("senderBusinessBotUserId", sender_business_bot_user_id_);
    s.store_field("senderBoostCount", sender_boost_count_);
    s.store_field("senderTag", sender_tag_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_field("authorSignature", author_signature_);
    s.store_field("mediaAlbumId", media_album_id_);
    s.store_field("effectId", effect_id_);
    s.store_object_field("restrictionInfo", static_cast<const BaseObject *>(restriction_info_.get()));
    s.store_field("summaryLanguageCode", summary_language_code_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_class_end();
  }
}

void message::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Message").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    sending_state_fieldID = jni::get_field_id(env, Class, "sendingState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSendingState;").c_str());
    scheduling_state_fieldID = jni::get_field_id(env, Class, "schedulingState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSchedulingState;").c_str());
    is_outgoing_fieldID = jni::get_field_id(env, Class, "isOutgoing", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    is_from_offline_fieldID = jni::get_field_id(env, Class, "isFromOffline", "Z");
    can_be_saved_fieldID = jni::get_field_id(env, Class, "canBeSaved", "Z");
    has_timestamped_media_fieldID = jni::get_field_id(env, Class, "hasTimestampedMedia", "Z");
    is_channel_post_fieldID = jni::get_field_id(env, Class, "isChannelPost", "Z");
    is_paid_star_suggested_post_fieldID = jni::get_field_id(env, Class, "isPaidStarSuggestedPost", "Z");
    is_paid_ton_suggested_post_fieldID = jni::get_field_id(env, Class, "isPaidTonSuggestedPost", "Z");
    contains_unread_mention_fieldID = jni::get_field_id(env, Class, "containsUnreadMention", "Z");
    contains_unread_poll_votes_fieldID = jni::get_field_id(env, Class, "containsUnreadPollVotes", "Z");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    edit_date_fieldID = jni::get_field_id(env, Class, "editDate", "I");
    forward_info_fieldID = jni::get_field_id(env, Class, "forwardInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageForwardInfo;").c_str());
    import_info_fieldID = jni::get_field_id(env, Class, "importInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageImportInfo;").c_str());
    interaction_info_fieldID = jni::get_field_id(env, Class, "interactionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageInteractionInfo;").c_str());
    unread_reactions_fieldID = jni::get_field_id(env, Class, "unreadReactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UnreadReaction;").c_str());
    fact_check_fieldID = jni::get_field_id(env, Class, "factCheck", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FactCheck;").c_str());
    suggested_post_info_fieldID = jni::get_field_id(env, Class, "suggestedPostInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostInfo;").c_str());
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageReplyTo;").c_str());
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    self_destruct_type_fieldID = jni::get_field_id(env, Class, "selfDestructType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSelfDestructType;").c_str());
    self_destruct_in_fieldID = jni::get_field_id(env, Class, "selfDestructIn", "D");
    auto_delete_in_fieldID = jni::get_field_id(env, Class, "autoDeleteIn", "D");
    via_bot_user_id_fieldID = jni::get_field_id(env, Class, "viaBotUserId", "J");
    guest_bot_caller_id_fieldID = jni::get_field_id(env, Class, "guestBotCallerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    sender_business_bot_user_id_fieldID = jni::get_field_id(env, Class, "senderBusinessBotUserId", "J");
    sender_boost_count_fieldID = jni::get_field_id(env, Class, "senderBoostCount", "I");
    sender_tag_fieldID = jni::get_field_id(env, Class, "senderTag", "Ljava/lang/String;");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    author_signature_fieldID = jni::get_field_id(env, Class, "authorSignature", "Ljava/lang/String;");
    media_album_id_fieldID = jni::get_field_id(env, Class, "mediaAlbumId", "J");
    effect_id_fieldID = jni::get_field_id(env, Class, "effectId", "J");
    restriction_info_fieldID = jni::get_field_id(env, Class, "restrictionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RestrictionInfo;").c_str());
    summary_language_code_fieldID = jni::get_field_id(env, Class, "summaryLanguageCode", "Ljava/lang/String;");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageStatistics::Class;
jfieldID messageStatistics::message_interaction_graph_fieldID;
jfieldID messageStatistics::message_reaction_graph_fieldID;

messageStatistics::messageStatistics()
  : message_interaction_graph_()
  , message_reaction_graph_()
{}

messageStatistics::messageStatistics(object_ptr<StatisticalGraph> &&message_interaction_graph_, object_ptr<StatisticalGraph> &&message_reaction_graph_)
  : message_interaction_graph_(std::move(message_interaction_graph_))
  , message_reaction_graph_(std::move(message_reaction_graph_))
{}

const std::int32_t messageStatistics::ID;

object_ptr<messageStatistics> messageStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageStatistics> res = make_object<messageStatistics>();
  res->message_interaction_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->message_interaction_graph_fieldID));
  res->message_reaction_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->message_reaction_graph_fieldID));
  return res;
}

void messageStatistics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_interaction_graph_ != nullptr) { jobject next; message_interaction_graph_->store(env, next); if (next) { env->SetObjectField(s, message_interaction_graph_fieldID, next); env->DeleteLocalRef(next); } }
  if (message_reaction_graph_ != nullptr) { jobject next; message_reaction_graph_->store(env, next); if (next) { env->SetObjectField(s, message_reaction_graph_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageStatistics");
    s.store_object_field("messageInteractionGraph", static_cast<const BaseObject *>(message_interaction_graph_.get()));
    s.store_object_field("messageReactionGraph", static_cast<const BaseObject *>(message_reaction_graph_.get()));
    s.store_class_end();
  }
}

void messageStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageStatistics").c_str());
    message_interaction_graph_fieldID = jni::get_field_id(env, Class, "messageInteractionGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    message_reaction_graph_fieldID = jni::get_field_id(env, Class, "messageReactionGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageViewers::Class;
jfieldID messageViewers::viewers_fieldID;

messageViewers::messageViewers()
  : viewers_()
{}

messageViewers::messageViewers(array<object_ptr<messageViewer>> &&viewers_)
  : viewers_(std::move(viewers_))
{}

const std::int32_t messageViewers::ID;

object_ptr<messageViewers> messageViewers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageViewers> res = make_object<messageViewers>();
  res->viewers_ = jni::FetchVector<messageViewer>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->viewers_fieldID));
  return res;
}

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

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

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

jclass NetworkStatisticsEntry::Class;

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

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

jclass networkStatisticsEntryFile::Class;
jfieldID networkStatisticsEntryFile::file_type_fieldID;
jfieldID networkStatisticsEntryFile::network_type_fieldID;
jfieldID networkStatisticsEntryFile::sent_bytes_fieldID;
jfieldID networkStatisticsEntryFile::received_bytes_fieldID;

networkStatisticsEntryFile::networkStatisticsEntryFile()
  : file_type_()
  , network_type_()
  , sent_bytes_()
  , received_bytes_()
{}

networkStatisticsEntryFile::networkStatisticsEntryFile(object_ptr<FileType> &&file_type_, object_ptr<NetworkType> &&network_type_, int53 sent_bytes_, int53 received_bytes_)
  : file_type_(std::move(file_type_))
  , network_type_(std::move(network_type_))
  , sent_bytes_(sent_bytes_)
  , received_bytes_(received_bytes_)
{}

const std::int32_t networkStatisticsEntryFile::ID;

object_ptr<NetworkStatisticsEntry> networkStatisticsEntryFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<networkStatisticsEntryFile> res = make_object<networkStatisticsEntryFile>();
  res->file_type_ = jni::fetch_tl_object<FileType>(env, jni::fetch_object(env, p, res->file_type_fieldID));
  res->network_type_ = jni::fetch_tl_object<NetworkType>(env, jni::fetch_object(env, p, res->network_type_fieldID));
  res->sent_bytes_ = env->GetLongField(p, res->sent_bytes_fieldID);
  res->received_bytes_ = env->GetLongField(p, res->received_bytes_fieldID);
  return std::move(res);
}

void networkStatisticsEntryFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (file_type_ != nullptr) { jobject next; file_type_->store(env, next); if (next) { env->SetObjectField(s, file_type_fieldID, next); env->DeleteLocalRef(next); } }
  if (network_type_ != nullptr) { jobject next; network_type_->store(env, next); if (next) { env->SetObjectField(s, network_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, sent_bytes_fieldID, sent_bytes_);
  env->SetLongField(s, received_bytes_fieldID, received_bytes_);
}

void networkStatisticsEntryFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NetworkStatisticsEntryFile");
    s.store_object_field("fileType", static_cast<const BaseObject *>(file_type_.get()));
    s.store_object_field("networkType", static_cast<const BaseObject *>(network_type_.get()));
    s.store_field("sentBytes", sent_bytes_);
    s.store_field("receivedBytes", received_bytes_);
    s.store_class_end();
  }
}

void networkStatisticsEntryFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NetworkStatisticsEntryFile").c_str());
    file_type_fieldID = jni::get_field_id(env, Class, "fileType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FileType;").c_str());
    network_type_fieldID = jni::get_field_id(env, Class, "networkType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NetworkType;").c_str());
    sent_bytes_fieldID = jni::get_field_id(env, Class, "sentBytes", "J");
    received_bytes_fieldID = jni::get_field_id(env, Class, "receivedBytes", "J");
    return true;
  }();
  (void)is_inited;
}

jclass networkStatisticsEntryCall::Class;
jfieldID networkStatisticsEntryCall::network_type_fieldID;
jfieldID networkStatisticsEntryCall::sent_bytes_fieldID;
jfieldID networkStatisticsEntryCall::received_bytes_fieldID;
jfieldID networkStatisticsEntryCall::duration_fieldID;

networkStatisticsEntryCall::networkStatisticsEntryCall()
  : network_type_()
  , sent_bytes_()
  , received_bytes_()
  , duration_()
{}

networkStatisticsEntryCall::networkStatisticsEntryCall(object_ptr<NetworkType> &&network_type_, int53 sent_bytes_, int53 received_bytes_, double duration_)
  : network_type_(std::move(network_type_))
  , sent_bytes_(sent_bytes_)
  , received_bytes_(received_bytes_)
  , duration_(duration_)
{}

const std::int32_t networkStatisticsEntryCall::ID;

object_ptr<NetworkStatisticsEntry> networkStatisticsEntryCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<networkStatisticsEntryCall> res = make_object<networkStatisticsEntryCall>();
  res->network_type_ = jni::fetch_tl_object<NetworkType>(env, jni::fetch_object(env, p, res->network_type_fieldID));
  res->sent_bytes_ = env->GetLongField(p, res->sent_bytes_fieldID);
  res->received_bytes_ = env->GetLongField(p, res->received_bytes_fieldID);
  res->duration_ = env->GetDoubleField(p, res->duration_fieldID);
  return std::move(res);
}

void networkStatisticsEntryCall::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (network_type_ != nullptr) { jobject next; network_type_->store(env, next); if (next) { env->SetObjectField(s, network_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, sent_bytes_fieldID, sent_bytes_);
  env->SetLongField(s, received_bytes_fieldID, received_bytes_);
  env->SetDoubleField(s, duration_fieldID, duration_);
}

void networkStatisticsEntryCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NetworkStatisticsEntryCall");
    s.store_object_field("networkType", static_cast<const BaseObject *>(network_type_.get()));
    s.store_field("sentBytes", sent_bytes_);
    s.store_field("receivedBytes", received_bytes_);
    s.store_field("duration", duration_);
    s.store_class_end();
  }
}

void networkStatisticsEntryCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NetworkStatisticsEntryCall").c_str());
    network_type_fieldID = jni::get_field_id(env, Class, "networkType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NetworkType;").c_str());
    sent_bytes_fieldID = jni::get_field_id(env, Class, "sentBytes", "J");
    received_bytes_fieldID = jni::get_field_id(env, Class, "receivedBytes", "J");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "D");
    return true;
  }();
  (void)is_inited;
}

jclass notificationGroup::Class;
jfieldID notificationGroup::id_fieldID;
jfieldID notificationGroup::type_fieldID;
jfieldID notificationGroup::chat_id_fieldID;
jfieldID notificationGroup::total_count_fieldID;
jfieldID notificationGroup::notifications_fieldID;

notificationGroup::notificationGroup()
  : id_()
  , type_()
  , chat_id_()
  , total_count_()
  , notifications_()
{}

notificationGroup::notificationGroup(int32 id_, object_ptr<NotificationGroupType> &&type_, int53 chat_id_, int32 total_count_, array<object_ptr<notification>> &&notifications_)
  : id_(id_)
  , type_(std::move(type_))
  , chat_id_(chat_id_)
  , total_count_(total_count_)
  , notifications_(std::move(notifications_))
{}

const std::int32_t notificationGroup::ID;

object_ptr<notificationGroup> notificationGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<notificationGroup> res = make_object<notificationGroup>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->type_ = jni::fetch_tl_object<NotificationGroupType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->notifications_ = jni::FetchVector<notification>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->notifications_fieldID));
  return res;
}

void notificationGroup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(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, chat_id_fieldID, chat_id_);
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, notifications_); if (arr_tmp_) { env->SetObjectField(s, notifications_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void notificationGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NotificationGroup");
    s.store_field("id", id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("chatId", chat_id_);
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("notifications", notifications_.size()); for (const auto &_value : notifications_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void notificationGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NotificationGroup").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NotificationGroupType;").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    notifications_fieldID = jni::get_field_id(env, Class, "notifications", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Notification;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass NotificationType::Class;

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

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

jclass notificationTypeNewMessage::Class;
jfieldID notificationTypeNewMessage::message_fieldID;
jfieldID notificationTypeNewMessage::show_preview_fieldID;

notificationTypeNewMessage::notificationTypeNewMessage()
  : message_()
  , show_preview_()
{}

notificationTypeNewMessage::notificationTypeNewMessage(object_ptr<message> &&message_, bool show_preview_)
  : message_(std::move(message_))
  , show_preview_(show_preview_)
{}

const std::int32_t notificationTypeNewMessage::ID;

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

void notificationTypeNewMessage::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, show_preview_fieldID, show_preview_);
}

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

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

jclass notificationTypeNewSecretChat::Class;

notificationTypeNewSecretChat::notificationTypeNewSecretChat() {
}

const std::int32_t notificationTypeNewSecretChat::ID;

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

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

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

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

jclass notificationTypeNewCall::Class;
jfieldID notificationTypeNewCall::call_id_fieldID;

notificationTypeNewCall::notificationTypeNewCall()
  : call_id_()
{}

notificationTypeNewCall::notificationTypeNewCall(int32 call_id_)
  : call_id_(call_id_)
{}

const std::int32_t notificationTypeNewCall::ID;

object_ptr<NotificationType> notificationTypeNewCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<notificationTypeNewCall> res = make_object<notificationTypeNewCall>();
  res->call_id_ = env->GetIntField(p, res->call_id_fieldID);
  return std::move(res);
}

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

void notificationTypeNewCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NotificationTypeNewCall");
    s.store_field("callId", call_id_);
    s.store_class_end();
  }
}

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

jclass notificationTypeNewPushMessage::Class;
jfieldID notificationTypeNewPushMessage::message_id_fieldID;
jfieldID notificationTypeNewPushMessage::sender_id_fieldID;
jfieldID notificationTypeNewPushMessage::sender_name_fieldID;
jfieldID notificationTypeNewPushMessage::is_outgoing_fieldID;
jfieldID notificationTypeNewPushMessage::content_fieldID;

notificationTypeNewPushMessage::notificationTypeNewPushMessage()
  : message_id_()
  , sender_id_()
  , sender_name_()
  , is_outgoing_()
  , content_()
{}

notificationTypeNewPushMessage::notificationTypeNewPushMessage(int53 message_id_, object_ptr<MessageSender> &&sender_id_, string const &sender_name_, bool is_outgoing_, object_ptr<PushMessageContent> &&content_)
  : message_id_(message_id_)
  , sender_id_(std::move(sender_id_))
  , sender_name_(sender_name_)
  , is_outgoing_(is_outgoing_)
  , content_(std::move(content_))
{}

const std::int32_t notificationTypeNewPushMessage::ID;

object_ptr<NotificationType> notificationTypeNewPushMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<notificationTypeNewPushMessage> res = make_object<notificationTypeNewPushMessage>();
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->sender_name_ = jni::fetch_string(env, p, res->sender_name_fieldID);
  res->is_outgoing_ = (env->GetBooleanField(p, res->is_outgoing_fieldID) != 0);
  res->content_ = jni::fetch_tl_object<PushMessageContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  return std::move(res);
}

void notificationTypeNewPushMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, sender_name_); if (nextString) { env->SetObjectField(s, sender_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_outgoing_fieldID, is_outgoing_);
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
}

void notificationTypeNewPushMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NotificationTypeNewPushMessage");
    s.store_field("messageId", message_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("senderName", sender_name_);
    s.store_field("isOutgoing", is_outgoing_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_class_end();
  }
}

void notificationTypeNewPushMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NotificationTypeNewPushMessage").c_str());
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    sender_name_fieldID = jni::get_field_id(env, Class, "senderName", "Ljava/lang/String;");
    is_outgoing_fieldID = jni::get_field_id(env, Class, "isOutgoing", "Z");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PushMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockCaption::Class;
jfieldID pageBlockCaption::text_fieldID;
jfieldID pageBlockCaption::credit_fieldID;

pageBlockCaption::pageBlockCaption()
  : text_()
  , credit_()
{}

pageBlockCaption::pageBlockCaption(object_ptr<RichText> &&text_, object_ptr<RichText> &&credit_)
  : text_(std::move(text_))
  , credit_(std::move(credit_))
{}

const std::int32_t pageBlockCaption::ID;

object_ptr<pageBlockCaption> pageBlockCaption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockCaption> res = make_object<pageBlockCaption>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->credit_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->credit_fieldID));
  return res;
}

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

void pageBlockCaption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockCaption");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_object_field("credit", static_cast<const BaseObject *>(credit_.get()));
    s.store_class_end();
  }
}

void pageBlockCaption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockCaption").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    credit_fieldID = jni::get_field_id(env, Class, "credit", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PollType::Class;

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

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

jclass pollTypeRegular::Class;

pollTypeRegular::pollTypeRegular() {
}

const std::int32_t pollTypeRegular::ID;

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

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

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

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

jclass pollTypeQuiz::Class;
jfieldID pollTypeQuiz::correct_option_ids_fieldID;
jfieldID pollTypeQuiz::explanation_fieldID;
jfieldID pollTypeQuiz::explanation_media_fieldID;

pollTypeQuiz::pollTypeQuiz()
  : correct_option_ids_()
  , explanation_()
  , explanation_media_()
{}

pollTypeQuiz::pollTypeQuiz(array<int32> &&correct_option_ids_, object_ptr<formattedText> &&explanation_, object_ptr<MessageContent> &&explanation_media_)
  : correct_option_ids_(std::move(correct_option_ids_))
  , explanation_(std::move(explanation_))
  , explanation_media_(std::move(explanation_media_))
{}

const std::int32_t pollTypeQuiz::ID;

object_ptr<PollType> pollTypeQuiz::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pollTypeQuiz> res = make_object<pollTypeQuiz>();
  res->correct_option_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->correct_option_ids_fieldID));
  res->explanation_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->explanation_fieldID));
  res->explanation_media_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->explanation_media_fieldID));
  return std::move(res);
}

void pollTypeQuiz::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, correct_option_ids_); if (arr_tmp_) { env->SetObjectField(s, correct_option_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (explanation_ != nullptr) { jobject next; explanation_->store(env, next); if (next) { env->SetObjectField(s, explanation_fieldID, next); env->DeleteLocalRef(next); } }
  if (explanation_media_ != nullptr) { jobject next; explanation_media_->store(env, next); if (next) { env->SetObjectField(s, explanation_media_fieldID, next); env->DeleteLocalRef(next); } }
}

void pollTypeQuiz::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PollTypeQuiz");
    { s.store_vector_begin("correctOptionIds", correct_option_ids_.size()); for (const auto &_value : correct_option_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_object_field("explanation", static_cast<const BaseObject *>(explanation_.get()));
    s.store_object_field("explanationMedia", static_cast<const BaseObject *>(explanation_media_.get()));
    s.store_class_end();
  }
}

void pollTypeQuiz::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PollTypeQuiz").c_str());
    correct_option_ids_fieldID = jni::get_field_id(env, Class, "correctOptionIds", "[I");
    explanation_fieldID = jni::get_field_id(env, Class, "explanation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    explanation_media_fieldID = jni::get_field_id(env, Class, "explanationMedia", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PremiumFeature::Class;

object_ptr<PremiumFeature> PremiumFeature::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case premiumFeatureIncreasedLimits::ID:
      return premiumFeatureIncreasedLimits::fetch(env, p);
    case premiumFeatureIncreasedUploadFileSize::ID:
      return premiumFeatureIncreasedUploadFileSize::fetch(env, p);
    case premiumFeatureImprovedDownloadSpeed::ID:
      return premiumFeatureImprovedDownloadSpeed::fetch(env, p);
    case premiumFeatureVoiceRecognition::ID:
      return premiumFeatureVoiceRecognition::fetch(env, p);
    case premiumFeatureDisabledAds::ID:
      return premiumFeatureDisabledAds::fetch(env, p);
    case premiumFeatureUniqueReactions::ID:
      return premiumFeatureUniqueReactions::fetch(env, p);
    case premiumFeatureUniqueStickers::ID:
      return premiumFeatureUniqueStickers::fetch(env, p);
    case premiumFeatureCustomEmoji::ID:
      return premiumFeatureCustomEmoji::fetch(env, p);
    case premiumFeatureAdvancedChatManagement::ID:
      return premiumFeatureAdvancedChatManagement::fetch(env, p);
    case premiumFeatureProfileBadge::ID:
      return premiumFeatureProfileBadge::fetch(env, p);
    case premiumFeatureEmojiStatus::ID:
      return premiumFeatureEmojiStatus::fetch(env, p);
    case premiumFeatureAnimatedProfilePhoto::ID:
      return premiumFeatureAnimatedProfilePhoto::fetch(env, p);
    case premiumFeatureForumTopicIcon::ID:
      return premiumFeatureForumTopicIcon::fetch(env, p);
    case premiumFeatureAppIcons::ID:
      return premiumFeatureAppIcons::fetch(env, p);
    case premiumFeatureRealTimeChatTranslation::ID:
      return premiumFeatureRealTimeChatTranslation::fetch(env, p);
    case premiumFeatureUpgradedStories::ID:
      return premiumFeatureUpgradedStories::fetch(env, p);
    case premiumFeatureChatBoost::ID:
      return premiumFeatureChatBoost::fetch(env, p);
    case premiumFeatureAccentColor::ID:
      return premiumFeatureAccentColor::fetch(env, p);
    case premiumFeatureBackgroundForBoth::ID:
      return premiumFeatureBackgroundForBoth::fetch(env, p);
    case premiumFeatureSavedMessagesTags::ID:
      return premiumFeatureSavedMessagesTags::fetch(env, p);
    case premiumFeatureMessagePrivacy::ID:
      return premiumFeatureMessagePrivacy::fetch(env, p);
    case premiumFeatureLastSeenTimes::ID:
      return premiumFeatureLastSeenTimes::fetch(env, p);
    case premiumFeatureBusiness::ID:
      return premiumFeatureBusiness::fetch(env, p);
    case premiumFeatureMessageEffects::ID:
      return premiumFeatureMessageEffects::fetch(env, p);
    case premiumFeatureChecklists::ID:
      return premiumFeatureChecklists::fetch(env, p);
    case premiumFeaturePaidMessages::ID:
      return premiumFeaturePaidMessages::fetch(env, p);
    case premiumFeatureProtectPrivateChatContent::ID:
      return premiumFeatureProtectPrivateChatContent::fetch(env, p);
    case premiumFeatureTextComposition::ID:
      return premiumFeatureTextComposition::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass premiumFeatureIncreasedLimits::Class;

premiumFeatureIncreasedLimits::premiumFeatureIncreasedLimits() {
}

const std::int32_t premiumFeatureIncreasedLimits::ID;

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

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

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

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

jclass premiumFeatureIncreasedUploadFileSize::Class;

premiumFeatureIncreasedUploadFileSize::premiumFeatureIncreasedUploadFileSize() {
}

const std::int32_t premiumFeatureIncreasedUploadFileSize::ID;

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

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

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

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

jclass premiumFeatureImprovedDownloadSpeed::Class;

premiumFeatureImprovedDownloadSpeed::premiumFeatureImprovedDownloadSpeed() {
}

const std::int32_t premiumFeatureImprovedDownloadSpeed::ID;

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

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

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

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

jclass premiumFeatureVoiceRecognition::Class;

premiumFeatureVoiceRecognition::premiumFeatureVoiceRecognition() {
}

const std::int32_t premiumFeatureVoiceRecognition::ID;

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

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

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

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

jclass premiumFeatureDisabledAds::Class;

premiumFeatureDisabledAds::premiumFeatureDisabledAds() {
}

const std::int32_t premiumFeatureDisabledAds::ID;

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

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

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

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

jclass premiumFeatureUniqueReactions::Class;

premiumFeatureUniqueReactions::premiumFeatureUniqueReactions() {
}

const std::int32_t premiumFeatureUniqueReactions::ID;

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

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

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

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

jclass premiumFeatureUniqueStickers::Class;

premiumFeatureUniqueStickers::premiumFeatureUniqueStickers() {
}

const std::int32_t premiumFeatureUniqueStickers::ID;

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

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

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

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

jclass premiumFeatureCustomEmoji::Class;

premiumFeatureCustomEmoji::premiumFeatureCustomEmoji() {
}

const std::int32_t premiumFeatureCustomEmoji::ID;

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

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

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

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

jclass premiumFeatureAdvancedChatManagement::Class;

premiumFeatureAdvancedChatManagement::premiumFeatureAdvancedChatManagement() {
}

const std::int32_t premiumFeatureAdvancedChatManagement::ID;

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

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

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

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

jclass premiumFeatureProfileBadge::Class;

premiumFeatureProfileBadge::premiumFeatureProfileBadge() {
}

const std::int32_t premiumFeatureProfileBadge::ID;

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

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

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

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

jclass premiumFeatureEmojiStatus::Class;

premiumFeatureEmojiStatus::premiumFeatureEmojiStatus() {
}

const std::int32_t premiumFeatureEmojiStatus::ID;

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

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

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

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

jclass premiumFeatureAnimatedProfilePhoto::Class;

premiumFeatureAnimatedProfilePhoto::premiumFeatureAnimatedProfilePhoto() {
}

const std::int32_t premiumFeatureAnimatedProfilePhoto::ID;

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

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

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

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

jclass premiumFeatureForumTopicIcon::Class;

premiumFeatureForumTopicIcon::premiumFeatureForumTopicIcon() {
}

const std::int32_t premiumFeatureForumTopicIcon::ID;

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

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

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

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

jclass premiumFeatureAppIcons::Class;

premiumFeatureAppIcons::premiumFeatureAppIcons() {
}

const std::int32_t premiumFeatureAppIcons::ID;

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

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

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

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

jclass premiumFeatureRealTimeChatTranslation::Class;

premiumFeatureRealTimeChatTranslation::premiumFeatureRealTimeChatTranslation() {
}

const std::int32_t premiumFeatureRealTimeChatTranslation::ID;

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

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

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

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

jclass premiumFeatureUpgradedStories::Class;

premiumFeatureUpgradedStories::premiumFeatureUpgradedStories() {
}

const std::int32_t premiumFeatureUpgradedStories::ID;

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

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

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

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

jclass premiumFeatureChatBoost::Class;

premiumFeatureChatBoost::premiumFeatureChatBoost() {
}

const std::int32_t premiumFeatureChatBoost::ID;

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

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

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

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

jclass premiumFeatureAccentColor::Class;

premiumFeatureAccentColor::premiumFeatureAccentColor() {
}

const std::int32_t premiumFeatureAccentColor::ID;

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

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

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

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

jclass premiumFeatureBackgroundForBoth::Class;

premiumFeatureBackgroundForBoth::premiumFeatureBackgroundForBoth() {
}

const std::int32_t premiumFeatureBackgroundForBoth::ID;

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

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

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

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

jclass premiumFeatureSavedMessagesTags::Class;

premiumFeatureSavedMessagesTags::premiumFeatureSavedMessagesTags() {
}

const std::int32_t premiumFeatureSavedMessagesTags::ID;

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

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

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

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

jclass premiumFeatureMessagePrivacy::Class;

premiumFeatureMessagePrivacy::premiumFeatureMessagePrivacy() {
}

const std::int32_t premiumFeatureMessagePrivacy::ID;

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

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

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

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

jclass premiumFeatureLastSeenTimes::Class;

premiumFeatureLastSeenTimes::premiumFeatureLastSeenTimes() {
}

const std::int32_t premiumFeatureLastSeenTimes::ID;

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

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

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

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

jclass premiumFeatureBusiness::Class;

premiumFeatureBusiness::premiumFeatureBusiness() {
}

const std::int32_t premiumFeatureBusiness::ID;

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

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

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

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

jclass premiumFeatureMessageEffects::Class;

premiumFeatureMessageEffects::premiumFeatureMessageEffects() {
}

const std::int32_t premiumFeatureMessageEffects::ID;

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

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

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

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

jclass premiumFeatureChecklists::Class;

premiumFeatureChecklists::premiumFeatureChecklists() {
}

const std::int32_t premiumFeatureChecklists::ID;

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

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

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

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

jclass premiumFeaturePaidMessages::Class;

premiumFeaturePaidMessages::premiumFeaturePaidMessages() {
}

const std::int32_t premiumFeaturePaidMessages::ID;

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

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

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

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

jclass premiumFeatureProtectPrivateChatContent::Class;

premiumFeatureProtectPrivateChatContent::premiumFeatureProtectPrivateChatContent() {
}

const std::int32_t premiumFeatureProtectPrivateChatContent::ID;

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

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

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

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

jclass premiumFeatureTextComposition::Class;

premiumFeatureTextComposition::premiumFeatureTextComposition() {
}

const std::int32_t premiumFeatureTextComposition::ID;

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

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

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

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

jclass premiumFeatures::Class;
jfieldID premiumFeatures::features_fieldID;
jfieldID premiumFeatures::limits_fieldID;
jfieldID premiumFeatures::payment_link_fieldID;

premiumFeatures::premiumFeatures()
  : features_()
  , limits_()
  , payment_link_()
{}

premiumFeatures::premiumFeatures(array<object_ptr<PremiumFeature>> &&features_, array<object_ptr<premiumLimit>> &&limits_, object_ptr<InternalLinkType> &&payment_link_)
  : features_(std::move(features_))
  , limits_(std::move(limits_))
  , payment_link_(std::move(payment_link_))
{}

const std::int32_t premiumFeatures::ID;

object_ptr<premiumFeatures> premiumFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumFeatures> res = make_object<premiumFeatures>();
  res->features_ = jni::FetchVector<PremiumFeature>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->features_fieldID));
  res->limits_ = jni::FetchVector<premiumLimit>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->limits_fieldID));
  res->payment_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->payment_link_fieldID));
  return res;
}

void premiumFeatures::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, features_); if (arr_tmp_) { env->SetObjectField(s, features_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, limits_); if (arr_tmp_) { env->SetObjectField(s, limits_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (payment_link_ != nullptr) { jobject next; payment_link_->store(env, next); if (next) { env->SetObjectField(s, payment_link_fieldID, next); env->DeleteLocalRef(next); } }
}

void premiumFeatures::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumFeatures");
    { s.store_vector_begin("features", features_.size()); for (const auto &_value : features_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("limits", limits_.size()); for (const auto &_value : limits_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("paymentLink", static_cast<const BaseObject *>(payment_link_.get()));
    s.store_class_end();
  }
}

void premiumFeatures::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumFeatures").c_str());
    features_fieldID = jni::get_field_id(env, Class, "features", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PremiumFeature;").c_str());
    limits_fieldID = jni::get_field_id(env, Class, "limits", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PremiumLimit;").c_str());
    payment_link_fieldID = jni::get_field_id(env, Class, "paymentLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumGiftCodeInfo::Class;
jfieldID premiumGiftCodeInfo::creator_id_fieldID;
jfieldID premiumGiftCodeInfo::creation_date_fieldID;
jfieldID premiumGiftCodeInfo::is_from_giveaway_fieldID;
jfieldID premiumGiftCodeInfo::giveaway_message_id_fieldID;
jfieldID premiumGiftCodeInfo::month_count_fieldID;
jfieldID premiumGiftCodeInfo::day_count_fieldID;
jfieldID premiumGiftCodeInfo::user_id_fieldID;
jfieldID premiumGiftCodeInfo::use_date_fieldID;

premiumGiftCodeInfo::premiumGiftCodeInfo()
  : creator_id_()
  , creation_date_()
  , is_from_giveaway_()
  , giveaway_message_id_()
  , month_count_()
  , day_count_()
  , user_id_()
  , use_date_()
{}

premiumGiftCodeInfo::premiumGiftCodeInfo(object_ptr<MessageSender> &&creator_id_, int32 creation_date_, bool is_from_giveaway_, int53 giveaway_message_id_, int32 month_count_, int32 day_count_, int53 user_id_, int32 use_date_)
  : creator_id_(std::move(creator_id_))
  , creation_date_(creation_date_)
  , is_from_giveaway_(is_from_giveaway_)
  , giveaway_message_id_(giveaway_message_id_)
  , month_count_(month_count_)
  , day_count_(day_count_)
  , user_id_(user_id_)
  , use_date_(use_date_)
{}

const std::int32_t premiumGiftCodeInfo::ID;

object_ptr<premiumGiftCodeInfo> premiumGiftCodeInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumGiftCodeInfo> res = make_object<premiumGiftCodeInfo>();
  res->creator_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->creator_id_fieldID));
  res->creation_date_ = env->GetIntField(p, res->creation_date_fieldID);
  res->is_from_giveaway_ = (env->GetBooleanField(p, res->is_from_giveaway_fieldID) != 0);
  res->giveaway_message_id_ = env->GetLongField(p, res->giveaway_message_id_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->day_count_ = env->GetIntField(p, res->day_count_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->use_date_ = env->GetIntField(p, res->use_date_fieldID);
  return res;
}

void premiumGiftCodeInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (creator_id_ != nullptr) { jobject next; creator_id_->store(env, next); if (next) { env->SetObjectField(s, creator_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, creation_date_fieldID, creation_date_);
  env->SetBooleanField(s, is_from_giveaway_fieldID, is_from_giveaway_);
  env->SetLongField(s, giveaway_message_id_fieldID, giveaway_message_id_);
  env->SetIntField(s, month_count_fieldID, month_count_);
  env->SetIntField(s, day_count_fieldID, day_count_);
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetIntField(s, use_date_fieldID, use_date_);
}

void premiumGiftCodeInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumGiftCodeInfo");
    s.store_object_field("creatorId", static_cast<const BaseObject *>(creator_id_.get()));
    s.store_field("creationDate", creation_date_);
    s.store_field("isFromGiveaway", is_from_giveaway_);
    s.store_field("giveawayMessageId", giveaway_message_id_);
    s.store_field("monthCount", month_count_);
    s.store_field("dayCount", day_count_);
    s.store_field("userId", user_id_);
    s.store_field("useDate", use_date_);
    s.store_class_end();
  }
}

void premiumGiftCodeInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumGiftCodeInfo").c_str());
    creator_id_fieldID = jni::get_field_id(env, Class, "creatorId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    creation_date_fieldID = jni::get_field_id(env, Class, "creationDate", "I");
    is_from_giveaway_fieldID = jni::get_field_id(env, Class, "isFromGiveaway", "Z");
    giveaway_message_id_fieldID = jni::get_field_id(env, Class, "giveawayMessageId", "J");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    day_count_fieldID = jni::get_field_id(env, Class, "dayCount", "I");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    use_date_fieldID = jni::get_field_id(env, Class, "useDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass premiumState::Class;
jfieldID premiumState::state_fieldID;
jfieldID premiumState::payment_options_fieldID;
jfieldID premiumState::animations_fieldID;
jfieldID premiumState::business_animations_fieldID;

premiumState::premiumState()
  : state_()
  , payment_options_()
  , animations_()
  , business_animations_()
{}

premiumState::premiumState(object_ptr<formattedText> &&state_, array<object_ptr<premiumStatePaymentOption>> &&payment_options_, array<object_ptr<premiumFeaturePromotionAnimation>> &&animations_, array<object_ptr<businessFeaturePromotionAnimation>> &&business_animations_)
  : state_(std::move(state_))
  , payment_options_(std::move(payment_options_))
  , animations_(std::move(animations_))
  , business_animations_(std::move(business_animations_))
{}

const std::int32_t premiumState::ID;

object_ptr<premiumState> premiumState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumState> res = make_object<premiumState>();
  res->state_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->state_fieldID));
  res->payment_options_ = jni::FetchVector<premiumStatePaymentOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->payment_options_fieldID));
  res->animations_ = jni::FetchVector<premiumFeaturePromotionAnimation>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->animations_fieldID));
  res->business_animations_ = jni::FetchVector<businessFeaturePromotionAnimation>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->business_animations_fieldID));
  return res;
}

void premiumState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, payment_options_); if (arr_tmp_) { env->SetObjectField(s, payment_options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, animations_); if (arr_tmp_) { env->SetObjectField(s, animations_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, business_animations_); if (arr_tmp_) { env->SetObjectField(s, business_animations_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void premiumState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumState");
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    { s.store_vector_begin("paymentOptions", payment_options_.size()); for (const auto &_value : payment_options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { 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_vector_begin("businessAnimations", business_animations_.size()); for (const auto &_value : business_animations_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void premiumState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumState").c_str());
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    payment_options_fieldID = jni::get_field_id(env, Class, "paymentOptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PremiumStatePaymentOption;").c_str());
    animations_fieldID = jni::get_field_id(env, Class, "animations", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PremiumFeaturePromotionAnimation;").c_str());
    business_animations_fieldID = jni::get_field_id(env, Class, "businessAnimations", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BusinessFeaturePromotionAnimation;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass preparedInlineMessageId::Class;
jfieldID preparedInlineMessageId::id_fieldID;
jfieldID preparedInlineMessageId::expiration_date_fieldID;

preparedInlineMessageId::preparedInlineMessageId()
  : id_()
  , expiration_date_()
{}

preparedInlineMessageId::preparedInlineMessageId(string const &id_, int32 expiration_date_)
  : id_(id_)
  , expiration_date_(expiration_date_)
{}

const std::int32_t preparedInlineMessageId::ID;

object_ptr<preparedInlineMessageId> preparedInlineMessageId::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<preparedInlineMessageId> res = make_object<preparedInlineMessageId>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  return res;
}

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

void preparedInlineMessageId::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PreparedInlineMessageId");
    s.store_field("id", id_);
    s.store_field("expirationDate", expiration_date_);
    s.store_class_end();
  }
}

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

jclass ProxyType::Class;

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

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

jclass proxyTypeSocks5::Class;
jfieldID proxyTypeSocks5::username_fieldID;
jfieldID proxyTypeSocks5::password_fieldID;

proxyTypeSocks5::proxyTypeSocks5()
  : username_()
  , password_()
{}

proxyTypeSocks5::proxyTypeSocks5(string const &username_, string const &password_)
  : username_(username_)
  , password_(password_)
{}

const std::int32_t proxyTypeSocks5::ID;

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

void proxyTypeSocks5::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, username_); if (nextString) { env->SetObjectField(s, username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, password_); if (nextString) { env->SetObjectField(s, password_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass proxyTypeHttp::Class;
jfieldID proxyTypeHttp::username_fieldID;
jfieldID proxyTypeHttp::password_fieldID;
jfieldID proxyTypeHttp::http_only_fieldID;

proxyTypeHttp::proxyTypeHttp()
  : username_()
  , password_()
  , http_only_()
{}

proxyTypeHttp::proxyTypeHttp(string const &username_, string const &password_, bool http_only_)
  : username_(username_)
  , password_(password_)
  , http_only_(http_only_)
{}

const std::int32_t proxyTypeHttp::ID;

object_ptr<ProxyType> proxyTypeHttp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<proxyTypeHttp> res = make_object<proxyTypeHttp>();
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  res->http_only_ = (env->GetBooleanField(p, res->http_only_fieldID) != 0);
  return std::move(res);
}

void proxyTypeHttp::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, username_); if (nextString) { env->SetObjectField(s, username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, password_); if (nextString) { env->SetObjectField(s, password_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, http_only_fieldID, http_only_);
}

void proxyTypeHttp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProxyTypeHttp");
    s.store_field("username", username_);
    s.store_field("password", password_);
    s.store_field("httpOnly", http_only_);
    s.store_class_end();
  }
}

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

jclass proxyTypeMtproto::Class;
jfieldID proxyTypeMtproto::secret_fieldID;

proxyTypeMtproto::proxyTypeMtproto()
  : secret_()
{}

proxyTypeMtproto::proxyTypeMtproto(string const &secret_)
  : secret_(secret_)
{}

const std::int32_t proxyTypeMtproto::ID;

object_ptr<ProxyType> proxyTypeMtproto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<proxyTypeMtproto> res = make_object<proxyTypeMtproto>();
  res->secret_ = jni::fetch_string(env, p, res->secret_fieldID);
  return std::move(res);
}

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

void proxyTypeMtproto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProxyTypeMtproto");
    s.store_field("secret", secret_);
    s.store_class_end();
  }
}

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

jclass PushMessageContent::Class;

object_ptr<PushMessageContent> PushMessageContent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case pushMessageContentHidden::ID:
      return pushMessageContentHidden::fetch(env, p);
    case pushMessageContentAnimation::ID:
      return pushMessageContentAnimation::fetch(env, p);
    case pushMessageContentAudio::ID:
      return pushMessageContentAudio::fetch(env, p);
    case pushMessageContentContact::ID:
      return pushMessageContentContact::fetch(env, p);
    case pushMessageContentContactRegistered::ID:
      return pushMessageContentContactRegistered::fetch(env, p);
    case pushMessageContentDocument::ID:
      return pushMessageContentDocument::fetch(env, p);
    case pushMessageContentGame::ID:
      return pushMessageContentGame::fetch(env, p);
    case pushMessageContentGameScore::ID:
      return pushMessageContentGameScore::fetch(env, p);
    case pushMessageContentInvoice::ID:
      return pushMessageContentInvoice::fetch(env, p);
    case pushMessageContentLocation::ID:
      return pushMessageContentLocation::fetch(env, p);
    case pushMessageContentPaidMedia::ID:
      return pushMessageContentPaidMedia::fetch(env, p);
    case pushMessageContentPhoto::ID:
      return pushMessageContentPhoto::fetch(env, p);
    case pushMessageContentPoll::ID:
      return pushMessageContentPoll::fetch(env, p);
    case pushMessageContentPremiumGiftCode::ID:
      return pushMessageContentPremiumGiftCode::fetch(env, p);
    case pushMessageContentGiveaway::ID:
      return pushMessageContentGiveaway::fetch(env, p);
    case pushMessageContentGift::ID:
      return pushMessageContentGift::fetch(env, p);
    case pushMessageContentUpgradedGift::ID:
      return pushMessageContentUpgradedGift::fetch(env, p);
    case pushMessageContentScreenshotTaken::ID:
      return pushMessageContentScreenshotTaken::fetch(env, p);
    case pushMessageContentSticker::ID:
      return pushMessageContentSticker::fetch(env, p);
    case pushMessageContentStory::ID:
      return pushMessageContentStory::fetch(env, p);
    case pushMessageContentText::ID:
      return pushMessageContentText::fetch(env, p);
    case pushMessageContentChecklist::ID:
      return pushMessageContentChecklist::fetch(env, p);
    case pushMessageContentVideo::ID:
      return pushMessageContentVideo::fetch(env, p);
    case pushMessageContentVideoNote::ID:
      return pushMessageContentVideoNote::fetch(env, p);
    case pushMessageContentVoiceNote::ID:
      return pushMessageContentVoiceNote::fetch(env, p);
    case pushMessageContentBasicGroupChatCreate::ID:
      return pushMessageContentBasicGroupChatCreate::fetch(env, p);
    case pushMessageContentVideoChatStarted::ID:
      return pushMessageContentVideoChatStarted::fetch(env, p);
    case pushMessageContentVideoChatEnded::ID:
      return pushMessageContentVideoChatEnded::fetch(env, p);
    case pushMessageContentInviteVideoChatParticipants::ID:
      return pushMessageContentInviteVideoChatParticipants::fetch(env, p);
    case pushMessageContentChatAddMembers::ID:
      return pushMessageContentChatAddMembers::fetch(env, p);
    case pushMessageContentChatChangePhoto::ID:
      return pushMessageContentChatChangePhoto::fetch(env, p);
    case pushMessageContentChatChangeTitle::ID:
      return pushMessageContentChatChangeTitle::fetch(env, p);
    case pushMessageContentChatSetBackground::ID:
      return pushMessageContentChatSetBackground::fetch(env, p);
    case pushMessageContentChatSetTheme::ID:
      return pushMessageContentChatSetTheme::fetch(env, p);
    case pushMessageContentChatDeleteMember::ID:
      return pushMessageContentChatDeleteMember::fetch(env, p);
    case pushMessageContentChatJoinByLink::ID:
      return pushMessageContentChatJoinByLink::fetch(env, p);
    case pushMessageContentChatJoinByRequest::ID:
      return pushMessageContentChatJoinByRequest::fetch(env, p);
    case pushMessageContentRecurringPayment::ID:
      return pushMessageContentRecurringPayment::fetch(env, p);
    case pushMessageContentSuggestProfilePhoto::ID:
      return pushMessageContentSuggestProfilePhoto::fetch(env, p);
    case pushMessageContentSuggestBirthdate::ID:
      return pushMessageContentSuggestBirthdate::fetch(env, p);
    case pushMessageContentProximityAlertTriggered::ID:
      return pushMessageContentProximityAlertTriggered::fetch(env, p);
    case pushMessageContentChecklistTasksAdded::ID:
      return pushMessageContentChecklistTasksAdded::fetch(env, p);
    case pushMessageContentChecklistTasksDone::ID:
      return pushMessageContentChecklistTasksDone::fetch(env, p);
    case pushMessageContentPollOptionAdded::ID:
      return pushMessageContentPollOptionAdded::fetch(env, p);
    case pushMessageContentMessageForwards::ID:
      return pushMessageContentMessageForwards::fetch(env, p);
    case pushMessageContentMediaAlbum::ID:
      return pushMessageContentMediaAlbum::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass pushMessageContentHidden::Class;
jfieldID pushMessageContentHidden::is_pinned_fieldID;

pushMessageContentHidden::pushMessageContentHidden()
  : is_pinned_()
{}

pushMessageContentHidden::pushMessageContentHidden(bool is_pinned_)
  : is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentHidden::ID;

object_ptr<PushMessageContent> pushMessageContentHidden::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentHidden> res = make_object<pushMessageContentHidden>();
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

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

void pushMessageContentHidden::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentHidden");
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentAnimation::Class;
jfieldID pushMessageContentAnimation::animation_fieldID;
jfieldID pushMessageContentAnimation::caption_fieldID;
jfieldID pushMessageContentAnimation::is_pinned_fieldID;

pushMessageContentAnimation::pushMessageContentAnimation()
  : animation_()
  , caption_()
  , is_pinned_()
{}

pushMessageContentAnimation::pushMessageContentAnimation(object_ptr<animation> &&animation_, string const &caption_, bool is_pinned_)
  : animation_(std::move(animation_))
  , caption_(caption_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentAnimation::ID;

object_ptr<PushMessageContent> pushMessageContentAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentAnimation> res = make_object<pushMessageContentAnimation>();
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->caption_ = jni::fetch_string(env, p, res->caption_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentAnimation::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); } }
  { jstring nextString = jni::to_jstring(env, caption_); if (nextString) { env->SetObjectField(s, caption_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentAnimation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentAnimation");
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_field("caption", caption_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentAnimation").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", "Ljava/lang/String;");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentAudio::Class;
jfieldID pushMessageContentAudio::audio_fieldID;
jfieldID pushMessageContentAudio::is_pinned_fieldID;

pushMessageContentAudio::pushMessageContentAudio()
  : audio_()
  , is_pinned_()
{}

pushMessageContentAudio::pushMessageContentAudio(object_ptr<audio> &&audio_, bool is_pinned_)
  : audio_(std::move(audio_))
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentAudio::ID;

object_ptr<PushMessageContent> pushMessageContentAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentAudio> res = make_object<pushMessageContentAudio>();
  res->audio_ = jni::fetch_tl_object<audio>(env, jni::fetch_object(env, p, res->audio_fieldID));
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentAudio::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); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

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

void pushMessageContentAudio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentAudio").c_str());
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Audio;").c_str());
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentContact::Class;
jfieldID pushMessageContentContact::name_fieldID;
jfieldID pushMessageContentContact::is_pinned_fieldID;

pushMessageContentContact::pushMessageContentContact()
  : name_()
  , is_pinned_()
{}

pushMessageContentContact::pushMessageContentContact(string const &name_, bool is_pinned_)
  : name_(name_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentContact::ID;

object_ptr<PushMessageContent> pushMessageContentContact::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentContact> res = make_object<pushMessageContentContact>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentContact::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->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentContact::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentContact");
    s.store_field("name", name_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentContact::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentContact").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentContactRegistered::Class;
jfieldID pushMessageContentContactRegistered::as_premium_account_fieldID;

pushMessageContentContactRegistered::pushMessageContentContactRegistered()
  : as_premium_account_()
{}

pushMessageContentContactRegistered::pushMessageContentContactRegistered(bool as_premium_account_)
  : as_premium_account_(as_premium_account_)
{}

const std::int32_t pushMessageContentContactRegistered::ID;

object_ptr<PushMessageContent> pushMessageContentContactRegistered::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentContactRegistered> res = make_object<pushMessageContentContactRegistered>();
  res->as_premium_account_ = (env->GetBooleanField(p, res->as_premium_account_fieldID) != 0);
  return std::move(res);
}

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

void pushMessageContentContactRegistered::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentContactRegistered");
    s.store_field("asPremiumAccount", as_premium_account_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentDocument::Class;
jfieldID pushMessageContentDocument::document_fieldID;
jfieldID pushMessageContentDocument::is_pinned_fieldID;

pushMessageContentDocument::pushMessageContentDocument()
  : document_()
  , is_pinned_()
{}

pushMessageContentDocument::pushMessageContentDocument(object_ptr<document> &&document_, bool is_pinned_)
  : document_(std::move(document_))
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentDocument::ID;

object_ptr<PushMessageContent> pushMessageContentDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentDocument> res = make_object<pushMessageContentDocument>();
  res->document_ = jni::fetch_tl_object<document>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentDocument::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->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentDocument");
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentDocument").c_str());
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Document;").c_str());
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentGame::Class;
jfieldID pushMessageContentGame::title_fieldID;
jfieldID pushMessageContentGame::is_pinned_fieldID;

pushMessageContentGame::pushMessageContentGame()
  : title_()
  , is_pinned_()
{}

pushMessageContentGame::pushMessageContentGame(string const &title_, bool is_pinned_)
  : title_(title_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentGame::ID;

object_ptr<PushMessageContent> pushMessageContentGame::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentGame> res = make_object<pushMessageContentGame>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

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

void pushMessageContentGame::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentGame");
    s.store_field("title", title_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentGameScore::Class;
jfieldID pushMessageContentGameScore::title_fieldID;
jfieldID pushMessageContentGameScore::score_fieldID;
jfieldID pushMessageContentGameScore::is_pinned_fieldID;

pushMessageContentGameScore::pushMessageContentGameScore()
  : title_()
  , score_()
  , is_pinned_()
{}

pushMessageContentGameScore::pushMessageContentGameScore(string const &title_, int32 score_, bool is_pinned_)
  : title_(title_)
  , score_(score_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentGameScore::ID;

object_ptr<PushMessageContent> pushMessageContentGameScore::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentGameScore> res = make_object<pushMessageContentGameScore>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->score_ = env->GetIntField(p, res->score_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentGameScore::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, score_fieldID, score_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentGameScore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentGameScore");
    s.store_field("title", title_);
    s.store_field("score", score_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentGameScore::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentGameScore").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    score_fieldID = jni::get_field_id(env, Class, "score", "I");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentInvoice::Class;
jfieldID pushMessageContentInvoice::price_fieldID;
jfieldID pushMessageContentInvoice::is_pinned_fieldID;

pushMessageContentInvoice::pushMessageContentInvoice()
  : price_()
  , is_pinned_()
{}

pushMessageContentInvoice::pushMessageContentInvoice(string const &price_, bool is_pinned_)
  : price_(price_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentInvoice::ID;

object_ptr<PushMessageContent> pushMessageContentInvoice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentInvoice> res = make_object<pushMessageContentInvoice>();
  res->price_ = jni::fetch_string(env, p, res->price_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentInvoice::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, price_); if (nextString) { env->SetObjectField(s, price_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentInvoice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentInvoice");
    s.store_field("price", price_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentInvoice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentInvoice").c_str());
    price_fieldID = jni::get_field_id(env, Class, "price", "Ljava/lang/String;");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentLocation::Class;
jfieldID pushMessageContentLocation::is_live_fieldID;
jfieldID pushMessageContentLocation::is_pinned_fieldID;

pushMessageContentLocation::pushMessageContentLocation()
  : is_live_()
  , is_pinned_()
{}

pushMessageContentLocation::pushMessageContentLocation(bool is_live_, bool is_pinned_)
  : is_live_(is_live_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentLocation::ID;

object_ptr<PushMessageContent> pushMessageContentLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentLocation> res = make_object<pushMessageContentLocation>();
  res->is_live_ = (env->GetBooleanField(p, res->is_live_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentLocation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_live_fieldID, is_live_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentLocation");
    s.store_field("isLive", is_live_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentLocation").c_str());
    is_live_fieldID = jni::get_field_id(env, Class, "isLive", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentPaidMedia::Class;
jfieldID pushMessageContentPaidMedia::star_count_fieldID;
jfieldID pushMessageContentPaidMedia::is_pinned_fieldID;

pushMessageContentPaidMedia::pushMessageContentPaidMedia()
  : star_count_()
  , is_pinned_()
{}

pushMessageContentPaidMedia::pushMessageContentPaidMedia(int53 star_count_, bool is_pinned_)
  : star_count_(star_count_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentPaidMedia::ID;

object_ptr<PushMessageContent> pushMessageContentPaidMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentPaidMedia> res = make_object<pushMessageContentPaidMedia>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentPaidMedia::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_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

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

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

jclass pushMessageContentPhoto::Class;
jfieldID pushMessageContentPhoto::photo_fieldID;
jfieldID pushMessageContentPhoto::caption_fieldID;
jfieldID pushMessageContentPhoto::is_secret_fieldID;
jfieldID pushMessageContentPhoto::is_pinned_fieldID;

pushMessageContentPhoto::pushMessageContentPhoto()
  : photo_()
  , caption_()
  , is_secret_()
  , is_pinned_()
{}

pushMessageContentPhoto::pushMessageContentPhoto(object_ptr<photo> &&photo_, string const &caption_, bool is_secret_, bool is_pinned_)
  : photo_(std::move(photo_))
  , caption_(caption_)
  , is_secret_(is_secret_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentPhoto::ID;

object_ptr<PushMessageContent> pushMessageContentPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentPhoto> res = make_object<pushMessageContentPhoto>();
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->caption_ = jni::fetch_string(env, p, res->caption_fieldID);
  res->is_secret_ = (env->GetBooleanField(p, res->is_secret_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentPhoto::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, caption_); if (nextString) { env->SetObjectField(s, caption_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_secret_fieldID, is_secret_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentPhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("caption", caption_);
    s.store_field("isSecret", is_secret_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentPhoto").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", "Ljava/lang/String;");
    is_secret_fieldID = jni::get_field_id(env, Class, "isSecret", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentPoll::Class;
jfieldID pushMessageContentPoll::question_fieldID;
jfieldID pushMessageContentPoll::is_regular_fieldID;
jfieldID pushMessageContentPoll::is_pinned_fieldID;

pushMessageContentPoll::pushMessageContentPoll()
  : question_()
  , is_regular_()
  , is_pinned_()
{}

pushMessageContentPoll::pushMessageContentPoll(string const &question_, bool is_regular_, bool is_pinned_)
  : question_(question_)
  , is_regular_(is_regular_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentPoll::ID;

object_ptr<PushMessageContent> pushMessageContentPoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentPoll> res = make_object<pushMessageContentPoll>();
  res->question_ = jni::fetch_string(env, p, res->question_fieldID);
  res->is_regular_ = (env->GetBooleanField(p, res->is_regular_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentPoll::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, question_); if (nextString) { env->SetObjectField(s, question_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_regular_fieldID, is_regular_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentPoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentPoll");
    s.store_field("question", question_);
    s.store_field("isRegular", is_regular_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentPoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentPoll").c_str());
    question_fieldID = jni::get_field_id(env, Class, "question", "Ljava/lang/String;");
    is_regular_fieldID = jni::get_field_id(env, Class, "isRegular", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentPremiumGiftCode::Class;
jfieldID pushMessageContentPremiumGiftCode::month_count_fieldID;

pushMessageContentPremiumGiftCode::pushMessageContentPremiumGiftCode()
  : month_count_()
{}

pushMessageContentPremiumGiftCode::pushMessageContentPremiumGiftCode(int32 month_count_)
  : month_count_(month_count_)
{}

const std::int32_t pushMessageContentPremiumGiftCode::ID;

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

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

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

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

jclass pushMessageContentGiveaway::Class;
jfieldID pushMessageContentGiveaway::winner_count_fieldID;
jfieldID pushMessageContentGiveaway::prize_fieldID;
jfieldID pushMessageContentGiveaway::is_pinned_fieldID;

pushMessageContentGiveaway::pushMessageContentGiveaway()
  : winner_count_()
  , prize_()
  , is_pinned_()
{}

pushMessageContentGiveaway::pushMessageContentGiveaway(int32 winner_count_, object_ptr<GiveawayPrize> &&prize_, bool is_pinned_)
  : winner_count_(winner_count_)
  , prize_(std::move(prize_))
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentGiveaway::ID;

object_ptr<PushMessageContent> pushMessageContentGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentGiveaway> res = make_object<pushMessageContentGiveaway>();
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->prize_ = jni::fetch_tl_object<GiveawayPrize>(env, jni::fetch_object(env, p, res->prize_fieldID));
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentGiveaway::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, winner_count_fieldID, winner_count_);
  if (prize_ != nullptr) { jobject next; prize_->store(env, next); if (next) { env->SetObjectField(s, prize_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentGiveaway");
    s.store_field("winnerCount", winner_count_);
    s.store_object_field("prize", static_cast<const BaseObject *>(prize_.get()));
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentGiveaway").c_str());
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    prize_fieldID = jni::get_field_id(env, Class, "prize", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayPrize;").c_str());
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentGift::Class;
jfieldID pushMessageContentGift::star_count_fieldID;
jfieldID pushMessageContentGift::is_prepaid_upgrade_fieldID;

pushMessageContentGift::pushMessageContentGift()
  : star_count_()
  , is_prepaid_upgrade_()
{}

pushMessageContentGift::pushMessageContentGift(int53 star_count_, bool is_prepaid_upgrade_)
  : star_count_(star_count_)
  , is_prepaid_upgrade_(is_prepaid_upgrade_)
{}

const std::int32_t pushMessageContentGift::ID;

object_ptr<PushMessageContent> pushMessageContentGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentGift> res = make_object<pushMessageContentGift>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->is_prepaid_upgrade_ = (env->GetBooleanField(p, res->is_prepaid_upgrade_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentGift::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_);
  env->SetBooleanField(s, is_prepaid_upgrade_fieldID, is_prepaid_upgrade_);
}

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

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

jclass pushMessageContentUpgradedGift::Class;
jfieldID pushMessageContentUpgradedGift::is_upgrade_fieldID;
jfieldID pushMessageContentUpgradedGift::is_prepaid_upgrade_fieldID;

pushMessageContentUpgradedGift::pushMessageContentUpgradedGift()
  : is_upgrade_()
  , is_prepaid_upgrade_()
{}

pushMessageContentUpgradedGift::pushMessageContentUpgradedGift(bool is_upgrade_, bool is_prepaid_upgrade_)
  : is_upgrade_(is_upgrade_)
  , is_prepaid_upgrade_(is_prepaid_upgrade_)
{}

const std::int32_t pushMessageContentUpgradedGift::ID;

object_ptr<PushMessageContent> pushMessageContentUpgradedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentUpgradedGift> res = make_object<pushMessageContentUpgradedGift>();
  res->is_upgrade_ = (env->GetBooleanField(p, res->is_upgrade_fieldID) != 0);
  res->is_prepaid_upgrade_ = (env->GetBooleanField(p, res->is_prepaid_upgrade_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentUpgradedGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_upgrade_fieldID, is_upgrade_);
  env->SetBooleanField(s, is_prepaid_upgrade_fieldID, is_prepaid_upgrade_);
}

void pushMessageContentUpgradedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentUpgradedGift");
    s.store_field("isUpgrade", is_upgrade_);
    s.store_field("isPrepaidUpgrade", is_prepaid_upgrade_);
    s.store_class_end();
  }
}

void pushMessageContentUpgradedGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentUpgradedGift").c_str());
    is_upgrade_fieldID = jni::get_field_id(env, Class, "isUpgrade", "Z");
    is_prepaid_upgrade_fieldID = jni::get_field_id(env, Class, "isPrepaidUpgrade", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentScreenshotTaken::Class;

pushMessageContentScreenshotTaken::pushMessageContentScreenshotTaken() {
}

const std::int32_t pushMessageContentScreenshotTaken::ID;

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

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

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

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

jclass pushMessageContentSticker::Class;
jfieldID pushMessageContentSticker::sticker_fieldID;
jfieldID pushMessageContentSticker::emoji_fieldID;
jfieldID pushMessageContentSticker::is_pinned_fieldID;

pushMessageContentSticker::pushMessageContentSticker()
  : sticker_()
  , emoji_()
  , is_pinned_()
{}

pushMessageContentSticker::pushMessageContentSticker(object_ptr<sticker> &&sticker_, string const &emoji_, bool is_pinned_)
  : sticker_(std::move(sticker_))
  , emoji_(emoji_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentSticker::ID;

object_ptr<PushMessageContent> pushMessageContentSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentSticker> res = make_object<pushMessageContentSticker>();
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentSticker::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); } }
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentSticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentSticker");
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_field("emoji", emoji_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentSticker").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentStory::Class;
jfieldID pushMessageContentStory::is_mention_fieldID;
jfieldID pushMessageContentStory::is_pinned_fieldID;

pushMessageContentStory::pushMessageContentStory()
  : is_mention_()
  , is_pinned_()
{}

pushMessageContentStory::pushMessageContentStory(bool is_mention_, bool is_pinned_)
  : is_mention_(is_mention_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentStory::ID;

object_ptr<PushMessageContent> pushMessageContentStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentStory> res = make_object<pushMessageContentStory>();
  res->is_mention_ = (env->GetBooleanField(p, res->is_mention_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentStory::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_mention_fieldID, is_mention_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentStory");
    s.store_field("isMention", is_mention_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentStory").c_str());
    is_mention_fieldID = jni::get_field_id(env, Class, "isMention", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentText::Class;
jfieldID pushMessageContentText::text_fieldID;
jfieldID pushMessageContentText::is_pinned_fieldID;

pushMessageContentText::pushMessageContentText()
  : text_()
  , is_pinned_()
{}

pushMessageContentText::pushMessageContentText(string const &text_, bool is_pinned_)
  : text_(text_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentText::ID;

object_ptr<PushMessageContent> pushMessageContentText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentText> res = make_object<pushMessageContentText>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentText::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); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

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

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

jclass pushMessageContentChecklist::Class;
jfieldID pushMessageContentChecklist::title_fieldID;
jfieldID pushMessageContentChecklist::is_pinned_fieldID;

pushMessageContentChecklist::pushMessageContentChecklist()
  : title_()
  , is_pinned_()
{}

pushMessageContentChecklist::pushMessageContentChecklist(string const &title_, bool is_pinned_)
  : title_(title_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentChecklist::ID;

object_ptr<PushMessageContent> pushMessageContentChecklist::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChecklist> res = make_object<pushMessageContentChecklist>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

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

void pushMessageContentChecklist::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChecklist");
    s.store_field("title", title_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentVideo::Class;
jfieldID pushMessageContentVideo::video_fieldID;
jfieldID pushMessageContentVideo::caption_fieldID;
jfieldID pushMessageContentVideo::is_secret_fieldID;
jfieldID pushMessageContentVideo::is_pinned_fieldID;

pushMessageContentVideo::pushMessageContentVideo()
  : video_()
  , caption_()
  , is_secret_()
  , is_pinned_()
{}

pushMessageContentVideo::pushMessageContentVideo(object_ptr<video> &&video_, string const &caption_, bool is_secret_, bool is_pinned_)
  : video_(std::move(video_))
  , caption_(caption_)
  , is_secret_(is_secret_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentVideo::ID;

object_ptr<PushMessageContent> pushMessageContentVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentVideo> res = make_object<pushMessageContentVideo>();
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->caption_ = jni::fetch_string(env, p, res->caption_fieldID);
  res->is_secret_ = (env->GetBooleanField(p, res->is_secret_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentVideo::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); } }
  { jstring nextString = jni::to_jstring(env, caption_); if (nextString) { env->SetObjectField(s, caption_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_secret_fieldID, is_secret_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_field("caption", caption_);
    s.store_field("isSecret", is_secret_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", "Ljava/lang/String;");
    is_secret_fieldID = jni::get_field_id(env, Class, "isSecret", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentVideoNote::Class;
jfieldID pushMessageContentVideoNote::video_note_fieldID;
jfieldID pushMessageContentVideoNote::is_pinned_fieldID;

pushMessageContentVideoNote::pushMessageContentVideoNote()
  : video_note_()
  , is_pinned_()
{}

pushMessageContentVideoNote::pushMessageContentVideoNote(object_ptr<videoNote> &&video_note_, bool is_pinned_)
  : video_note_(std::move(video_note_))
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentVideoNote::ID;

object_ptr<PushMessageContent> pushMessageContentVideoNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentVideoNote> res = make_object<pushMessageContentVideoNote>();
  res->video_note_ = jni::fetch_tl_object<videoNote>(env, jni::fetch_object(env, p, res->video_note_fieldID));
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentVideoNote::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); } }
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentVideoNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentVideoNote");
    s.store_object_field("videoNote", static_cast<const BaseObject *>(video_note_.get()));
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentVideoNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentVideoNote").c_str());
    video_note_fieldID = jni::get_field_id(env, Class, "videoNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VideoNote;").c_str());
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentVoiceNote::Class;
jfieldID pushMessageContentVoiceNote::voice_note_fieldID;
jfieldID pushMessageContentVoiceNote::is_pinned_fieldID;

pushMessageContentVoiceNote::pushMessageContentVoiceNote()
  : voice_note_()
  , is_pinned_()
{}

pushMessageContentVoiceNote::pushMessageContentVoiceNote(object_ptr<voiceNote> &&voice_note_, bool is_pinned_)
  : voice_note_(std::move(voice_note_))
  , is_pinned_(is_pinned_)
{}

const std::int32_t pushMessageContentVoiceNote::ID;

object_ptr<PushMessageContent> pushMessageContentVoiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentVoiceNote> res = make_object<pushMessageContentVoiceNote>();
  res->voice_note_ = jni::fetch_tl_object<voiceNote>(env, jni::fetch_object(env, p, res->voice_note_fieldID));
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentVoiceNote::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->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
}

void pushMessageContentVoiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentVoiceNote");
    s.store_object_field("voiceNote", static_cast<const BaseObject *>(voice_note_.get()));
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

void pushMessageContentVoiceNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentVoiceNote").c_str());
    voice_note_fieldID = jni::get_field_id(env, Class, "voiceNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VoiceNote;").c_str());
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentBasicGroupChatCreate::Class;

pushMessageContentBasicGroupChatCreate::pushMessageContentBasicGroupChatCreate() {
}

const std::int32_t pushMessageContentBasicGroupChatCreate::ID;

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

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

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

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

jclass pushMessageContentVideoChatStarted::Class;

pushMessageContentVideoChatStarted::pushMessageContentVideoChatStarted() {
}

const std::int32_t pushMessageContentVideoChatStarted::ID;

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

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

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

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

jclass pushMessageContentVideoChatEnded::Class;

pushMessageContentVideoChatEnded::pushMessageContentVideoChatEnded() {
}

const std::int32_t pushMessageContentVideoChatEnded::ID;

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

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

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

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

jclass pushMessageContentInviteVideoChatParticipants::Class;
jfieldID pushMessageContentInviteVideoChatParticipants::is_current_user_fieldID;

pushMessageContentInviteVideoChatParticipants::pushMessageContentInviteVideoChatParticipants()
  : is_current_user_()
{}

pushMessageContentInviteVideoChatParticipants::pushMessageContentInviteVideoChatParticipants(bool is_current_user_)
  : is_current_user_(is_current_user_)
{}

const std::int32_t pushMessageContentInviteVideoChatParticipants::ID;

object_ptr<PushMessageContent> pushMessageContentInviteVideoChatParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentInviteVideoChatParticipants> res = make_object<pushMessageContentInviteVideoChatParticipants>();
  res->is_current_user_ = (env->GetBooleanField(p, res->is_current_user_fieldID) != 0);
  return std::move(res);
}

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

void pushMessageContentInviteVideoChatParticipants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentInviteVideoChatParticipants");
    s.store_field("isCurrentUser", is_current_user_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentChatAddMembers::Class;
jfieldID pushMessageContentChatAddMembers::member_name_fieldID;
jfieldID pushMessageContentChatAddMembers::is_current_user_fieldID;
jfieldID pushMessageContentChatAddMembers::is_returned_fieldID;

pushMessageContentChatAddMembers::pushMessageContentChatAddMembers()
  : member_name_()
  , is_current_user_()
  , is_returned_()
{}

pushMessageContentChatAddMembers::pushMessageContentChatAddMembers(string const &member_name_, bool is_current_user_, bool is_returned_)
  : member_name_(member_name_)
  , is_current_user_(is_current_user_)
  , is_returned_(is_returned_)
{}

const std::int32_t pushMessageContentChatAddMembers::ID;

object_ptr<PushMessageContent> pushMessageContentChatAddMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChatAddMembers> res = make_object<pushMessageContentChatAddMembers>();
  res->member_name_ = jni::fetch_string(env, p, res->member_name_fieldID);
  res->is_current_user_ = (env->GetBooleanField(p, res->is_current_user_fieldID) != 0);
  res->is_returned_ = (env->GetBooleanField(p, res->is_returned_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentChatAddMembers::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, member_name_); if (nextString) { env->SetObjectField(s, member_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_current_user_fieldID, is_current_user_);
  env->SetBooleanField(s, is_returned_fieldID, is_returned_);
}

void pushMessageContentChatAddMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChatAddMembers");
    s.store_field("memberName", member_name_);
    s.store_field("isCurrentUser", is_current_user_);
    s.store_field("isReturned", is_returned_);
    s.store_class_end();
  }
}

void pushMessageContentChatAddMembers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentChatAddMembers").c_str());
    member_name_fieldID = jni::get_field_id(env, Class, "memberName", "Ljava/lang/String;");
    is_current_user_fieldID = jni::get_field_id(env, Class, "isCurrentUser", "Z");
    is_returned_fieldID = jni::get_field_id(env, Class, "isReturned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentChatChangePhoto::Class;

pushMessageContentChatChangePhoto::pushMessageContentChatChangePhoto() {
}

const std::int32_t pushMessageContentChatChangePhoto::ID;

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

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

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

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

jclass pushMessageContentChatChangeTitle::Class;
jfieldID pushMessageContentChatChangeTitle::title_fieldID;

pushMessageContentChatChangeTitle::pushMessageContentChatChangeTitle()
  : title_()
{}

pushMessageContentChatChangeTitle::pushMessageContentChatChangeTitle(string const &title_)
  : title_(title_)
{}

const std::int32_t pushMessageContentChatChangeTitle::ID;

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

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

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

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

jclass pushMessageContentChatSetBackground::Class;
jfieldID pushMessageContentChatSetBackground::is_same_fieldID;

pushMessageContentChatSetBackground::pushMessageContentChatSetBackground()
  : is_same_()
{}

pushMessageContentChatSetBackground::pushMessageContentChatSetBackground(bool is_same_)
  : is_same_(is_same_)
{}

const std::int32_t pushMessageContentChatSetBackground::ID;

object_ptr<PushMessageContent> pushMessageContentChatSetBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChatSetBackground> res = make_object<pushMessageContentChatSetBackground>();
  res->is_same_ = (env->GetBooleanField(p, res->is_same_fieldID) != 0);
  return std::move(res);
}

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

void pushMessageContentChatSetBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChatSetBackground");
    s.store_field("isSame", is_same_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentChatSetTheme::Class;
jfieldID pushMessageContentChatSetTheme::name_fieldID;

pushMessageContentChatSetTheme::pushMessageContentChatSetTheme()
  : name_()
{}

pushMessageContentChatSetTheme::pushMessageContentChatSetTheme(string const &name_)
  : name_(name_)
{}

const std::int32_t pushMessageContentChatSetTheme::ID;

object_ptr<PushMessageContent> pushMessageContentChatSetTheme::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChatSetTheme> res = make_object<pushMessageContentChatSetTheme>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return std::move(res);
}

void pushMessageContentChatSetTheme::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 pushMessageContentChatSetTheme::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChatSetTheme");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentChatDeleteMember::Class;
jfieldID pushMessageContentChatDeleteMember::member_name_fieldID;
jfieldID pushMessageContentChatDeleteMember::is_current_user_fieldID;
jfieldID pushMessageContentChatDeleteMember::is_left_fieldID;

pushMessageContentChatDeleteMember::pushMessageContentChatDeleteMember()
  : member_name_()
  , is_current_user_()
  , is_left_()
{}

pushMessageContentChatDeleteMember::pushMessageContentChatDeleteMember(string const &member_name_, bool is_current_user_, bool is_left_)
  : member_name_(member_name_)
  , is_current_user_(is_current_user_)
  , is_left_(is_left_)
{}

const std::int32_t pushMessageContentChatDeleteMember::ID;

object_ptr<PushMessageContent> pushMessageContentChatDeleteMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChatDeleteMember> res = make_object<pushMessageContentChatDeleteMember>();
  res->member_name_ = jni::fetch_string(env, p, res->member_name_fieldID);
  res->is_current_user_ = (env->GetBooleanField(p, res->is_current_user_fieldID) != 0);
  res->is_left_ = (env->GetBooleanField(p, res->is_left_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentChatDeleteMember::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, member_name_); if (nextString) { env->SetObjectField(s, member_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_current_user_fieldID, is_current_user_);
  env->SetBooleanField(s, is_left_fieldID, is_left_);
}

void pushMessageContentChatDeleteMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChatDeleteMember");
    s.store_field("memberName", member_name_);
    s.store_field("isCurrentUser", is_current_user_);
    s.store_field("isLeft", is_left_);
    s.store_class_end();
  }
}

void pushMessageContentChatDeleteMember::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentChatDeleteMember").c_str());
    member_name_fieldID = jni::get_field_id(env, Class, "memberName", "Ljava/lang/String;");
    is_current_user_fieldID = jni::get_field_id(env, Class, "isCurrentUser", "Z");
    is_left_fieldID = jni::get_field_id(env, Class, "isLeft", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pushMessageContentChatJoinByLink::Class;

pushMessageContentChatJoinByLink::pushMessageContentChatJoinByLink() {
}

const std::int32_t pushMessageContentChatJoinByLink::ID;

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

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

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

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

jclass pushMessageContentChatJoinByRequest::Class;

pushMessageContentChatJoinByRequest::pushMessageContentChatJoinByRequest() {
}

const std::int32_t pushMessageContentChatJoinByRequest::ID;

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

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

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

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

jclass pushMessageContentRecurringPayment::Class;
jfieldID pushMessageContentRecurringPayment::amount_fieldID;

pushMessageContentRecurringPayment::pushMessageContentRecurringPayment()
  : amount_()
{}

pushMessageContentRecurringPayment::pushMessageContentRecurringPayment(string const &amount_)
  : amount_(amount_)
{}

const std::int32_t pushMessageContentRecurringPayment::ID;

object_ptr<PushMessageContent> pushMessageContentRecurringPayment::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentRecurringPayment> res = make_object<pushMessageContentRecurringPayment>();
  res->amount_ = jni::fetch_string(env, p, res->amount_fieldID);
  return std::move(res);
}

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

void pushMessageContentRecurringPayment::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentRecurringPayment");
    s.store_field("amount", amount_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentSuggestProfilePhoto::Class;

pushMessageContentSuggestProfilePhoto::pushMessageContentSuggestProfilePhoto() {
}

const std::int32_t pushMessageContentSuggestProfilePhoto::ID;

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

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

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

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

jclass pushMessageContentSuggestBirthdate::Class;

pushMessageContentSuggestBirthdate::pushMessageContentSuggestBirthdate() {
}

const std::int32_t pushMessageContentSuggestBirthdate::ID;

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

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

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

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

jclass pushMessageContentProximityAlertTriggered::Class;
jfieldID pushMessageContentProximityAlertTriggered::distance_fieldID;

pushMessageContentProximityAlertTriggered::pushMessageContentProximityAlertTriggered()
  : distance_()
{}

pushMessageContentProximityAlertTriggered::pushMessageContentProximityAlertTriggered(int32 distance_)
  : distance_(distance_)
{}

const std::int32_t pushMessageContentProximityAlertTriggered::ID;

object_ptr<PushMessageContent> pushMessageContentProximityAlertTriggered::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentProximityAlertTriggered> res = make_object<pushMessageContentProximityAlertTriggered>();
  res->distance_ = env->GetIntField(p, res->distance_fieldID);
  return std::move(res);
}

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

void pushMessageContentProximityAlertTriggered::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentProximityAlertTriggered");
    s.store_field("distance", distance_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentChecklistTasksAdded::Class;
jfieldID pushMessageContentChecklistTasksAdded::task_count_fieldID;

pushMessageContentChecklistTasksAdded::pushMessageContentChecklistTasksAdded()
  : task_count_()
{}

pushMessageContentChecklistTasksAdded::pushMessageContentChecklistTasksAdded(int32 task_count_)
  : task_count_(task_count_)
{}

const std::int32_t pushMessageContentChecklistTasksAdded::ID;

object_ptr<PushMessageContent> pushMessageContentChecklistTasksAdded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChecklistTasksAdded> res = make_object<pushMessageContentChecklistTasksAdded>();
  res->task_count_ = env->GetIntField(p, res->task_count_fieldID);
  return std::move(res);
}

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

void pushMessageContentChecklistTasksAdded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChecklistTasksAdded");
    s.store_field("taskCount", task_count_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentChecklistTasksDone::Class;
jfieldID pushMessageContentChecklistTasksDone::task_count_fieldID;

pushMessageContentChecklistTasksDone::pushMessageContentChecklistTasksDone()
  : task_count_()
{}

pushMessageContentChecklistTasksDone::pushMessageContentChecklistTasksDone(int32 task_count_)
  : task_count_(task_count_)
{}

const std::int32_t pushMessageContentChecklistTasksDone::ID;

object_ptr<PushMessageContent> pushMessageContentChecklistTasksDone::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentChecklistTasksDone> res = make_object<pushMessageContentChecklistTasksDone>();
  res->task_count_ = env->GetIntField(p, res->task_count_fieldID);
  return std::move(res);
}

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

void pushMessageContentChecklistTasksDone::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentChecklistTasksDone");
    s.store_field("taskCount", task_count_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentPollOptionAdded::Class;
jfieldID pushMessageContentPollOptionAdded::text_fieldID;

pushMessageContentPollOptionAdded::pushMessageContentPollOptionAdded()
  : text_()
{}

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

const std::int32_t pushMessageContentPollOptionAdded::ID;

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

void pushMessageContentPollOptionAdded::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 pushMessageContentPollOptionAdded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentPollOptionAdded");
    s.store_field("text", text_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentMessageForwards::Class;
jfieldID pushMessageContentMessageForwards::total_count_fieldID;

pushMessageContentMessageForwards::pushMessageContentMessageForwards()
  : total_count_()
{}

pushMessageContentMessageForwards::pushMessageContentMessageForwards(int32 total_count_)
  : total_count_(total_count_)
{}

const std::int32_t pushMessageContentMessageForwards::ID;

object_ptr<PushMessageContent> pushMessageContentMessageForwards::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentMessageForwards> res = make_object<pushMessageContentMessageForwards>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  return std::move(res);
}

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

void pushMessageContentMessageForwards::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentMessageForwards");
    s.store_field("totalCount", total_count_);
    s.store_class_end();
  }
}

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

jclass pushMessageContentMediaAlbum::Class;
jfieldID pushMessageContentMediaAlbum::total_count_fieldID;
jfieldID pushMessageContentMediaAlbum::has_photos_fieldID;
jfieldID pushMessageContentMediaAlbum::has_videos_fieldID;
jfieldID pushMessageContentMediaAlbum::has_audios_fieldID;
jfieldID pushMessageContentMediaAlbum::has_documents_fieldID;

pushMessageContentMediaAlbum::pushMessageContentMediaAlbum()
  : total_count_()
  , has_photos_()
  , has_videos_()
  , has_audios_()
  , has_documents_()
{}

pushMessageContentMediaAlbum::pushMessageContentMediaAlbum(int32 total_count_, bool has_photos_, bool has_videos_, bool has_audios_, bool has_documents_)
  : total_count_(total_count_)
  , has_photos_(has_photos_)
  , has_videos_(has_videos_)
  , has_audios_(has_audios_)
  , has_documents_(has_documents_)
{}

const std::int32_t pushMessageContentMediaAlbum::ID;

object_ptr<PushMessageContent> pushMessageContentMediaAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pushMessageContentMediaAlbum> res = make_object<pushMessageContentMediaAlbum>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->has_photos_ = (env->GetBooleanField(p, res->has_photos_fieldID) != 0);
  res->has_videos_ = (env->GetBooleanField(p, res->has_videos_fieldID) != 0);
  res->has_audios_ = (env->GetBooleanField(p, res->has_audios_fieldID) != 0);
  res->has_documents_ = (env->GetBooleanField(p, res->has_documents_fieldID) != 0);
  return std::move(res);
}

void pushMessageContentMediaAlbum::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_);
  env->SetBooleanField(s, has_photos_fieldID, has_photos_);
  env->SetBooleanField(s, has_videos_fieldID, has_videos_);
  env->SetBooleanField(s, has_audios_fieldID, has_audios_);
  env->SetBooleanField(s, has_documents_fieldID, has_documents_);
}

void pushMessageContentMediaAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PushMessageContentMediaAlbum");
    s.store_field("totalCount", total_count_);
    s.store_field("hasPhotos", has_photos_);
    s.store_field("hasVideos", has_videos_);
    s.store_field("hasAudios", has_audios_);
    s.store_field("hasDocuments", has_documents_);
    s.store_class_end();
  }
}

void pushMessageContentMediaAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PushMessageContentMediaAlbum").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    has_photos_fieldID = jni::get_field_id(env, Class, "hasPhotos", "Z");
    has_videos_fieldID = jni::get_field_id(env, Class, "hasVideos", "Z");
    has_audios_fieldID = jni::get_field_id(env, Class, "hasAudios", "Z");
    has_documents_fieldID = jni::get_field_id(env, Class, "hasDocuments", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass ReportChatResult::Class;

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

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

jclass reportChatResultOk::Class;

reportChatResultOk::reportChatResultOk() {
}

const std::int32_t reportChatResultOk::ID;

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

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

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

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

jclass reportChatResultOptionRequired::Class;
jfieldID reportChatResultOptionRequired::title_fieldID;
jfieldID reportChatResultOptionRequired::options_fieldID;

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

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

const std::int32_t reportChatResultOptionRequired::ID;

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

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

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

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

jclass reportChatResultTextRequired::Class;
jfieldID reportChatResultTextRequired::option_id_fieldID;
jfieldID reportChatResultTextRequired::is_optional_fieldID;

reportChatResultTextRequired::reportChatResultTextRequired()
  : option_id_()
  , is_optional_()
{}

reportChatResultTextRequired::reportChatResultTextRequired(bytes const &option_id_, bool is_optional_)
  : option_id_(std::move(option_id_))
  , is_optional_(is_optional_)
{}

const std::int32_t reportChatResultTextRequired::ID;

object_ptr<ReportChatResult> reportChatResultTextRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportChatResultTextRequired> res = make_object<reportChatResultTextRequired>();
  res->option_id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->option_id_fieldID));
  res->is_optional_ = (env->GetBooleanField(p, res->is_optional_fieldID) != 0);
  return std::move(res);
}

void reportChatResultTextRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jbyteArray nextBytes = jni::to_bytes(env, option_id_); if (nextBytes) { env->SetObjectField(s, option_id_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  env->SetBooleanField(s, is_optional_fieldID, is_optional_);
}

void reportChatResultTextRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportChatResultTextRequired");
    s.store_bytes_field("optionId", option_id_);
    s.store_field("isOptional", is_optional_);
    s.store_class_end();
  }
}

void reportChatResultTextRequired::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportChatResultTextRequired").c_str());
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "[B");
    is_optional_fieldID = jni::get_field_id(env, Class, "isOptional", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass reportChatResultMessagesRequired::Class;

reportChatResultMessagesRequired::reportChatResultMessagesRequired() {
}

const std::int32_t reportChatResultMessagesRequired::ID;

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

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

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

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

jclass ReportReason::Class;

object_ptr<ReportReason> ReportReason::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case reportReasonSpam::ID:
      return reportReasonSpam::fetch(env, p);
    case reportReasonViolence::ID:
      return reportReasonViolence::fetch(env, p);
    case reportReasonPornography::ID:
      return reportReasonPornography::fetch(env, p);
    case reportReasonChildAbuse::ID:
      return reportReasonChildAbuse::fetch(env, p);
    case reportReasonCopyright::ID:
      return reportReasonCopyright::fetch(env, p);
    case reportReasonUnrelatedLocation::ID:
      return reportReasonUnrelatedLocation::fetch(env, p);
    case reportReasonFake::ID:
      return reportReasonFake::fetch(env, p);
    case reportReasonIllegalDrugs::ID:
      return reportReasonIllegalDrugs::fetch(env, p);
    case reportReasonPersonalDetails::ID:
      return reportReasonPersonalDetails::fetch(env, p);
    case reportReasonCustom::ID:
      return reportReasonCustom::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass reportReasonSpam::Class;

reportReasonSpam::reportReasonSpam() {
}

const std::int32_t reportReasonSpam::ID;

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

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

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

jclass reportReasonViolence::Class;

reportReasonViolence::reportReasonViolence() {
}

const std::int32_t reportReasonViolence::ID;

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

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

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

jclass reportReasonPornography::Class;

reportReasonPornography::reportReasonPornography() {
}

const std::int32_t reportReasonPornography::ID;

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

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

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

jclass reportReasonChildAbuse::Class;

reportReasonChildAbuse::reportReasonChildAbuse() {
}

const std::int32_t reportReasonChildAbuse::ID;

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

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

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

jclass reportReasonCopyright::Class;

reportReasonCopyright::reportReasonCopyright() {
}

const std::int32_t reportReasonCopyright::ID;

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

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

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

jclass reportReasonUnrelatedLocation::Class;

reportReasonUnrelatedLocation::reportReasonUnrelatedLocation() {
}

const std::int32_t reportReasonUnrelatedLocation::ID;

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

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

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

jclass reportReasonFake::Class;

reportReasonFake::reportReasonFake() {
}

const std::int32_t reportReasonFake::ID;

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

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

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

jclass reportReasonIllegalDrugs::Class;

reportReasonIllegalDrugs::reportReasonIllegalDrugs() {
}

const std::int32_t reportReasonIllegalDrugs::ID;

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

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

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

jclass reportReasonPersonalDetails::Class;

reportReasonPersonalDetails::reportReasonPersonalDetails() {
}

const std::int32_t reportReasonPersonalDetails::ID;

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

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

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

jclass reportReasonCustom::Class;

reportReasonCustom::reportReasonCustom() {
}

const std::int32_t reportReasonCustom::ID;

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

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

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

jclass RevenueWithdrawalState::Class;

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

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

jclass revenueWithdrawalStatePending::Class;

revenueWithdrawalStatePending::revenueWithdrawalStatePending() {
}

const std::int32_t revenueWithdrawalStatePending::ID;

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

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

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

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

jclass revenueWithdrawalStateSucceeded::Class;
jfieldID revenueWithdrawalStateSucceeded::date_fieldID;
jfieldID revenueWithdrawalStateSucceeded::url_fieldID;

revenueWithdrawalStateSucceeded::revenueWithdrawalStateSucceeded()
  : date_()
  , url_()
{}

revenueWithdrawalStateSucceeded::revenueWithdrawalStateSucceeded(int32 date_, string const &url_)
  : date_(date_)
  , url_(url_)
{}

const std::int32_t revenueWithdrawalStateSucceeded::ID;

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

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

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

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

jclass revenueWithdrawalStateFailed::Class;

revenueWithdrawalStateFailed::revenueWithdrawalStateFailed() {
}

const std::int32_t revenueWithdrawalStateFailed::ID;

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

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

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

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

jclass secretChat::Class;
jfieldID secretChat::id_fieldID;
jfieldID secretChat::user_id_fieldID;
jfieldID secretChat::state_fieldID;
jfieldID secretChat::is_outbound_fieldID;
jfieldID secretChat::key_hash_fieldID;
jfieldID secretChat::layer_fieldID;

secretChat::secretChat()
  : id_()
  , user_id_()
  , state_()
  , is_outbound_()
  , key_hash_()
  , layer_()
{}

secretChat::secretChat(int32 id_, int53 user_id_, object_ptr<SecretChatState> &&state_, bool is_outbound_, bytes const &key_hash_, int32 layer_)
  : id_(id_)
  , user_id_(user_id_)
  , state_(std::move(state_))
  , is_outbound_(is_outbound_)
  , key_hash_(std::move(key_hash_))
  , layer_(layer_)
{}

const std::int32_t secretChat::ID;

object_ptr<secretChat> secretChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<secretChat> res = make_object<secretChat>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->state_ = jni::fetch_tl_object<SecretChatState>(env, jni::fetch_object(env, p, res->state_fieldID));
  res->is_outbound_ = (env->GetBooleanField(p, res->is_outbound_fieldID) != 0);
  res->key_hash_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->key_hash_fieldID));
  res->layer_ = env->GetIntField(p, res->layer_fieldID);
  return res;
}

void secretChat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_outbound_fieldID, is_outbound_);
  { jbyteArray nextBytes = jni::to_bytes(env, key_hash_); if (nextBytes) { env->SetObjectField(s, key_hash_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  env->SetIntField(s, layer_fieldID, layer_);
}

void secretChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SecretChat");
    s.store_field("id", id_);
    s.store_field("userId", user_id_);
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_field("isOutbound", is_outbound_);
    s.store_bytes_field("keyHash", key_hash_);
    s.store_field("layer", layer_);
    s.store_class_end();
  }
}

void secretChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SecretChat").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SecretChatState;").c_str());
    is_outbound_fieldID = jni::get_field_id(env, Class, "isOutbound", "Z");
    key_hash_fieldID = jni::get_field_id(env, Class, "keyHash", "[B");
    layer_fieldID = jni::get_field_id(env, Class, "layer", "I");
    return true;
  }();
  (void)is_inited;
}

jclass starGiveawayPaymentOption::Class;
jfieldID starGiveawayPaymentOption::currency_fieldID;
jfieldID starGiveawayPaymentOption::amount_fieldID;
jfieldID starGiveawayPaymentOption::star_count_fieldID;
jfieldID starGiveawayPaymentOption::store_product_id_fieldID;
jfieldID starGiveawayPaymentOption::yearly_boost_count_fieldID;
jfieldID starGiveawayPaymentOption::winner_options_fieldID;
jfieldID starGiveawayPaymentOption::is_default_fieldID;
jfieldID starGiveawayPaymentOption::is_additional_fieldID;

starGiveawayPaymentOption::starGiveawayPaymentOption()
  : currency_()
  , amount_()
  , star_count_()
  , store_product_id_()
  , yearly_boost_count_()
  , winner_options_()
  , is_default_()
  , is_additional_()
{}

starGiveawayPaymentOption::starGiveawayPaymentOption(string const &currency_, int53 amount_, int53 star_count_, string const &store_product_id_, int32 yearly_boost_count_, array<object_ptr<starGiveawayWinnerOption>> &&winner_options_, bool is_default_, bool is_additional_)
  : currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
  , store_product_id_(store_product_id_)
  , yearly_boost_count_(yearly_boost_count_)
  , winner_options_(std::move(winner_options_))
  , is_default_(is_default_)
  , is_additional_(is_additional_)
{}

const std::int32_t starGiveawayPaymentOption::ID;

object_ptr<starGiveawayPaymentOption> starGiveawayPaymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starGiveawayPaymentOption> res = make_object<starGiveawayPaymentOption>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->store_product_id_ = jni::fetch_string(env, p, res->store_product_id_fieldID);
  res->yearly_boost_count_ = env->GetIntField(p, res->yearly_boost_count_fieldID);
  res->winner_options_ = jni::FetchVector<starGiveawayWinnerOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->winner_options_fieldID));
  res->is_default_ = (env->GetBooleanField(p, res->is_default_fieldID) != 0);
  res->is_additional_ = (env->GetBooleanField(p, res->is_additional_fieldID) != 0);
  return res;
}

void starGiveawayPaymentOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  env->SetLongField(s, star_count_fieldID, star_count_);
  { jstring nextString = jni::to_jstring(env, store_product_id_); if (nextString) { env->SetObjectField(s, store_product_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, yearly_boost_count_fieldID, yearly_boost_count_);
  { auto arr_tmp_ = jni::store_vector(env, winner_options_); if (arr_tmp_) { env->SetObjectField(s, winner_options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_default_fieldID, is_default_);
  env->SetBooleanField(s, is_additional_fieldID, is_additional_);
}

void starGiveawayPaymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarGiveawayPaymentOption");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_field("storeProductId", store_product_id_);
    s.store_field("yearlyBoostCount", yearly_boost_count_);
    { s.store_vector_begin("winnerOptions", winner_options_.size()); for (const auto &_value : winner_options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("isDefault", is_default_);
    s.store_field("isAdditional", is_additional_);
    s.store_class_end();
  }
}

void starGiveawayPaymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarGiveawayPaymentOption").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    store_product_id_fieldID = jni::get_field_id(env, Class, "storeProductId", "Ljava/lang/String;");
    yearly_boost_count_fieldID = jni::get_field_id(env, Class, "yearlyBoostCount", "I");
    winner_options_fieldID = jni::get_field_id(env, Class, "winnerOptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StarGiveawayWinnerOption;").c_str());
    is_default_fieldID = jni::get_field_id(env, Class, "isDefault", "Z");
    is_additional_fieldID = jni::get_field_id(env, Class, "isAdditional", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass starPaymentOptions::Class;
jfieldID starPaymentOptions::options_fieldID;

starPaymentOptions::starPaymentOptions()
  : options_()
{}

starPaymentOptions::starPaymentOptions(array<object_ptr<starPaymentOption>> &&options_)
  : options_(std::move(options_))
{}

const std::int32_t starPaymentOptions::ID;

object_ptr<starPaymentOptions> starPaymentOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starPaymentOptions> res = make_object<starPaymentOptions>();
  res->options_ = jni::FetchVector<starPaymentOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  return res;
}

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

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

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

jclass stickerSets::Class;
jfieldID stickerSets::total_count_fieldID;
jfieldID stickerSets::sets_fieldID;

stickerSets::stickerSets()
  : total_count_()
  , sets_()
{}

stickerSets::stickerSets(int32 total_count_, array<object_ptr<stickerSetInfo>> &&sets_)
  : total_count_(total_count_)
  , sets_(std::move(sets_))
{}

const std::int32_t stickerSets::ID;

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

void stickerSets::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, sets_); if (arr_tmp_) { env->SetObjectField(s, sets_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

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

jclass storageStatisticsByFileType::Class;
jfieldID storageStatisticsByFileType::file_type_fieldID;
jfieldID storageStatisticsByFileType::size_fieldID;
jfieldID storageStatisticsByFileType::count_fieldID;

storageStatisticsByFileType::storageStatisticsByFileType()
  : file_type_()
  , size_()
  , count_()
{}

storageStatisticsByFileType::storageStatisticsByFileType(object_ptr<FileType> &&file_type_, int53 size_, int32 count_)
  : file_type_(std::move(file_type_))
  , size_(size_)
  , count_(count_)
{}

const std::int32_t storageStatisticsByFileType::ID;

object_ptr<storageStatisticsByFileType> storageStatisticsByFileType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storageStatisticsByFileType> res = make_object<storageStatisticsByFileType>();
  res->file_type_ = jni::fetch_tl_object<FileType>(env, jni::fetch_object(env, p, res->file_type_fieldID));
  res->size_ = env->GetLongField(p, res->size_fieldID);
  res->count_ = env->GetIntField(p, res->count_fieldID);
  return res;
}

void storageStatisticsByFileType::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (file_type_ != nullptr) { jobject next; file_type_->store(env, next); if (next) { env->SetObjectField(s, file_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, size_fieldID, size_);
  env->SetIntField(s, count_fieldID, count_);
}

void storageStatisticsByFileType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorageStatisticsByFileType");
    s.store_object_field("fileType", static_cast<const BaseObject *>(file_type_.get()));
    s.store_field("size", size_);
    s.store_field("count", count_);
    s.store_class_end();
  }
}

void storageStatisticsByFileType::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorageStatisticsByFileType").c_str());
    file_type_fieldID = jni::get_field_id(env, Class, "fileType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FileType;").c_str());
    size_fieldID = jni::get_field_id(env, Class, "size", "J");
    count_fieldID = jni::get_field_id(env, Class, "count", "I");
    return true;
  }();
  (void)is_inited;
}

jclass storyInteractionInfo::Class;
jfieldID storyInteractionInfo::view_count_fieldID;
jfieldID storyInteractionInfo::forward_count_fieldID;
jfieldID storyInteractionInfo::reaction_count_fieldID;
jfieldID storyInteractionInfo::recent_viewer_user_ids_fieldID;

storyInteractionInfo::storyInteractionInfo()
  : view_count_()
  , forward_count_()
  , reaction_count_()
  , recent_viewer_user_ids_()
{}

storyInteractionInfo::storyInteractionInfo(int32 view_count_, int32 forward_count_, int32 reaction_count_, array<int53> &&recent_viewer_user_ids_)
  : view_count_(view_count_)
  , forward_count_(forward_count_)
  , reaction_count_(reaction_count_)
  , recent_viewer_user_ids_(std::move(recent_viewer_user_ids_))
{}

const std::int32_t storyInteractionInfo::ID;

object_ptr<storyInteractionInfo> storyInteractionInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInteractionInfo> res = make_object<storyInteractionInfo>();
  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);
  res->recent_viewer_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->recent_viewer_user_ids_fieldID));
  return res;
}

void storyInteractionInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, view_count_fieldID, view_count_);
  env->SetIntField(s, forward_count_fieldID, forward_count_);
  env->SetIntField(s, reaction_count_fieldID, reaction_count_);
  { auto arr_tmp_ = jni::store_vector(env, recent_viewer_user_ids_); if (arr_tmp_) { env->SetObjectField(s, recent_viewer_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void storyInteractionInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInteractionInfo");
    s.store_field("viewCount", view_count_);
    s.store_field("forwardCount", forward_count_);
    s.store_field("reactionCount", reaction_count_);
    { s.store_vector_begin("recentViewerUserIds", recent_viewer_user_ids_.size()); for (const auto &_value : recent_viewer_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void storyInteractionInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteractionInfo").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");
    recent_viewer_user_ids_fieldID = jni::get_field_id(env, Class, "recentViewerUserIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass storyInteractions::Class;
jfieldID storyInteractions::total_count_fieldID;
jfieldID storyInteractions::total_forward_count_fieldID;
jfieldID storyInteractions::total_reaction_count_fieldID;
jfieldID storyInteractions::interactions_fieldID;
jfieldID storyInteractions::next_offset_fieldID;

storyInteractions::storyInteractions()
  : total_count_()
  , total_forward_count_()
  , total_reaction_count_()
  , interactions_()
  , next_offset_()
{}

storyInteractions::storyInteractions(int32 total_count_, int32 total_forward_count_, int32 total_reaction_count_, array<object_ptr<storyInteraction>> &&interactions_, string const &next_offset_)
  : total_count_(total_count_)
  , total_forward_count_(total_forward_count_)
  , total_reaction_count_(total_reaction_count_)
  , interactions_(std::move(interactions_))
  , next_offset_(next_offset_)
{}

const std::int32_t storyInteractions::ID;

object_ptr<storyInteractions> storyInteractions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInteractions> res = make_object<storyInteractions>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->total_forward_count_ = env->GetIntField(p, res->total_forward_count_fieldID);
  res->total_reaction_count_ = env->GetIntField(p, res->total_reaction_count_fieldID);
  res->interactions_ = jni::FetchVector<storyInteraction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->interactions_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void storyInteractions::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_);
  env->SetIntField(s, total_forward_count_fieldID, total_forward_count_);
  env->SetIntField(s, total_reaction_count_fieldID, total_reaction_count_);
  { auto arr_tmp_ = jni::store_vector(env, interactions_); if (arr_tmp_) { env->SetObjectField(s, interactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void storyInteractions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInteractions");
    s.store_field("totalCount", total_count_);
    s.store_field("totalForwardCount", total_forward_count_);
    s.store_field("totalReactionCount", total_reaction_count_);
    { s.store_vector_begin("interactions", interactions_.size()); for (const auto &_value : interactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("nextOffset", next_offset_);
    s.store_class_end();
  }
}

void storyInteractions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInteractions").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    total_forward_count_fieldID = jni::get_field_id(env, Class, "totalForwardCount", "I");
    total_reaction_count_fieldID = jni::get_field_id(env, Class, "totalReactionCount", "I");
    interactions_fieldID = jni::get_field_id(env, Class, "interactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StoryInteraction;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass storyStatistics::Class;
jfieldID storyStatistics::story_interaction_graph_fieldID;
jfieldID storyStatistics::story_reaction_graph_fieldID;

storyStatistics::storyStatistics()
  : story_interaction_graph_()
  , story_reaction_graph_()
{}

storyStatistics::storyStatistics(object_ptr<StatisticalGraph> &&story_interaction_graph_, object_ptr<StatisticalGraph> &&story_reaction_graph_)
  : story_interaction_graph_(std::move(story_interaction_graph_))
  , story_reaction_graph_(std::move(story_reaction_graph_))
{}

const std::int32_t storyStatistics::ID;

object_ptr<storyStatistics> storyStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyStatistics> res = make_object<storyStatistics>();
  res->story_interaction_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->story_interaction_graph_fieldID));
  res->story_reaction_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->story_reaction_graph_fieldID));
  return res;
}

void storyStatistics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (story_interaction_graph_ != nullptr) { jobject next; story_interaction_graph_->store(env, next); if (next) { env->SetObjectField(s, story_interaction_graph_fieldID, next); env->DeleteLocalRef(next); } }
  if (story_reaction_graph_ != nullptr) { jobject next; story_reaction_graph_->store(env, next); if (next) { env->SetObjectField(s, story_reaction_graph_fieldID, next); env->DeleteLocalRef(next); } }
}

void storyStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryStatistics");
    s.store_object_field("storyInteractionGraph", static_cast<const BaseObject *>(story_interaction_graph_.get()));
    s.store_object_field("storyReactionGraph", static_cast<const BaseObject *>(story_reaction_graph_.get()));
    s.store_class_end();
  }
}

void storyStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryStatistics").c_str());
    story_interaction_graph_fieldID = jni::get_field_id(env, Class, "storyInteractionGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    story_reaction_graph_fieldID = jni::get_field_id(env, Class, "storyReactionGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass suggestedPostInfo::Class;
jfieldID suggestedPostInfo::price_fieldID;
jfieldID suggestedPostInfo::send_date_fieldID;
jfieldID suggestedPostInfo::state_fieldID;
jfieldID suggestedPostInfo::can_be_approved_fieldID;
jfieldID suggestedPostInfo::can_be_declined_fieldID;

suggestedPostInfo::suggestedPostInfo()
  : price_()
  , send_date_()
  , state_()
  , can_be_approved_()
  , can_be_declined_()
{}

suggestedPostInfo::suggestedPostInfo(object_ptr<SuggestedPostPrice> &&price_, int32 send_date_, object_ptr<SuggestedPostState> &&state_, bool can_be_approved_, bool can_be_declined_)
  : price_(std::move(price_))
  , send_date_(send_date_)
  , state_(std::move(state_))
  , can_be_approved_(can_be_approved_)
  , can_be_declined_(can_be_declined_)
{}

const std::int32_t suggestedPostInfo::ID;

object_ptr<suggestedPostInfo> suggestedPostInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestedPostInfo> res = make_object<suggestedPostInfo>();
  res->price_ = jni::fetch_tl_object<SuggestedPostPrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  res->send_date_ = env->GetIntField(p, res->send_date_fieldID);
  res->state_ = jni::fetch_tl_object<SuggestedPostState>(env, jni::fetch_object(env, p, res->state_fieldID));
  res->can_be_approved_ = (env->GetBooleanField(p, res->can_be_approved_fieldID) != 0);
  res->can_be_declined_ = (env->GetBooleanField(p, res->can_be_declined_fieldID) != 0);
  return res;
}

void suggestedPostInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (price_ != nullptr) { jobject next; price_->store(env, next); if (next) { env->SetObjectField(s, price_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, send_date_fieldID, send_date_);
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_be_approved_fieldID, can_be_approved_);
  env->SetBooleanField(s, can_be_declined_fieldID, can_be_declined_);
}

void suggestedPostInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SuggestedPostInfo");
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_field("sendDate", send_date_);
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_field("canBeApproved", can_be_approved_);
    s.store_field("canBeDeclined", can_be_declined_);
    s.store_class_end();
  }
}

void suggestedPostInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SuggestedPostInfo").c_str());
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostPrice;").c_str());
    send_date_fieldID = jni::get_field_id(env, Class, "sendDate", "I");
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostState;").c_str());
    can_be_approved_fieldID = jni::get_field_id(env, Class, "canBeApproved", "Z");
    can_be_declined_fieldID = jni::get_field_id(env, Class, "canBeDeclined", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass tMeUrls::Class;
jfieldID tMeUrls::urls_fieldID;

tMeUrls::tMeUrls()
  : urls_()
{}

tMeUrls::tMeUrls(array<object_ptr<tMeUrl>> &&urls_)
  : urls_(std::move(urls_))
{}

const std::int32_t tMeUrls::ID;

object_ptr<tMeUrls> tMeUrls::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tMeUrls> res = make_object<tMeUrls>();
  res->urls_ = jni::FetchVector<tMeUrl>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->urls_fieldID));
  return res;
}

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

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

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

jclass TargetChat::Class;

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

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

jclass targetChatCurrent::Class;

targetChatCurrent::targetChatCurrent() {
}

const std::int32_t targetChatCurrent::ID;

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

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

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

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

jclass targetChatChosen::Class;
jfieldID targetChatChosen::types_fieldID;

targetChatChosen::targetChatChosen()
  : types_()
{}

targetChatChosen::targetChatChosen(object_ptr<targetChatTypes> &&types_)
  : types_(std::move(types_))
{}

const std::int32_t targetChatChosen::ID;

object_ptr<TargetChat> targetChatChosen::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<targetChatChosen> res = make_object<targetChatChosen>();
  res->types_ = jni::fetch_tl_object<targetChatTypes>(env, jni::fetch_object(env, p, res->types_fieldID));
  return std::move(res);
}

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

void targetChatChosen::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TargetChatChosen");
    s.store_object_field("types", static_cast<const BaseObject *>(types_.get()));
    s.store_class_end();
  }
}

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

jclass targetChatInternalLink::Class;
jfieldID targetChatInternalLink::link_fieldID;

targetChatInternalLink::targetChatInternalLink()
  : link_()
{}

targetChatInternalLink::targetChatInternalLink(object_ptr<InternalLinkType> &&link_)
  : link_(std::move(link_))
{}

const std::int32_t targetChatInternalLink::ID;

object_ptr<TargetChat> targetChatInternalLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<targetChatInternalLink> res = make_object<targetChatInternalLink>();
  res->link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->link_fieldID));
  return std::move(res);
}

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

void targetChatInternalLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TargetChatInternalLink");
    s.store_object_field("link", static_cast<const BaseObject *>(link_.get()));
    s.store_class_end();
  }
}

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

jclass TelegramPaymentPurpose::Class;

object_ptr<TelegramPaymentPurpose> TelegramPaymentPurpose::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case telegramPaymentPurposePremiumGift::ID:
      return telegramPaymentPurposePremiumGift::fetch(env, p);
    case telegramPaymentPurposePremiumGiftCodes::ID:
      return telegramPaymentPurposePremiumGiftCodes::fetch(env, p);
    case telegramPaymentPurposePremiumGiveaway::ID:
      return telegramPaymentPurposePremiumGiveaway::fetch(env, p);
    case telegramPaymentPurposeStars::ID:
      return telegramPaymentPurposeStars::fetch(env, p);
    case telegramPaymentPurposeGiftedStars::ID:
      return telegramPaymentPurposeGiftedStars::fetch(env, p);
    case telegramPaymentPurposeStarGiveaway::ID:
      return telegramPaymentPurposeStarGiveaway::fetch(env, p);
    case telegramPaymentPurposeJoinChat::ID:
      return telegramPaymentPurposeJoinChat::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass telegramPaymentPurposePremiumGift::Class;
jfieldID telegramPaymentPurposePremiumGift::currency_fieldID;
jfieldID telegramPaymentPurposePremiumGift::amount_fieldID;
jfieldID telegramPaymentPurposePremiumGift::user_id_fieldID;
jfieldID telegramPaymentPurposePremiumGift::month_count_fieldID;
jfieldID telegramPaymentPurposePremiumGift::text_fieldID;

telegramPaymentPurposePremiumGift::telegramPaymentPurposePremiumGift()
  : currency_()
  , amount_()
  , user_id_()
  , month_count_()
  , text_()
{}

telegramPaymentPurposePremiumGift::telegramPaymentPurposePremiumGift(string const &currency_, int53 amount_, int53 user_id_, int32 month_count_, object_ptr<formattedText> &&text_)
  : currency_(currency_)
  , amount_(amount_)
  , user_id_(user_id_)
  , month_count_(month_count_)
  , text_(std::move(text_))
{}

const std::int32_t telegramPaymentPurposePremiumGift::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposePremiumGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposePremiumGift> res = make_object<telegramPaymentPurposePremiumGift>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void telegramPaymentPurposePremiumGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposePremiumGift");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("userId", user_id_);
    s.store_field("monthCount", month_count_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void telegramPaymentPurposePremiumGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TelegramPaymentPurposePremiumGift").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass telegramPaymentPurposePremiumGiftCodes::Class;
jfieldID telegramPaymentPurposePremiumGiftCodes::boosted_chat_id_fieldID;
jfieldID telegramPaymentPurposePremiumGiftCodes::currency_fieldID;
jfieldID telegramPaymentPurposePremiumGiftCodes::amount_fieldID;
jfieldID telegramPaymentPurposePremiumGiftCodes::user_ids_fieldID;
jfieldID telegramPaymentPurposePremiumGiftCodes::month_count_fieldID;
jfieldID telegramPaymentPurposePremiumGiftCodes::text_fieldID;

telegramPaymentPurposePremiumGiftCodes::telegramPaymentPurposePremiumGiftCodes()
  : boosted_chat_id_()
  , currency_()
  , amount_()
  , user_ids_()
  , month_count_()
  , text_()
{}

telegramPaymentPurposePremiumGiftCodes::telegramPaymentPurposePremiumGiftCodes(int53 boosted_chat_id_, string const &currency_, int53 amount_, array<int53> &&user_ids_, int32 month_count_, object_ptr<formattedText> &&text_)
  : boosted_chat_id_(boosted_chat_id_)
  , currency_(currency_)
  , amount_(amount_)
  , user_ids_(std::move(user_ids_))
  , month_count_(month_count_)
  , text_(std::move(text_))
{}

const std::int32_t telegramPaymentPurposePremiumGiftCodes::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposePremiumGiftCodes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposePremiumGiftCodes> res = make_object<telegramPaymentPurposePremiumGiftCodes>();
  res->boosted_chat_id_ = env->GetLongField(p, res->boosted_chat_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void telegramPaymentPurposePremiumGiftCodes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposePremiumGiftCodes");
    s.store_field("boostedChatId", boosted_chat_id_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    { s.store_vector_begin("userIds", user_ids_.size()); for (const auto &_value : user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("monthCount", month_count_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void telegramPaymentPurposePremiumGiftCodes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TelegramPaymentPurposePremiumGiftCodes").c_str());
    boosted_chat_id_fieldID = jni::get_field_id(env, Class, "boostedChatId", "J");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass telegramPaymentPurposePremiumGiveaway::Class;
jfieldID telegramPaymentPurposePremiumGiveaway::parameters_fieldID;
jfieldID telegramPaymentPurposePremiumGiveaway::currency_fieldID;
jfieldID telegramPaymentPurposePremiumGiveaway::amount_fieldID;
jfieldID telegramPaymentPurposePremiumGiveaway::winner_count_fieldID;
jfieldID telegramPaymentPurposePremiumGiveaway::month_count_fieldID;

telegramPaymentPurposePremiumGiveaway::telegramPaymentPurposePremiumGiveaway()
  : parameters_()
  , currency_()
  , amount_()
  , winner_count_()
  , month_count_()
{}

telegramPaymentPurposePremiumGiveaway::telegramPaymentPurposePremiumGiveaway(object_ptr<giveawayParameters> &&parameters_, string const &currency_, int53 amount_, int32 winner_count_, int32 month_count_)
  : parameters_(std::move(parameters_))
  , currency_(currency_)
  , amount_(amount_)
  , winner_count_(winner_count_)
  , month_count_(month_count_)
{}

const std::int32_t telegramPaymentPurposePremiumGiveaway::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposePremiumGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposePremiumGiveaway> res = make_object<telegramPaymentPurposePremiumGiveaway>();
  res->parameters_ = jni::fetch_tl_object<giveawayParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  return std::move(res);
}

void telegramPaymentPurposePremiumGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposePremiumGiveaway");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("winnerCount", winner_count_);
    s.store_field("monthCount", month_count_);
    s.store_class_end();
  }
}

void telegramPaymentPurposePremiumGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TelegramPaymentPurposePremiumGiveaway").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayParameters;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass telegramPaymentPurposeStars::Class;
jfieldID telegramPaymentPurposeStars::currency_fieldID;
jfieldID telegramPaymentPurposeStars::amount_fieldID;
jfieldID telegramPaymentPurposeStars::star_count_fieldID;
jfieldID telegramPaymentPurposeStars::chat_id_fieldID;

telegramPaymentPurposeStars::telegramPaymentPurposeStars()
  : currency_()
  , amount_()
  , star_count_()
  , chat_id_()
{}

telegramPaymentPurposeStars::telegramPaymentPurposeStars(string const &currency_, int53 amount_, int53 star_count_, int53 chat_id_)
  : currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
  , chat_id_(chat_id_)
{}

const std::int32_t telegramPaymentPurposeStars::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposeStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposeStars> res = make_object<telegramPaymentPurposeStars>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return std::move(res);
}

void telegramPaymentPurposeStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposeStars");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

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

jclass telegramPaymentPurposeGiftedStars::Class;
jfieldID telegramPaymentPurposeGiftedStars::user_id_fieldID;
jfieldID telegramPaymentPurposeGiftedStars::currency_fieldID;
jfieldID telegramPaymentPurposeGiftedStars::amount_fieldID;
jfieldID telegramPaymentPurposeGiftedStars::star_count_fieldID;

telegramPaymentPurposeGiftedStars::telegramPaymentPurposeGiftedStars()
  : user_id_()
  , currency_()
  , amount_()
  , star_count_()
{}

telegramPaymentPurposeGiftedStars::telegramPaymentPurposeGiftedStars(int53 user_id_, string const &currency_, int53 amount_, int53 star_count_)
  : user_id_(user_id_)
  , currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
{}

const std::int32_t telegramPaymentPurposeGiftedStars::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposeGiftedStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposeGiftedStars> res = make_object<telegramPaymentPurposeGiftedStars>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

void telegramPaymentPurposeGiftedStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposeGiftedStars");
    s.store_field("userId", user_id_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

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

jclass telegramPaymentPurposeStarGiveaway::Class;
jfieldID telegramPaymentPurposeStarGiveaway::parameters_fieldID;
jfieldID telegramPaymentPurposeStarGiveaway::currency_fieldID;
jfieldID telegramPaymentPurposeStarGiveaway::amount_fieldID;
jfieldID telegramPaymentPurposeStarGiveaway::winner_count_fieldID;
jfieldID telegramPaymentPurposeStarGiveaway::star_count_fieldID;

telegramPaymentPurposeStarGiveaway::telegramPaymentPurposeStarGiveaway()
  : parameters_()
  , currency_()
  , amount_()
  , winner_count_()
  , star_count_()
{}

telegramPaymentPurposeStarGiveaway::telegramPaymentPurposeStarGiveaway(object_ptr<giveawayParameters> &&parameters_, string const &currency_, int53 amount_, int32 winner_count_, int53 star_count_)
  : parameters_(std::move(parameters_))
  , currency_(currency_)
  , amount_(amount_)
  , winner_count_(winner_count_)
  , star_count_(star_count_)
{}

const std::int32_t telegramPaymentPurposeStarGiveaway::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposeStarGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposeStarGiveaway> res = make_object<telegramPaymentPurposeStarGiveaway>();
  res->parameters_ = jni::fetch_tl_object<giveawayParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

void telegramPaymentPurposeStarGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposeStarGiveaway");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("winnerCount", winner_count_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

void telegramPaymentPurposeStarGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TelegramPaymentPurposeStarGiveaway").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayParameters;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass telegramPaymentPurposeJoinChat::Class;
jfieldID telegramPaymentPurposeJoinChat::invite_link_fieldID;

telegramPaymentPurposeJoinChat::telegramPaymentPurposeJoinChat()
  : invite_link_()
{}

telegramPaymentPurposeJoinChat::telegramPaymentPurposeJoinChat(string const &invite_link_)
  : invite_link_(invite_link_)
{}

const std::int32_t telegramPaymentPurposeJoinChat::ID;

object_ptr<TelegramPaymentPurpose> telegramPaymentPurposeJoinChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<telegramPaymentPurposeJoinChat> res = make_object<telegramPaymentPurposeJoinChat>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return std::move(res);
}

void telegramPaymentPurposeJoinChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TelegramPaymentPurposeJoinChat");
    s.store_field("inviteLink", invite_link_);
    s.store_class_end();
  }
}

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

jclass textCompositionStyleExample::Class;
jfieldID textCompositionStyleExample::source_text_fieldID;
jfieldID textCompositionStyleExample::result_text_fieldID;

textCompositionStyleExample::textCompositionStyleExample()
  : source_text_()
  , result_text_()
{}

textCompositionStyleExample::textCompositionStyleExample(object_ptr<formattedText> &&source_text_, object_ptr<formattedText> &&result_text_)
  : source_text_(std::move(source_text_))
  , result_text_(std::move(result_text_))
{}

const std::int32_t textCompositionStyleExample::ID;

object_ptr<textCompositionStyleExample> textCompositionStyleExample::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<textCompositionStyleExample> res = make_object<textCompositionStyleExample>();
  res->source_text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->source_text_fieldID));
  res->result_text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->result_text_fieldID));
  return res;
}

void textCompositionStyleExample::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (source_text_ != nullptr) { jobject next; source_text_->store(env, next); if (next) { env->SetObjectField(s, source_text_fieldID, next); env->DeleteLocalRef(next); } }
  if (result_text_ != nullptr) { jobject next; result_text_->store(env, next); if (next) { env->SetObjectField(s, result_text_fieldID, next); env->DeleteLocalRef(next); } }
}

void textCompositionStyleExample::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TextCompositionStyleExample");
    s.store_object_field("sourceText", static_cast<const BaseObject *>(source_text_.get()));
    s.store_object_field("resultText", static_cast<const BaseObject *>(result_text_.get()));
    s.store_class_end();
  }
}

void textCompositionStyleExample::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TextCompositionStyleExample").c_str());
    source_text_fieldID = jni::get_field_id(env, Class, "sourceText", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    result_text_fieldID = jni::get_field_id(env, Class, "resultText", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass unconfirmedSession::Class;
jfieldID unconfirmedSession::id_fieldID;
jfieldID unconfirmedSession::log_in_date_fieldID;
jfieldID unconfirmedSession::device_model_fieldID;
jfieldID unconfirmedSession::location_fieldID;

unconfirmedSession::unconfirmedSession()
  : id_()
  , log_in_date_()
  , device_model_()
  , location_()
{}

unconfirmedSession::unconfirmedSession(int64 id_, int32 log_in_date_, string const &device_model_, string const &location_)
  : id_(id_)
  , log_in_date_(log_in_date_)
  , device_model_(device_model_)
  , location_(location_)
{}

const std::int32_t unconfirmedSession::ID;

object_ptr<unconfirmedSession> unconfirmedSession::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<unconfirmedSession> res = make_object<unconfirmedSession>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->log_in_date_ = env->GetIntField(p, res->log_in_date_fieldID);
  res->device_model_ = jni::fetch_string(env, p, res->device_model_fieldID);
  res->location_ = jni::fetch_string(env, p, res->location_fieldID);
  return res;
}

void unconfirmedSession::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, log_in_date_fieldID, log_in_date_);
  { 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, location_); if (nextString) { env->SetObjectField(s, location_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void unconfirmedSession::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UnconfirmedSession");
    s.store_field("id", id_);
    s.store_field("logInDate", log_in_date_);
    s.store_field("deviceModel", device_model_);
    s.store_field("location", location_);
    s.store_class_end();
  }
}

void unconfirmedSession::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UnconfirmedSession").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    log_in_date_fieldID = jni::get_field_id(env, Class, "logInDate", "I");
    device_model_fieldID = jni::get_field_id(env, Class, "deviceModel", "Ljava/lang/String;");
    location_fieldID = jni::get_field_id(env, Class, "location", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftModel::Class;
jfieldID upgradedGiftModel::name_fieldID;
jfieldID upgradedGiftModel::sticker_fieldID;
jfieldID upgradedGiftModel::rarity_fieldID;
jfieldID upgradedGiftModel::is_crafted_fieldID;

upgradedGiftModel::upgradedGiftModel()
  : name_()
  , sticker_()
  , rarity_()
  , is_crafted_()
{}

upgradedGiftModel::upgradedGiftModel(string const &name_, object_ptr<sticker> &&sticker_, object_ptr<UpgradedGiftAttributeRarity> &&rarity_, bool is_crafted_)
  : name_(name_)
  , sticker_(std::move(sticker_))
  , rarity_(std::move(rarity_))
  , is_crafted_(is_crafted_)
{}

const std::int32_t upgradedGiftModel::ID;

object_ptr<upgradedGiftModel> upgradedGiftModel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftModel> res = make_object<upgradedGiftModel>();
  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));
  res->is_crafted_ = (env->GetBooleanField(p, res->is_crafted_fieldID) != 0);
  return res;
}

void upgradedGiftModel::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); } }
  env->SetBooleanField(s, is_crafted_fieldID, is_crafted_);
}

void upgradedGiftModel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftModel");
    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_field("isCrafted", is_crafted_);
    s.store_class_end();
  }
}

void upgradedGiftModel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftModel").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());
    is_crafted_fieldID = jni::get_field_id(env, Class, "isCrafted", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftModelCount::Class;
jfieldID upgradedGiftModelCount::model_fieldID;
jfieldID upgradedGiftModelCount::total_count_fieldID;

upgradedGiftModelCount::upgradedGiftModelCount()
  : model_()
  , total_count_()
{}

upgradedGiftModelCount::upgradedGiftModelCount(object_ptr<upgradedGiftModel> &&model_, int32 total_count_)
  : model_(std::move(model_))
  , total_count_(total_count_)
{}

const std::int32_t upgradedGiftModelCount::ID;

object_ptr<upgradedGiftModelCount> upgradedGiftModelCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftModelCount> res = make_object<upgradedGiftModelCount>();
  res->model_ = jni::fetch_tl_object<upgradedGiftModel>(env, jni::fetch_object(env, p, res->model_fieldID));
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  return res;
}

void upgradedGiftModelCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (model_ != nullptr) { jobject next; model_->store(env, next); if (next) { env->SetObjectField(s, model_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, total_count_fieldID, total_count_);
}

void upgradedGiftModelCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftModelCount");
    s.store_object_field("model", static_cast<const BaseObject *>(model_.get()));
    s.store_field("totalCount", total_count_);
    s.store_class_end();
  }
}

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

jclass upgradedGiftOriginalDetails::Class;
jfieldID upgradedGiftOriginalDetails::sender_id_fieldID;
jfieldID upgradedGiftOriginalDetails::receiver_id_fieldID;
jfieldID upgradedGiftOriginalDetails::text_fieldID;
jfieldID upgradedGiftOriginalDetails::date_fieldID;

upgradedGiftOriginalDetails::upgradedGiftOriginalDetails()
  : sender_id_()
  , receiver_id_()
  , text_()
  , date_()
{}

upgradedGiftOriginalDetails::upgradedGiftOriginalDetails(object_ptr<MessageSender> &&sender_id_, object_ptr<MessageSender> &&receiver_id_, object_ptr<formattedText> &&text_, int32 date_)
  : sender_id_(std::move(sender_id_))
  , receiver_id_(std::move(receiver_id_))
  , text_(std::move(text_))
  , date_(date_)
{}

const std::int32_t upgradedGiftOriginalDetails::ID;

object_ptr<upgradedGiftOriginalDetails> upgradedGiftOriginalDetails::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftOriginalDetails> res = make_object<upgradedGiftOriginalDetails>();
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->receiver_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->receiver_id_fieldID));
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void upgradedGiftOriginalDetails::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); } }
  if (receiver_id_ != nullptr) { jobject next; receiver_id_->store(env, next); if (next) { env->SetObjectField(s, receiver_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
}

void upgradedGiftOriginalDetails::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftOriginalDetails");
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_object_field("receiverId", static_cast<const BaseObject *>(receiver_id_.get()));
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("date", date_);
    s.store_class_end();
  }
}

void upgradedGiftOriginalDetails::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftOriginalDetails").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    receiver_id_fieldID = jni::get_field_id(env, Class, "receiverId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass UserPrivacySettingRule::Class;

object_ptr<UserPrivacySettingRule> UserPrivacySettingRule::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case userPrivacySettingRuleAllowAll::ID:
      return userPrivacySettingRuleAllowAll::fetch(env, p);
    case userPrivacySettingRuleAllowContacts::ID:
      return userPrivacySettingRuleAllowContacts::fetch(env, p);
    case userPrivacySettingRuleAllowBots::ID:
      return userPrivacySettingRuleAllowBots::fetch(env, p);
    case userPrivacySettingRuleAllowPremiumUsers::ID:
      return userPrivacySettingRuleAllowPremiumUsers::fetch(env, p);
    case userPrivacySettingRuleAllowUsers::ID:
      return userPrivacySettingRuleAllowUsers::fetch(env, p);
    case userPrivacySettingRuleAllowChatMembers::ID:
      return userPrivacySettingRuleAllowChatMembers::fetch(env, p);
    case userPrivacySettingRuleRestrictAll::ID:
      return userPrivacySettingRuleRestrictAll::fetch(env, p);
    case userPrivacySettingRuleRestrictContacts::ID:
      return userPrivacySettingRuleRestrictContacts::fetch(env, p);
    case userPrivacySettingRuleRestrictBots::ID:
      return userPrivacySettingRuleRestrictBots::fetch(env, p);
    case userPrivacySettingRuleRestrictUsers::ID:
      return userPrivacySettingRuleRestrictUsers::fetch(env, p);
    case userPrivacySettingRuleRestrictChatMembers::ID:
      return userPrivacySettingRuleRestrictChatMembers::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass userPrivacySettingRuleAllowAll::Class;

userPrivacySettingRuleAllowAll::userPrivacySettingRuleAllowAll() {
}

const std::int32_t userPrivacySettingRuleAllowAll::ID;

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

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

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

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

jclass userPrivacySettingRuleAllowContacts::Class;

userPrivacySettingRuleAllowContacts::userPrivacySettingRuleAllowContacts() {
}

const std::int32_t userPrivacySettingRuleAllowContacts::ID;

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

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

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

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

jclass userPrivacySettingRuleAllowBots::Class;

userPrivacySettingRuleAllowBots::userPrivacySettingRuleAllowBots() {
}

const std::int32_t userPrivacySettingRuleAllowBots::ID;

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

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

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

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

jclass userPrivacySettingRuleAllowPremiumUsers::Class;

userPrivacySettingRuleAllowPremiumUsers::userPrivacySettingRuleAllowPremiumUsers() {
}

const std::int32_t userPrivacySettingRuleAllowPremiumUsers::ID;

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

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

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

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

jclass userPrivacySettingRuleAllowUsers::Class;
jfieldID userPrivacySettingRuleAllowUsers::user_ids_fieldID;

userPrivacySettingRuleAllowUsers::userPrivacySettingRuleAllowUsers()
  : user_ids_()
{}

userPrivacySettingRuleAllowUsers::userPrivacySettingRuleAllowUsers(array<int53> &&user_ids_)
  : user_ids_(std::move(user_ids_))
{}

const std::int32_t userPrivacySettingRuleAllowUsers::ID;

object_ptr<UserPrivacySettingRule> userPrivacySettingRuleAllowUsers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userPrivacySettingRuleAllowUsers> res = make_object<userPrivacySettingRuleAllowUsers>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return std::move(res);
}

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

void userPrivacySettingRuleAllowUsers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserPrivacySettingRuleAllowUsers");
    { 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();
  }
}

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

jclass userPrivacySettingRuleAllowChatMembers::Class;
jfieldID userPrivacySettingRuleAllowChatMembers::chat_ids_fieldID;

userPrivacySettingRuleAllowChatMembers::userPrivacySettingRuleAllowChatMembers()
  : chat_ids_()
{}

userPrivacySettingRuleAllowChatMembers::userPrivacySettingRuleAllowChatMembers(array<int53> &&chat_ids_)
  : chat_ids_(std::move(chat_ids_))
{}

const std::int32_t userPrivacySettingRuleAllowChatMembers::ID;

object_ptr<UserPrivacySettingRule> userPrivacySettingRuleAllowChatMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userPrivacySettingRuleAllowChatMembers> res = make_object<userPrivacySettingRuleAllowChatMembers>();
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return std::move(res);
}

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

void userPrivacySettingRuleAllowChatMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserPrivacySettingRuleAllowChatMembers");
    { 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();
  }
}

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

jclass userPrivacySettingRuleRestrictAll::Class;

userPrivacySettingRuleRestrictAll::userPrivacySettingRuleRestrictAll() {
}

const std::int32_t userPrivacySettingRuleRestrictAll::ID;

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

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

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

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

jclass userPrivacySettingRuleRestrictContacts::Class;

userPrivacySettingRuleRestrictContacts::userPrivacySettingRuleRestrictContacts() {
}

const std::int32_t userPrivacySettingRuleRestrictContacts::ID;

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

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

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

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

jclass userPrivacySettingRuleRestrictBots::Class;

userPrivacySettingRuleRestrictBots::userPrivacySettingRuleRestrictBots() {
}

const std::int32_t userPrivacySettingRuleRestrictBots::ID;

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

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

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

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

jclass userPrivacySettingRuleRestrictUsers::Class;
jfieldID userPrivacySettingRuleRestrictUsers::user_ids_fieldID;

userPrivacySettingRuleRestrictUsers::userPrivacySettingRuleRestrictUsers()
  : user_ids_()
{}

userPrivacySettingRuleRestrictUsers::userPrivacySettingRuleRestrictUsers(array<int53> &&user_ids_)
  : user_ids_(std::move(user_ids_))
{}

const std::int32_t userPrivacySettingRuleRestrictUsers::ID;

object_ptr<UserPrivacySettingRule> userPrivacySettingRuleRestrictUsers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userPrivacySettingRuleRestrictUsers> res = make_object<userPrivacySettingRuleRestrictUsers>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return std::move(res);
}

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

void userPrivacySettingRuleRestrictUsers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserPrivacySettingRuleRestrictUsers");
    { 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();
  }
}

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

jclass userPrivacySettingRuleRestrictChatMembers::Class;
jfieldID userPrivacySettingRuleRestrictChatMembers::chat_ids_fieldID;

userPrivacySettingRuleRestrictChatMembers::userPrivacySettingRuleRestrictChatMembers()
  : chat_ids_()
{}

userPrivacySettingRuleRestrictChatMembers::userPrivacySettingRuleRestrictChatMembers(array<int53> &&chat_ids_)
  : chat_ids_(std::move(chat_ids_))
{}

const std::int32_t userPrivacySettingRuleRestrictChatMembers::ID;

object_ptr<UserPrivacySettingRule> userPrivacySettingRuleRestrictChatMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userPrivacySettingRuleRestrictChatMembers> res = make_object<userPrivacySettingRuleRestrictChatMembers>();
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return std::move(res);
}

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

void userPrivacySettingRuleRestrictChatMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserPrivacySettingRuleRestrictChatMembers");
    { 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();
  }
}

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

jclass userRating::Class;
jfieldID userRating::level_fieldID;
jfieldID userRating::is_maximum_level_reached_fieldID;
jfieldID userRating::rating_fieldID;
jfieldID userRating::current_level_rating_fieldID;
jfieldID userRating::next_level_rating_fieldID;

userRating::userRating()
  : level_()
  , is_maximum_level_reached_()
  , rating_()
  , current_level_rating_()
  , next_level_rating_()
{}

userRating::userRating(int32 level_, bool is_maximum_level_reached_, int53 rating_, int53 current_level_rating_, int53 next_level_rating_)
  : level_(level_)
  , is_maximum_level_reached_(is_maximum_level_reached_)
  , rating_(rating_)
  , current_level_rating_(current_level_rating_)
  , next_level_rating_(next_level_rating_)
{}

const std::int32_t userRating::ID;

object_ptr<userRating> userRating::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userRating> res = make_object<userRating>();
  res->level_ = env->GetIntField(p, res->level_fieldID);
  res->is_maximum_level_reached_ = (env->GetBooleanField(p, res->is_maximum_level_reached_fieldID) != 0);
  res->rating_ = env->GetLongField(p, res->rating_fieldID);
  res->current_level_rating_ = env->GetLongField(p, res->current_level_rating_fieldID);
  res->next_level_rating_ = env->GetLongField(p, res->next_level_rating_fieldID);
  return res;
}

void userRating::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, level_fieldID, level_);
  env->SetBooleanField(s, is_maximum_level_reached_fieldID, is_maximum_level_reached_);
  env->SetLongField(s, rating_fieldID, rating_);
  env->SetLongField(s, current_level_rating_fieldID, current_level_rating_);
  env->SetLongField(s, next_level_rating_fieldID, next_level_rating_);
}

void userRating::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserRating");
    s.store_field("level", level_);
    s.store_field("isMaximumLevelReached", is_maximum_level_reached_);
    s.store_field("rating", rating_);
    s.store_field("currentLevelRating", current_level_rating_);
    s.store_field("nextLevelRating", next_level_rating_);
    s.store_class_end();
  }
}

void userRating::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UserRating").c_str());
    level_fieldID = jni::get_field_id(env, Class, "level", "I");
    is_maximum_level_reached_fieldID = jni::get_field_id(env, Class, "isMaximumLevelReached", "Z");
    rating_fieldID = jni::get_field_id(env, Class, "rating", "J");
    current_level_rating_fieldID = jni::get_field_id(env, Class, "currentLevelRating", "J");
    next_level_rating_fieldID = jni::get_field_id(env, Class, "nextLevelRating", "J");
    return true;
  }();
  (void)is_inited;
}

jclass usernames::Class;
jfieldID usernames::active_usernames_fieldID;
jfieldID usernames::disabled_usernames_fieldID;
jfieldID usernames::editable_username_fieldID;
jfieldID usernames::collectible_usernames_fieldID;

usernames::usernames()
  : active_usernames_()
  , disabled_usernames_()
  , editable_username_()
  , collectible_usernames_()
{}

usernames::usernames(array<string> &&active_usernames_, array<string> &&disabled_usernames_, string const &editable_username_, array<string> &&collectible_usernames_)
  : active_usernames_(std::move(active_usernames_))
  , disabled_usernames_(std::move(disabled_usernames_))
  , editable_username_(editable_username_)
  , collectible_usernames_(std::move(collectible_usernames_))
{}

const std::int32_t usernames::ID;

object_ptr<usernames> usernames::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<usernames> res = make_object<usernames>();
  res->active_usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->active_usernames_fieldID));
  res->disabled_usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->disabled_usernames_fieldID));
  res->editable_username_ = jni::fetch_string(env, p, res->editable_username_fieldID);
  res->collectible_usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->collectible_usernames_fieldID));
  return res;
}

void usernames::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, active_usernames_); if (arr_tmp_) { env->SetObjectField(s, active_usernames_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, disabled_usernames_); if (arr_tmp_) { env->SetObjectField(s, disabled_usernames_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, editable_username_); if (nextString) { env->SetObjectField(s, editable_username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, collectible_usernames_); if (arr_tmp_) { env->SetObjectField(s, collectible_usernames_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void usernames::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Usernames");
    { s.store_vector_begin("activeUsernames", active_usernames_.size()); for (const auto &_value : active_usernames_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("disabledUsernames", disabled_usernames_.size()); for (const auto &_value : disabled_usernames_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("editableUsername", editable_username_);
    { s.store_vector_begin("collectibleUsernames", collectible_usernames_.size()); for (const auto &_value : collectible_usernames_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void usernames::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Usernames").c_str());
    active_usernames_fieldID = jni::get_field_id(env, Class, "activeUsernames", "[Ljava/lang/String;");
    disabled_usernames_fieldID = jni::get_field_id(env, Class, "disabledUsernames", "[Ljava/lang/String;");
    editable_username_fieldID = jni::get_field_id(env, Class, "editableUsername", "Ljava/lang/String;");
    collectible_usernames_fieldID = jni::get_field_id(env, Class, "collectibleUsernames", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass VectorPathCommand::Class;

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

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

jclass vectorPathCommandLine::Class;
jfieldID vectorPathCommandLine::end_point_fieldID;

vectorPathCommandLine::vectorPathCommandLine()
  : end_point_()
{}

vectorPathCommandLine::vectorPathCommandLine(object_ptr<point> &&end_point_)
  : end_point_(std::move(end_point_))
{}

const std::int32_t vectorPathCommandLine::ID;

object_ptr<VectorPathCommand> vectorPathCommandLine::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<vectorPathCommandLine> res = make_object<vectorPathCommandLine>();
  res->end_point_ = jni::fetch_tl_object<point>(env, jni::fetch_object(env, p, res->end_point_fieldID));
  return std::move(res);
}

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

void vectorPathCommandLine::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VectorPathCommandLine");
    s.store_object_field("endPoint", static_cast<const BaseObject *>(end_point_.get()));
    s.store_class_end();
  }
}

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

jclass vectorPathCommandCubicBezierCurve::Class;
jfieldID vectorPathCommandCubicBezierCurve::start_control_point_fieldID;
jfieldID vectorPathCommandCubicBezierCurve::end_control_point_fieldID;
jfieldID vectorPathCommandCubicBezierCurve::end_point_fieldID;

vectorPathCommandCubicBezierCurve::vectorPathCommandCubicBezierCurve()
  : start_control_point_()
  , end_control_point_()
  , end_point_()
{}

vectorPathCommandCubicBezierCurve::vectorPathCommandCubicBezierCurve(object_ptr<point> &&start_control_point_, object_ptr<point> &&end_control_point_, object_ptr<point> &&end_point_)
  : start_control_point_(std::move(start_control_point_))
  , end_control_point_(std::move(end_control_point_))
  , end_point_(std::move(end_point_))
{}

const std::int32_t vectorPathCommandCubicBezierCurve::ID;

object_ptr<VectorPathCommand> vectorPathCommandCubicBezierCurve::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<vectorPathCommandCubicBezierCurve> res = make_object<vectorPathCommandCubicBezierCurve>();
  res->start_control_point_ = jni::fetch_tl_object<point>(env, jni::fetch_object(env, p, res->start_control_point_fieldID));
  res->end_control_point_ = jni::fetch_tl_object<point>(env, jni::fetch_object(env, p, res->end_control_point_fieldID));
  res->end_point_ = jni::fetch_tl_object<point>(env, jni::fetch_object(env, p, res->end_point_fieldID));
  return std::move(res);
}

void vectorPathCommandCubicBezierCurve::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (start_control_point_ != nullptr) { jobject next; start_control_point_->store(env, next); if (next) { env->SetObjectField(s, start_control_point_fieldID, next); env->DeleteLocalRef(next); } }
  if (end_control_point_ != nullptr) { jobject next; end_control_point_->store(env, next); if (next) { env->SetObjectField(s, end_control_point_fieldID, next); env->DeleteLocalRef(next); } }
  if (end_point_ != nullptr) { jobject next; end_point_->store(env, next); if (next) { env->SetObjectField(s, end_point_fieldID, next); env->DeleteLocalRef(next); } }
}

void vectorPathCommandCubicBezierCurve::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VectorPathCommandCubicBezierCurve");
    s.store_object_field("startControlPoint", static_cast<const BaseObject *>(start_control_point_.get()));
    s.store_object_field("endControlPoint", static_cast<const BaseObject *>(end_control_point_.get()));
    s.store_object_field("endPoint", static_cast<const BaseObject *>(end_point_.get()));
    s.store_class_end();
  }
}

void vectorPathCommandCubicBezierCurve::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VectorPathCommandCubicBezierCurve").c_str());
    start_control_point_fieldID = jni::get_field_id(env, Class, "startControlPoint", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Point;").c_str());
    end_control_point_fieldID = jni::get_field_id(env, Class, "endControlPoint", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Point;").c_str());
    end_point_fieldID = jni::get_field_id(env, Class, "endPoint", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Point;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass webPageInstantView::Class;
jfieldID webPageInstantView::page_blocks_fieldID;
jfieldID webPageInstantView::view_count_fieldID;
jfieldID webPageInstantView::version_fieldID;
jfieldID webPageInstantView::is_rtl_fieldID;
jfieldID webPageInstantView::is_full_fieldID;
jfieldID webPageInstantView::feedback_link_fieldID;

webPageInstantView::webPageInstantView()
  : page_blocks_()
  , view_count_()
  , version_()
  , is_rtl_()
  , is_full_()
  , feedback_link_()
{}

webPageInstantView::webPageInstantView(array<object_ptr<PageBlock>> &&page_blocks_, int32 view_count_, int32 version_, bool is_rtl_, bool is_full_, object_ptr<InternalLinkType> &&feedback_link_)
  : page_blocks_(std::move(page_blocks_))
  , view_count_(view_count_)
  , version_(version_)
  , is_rtl_(is_rtl_)
  , is_full_(is_full_)
  , feedback_link_(std::move(feedback_link_))
{}

const std::int32_t webPageInstantView::ID;

object_ptr<webPageInstantView> webPageInstantView::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<webPageInstantView> res = make_object<webPageInstantView>();
  res->page_blocks_ = jni::FetchVector<PageBlock>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->page_blocks_fieldID));
  res->view_count_ = env->GetIntField(p, res->view_count_fieldID);
  res->version_ = env->GetIntField(p, res->version_fieldID);
  res->is_rtl_ = (env->GetBooleanField(p, res->is_rtl_fieldID) != 0);
  res->is_full_ = (env->GetBooleanField(p, res->is_full_fieldID) != 0);
  res->feedback_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->feedback_link_fieldID));
  return res;
}

void webPageInstantView::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, page_blocks_); if (arr_tmp_) { env->SetObjectField(s, page_blocks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, view_count_fieldID, view_count_);
  env->SetIntField(s, version_fieldID, version_);
  env->SetBooleanField(s, is_rtl_fieldID, is_rtl_);
  env->SetBooleanField(s, is_full_fieldID, is_full_);
  if (feedback_link_ != nullptr) { jobject next; feedback_link_->store(env, next); if (next) { env->SetObjectField(s, feedback_link_fieldID, next); env->DeleteLocalRef(next); } }
}

void webPageInstantView::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "WebPageInstantView");
    { s.store_vector_begin("pageBlocks", page_blocks_.size()); for (const auto &_value : page_blocks_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("viewCount", view_count_);
    s.store_field("version", version_);
    s.store_field("isRtl", is_rtl_);
    s.store_field("isFull", is_full_);
    s.store_object_field("feedbackLink", static_cast<const BaseObject *>(feedback_link_.get()));
    s.store_class_end();
  }
}

void webPageInstantView::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$WebPageInstantView").c_str());
    page_blocks_fieldID = jni::get_field_id(env, Class, "pageBlocks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlock;").c_str());
    view_count_fieldID = jni::get_field_id(env, Class, "viewCount", "I");
    version_fieldID = jni::get_field_id(env, Class, "version", "I");
    is_rtl_fieldID = jni::get_field_id(env, Class, "isRtl", "Z");
    is_full_fieldID = jni::get_field_id(env, Class, "isFull", "Z");
    feedback_link_fieldID = jni::get_field_id(env, Class, "feedbackLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass activateStoryStealthMode::Class;

activateStoryStealthMode::activateStoryStealthMode() {
}

const std::int32_t activateStoryStealthMode::ID;

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

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

activateStoryStealthMode::ReturnType activateStoryStealthMode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass addQuickReplyShortcutMessageAlbum::Class;
jfieldID addQuickReplyShortcutMessageAlbum::shortcut_name_fieldID;
jfieldID addQuickReplyShortcutMessageAlbum::reply_to_message_id_fieldID;
jfieldID addQuickReplyShortcutMessageAlbum::input_message_contents_fieldID;

addQuickReplyShortcutMessageAlbum::addQuickReplyShortcutMessageAlbum()
  : shortcut_name_()
  , reply_to_message_id_()
  , input_message_contents_()
{}

addQuickReplyShortcutMessageAlbum::addQuickReplyShortcutMessageAlbum(string const &shortcut_name_, int53 reply_to_message_id_, array<object_ptr<InputMessageContent>> &&input_message_contents_)
  : shortcut_name_(shortcut_name_)
  , reply_to_message_id_(reply_to_message_id_)
  , input_message_contents_(std::move(input_message_contents_))
{}

const std::int32_t addQuickReplyShortcutMessageAlbum::ID;

object_ptr<addQuickReplyShortcutMessageAlbum> addQuickReplyShortcutMessageAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addQuickReplyShortcutMessageAlbum> res = make_object<addQuickReplyShortcutMessageAlbum>();
  res->shortcut_name_ = jni::fetch_string(env, p, res->shortcut_name_fieldID);
  res->reply_to_message_id_ = env->GetLongField(p, res->reply_to_message_id_fieldID);
  res->input_message_contents_ = jni::FetchVector<InputMessageContent>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->input_message_contents_fieldID));
  return res;
}

void addQuickReplyShortcutMessageAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddQuickReplyShortcutMessageAlbum");
    s.store_field("shortcutName", shortcut_name_);
    s.store_field("replyToMessageId", reply_to_message_id_);
    { s.store_vector_begin("inputMessageContents", input_message_contents_.size()); for (const auto &_value : input_message_contents_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

addQuickReplyShortcutMessageAlbum::ReturnType addQuickReplyShortcutMessageAlbum::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return quickReplyMessages::fetch(env, p);
}

void addQuickReplyShortcutMessageAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddQuickReplyShortcutMessageAlbum").c_str());
    shortcut_name_fieldID = jni::get_field_id(env, Class, "shortcutName", "Ljava/lang/String;");
    reply_to_message_id_fieldID = jni::get_field_id(env, Class, "replyToMessageId", "J");
    input_message_contents_fieldID = jni::get_field_id(env, Class, "inputMessageContents", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addStoryAlbumStories::Class;
jfieldID addStoryAlbumStories::chat_id_fieldID;
jfieldID addStoryAlbumStories::story_album_id_fieldID;
jfieldID addStoryAlbumStories::story_ids_fieldID;

addStoryAlbumStories::addStoryAlbumStories()
  : chat_id_()
  , story_album_id_()
  , story_ids_()
{}

addStoryAlbumStories::addStoryAlbumStories(int53 chat_id_, int32 story_album_id_, array<int32> &&story_ids_)
  : chat_id_(chat_id_)
  , story_album_id_(story_album_id_)
  , story_ids_(std::move(story_ids_))
{}

const std::int32_t addStoryAlbumStories::ID;

object_ptr<addStoryAlbumStories> addStoryAlbumStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addStoryAlbumStories> res = make_object<addStoryAlbumStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_album_id_ = env->GetIntField(p, res->story_album_id_fieldID);
  res->story_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->story_ids_fieldID));
  return res;
}

void addStoryAlbumStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddStoryAlbumStories");
    s.store_field("chatId", chat_id_);
    s.store_field("storyAlbumId", story_album_id_);
    { s.store_vector_begin("storyIds", story_ids_.size()); for (const auto &_value : story_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

addStoryAlbumStories::ReturnType addStoryAlbumStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyAlbum::fetch(env, p);
}

void addStoryAlbumStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddStoryAlbumStories").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");
    story_ids_fieldID = jni::get_field_id(env, Class, "storyIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass answerWebAppQuery::Class;
jfieldID answerWebAppQuery::web_app_query_id_fieldID;
jfieldID answerWebAppQuery::result_fieldID;

answerWebAppQuery::answerWebAppQuery()
  : web_app_query_id_()
  , result_()
{}

answerWebAppQuery::answerWebAppQuery(string const &web_app_query_id_, object_ptr<InputInlineQueryResult> &&result_)
  : web_app_query_id_(web_app_query_id_)
  , result_(std::move(result_))
{}

const std::int32_t answerWebAppQuery::ID;

object_ptr<answerWebAppQuery> answerWebAppQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<answerWebAppQuery> res = make_object<answerWebAppQuery>();
  res->web_app_query_id_ = jni::fetch_string(env, p, res->web_app_query_id_fieldID);
  res->result_ = jni::fetch_tl_object<InputInlineQueryResult>(env, jni::fetch_object(env, p, res->result_fieldID));
  return res;
}

void answerWebAppQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnswerWebAppQuery");
    s.store_field("webAppQueryId", web_app_query_id_);
    s.store_object_field("result", static_cast<const BaseObject *>(result_.get()));
    s.store_class_end();
  }
}

answerWebAppQuery::ReturnType answerWebAppQuery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return inlineMessageId::fetch(env, p);
}

void answerWebAppQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnswerWebAppQuery").c_str());
    web_app_query_id_fieldID = jni::get_field_id(env, Class, "webAppQueryId", "Ljava/lang/String;");
    result_fieldID = jni::get_field_id(env, Class, "result", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputInlineQueryResult;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass approveSuggestedPost::Class;
jfieldID approveSuggestedPost::chat_id_fieldID;
jfieldID approveSuggestedPost::message_id_fieldID;
jfieldID approveSuggestedPost::send_date_fieldID;

approveSuggestedPost::approveSuggestedPost()
  : chat_id_()
  , message_id_()
  , send_date_()
{}

approveSuggestedPost::approveSuggestedPost(int53 chat_id_, int53 message_id_, int32 send_date_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , send_date_(send_date_)
{}

const std::int32_t approveSuggestedPost::ID;

object_ptr<approveSuggestedPost> approveSuggestedPost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<approveSuggestedPost> res = make_object<approveSuggestedPost>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->send_date_ = env->GetIntField(p, res->send_date_fieldID);
  return res;
}

void approveSuggestedPost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ApproveSuggestedPost");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("sendDate", send_date_);
    s.store_class_end();
  }
}

approveSuggestedPost::ReturnType approveSuggestedPost::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass checkAuthenticationBotToken::Class;
jfieldID checkAuthenticationBotToken::token_fieldID;

checkAuthenticationBotToken::checkAuthenticationBotToken()
  : token_()
{}

checkAuthenticationBotToken::checkAuthenticationBotToken(string const &token_)
  : token_(token_)
{}

const std::int32_t checkAuthenticationBotToken::ID;

object_ptr<checkAuthenticationBotToken> checkAuthenticationBotToken::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkAuthenticationBotToken> res = make_object<checkAuthenticationBotToken>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return res;
}

void checkAuthenticationBotToken::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckAuthenticationBotToken");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

checkAuthenticationBotToken::ReturnType checkAuthenticationBotToken::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass checkAuthenticationPassword::Class;
jfieldID checkAuthenticationPassword::password_fieldID;

checkAuthenticationPassword::checkAuthenticationPassword()
  : password_()
{}

checkAuthenticationPassword::checkAuthenticationPassword(string const &password_)
  : password_(password_)
{}

const std::int32_t checkAuthenticationPassword::ID;

object_ptr<checkAuthenticationPassword> checkAuthenticationPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkAuthenticationPassword> res = make_object<checkAuthenticationPassword>();
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void checkAuthenticationPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckAuthenticationPassword");
    s.store_field("password", password_);
    s.store_class_end();
  }
}

checkAuthenticationPassword::ReturnType checkAuthenticationPassword::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass checkRecoveryEmailAddressCode::Class;
jfieldID checkRecoveryEmailAddressCode::code_fieldID;

checkRecoveryEmailAddressCode::checkRecoveryEmailAddressCode()
  : code_()
{}

checkRecoveryEmailAddressCode::checkRecoveryEmailAddressCode(string const &code_)
  : code_(code_)
{}

const std::int32_t checkRecoveryEmailAddressCode::ID;

object_ptr<checkRecoveryEmailAddressCode> checkRecoveryEmailAddressCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkRecoveryEmailAddressCode> res = make_object<checkRecoveryEmailAddressCode>();
  res->code_ = jni::fetch_string(env, p, res->code_fieldID);
  return res;
}

void checkRecoveryEmailAddressCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckRecoveryEmailAddressCode");
    s.store_field("code", code_);
    s.store_class_end();
  }
}

checkRecoveryEmailAddressCode::ReturnType checkRecoveryEmailAddressCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

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

jclass checkWebAppFileDownload::Class;
jfieldID checkWebAppFileDownload::bot_user_id_fieldID;
jfieldID checkWebAppFileDownload::file_name_fieldID;
jfieldID checkWebAppFileDownload::url_fieldID;

checkWebAppFileDownload::checkWebAppFileDownload()
  : bot_user_id_()
  , file_name_()
  , url_()
{}

checkWebAppFileDownload::checkWebAppFileDownload(int53 bot_user_id_, string const &file_name_, string const &url_)
  : bot_user_id_(bot_user_id_)
  , file_name_(file_name_)
  , url_(url_)
{}

const std::int32_t checkWebAppFileDownload::ID;

object_ptr<checkWebAppFileDownload> checkWebAppFileDownload::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkWebAppFileDownload> res = make_object<checkWebAppFileDownload>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return res;
}

void checkWebAppFileDownload::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckWebAppFileDownload");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("fileName", file_name_);
    s.store_field("url", url_);
    s.store_class_end();
  }
}

checkWebAppFileDownload::ReturnType checkWebAppFileDownload::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clickAnimatedEmojiMessage::Class;
jfieldID clickAnimatedEmojiMessage::chat_id_fieldID;
jfieldID clickAnimatedEmojiMessage::message_id_fieldID;

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

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

const std::int32_t clickAnimatedEmojiMessage::ID;

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

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

clickAnimatedEmojiMessage::ReturnType clickAnimatedEmojiMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return sticker::fetch(env, p);
}

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

deleteAllRecentMessageReactionsFromSender::deleteAllRecentMessageReactionsFromSender()
  : chat_id_()
  , sender_id_()
{}

deleteAllRecentMessageReactionsFromSender::deleteAllRecentMessageReactionsFromSender(int53 chat_id_, object_ptr<MessageSender> &&sender_id_)
  : chat_id_(chat_id_)
  , sender_id_(std::move(sender_id_))
{}

const std::int32_t deleteAllRecentMessageReactionsFromSender::ID;

object_ptr<deleteAllRecentMessageReactionsFromSender> deleteAllRecentMessageReactionsFromSender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteAllRecentMessageReactionsFromSender> res = make_object<deleteAllRecentMessageReactionsFromSender>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  return res;
}

void deleteAllRecentMessageReactionsFromSender::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteAllRecentMessageReactionsFromSender");
    s.store_field("chatId", chat_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_class_end();
  }
}

deleteAllRecentMessageReactionsFromSender::ReturnType deleteAllRecentMessageReactionsFromSender::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteBusinessConnectedBot::Class;
jfieldID deleteBusinessConnectedBot::bot_user_id_fieldID;

deleteBusinessConnectedBot::deleteBusinessConnectedBot()
  : bot_user_id_()
{}

deleteBusinessConnectedBot::deleteBusinessConnectedBot(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t deleteBusinessConnectedBot::ID;

object_ptr<deleteBusinessConnectedBot> deleteBusinessConnectedBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteBusinessConnectedBot> res = make_object<deleteBusinessConnectedBot>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return res;
}

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

deleteBusinessConnectedBot::ReturnType deleteBusinessConnectedBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteBusinessStory::Class;
jfieldID deleteBusinessStory::business_connection_id_fieldID;
jfieldID deleteBusinessStory::story_id_fieldID;

deleteBusinessStory::deleteBusinessStory()
  : business_connection_id_()
  , story_id_()
{}

deleteBusinessStory::deleteBusinessStory(string const &business_connection_id_, int32 story_id_)
  : business_connection_id_(business_connection_id_)
  , story_id_(story_id_)
{}

const std::int32_t deleteBusinessStory::ID;

object_ptr<deleteBusinessStory> deleteBusinessStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteBusinessStory> res = make_object<deleteBusinessStory>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  return res;
}

void deleteBusinessStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteBusinessStory");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("storyId", story_id_);
    s.store_class_end();
  }
}

deleteBusinessStory::ReturnType deleteBusinessStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteBusinessStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteBusinessStory").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass deleteChatFolder::Class;
jfieldID deleteChatFolder::chat_folder_id_fieldID;
jfieldID deleteChatFolder::leave_chat_ids_fieldID;

deleteChatFolder::deleteChatFolder()
  : chat_folder_id_()
  , leave_chat_ids_()
{}

deleteChatFolder::deleteChatFolder(int32 chat_folder_id_, array<int53> &&leave_chat_ids_)
  : chat_folder_id_(chat_folder_id_)
  , leave_chat_ids_(std::move(leave_chat_ids_))
{}

const std::int32_t deleteChatFolder::ID;

object_ptr<deleteChatFolder> deleteChatFolder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteChatFolder> res = make_object<deleteChatFolder>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  res->leave_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->leave_chat_ids_fieldID));
  return res;
}

void deleteChatFolder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteChatFolder");
    s.store_field("chatFolderId", chat_folder_id_);
    { s.store_vector_begin("leaveChatIds", leave_chat_ids_.size()); for (const auto &_value : leave_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

deleteChatFolder::ReturnType deleteChatFolder::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteChatFolder::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteChatFolder").c_str());
    chat_folder_id_fieldID = jni::get_field_id(env, Class, "chatFolderId", "I");
    leave_chat_ids_fieldID = jni::get_field_id(env, Class, "leaveChatIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass deleteDefaultBackground::Class;
jfieldID deleteDefaultBackground::for_dark_theme_fieldID;

deleteDefaultBackground::deleteDefaultBackground()
  : for_dark_theme_()
{}

deleteDefaultBackground::deleteDefaultBackground(bool for_dark_theme_)
  : for_dark_theme_(for_dark_theme_)
{}

const std::int32_t deleteDefaultBackground::ID;

object_ptr<deleteDefaultBackground> deleteDefaultBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteDefaultBackground> res = make_object<deleteDefaultBackground>();
  res->for_dark_theme_ = (env->GetBooleanField(p, res->for_dark_theme_fieldID) != 0);
  return res;
}

void deleteDefaultBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteDefaultBackground");
    s.store_field("forDarkTheme", for_dark_theme_);
    s.store_class_end();
  }
}

deleteDefaultBackground::ReturnType deleteDefaultBackground::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteMessages::Class;
jfieldID deleteMessages::chat_id_fieldID;
jfieldID deleteMessages::message_ids_fieldID;
jfieldID deleteMessages::revoke_fieldID;

deleteMessages::deleteMessages()
  : chat_id_()
  , message_ids_()
  , revoke_()
{}

deleteMessages::deleteMessages(int53 chat_id_, array<int53> &&message_ids_, bool revoke_)
  : chat_id_(chat_id_)
  , message_ids_(std::move(message_ids_))
  , revoke_(revoke_)
{}

const std::int32_t deleteMessages::ID;

object_ptr<deleteMessages> deleteMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteMessages> res = make_object<deleteMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  res->revoke_ = (env->GetBooleanField(p, res->revoke_fieldID) != 0);
  return res;
}

void deleteMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteMessages");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("revoke", revoke_);
    s.store_class_end();
  }
}

deleteMessages::ReturnType deleteMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteRevokedChatInviteLink::Class;
jfieldID deleteRevokedChatInviteLink::chat_id_fieldID;
jfieldID deleteRevokedChatInviteLink::invite_link_fieldID;

deleteRevokedChatInviteLink::deleteRevokedChatInviteLink()
  : chat_id_()
  , invite_link_()
{}

deleteRevokedChatInviteLink::deleteRevokedChatInviteLink(int53 chat_id_, string const &invite_link_)
  : chat_id_(chat_id_)
  , invite_link_(invite_link_)
{}

const std::int32_t deleteRevokedChatInviteLink::ID;

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

deleteRevokedChatInviteLink::ReturnType deleteRevokedChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

deleteStickerSet::deleteStickerSet()
  : name_()
{}

deleteStickerSet::deleteStickerSet(string const &name_)
  : name_(name_)
{}

const std::int32_t deleteStickerSet::ID;

object_ptr<deleteStickerSet> deleteStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteStickerSet> res = make_object<deleteStickerSet>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void deleteStickerSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteStickerSet");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

deleteStickerSet::ReturnType deleteStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass destroy::Class;

destroy::destroy() {
}

const std::int32_t destroy::ID;

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

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

destroy::ReturnType destroy::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass editBotMediaPreview::Class;
jfieldID editBotMediaPreview::bot_user_id_fieldID;
jfieldID editBotMediaPreview::language_code_fieldID;
jfieldID editBotMediaPreview::file_id_fieldID;
jfieldID editBotMediaPreview::content_fieldID;

editBotMediaPreview::editBotMediaPreview()
  : bot_user_id_()
  , language_code_()
  , file_id_()
  , content_()
{}

editBotMediaPreview::editBotMediaPreview(int53 bot_user_id_, string const &language_code_, int32 file_id_, object_ptr<InputStoryContent> &&content_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
  , file_id_(file_id_)
  , content_(std::move(content_))
{}

const std::int32_t editBotMediaPreview::ID;

object_ptr<editBotMediaPreview> editBotMediaPreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBotMediaPreview> res = make_object<editBotMediaPreview>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->content_ = jni::fetch_tl_object<InputStoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  return res;
}

void editBotMediaPreview::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBotMediaPreview");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_field("fileId", file_id_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_class_end();
  }
}

editBotMediaPreview::ReturnType editBotMediaPreview::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botMediaPreview::fetch(env, p);
}

void editBotMediaPreview::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBotMediaPreview").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    language_code_fieldID = jni::get_field_id(env, Class, "languageCode", "Ljava/lang/String;");
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editBusinessMessageCaption::Class;
jfieldID editBusinessMessageCaption::business_connection_id_fieldID;
jfieldID editBusinessMessageCaption::chat_id_fieldID;
jfieldID editBusinessMessageCaption::message_id_fieldID;
jfieldID editBusinessMessageCaption::reply_markup_fieldID;
jfieldID editBusinessMessageCaption::caption_fieldID;
jfieldID editBusinessMessageCaption::show_caption_above_media_fieldID;

editBusinessMessageCaption::editBusinessMessageCaption()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
  , caption_()
  , show_caption_above_media_()
{}

editBusinessMessageCaption::editBusinessMessageCaption(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_)
  : business_connection_id_(business_connection_id_)
  , 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 editBusinessMessageCaption::ID;

object_ptr<editBusinessMessageCaption> editBusinessMessageCaption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessMessageCaption> res = make_object<editBusinessMessageCaption>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->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 editBusinessMessageCaption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessMessageCaption");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_class_end();
  }
}

editBusinessMessageCaption::ReturnType editBusinessMessageCaption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void editBusinessMessageCaption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessMessageCaption").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());
    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 editBusinessMessageMedia::Class;
jfieldID editBusinessMessageMedia::business_connection_id_fieldID;
jfieldID editBusinessMessageMedia::chat_id_fieldID;
jfieldID editBusinessMessageMedia::message_id_fieldID;
jfieldID editBusinessMessageMedia::reply_markup_fieldID;
jfieldID editBusinessMessageMedia::input_message_content_fieldID;

editBusinessMessageMedia::editBusinessMessageMedia()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
  , input_message_content_()
{}

editBusinessMessageMedia::editBusinessMessageMedia(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editBusinessMessageMedia::ID;

object_ptr<editBusinessMessageMedia> editBusinessMessageMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessMessageMedia> res = make_object<editBusinessMessageMedia>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void editBusinessMessageMedia::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessMessageMedia");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

editBusinessMessageMedia::ReturnType editBusinessMessageMedia::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void editBusinessMessageMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessMessageMedia").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    input_message_content_fieldID = jni::get_field_id(env, Class, "inputMessageContent", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editStarSubscription::Class;
jfieldID editStarSubscription::subscription_id_fieldID;
jfieldID editStarSubscription::is_canceled_fieldID;

editStarSubscription::editStarSubscription()
  : subscription_id_()
  , is_canceled_()
{}

editStarSubscription::editStarSubscription(string const &subscription_id_, bool is_canceled_)
  : subscription_id_(subscription_id_)
  , is_canceled_(is_canceled_)
{}

const std::int32_t editStarSubscription::ID;

object_ptr<editStarSubscription> editStarSubscription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editStarSubscription> res = make_object<editStarSubscription>();
  res->subscription_id_ = jni::fetch_string(env, p, res->subscription_id_fieldID);
  res->is_canceled_ = (env->GetBooleanField(p, res->is_canceled_fieldID) != 0);
  return res;
}

void editStarSubscription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditStarSubscription");
    s.store_field("subscriptionId", subscription_id_);
    s.store_field("isCanceled", is_canceled_);
    s.store_class_end();
  }
}

editStarSubscription::ReturnType editStarSubscription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editStarSubscription::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditStarSubscription").c_str());
    subscription_id_fieldID = jni::get_field_id(env, Class, "subscriptionId", "Ljava/lang/String;");
    is_canceled_fieldID = jni::get_field_id(env, Class, "isCanceled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass editStory::Class;
jfieldID editStory::story_poster_chat_id_fieldID;
jfieldID editStory::story_id_fieldID;
jfieldID editStory::content_fieldID;
jfieldID editStory::areas_fieldID;
jfieldID editStory::caption_fieldID;

editStory::editStory()
  : story_poster_chat_id_()
  , story_id_()
  , content_()
  , areas_()
  , caption_()
{}

editStory::editStory(int53 story_poster_chat_id_, int32 story_id_, object_ptr<InputStoryContent> &&content_, object_ptr<inputStoryAreas> &&areas_, object_ptr<formattedText> &&caption_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , content_(std::move(content_))
  , areas_(std::move(areas_))
  , caption_(std::move(caption_))
{}

const std::int32_t editStory::ID;

object_ptr<editStory> editStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editStory> res = make_object<editStory>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->content_ = jni::fetch_tl_object<InputStoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  res->areas_ = jni::fetch_tl_object<inputStoryAreas>(env, jni::fetch_object(env, p, res->areas_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return res;
}

void editStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_object_field("areas", static_cast<const BaseObject *>(areas_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

editStory::ReturnType editStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditStory").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");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryContent;").c_str());
    areas_fieldID = jni::get_field_id(env, Class, "areas", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryAreas;").c_str());
    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 editUserStarSubscription::Class;
jfieldID editUserStarSubscription::user_id_fieldID;
jfieldID editUserStarSubscription::telegram_payment_charge_id_fieldID;
jfieldID editUserStarSubscription::is_canceled_fieldID;

editUserStarSubscription::editUserStarSubscription()
  : user_id_()
  , telegram_payment_charge_id_()
  , is_canceled_()
{}

editUserStarSubscription::editUserStarSubscription(int53 user_id_, string const &telegram_payment_charge_id_, bool is_canceled_)
  : user_id_(user_id_)
  , telegram_payment_charge_id_(telegram_payment_charge_id_)
  , is_canceled_(is_canceled_)
{}

const std::int32_t editUserStarSubscription::ID;

object_ptr<editUserStarSubscription> editUserStarSubscription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editUserStarSubscription> res = make_object<editUserStarSubscription>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->telegram_payment_charge_id_ = jni::fetch_string(env, p, res->telegram_payment_charge_id_fieldID);
  res->is_canceled_ = (env->GetBooleanField(p, res->is_canceled_fieldID) != 0);
  return res;
}

void editUserStarSubscription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditUserStarSubscription");
    s.store_field("userId", user_id_);
    s.store_field("telegramPaymentChargeId", telegram_payment_charge_id_);
    s.store_field("isCanceled", is_canceled_);
    s.store_class_end();
  }
}

editUserStarSubscription::ReturnType editUserStarSubscription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editUserStarSubscription::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditUserStarSubscription").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    telegram_payment_charge_id_fieldID = jni::get_field_id(env, Class, "telegramPaymentChargeId", "Ljava/lang/String;");
    is_canceled_fieldID = jni::get_field_id(env, Class, "isCanceled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass endGroupCall::Class;
jfieldID endGroupCall::group_call_id_fieldID;

endGroupCall::endGroupCall()
  : group_call_id_()
{}

endGroupCall::endGroupCall(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t endGroupCall::ID;

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

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

endGroupCall::ReturnType endGroupCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass getActiveSessions::Class;

getActiveSessions::getActiveSessions() {
}

const std::int32_t getActiveSessions::ID;

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

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

getActiveSessions::ReturnType getActiveSessions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return sessions::fetch(env, p);
}

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

jclass getBotMediaPreviews::Class;
jfieldID getBotMediaPreviews::bot_user_id_fieldID;

getBotMediaPreviews::getBotMediaPreviews()
  : bot_user_id_()
{}

getBotMediaPreviews::getBotMediaPreviews(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t getBotMediaPreviews::ID;

object_ptr<getBotMediaPreviews> getBotMediaPreviews::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotMediaPreviews> res = make_object<getBotMediaPreviews>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return res;
}

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

getBotMediaPreviews::ReturnType getBotMediaPreviews::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botMediaPreviews::fetch(env, p);
}

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

jclass getBusinessChatLinks::Class;

getBusinessChatLinks::getBusinessChatLinks() {
}

const std::int32_t getBusinessChatLinks::ID;

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

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

getBusinessChatLinks::ReturnType getBusinessChatLinks::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessChatLinks::fetch(env, p);
}

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

jclass getBusinessConnection::Class;
jfieldID getBusinessConnection::connection_id_fieldID;

getBusinessConnection::getBusinessConnection()
  : connection_id_()
{}

getBusinessConnection::getBusinessConnection(string const &connection_id_)
  : connection_id_(connection_id_)
{}

const std::int32_t getBusinessConnection::ID;

object_ptr<getBusinessConnection> getBusinessConnection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBusinessConnection> res = make_object<getBusinessConnection>();
  res->connection_id_ = jni::fetch_string(env, p, res->connection_id_fieldID);
  return res;
}

void getBusinessConnection::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBusinessConnection");
    s.store_field("connectionId", connection_id_);
    s.store_class_end();
  }
}

getBusinessConnection::ReturnType getBusinessConnection::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessConnection::fetch(env, p);
}

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

jclass getChatEventLog::Class;
jfieldID getChatEventLog::chat_id_fieldID;
jfieldID getChatEventLog::query_fieldID;
jfieldID getChatEventLog::from_event_id_fieldID;
jfieldID getChatEventLog::limit_fieldID;
jfieldID getChatEventLog::filters_fieldID;
jfieldID getChatEventLog::user_ids_fieldID;

getChatEventLog::getChatEventLog()
  : chat_id_()
  , query_()
  , from_event_id_()
  , limit_()
  , filters_()
  , user_ids_()
{}

getChatEventLog::getChatEventLog(int53 chat_id_, string const &query_, int64 from_event_id_, int32 limit_, object_ptr<chatEventLogFilters> &&filters_, array<int53> &&user_ids_)
  : chat_id_(chat_id_)
  , query_(query_)
  , from_event_id_(from_event_id_)
  , limit_(limit_)
  , filters_(std::move(filters_))
  , user_ids_(std::move(user_ids_))
{}

const std::int32_t getChatEventLog::ID;

object_ptr<getChatEventLog> getChatEventLog::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatEventLog> res = make_object<getChatEventLog>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->from_event_id_ = env->GetLongField(p, res->from_event_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->filters_ = jni::fetch_tl_object<chatEventLogFilters>(env, jni::fetch_object(env, p, res->filters_fieldID));
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return res;
}

void getChatEventLog::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatEventLog");
    s.store_field("chatId", chat_id_);
    s.store_field("query", query_);
    s.store_field("fromEventId", from_event_id_);
    s.store_field("limit", limit_);
    s.store_object_field("filters", static_cast<const BaseObject *>(filters_.get()));
    { 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();
  }
}

getChatEventLog::ReturnType getChatEventLog::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatEvents::fetch(env, p);
}

void getChatEventLog::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatEventLog").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    from_event_id_fieldID = jni::get_field_id(env, Class, "fromEventId", "J");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    filters_fieldID = jni::get_field_id(env, Class, "filters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatEventLogFilters;").c_str());
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass getChatPinnedMessage::Class;
jfieldID getChatPinnedMessage::chat_id_fieldID;

getChatPinnedMessage::getChatPinnedMessage()
  : chat_id_()
{}

getChatPinnedMessage::getChatPinnedMessage(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatPinnedMessage::ID;

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

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

getChatPinnedMessage::ReturnType getChatPinnedMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

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

jclass getChatPostedToChatPageStories::Class;
jfieldID getChatPostedToChatPageStories::chat_id_fieldID;
jfieldID getChatPostedToChatPageStories::from_story_id_fieldID;
jfieldID getChatPostedToChatPageStories::limit_fieldID;

getChatPostedToChatPageStories::getChatPostedToChatPageStories()
  : chat_id_()
  , from_story_id_()
  , limit_()
{}

getChatPostedToChatPageStories::getChatPostedToChatPageStories(int53 chat_id_, int32 from_story_id_, int32 limit_)
  : chat_id_(chat_id_)
  , from_story_id_(from_story_id_)
  , limit_(limit_)
{}

const std::int32_t getChatPostedToChatPageStories::ID;

object_ptr<getChatPostedToChatPageStories> getChatPostedToChatPageStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatPostedToChatPageStories> res = make_object<getChatPostedToChatPageStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->from_story_id_ = env->GetIntField(p, res->from_story_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatPostedToChatPageStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatPostedToChatPageStories");
    s.store_field("chatId", chat_id_);
    s.store_field("fromStoryId", from_story_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatPostedToChatPageStories::ReturnType getChatPostedToChatPageStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stories::fetch(env, p);
}

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

jclass getChatSimilarChatCount::Class;
jfieldID getChatSimilarChatCount::chat_id_fieldID;
jfieldID getChatSimilarChatCount::return_local_fieldID;

getChatSimilarChatCount::getChatSimilarChatCount()
  : chat_id_()
  , return_local_()
{}

getChatSimilarChatCount::getChatSimilarChatCount(int53 chat_id_, bool return_local_)
  : chat_id_(chat_id_)
  , return_local_(return_local_)
{}

const std::int32_t getChatSimilarChatCount::ID;

object_ptr<getChatSimilarChatCount> getChatSimilarChatCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatSimilarChatCount> res = make_object<getChatSimilarChatCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->return_local_ = (env->GetBooleanField(p, res->return_local_fieldID) != 0);
  return res;
}

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

getChatSimilarChatCount::ReturnType getChatSimilarChatCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return count::fetch(env, p);
}

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

jclass getCustomEmojiStickers::Class;
jfieldID getCustomEmojiStickers::custom_emoji_ids_fieldID;

getCustomEmojiStickers::getCustomEmojiStickers()
  : custom_emoji_ids_()
{}

getCustomEmojiStickers::getCustomEmojiStickers(array<int64> &&custom_emoji_ids_)
  : custom_emoji_ids_(std::move(custom_emoji_ids_))
{}

const std::int32_t getCustomEmojiStickers::ID;

object_ptr<getCustomEmojiStickers> getCustomEmojiStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getCustomEmojiStickers> res = make_object<getCustomEmojiStickers>();
  res->custom_emoji_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->custom_emoji_ids_fieldID));
  return res;
}

void getCustomEmojiStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetCustomEmojiStickers");
    { s.store_vector_begin("customEmojiIds", custom_emoji_ids_.size()); for (const auto &_value : custom_emoji_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

getCustomEmojiStickers::ReturnType getCustomEmojiStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getGroupCallStreams::Class;
jfieldID getGroupCallStreams::group_call_id_fieldID;

getGroupCallStreams::getGroupCallStreams()
  : group_call_id_()
{}

getGroupCallStreams::getGroupCallStreams(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t getGroupCallStreams::ID;

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

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

getGroupCallStreams::ReturnType getGroupCallStreams::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return groupCallStreams::fetch(env, p);
}

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

jclass getInstalledBackgrounds::Class;
jfieldID getInstalledBackgrounds::for_dark_theme_fieldID;

getInstalledBackgrounds::getInstalledBackgrounds()
  : for_dark_theme_()
{}

getInstalledBackgrounds::getInstalledBackgrounds(bool for_dark_theme_)
  : for_dark_theme_(for_dark_theme_)
{}

const std::int32_t getInstalledBackgrounds::ID;

object_ptr<getInstalledBackgrounds> getInstalledBackgrounds::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getInstalledBackgrounds> res = make_object<getInstalledBackgrounds>();
  res->for_dark_theme_ = (env->GetBooleanField(p, res->for_dark_theme_fieldID) != 0);
  return res;
}

void getInstalledBackgrounds::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetInstalledBackgrounds");
    s.store_field("forDarkTheme", for_dark_theme_);
    s.store_class_end();
  }
}

getInstalledBackgrounds::ReturnType getInstalledBackgrounds::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return backgrounds::fetch(env, p);
}

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

jclass getJsonValue::Class;
jfieldID getJsonValue::json_fieldID;

getJsonValue::getJsonValue()
  : json_()
{}

getJsonValue::getJsonValue(string const &json_)
  : json_(json_)
{}

const std::int32_t getJsonValue::ID;

object_ptr<getJsonValue> getJsonValue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getJsonValue> res = make_object<getJsonValue>();
  res->json_ = jni::fetch_string(env, p, res->json_fieldID);
  return res;
}

void getJsonValue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetJsonValue");
    s.store_field("json", json_);
    s.store_class_end();
  }
}

getJsonValue::ReturnType getJsonValue::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return JsonValue::fetch(env, p);
}

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

jclass getLinkPreview::Class;
jfieldID getLinkPreview::text_fieldID;
jfieldID getLinkPreview::link_preview_options_fieldID;

getLinkPreview::getLinkPreview()
  : text_()
  , link_preview_options_()
{}

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

const std::int32_t getLinkPreview::ID;

object_ptr<getLinkPreview> getLinkPreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getLinkPreview> res = make_object<getLinkPreview>();
  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));
  return res;
}

void getLinkPreview::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLinkPreview");
    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_class_end();
  }
}

getLinkPreview::ReturnType getLinkPreview::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return linkPreview::fetch(env, p);
}

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

jclass getMessageEffect::Class;
jfieldID getMessageEffect::effect_id_fieldID;

getMessageEffect::getMessageEffect()
  : effect_id_()
{}

getMessageEffect::getMessageEffect(int64 effect_id_)
  : effect_id_(effect_id_)
{}

const std::int32_t getMessageEffect::ID;

object_ptr<getMessageEffect> getMessageEffect::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageEffect> res = make_object<getMessageEffect>();
  res->effect_id_ = env->GetLongField(p, res->effect_id_fieldID);
  return res;
}

void getMessageEffect::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageEffect");
    s.store_field("effectId", effect_id_);
    s.store_class_end();
  }
}

getMessageEffect::ReturnType getMessageEffect::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageEffect::fetch(env, p);
}

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

jclass getMessageThread::Class;
jfieldID getMessageThread::chat_id_fieldID;
jfieldID getMessageThread::message_id_fieldID;

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

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

const std::int32_t getMessageThread::ID;

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

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

getMessageThread::ReturnType getMessageThread::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageThreadInfo::fetch(env, p);
}

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

getPasswordState::getPasswordState() {
}

const std::int32_t getPasswordState::ID;

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

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

getPasswordState::ReturnType getPasswordState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

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

jclass getPhoneNumberInfo::Class;
jfieldID getPhoneNumberInfo::phone_number_prefix_fieldID;

getPhoneNumberInfo::getPhoneNumberInfo()
  : phone_number_prefix_()
{}

getPhoneNumberInfo::getPhoneNumberInfo(string const &phone_number_prefix_)
  : phone_number_prefix_(phone_number_prefix_)
{}

const std::int32_t getPhoneNumberInfo::ID;

object_ptr<getPhoneNumberInfo> getPhoneNumberInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPhoneNumberInfo> res = make_object<getPhoneNumberInfo>();
  res->phone_number_prefix_ = jni::fetch_string(env, p, res->phone_number_prefix_fieldID);
  return res;
}

void getPhoneNumberInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPhoneNumberInfo");
    s.store_field("phoneNumberPrefix", phone_number_prefix_);
    s.store_class_end();
  }
}

getPhoneNumberInfo::ReturnType getPhoneNumberInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return phoneNumberInfo::fetch(env, p);
}

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

jclass getPremiumStickerExamples::Class;

getPremiumStickerExamples::getPremiumStickerExamples() {
}

const std::int32_t getPremiumStickerExamples::ID;

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

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

getPremiumStickerExamples::ReturnType getPremiumStickerExamples::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getSavedNotificationSound::Class;
jfieldID getSavedNotificationSound::notification_sound_id_fieldID;

getSavedNotificationSound::getSavedNotificationSound()
  : notification_sound_id_()
{}

getSavedNotificationSound::getSavedNotificationSound(int64 notification_sound_id_)
  : notification_sound_id_(notification_sound_id_)
{}

const std::int32_t getSavedNotificationSound::ID;

object_ptr<getSavedNotificationSound> getSavedNotificationSound::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getSavedNotificationSound> res = make_object<getSavedNotificationSound>();
  res->notification_sound_id_ = env->GetLongField(p, res->notification_sound_id_fieldID);
  return res;
}

void getSavedNotificationSound::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSavedNotificationSound");
    s.store_field("notificationSoundId", notification_sound_id_);
    s.store_class_end();
  }
}

getSavedNotificationSound::ReturnType getSavedNotificationSound::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return notificationSound::fetch(env, p);
}

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

jclass getStickerEmojis::Class;
jfieldID getStickerEmojis::sticker_fieldID;

getStickerEmojis::getStickerEmojis()
  : sticker_()
{}

getStickerEmojis::getStickerEmojis(object_ptr<InputFile> &&sticker_)
  : sticker_(std::move(sticker_))
{}

const std::int32_t getStickerEmojis::ID;

object_ptr<getStickerEmojis> getStickerEmojis::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStickerEmojis> res = make_object<getStickerEmojis>();
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

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

getStickerEmojis::ReturnType getStickerEmojis::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojis::fetch(env, p);
}

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

jclass getStory::Class;
jfieldID getStory::story_poster_chat_id_fieldID;
jfieldID getStory::story_id_fieldID;
jfieldID getStory::only_local_fieldID;

getStory::getStory()
  : story_poster_chat_id_()
  , story_id_()
  , only_local_()
{}

getStory::getStory(int53 story_poster_chat_id_, int32 story_id_, bool only_local_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , only_local_(only_local_)
{}

const std::int32_t getStory::ID;

object_ptr<getStory> getStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStory> res = make_object<getStory>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->only_local_ = (env->GetBooleanField(p, res->only_local_fieldID) != 0);
  return res;
}

void getStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_field("onlyLocal", only_local_);
    s.store_class_end();
  }
}

getStory::ReturnType getStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return story::fetch(env, p);
}

void getStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStory").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");
    only_local_fieldID = jni::get_field_id(env, Class, "onlyLocal", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getStoryInteractions::Class;
jfieldID getStoryInteractions::story_id_fieldID;
jfieldID getStoryInteractions::query_fieldID;
jfieldID getStoryInteractions::only_contacts_fieldID;
jfieldID getStoryInteractions::prefer_forwards_fieldID;
jfieldID getStoryInteractions::prefer_with_reaction_fieldID;
jfieldID getStoryInteractions::offset_fieldID;
jfieldID getStoryInteractions::limit_fieldID;

getStoryInteractions::getStoryInteractions()
  : story_id_()
  , query_()
  , only_contacts_()
  , prefer_forwards_()
  , prefer_with_reaction_()
  , offset_()
  , limit_()
{}

getStoryInteractions::getStoryInteractions(int32 story_id_, string const &query_, bool only_contacts_, bool prefer_forwards_, bool prefer_with_reaction_, string const &offset_, int32 limit_)
  : story_id_(story_id_)
  , query_(query_)
  , only_contacts_(only_contacts_)
  , prefer_forwards_(prefer_forwards_)
  , prefer_with_reaction_(prefer_with_reaction_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getStoryInteractions::ID;

object_ptr<getStoryInteractions> getStoryInteractions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStoryInteractions> res = make_object<getStoryInteractions>();
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->only_contacts_ = (env->GetBooleanField(p, res->only_contacts_fieldID) != 0);
  res->prefer_forwards_ = (env->GetBooleanField(p, res->prefer_forwards_fieldID) != 0);
  res->prefer_with_reaction_ = (env->GetBooleanField(p, res->prefer_with_reaction_fieldID) != 0);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getStoryInteractions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStoryInteractions");
    s.store_field("storyId", story_id_);
    s.store_field("query", query_);
    s.store_field("onlyContacts", only_contacts_);
    s.store_field("preferForwards", prefer_forwards_);
    s.store_field("preferWithReaction", prefer_with_reaction_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getStoryInteractions::ReturnType getStoryInteractions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyInteractions::fetch(env, p);
}

void getStoryInteractions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStoryInteractions").c_str());
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    only_contacts_fieldID = jni::get_field_id(env, Class, "onlyContacts", "Z");
    prefer_forwards_fieldID = jni::get_field_id(env, Class, "preferForwards", "Z");
    prefer_with_reaction_fieldID = jni::get_field_id(env, Class, "preferWithReaction", "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 getStoryStatistics::Class;
jfieldID getStoryStatistics::chat_id_fieldID;
jfieldID getStoryStatistics::story_id_fieldID;
jfieldID getStoryStatistics::is_dark_fieldID;

getStoryStatistics::getStoryStatistics()
  : chat_id_()
  , story_id_()
  , is_dark_()
{}

getStoryStatistics::getStoryStatistics(int53 chat_id_, int32 story_id_, bool is_dark_)
  : chat_id_(chat_id_)
  , story_id_(story_id_)
  , is_dark_(is_dark_)
{}

const std::int32_t getStoryStatistics::ID;

object_ptr<getStoryStatistics> getStoryStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStoryStatistics> res = make_object<getStoryStatistics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->is_dark_ = (env->GetBooleanField(p, res->is_dark_fieldID) != 0);
  return res;
}

void getStoryStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStoryStatistics");
    s.store_field("chatId", chat_id_);
    s.store_field("storyId", story_id_);
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getStoryStatistics::ReturnType getStoryStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyStatistics::fetch(env, p);
}

void getStoryStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStoryStatistics").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    is_dark_fieldID = jni::get_field_id(env, Class, "isDark", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getTopChats::Class;
jfieldID getTopChats::category_fieldID;
jfieldID getTopChats::limit_fieldID;

getTopChats::getTopChats()
  : category_()
  , limit_()
{}

getTopChats::getTopChats(object_ptr<TopChatCategory> &&category_, int32 limit_)
  : category_(std::move(category_))
  , limit_(limit_)
{}

const std::int32_t getTopChats::ID;

object_ptr<getTopChats> getTopChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getTopChats> res = make_object<getTopChats>();
  res->category_ = jni::fetch_tl_object<TopChatCategory>(env, jni::fetch_object(env, p, res->category_fieldID));
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getTopChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetTopChats");
    s.store_object_field("category", static_cast<const BaseObject *>(category_.get()));
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getTopChats::ReturnType getTopChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void getTopChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetTopChats").c_str());
    category_fieldID = jni::get_field_id(env, Class, "category", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TopChatCategory;").c_str());
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getUpgradedGiftEmojiStatuses::Class;

getUpgradedGiftEmojiStatuses::getUpgradedGiftEmojiStatuses() {
}

const std::int32_t getUpgradedGiftEmojiStatuses::ID;

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

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

getUpgradedGiftEmojiStatuses::ReturnType getUpgradedGiftEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatuses::fetch(env, p);
}

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

jclass getUpgradedGiftValueInfo::Class;
jfieldID getUpgradedGiftValueInfo::name_fieldID;

getUpgradedGiftValueInfo::getUpgradedGiftValueInfo()
  : name_()
{}

getUpgradedGiftValueInfo::getUpgradedGiftValueInfo(string const &name_)
  : name_(name_)
{}

const std::int32_t getUpgradedGiftValueInfo::ID;

object_ptr<getUpgradedGiftValueInfo> getUpgradedGiftValueInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getUpgradedGiftValueInfo> res = make_object<getUpgradedGiftValueInfo>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

void getUpgradedGiftValueInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetUpgradedGiftValueInfo");
    s.store_field("name", name_);
    s.store_class_end();
  }
}

getUpgradedGiftValueInfo::ReturnType getUpgradedGiftValueInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return upgradedGiftValueInfo::fetch(env, p);
}

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

jclass getUser::Class;
jfieldID getUser::user_id_fieldID;

getUser::getUser()
  : user_id_()
{}

getUser::getUser(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t getUser::ID;

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

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

getUser::ReturnType getUser::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return user::fetch(env, p);
}

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

jclass getWebAppPlaceholder::Class;
jfieldID getWebAppPlaceholder::bot_user_id_fieldID;

getWebAppPlaceholder::getWebAppPlaceholder()
  : bot_user_id_()
{}

getWebAppPlaceholder::getWebAppPlaceholder(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t getWebAppPlaceholder::ID;

object_ptr<getWebAppPlaceholder> getWebAppPlaceholder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getWebAppPlaceholder> res = make_object<getWebAppPlaceholder>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return res;
}

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

getWebAppPlaceholder::ReturnType getWebAppPlaceholder::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return outline::fetch(env, p);
}

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

jclass hideContactCloseBirthdays::Class;

hideContactCloseBirthdays::hideContactCloseBirthdays() {
}

const std::int32_t hideContactCloseBirthdays::ID;

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

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

hideContactCloseBirthdays::ReturnType hideContactCloseBirthdays::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass joinLiveStory::Class;
jfieldID joinLiveStory::group_call_id_fieldID;
jfieldID joinLiveStory::join_parameters_fieldID;

joinLiveStory::joinLiveStory()
  : group_call_id_()
  , join_parameters_()
{}

joinLiveStory::joinLiveStory(int32 group_call_id_, object_ptr<groupCallJoinParameters> &&join_parameters_)
  : group_call_id_(group_call_id_)
  , join_parameters_(std::move(join_parameters_))
{}

const std::int32_t joinLiveStory::ID;

object_ptr<joinLiveStory> joinLiveStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<joinLiveStory> res = make_object<joinLiveStory>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->join_parameters_ = jni::fetch_tl_object<groupCallJoinParameters>(env, jni::fetch_object(env, p, res->join_parameters_fieldID));
  return res;
}

void joinLiveStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "JoinLiveStory");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("joinParameters", static_cast<const BaseObject *>(join_parameters_.get()));
    s.store_class_end();
  }
}

joinLiveStory::ReturnType joinLiveStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void joinLiveStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$JoinLiveStory").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    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 launchPrepaidGiveaway::Class;
jfieldID launchPrepaidGiveaway::giveaway_id_fieldID;
jfieldID launchPrepaidGiveaway::parameters_fieldID;
jfieldID launchPrepaidGiveaway::winner_count_fieldID;
jfieldID launchPrepaidGiveaway::star_count_fieldID;

launchPrepaidGiveaway::launchPrepaidGiveaway()
  : giveaway_id_()
  , parameters_()
  , winner_count_()
  , star_count_()
{}

launchPrepaidGiveaway::launchPrepaidGiveaway(int64 giveaway_id_, object_ptr<giveawayParameters> &&parameters_, int32 winner_count_, int53 star_count_)
  : giveaway_id_(giveaway_id_)
  , parameters_(std::move(parameters_))
  , winner_count_(winner_count_)
  , star_count_(star_count_)
{}

const std::int32_t launchPrepaidGiveaway::ID;

object_ptr<launchPrepaidGiveaway> launchPrepaidGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<launchPrepaidGiveaway> res = make_object<launchPrepaidGiveaway>();
  res->giveaway_id_ = env->GetLongField(p, res->giveaway_id_fieldID);
  res->parameters_ = jni::fetch_tl_object<giveawayParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

void launchPrepaidGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LaunchPrepaidGiveaway");
    s.store_field("giveawayId", giveaway_id_);
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("winnerCount", winner_count_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

launchPrepaidGiveaway::ReturnType launchPrepaidGiveaway::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void launchPrepaidGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LaunchPrepaidGiveaway").c_str());
    giveaway_id_fieldID = jni::get_field_id(env, Class, "giveawayId", "J");
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayParameters;").c_str());
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass readAllForumTopicPollVotes::Class;
jfieldID readAllForumTopicPollVotes::chat_id_fieldID;
jfieldID readAllForumTopicPollVotes::forum_topic_id_fieldID;

readAllForumTopicPollVotes::readAllForumTopicPollVotes()
  : chat_id_()
  , forum_topic_id_()
{}

readAllForumTopicPollVotes::readAllForumTopicPollVotes(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t readAllForumTopicPollVotes::ID;

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

readAllForumTopicPollVotes::ReturnType readAllForumTopicPollVotes::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void readAllForumTopicPollVotes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReadAllForumTopicPollVotes").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 recoverPassword::Class;
jfieldID recoverPassword::recovery_code_fieldID;
jfieldID recoverPassword::new_password_fieldID;
jfieldID recoverPassword::new_hint_fieldID;

recoverPassword::recoverPassword()
  : recovery_code_()
  , new_password_()
  , new_hint_()
{}

recoverPassword::recoverPassword(string const &recovery_code_, string const &new_password_, string const &new_hint_)
  : recovery_code_(recovery_code_)
  , new_password_(new_password_)
  , new_hint_(new_hint_)
{}

const std::int32_t recoverPassword::ID;

object_ptr<recoverPassword> recoverPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<recoverPassword> res = make_object<recoverPassword>();
  res->recovery_code_ = jni::fetch_string(env, p, res->recovery_code_fieldID);
  res->new_password_ = jni::fetch_string(env, p, res->new_password_fieldID);
  res->new_hint_ = jni::fetch_string(env, p, res->new_hint_fieldID);
  return res;
}

void recoverPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RecoverPassword");
    s.store_field("recoveryCode", recovery_code_);
    s.store_field("newPassword", new_password_);
    s.store_field("newHint", new_hint_);
    s.store_class_end();
  }
}

recoverPassword::ReturnType recoverPassword::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

void recoverPassword::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RecoverPassword").c_str());
    recovery_code_fieldID = jni::get_field_id(env, Class, "recoveryCode", "Ljava/lang/String;");
    new_password_fieldID = jni::get_field_id(env, Class, "newPassword", "Ljava/lang/String;");
    new_hint_fieldID = jni::get_field_id(env, Class, "newHint", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass removeMessageReaction::Class;
jfieldID removeMessageReaction::chat_id_fieldID;
jfieldID removeMessageReaction::message_id_fieldID;
jfieldID removeMessageReaction::reaction_type_fieldID;

removeMessageReaction::removeMessageReaction()
  : chat_id_()
  , message_id_()
  , reaction_type_()
{}

removeMessageReaction::removeMessageReaction(int53 chat_id_, int53 message_id_, object_ptr<ReactionType> &&reaction_type_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reaction_type_(std::move(reaction_type_))
{}

const std::int32_t removeMessageReaction::ID;

object_ptr<removeMessageReaction> removeMessageReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeMessageReaction> res = make_object<removeMessageReaction>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->reaction_type_fieldID));
  return res;
}

void removeMessageReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveMessageReaction");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("reactionType", static_cast<const BaseObject *>(reaction_type_.get()));
    s.store_class_end();
  }
}

removeMessageReaction::ReturnType removeMessageReaction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeMessageReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveMessageReaction").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reaction_type_fieldID = jni::get_field_id(env, Class, "reactionType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportSupergroupAntiSpamFalsePositive::Class;
jfieldID reportSupergroupAntiSpamFalsePositive::supergroup_id_fieldID;
jfieldID reportSupergroupAntiSpamFalsePositive::message_id_fieldID;

reportSupergroupAntiSpamFalsePositive::reportSupergroupAntiSpamFalsePositive()
  : supergroup_id_()
  , message_id_()
{}

reportSupergroupAntiSpamFalsePositive::reportSupergroupAntiSpamFalsePositive(int53 supergroup_id_, int53 message_id_)
  : supergroup_id_(supergroup_id_)
  , message_id_(message_id_)
{}

const std::int32_t reportSupergroupAntiSpamFalsePositive::ID;

object_ptr<reportSupergroupAntiSpamFalsePositive> reportSupergroupAntiSpamFalsePositive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportSupergroupAntiSpamFalsePositive> res = make_object<reportSupergroupAntiSpamFalsePositive>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return res;
}

void reportSupergroupAntiSpamFalsePositive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportSupergroupAntiSpamFalsePositive");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

reportSupergroupAntiSpamFalsePositive::ReturnType reportSupergroupAntiSpamFalsePositive::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reportSupergroupAntiSpamFalsePositive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportSupergroupAntiSpamFalsePositive").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass resetPassword::Class;

resetPassword::resetPassword() {
}

const std::int32_t resetPassword::ID;

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

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

resetPassword::ReturnType resetPassword::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ResetPasswordResult::fetch(env, p);
}

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

jclass searchAffiliatePrograms::Class;
jfieldID searchAffiliatePrograms::affiliate_fieldID;
jfieldID searchAffiliatePrograms::sort_order_fieldID;
jfieldID searchAffiliatePrograms::offset_fieldID;
jfieldID searchAffiliatePrograms::limit_fieldID;

searchAffiliatePrograms::searchAffiliatePrograms()
  : affiliate_()
  , sort_order_()
  , offset_()
  , limit_()
{}

searchAffiliatePrograms::searchAffiliatePrograms(object_ptr<AffiliateType> &&affiliate_, object_ptr<AffiliateProgramSortOrder> &&sort_order_, string const &offset_, int32 limit_)
  : affiliate_(std::move(affiliate_))
  , sort_order_(std::move(sort_order_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchAffiliatePrograms::ID;

object_ptr<searchAffiliatePrograms> searchAffiliatePrograms::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchAffiliatePrograms> res = make_object<searchAffiliatePrograms>();
  res->affiliate_ = jni::fetch_tl_object<AffiliateType>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  res->sort_order_ = jni::fetch_tl_object<AffiliateProgramSortOrder>(env, jni::fetch_object(env, p, res->sort_order_fieldID));
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchAffiliatePrograms::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchAffiliatePrograms");
    s.store_object_field("affiliate", static_cast<const BaseObject *>(affiliate_.get()));
    s.store_object_field("sortOrder", static_cast<const BaseObject *>(sort_order_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchAffiliatePrograms::ReturnType searchAffiliatePrograms::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundAffiliatePrograms::fetch(env, p);
}

void searchAffiliatePrograms::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchAffiliatePrograms").c_str());
    affiliate_fieldID = jni::get_field_id(env, Class, "affiliate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateType;").c_str());
    sort_order_fieldID = jni::get_field_id(env, Class, "sortOrder", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateProgramSortOrder;").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 searchChatMembers::Class;
jfieldID searchChatMembers::chat_id_fieldID;
jfieldID searchChatMembers::query_fieldID;
jfieldID searchChatMembers::limit_fieldID;
jfieldID searchChatMembers::filter_fieldID;

searchChatMembers::searchChatMembers()
  : chat_id_()
  , query_()
  , limit_()
  , filter_()
{}

searchChatMembers::searchChatMembers(int53 chat_id_, string const &query_, int32 limit_, object_ptr<ChatMembersFilter> &&filter_)
  : chat_id_(chat_id_)
  , query_(query_)
  , limit_(limit_)
  , filter_(std::move(filter_))
{}

const std::int32_t searchChatMembers::ID;

object_ptr<searchChatMembers> searchChatMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchChatMembers> res = make_object<searchChatMembers>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->filter_ = jni::fetch_tl_object<ChatMembersFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  return res;
}

void searchChatMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchChatMembers");
    s.store_field("chatId", chat_id_);
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_class_end();
  }
}

searchChatMembers::ReturnType searchChatMembers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatMembers::fetch(env, p);
}

void searchChatMembers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchChatMembers").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMembersFilter;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass searchOutgoingDocumentMessages::Class;
jfieldID searchOutgoingDocumentMessages::query_fieldID;
jfieldID searchOutgoingDocumentMessages::limit_fieldID;

searchOutgoingDocumentMessages::searchOutgoingDocumentMessages()
  : query_()
  , limit_()
{}

searchOutgoingDocumentMessages::searchOutgoingDocumentMessages(string const &query_, int32 limit_)
  : query_(query_)
  , limit_(limit_)
{}

const std::int32_t searchOutgoingDocumentMessages::ID;

object_ptr<searchOutgoingDocumentMessages> searchOutgoingDocumentMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchOutgoingDocumentMessages> res = make_object<searchOutgoingDocumentMessages>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchOutgoingDocumentMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchOutgoingDocumentMessages");
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchOutgoingDocumentMessages::ReturnType searchOutgoingDocumentMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundMessages::fetch(env, p);
}

void searchOutgoingDocumentMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchOutgoingDocumentMessages").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 searchPublicPosts::Class;
jfieldID searchPublicPosts::query_fieldID;
jfieldID searchPublicPosts::offset_fieldID;
jfieldID searchPublicPosts::limit_fieldID;
jfieldID searchPublicPosts::star_count_fieldID;

searchPublicPosts::searchPublicPosts()
  : query_()
  , offset_()
  , limit_()
  , star_count_()
{}

searchPublicPosts::searchPublicPosts(string const &query_, string const &offset_, int32 limit_, int53 star_count_)
  : query_(query_)
  , offset_(offset_)
  , limit_(limit_)
  , star_count_(star_count_)
{}

const std::int32_t searchPublicPosts::ID;

object_ptr<searchPublicPosts> searchPublicPosts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchPublicPosts> res = make_object<searchPublicPosts>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

void searchPublicPosts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchPublicPosts");
    s.store_field("query", query_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

searchPublicPosts::ReturnType searchPublicPosts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundPublicPosts::fetch(env, p);
}

void searchPublicPosts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchPublicPosts").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;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass searchPublicStoriesByLocation::Class;
jfieldID searchPublicStoriesByLocation::address_fieldID;
jfieldID searchPublicStoriesByLocation::offset_fieldID;
jfieldID searchPublicStoriesByLocation::limit_fieldID;

searchPublicStoriesByLocation::searchPublicStoriesByLocation()
  : address_()
  , offset_()
  , limit_()
{}

searchPublicStoriesByLocation::searchPublicStoriesByLocation(object_ptr<locationAddress> &&address_, string const &offset_, int32 limit_)
  : address_(std::move(address_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchPublicStoriesByLocation::ID;

object_ptr<searchPublicStoriesByLocation> searchPublicStoriesByLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchPublicStoriesByLocation> res = make_object<searchPublicStoriesByLocation>();
  res->address_ = jni::fetch_tl_object<locationAddress>(env, jni::fetch_object(env, p, res->address_fieldID));
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchPublicStoriesByLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchPublicStoriesByLocation");
    s.store_object_field("address", static_cast<const BaseObject *>(address_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchPublicStoriesByLocation::ReturnType searchPublicStoriesByLocation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundStories::fetch(env, p);
}

void searchPublicStoriesByLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchPublicStoriesByLocation").c_str());
    address_fieldID = jni::get_field_id(env, Class, "address", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LocationAddress;").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 sendBotStartMessage::Class;
jfieldID sendBotStartMessage::bot_user_id_fieldID;
jfieldID sendBotStartMessage::chat_id_fieldID;
jfieldID sendBotStartMessage::parameter_fieldID;

sendBotStartMessage::sendBotStartMessage()
  : bot_user_id_()
  , chat_id_()
  , parameter_()
{}

sendBotStartMessage::sendBotStartMessage(int53 bot_user_id_, int53 chat_id_, string const &parameter_)
  : bot_user_id_(bot_user_id_)
  , chat_id_(chat_id_)
  , parameter_(parameter_)
{}

const std::int32_t sendBotStartMessage::ID;

object_ptr<sendBotStartMessage> sendBotStartMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendBotStartMessage> res = make_object<sendBotStartMessage>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->parameter_ = jni::fetch_string(env, p, res->parameter_fieldID);
  return res;
}

void sendBotStartMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendBotStartMessage");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("parameter", parameter_);
    s.store_class_end();
  }
}

sendBotStartMessage::ReturnType sendBotStartMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void sendBotStartMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendBotStartMessage").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");
    parameter_fieldID = jni::get_field_id(env, Class, "parameter", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass sendGiftPurchaseOffer::Class;
jfieldID sendGiftPurchaseOffer::owner_id_fieldID;
jfieldID sendGiftPurchaseOffer::gift_name_fieldID;
jfieldID sendGiftPurchaseOffer::price_fieldID;
jfieldID sendGiftPurchaseOffer::duration_fieldID;
jfieldID sendGiftPurchaseOffer::paid_message_star_count_fieldID;

sendGiftPurchaseOffer::sendGiftPurchaseOffer()
  : owner_id_()
  , gift_name_()
  , price_()
  , duration_()
  , paid_message_star_count_()
{}

sendGiftPurchaseOffer::sendGiftPurchaseOffer(object_ptr<MessageSender> &&owner_id_, string const &gift_name_, object_ptr<GiftResalePrice> &&price_, int32 duration_, int53 paid_message_star_count_)
  : owner_id_(std::move(owner_id_))
  , gift_name_(gift_name_)
  , price_(std::move(price_))
  , duration_(duration_)
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t sendGiftPurchaseOffer::ID;

object_ptr<sendGiftPurchaseOffer> sendGiftPurchaseOffer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendGiftPurchaseOffer> res = make_object<sendGiftPurchaseOffer>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->gift_name_ = jni::fetch_string(env, p, res->gift_name_fieldID);
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

void sendGiftPurchaseOffer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendGiftPurchaseOffer");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("giftName", gift_name_);
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_field("duration", duration_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

sendGiftPurchaseOffer::ReturnType sendGiftPurchaseOffer::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendGiftPurchaseOffer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendGiftPurchaseOffer").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    gift_name_fieldID = jni::get_field_id(env, Class, "giftName", "Ljava/lang/String;");
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftResalePrice;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass sendQuickReplyShortcutMessages::Class;
jfieldID sendQuickReplyShortcutMessages::chat_id_fieldID;
jfieldID sendQuickReplyShortcutMessages::shortcut_id_fieldID;
jfieldID sendQuickReplyShortcutMessages::sending_id_fieldID;

sendQuickReplyShortcutMessages::sendQuickReplyShortcutMessages()
  : chat_id_()
  , shortcut_id_()
  , sending_id_()
{}

sendQuickReplyShortcutMessages::sendQuickReplyShortcutMessages(int53 chat_id_, int32 shortcut_id_, int32 sending_id_)
  : chat_id_(chat_id_)
  , shortcut_id_(shortcut_id_)
  , sending_id_(sending_id_)
{}

const std::int32_t sendQuickReplyShortcutMessages::ID;

object_ptr<sendQuickReplyShortcutMessages> sendQuickReplyShortcutMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendQuickReplyShortcutMessages> res = make_object<sendQuickReplyShortcutMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->sending_id_ = env->GetIntField(p, res->sending_id_fieldID);
  return res;
}

void sendQuickReplyShortcutMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendQuickReplyShortcutMessages");
    s.store_field("chatId", chat_id_);
    s.store_field("shortcutId", shortcut_id_);
    s.store_field("sendingId", sending_id_);
    s.store_class_end();
  }
}

sendQuickReplyShortcutMessages::ReturnType sendQuickReplyShortcutMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

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

jclass sendTextMessageDraft::Class;
jfieldID sendTextMessageDraft::chat_id_fieldID;
jfieldID sendTextMessageDraft::forum_topic_id_fieldID;
jfieldID sendTextMessageDraft::draft_id_fieldID;
jfieldID sendTextMessageDraft::text_fieldID;

sendTextMessageDraft::sendTextMessageDraft()
  : chat_id_()
  , forum_topic_id_()
  , draft_id_()
  , text_()
{}

sendTextMessageDraft::sendTextMessageDraft(int53 chat_id_, int32 forum_topic_id_, int64 draft_id_, object_ptr<formattedText> &&text_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , draft_id_(draft_id_)
  , text_(std::move(text_))
{}

const std::int32_t sendTextMessageDraft::ID;

object_ptr<sendTextMessageDraft> sendTextMessageDraft::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendTextMessageDraft> res = make_object<sendTextMessageDraft>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->draft_id_ = env->GetLongField(p, res->draft_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return res;
}

void sendTextMessageDraft::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendTextMessageDraft");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("draftId", draft_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

sendTextMessageDraft::ReturnType sendTextMessageDraft::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendTextMessageDraft::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendTextMessageDraft").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    forum_topic_id_fieldID = jni::get_field_id(env, Class, "forumTopicId", "I");
    draft_id_fieldID = jni::get_field_id(env, Class, "draftId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass sendWebAppCustomRequest::Class;
jfieldID sendWebAppCustomRequest::bot_user_id_fieldID;
jfieldID sendWebAppCustomRequest::method_fieldID;
jfieldID sendWebAppCustomRequest::parameters_fieldID;

sendWebAppCustomRequest::sendWebAppCustomRequest()
  : bot_user_id_()
  , method_()
  , parameters_()
{}

sendWebAppCustomRequest::sendWebAppCustomRequest(int53 bot_user_id_, string const &method_, string const &parameters_)
  : bot_user_id_(bot_user_id_)
  , method_(method_)
  , parameters_(parameters_)
{}

const std::int32_t sendWebAppCustomRequest::ID;

object_ptr<sendWebAppCustomRequest> sendWebAppCustomRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendWebAppCustomRequest> res = make_object<sendWebAppCustomRequest>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->method_ = jni::fetch_string(env, p, res->method_fieldID);
  res->parameters_ = jni::fetch_string(env, p, res->parameters_fieldID);
  return res;
}

void sendWebAppCustomRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendWebAppCustomRequest");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("method", method_);
    s.store_field("parameters", parameters_);
    s.store_class_end();
  }
}

sendWebAppCustomRequest::ReturnType sendWebAppCustomRequest::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return customRequestResult::fetch(env, p);
}

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

jclass sendWebAppData::Class;
jfieldID sendWebAppData::bot_user_id_fieldID;
jfieldID sendWebAppData::button_text_fieldID;
jfieldID sendWebAppData::data_fieldID;

sendWebAppData::sendWebAppData()
  : bot_user_id_()
  , button_text_()
  , data_()
{}

sendWebAppData::sendWebAppData(int53 bot_user_id_, string const &button_text_, string const &data_)
  : bot_user_id_(bot_user_id_)
  , button_text_(button_text_)
  , data_(data_)
{}

const std::int32_t sendWebAppData::ID;

object_ptr<sendWebAppData> sendWebAppData::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendWebAppData> res = make_object<sendWebAppData>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->button_text_ = jni::fetch_string(env, p, res->button_text_fieldID);
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  return res;
}

void sendWebAppData::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendWebAppData");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("buttonText", button_text_);
    s.store_field("data", data_);
    s.store_class_end();
  }
}

sendWebAppData::ReturnType sendWebAppData::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setArchiveChatListSettings::Class;
jfieldID setArchiveChatListSettings::settings_fieldID;

setArchiveChatListSettings::setArchiveChatListSettings()
  : settings_()
{}

setArchiveChatListSettings::setArchiveChatListSettings(object_ptr<archiveChatListSettings> &&settings_)
  : settings_(std::move(settings_))
{}

const std::int32_t setArchiveChatListSettings::ID;

object_ptr<setArchiveChatListSettings> setArchiveChatListSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setArchiveChatListSettings> res = make_object<setArchiveChatListSettings>();
  res->settings_ = jni::fetch_tl_object<archiveChatListSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

void setArchiveChatListSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetArchiveChatListSettings");
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

setArchiveChatListSettings::ReturnType setArchiveChatListSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBotInfoDescription::Class;
jfieldID setBotInfoDescription::bot_user_id_fieldID;
jfieldID setBotInfoDescription::language_code_fieldID;
jfieldID setBotInfoDescription::description_fieldID;

setBotInfoDescription::setBotInfoDescription()
  : bot_user_id_()
  , language_code_()
  , description_()
{}

setBotInfoDescription::setBotInfoDescription(int53 bot_user_id_, string const &language_code_, string const &description_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
  , description_(description_)
{}

const std::int32_t setBotInfoDescription::ID;

object_ptr<setBotInfoDescription> setBotInfoDescription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBotInfoDescription> res = make_object<setBotInfoDescription>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return res;
}

void setBotInfoDescription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBotInfoDescription");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_field("description", description_);
    s.store_class_end();
  }
}

setBotInfoDescription::ReturnType setBotInfoDescription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatMessageSender::Class;
jfieldID setChatMessageSender::chat_id_fieldID;
jfieldID setChatMessageSender::message_sender_id_fieldID;

setChatMessageSender::setChatMessageSender()
  : chat_id_()
  , message_sender_id_()
{}

setChatMessageSender::setChatMessageSender(int53 chat_id_, object_ptr<MessageSender> &&message_sender_id_)
  : chat_id_(chat_id_)
  , message_sender_id_(std::move(message_sender_id_))
{}

const std::int32_t setChatMessageSender::ID;

object_ptr<setChatMessageSender> setChatMessageSender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatMessageSender> res = make_object<setChatMessageSender>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->message_sender_id_fieldID));
  return res;
}

void setChatMessageSender::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatMessageSender");
    s.store_field("chatId", chat_id_);
    s.store_object_field("messageSenderId", static_cast<const BaseObject *>(message_sender_id_.get()));
    s.store_class_end();
  }
}

setChatMessageSender::ReturnType setChatMessageSender::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatProfileAccentColor::Class;
jfieldID setChatProfileAccentColor::chat_id_fieldID;
jfieldID setChatProfileAccentColor::profile_accent_color_id_fieldID;
jfieldID setChatProfileAccentColor::profile_background_custom_emoji_id_fieldID;

setChatProfileAccentColor::setChatProfileAccentColor()
  : chat_id_()
  , profile_accent_color_id_()
  , profile_background_custom_emoji_id_()
{}

setChatProfileAccentColor::setChatProfileAccentColor(int53 chat_id_, int32 profile_accent_color_id_, int64 profile_background_custom_emoji_id_)
  : chat_id_(chat_id_)
  , profile_accent_color_id_(profile_accent_color_id_)
  , profile_background_custom_emoji_id_(profile_background_custom_emoji_id_)
{}

const std::int32_t setChatProfileAccentColor::ID;

object_ptr<setChatProfileAccentColor> setChatProfileAccentColor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatProfileAccentColor> res = make_object<setChatProfileAccentColor>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->profile_accent_color_id_ = env->GetIntField(p, res->profile_accent_color_id_fieldID);
  res->profile_background_custom_emoji_id_ = env->GetLongField(p, res->profile_background_custom_emoji_id_fieldID);
  return res;
}

void setChatProfileAccentColor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatProfileAccentColor");
    s.store_field("chatId", chat_id_);
    s.store_field("profileAccentColorId", profile_accent_color_id_);
    s.store_field("profileBackgroundCustomEmojiId", profile_background_custom_emoji_id_);
    s.store_class_end();
  }
}

setChatProfileAccentColor::ReturnType setChatProfileAccentColor::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDatabaseEncryptionKey::Class;
jfieldID setDatabaseEncryptionKey::new_encryption_key_fieldID;

setDatabaseEncryptionKey::setDatabaseEncryptionKey()
  : new_encryption_key_()
{}

setDatabaseEncryptionKey::setDatabaseEncryptionKey(bytes const &new_encryption_key_)
  : new_encryption_key_(std::move(new_encryption_key_))
{}

const std::int32_t setDatabaseEncryptionKey::ID;

object_ptr<setDatabaseEncryptionKey> setDatabaseEncryptionKey::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDatabaseEncryptionKey> res = make_object<setDatabaseEncryptionKey>();
  res->new_encryption_key_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->new_encryption_key_fieldID));
  return res;
}

void setDatabaseEncryptionKey::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetDatabaseEncryptionKey");
    s.store_bytes_field("newEncryptionKey", new_encryption_key_);
    s.store_class_end();
  }
}

setDatabaseEncryptionKey::ReturnType setDatabaseEncryptionKey::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDefaultGroupAdministratorRights::Class;
jfieldID setDefaultGroupAdministratorRights::default_group_administrator_rights_fieldID;

setDefaultGroupAdministratorRights::setDefaultGroupAdministratorRights()
  : default_group_administrator_rights_()
{}

setDefaultGroupAdministratorRights::setDefaultGroupAdministratorRights(object_ptr<chatAdministratorRights> &&default_group_administrator_rights_)
  : default_group_administrator_rights_(std::move(default_group_administrator_rights_))
{}

const std::int32_t setDefaultGroupAdministratorRights::ID;

object_ptr<setDefaultGroupAdministratorRights> setDefaultGroupAdministratorRights::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDefaultGroupAdministratorRights> res = make_object<setDefaultGroupAdministratorRights>();
  res->default_group_administrator_rights_ = jni::fetch_tl_object<chatAdministratorRights>(env, jni::fetch_object(env, p, res->default_group_administrator_rights_fieldID));
  return res;
}

void setDefaultGroupAdministratorRights::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetDefaultGroupAdministratorRights");
    s.store_object_field("defaultGroupAdministratorRights", static_cast<const BaseObject *>(default_group_administrator_rights_.get()));
    s.store_class_end();
  }
}

setDefaultGroupAdministratorRights::ReturnType setDefaultGroupAdministratorRights::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setGiftSettings::Class;
jfieldID setGiftSettings::settings_fieldID;

setGiftSettings::setGiftSettings()
  : settings_()
{}

setGiftSettings::setGiftSettings(object_ptr<giftSettings> &&settings_)
  : settings_(std::move(settings_))
{}

const std::int32_t setGiftSettings::ID;

object_ptr<setGiftSettings> setGiftSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setGiftSettings> res = make_object<setGiftSettings>();
  res->settings_ = jni::fetch_tl_object<giftSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

void setGiftSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetGiftSettings");
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

setGiftSettings::ReturnType setGiftSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setLogStream::Class;
jfieldID setLogStream::log_stream_fieldID;

setLogStream::setLogStream()
  : log_stream_()
{}

setLogStream::setLogStream(object_ptr<LogStream> &&log_stream_)
  : log_stream_(std::move(log_stream_))
{}

const std::int32_t setLogStream::ID;

object_ptr<setLogStream> setLogStream::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setLogStream> res = make_object<setLogStream>();
  res->log_stream_ = jni::fetch_tl_object<LogStream>(env, jni::fetch_object(env, p, res->log_stream_fieldID));
  return res;
}

void setLogStream::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetLogStream");
    s.store_object_field("logStream", static_cast<const BaseObject *>(log_stream_.get()));
    s.store_class_end();
  }
}

setLogStream::ReturnType setLogStream::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setNewChatPrivacySettings::Class;
jfieldID setNewChatPrivacySettings::settings_fieldID;

setNewChatPrivacySettings::setNewChatPrivacySettings()
  : settings_()
{}

setNewChatPrivacySettings::setNewChatPrivacySettings(object_ptr<newChatPrivacySettings> &&settings_)
  : settings_(std::move(settings_))
{}

const std::int32_t setNewChatPrivacySettings::ID;

object_ptr<setNewChatPrivacySettings> setNewChatPrivacySettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setNewChatPrivacySettings> res = make_object<setNewChatPrivacySettings>();
  res->settings_ = jni::fetch_tl_object<newChatPrivacySettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

void setNewChatPrivacySettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetNewChatPrivacySettings");
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

setNewChatPrivacySettings::ReturnType setNewChatPrivacySettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setPinnedChats::Class;
jfieldID setPinnedChats::chat_list_fieldID;
jfieldID setPinnedChats::chat_ids_fieldID;

setPinnedChats::setPinnedChats()
  : chat_list_()
  , chat_ids_()
{}

setPinnedChats::setPinnedChats(object_ptr<ChatList> &&chat_list_, array<int53> &&chat_ids_)
  : chat_list_(std::move(chat_list_))
  , chat_ids_(std::move(chat_ids_))
{}

const std::int32_t setPinnedChats::ID;

object_ptr<setPinnedChats> setPinnedChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPinnedChats> res = make_object<setPinnedChats>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return res;
}

void setPinnedChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPinnedChats");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    { 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();
  }
}

setPinnedChats::ReturnType setPinnedChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setPinnedChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetPinnedChats").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    chat_ids_fieldID = jni::get_field_id(env, Class, "chatIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass setPollAnswer::Class;
jfieldID setPollAnswer::chat_id_fieldID;
jfieldID setPollAnswer::message_id_fieldID;
jfieldID setPollAnswer::option_ids_fieldID;

setPollAnswer::setPollAnswer()
  : chat_id_()
  , message_id_()
  , option_ids_()
{}

setPollAnswer::setPollAnswer(int53 chat_id_, int53 message_id_, array<int32> &&option_ids_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , option_ids_(std::move(option_ids_))
{}

const std::int32_t setPollAnswer::ID;

object_ptr<setPollAnswer> setPollAnswer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPollAnswer> res = make_object<setPollAnswer>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->option_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->option_ids_fieldID));
  return res;
}

void setPollAnswer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPollAnswer");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    { s.store_vector_begin("optionIds", option_ids_.size()); for (const auto &_value : option_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

setPollAnswer::ReturnType setPollAnswer::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setProfileAudioPosition::Class;
jfieldID setProfileAudioPosition::file_id_fieldID;
jfieldID setProfileAudioPosition::after_file_id_fieldID;

setProfileAudioPosition::setProfileAudioPosition()
  : file_id_()
  , after_file_id_()
{}

setProfileAudioPosition::setProfileAudioPosition(int32 file_id_, int32 after_file_id_)
  : file_id_(file_id_)
  , after_file_id_(after_file_id_)
{}

const std::int32_t setProfileAudioPosition::ID;

object_ptr<setProfileAudioPosition> setProfileAudioPosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setProfileAudioPosition> res = make_object<setProfileAudioPosition>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->after_file_id_ = env->GetIntField(p, res->after_file_id_fieldID);
  return res;
}

void setProfileAudioPosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetProfileAudioPosition");
    s.store_field("fileId", file_id_);
    s.store_field("afterFileId", after_file_id_);
    s.store_class_end();
  }
}

setProfileAudioPosition::ReturnType setProfileAudioPosition::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setProfileAudioPosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetProfileAudioPosition").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    after_file_id_fieldID = jni::get_field_id(env, Class, "afterFileId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass setUpgradedGiftColors::Class;
jfieldID setUpgradedGiftColors::upgraded_gift_colors_id_fieldID;

setUpgradedGiftColors::setUpgradedGiftColors()
  : upgraded_gift_colors_id_()
{}

setUpgradedGiftColors::setUpgradedGiftColors(int64 upgraded_gift_colors_id_)
  : upgraded_gift_colors_id_(upgraded_gift_colors_id_)
{}

const std::int32_t setUpgradedGiftColors::ID;

object_ptr<setUpgradedGiftColors> setUpgradedGiftColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setUpgradedGiftColors> res = make_object<setUpgradedGiftColors>();
  res->upgraded_gift_colors_id_ = env->GetLongField(p, res->upgraded_gift_colors_id_fieldID);
  return res;
}

void setUpgradedGiftColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetUpgradedGiftColors");
    s.store_field("upgradedGiftColorsId", upgraded_gift_colors_id_);
    s.store_class_end();
  }
}

setUpgradedGiftColors::ReturnType setUpgradedGiftColors::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setUserPersonalProfilePhoto::Class;
jfieldID setUserPersonalProfilePhoto::user_id_fieldID;
jfieldID setUserPersonalProfilePhoto::photo_fieldID;

setUserPersonalProfilePhoto::setUserPersonalProfilePhoto()
  : user_id_()
  , photo_()
{}

setUserPersonalProfilePhoto::setUserPersonalProfilePhoto(int53 user_id_, object_ptr<InputChatPhoto> &&photo_)
  : user_id_(user_id_)
  , photo_(std::move(photo_))
{}

const std::int32_t setUserPersonalProfilePhoto::ID;

object_ptr<setUserPersonalProfilePhoto> setUserPersonalProfilePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setUserPersonalProfilePhoto> res = make_object<setUserPersonalProfilePhoto>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->photo_ = jni::fetch_tl_object<InputChatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return res;
}

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

setUserPersonalProfilePhoto::ReturnType setUserPersonalProfilePhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setUserPersonalProfilePhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetUserPersonalProfilePhoto").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "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 setUserSupportInfo::Class;
jfieldID setUserSupportInfo::user_id_fieldID;
jfieldID setUserSupportInfo::message_fieldID;

setUserSupportInfo::setUserSupportInfo()
  : user_id_()
  , message_()
{}

setUserSupportInfo::setUserSupportInfo(int53 user_id_, object_ptr<formattedText> &&message_)
  : user_id_(user_id_)
  , message_(std::move(message_))
{}

const std::int32_t setUserSupportInfo::ID;

object_ptr<setUserSupportInfo> setUserSupportInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setUserSupportInfo> res = make_object<setUserSupportInfo>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->message_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->message_fieldID));
  return res;
}

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

setUserSupportInfo::ReturnType setUserSupportInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return userSupportInfo::fetch(env, p);
}

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

jclass shareChatWithBot::Class;
jfieldID shareChatWithBot::source_fieldID;
jfieldID shareChatWithBot::button_id_fieldID;
jfieldID shareChatWithBot::shared_chat_id_fieldID;
jfieldID shareChatWithBot::only_check_fieldID;

shareChatWithBot::shareChatWithBot()
  : source_()
  , button_id_()
  , shared_chat_id_()
  , only_check_()
{}

shareChatWithBot::shareChatWithBot(object_ptr<KeyboardButtonSource> &&source_, int32 button_id_, int53 shared_chat_id_, bool only_check_)
  : source_(std::move(source_))
  , button_id_(button_id_)
  , shared_chat_id_(shared_chat_id_)
  , only_check_(only_check_)
{}

const std::int32_t shareChatWithBot::ID;

object_ptr<shareChatWithBot> shareChatWithBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<shareChatWithBot> res = make_object<shareChatWithBot>();
  res->source_ = jni::fetch_tl_object<KeyboardButtonSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  res->button_id_ = env->GetIntField(p, res->button_id_fieldID);
  res->shared_chat_id_ = env->GetLongField(p, res->shared_chat_id_fieldID);
  res->only_check_ = (env->GetBooleanField(p, res->only_check_fieldID) != 0);
  return res;
}

void shareChatWithBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ShareChatWithBot");
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_field("buttonId", button_id_);
    s.store_field("sharedChatId", shared_chat_id_);
    s.store_field("onlyCheck", only_check_);
    s.store_class_end();
  }
}

shareChatWithBot::ReturnType shareChatWithBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void shareChatWithBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ShareChatWithBot").c_str());
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$KeyboardButtonSource;").c_str());
    button_id_fieldID = jni::get_field_id(env, Class, "buttonId", "I");
    shared_chat_id_fieldID = jni::get_field_id(env, Class, "sharedChatId", "J");
    only_check_fieldID = jni::get_field_id(env, Class, "onlyCheck", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass startGroupCallScreenSharing::Class;
jfieldID startGroupCallScreenSharing::group_call_id_fieldID;
jfieldID startGroupCallScreenSharing::audio_source_id_fieldID;
jfieldID startGroupCallScreenSharing::payload_fieldID;

startGroupCallScreenSharing::startGroupCallScreenSharing()
  : group_call_id_()
  , audio_source_id_()
  , payload_()
{}

startGroupCallScreenSharing::startGroupCallScreenSharing(int32 group_call_id_, int32 audio_source_id_, string const &payload_)
  : group_call_id_(group_call_id_)
  , audio_source_id_(audio_source_id_)
  , payload_(payload_)
{}

const std::int32_t startGroupCallScreenSharing::ID;

object_ptr<startGroupCallScreenSharing> startGroupCallScreenSharing::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<startGroupCallScreenSharing> res = make_object<startGroupCallScreenSharing>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->audio_source_id_ = env->GetIntField(p, res->audio_source_id_fieldID);
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  return res;
}

void startGroupCallScreenSharing::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StartGroupCallScreenSharing");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("audioSourceId", audio_source_id_);
    s.store_field("payload", payload_);
    s.store_class_end();
  }
}

startGroupCallScreenSharing::ReturnType startGroupCallScreenSharing::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void startGroupCallScreenSharing::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StartGroupCallScreenSharing").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    audio_source_id_fieldID = jni::get_field_id(env, Class, "audioSourceId", "I");
    payload_fieldID = jni::get_field_id(env, Class, "payload", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass terminateAllOtherSessions::Class;

terminateAllOtherSessions::terminateAllOtherSessions() {
}

const std::int32_t terminateAllOtherSessions::ID;

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

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

terminateAllOtherSessions::ReturnType terminateAllOtherSessions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass testCallEmpty::Class;

testCallEmpty::testCallEmpty() {
}

const std::int32_t testCallEmpty::ID;

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

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

testCallEmpty::ReturnType testCallEmpty::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass testGetDifference::Class;

testGetDifference::testGetDifference() {
}

const std::int32_t testGetDifference::ID;

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

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

testGetDifference::ReturnType testGetDifference::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass testSquareInt::Class;
jfieldID testSquareInt::x_fieldID;

testSquareInt::testSquareInt()
  : x_()
{}

testSquareInt::testSquareInt(int32 x_)
  : x_(x_)
{}

const std::int32_t testSquareInt::ID;

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

void testSquareInt::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestSquareInt");
    s.store_field("x", x_);
    s.store_class_end();
  }
}

testSquareInt::ReturnType testSquareInt::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testInt::fetch(env, p);
}

void testSquareInt::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TestSquareInt").c_str());
    x_fieldID = jni::get_field_id(env, Class, "x", "I");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
