#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 ageVerificationParameters::Class;
jfieldID ageVerificationParameters::min_age_fieldID;
jfieldID ageVerificationParameters::verification_bot_username_fieldID;
jfieldID ageVerificationParameters::country_fieldID;

ageVerificationParameters::ageVerificationParameters()
  : min_age_()
  , verification_bot_username_()
  , country_()
{}

ageVerificationParameters::ageVerificationParameters(int32 min_age_, string const &verification_bot_username_, string const &country_)
  : min_age_(min_age_)
  , verification_bot_username_(verification_bot_username_)
  , country_(country_)
{}

const std::int32_t ageVerificationParameters::ID;

object_ptr<ageVerificationParameters> ageVerificationParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<ageVerificationParameters> res = make_object<ageVerificationParameters>();
  res->min_age_ = env->GetIntField(p, res->min_age_fieldID);
  res->verification_bot_username_ = jni::fetch_string(env, p, res->verification_bot_username_fieldID);
  res->country_ = jni::fetch_string(env, p, res->country_fieldID);
  return res;
}

void ageVerificationParameters::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, min_age_fieldID, min_age_);
  { jstring nextString = jni::to_jstring(env, verification_bot_username_); if (nextString) { env->SetObjectField(s, verification_bot_username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, country_); if (nextString) { env->SetObjectField(s, country_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void ageVerificationParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AgeVerificationParameters");
    s.store_field("minAge", min_age_);
    s.store_field("verificationBotUsername", verification_bot_username_);
    s.store_field("country", country_);
    s.store_class_end();
  }
}

void ageVerificationParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AgeVerificationParameters").c_str());
    min_age_fieldID = jni::get_field_id(env, Class, "minAge", "I");
    verification_bot_username_fieldID = jni::get_field_id(env, Class, "verificationBotUsername", "Ljava/lang/String;");
    country_fieldID = jni::get_field_id(env, Class, "country", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass alternativeVideo::Class;
jfieldID alternativeVideo::id_fieldID;
jfieldID alternativeVideo::width_fieldID;
jfieldID alternativeVideo::height_fieldID;
jfieldID alternativeVideo::codec_fieldID;
jfieldID alternativeVideo::hls_file_fieldID;
jfieldID alternativeVideo::video_fieldID;

alternativeVideo::alternativeVideo()
  : id_()
  , width_()
  , height_()
  , codec_()
  , hls_file_()
  , video_()
{}

alternativeVideo::alternativeVideo(int64 id_, int32 width_, int32 height_, string const &codec_, object_ptr<file> &&hls_file_, object_ptr<file> &&video_)
  : id_(id_)
  , width_(width_)
  , height_(height_)
  , codec_(codec_)
  , hls_file_(std::move(hls_file_))
  , video_(std::move(video_))
{}

const std::int32_t alternativeVideo::ID;

object_ptr<alternativeVideo> alternativeVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<alternativeVideo> res = make_object<alternativeVideo>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->codec_ = jni::fetch_string(env, p, res->codec_fieldID);
  res->hls_file_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->hls_file_fieldID));
  res->video_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->video_fieldID));
  return res;
}

void alternativeVideo::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, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  { jstring nextString = jni::to_jstring(env, codec_); if (nextString) { env->SetObjectField(s, codec_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (hls_file_ != nullptr) { jobject next; hls_file_->store(env, next); if (next) { env->SetObjectField(s, hls_file_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
}

void alternativeVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AlternativeVideo");
    s.store_field("id", id_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("codec", codec_);
    s.store_object_field("hlsFile", static_cast<const BaseObject *>(hls_file_.get()));
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_class_end();
  }
}

void alternativeVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AlternativeVideo").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    codec_fieldID = jni::get_field_id(env, Class, "codec", "Ljava/lang/String;");
    hls_file_fieldID = jni::get_field_id(env, Class, "hlsFile", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass autosaveSettingsException::Class;
jfieldID autosaveSettingsException::chat_id_fieldID;
jfieldID autosaveSettingsException::settings_fieldID;

autosaveSettingsException::autosaveSettingsException()
  : chat_id_()
  , settings_()
{}

autosaveSettingsException::autosaveSettingsException(int53 chat_id_, object_ptr<scopeAutosaveSettings> &&settings_)
  : chat_id_(chat_id_)
  , settings_(std::move(settings_))
{}

const std::int32_t autosaveSettingsException::ID;

object_ptr<autosaveSettingsException> autosaveSettingsException::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<autosaveSettingsException> res = make_object<autosaveSettingsException>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->settings_ = jni::fetch_tl_object<scopeAutosaveSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

void autosaveSettingsException::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (settings_ != nullptr) { jobject next; settings_->store(env, next); if (next) { env->SetObjectField(s, settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void autosaveSettingsException::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AutosaveSettingsException");
    s.store_field("chatId", chat_id_);
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

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

jclass basicGroup::Class;
jfieldID basicGroup::id_fieldID;
jfieldID basicGroup::member_count_fieldID;
jfieldID basicGroup::status_fieldID;
jfieldID basicGroup::is_active_fieldID;
jfieldID basicGroup::upgraded_to_supergroup_id_fieldID;

basicGroup::basicGroup()
  : id_()
  , member_count_()
  , status_()
  , is_active_()
  , upgraded_to_supergroup_id_()
{}

basicGroup::basicGroup(int53 id_, int32 member_count_, object_ptr<ChatMemberStatus> &&status_, bool is_active_, int53 upgraded_to_supergroup_id_)
  : id_(id_)
  , member_count_(member_count_)
  , status_(std::move(status_))
  , is_active_(is_active_)
  , upgraded_to_supergroup_id_(upgraded_to_supergroup_id_)
{}

const std::int32_t basicGroup::ID;

object_ptr<basicGroup> basicGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<basicGroup> res = make_object<basicGroup>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->member_count_ = env->GetIntField(p, res->member_count_fieldID);
  res->status_ = jni::fetch_tl_object<ChatMemberStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  res->upgraded_to_supergroup_id_ = env->GetLongField(p, res->upgraded_to_supergroup_id_fieldID);
  return res;
}

void basicGroup::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, member_count_fieldID, member_count_);
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_active_fieldID, is_active_);
  env->SetLongField(s, upgraded_to_supergroup_id_fieldID, upgraded_to_supergroup_id_);
}

void basicGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BasicGroup");
    s.store_field("id", id_);
    s.store_field("memberCount", member_count_);
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_field("isActive", is_active_);
    s.store_field("upgradedToSupergroupId", upgraded_to_supergroup_id_);
    s.store_class_end();
  }
}

void basicGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BasicGroup").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    member_count_fieldID = jni::get_field_id(env, Class, "memberCount", "I");
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatMemberStatus;").c_str());
    is_active_fieldID = jni::get_field_id(env, Class, "isActive", "Z");
    upgraded_to_supergroup_id_fieldID = jni::get_field_id(env, Class, "upgradedToSupergroupId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass botAccessSettings::Class;
jfieldID botAccessSettings::is_restricted_fieldID;
jfieldID botAccessSettings::added_user_ids_fieldID;

botAccessSettings::botAccessSettings()
  : is_restricted_()
  , added_user_ids_()
{}

botAccessSettings::botAccessSettings(bool is_restricted_, array<int53> &&added_user_ids_)
  : is_restricted_(is_restricted_)
  , added_user_ids_(std::move(added_user_ids_))
{}

const std::int32_t botAccessSettings::ID;

object_ptr<botAccessSettings> botAccessSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botAccessSettings> res = make_object<botAccessSettings>();
  res->is_restricted_ = (env->GetBooleanField(p, res->is_restricted_fieldID) != 0);
  res->added_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->added_user_ids_fieldID));
  return res;
}

void botAccessSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_restricted_fieldID, is_restricted_);
  { auto arr_tmp_ = jni::store_vector(env, added_user_ids_); if (arr_tmp_) { env->SetObjectField(s, added_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void botAccessSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotAccessSettings");
    s.store_field("isRestricted", is_restricted_);
    { s.store_vector_begin("addedUserIds", added_user_ids_.size()); for (const auto &_value : added_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void botAccessSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotAccessSettings").c_str());
    is_restricted_fieldID = jni::get_field_id(env, Class, "isRestricted", "Z");
    added_user_ids_fieldID = jni::get_field_id(env, Class, "addedUserIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass botMediaPreviewInfo::Class;
jfieldID botMediaPreviewInfo::previews_fieldID;
jfieldID botMediaPreviewInfo::language_codes_fieldID;

botMediaPreviewInfo::botMediaPreviewInfo()
  : previews_()
  , language_codes_()
{}

botMediaPreviewInfo::botMediaPreviewInfo(array<object_ptr<botMediaPreview>> &&previews_, array<string> &&language_codes_)
  : previews_(std::move(previews_))
  , language_codes_(std::move(language_codes_))
{}

const std::int32_t botMediaPreviewInfo::ID;

object_ptr<botMediaPreviewInfo> botMediaPreviewInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botMediaPreviewInfo> res = make_object<botMediaPreviewInfo>();
  res->previews_ = jni::FetchVector<botMediaPreview>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->previews_fieldID));
  res->language_codes_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->language_codes_fieldID));
  return res;
}

void botMediaPreviewInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, previews_); if (arr_tmp_) { env->SetObjectField(s, previews_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, language_codes_); if (arr_tmp_) { env->SetObjectField(s, language_codes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void botMediaPreviewInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotMediaPreviewInfo");
    { s.store_vector_begin("previews", previews_.size()); for (const auto &_value : previews_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("languageCodes", language_codes_.size()); for (const auto &_value : language_codes_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void botMediaPreviewInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotMediaPreviewInfo").c_str());
    previews_fieldID = jni::get_field_id(env, Class, "previews", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BotMediaPreview;").c_str());
    language_codes_fieldID = jni::get_field_id(env, Class, "languageCodes", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass businessAwayMessageSettings::Class;
jfieldID businessAwayMessageSettings::shortcut_id_fieldID;
jfieldID businessAwayMessageSettings::recipients_fieldID;
jfieldID businessAwayMessageSettings::schedule_fieldID;
jfieldID businessAwayMessageSettings::offline_only_fieldID;

businessAwayMessageSettings::businessAwayMessageSettings()
  : shortcut_id_()
  , recipients_()
  , schedule_()
  , offline_only_()
{}

businessAwayMessageSettings::businessAwayMessageSettings(int32 shortcut_id_, object_ptr<businessRecipients> &&recipients_, object_ptr<BusinessAwayMessageSchedule> &&schedule_, bool offline_only_)
  : shortcut_id_(shortcut_id_)
  , recipients_(std::move(recipients_))
  , schedule_(std::move(schedule_))
  , offline_only_(offline_only_)
{}

const std::int32_t businessAwayMessageSettings::ID;

object_ptr<businessAwayMessageSettings> businessAwayMessageSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessAwayMessageSettings> res = make_object<businessAwayMessageSettings>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->recipients_ = jni::fetch_tl_object<businessRecipients>(env, jni::fetch_object(env, p, res->recipients_fieldID));
  res->schedule_ = jni::fetch_tl_object<BusinessAwayMessageSchedule>(env, jni::fetch_object(env, p, res->schedule_fieldID));
  res->offline_only_ = (env->GetBooleanField(p, res->offline_only_fieldID) != 0);
  return res;
}

void businessAwayMessageSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, shortcut_id_fieldID, shortcut_id_);
  if (recipients_ != nullptr) { jobject next; recipients_->store(env, next); if (next) { env->SetObjectField(s, recipients_fieldID, next); env->DeleteLocalRef(next); } }
  if (schedule_ != nullptr) { jobject next; schedule_->store(env, next); if (next) { env->SetObjectField(s, schedule_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, offline_only_fieldID, offline_only_);
}

void businessAwayMessageSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessAwayMessageSettings");
    s.store_field("shortcutId", shortcut_id_);
    s.store_object_field("recipients", static_cast<const BaseObject *>(recipients_.get()));
    s.store_object_field("schedule", static_cast<const BaseObject *>(schedule_.get()));
    s.store_field("offlineOnly", offline_only_);
    s.store_class_end();
  }
}

void businessAwayMessageSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessAwayMessageSettings").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    recipients_fieldID = jni::get_field_id(env, Class, "recipients", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessRecipients;").c_str());
    schedule_fieldID = jni::get_field_id(env, Class, "schedule", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessAwayMessageSchedule;").c_str());
    offline_only_fieldID = jni::get_field_id(env, Class, "offlineOnly", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass callId::Class;
jfieldID callId::id_fieldID;

callId::callId()
  : id_()
{}

callId::callId(int32 id_)
  : id_(id_)
{}

const std::int32_t callId::ID;

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

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

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

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

jclass callProtocol::Class;
jfieldID callProtocol::udp_p2p_fieldID;
jfieldID callProtocol::udp_reflector_fieldID;
jfieldID callProtocol::min_layer_fieldID;
jfieldID callProtocol::max_layer_fieldID;
jfieldID callProtocol::library_versions_fieldID;

callProtocol::callProtocol()
  : udp_p2p_()
  , udp_reflector_()
  , min_layer_()
  , max_layer_()
  , library_versions_()
{}

callProtocol::callProtocol(bool udp_p2p_, bool udp_reflector_, int32 min_layer_, int32 max_layer_, array<string> &&library_versions_)
  : udp_p2p_(udp_p2p_)
  , udp_reflector_(udp_reflector_)
  , min_layer_(min_layer_)
  , max_layer_(max_layer_)
  , library_versions_(std::move(library_versions_))
{}

const std::int32_t callProtocol::ID;

object_ptr<callProtocol> callProtocol::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<callProtocol> res = make_object<callProtocol>();
  res->udp_p2p_ = (env->GetBooleanField(p, res->udp_p2p_fieldID) != 0);
  res->udp_reflector_ = (env->GetBooleanField(p, res->udp_reflector_fieldID) != 0);
  res->min_layer_ = env->GetIntField(p, res->min_layer_fieldID);
  res->max_layer_ = env->GetIntField(p, res->max_layer_fieldID);
  res->library_versions_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->library_versions_fieldID));
  return res;
}

void callProtocol::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, udp_p2p_fieldID, udp_p2p_);
  env->SetBooleanField(s, udp_reflector_fieldID, udp_reflector_);
  env->SetIntField(s, min_layer_fieldID, min_layer_);
  env->SetIntField(s, max_layer_fieldID, max_layer_);
  { auto arr_tmp_ = jni::store_vector(env, library_versions_); if (arr_tmp_) { env->SetObjectField(s, library_versions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void callProtocol::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CallProtocol");
    s.store_field("udpP2p", udp_p2p_);
    s.store_field("udpReflector", udp_reflector_);
    s.store_field("minLayer", min_layer_);
    s.store_field("maxLayer", max_layer_);
    { s.store_vector_begin("libraryVersions", library_versions_.size()); for (const auto &_value : library_versions_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void callProtocol::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CallProtocol").c_str());
    udp_p2p_fieldID = jni::get_field_id(env, Class, "udpP2p", "Z");
    udp_reflector_fieldID = jni::get_field_id(env, Class, "udpReflector", "Z");
    min_layer_fieldID = jni::get_field_id(env, Class, "minLayer", "I");
    max_layer_fieldID = jni::get_field_id(env, Class, "maxLayer", "I");
    library_versions_fieldID = jni::get_field_id(env, Class, "libraryVersions", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass ChatAction::Class;

object_ptr<ChatAction> ChatAction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case chatActionTyping::ID:
      return chatActionTyping::fetch(env, p);
    case chatActionRecordingVideo::ID:
      return chatActionRecordingVideo::fetch(env, p);
    case chatActionUploadingVideo::ID:
      return chatActionUploadingVideo::fetch(env, p);
    case chatActionRecordingVoiceNote::ID:
      return chatActionRecordingVoiceNote::fetch(env, p);
    case chatActionUploadingVoiceNote::ID:
      return chatActionUploadingVoiceNote::fetch(env, p);
    case chatActionUploadingPhoto::ID:
      return chatActionUploadingPhoto::fetch(env, p);
    case chatActionUploadingDocument::ID:
      return chatActionUploadingDocument::fetch(env, p);
    case chatActionChoosingSticker::ID:
      return chatActionChoosingSticker::fetch(env, p);
    case chatActionChoosingLocation::ID:
      return chatActionChoosingLocation::fetch(env, p);
    case chatActionChoosingContact::ID:
      return chatActionChoosingContact::fetch(env, p);
    case chatActionStartPlayingGame::ID:
      return chatActionStartPlayingGame::fetch(env, p);
    case chatActionRecordingVideoNote::ID:
      return chatActionRecordingVideoNote::fetch(env, p);
    case chatActionUploadingVideoNote::ID:
      return chatActionUploadingVideoNote::fetch(env, p);
    case chatActionWatchingAnimations::ID:
      return chatActionWatchingAnimations::fetch(env, p);
    case chatActionCancel::ID:
      return chatActionCancel::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass chatActionTyping::Class;

chatActionTyping::chatActionTyping() {
}

const std::int32_t chatActionTyping::ID;

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

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

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

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

jclass chatActionRecordingVideo::Class;

chatActionRecordingVideo::chatActionRecordingVideo() {
}

const std::int32_t chatActionRecordingVideo::ID;

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

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

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

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

jclass chatActionUploadingVideo::Class;
jfieldID chatActionUploadingVideo::progress_fieldID;

chatActionUploadingVideo::chatActionUploadingVideo()
  : progress_()
{}

chatActionUploadingVideo::chatActionUploadingVideo(int32 progress_)
  : progress_(progress_)
{}

const std::int32_t chatActionUploadingVideo::ID;

object_ptr<ChatAction> chatActionUploadingVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionUploadingVideo> res = make_object<chatActionUploadingVideo>();
  res->progress_ = env->GetIntField(p, res->progress_fieldID);
  return std::move(res);
}

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

void chatActionUploadingVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionUploadingVideo");
    s.store_field("progress", progress_);
    s.store_class_end();
  }
}

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

jclass chatActionRecordingVoiceNote::Class;

chatActionRecordingVoiceNote::chatActionRecordingVoiceNote() {
}

const std::int32_t chatActionRecordingVoiceNote::ID;

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

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

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

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

jclass chatActionUploadingVoiceNote::Class;
jfieldID chatActionUploadingVoiceNote::progress_fieldID;

chatActionUploadingVoiceNote::chatActionUploadingVoiceNote()
  : progress_()
{}

chatActionUploadingVoiceNote::chatActionUploadingVoiceNote(int32 progress_)
  : progress_(progress_)
{}

const std::int32_t chatActionUploadingVoiceNote::ID;

object_ptr<ChatAction> chatActionUploadingVoiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionUploadingVoiceNote> res = make_object<chatActionUploadingVoiceNote>();
  res->progress_ = env->GetIntField(p, res->progress_fieldID);
  return std::move(res);
}

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

void chatActionUploadingVoiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionUploadingVoiceNote");
    s.store_field("progress", progress_);
    s.store_class_end();
  }
}

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

jclass chatActionUploadingPhoto::Class;
jfieldID chatActionUploadingPhoto::progress_fieldID;

chatActionUploadingPhoto::chatActionUploadingPhoto()
  : progress_()
{}

chatActionUploadingPhoto::chatActionUploadingPhoto(int32 progress_)
  : progress_(progress_)
{}

const std::int32_t chatActionUploadingPhoto::ID;

object_ptr<ChatAction> chatActionUploadingPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionUploadingPhoto> res = make_object<chatActionUploadingPhoto>();
  res->progress_ = env->GetIntField(p, res->progress_fieldID);
  return std::move(res);
}

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

void chatActionUploadingPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionUploadingPhoto");
    s.store_field("progress", progress_);
    s.store_class_end();
  }
}

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

jclass chatActionUploadingDocument::Class;
jfieldID chatActionUploadingDocument::progress_fieldID;

chatActionUploadingDocument::chatActionUploadingDocument()
  : progress_()
{}

chatActionUploadingDocument::chatActionUploadingDocument(int32 progress_)
  : progress_(progress_)
{}

const std::int32_t chatActionUploadingDocument::ID;

object_ptr<ChatAction> chatActionUploadingDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionUploadingDocument> res = make_object<chatActionUploadingDocument>();
  res->progress_ = env->GetIntField(p, res->progress_fieldID);
  return std::move(res);
}

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

void chatActionUploadingDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionUploadingDocument");
    s.store_field("progress", progress_);
    s.store_class_end();
  }
}

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

jclass chatActionChoosingSticker::Class;

chatActionChoosingSticker::chatActionChoosingSticker() {
}

const std::int32_t chatActionChoosingSticker::ID;

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

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

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

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

jclass chatActionChoosingLocation::Class;

chatActionChoosingLocation::chatActionChoosingLocation() {
}

const std::int32_t chatActionChoosingLocation::ID;

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

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

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

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

jclass chatActionChoosingContact::Class;

chatActionChoosingContact::chatActionChoosingContact() {
}

const std::int32_t chatActionChoosingContact::ID;

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

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

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

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

jclass chatActionStartPlayingGame::Class;

chatActionStartPlayingGame::chatActionStartPlayingGame() {
}

const std::int32_t chatActionStartPlayingGame::ID;

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

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

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

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

jclass chatActionRecordingVideoNote::Class;

chatActionRecordingVideoNote::chatActionRecordingVideoNote() {
}

const std::int32_t chatActionRecordingVideoNote::ID;

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

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

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

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

jclass chatActionUploadingVideoNote::Class;
jfieldID chatActionUploadingVideoNote::progress_fieldID;

chatActionUploadingVideoNote::chatActionUploadingVideoNote()
  : progress_()
{}

chatActionUploadingVideoNote::chatActionUploadingVideoNote(int32 progress_)
  : progress_(progress_)
{}

const std::int32_t chatActionUploadingVideoNote::ID;

object_ptr<ChatAction> chatActionUploadingVideoNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionUploadingVideoNote> res = make_object<chatActionUploadingVideoNote>();
  res->progress_ = env->GetIntField(p, res->progress_fieldID);
  return std::move(res);
}

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

void chatActionUploadingVideoNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionUploadingVideoNote");
    s.store_field("progress", progress_);
    s.store_class_end();
  }
}

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

jclass chatActionWatchingAnimations::Class;
jfieldID chatActionWatchingAnimations::emoji_fieldID;

chatActionWatchingAnimations::chatActionWatchingAnimations()
  : emoji_()
{}

chatActionWatchingAnimations::chatActionWatchingAnimations(string const &emoji_)
  : emoji_(emoji_)
{}

const std::int32_t chatActionWatchingAnimations::ID;

object_ptr<ChatAction> chatActionWatchingAnimations::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionWatchingAnimations> res = make_object<chatActionWatchingAnimations>();
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  return std::move(res);
}

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

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

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

jclass chatActionCancel::Class;

chatActionCancel::chatActionCancel() {
}

const std::int32_t chatActionCancel::ID;

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

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

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

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

jclass chatBoostLink::Class;
jfieldID chatBoostLink::link_fieldID;
jfieldID chatBoostLink::is_public_fieldID;

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

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

const std::int32_t chatBoostLink::ID;

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

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

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

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

jclass chatMembers::Class;
jfieldID chatMembers::total_count_fieldID;
jfieldID chatMembers::members_fieldID;

chatMembers::chatMembers()
  : total_count_()
  , members_()
{}

chatMembers::chatMembers(int32 total_count_, array<object_ptr<chatMember>> &&members_)
  : total_count_(total_count_)
  , members_(std::move(members_))
{}

const std::int32_t chatMembers::ID;

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

void chatMembers::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, members_); if (arr_tmp_) { env->SetObjectField(s, members_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void chatMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatMembers");
    s.store_field("totalCount", total_count_);
    { 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 chatMembers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatMembers").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    members_fieldID = jni::get_field_id(env, Class, "members", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatMember;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatPhotoInfo::Class;
jfieldID chatPhotoInfo::small_fieldID;
jfieldID chatPhotoInfo::big_fieldID;
jfieldID chatPhotoInfo::minithumbnail_fieldID;
jfieldID chatPhotoInfo::has_animation_fieldID;
jfieldID chatPhotoInfo::is_personal_fieldID;

chatPhotoInfo::chatPhotoInfo()
  : small_()
  , big_()
  , minithumbnail_()
  , has_animation_()
  , is_personal_()
{}

chatPhotoInfo::chatPhotoInfo(object_ptr<file> &&small_, object_ptr<file> &&big_, object_ptr<minithumbnail> &&minithumbnail_, bool has_animation_, bool is_personal_)
  : small_(std::move(small_))
  , big_(std::move(big_))
  , minithumbnail_(std::move(minithumbnail_))
  , has_animation_(has_animation_)
  , is_personal_(is_personal_)
{}

const std::int32_t chatPhotoInfo::ID;

object_ptr<chatPhotoInfo> chatPhotoInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatPhotoInfo> res = make_object<chatPhotoInfo>();
  res->small_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->small_fieldID));
  res->big_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->big_fieldID));
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->has_animation_ = (env->GetBooleanField(p, res->has_animation_fieldID) != 0);
  res->is_personal_ = (env->GetBooleanField(p, res->is_personal_fieldID) != 0);
  return res;
}

void chatPhotoInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (small_ != nullptr) { jobject next; small_->store(env, next); if (next) { env->SetObjectField(s, small_fieldID, next); env->DeleteLocalRef(next); } }
  if (big_ != nullptr) { jobject next; big_->store(env, next); if (next) { env->SetObjectField(s, big_fieldID, next); env->DeleteLocalRef(next); } }
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, has_animation_fieldID, has_animation_);
  env->SetBooleanField(s, is_personal_fieldID, is_personal_);
}

void chatPhotoInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatPhotoInfo");
    s.store_object_field("small", static_cast<const BaseObject *>(small_.get()));
    s.store_object_field("big", static_cast<const BaseObject *>(big_.get()));
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_field("hasAnimation", has_animation_);
    s.store_field("isPersonal", is_personal_);
    s.store_class_end();
  }
}

void chatPhotoInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatPhotoInfo").c_str());
    small_fieldID = jni::get_field_id(env, Class, "small", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    big_fieldID = jni::get_field_id(env, Class, "big", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    has_animation_fieldID = jni::get_field_id(env, Class, "hasAnimation", "Z");
    is_personal_fieldID = jni::get_field_id(env, Class, "isPersonal", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatRevenueTransactions::Class;
jfieldID chatRevenueTransactions::ton_amount_fieldID;
jfieldID chatRevenueTransactions::transactions_fieldID;
jfieldID chatRevenueTransactions::next_offset_fieldID;

chatRevenueTransactions::chatRevenueTransactions()
  : ton_amount_()
  , transactions_()
  , next_offset_()
{}

chatRevenueTransactions::chatRevenueTransactions(int53 ton_amount_, array<object_ptr<chatRevenueTransaction>> &&transactions_, string const &next_offset_)
  : ton_amount_(ton_amount_)
  , transactions_(std::move(transactions_))
  , next_offset_(next_offset_)
{}

const std::int32_t chatRevenueTransactions::ID;

object_ptr<chatRevenueTransactions> chatRevenueTransactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueTransactions> res = make_object<chatRevenueTransactions>();
  res->ton_amount_ = env->GetLongField(p, res->ton_amount_fieldID);
  res->transactions_ = jni::FetchVector<chatRevenueTransaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->transactions_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

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

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

void chatRevenueTransactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransactions").c_str());
    ton_amount_fieldID = jni::get_field_id(env, Class, "tonAmount", "J");
    transactions_fieldID = jni::get_field_id(env, Class, "transactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatRevenueTransaction;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass ChatStatisticsObjectType::Class;

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

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

jclass chatStatisticsObjectTypeMessage::Class;
jfieldID chatStatisticsObjectTypeMessage::message_id_fieldID;

chatStatisticsObjectTypeMessage::chatStatisticsObjectTypeMessage()
  : message_id_()
{}

chatStatisticsObjectTypeMessage::chatStatisticsObjectTypeMessage(int53 message_id_)
  : message_id_(message_id_)
{}

const std::int32_t chatStatisticsObjectTypeMessage::ID;

object_ptr<ChatStatisticsObjectType> chatStatisticsObjectTypeMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatStatisticsObjectTypeMessage> res = make_object<chatStatisticsObjectTypeMessage>();
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return std::move(res);
}

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

void chatStatisticsObjectTypeMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatStatisticsObjectTypeMessage");
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

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

jclass chatStatisticsObjectTypeStory::Class;
jfieldID chatStatisticsObjectTypeStory::story_id_fieldID;

chatStatisticsObjectTypeStory::chatStatisticsObjectTypeStory()
  : story_id_()
{}

chatStatisticsObjectTypeStory::chatStatisticsObjectTypeStory(int32 story_id_)
  : story_id_(story_id_)
{}

const std::int32_t chatStatisticsObjectTypeStory::ID;

object_ptr<ChatStatisticsObjectType> chatStatisticsObjectTypeStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatStatisticsObjectTypeStory> res = make_object<chatStatisticsObjectTypeStory>();
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  return std::move(res);
}

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

void chatStatisticsObjectTypeStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatStatisticsObjectTypeStory");
    s.store_field("storyId", story_id_);
    s.store_class_end();
  }
}

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

jclass ChatType::Class;

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

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

jclass chatTypePrivate::Class;
jfieldID chatTypePrivate::user_id_fieldID;

chatTypePrivate::chatTypePrivate()
  : user_id_()
{}

chatTypePrivate::chatTypePrivate(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t chatTypePrivate::ID;

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

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

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

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

jclass chatTypeBasicGroup::Class;
jfieldID chatTypeBasicGroup::basic_group_id_fieldID;

chatTypeBasicGroup::chatTypeBasicGroup()
  : basic_group_id_()
{}

chatTypeBasicGroup::chatTypeBasicGroup(int53 basic_group_id_)
  : basic_group_id_(basic_group_id_)
{}

const std::int32_t chatTypeBasicGroup::ID;

object_ptr<ChatType> chatTypeBasicGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatTypeBasicGroup> res = make_object<chatTypeBasicGroup>();
  res->basic_group_id_ = env->GetLongField(p, res->basic_group_id_fieldID);
  return std::move(res);
}

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

void chatTypeBasicGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatTypeBasicGroup");
    s.store_field("basicGroupId", basic_group_id_);
    s.store_class_end();
  }
}

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

jclass chatTypeSupergroup::Class;
jfieldID chatTypeSupergroup::supergroup_id_fieldID;
jfieldID chatTypeSupergroup::is_channel_fieldID;

chatTypeSupergroup::chatTypeSupergroup()
  : supergroup_id_()
  , is_channel_()
{}

chatTypeSupergroup::chatTypeSupergroup(int53 supergroup_id_, bool is_channel_)
  : supergroup_id_(supergroup_id_)
  , is_channel_(is_channel_)
{}

const std::int32_t chatTypeSupergroup::ID;

object_ptr<ChatType> chatTypeSupergroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatTypeSupergroup> res = make_object<chatTypeSupergroup>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->is_channel_ = (env->GetBooleanField(p, res->is_channel_fieldID) != 0);
  return std::move(res);
}

void chatTypeSupergroup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, supergroup_id_fieldID, supergroup_id_);
  env->SetBooleanField(s, is_channel_fieldID, is_channel_);
}

void chatTypeSupergroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatTypeSupergroup");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("isChannel", is_channel_);
    s.store_class_end();
  }
}

void chatTypeSupergroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatTypeSupergroup").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    is_channel_fieldID = jni::get_field_id(env, Class, "isChannel", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatTypeSecret::Class;
jfieldID chatTypeSecret::secret_chat_id_fieldID;
jfieldID chatTypeSecret::user_id_fieldID;

chatTypeSecret::chatTypeSecret()
  : secret_chat_id_()
  , user_id_()
{}

chatTypeSecret::chatTypeSecret(int32 secret_chat_id_, int53 user_id_)
  : secret_chat_id_(secret_chat_id_)
  , user_id_(user_id_)
{}

const std::int32_t chatTypeSecret::ID;

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

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

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

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

jclass CraftGiftResult::Class;

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

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

jclass craftGiftResultSuccess::Class;
jfieldID craftGiftResultSuccess::gift_fieldID;
jfieldID craftGiftResultSuccess::received_gift_id_fieldID;

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

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

const std::int32_t craftGiftResultSuccess::ID;

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

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

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

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

jclass craftGiftResultTooEarly::Class;
jfieldID craftGiftResultTooEarly::retry_after_fieldID;

craftGiftResultTooEarly::craftGiftResultTooEarly()
  : retry_after_()
{}

craftGiftResultTooEarly::craftGiftResultTooEarly(int32 retry_after_)
  : retry_after_(retry_after_)
{}

const std::int32_t craftGiftResultTooEarly::ID;

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

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

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

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

jclass craftGiftResultInvalidGift::Class;

craftGiftResultInvalidGift::craftGiftResultInvalidGift() {
}

const std::int32_t craftGiftResultInvalidGift::ID;

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

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

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

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

jclass craftGiftResultFail::Class;

craftGiftResultFail::craftGiftResultFail() {
}

const std::int32_t craftGiftResultFail::ID;

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

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

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

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

jclass draftMessage::Class;
jfieldID draftMessage::reply_to_fieldID;
jfieldID draftMessage::date_fieldID;
jfieldID draftMessage::input_message_text_fieldID;
jfieldID draftMessage::effect_id_fieldID;
jfieldID draftMessage::suggested_post_info_fieldID;

draftMessage::draftMessage()
  : reply_to_()
  , date_()
  , input_message_text_()
  , effect_id_()
  , suggested_post_info_()
{}

draftMessage::draftMessage(object_ptr<InputMessageReplyTo> &&reply_to_, int32 date_, object_ptr<InputMessageContent> &&input_message_text_, int64 effect_id_, object_ptr<inputSuggestedPostInfo> &&suggested_post_info_)
  : reply_to_(std::move(reply_to_))
  , date_(date_)
  , input_message_text_(std::move(input_message_text_))
  , effect_id_(effect_id_)
  , suggested_post_info_(std::move(suggested_post_info_))
{}

const std::int32_t draftMessage::ID;

object_ptr<draftMessage> draftMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<draftMessage> res = make_object<draftMessage>();
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->input_message_text_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_text_fieldID));
  res->effect_id_ = env->GetLongField(p, res->effect_id_fieldID);
  res->suggested_post_info_ = jni::fetch_tl_object<inputSuggestedPostInfo>(env, jni::fetch_object(env, p, res->suggested_post_info_fieldID));
  return res;
}

void draftMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (reply_to_ != nullptr) { jobject next; reply_to_->store(env, next); if (next) { env->SetObjectField(s, reply_to_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  if (input_message_text_ != nullptr) { jobject next; input_message_text_->store(env, next); if (next) { env->SetObjectField(s, input_message_text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, effect_id_fieldID, effect_id_);
  if (suggested_post_info_ != nullptr) { jobject next; suggested_post_info_->store(env, next); if (next) { env->SetObjectField(s, suggested_post_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void draftMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DraftMessage");
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_field("date", date_);
    s.store_object_field("inputMessageText", static_cast<const BaseObject *>(input_message_text_.get()));
    s.store_field("effectId", effect_id_);
    s.store_object_field("suggestedPostInfo", static_cast<const BaseObject *>(suggested_post_info_.get()));
    s.store_class_end();
  }
}

void draftMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DraftMessage").c_str());
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    input_message_text_fieldID = jni::get_field_id(env, Class, "inputMessageText", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    effect_id_fieldID = jni::get_field_id(env, Class, "effectId", "J");
    suggested_post_info_fieldID = jni::get_field_id(env, Class, "suggestedPostInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputSuggestedPostInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass emojiCategories::Class;
jfieldID emojiCategories::categories_fieldID;

emojiCategories::emojiCategories()
  : categories_()
{}

emojiCategories::emojiCategories(array<object_ptr<emojiCategory>> &&categories_)
  : categories_(std::move(categories_))
{}

const std::int32_t emojiCategories::ID;

object_ptr<emojiCategories> emojiCategories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiCategories> res = make_object<emojiCategories>();
  res->categories_ = jni::FetchVector<emojiCategory>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->categories_fieldID));
  return res;
}

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

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

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

jclass EmojiCategoryType::Class;

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

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

jclass emojiCategoryTypeDefault::Class;

emojiCategoryTypeDefault::emojiCategoryTypeDefault() {
}

const std::int32_t emojiCategoryTypeDefault::ID;

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

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

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

jclass emojiCategoryTypeRegularStickers::Class;

emojiCategoryTypeRegularStickers::emojiCategoryTypeRegularStickers() {
}

const std::int32_t emojiCategoryTypeRegularStickers::ID;

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

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

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

jclass emojiCategoryTypeEmojiStatus::Class;

emojiCategoryTypeEmojiStatus::emojiCategoryTypeEmojiStatus() {
}

const std::int32_t emojiCategoryTypeEmojiStatus::ID;

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

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

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

jclass emojiCategoryTypeChatPhoto::Class;

emojiCategoryTypeChatPhoto::emojiCategoryTypeChatPhoto() {
}

const std::int32_t emojiCategoryTypeChatPhoto::ID;

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

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

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

jclass emojiKeyword::Class;
jfieldID emojiKeyword::emoji_fieldID;
jfieldID emojiKeyword::keyword_fieldID;

emojiKeyword::emojiKeyword()
  : emoji_()
  , keyword_()
{}

emojiKeyword::emojiKeyword(string const &emoji_, string const &keyword_)
  : emoji_(emoji_)
  , keyword_(keyword_)
{}

const std::int32_t emojiKeyword::ID;

object_ptr<emojiKeyword> emojiKeyword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiKeyword> res = make_object<emojiKeyword>();
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->keyword_ = jni::fetch_string(env, p, res->keyword_fieldID);
  return res;
}

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

void emojiKeyword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiKeyword");
    s.store_field("emoji", emoji_);
    s.store_field("keyword", keyword_);
    s.store_class_end();
  }
}

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

jclass emojiReaction::Class;
jfieldID emojiReaction::emoji_fieldID;
jfieldID emojiReaction::title_fieldID;
jfieldID emojiReaction::is_active_fieldID;
jfieldID emojiReaction::static_icon_fieldID;
jfieldID emojiReaction::appear_animation_fieldID;
jfieldID emojiReaction::select_animation_fieldID;
jfieldID emojiReaction::activate_animation_fieldID;
jfieldID emojiReaction::effect_animation_fieldID;
jfieldID emojiReaction::around_animation_fieldID;
jfieldID emojiReaction::center_animation_fieldID;

emojiReaction::emojiReaction()
  : emoji_()
  , title_()
  , is_active_()
  , static_icon_()
  , appear_animation_()
  , select_animation_()
  , activate_animation_()
  , effect_animation_()
  , around_animation_()
  , center_animation_()
{}

emojiReaction::emojiReaction(string const &emoji_, string const &title_, bool is_active_, object_ptr<sticker> &&static_icon_, object_ptr<sticker> &&appear_animation_, object_ptr<sticker> &&select_animation_, object_ptr<sticker> &&activate_animation_, object_ptr<sticker> &&effect_animation_, object_ptr<sticker> &&around_animation_, object_ptr<sticker> &&center_animation_)
  : emoji_(emoji_)
  , title_(title_)
  , is_active_(is_active_)
  , static_icon_(std::move(static_icon_))
  , appear_animation_(std::move(appear_animation_))
  , select_animation_(std::move(select_animation_))
  , activate_animation_(std::move(activate_animation_))
  , effect_animation_(std::move(effect_animation_))
  , around_animation_(std::move(around_animation_))
  , center_animation_(std::move(center_animation_))
{}

const std::int32_t emojiReaction::ID;

object_ptr<emojiReaction> emojiReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiReaction> res = make_object<emojiReaction>();
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  res->static_icon_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->static_icon_fieldID));
  res->appear_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->appear_animation_fieldID));
  res->select_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->select_animation_fieldID));
  res->activate_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->activate_animation_fieldID));
  res->effect_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->effect_animation_fieldID));
  res->around_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->around_animation_fieldID));
  res->center_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->center_animation_fieldID));
  return res;
}

void emojiReaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_active_fieldID, is_active_);
  if (static_icon_ != nullptr) { jobject next; static_icon_->store(env, next); if (next) { env->SetObjectField(s, static_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (appear_animation_ != nullptr) { jobject next; appear_animation_->store(env, next); if (next) { env->SetObjectField(s, appear_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (select_animation_ != nullptr) { jobject next; select_animation_->store(env, next); if (next) { env->SetObjectField(s, select_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (activate_animation_ != nullptr) { jobject next; activate_animation_->store(env, next); if (next) { env->SetObjectField(s, activate_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (effect_animation_ != nullptr) { jobject next; effect_animation_->store(env, next); if (next) { env->SetObjectField(s, effect_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (around_animation_ != nullptr) { jobject next; around_animation_->store(env, next); if (next) { env->SetObjectField(s, around_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (center_animation_ != nullptr) { jobject next; center_animation_->store(env, next); if (next) { env->SetObjectField(s, center_animation_fieldID, next); env->DeleteLocalRef(next); } }
}

void emojiReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiReaction");
    s.store_field("emoji", emoji_);
    s.store_field("title", title_);
    s.store_field("isActive", is_active_);
    s.store_object_field("staticIcon", static_cast<const BaseObject *>(static_icon_.get()));
    s.store_object_field("appearAnimation", static_cast<const BaseObject *>(appear_animation_.get()));
    s.store_object_field("selectAnimation", static_cast<const BaseObject *>(select_animation_.get()));
    s.store_object_field("activateAnimation", static_cast<const BaseObject *>(activate_animation_.get()));
    s.store_object_field("effectAnimation", static_cast<const BaseObject *>(effect_animation_.get()));
    s.store_object_field("aroundAnimation", static_cast<const BaseObject *>(around_animation_.get()));
    s.store_object_field("centerAnimation", static_cast<const BaseObject *>(center_animation_.get()));
    s.store_class_end();
  }
}

void emojiReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiReaction").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    is_active_fieldID = jni::get_field_id(env, Class, "isActive", "Z");
    static_icon_fieldID = jni::get_field_id(env, Class, "staticIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    appear_animation_fieldID = jni::get_field_id(env, Class, "appearAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    select_animation_fieldID = jni::get_field_id(env, Class, "selectAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    activate_animation_fieldID = jni::get_field_id(env, Class, "activateAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    effect_animation_fieldID = jni::get_field_id(env, Class, "effectAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    around_animation_fieldID = jni::get_field_id(env, Class, "aroundAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    center_animation_fieldID = jni::get_field_id(env, Class, "centerAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass emojiStatuses::Class;
jfieldID emojiStatuses::emoji_statuses_fieldID;

emojiStatuses::emojiStatuses()
  : emoji_statuses_()
{}

emojiStatuses::emojiStatuses(array<object_ptr<emojiStatus>> &&emoji_statuses_)
  : emoji_statuses_(std::move(emoji_statuses_))
{}

const std::int32_t emojiStatuses::ID;

object_ptr<emojiStatuses> emojiStatuses::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiStatuses> res = make_object<emojiStatuses>();
  res->emoji_statuses_ = jni::FetchVector<emojiStatus>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emoji_statuses_fieldID));
  return res;
}

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

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

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

jclass fileDownloadedPrefixSize::Class;
jfieldID fileDownloadedPrefixSize::size_fieldID;

fileDownloadedPrefixSize::fileDownloadedPrefixSize()
  : size_()
{}

fileDownloadedPrefixSize::fileDownloadedPrefixSize(int53 size_)
  : size_(size_)
{}

const std::int32_t fileDownloadedPrefixSize::ID;

object_ptr<fileDownloadedPrefixSize> fileDownloadedPrefixSize::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<fileDownloadedPrefixSize> res = make_object<fileDownloadedPrefixSize>();
  res->size_ = env->GetLongField(p, res->size_fieldID);
  return res;
}

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

void fileDownloadedPrefixSize::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FileDownloadedPrefixSize");
    s.store_field("size", size_);
    s.store_class_end();
  }
}

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

jclass fixedText::Class;
jfieldID fixedText::text_fieldID;
jfieldID fixedText::diff_text_fieldID;

fixedText::fixedText()
  : text_()
  , diff_text_()
{}

fixedText::fixedText(object_ptr<formattedText> &&text_, object_ptr<diffText> &&diff_text_)
  : text_(std::move(text_))
  , diff_text_(std::move(diff_text_))
{}

const std::int32_t fixedText::ID;

object_ptr<fixedText> fixedText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<fixedText> res = make_object<fixedText>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->diff_text_ = jni::fetch_tl_object<diffText>(env, jni::fetch_object(env, p, res->diff_text_fieldID));
  return res;
}

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

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

void fixedText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FixedText").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    diff_text_fieldID = jni::get_field_id(env, Class, "diffText", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DiffText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass formattedText::Class;
jfieldID formattedText::text_fieldID;
jfieldID formattedText::entities_fieldID;

formattedText::formattedText()
  : text_()
  , entities_()
{}

formattedText::formattedText(string const &text_, array<object_ptr<textEntity>> &&entities_)
  : text_(text_)
  , entities_(std::move(entities_))
{}

const std::int32_t formattedText::ID;

object_ptr<formattedText> formattedText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<formattedText> res = make_object<formattedText>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->entities_ = jni::FetchVector<textEntity>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->entities_fieldID));
  return res;
}

void formattedText::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); } }
  { auto arr_tmp_ = jni::store_vector(env, entities_); if (arr_tmp_) { env->SetObjectField(s, entities_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void formattedText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FormattedText");
    s.store_field("text", text_);
    { s.store_vector_begin("entities", entities_.size()); for (const auto &_value : entities_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass forumTopicInfo::Class;
jfieldID forumTopicInfo::chat_id_fieldID;
jfieldID forumTopicInfo::forum_topic_id_fieldID;
jfieldID forumTopicInfo::name_fieldID;
jfieldID forumTopicInfo::icon_fieldID;
jfieldID forumTopicInfo::creation_date_fieldID;
jfieldID forumTopicInfo::creator_id_fieldID;
jfieldID forumTopicInfo::is_general_fieldID;
jfieldID forumTopicInfo::is_outgoing_fieldID;
jfieldID forumTopicInfo::is_closed_fieldID;
jfieldID forumTopicInfo::is_hidden_fieldID;
jfieldID forumTopicInfo::is_name_implicit_fieldID;

forumTopicInfo::forumTopicInfo()
  : chat_id_()
  , forum_topic_id_()
  , name_()
  , icon_()
  , creation_date_()
  , creator_id_()
  , is_general_()
  , is_outgoing_()
  , is_closed_()
  , is_hidden_()
  , is_name_implicit_()
{}

forumTopicInfo::forumTopicInfo(int53 chat_id_, int32 forum_topic_id_, string const &name_, object_ptr<forumTopicIcon> &&icon_, int32 creation_date_, object_ptr<MessageSender> &&creator_id_, bool is_general_, bool is_outgoing_, bool is_closed_, bool is_hidden_, bool is_name_implicit_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , name_(name_)
  , icon_(std::move(icon_))
  , creation_date_(creation_date_)
  , creator_id_(std::move(creator_id_))
  , is_general_(is_general_)
  , is_outgoing_(is_outgoing_)
  , is_closed_(is_closed_)
  , is_hidden_(is_hidden_)
  , is_name_implicit_(is_name_implicit_)
{}

const std::int32_t forumTopicInfo::ID;

object_ptr<forumTopicInfo> forumTopicInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<forumTopicInfo> res = make_object<forumTopicInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->icon_ = jni::fetch_tl_object<forumTopicIcon>(env, jni::fetch_object(env, p, res->icon_fieldID));
  res->creation_date_ = env->GetIntField(p, res->creation_date_fieldID);
  res->creator_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->creator_id_fieldID));
  res->is_general_ = (env->GetBooleanField(p, res->is_general_fieldID) != 0);
  res->is_outgoing_ = (env->GetBooleanField(p, res->is_outgoing_fieldID) != 0);
  res->is_closed_ = (env->GetBooleanField(p, res->is_closed_fieldID) != 0);
  res->is_hidden_ = (env->GetBooleanField(p, res->is_hidden_fieldID) != 0);
  res->is_name_implicit_ = (env->GetBooleanField(p, res->is_name_implicit_fieldID) != 0);
  return res;
}

void forumTopicInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, forum_topic_id_fieldID, forum_topic_id_);
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (icon_ != nullptr) { jobject next; icon_->store(env, next); if (next) { env->SetObjectField(s, icon_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, creation_date_fieldID, creation_date_);
  if (creator_id_ != nullptr) { jobject next; creator_id_->store(env, next); if (next) { env->SetObjectField(s, creator_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_general_fieldID, is_general_);
  env->SetBooleanField(s, is_outgoing_fieldID, is_outgoing_);
  env->SetBooleanField(s, is_closed_fieldID, is_closed_);
  env->SetBooleanField(s, is_hidden_fieldID, is_hidden_);
  env->SetBooleanField(s, is_name_implicit_fieldID, is_name_implicit_);
}

void forumTopicInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ForumTopicInfo");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("name", name_);
    s.store_object_field("icon", static_cast<const BaseObject *>(icon_.get()));
    s.store_field("creationDate", creation_date_);
    s.store_object_field("creatorId", static_cast<const BaseObject *>(creator_id_.get()));
    s.store_field("isGeneral", is_general_);
    s.store_field("isOutgoing", is_outgoing_);
    s.store_field("isClosed", is_closed_);
    s.store_field("isHidden", is_hidden_);
    s.store_field("isNameImplicit", is_name_implicit_);
    s.store_class_end();
  }
}

void forumTopicInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ForumTopicInfo").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    forum_topic_id_fieldID = jni::get_field_id(env, Class, "forumTopicId", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    icon_fieldID = jni::get_field_id(env, Class, "icon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicIcon;").c_str());
    creation_date_fieldID = jni::get_field_id(env, Class, "creationDate", "I");
    creator_id_fieldID = jni::get_field_id(env, Class, "creatorId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_general_fieldID = jni::get_field_id(env, Class, "isGeneral", "Z");
    is_outgoing_fieldID = jni::get_field_id(env, Class, "isOutgoing", "Z");
    is_closed_fieldID = jni::get_field_id(env, Class, "isClosed", "Z");
    is_hidden_fieldID = jni::get_field_id(env, Class, "isHidden", "Z");
    is_name_implicit_fieldID = jni::get_field_id(env, Class, "isNameImplicit", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass foundChatMessages::Class;
jfieldID foundChatMessages::total_count_fieldID;
jfieldID foundChatMessages::messages_fieldID;
jfieldID foundChatMessages::next_from_message_id_fieldID;

foundChatMessages::foundChatMessages()
  : total_count_()
  , messages_()
  , next_from_message_id_()
{}

foundChatMessages::foundChatMessages(int32 total_count_, array<object_ptr<message>> &&messages_, int53 next_from_message_id_)
  : total_count_(total_count_)
  , messages_(std::move(messages_))
  , next_from_message_id_(next_from_message_id_)
{}

const std::int32_t foundChatMessages::ID;

object_ptr<foundChatMessages> foundChatMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundChatMessages> res = make_object<foundChatMessages>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->messages_ = jni::FetchVector<message>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->messages_fieldID));
  res->next_from_message_id_ = env->GetLongField(p, res->next_from_message_id_fieldID);
  return res;
}

void foundChatMessages::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, messages_); if (arr_tmp_) { env->SetObjectField(s, messages_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetLongField(s, next_from_message_id_fieldID, next_from_message_id_);
}

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

void foundChatMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FoundChatMessages").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    messages_fieldID = jni::get_field_id(env, Class, "messages", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    next_from_message_id_fieldID = jni::get_field_id(env, Class, "nextFromMessageId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass foundFileDownloads::Class;
jfieldID foundFileDownloads::total_counts_fieldID;
jfieldID foundFileDownloads::files_fieldID;
jfieldID foundFileDownloads::next_offset_fieldID;

foundFileDownloads::foundFileDownloads()
  : total_counts_()
  , files_()
  , next_offset_()
{}

foundFileDownloads::foundFileDownloads(object_ptr<downloadedFileCounts> &&total_counts_, array<object_ptr<fileDownload>> &&files_, string const &next_offset_)
  : total_counts_(std::move(total_counts_))
  , files_(std::move(files_))
  , next_offset_(next_offset_)
{}

const std::int32_t foundFileDownloads::ID;

object_ptr<foundFileDownloads> foundFileDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundFileDownloads> res = make_object<foundFileDownloads>();
  res->total_counts_ = jni::fetch_tl_object<downloadedFileCounts>(env, jni::fetch_object(env, p, res->total_counts_fieldID));
  res->files_ = jni::FetchVector<fileDownload>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->files_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void foundFileDownloads::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (total_counts_ != nullptr) { jobject next; total_counts_->store(env, next); if (next) { env->SetObjectField(s, total_counts_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, files_); if (arr_tmp_) { env->SetObjectField(s, files_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 foundFileDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FoundFileDownloads");
    s.store_object_field("totalCounts", static_cast<const BaseObject *>(total_counts_.get()));
    { s.store_vector_begin("files", files_.size()); for (const auto &_value : files_) { 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 foundFileDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FoundFileDownloads").c_str());
    total_counts_fieldID = jni::get_field_id(env, Class, "totalCounts", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DownloadedFileCounts;").c_str());
    files_fieldID = jni::get_field_id(env, Class, "files", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$FileDownload;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass giftAuctionState::Class;
jfieldID giftAuctionState::gift_fieldID;
jfieldID giftAuctionState::state_fieldID;

giftAuctionState::giftAuctionState()
  : gift_()
  , state_()
{}

giftAuctionState::giftAuctionState(object_ptr<gift> &&gift_, object_ptr<AuctionState> &&state_)
  : gift_(std::move(gift_))
  , state_(std::move(state_))
{}

const std::int32_t giftAuctionState::ID;

object_ptr<giftAuctionState> giftAuctionState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftAuctionState> res = make_object<giftAuctionState>();
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->state_ = jni::fetch_tl_object<AuctionState>(env, jni::fetch_object(env, p, res->state_fieldID));
  return res;
}

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

void giftAuctionState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftAuctionState");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_class_end();
  }
}

void giftAuctionState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftAuctionState").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").c_str());
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AuctionState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass groupCallVideoSourceGroup::Class;
jfieldID groupCallVideoSourceGroup::semantics_fieldID;
jfieldID groupCallVideoSourceGroup::source_ids_fieldID;

groupCallVideoSourceGroup::groupCallVideoSourceGroup()
  : semantics_()
  , source_ids_()
{}

groupCallVideoSourceGroup::groupCallVideoSourceGroup(string const &semantics_, array<int32> &&source_ids_)
  : semantics_(semantics_)
  , source_ids_(std::move(source_ids_))
{}

const std::int32_t groupCallVideoSourceGroup::ID;

object_ptr<groupCallVideoSourceGroup> groupCallVideoSourceGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallVideoSourceGroup> res = make_object<groupCallVideoSourceGroup>();
  res->semantics_ = jni::fetch_string(env, p, res->semantics_fieldID);
  res->source_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->source_ids_fieldID));
  return res;
}

void groupCallVideoSourceGroup::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, semantics_); if (nextString) { env->SetObjectField(s, semantics_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, source_ids_); if (arr_tmp_) { env->SetObjectField(s, source_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void groupCallVideoSourceGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallVideoSourceGroup");
    s.store_field("semantics", semantics_);
    { s.store_vector_begin("sourceIds", source_ids_.size()); for (const auto &_value : source_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void groupCallVideoSourceGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallVideoSourceGroup").c_str());
    semantics_fieldID = jni::get_field_id(env, Class, "semantics", "Ljava/lang/String;");
    source_ids_fieldID = jni::get_field_id(env, Class, "sourceIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass inputPassportElementError::Class;
jfieldID inputPassportElementError::type_fieldID;
jfieldID inputPassportElementError::message_fieldID;
jfieldID inputPassportElementError::source_fieldID;

inputPassportElementError::inputPassportElementError()
  : type_()
  , message_()
  , source_()
{}

inputPassportElementError::inputPassportElementError(object_ptr<PassportElementType> &&type_, string const &message_, object_ptr<InputPassportElementErrorSource> &&source_)
  : type_(std::move(type_))
  , message_(message_)
  , source_(std::move(source_))
{}

const std::int32_t inputPassportElementError::ID;

object_ptr<inputPassportElementError> inputPassportElementError::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementError> res = make_object<inputPassportElementError>();
  res->type_ = jni::fetch_tl_object<PassportElementType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->message_ = jni::fetch_string(env, p, res->message_fieldID);
  res->source_ = jni::fetch_tl_object<InputPassportElementErrorSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  return res;
}

void inputPassportElementError::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementError");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("message", message_);
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_class_end();
  }
}

void inputPassportElementError::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputPassportElementError").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PassportElementType;").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", "Ljava/lang/String;");
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputPassportElementErrorSource;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inputSticker::Class;
jfieldID inputSticker::sticker_fieldID;
jfieldID inputSticker::format_fieldID;
jfieldID inputSticker::emojis_fieldID;
jfieldID inputSticker::mask_position_fieldID;
jfieldID inputSticker::keywords_fieldID;

inputSticker::inputSticker()
  : sticker_()
  , format_()
  , emojis_()
  , mask_position_()
  , keywords_()
{}

inputSticker::inputSticker(object_ptr<InputFile> &&sticker_, object_ptr<StickerFormat> &&format_, string const &emojis_, object_ptr<maskPosition> &&mask_position_, array<string> &&keywords_)
  : sticker_(std::move(sticker_))
  , format_(std::move(format_))
  , emojis_(emojis_)
  , mask_position_(std::move(mask_position_))
  , keywords_(std::move(keywords_))
{}

const std::int32_t inputSticker::ID;

object_ptr<inputSticker> inputSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputSticker> res = make_object<inputSticker>();
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->format_ = jni::fetch_tl_object<StickerFormat>(env, jni::fetch_object(env, p, res->format_fieldID));
  res->emojis_ = jni::fetch_string(env, p, res->emojis_fieldID);
  res->mask_position_ = jni::fetch_tl_object<maskPosition>(env, jni::fetch_object(env, p, res->mask_position_fieldID));
  res->keywords_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->keywords_fieldID));
  return res;
}

void inputSticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputSticker");
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_object_field("format", static_cast<const BaseObject *>(format_.get()));
    s.store_field("emojis", emojis_);
    s.store_object_field("maskPosition", static_cast<const BaseObject *>(mask_position_.get()));
    { s.store_vector_begin("keywords", keywords_.size()); for (const auto &_value : keywords_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void inputSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputSticker").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    format_fieldID = jni::get_field_id(env, Class, "format", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerFormat;").c_str());
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "Ljava/lang/String;");
    mask_position_fieldID = jni::get_field_id(env, Class, "maskPosition", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MaskPosition;").c_str());
    keywords_fieldID = jni::get_field_id(env, Class, "keywords", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass labeledPricePart::Class;
jfieldID labeledPricePart::label_fieldID;
jfieldID labeledPricePart::amount_fieldID;

labeledPricePart::labeledPricePart()
  : label_()
  , amount_()
{}

labeledPricePart::labeledPricePart(string const &label_, int53 amount_)
  : label_(label_)
  , amount_(amount_)
{}

const std::int32_t labeledPricePart::ID;

object_ptr<labeledPricePart> labeledPricePart::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<labeledPricePart> res = make_object<labeledPricePart>();
  res->label_ = jni::fetch_string(env, p, res->label_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  return res;
}

void labeledPricePart::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, label_); if (nextString) { env->SetObjectField(s, label_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
}

void labeledPricePart::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LabeledPricePart");
    s.store_field("label", label_);
    s.store_field("amount", amount_);
    s.store_class_end();
  }
}

void labeledPricePart::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LabeledPricePart").c_str());
    label_fieldID = jni::get_field_id(env, Class, "label", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass LoginUrlInfo::Class;

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

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

jclass loginUrlInfoOpen::Class;
jfieldID loginUrlInfoOpen::url_fieldID;
jfieldID loginUrlInfoOpen::skip_confirmation_fieldID;

loginUrlInfoOpen::loginUrlInfoOpen()
  : url_()
  , skip_confirmation_()
{}

loginUrlInfoOpen::loginUrlInfoOpen(string const &url_, bool skip_confirmation_)
  : url_(url_)
  , skip_confirmation_(skip_confirmation_)
{}

const std::int32_t loginUrlInfoOpen::ID;

object_ptr<LoginUrlInfo> loginUrlInfoOpen::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<loginUrlInfoOpen> res = make_object<loginUrlInfoOpen>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->skip_confirmation_ = (env->GetBooleanField(p, res->skip_confirmation_fieldID) != 0);
  return std::move(res);
}

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

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

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

jclass loginUrlInfoRequestConfirmation::Class;
jfieldID loginUrlInfoRequestConfirmation::url_fieldID;
jfieldID loginUrlInfoRequestConfirmation::domain_fieldID;
jfieldID loginUrlInfoRequestConfirmation::bot_user_id_fieldID;
jfieldID loginUrlInfoRequestConfirmation::request_write_access_fieldID;

loginUrlInfoRequestConfirmation::loginUrlInfoRequestConfirmation()
  : url_()
  , domain_()
  , bot_user_id_()
  , request_write_access_()
{}

loginUrlInfoRequestConfirmation::loginUrlInfoRequestConfirmation(string const &url_, string const &domain_, int53 bot_user_id_, bool request_write_access_)
  : url_(url_)
  , domain_(domain_)
  , bot_user_id_(bot_user_id_)
  , request_write_access_(request_write_access_)
{}

const std::int32_t loginUrlInfoRequestConfirmation::ID;

object_ptr<LoginUrlInfo> loginUrlInfoRequestConfirmation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<loginUrlInfoRequestConfirmation> res = make_object<loginUrlInfoRequestConfirmation>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->domain_ = jni::fetch_string(env, p, res->domain_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->request_write_access_ = (env->GetBooleanField(p, res->request_write_access_fieldID) != 0);
  return std::move(res);
}

void loginUrlInfoRequestConfirmation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, domain_); if (nextString) { env->SetObjectField(s, domain_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, bot_user_id_fieldID, bot_user_id_);
  env->SetBooleanField(s, request_write_access_fieldID, request_write_access_);
}

void loginUrlInfoRequestConfirmation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoginUrlInfoRequestConfirmation");
    s.store_field("url", url_);
    s.store_field("domain", domain_);
    s.store_field("botUserId", bot_user_id_);
    s.store_field("requestWriteAccess", request_write_access_);
    s.store_class_end();
  }
}

void loginUrlInfoRequestConfirmation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LoginUrlInfoRequestConfirmation").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    domain_fieldID = jni::get_field_id(env, Class, "domain", "Ljava/lang/String;");
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    request_write_access_fieldID = jni::get_field_id(env, Class, "requestWriteAccess", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass MessageContent::Class;

object_ptr<MessageContent> MessageContent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case messageText::ID:
      return messageText::fetch(env, p);
    case messageAnimation::ID:
      return messageAnimation::fetch(env, p);
    case messageAudio::ID:
      return messageAudio::fetch(env, p);
    case messageDocument::ID:
      return messageDocument::fetch(env, p);
    case messagePaidMedia::ID:
      return messagePaidMedia::fetch(env, p);
    case messagePhoto::ID:
      return messagePhoto::fetch(env, p);
    case messageSticker::ID:
      return messageSticker::fetch(env, p);
    case messageVideo::ID:
      return messageVideo::fetch(env, p);
    case messageVideoNote::ID:
      return messageVideoNote::fetch(env, p);
    case messageVoiceNote::ID:
      return messageVoiceNote::fetch(env, p);
    case messageExpiredPhoto::ID:
      return messageExpiredPhoto::fetch(env, p);
    case messageExpiredVideo::ID:
      return messageExpiredVideo::fetch(env, p);
    case messageExpiredVideoNote::ID:
      return messageExpiredVideoNote::fetch(env, p);
    case messageExpiredVoiceNote::ID:
      return messageExpiredVoiceNote::fetch(env, p);
    case messageLocation::ID:
      return messageLocation::fetch(env, p);
    case messageVenue::ID:
      return messageVenue::fetch(env, p);
    case messageContact::ID:
      return messageContact::fetch(env, p);
    case messageAnimatedEmoji::ID:
      return messageAnimatedEmoji::fetch(env, p);
    case messageDice::ID:
      return messageDice::fetch(env, p);
    case messageGame::ID:
      return messageGame::fetch(env, p);
    case messagePoll::ID:
      return messagePoll::fetch(env, p);
    case messageStakeDice::ID:
      return messageStakeDice::fetch(env, p);
    case messageStory::ID:
      return messageStory::fetch(env, p);
    case messageChecklist::ID:
      return messageChecklist::fetch(env, p);
    case messageInvoice::ID:
      return messageInvoice::fetch(env, p);
    case messageCall::ID:
      return messageCall::fetch(env, p);
    case messageGroupCall::ID:
      return messageGroupCall::fetch(env, p);
    case messageVideoChatScheduled::ID:
      return messageVideoChatScheduled::fetch(env, p);
    case messageVideoChatStarted::ID:
      return messageVideoChatStarted::fetch(env, p);
    case messageVideoChatEnded::ID:
      return messageVideoChatEnded::fetch(env, p);
    case messageInviteVideoChatParticipants::ID:
      return messageInviteVideoChatParticipants::fetch(env, p);
    case messagePollOptionAdded::ID:
      return messagePollOptionAdded::fetch(env, p);
    case messagePollOptionDeleted::ID:
      return messagePollOptionDeleted::fetch(env, p);
    case messageBasicGroupChatCreate::ID:
      return messageBasicGroupChatCreate::fetch(env, p);
    case messageSupergroupChatCreate::ID:
      return messageSupergroupChatCreate::fetch(env, p);
    case messageChatChangeTitle::ID:
      return messageChatChangeTitle::fetch(env, p);
    case messageChatChangePhoto::ID:
      return messageChatChangePhoto::fetch(env, p);
    case messageChatDeletePhoto::ID:
      return messageChatDeletePhoto::fetch(env, p);
    case messageChatOwnerLeft::ID:
      return messageChatOwnerLeft::fetch(env, p);
    case messageChatOwnerChanged::ID:
      return messageChatOwnerChanged::fetch(env, p);
    case messageChatHasProtectedContentToggled::ID:
      return messageChatHasProtectedContentToggled::fetch(env, p);
    case messageChatHasProtectedContentDisableRequested::ID:
      return messageChatHasProtectedContentDisableRequested::fetch(env, p);
    case messageChatAddMembers::ID:
      return messageChatAddMembers::fetch(env, p);
    case messageChatJoinByLink::ID:
      return messageChatJoinByLink::fetch(env, p);
    case messageChatJoinByRequest::ID:
      return messageChatJoinByRequest::fetch(env, p);
    case messageChatDeleteMember::ID:
      return messageChatDeleteMember::fetch(env, p);
    case messageChatUpgradeTo::ID:
      return messageChatUpgradeTo::fetch(env, p);
    case messageChatUpgradeFrom::ID:
      return messageChatUpgradeFrom::fetch(env, p);
    case messagePinMessage::ID:
      return messagePinMessage::fetch(env, p);
    case messageScreenshotTaken::ID:
      return messageScreenshotTaken::fetch(env, p);
    case messageChatSetBackground::ID:
      return messageChatSetBackground::fetch(env, p);
    case messageChatSetTheme::ID:
      return messageChatSetTheme::fetch(env, p);
    case messageChatSetMessageAutoDeleteTime::ID:
      return messageChatSetMessageAutoDeleteTime::fetch(env, p);
    case messageChatBoost::ID:
      return messageChatBoost::fetch(env, p);
    case messageForumTopicCreated::ID:
      return messageForumTopicCreated::fetch(env, p);
    case messageForumTopicEdited::ID:
      return messageForumTopicEdited::fetch(env, p);
    case messageForumTopicIsClosedToggled::ID:
      return messageForumTopicIsClosedToggled::fetch(env, p);
    case messageForumTopicIsHiddenToggled::ID:
      return messageForumTopicIsHiddenToggled::fetch(env, p);
    case messageSuggestProfilePhoto::ID:
      return messageSuggestProfilePhoto::fetch(env, p);
    case messageSuggestBirthdate::ID:
      return messageSuggestBirthdate::fetch(env, p);
    case messageCustomServiceAction::ID:
      return messageCustomServiceAction::fetch(env, p);
    case messageGameScore::ID:
      return messageGameScore::fetch(env, p);
    case messageManagedBotCreated::ID:
      return messageManagedBotCreated::fetch(env, p);
    case messagePaymentSuccessful::ID:
      return messagePaymentSuccessful::fetch(env, p);
    case messagePaymentSuccessfulBot::ID:
      return messagePaymentSuccessfulBot::fetch(env, p);
    case messagePaymentRefunded::ID:
      return messagePaymentRefunded::fetch(env, p);
    case messageGiftedPremium::ID:
      return messageGiftedPremium::fetch(env, p);
    case messagePremiumGiftCode::ID:
      return messagePremiumGiftCode::fetch(env, p);
    case messageGiveawayCreated::ID:
      return messageGiveawayCreated::fetch(env, p);
    case messageGiveaway::ID:
      return messageGiveaway::fetch(env, p);
    case messageGiveawayCompleted::ID:
      return messageGiveawayCompleted::fetch(env, p);
    case messageGiveawayWinners::ID:
      return messageGiveawayWinners::fetch(env, p);
    case messageGiftedStars::ID:
      return messageGiftedStars::fetch(env, p);
    case messageGiftedTon::ID:
      return messageGiftedTon::fetch(env, p);
    case messageGiveawayPrizeStars::ID:
      return messageGiveawayPrizeStars::fetch(env, p);
    case messageGift::ID:
      return messageGift::fetch(env, p);
    case messageUpgradedGift::ID:
      return messageUpgradedGift::fetch(env, p);
    case messageRefundedUpgradedGift::ID:
      return messageRefundedUpgradedGift::fetch(env, p);
    case messageUpgradedGiftPurchaseOffer::ID:
      return messageUpgradedGiftPurchaseOffer::fetch(env, p);
    case messageUpgradedGiftPurchaseOfferRejected::ID:
      return messageUpgradedGiftPurchaseOfferRejected::fetch(env, p);
    case messagePaidMessagesRefunded::ID:
      return messagePaidMessagesRefunded::fetch(env, p);
    case messagePaidMessagePriceChanged::ID:
      return messagePaidMessagePriceChanged::fetch(env, p);
    case messageDirectMessagePriceChanged::ID:
      return messageDirectMessagePriceChanged::fetch(env, p);
    case messageChecklistTasksDone::ID:
      return messageChecklistTasksDone::fetch(env, p);
    case messageChecklistTasksAdded::ID:
      return messageChecklistTasksAdded::fetch(env, p);
    case messageSuggestedPostApprovalFailed::ID:
      return messageSuggestedPostApprovalFailed::fetch(env, p);
    case messageSuggestedPostApproved::ID:
      return messageSuggestedPostApproved::fetch(env, p);
    case messageSuggestedPostDeclined::ID:
      return messageSuggestedPostDeclined::fetch(env, p);
    case messageSuggestedPostPaid::ID:
      return messageSuggestedPostPaid::fetch(env, p);
    case messageSuggestedPostRefunded::ID:
      return messageSuggestedPostRefunded::fetch(env, p);
    case messageContactRegistered::ID:
      return messageContactRegistered::fetch(env, p);
    case messageUsersShared::ID:
      return messageUsersShared::fetch(env, p);
    case messageChatShared::ID:
      return messageChatShared::fetch(env, p);
    case messageBotWriteAccessAllowed::ID:
      return messageBotWriteAccessAllowed::fetch(env, p);
    case messageWebAppDataSent::ID:
      return messageWebAppDataSent::fetch(env, p);
    case messageWebAppDataReceived::ID:
      return messageWebAppDataReceived::fetch(env, p);
    case messagePassportDataSent::ID:
      return messagePassportDataSent::fetch(env, p);
    case messagePassportDataReceived::ID:
      return messagePassportDataReceived::fetch(env, p);
    case messageProximityAlertTriggered::ID:
      return messageProximityAlertTriggered::fetch(env, p);
    case messageUnsupported::ID:
      return messageUnsupported::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass messageText::Class;
jfieldID messageText::text_fieldID;
jfieldID messageText::link_preview_fieldID;
jfieldID messageText::link_preview_options_fieldID;

messageText::messageText()
  : text_()
  , link_preview_()
  , link_preview_options_()
{}

messageText::messageText(object_ptr<formattedText> &&text_, object_ptr<linkPreview> &&link_preview_, object_ptr<linkPreviewOptions> &&link_preview_options_)
  : text_(std::move(text_))
  , link_preview_(std::move(link_preview_))
  , link_preview_options_(std::move(link_preview_options_))
{}

const std::int32_t messageText::ID;

object_ptr<MessageContent> messageText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageText> res = make_object<messageText>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->link_preview_ = jni::fetch_tl_object<linkPreview>(env, jni::fetch_object(env, p, res->link_preview_fieldID));
  res->link_preview_options_ = jni::fetch_tl_object<linkPreviewOptions>(env, jni::fetch_object(env, p, res->link_preview_options_fieldID));
  return std::move(res);
}

void messageText::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  if (link_preview_ != nullptr) { jobject next; link_preview_->store(env, next); if (next) { env->SetObjectField(s, link_preview_fieldID, next); env->DeleteLocalRef(next); } }
  if (link_preview_options_ != nullptr) { jobject next; link_preview_options_->store(env, next); if (next) { env->SetObjectField(s, link_preview_options_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageText");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_object_field("linkPreview", static_cast<const BaseObject *>(link_preview_.get()));
    s.store_object_field("linkPreviewOptions", static_cast<const BaseObject *>(link_preview_options_.get()));
    s.store_class_end();
  }
}

void messageText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageText").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    link_preview_fieldID = jni::get_field_id(env, Class, "linkPreview", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LinkPreview;").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 messageAnimation::Class;
jfieldID messageAnimation::animation_fieldID;
jfieldID messageAnimation::caption_fieldID;
jfieldID messageAnimation::show_caption_above_media_fieldID;
jfieldID messageAnimation::has_spoiler_fieldID;
jfieldID messageAnimation::is_secret_fieldID;

messageAnimation::messageAnimation()
  : animation_()
  , caption_()
  , show_caption_above_media_()
  , has_spoiler_()
  , is_secret_()
{}

messageAnimation::messageAnimation(object_ptr<animation> &&animation_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, bool has_spoiler_, bool is_secret_)
  : animation_(std::move(animation_))
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , has_spoiler_(has_spoiler_)
  , is_secret_(is_secret_)
{}

const std::int32_t messageAnimation::ID;

object_ptr<MessageContent> messageAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageAnimation> res = make_object<messageAnimation>();
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->has_spoiler_ = (env->GetBooleanField(p, res->has_spoiler_fieldID) != 0);
  res->is_secret_ = (env->GetBooleanField(p, res->is_secret_fieldID) != 0);
  return std::move(res);
}

void messageAnimation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  env->SetBooleanField(s, has_spoiler_fieldID, has_spoiler_);
  env->SetBooleanField(s, is_secret_fieldID, is_secret_);
}

void messageAnimation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageAnimation");
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_field("hasSpoiler", has_spoiler_);
    s.store_field("isSecret", is_secret_);
    s.store_class_end();
  }
}

void messageAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageAnimation").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", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    has_spoiler_fieldID = jni::get_field_id(env, Class, "hasSpoiler", "Z");
    is_secret_fieldID = jni::get_field_id(env, Class, "isSecret", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageAudio::Class;
jfieldID messageAudio::audio_fieldID;
jfieldID messageAudio::caption_fieldID;

messageAudio::messageAudio()
  : audio_()
  , caption_()
{}

messageAudio::messageAudio(object_ptr<audio> &&audio_, object_ptr<formattedText> &&caption_)
  : audio_(std::move(audio_))
  , caption_(std::move(caption_))
{}

const std::int32_t messageAudio::ID;

object_ptr<MessageContent> messageAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageAudio> res = make_object<messageAudio>();
  res->audio_ = jni::fetch_tl_object<audio>(env, jni::fetch_object(env, p, res->audio_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void messageAudio::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (audio_ != nullptr) { jobject next; audio_->store(env, next); if (next) { env->SetObjectField(s, audio_fieldID, next); env->DeleteLocalRef(next); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageAudio");
    s.store_object_field("audio", static_cast<const BaseObject *>(audio_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

void messageAudio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageAudio").c_str());
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Audio;").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 messageDocument::Class;
jfieldID messageDocument::document_fieldID;
jfieldID messageDocument::caption_fieldID;

messageDocument::messageDocument()
  : document_()
  , caption_()
{}

messageDocument::messageDocument(object_ptr<document> &&document_, object_ptr<formattedText> &&caption_)
  : document_(std::move(document_))
  , caption_(std::move(caption_))
{}

const std::int32_t messageDocument::ID;

object_ptr<MessageContent> messageDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageDocument> res = make_object<messageDocument>();
  res->document_ = jni::fetch_tl_object<document>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void messageDocument::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (document_ != nullptr) { jobject next; document_->store(env, next); if (next) { env->SetObjectField(s, document_fieldID, next); env->DeleteLocalRef(next); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageDocument");
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

void messageDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageDocument").c_str());
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Document;").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 messagePaidMedia::Class;
jfieldID messagePaidMedia::star_count_fieldID;
jfieldID messagePaidMedia::media_fieldID;
jfieldID messagePaidMedia::caption_fieldID;
jfieldID messagePaidMedia::show_caption_above_media_fieldID;

messagePaidMedia::messagePaidMedia()
  : star_count_()
  , media_()
  , caption_()
  , show_caption_above_media_()
{}

messagePaidMedia::messagePaidMedia(int53 star_count_, array<object_ptr<PaidMedia>> &&media_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_)
  : star_count_(star_count_)
  , media_(std::move(media_))
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
{}

const std::int32_t messagePaidMedia::ID;

object_ptr<MessageContent> messagePaidMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePaidMedia> res = make_object<messagePaidMedia>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->media_ = jni::FetchVector<PaidMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->media_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  return std::move(res);
}

void messagePaidMedia::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, star_count_fieldID, star_count_);
  { auto arr_tmp_ = jni::store_vector(env, media_); if (arr_tmp_) { env->SetObjectField(s, media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
}

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

void messagePaidMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePaidMedia").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaidMedia;").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 messagePhoto::Class;
jfieldID messagePhoto::photo_fieldID;
jfieldID messagePhoto::video_fieldID;
jfieldID messagePhoto::caption_fieldID;
jfieldID messagePhoto::show_caption_above_media_fieldID;
jfieldID messagePhoto::has_spoiler_fieldID;
jfieldID messagePhoto::is_secret_fieldID;

messagePhoto::messagePhoto()
  : photo_()
  , video_()
  , caption_()
  , show_caption_above_media_()
  , has_spoiler_()
  , is_secret_()
{}

messagePhoto::messagePhoto(object_ptr<photo> &&photo_, object_ptr<video> &&video_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, bool has_spoiler_, bool is_secret_)
  : photo_(std::move(photo_))
  , video_(std::move(video_))
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , has_spoiler_(has_spoiler_)
  , is_secret_(is_secret_)
{}

const std::int32_t messagePhoto::ID;

object_ptr<MessageContent> messagePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePhoto> res = make_object<messagePhoto>();
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->has_spoiler_ = (env->GetBooleanField(p, res->has_spoiler_fieldID) != 0);
  res->is_secret_ = (env->GetBooleanField(p, res->is_secret_fieldID) != 0);
  return std::move(res);
}

void messagePhoto::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  env->SetBooleanField(s, has_spoiler_fieldID, has_spoiler_);
  env->SetBooleanField(s, is_secret_fieldID, is_secret_);
}

void messagePhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_field("hasSpoiler", has_spoiler_);
    s.store_field("isSecret", is_secret_);
    s.store_class_end();
  }
}

void messagePhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePhoto").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").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", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    has_spoiler_fieldID = jni::get_field_id(env, Class, "hasSpoiler", "Z");
    is_secret_fieldID = jni::get_field_id(env, Class, "isSecret", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageSticker::Class;
jfieldID messageSticker::sticker_fieldID;
jfieldID messageSticker::is_premium_fieldID;

messageSticker::messageSticker()
  : sticker_()
  , is_premium_()
{}

messageSticker::messageSticker(object_ptr<sticker> &&sticker_, bool is_premium_)
  : sticker_(std::move(sticker_))
  , is_premium_(is_premium_)
{}

const std::int32_t messageSticker::ID;

object_ptr<MessageContent> messageSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSticker> res = make_object<messageSticker>();
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->is_premium_ = (env->GetBooleanField(p, res->is_premium_fieldID) != 0);
  return std::move(res);
}

void messageSticker::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); } }
  env->SetBooleanField(s, is_premium_fieldID, is_premium_);
}

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

void messageSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSticker").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    is_premium_fieldID = jni::get_field_id(env, Class, "isPremium", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageVideo::Class;
jfieldID messageVideo::video_fieldID;
jfieldID messageVideo::alternative_videos_fieldID;
jfieldID messageVideo::storyboards_fieldID;
jfieldID messageVideo::cover_fieldID;
jfieldID messageVideo::start_timestamp_fieldID;
jfieldID messageVideo::caption_fieldID;
jfieldID messageVideo::show_caption_above_media_fieldID;
jfieldID messageVideo::has_spoiler_fieldID;
jfieldID messageVideo::is_secret_fieldID;

messageVideo::messageVideo()
  : video_()
  , alternative_videos_()
  , storyboards_()
  , cover_()
  , start_timestamp_()
  , caption_()
  , show_caption_above_media_()
  , has_spoiler_()
  , is_secret_()
{}

messageVideo::messageVideo(object_ptr<video> &&video_, array<object_ptr<alternativeVideo>> &&alternative_videos_, array<object_ptr<videoStoryboard>> &&storyboards_, object_ptr<photo> &&cover_, int32 start_timestamp_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_, bool has_spoiler_, bool is_secret_)
  : video_(std::move(video_))
  , alternative_videos_(std::move(alternative_videos_))
  , storyboards_(std::move(storyboards_))
  , cover_(std::move(cover_))
  , start_timestamp_(start_timestamp_)
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
  , has_spoiler_(has_spoiler_)
  , is_secret_(is_secret_)
{}

const std::int32_t messageVideo::ID;

object_ptr<MessageContent> messageVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageVideo> res = make_object<messageVideo>();
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->alternative_videos_ = jni::FetchVector<alternativeVideo>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->alternative_videos_fieldID));
  res->storyboards_ = jni::FetchVector<videoStoryboard>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->storyboards_fieldID));
  res->cover_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->cover_fieldID));
  res->start_timestamp_ = env->GetIntField(p, res->start_timestamp_fieldID);
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  res->has_spoiler_ = (env->GetBooleanField(p, res->has_spoiler_fieldID) != 0);
  res->is_secret_ = (env->GetBooleanField(p, res->is_secret_fieldID) != 0);
  return std::move(res);
}

void messageVideo::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); } }
  { auto arr_tmp_ = jni::store_vector(env, alternative_videos_); if (arr_tmp_) { env->SetObjectField(s, alternative_videos_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, storyboards_); if (arr_tmp_) { env->SetObjectField(s, storyboards_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (cover_ != nullptr) { jobject next; cover_->store(env, next); if (next) { env->SetObjectField(s, cover_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, start_timestamp_fieldID, start_timestamp_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, show_caption_above_media_fieldID, show_caption_above_media_);
  env->SetBooleanField(s, has_spoiler_fieldID, has_spoiler_);
  env->SetBooleanField(s, is_secret_fieldID, is_secret_);
}

void messageVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    { s.store_vector_begin("alternativeVideos", alternative_videos_.size()); for (const auto &_value : alternative_videos_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("storyboards", storyboards_.size()); for (const auto &_value : storyboards_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("cover", static_cast<const BaseObject *>(cover_.get()));
    s.store_field("startTimestamp", start_timestamp_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_field("hasSpoiler", has_spoiler_);
    s.store_field("isSecret", is_secret_);
    s.store_class_end();
  }
}

void messageVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    alternative_videos_fieldID = jni::get_field_id(env, Class, "alternativeVideos", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AlternativeVideo;").c_str());
    storyboards_fieldID = jni::get_field_id(env, Class, "storyboards", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$VideoStoryboard;").c_str());
    cover_fieldID = jni::get_field_id(env, Class, "cover", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    start_timestamp_fieldID = jni::get_field_id(env, Class, "startTimestamp", "I");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    show_caption_above_media_fieldID = jni::get_field_id(env, Class, "showCaptionAboveMedia", "Z");
    has_spoiler_fieldID = jni::get_field_id(env, Class, "hasSpoiler", "Z");
    is_secret_fieldID = jni::get_field_id(env, Class, "isSecret", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageVideoNote::Class;
jfieldID messageVideoNote::video_note_fieldID;
jfieldID messageVideoNote::is_viewed_fieldID;
jfieldID messageVideoNote::is_secret_fieldID;

messageVideoNote::messageVideoNote()
  : video_note_()
  , is_viewed_()
  , is_secret_()
{}

messageVideoNote::messageVideoNote(object_ptr<videoNote> &&video_note_, bool is_viewed_, bool is_secret_)
  : video_note_(std::move(video_note_))
  , is_viewed_(is_viewed_)
  , is_secret_(is_secret_)
{}

const std::int32_t messageVideoNote::ID;

object_ptr<MessageContent> messageVideoNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageVideoNote> res = make_object<messageVideoNote>();
  res->video_note_ = jni::fetch_tl_object<videoNote>(env, jni::fetch_object(env, p, res->video_note_fieldID));
  res->is_viewed_ = (env->GetBooleanField(p, res->is_viewed_fieldID) != 0);
  res->is_secret_ = (env->GetBooleanField(p, res->is_secret_fieldID) != 0);
  return std::move(res);
}

void messageVideoNote::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_viewed_fieldID, is_viewed_);
  env->SetBooleanField(s, is_secret_fieldID, is_secret_);
}

void messageVideoNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageVideoNote");
    s.store_object_field("videoNote", static_cast<const BaseObject *>(video_note_.get()));
    s.store_field("isViewed", is_viewed_);
    s.store_field("isSecret", is_secret_);
    s.store_class_end();
  }
}

void messageVideoNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageVideoNote").c_str());
    video_note_fieldID = jni::get_field_id(env, Class, "videoNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VideoNote;").c_str());
    is_viewed_fieldID = jni::get_field_id(env, Class, "isViewed", "Z");
    is_secret_fieldID = jni::get_field_id(env, Class, "isSecret", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageVoiceNote::Class;
jfieldID messageVoiceNote::voice_note_fieldID;
jfieldID messageVoiceNote::caption_fieldID;
jfieldID messageVoiceNote::is_listened_fieldID;

messageVoiceNote::messageVoiceNote()
  : voice_note_()
  , caption_()
  , is_listened_()
{}

messageVoiceNote::messageVoiceNote(object_ptr<voiceNote> &&voice_note_, object_ptr<formattedText> &&caption_, bool is_listened_)
  : voice_note_(std::move(voice_note_))
  , caption_(std::move(caption_))
  , is_listened_(is_listened_)
{}

const std::int32_t messageVoiceNote::ID;

object_ptr<MessageContent> messageVoiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageVoiceNote> res = make_object<messageVoiceNote>();
  res->voice_note_ = jni::fetch_tl_object<voiceNote>(env, jni::fetch_object(env, p, res->voice_note_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->is_listened_ = (env->GetBooleanField(p, res->is_listened_fieldID) != 0);
  return std::move(res);
}

void messageVoiceNote::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); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_listened_fieldID, is_listened_);
}

void messageVoiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageVoiceNote");
    s.store_object_field("voiceNote", static_cast<const BaseObject *>(voice_note_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("isListened", is_listened_);
    s.store_class_end();
  }
}

void messageVoiceNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageVoiceNote").c_str());
    voice_note_fieldID = jni::get_field_id(env, Class, "voiceNote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VoiceNote;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    is_listened_fieldID = jni::get_field_id(env, Class, "isListened", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageExpiredPhoto::Class;

messageExpiredPhoto::messageExpiredPhoto() {
}

const std::int32_t messageExpiredPhoto::ID;

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

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

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

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

jclass messageExpiredVideo::Class;

messageExpiredVideo::messageExpiredVideo() {
}

const std::int32_t messageExpiredVideo::ID;

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

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

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

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

jclass messageExpiredVideoNote::Class;

messageExpiredVideoNote::messageExpiredVideoNote() {
}

const std::int32_t messageExpiredVideoNote::ID;

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

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

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

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

jclass messageExpiredVoiceNote::Class;

messageExpiredVoiceNote::messageExpiredVoiceNote() {
}

const std::int32_t messageExpiredVoiceNote::ID;

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

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

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

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

jclass messageLocation::Class;
jfieldID messageLocation::location_fieldID;
jfieldID messageLocation::live_period_fieldID;
jfieldID messageLocation::expires_in_fieldID;
jfieldID messageLocation::heading_fieldID;
jfieldID messageLocation::proximity_alert_radius_fieldID;

messageLocation::messageLocation()
  : location_()
  , live_period_()
  , expires_in_()
  , heading_()
  , proximity_alert_radius_()
{}

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

const std::int32_t messageLocation::ID;

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

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

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

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

jclass messageVenue::Class;
jfieldID messageVenue::venue_fieldID;

messageVenue::messageVenue()
  : venue_()
{}

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

const std::int32_t messageVenue::ID;

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

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

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

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

jclass messageContact::Class;
jfieldID messageContact::contact_fieldID;

messageContact::messageContact()
  : contact_()
{}

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

const std::int32_t messageContact::ID;

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

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

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

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

jclass messageAnimatedEmoji::Class;
jfieldID messageAnimatedEmoji::animated_emoji_fieldID;
jfieldID messageAnimatedEmoji::emoji_fieldID;

messageAnimatedEmoji::messageAnimatedEmoji()
  : animated_emoji_()
  , emoji_()
{}

messageAnimatedEmoji::messageAnimatedEmoji(object_ptr<animatedEmoji> &&animated_emoji_, string const &emoji_)
  : animated_emoji_(std::move(animated_emoji_))
  , emoji_(emoji_)
{}

const std::int32_t messageAnimatedEmoji::ID;

object_ptr<MessageContent> messageAnimatedEmoji::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageAnimatedEmoji> res = make_object<messageAnimatedEmoji>();
  res->animated_emoji_ = jni::fetch_tl_object<animatedEmoji>(env, jni::fetch_object(env, p, res->animated_emoji_fieldID));
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  return std::move(res);
}

void messageAnimatedEmoji::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (animated_emoji_ != nullptr) { jobject next; animated_emoji_->store(env, next); if (next) { env->SetObjectField(s, animated_emoji_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messageAnimatedEmoji::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageAnimatedEmoji");
    s.store_object_field("animatedEmoji", static_cast<const BaseObject *>(animated_emoji_.get()));
    s.store_field("emoji", emoji_);
    s.store_class_end();
  }
}

void messageAnimatedEmoji::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageAnimatedEmoji").c_str());
    animated_emoji_fieldID = jni::get_field_id(env, Class, "animatedEmoji", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AnimatedEmoji;").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageDice::Class;
jfieldID messageDice::initial_state_fieldID;
jfieldID messageDice::final_state_fieldID;
jfieldID messageDice::emoji_fieldID;
jfieldID messageDice::value_fieldID;
jfieldID messageDice::success_animation_frame_number_fieldID;

messageDice::messageDice()
  : initial_state_()
  , final_state_()
  , emoji_()
  , value_()
  , success_animation_frame_number_()
{}

messageDice::messageDice(object_ptr<DiceStickers> &&initial_state_, object_ptr<DiceStickers> &&final_state_, string const &emoji_, int32 value_, int32 success_animation_frame_number_)
  : initial_state_(std::move(initial_state_))
  , final_state_(std::move(final_state_))
  , emoji_(emoji_)
  , value_(value_)
  , success_animation_frame_number_(success_animation_frame_number_)
{}

const std::int32_t messageDice::ID;

object_ptr<MessageContent> messageDice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageDice> res = make_object<messageDice>();
  res->initial_state_ = jni::fetch_tl_object<DiceStickers>(env, jni::fetch_object(env, p, res->initial_state_fieldID));
  res->final_state_ = jni::fetch_tl_object<DiceStickers>(env, jni::fetch_object(env, p, res->final_state_fieldID));
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->value_ = env->GetIntField(p, res->value_fieldID);
  res->success_animation_frame_number_ = env->GetIntField(p, res->success_animation_frame_number_fieldID);
  return std::move(res);
}

void messageDice::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (initial_state_ != nullptr) { jobject next; initial_state_->store(env, next); if (next) { env->SetObjectField(s, initial_state_fieldID, next); env->DeleteLocalRef(next); } }
  if (final_state_ != nullptr) { jobject next; final_state_->store(env, next); if (next) { env->SetObjectField(s, final_state_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, value_fieldID, value_);
  env->SetIntField(s, success_animation_frame_number_fieldID, success_animation_frame_number_);
}

void messageDice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageDice");
    s.store_object_field("initialState", static_cast<const BaseObject *>(initial_state_.get()));
    s.store_object_field("finalState", static_cast<const BaseObject *>(final_state_.get()));
    s.store_field("emoji", emoji_);
    s.store_field("value", value_);
    s.store_field("successAnimationFrameNumber", success_animation_frame_number_);
    s.store_class_end();
  }
}

void messageDice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageDice").c_str());
    initial_state_fieldID = jni::get_field_id(env, Class, "initialState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DiceStickers;").c_str());
    final_state_fieldID = jni::get_field_id(env, Class, "finalState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DiceStickers;").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    value_fieldID = jni::get_field_id(env, Class, "value", "I");
    success_animation_frame_number_fieldID = jni::get_field_id(env, Class, "successAnimationFrameNumber", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageGame::Class;
jfieldID messageGame::game_fieldID;

messageGame::messageGame()
  : game_()
{}

messageGame::messageGame(object_ptr<game> &&game_)
  : game_(std::move(game_))
{}

const std::int32_t messageGame::ID;

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

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

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

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

jclass messagePoll::Class;
jfieldID messagePoll::poll_fieldID;
jfieldID messagePoll::description_fieldID;
jfieldID messagePoll::media_fieldID;
jfieldID messagePoll::can_add_option_fieldID;

messagePoll::messagePoll()
  : poll_()
  , description_()
  , media_()
  , can_add_option_()
{}

messagePoll::messagePoll(object_ptr<poll> &&poll_, object_ptr<formattedText> &&description_, object_ptr<MessageContent> &&media_, bool can_add_option_)
  : poll_(std::move(poll_))
  , description_(std::move(description_))
  , media_(std::move(media_))
  , can_add_option_(can_add_option_)
{}

const std::int32_t messagePoll::ID;

object_ptr<MessageContent> messagePoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePoll> res = make_object<messagePoll>();
  res->poll_ = jni::fetch_tl_object<poll>(env, jni::fetch_object(env, p, res->poll_fieldID));
  res->description_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->description_fieldID));
  res->media_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->media_fieldID));
  res->can_add_option_ = (env->GetBooleanField(p, res->can_add_option_fieldID) != 0);
  return std::move(res);
}

void messagePoll::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (poll_ != nullptr) { jobject next; poll_->store(env, next); if (next) { env->SetObjectField(s, poll_fieldID, next); env->DeleteLocalRef(next); } }
  if (description_ != nullptr) { jobject next; description_->store(env, next); if (next) { env->SetObjectField(s, description_fieldID, next); env->DeleteLocalRef(next); } }
  if (media_ != nullptr) { jobject next; media_->store(env, next); if (next) { env->SetObjectField(s, media_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_add_option_fieldID, can_add_option_);
}

void messagePoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePoll");
    s.store_object_field("poll", static_cast<const BaseObject *>(poll_.get()));
    s.store_object_field("description", static_cast<const BaseObject *>(description_.get()));
    s.store_object_field("media", static_cast<const BaseObject *>(media_.get()));
    s.store_field("canAddOption", can_add_option_);
    s.store_class_end();
  }
}

void messagePoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePoll").c_str());
    poll_fieldID = jni::get_field_id(env, Class, "poll", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Poll;").c_str());
    description_fieldID = jni::get_field_id(env, Class, "description", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    can_add_option_fieldID = jni::get_field_id(env, Class, "canAddOption", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageStakeDice::Class;
jfieldID messageStakeDice::initial_state_fieldID;
jfieldID messageStakeDice::final_state_fieldID;
jfieldID messageStakeDice::value_fieldID;
jfieldID messageStakeDice::stake_toncoin_amount_fieldID;
jfieldID messageStakeDice::prize_toncoin_amount_fieldID;

messageStakeDice::messageStakeDice()
  : initial_state_()
  , final_state_()
  , value_()
  , stake_toncoin_amount_()
  , prize_toncoin_amount_()
{}

messageStakeDice::messageStakeDice(object_ptr<DiceStickers> &&initial_state_, object_ptr<DiceStickers> &&final_state_, int32 value_, int53 stake_toncoin_amount_, int53 prize_toncoin_amount_)
  : initial_state_(std::move(initial_state_))
  , final_state_(std::move(final_state_))
  , value_(value_)
  , stake_toncoin_amount_(stake_toncoin_amount_)
  , prize_toncoin_amount_(prize_toncoin_amount_)
{}

const std::int32_t messageStakeDice::ID;

object_ptr<MessageContent> messageStakeDice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageStakeDice> res = make_object<messageStakeDice>();
  res->initial_state_ = jni::fetch_tl_object<DiceStickers>(env, jni::fetch_object(env, p, res->initial_state_fieldID));
  res->final_state_ = jni::fetch_tl_object<DiceStickers>(env, jni::fetch_object(env, p, res->final_state_fieldID));
  res->value_ = env->GetIntField(p, res->value_fieldID);
  res->stake_toncoin_amount_ = env->GetLongField(p, res->stake_toncoin_amount_fieldID);
  res->prize_toncoin_amount_ = env->GetLongField(p, res->prize_toncoin_amount_fieldID);
  return std::move(res);
}

void messageStakeDice::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (initial_state_ != nullptr) { jobject next; initial_state_->store(env, next); if (next) { env->SetObjectField(s, initial_state_fieldID, next); env->DeleteLocalRef(next); } }
  if (final_state_ != nullptr) { jobject next; final_state_->store(env, next); if (next) { env->SetObjectField(s, final_state_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, value_fieldID, value_);
  env->SetLongField(s, stake_toncoin_amount_fieldID, stake_toncoin_amount_);
  env->SetLongField(s, prize_toncoin_amount_fieldID, prize_toncoin_amount_);
}

void messageStakeDice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageStakeDice");
    s.store_object_field("initialState", static_cast<const BaseObject *>(initial_state_.get()));
    s.store_object_field("finalState", static_cast<const BaseObject *>(final_state_.get()));
    s.store_field("value", value_);
    s.store_field("stakeToncoinAmount", stake_toncoin_amount_);
    s.store_field("prizeToncoinAmount", prize_toncoin_amount_);
    s.store_class_end();
  }
}

void messageStakeDice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageStakeDice").c_str());
    initial_state_fieldID = jni::get_field_id(env, Class, "initialState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DiceStickers;").c_str());
    final_state_fieldID = jni::get_field_id(env, Class, "finalState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DiceStickers;").c_str());
    value_fieldID = jni::get_field_id(env, Class, "value", "I");
    stake_toncoin_amount_fieldID = jni::get_field_id(env, Class, "stakeToncoinAmount", "J");
    prize_toncoin_amount_fieldID = jni::get_field_id(env, Class, "prizeToncoinAmount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass messageStory::Class;
jfieldID messageStory::story_poster_chat_id_fieldID;
jfieldID messageStory::story_id_fieldID;
jfieldID messageStory::via_mention_fieldID;

messageStory::messageStory()
  : story_poster_chat_id_()
  , story_id_()
  , via_mention_()
{}

messageStory::messageStory(int53 story_poster_chat_id_, int32 story_id_, bool via_mention_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , via_mention_(via_mention_)
{}

const std::int32_t messageStory::ID;

object_ptr<MessageContent> messageStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageStory> res = make_object<messageStory>();
  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->via_mention_ = (env->GetBooleanField(p, res->via_mention_fieldID) != 0);
  return std::move(res);
}

void messageStory::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, story_poster_chat_id_fieldID, story_poster_chat_id_);
  env->SetIntField(s, story_id_fieldID, story_id_);
  env->SetBooleanField(s, via_mention_fieldID, via_mention_);
}

void messageStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_field("viaMention", via_mention_);
    s.store_class_end();
  }
}

void messageStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageStory").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");
    via_mention_fieldID = jni::get_field_id(env, Class, "viaMention", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageChecklist::Class;
jfieldID messageChecklist::list_fieldID;

messageChecklist::messageChecklist()
  : list_()
{}

messageChecklist::messageChecklist(object_ptr<checklist> &&list_)
  : list_(std::move(list_))
{}

const std::int32_t messageChecklist::ID;

object_ptr<MessageContent> messageChecklist::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChecklist> res = make_object<messageChecklist>();
  res->list_ = jni::fetch_tl_object<checklist>(env, jni::fetch_object(env, p, res->list_fieldID));
  return std::move(res);
}

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

void messageChecklist::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChecklist");
    s.store_object_field("list", static_cast<const BaseObject *>(list_.get()));
    s.store_class_end();
  }
}

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

jclass messageInvoice::Class;
jfieldID messageInvoice::product_info_fieldID;
jfieldID messageInvoice::currency_fieldID;
jfieldID messageInvoice::total_amount_fieldID;
jfieldID messageInvoice::start_parameter_fieldID;
jfieldID messageInvoice::is_test_fieldID;
jfieldID messageInvoice::need_shipping_address_fieldID;
jfieldID messageInvoice::receipt_message_id_fieldID;
jfieldID messageInvoice::paid_media_fieldID;
jfieldID messageInvoice::paid_media_caption_fieldID;

messageInvoice::messageInvoice()
  : product_info_()
  , currency_()
  , total_amount_()
  , start_parameter_()
  , is_test_()
  , need_shipping_address_()
  , receipt_message_id_()
  , paid_media_()
  , paid_media_caption_()
{}

messageInvoice::messageInvoice(object_ptr<productInfo> &&product_info_, string const &currency_, int53 total_amount_, string const &start_parameter_, bool is_test_, bool need_shipping_address_, int53 receipt_message_id_, object_ptr<PaidMedia> &&paid_media_, object_ptr<formattedText> &&paid_media_caption_)
  : product_info_(std::move(product_info_))
  , currency_(currency_)
  , total_amount_(total_amount_)
  , start_parameter_(start_parameter_)
  , is_test_(is_test_)
  , need_shipping_address_(need_shipping_address_)
  , receipt_message_id_(receipt_message_id_)
  , paid_media_(std::move(paid_media_))
  , paid_media_caption_(std::move(paid_media_caption_))
{}

const std::int32_t messageInvoice::ID;

object_ptr<MessageContent> messageInvoice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageInvoice> res = make_object<messageInvoice>();
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->start_parameter_ = jni::fetch_string(env, p, res->start_parameter_fieldID);
  res->is_test_ = (env->GetBooleanField(p, res->is_test_fieldID) != 0);
  res->need_shipping_address_ = (env->GetBooleanField(p, res->need_shipping_address_fieldID) != 0);
  res->receipt_message_id_ = env->GetLongField(p, res->receipt_message_id_fieldID);
  res->paid_media_ = jni::fetch_tl_object<PaidMedia>(env, jni::fetch_object(env, p, res->paid_media_fieldID));
  res->paid_media_caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->paid_media_caption_fieldID));
  return std::move(res);
}

void messageInvoice::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, total_amount_fieldID, total_amount_);
  { jstring nextString = jni::to_jstring(env, start_parameter_); if (nextString) { env->SetObjectField(s, start_parameter_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_test_fieldID, is_test_);
  env->SetBooleanField(s, need_shipping_address_fieldID, need_shipping_address_);
  env->SetLongField(s, receipt_message_id_fieldID, receipt_message_id_);
  if (paid_media_ != nullptr) { jobject next; paid_media_->store(env, next); if (next) { env->SetObjectField(s, paid_media_fieldID, next); env->DeleteLocalRef(next); } }
  if (paid_media_caption_ != nullptr) { jobject next; paid_media_caption_->store(env, next); if (next) { env->SetObjectField(s, paid_media_caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageInvoice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageInvoice");
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_field("currency", currency_);
    s.store_field("totalAmount", total_amount_);
    s.store_field("startParameter", start_parameter_);
    s.store_field("isTest", is_test_);
    s.store_field("needShippingAddress", need_shipping_address_);
    s.store_field("receiptMessageId", receipt_message_id_);
    s.store_object_field("paidMedia", static_cast<const BaseObject *>(paid_media_.get()));
    s.store_object_field("paidMediaCaption", static_cast<const BaseObject *>(paid_media_caption_.get()));
    s.store_class_end();
  }
}

void messageInvoice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageInvoice").c_str());
    product_info_fieldID = jni::get_field_id(env, Class, "productInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProductInfo;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    start_parameter_fieldID = jni::get_field_id(env, Class, "startParameter", "Ljava/lang/String;");
    is_test_fieldID = jni::get_field_id(env, Class, "isTest", "Z");
    need_shipping_address_fieldID = jni::get_field_id(env, Class, "needShippingAddress", "Z");
    receipt_message_id_fieldID = jni::get_field_id(env, Class, "receiptMessageId", "J");
    paid_media_fieldID = jni::get_field_id(env, Class, "paidMedia", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PaidMedia;").c_str());
    paid_media_caption_fieldID = jni::get_field_id(env, Class, "paidMediaCaption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageCall::Class;
jfieldID messageCall::unique_id_fieldID;
jfieldID messageCall::is_video_fieldID;
jfieldID messageCall::discard_reason_fieldID;
jfieldID messageCall::duration_fieldID;

messageCall::messageCall()
  : unique_id_()
  , is_video_()
  , discard_reason_()
  , duration_()
{}

messageCall::messageCall(int64 unique_id_, bool is_video_, object_ptr<CallDiscardReason> &&discard_reason_, int32 duration_)
  : unique_id_(unique_id_)
  , is_video_(is_video_)
  , discard_reason_(std::move(discard_reason_))
  , duration_(duration_)
{}

const std::int32_t messageCall::ID;

object_ptr<MessageContent> messageCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageCall> res = make_object<messageCall>();
  res->unique_id_ = env->GetLongField(p, res->unique_id_fieldID);
  res->is_video_ = (env->GetBooleanField(p, res->is_video_fieldID) != 0);
  res->discard_reason_ = jni::fetch_tl_object<CallDiscardReason>(env, jni::fetch_object(env, p, res->discard_reason_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  return std::move(res);
}

void messageCall::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, unique_id_fieldID, unique_id_);
  env->SetBooleanField(s, is_video_fieldID, is_video_);
  if (discard_reason_ != nullptr) { jobject next; discard_reason_->store(env, next); if (next) { env->SetObjectField(s, discard_reason_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, duration_fieldID, duration_);
}

void messageCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageCall");
    s.store_field("uniqueId", unique_id_);
    s.store_field("isVideo", is_video_);
    s.store_object_field("discardReason", static_cast<const BaseObject *>(discard_reason_.get()));
    s.store_field("duration", duration_);
    s.store_class_end();
  }
}

void messageCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageCall").c_str());
    unique_id_fieldID = jni::get_field_id(env, Class, "uniqueId", "J");
    is_video_fieldID = jni::get_field_id(env, Class, "isVideo", "Z");
    discard_reason_fieldID = jni::get_field_id(env, Class, "discardReason", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallDiscardReason;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageGroupCall::Class;
jfieldID messageGroupCall::unique_id_fieldID;
jfieldID messageGroupCall::is_active_fieldID;
jfieldID messageGroupCall::was_missed_fieldID;
jfieldID messageGroupCall::is_video_fieldID;
jfieldID messageGroupCall::duration_fieldID;
jfieldID messageGroupCall::other_participant_ids_fieldID;

messageGroupCall::messageGroupCall()
  : unique_id_()
  , is_active_()
  , was_missed_()
  , is_video_()
  , duration_()
  , other_participant_ids_()
{}

messageGroupCall::messageGroupCall(int64 unique_id_, bool is_active_, bool was_missed_, bool is_video_, int32 duration_, array<object_ptr<MessageSender>> &&other_participant_ids_)
  : unique_id_(unique_id_)
  , is_active_(is_active_)
  , was_missed_(was_missed_)
  , is_video_(is_video_)
  , duration_(duration_)
  , other_participant_ids_(std::move(other_participant_ids_))
{}

const std::int32_t messageGroupCall::ID;

object_ptr<MessageContent> messageGroupCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGroupCall> res = make_object<messageGroupCall>();
  res->unique_id_ = env->GetLongField(p, res->unique_id_fieldID);
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  res->was_missed_ = (env->GetBooleanField(p, res->was_missed_fieldID) != 0);
  res->is_video_ = (env->GetBooleanField(p, res->is_video_fieldID) != 0);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->other_participant_ids_ = jni::FetchVector<MessageSender>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->other_participant_ids_fieldID));
  return std::move(res);
}

void messageGroupCall::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, unique_id_fieldID, unique_id_);
  env->SetBooleanField(s, is_active_fieldID, is_active_);
  env->SetBooleanField(s, was_missed_fieldID, was_missed_);
  env->SetBooleanField(s, is_video_fieldID, is_video_);
  env->SetIntField(s, duration_fieldID, duration_);
  { auto arr_tmp_ = jni::store_vector(env, other_participant_ids_); if (arr_tmp_) { env->SetObjectField(s, other_participant_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageGroupCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGroupCall");
    s.store_field("uniqueId", unique_id_);
    s.store_field("isActive", is_active_);
    s.store_field("wasMissed", was_missed_);
    s.store_field("isVideo", is_video_);
    s.store_field("duration", duration_);
    { s.store_vector_begin("otherParticipantIds", other_participant_ids_.size()); for (const auto &_value : other_participant_ids_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void messageGroupCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGroupCall").c_str());
    unique_id_fieldID = jni::get_field_id(env, Class, "uniqueId", "J");
    is_active_fieldID = jni::get_field_id(env, Class, "isActive", "Z");
    was_missed_fieldID = jni::get_field_id(env, Class, "wasMissed", "Z");
    is_video_fieldID = jni::get_field_id(env, Class, "isVideo", "Z");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    other_participant_ids_fieldID = jni::get_field_id(env, Class, "otherParticipantIds", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageVideoChatScheduled::Class;
jfieldID messageVideoChatScheduled::group_call_id_fieldID;
jfieldID messageVideoChatScheduled::start_date_fieldID;

messageVideoChatScheduled::messageVideoChatScheduled()
  : group_call_id_()
  , start_date_()
{}

messageVideoChatScheduled::messageVideoChatScheduled(int32 group_call_id_, int32 start_date_)
  : group_call_id_(group_call_id_)
  , start_date_(start_date_)
{}

const std::int32_t messageVideoChatScheduled::ID;

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

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

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

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

jclass messageVideoChatStarted::Class;
jfieldID messageVideoChatStarted::group_call_id_fieldID;

messageVideoChatStarted::messageVideoChatStarted()
  : group_call_id_()
{}

messageVideoChatStarted::messageVideoChatStarted(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t messageVideoChatStarted::ID;

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

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

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

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

jclass messageVideoChatEnded::Class;
jfieldID messageVideoChatEnded::duration_fieldID;

messageVideoChatEnded::messageVideoChatEnded()
  : duration_()
{}

messageVideoChatEnded::messageVideoChatEnded(int32 duration_)
  : duration_(duration_)
{}

const std::int32_t messageVideoChatEnded::ID;

object_ptr<MessageContent> messageVideoChatEnded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageVideoChatEnded> res = make_object<messageVideoChatEnded>();
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  return std::move(res);
}

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

void messageVideoChatEnded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageVideoChatEnded");
    s.store_field("duration", duration_);
    s.store_class_end();
  }
}

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

jclass messageInviteVideoChatParticipants::Class;
jfieldID messageInviteVideoChatParticipants::group_call_id_fieldID;
jfieldID messageInviteVideoChatParticipants::user_ids_fieldID;

messageInviteVideoChatParticipants::messageInviteVideoChatParticipants()
  : group_call_id_()
  , user_ids_()
{}

messageInviteVideoChatParticipants::messageInviteVideoChatParticipants(int32 group_call_id_, array<int53> &&user_ids_)
  : group_call_id_(group_call_id_)
  , user_ids_(std::move(user_ids_))
{}

const std::int32_t messageInviteVideoChatParticipants::ID;

object_ptr<MessageContent> messageInviteVideoChatParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageInviteVideoChatParticipants> res = make_object<messageInviteVideoChatParticipants>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return std::move(res);
}

void messageInviteVideoChatParticipants::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, group_call_id_fieldID, group_call_id_);
  { auto arr_tmp_ = jni::store_vector(env, user_ids_); if (arr_tmp_) { env->SetObjectField(s, user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageInviteVideoChatParticipants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageInviteVideoChatParticipants");
    s.store_field("groupCallId", group_call_id_);
    { s.store_vector_begin("userIds", user_ids_.size()); for (const auto &_value : user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass messagePollOptionAdded::Class;
jfieldID messagePollOptionAdded::poll_message_id_fieldID;
jfieldID messagePollOptionAdded::option_id_fieldID;
jfieldID messagePollOptionAdded::text_fieldID;

messagePollOptionAdded::messagePollOptionAdded()
  : poll_message_id_()
  , option_id_()
  , text_()
{}

messagePollOptionAdded::messagePollOptionAdded(int53 poll_message_id_, string const &option_id_, object_ptr<formattedText> &&text_)
  : poll_message_id_(poll_message_id_)
  , option_id_(option_id_)
  , text_(std::move(text_))
{}

const std::int32_t messagePollOptionAdded::ID;

object_ptr<MessageContent> messagePollOptionAdded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePollOptionAdded> res = make_object<messagePollOptionAdded>();
  res->poll_message_id_ = env->GetLongField(p, res->poll_message_id_fieldID);
  res->option_id_ = jni::fetch_string(env, p, res->option_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void messagePollOptionAdded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, poll_message_id_fieldID, poll_message_id_);
  { jstring nextString = jni::to_jstring(env, option_id_); if (nextString) { env->SetObjectField(s, option_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
}

void messagePollOptionAdded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePollOptionAdded");
    s.store_field("pollMessageId", poll_message_id_);
    s.store_field("optionId", option_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void messagePollOptionAdded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePollOptionAdded").c_str());
    poll_message_id_fieldID = jni::get_field_id(env, Class, "pollMessageId", "J");
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "Ljava/lang/String;");
    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 messagePollOptionDeleted::Class;
jfieldID messagePollOptionDeleted::poll_message_id_fieldID;
jfieldID messagePollOptionDeleted::option_id_fieldID;
jfieldID messagePollOptionDeleted::text_fieldID;

messagePollOptionDeleted::messagePollOptionDeleted()
  : poll_message_id_()
  , option_id_()
  , text_()
{}

messagePollOptionDeleted::messagePollOptionDeleted(int53 poll_message_id_, string const &option_id_, object_ptr<formattedText> &&text_)
  : poll_message_id_(poll_message_id_)
  , option_id_(option_id_)
  , text_(std::move(text_))
{}

const std::int32_t messagePollOptionDeleted::ID;

object_ptr<MessageContent> messagePollOptionDeleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePollOptionDeleted> res = make_object<messagePollOptionDeleted>();
  res->poll_message_id_ = env->GetLongField(p, res->poll_message_id_fieldID);
  res->option_id_ = jni::fetch_string(env, p, res->option_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void messagePollOptionDeleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, poll_message_id_fieldID, poll_message_id_);
  { jstring nextString = jni::to_jstring(env, option_id_); if (nextString) { env->SetObjectField(s, option_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
}

void messagePollOptionDeleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePollOptionDeleted");
    s.store_field("pollMessageId", poll_message_id_);
    s.store_field("optionId", option_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void messagePollOptionDeleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePollOptionDeleted").c_str());
    poll_message_id_fieldID = jni::get_field_id(env, Class, "pollMessageId", "J");
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "Ljava/lang/String;");
    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 messageBasicGroupChatCreate::Class;
jfieldID messageBasicGroupChatCreate::title_fieldID;
jfieldID messageBasicGroupChatCreate::member_user_ids_fieldID;

messageBasicGroupChatCreate::messageBasicGroupChatCreate()
  : title_()
  , member_user_ids_()
{}

messageBasicGroupChatCreate::messageBasicGroupChatCreate(string const &title_, array<int53> &&member_user_ids_)
  : title_(title_)
  , member_user_ids_(std::move(member_user_ids_))
{}

const std::int32_t messageBasicGroupChatCreate::ID;

object_ptr<MessageContent> messageBasicGroupChatCreate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageBasicGroupChatCreate> res = make_object<messageBasicGroupChatCreate>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->member_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->member_user_ids_fieldID));
  return std::move(res);
}

void messageBasicGroupChatCreate::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, member_user_ids_); if (arr_tmp_) { env->SetObjectField(s, member_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageBasicGroupChatCreate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageBasicGroupChatCreate");
    s.store_field("title", title_);
    { 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_class_end();
  }
}

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

jclass messageSupergroupChatCreate::Class;
jfieldID messageSupergroupChatCreate::title_fieldID;

messageSupergroupChatCreate::messageSupergroupChatCreate()
  : title_()
{}

messageSupergroupChatCreate::messageSupergroupChatCreate(string const &title_)
  : title_(title_)
{}

const std::int32_t messageSupergroupChatCreate::ID;

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

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

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

jclass messageChatChangeTitle::Class;
jfieldID messageChatChangeTitle::title_fieldID;

messageChatChangeTitle::messageChatChangeTitle()
  : title_()
{}

messageChatChangeTitle::messageChatChangeTitle(string const &title_)
  : title_(title_)
{}

const std::int32_t messageChatChangeTitle::ID;

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

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

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

jclass messageChatChangePhoto::Class;
jfieldID messageChatChangePhoto::photo_fieldID;

messageChatChangePhoto::messageChatChangePhoto()
  : photo_()
{}

messageChatChangePhoto::messageChatChangePhoto(object_ptr<chatPhoto> &&photo_)
  : photo_(std::move(photo_))
{}

const std::int32_t messageChatChangePhoto::ID;

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

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

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

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

jclass messageChatDeletePhoto::Class;

messageChatDeletePhoto::messageChatDeletePhoto() {
}

const std::int32_t messageChatDeletePhoto::ID;

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

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

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

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

jclass messageChatOwnerLeft::Class;
jfieldID messageChatOwnerLeft::new_owner_user_id_fieldID;

messageChatOwnerLeft::messageChatOwnerLeft()
  : new_owner_user_id_()
{}

messageChatOwnerLeft::messageChatOwnerLeft(int53 new_owner_user_id_)
  : new_owner_user_id_(new_owner_user_id_)
{}

const std::int32_t messageChatOwnerLeft::ID;

object_ptr<MessageContent> messageChatOwnerLeft::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatOwnerLeft> res = make_object<messageChatOwnerLeft>();
  res->new_owner_user_id_ = env->GetLongField(p, res->new_owner_user_id_fieldID);
  return std::move(res);
}

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

void messageChatOwnerLeft::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatOwnerLeft");
    s.store_field("newOwnerUserId", new_owner_user_id_);
    s.store_class_end();
  }
}

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

jclass messageChatOwnerChanged::Class;
jfieldID messageChatOwnerChanged::new_owner_user_id_fieldID;

messageChatOwnerChanged::messageChatOwnerChanged()
  : new_owner_user_id_()
{}

messageChatOwnerChanged::messageChatOwnerChanged(int53 new_owner_user_id_)
  : new_owner_user_id_(new_owner_user_id_)
{}

const std::int32_t messageChatOwnerChanged::ID;

object_ptr<MessageContent> messageChatOwnerChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatOwnerChanged> res = make_object<messageChatOwnerChanged>();
  res->new_owner_user_id_ = env->GetLongField(p, res->new_owner_user_id_fieldID);
  return std::move(res);
}

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

void messageChatOwnerChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatOwnerChanged");
    s.store_field("newOwnerUserId", new_owner_user_id_);
    s.store_class_end();
  }
}

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

jclass messageChatHasProtectedContentToggled::Class;
jfieldID messageChatHasProtectedContentToggled::request_message_id_fieldID;
jfieldID messageChatHasProtectedContentToggled::old_has_protected_content_fieldID;
jfieldID messageChatHasProtectedContentToggled::new_has_protected_content_fieldID;

messageChatHasProtectedContentToggled::messageChatHasProtectedContentToggled()
  : request_message_id_()
  , old_has_protected_content_()
  , new_has_protected_content_()
{}

messageChatHasProtectedContentToggled::messageChatHasProtectedContentToggled(int53 request_message_id_, bool old_has_protected_content_, bool new_has_protected_content_)
  : request_message_id_(request_message_id_)
  , old_has_protected_content_(old_has_protected_content_)
  , new_has_protected_content_(new_has_protected_content_)
{}

const std::int32_t messageChatHasProtectedContentToggled::ID;

object_ptr<MessageContent> messageChatHasProtectedContentToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatHasProtectedContentToggled> res = make_object<messageChatHasProtectedContentToggled>();
  res->request_message_id_ = env->GetLongField(p, res->request_message_id_fieldID);
  res->old_has_protected_content_ = (env->GetBooleanField(p, res->old_has_protected_content_fieldID) != 0);
  res->new_has_protected_content_ = (env->GetBooleanField(p, res->new_has_protected_content_fieldID) != 0);
  return std::move(res);
}

void messageChatHasProtectedContentToggled::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, request_message_id_fieldID, request_message_id_);
  env->SetBooleanField(s, old_has_protected_content_fieldID, old_has_protected_content_);
  env->SetBooleanField(s, new_has_protected_content_fieldID, new_has_protected_content_);
}

void messageChatHasProtectedContentToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatHasProtectedContentToggled");
    s.store_field("requestMessageId", request_message_id_);
    s.store_field("oldHasProtectedContent", old_has_protected_content_);
    s.store_field("newHasProtectedContent", new_has_protected_content_);
    s.store_class_end();
  }
}

void messageChatHasProtectedContentToggled::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageChatHasProtectedContentToggled").c_str());
    request_message_id_fieldID = jni::get_field_id(env, Class, "requestMessageId", "J");
    old_has_protected_content_fieldID = jni::get_field_id(env, Class, "oldHasProtectedContent", "Z");
    new_has_protected_content_fieldID = jni::get_field_id(env, Class, "newHasProtectedContent", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageChatHasProtectedContentDisableRequested::Class;
jfieldID messageChatHasProtectedContentDisableRequested::is_expired_fieldID;

messageChatHasProtectedContentDisableRequested::messageChatHasProtectedContentDisableRequested()
  : is_expired_()
{}

messageChatHasProtectedContentDisableRequested::messageChatHasProtectedContentDisableRequested(bool is_expired_)
  : is_expired_(is_expired_)
{}

const std::int32_t messageChatHasProtectedContentDisableRequested::ID;

object_ptr<MessageContent> messageChatHasProtectedContentDisableRequested::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatHasProtectedContentDisableRequested> res = make_object<messageChatHasProtectedContentDisableRequested>();
  res->is_expired_ = (env->GetBooleanField(p, res->is_expired_fieldID) != 0);
  return std::move(res);
}

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

void messageChatHasProtectedContentDisableRequested::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatHasProtectedContentDisableRequested");
    s.store_field("isExpired", is_expired_);
    s.store_class_end();
  }
}

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

jclass messageChatAddMembers::Class;
jfieldID messageChatAddMembers::member_user_ids_fieldID;

messageChatAddMembers::messageChatAddMembers()
  : member_user_ids_()
{}

messageChatAddMembers::messageChatAddMembers(array<int53> &&member_user_ids_)
  : member_user_ids_(std::move(member_user_ids_))
{}

const std::int32_t messageChatAddMembers::ID;

object_ptr<MessageContent> messageChatAddMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatAddMembers> res = make_object<messageChatAddMembers>();
  res->member_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->member_user_ids_fieldID));
  return std::move(res);
}

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

void messageChatAddMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatAddMembers");
    { 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_class_end();
  }
}

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

jclass messageChatJoinByLink::Class;

messageChatJoinByLink::messageChatJoinByLink() {
}

const std::int32_t messageChatJoinByLink::ID;

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

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

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

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

jclass messageChatJoinByRequest::Class;

messageChatJoinByRequest::messageChatJoinByRequest() {
}

const std::int32_t messageChatJoinByRequest::ID;

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

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

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

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

jclass messageChatDeleteMember::Class;
jfieldID messageChatDeleteMember::user_id_fieldID;

messageChatDeleteMember::messageChatDeleteMember()
  : user_id_()
{}

messageChatDeleteMember::messageChatDeleteMember(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t messageChatDeleteMember::ID;

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

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

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

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

jclass messageChatUpgradeTo::Class;
jfieldID messageChatUpgradeTo::supergroup_id_fieldID;

messageChatUpgradeTo::messageChatUpgradeTo()
  : supergroup_id_()
{}

messageChatUpgradeTo::messageChatUpgradeTo(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t messageChatUpgradeTo::ID;

object_ptr<MessageContent> messageChatUpgradeTo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatUpgradeTo> res = make_object<messageChatUpgradeTo>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  return std::move(res);
}

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

void messageChatUpgradeTo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatUpgradeTo");
    s.store_field("supergroupId", supergroup_id_);
    s.store_class_end();
  }
}

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

jclass messageChatUpgradeFrom::Class;
jfieldID messageChatUpgradeFrom::title_fieldID;
jfieldID messageChatUpgradeFrom::basic_group_id_fieldID;

messageChatUpgradeFrom::messageChatUpgradeFrom()
  : title_()
  , basic_group_id_()
{}

messageChatUpgradeFrom::messageChatUpgradeFrom(string const &title_, int53 basic_group_id_)
  : title_(title_)
  , basic_group_id_(basic_group_id_)
{}

const std::int32_t messageChatUpgradeFrom::ID;

object_ptr<MessageContent> messageChatUpgradeFrom::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatUpgradeFrom> res = make_object<messageChatUpgradeFrom>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->basic_group_id_ = env->GetLongField(p, res->basic_group_id_fieldID);
  return std::move(res);
}

void messageChatUpgradeFrom::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->SetLongField(s, basic_group_id_fieldID, basic_group_id_);
}

void messageChatUpgradeFrom::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatUpgradeFrom");
    s.store_field("title", title_);
    s.store_field("basicGroupId", basic_group_id_);
    s.store_class_end();
  }
}

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

jclass messagePinMessage::Class;
jfieldID messagePinMessage::message_id_fieldID;

messagePinMessage::messagePinMessage()
  : message_id_()
{}

messagePinMessage::messagePinMessage(int53 message_id_)
  : message_id_(message_id_)
{}

const std::int32_t messagePinMessage::ID;

object_ptr<MessageContent> messagePinMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePinMessage> res = make_object<messagePinMessage>();
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  return std::move(res);
}

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

void messagePinMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePinMessage");
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

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

jclass messageScreenshotTaken::Class;

messageScreenshotTaken::messageScreenshotTaken() {
}

const std::int32_t messageScreenshotTaken::ID;

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

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

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

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

jclass messageChatSetBackground::Class;
jfieldID messageChatSetBackground::old_background_message_id_fieldID;
jfieldID messageChatSetBackground::background_fieldID;
jfieldID messageChatSetBackground::only_for_self_fieldID;

messageChatSetBackground::messageChatSetBackground()
  : old_background_message_id_()
  , background_()
  , only_for_self_()
{}

messageChatSetBackground::messageChatSetBackground(int53 old_background_message_id_, object_ptr<chatBackground> &&background_, bool only_for_self_)
  : old_background_message_id_(old_background_message_id_)
  , background_(std::move(background_))
  , only_for_self_(only_for_self_)
{}

const std::int32_t messageChatSetBackground::ID;

object_ptr<MessageContent> messageChatSetBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatSetBackground> res = make_object<messageChatSetBackground>();
  res->old_background_message_id_ = env->GetLongField(p, res->old_background_message_id_fieldID);
  res->background_ = jni::fetch_tl_object<chatBackground>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->only_for_self_ = (env->GetBooleanField(p, res->only_for_self_fieldID) != 0);
  return std::move(res);
}

void messageChatSetBackground::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, old_background_message_id_fieldID, old_background_message_id_);
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, only_for_self_fieldID, only_for_self_);
}

void messageChatSetBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatSetBackground");
    s.store_field("oldBackgroundMessageId", old_background_message_id_);
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_field("onlyForSelf", only_for_self_);
    s.store_class_end();
  }
}

void messageChatSetBackground::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageChatSetBackground").c_str());
    old_background_message_id_fieldID = jni::get_field_id(env, Class, "oldBackgroundMessageId", "J");
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBackground;").c_str());
    only_for_self_fieldID = jni::get_field_id(env, Class, "onlyForSelf", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageChatSetTheme::Class;
jfieldID messageChatSetTheme::theme_fieldID;

messageChatSetTheme::messageChatSetTheme()
  : theme_()
{}

messageChatSetTheme::messageChatSetTheme(object_ptr<ChatTheme> &&theme_)
  : theme_(std::move(theme_))
{}

const std::int32_t messageChatSetTheme::ID;

object_ptr<MessageContent> messageChatSetTheme::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatSetTheme> res = make_object<messageChatSetTheme>();
  res->theme_ = jni::fetch_tl_object<ChatTheme>(env, jni::fetch_object(env, p, res->theme_fieldID));
  return std::move(res);
}

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

void messageChatSetTheme::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatSetTheme");
    s.store_object_field("theme", static_cast<const BaseObject *>(theme_.get()));
    s.store_class_end();
  }
}

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

jclass messageChatSetMessageAutoDeleteTime::Class;
jfieldID messageChatSetMessageAutoDeleteTime::message_auto_delete_time_fieldID;
jfieldID messageChatSetMessageAutoDeleteTime::from_user_id_fieldID;

messageChatSetMessageAutoDeleteTime::messageChatSetMessageAutoDeleteTime()
  : message_auto_delete_time_()
  , from_user_id_()
{}

messageChatSetMessageAutoDeleteTime::messageChatSetMessageAutoDeleteTime(int32 message_auto_delete_time_, int53 from_user_id_)
  : message_auto_delete_time_(message_auto_delete_time_)
  , from_user_id_(from_user_id_)
{}

const std::int32_t messageChatSetMessageAutoDeleteTime::ID;

object_ptr<MessageContent> messageChatSetMessageAutoDeleteTime::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatSetMessageAutoDeleteTime> res = make_object<messageChatSetMessageAutoDeleteTime>();
  res->message_auto_delete_time_ = env->GetIntField(p, res->message_auto_delete_time_fieldID);
  res->from_user_id_ = env->GetLongField(p, res->from_user_id_fieldID);
  return std::move(res);
}

void messageChatSetMessageAutoDeleteTime::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, message_auto_delete_time_fieldID, message_auto_delete_time_);
  env->SetLongField(s, from_user_id_fieldID, from_user_id_);
}

void messageChatSetMessageAutoDeleteTime::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatSetMessageAutoDeleteTime");
    s.store_field("messageAutoDeleteTime", message_auto_delete_time_);
    s.store_field("fromUserId", from_user_id_);
    s.store_class_end();
  }
}

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

jclass messageChatBoost::Class;
jfieldID messageChatBoost::boost_count_fieldID;

messageChatBoost::messageChatBoost()
  : boost_count_()
{}

messageChatBoost::messageChatBoost(int32 boost_count_)
  : boost_count_(boost_count_)
{}

const std::int32_t messageChatBoost::ID;

object_ptr<MessageContent> messageChatBoost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatBoost> res = make_object<messageChatBoost>();
  res->boost_count_ = env->GetIntField(p, res->boost_count_fieldID);
  return std::move(res);
}

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

void messageChatBoost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatBoost");
    s.store_field("boostCount", boost_count_);
    s.store_class_end();
  }
}

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

jclass messageForumTopicCreated::Class;
jfieldID messageForumTopicCreated::name_fieldID;
jfieldID messageForumTopicCreated::is_name_implicit_fieldID;
jfieldID messageForumTopicCreated::icon_fieldID;

messageForumTopicCreated::messageForumTopicCreated()
  : name_()
  , is_name_implicit_()
  , icon_()
{}

messageForumTopicCreated::messageForumTopicCreated(string const &name_, bool is_name_implicit_, object_ptr<forumTopicIcon> &&icon_)
  : name_(name_)
  , is_name_implicit_(is_name_implicit_)
  , icon_(std::move(icon_))
{}

const std::int32_t messageForumTopicCreated::ID;

object_ptr<MessageContent> messageForumTopicCreated::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageForumTopicCreated> res = make_object<messageForumTopicCreated>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->is_name_implicit_ = (env->GetBooleanField(p, res->is_name_implicit_fieldID) != 0);
  res->icon_ = jni::fetch_tl_object<forumTopicIcon>(env, jni::fetch_object(env, p, res->icon_fieldID));
  return std::move(res);
}

void messageForumTopicCreated::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_name_implicit_fieldID, is_name_implicit_);
  if (icon_ != nullptr) { jobject next; icon_->store(env, next); if (next) { env->SetObjectField(s, icon_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageForumTopicCreated::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageForumTopicCreated");
    s.store_field("name", name_);
    s.store_field("isNameImplicit", is_name_implicit_);
    s.store_object_field("icon", static_cast<const BaseObject *>(icon_.get()));
    s.store_class_end();
  }
}

void messageForumTopicCreated::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageForumTopicCreated").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    is_name_implicit_fieldID = jni::get_field_id(env, Class, "isNameImplicit", "Z");
    icon_fieldID = jni::get_field_id(env, Class, "icon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicIcon;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageForumTopicEdited::Class;
jfieldID messageForumTopicEdited::name_fieldID;
jfieldID messageForumTopicEdited::edit_icon_custom_emoji_id_fieldID;
jfieldID messageForumTopicEdited::icon_custom_emoji_id_fieldID;

messageForumTopicEdited::messageForumTopicEdited()
  : name_()
  , edit_icon_custom_emoji_id_()
  , icon_custom_emoji_id_()
{}

messageForumTopicEdited::messageForumTopicEdited(string const &name_, bool edit_icon_custom_emoji_id_, int64 icon_custom_emoji_id_)
  : name_(name_)
  , edit_icon_custom_emoji_id_(edit_icon_custom_emoji_id_)
  , icon_custom_emoji_id_(icon_custom_emoji_id_)
{}

const std::int32_t messageForumTopicEdited::ID;

object_ptr<MessageContent> messageForumTopicEdited::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageForumTopicEdited> res = make_object<messageForumTopicEdited>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->edit_icon_custom_emoji_id_ = (env->GetBooleanField(p, res->edit_icon_custom_emoji_id_fieldID) != 0);
  res->icon_custom_emoji_id_ = env->GetLongField(p, res->icon_custom_emoji_id_fieldID);
  return std::move(res);
}

void messageForumTopicEdited::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, edit_icon_custom_emoji_id_fieldID, edit_icon_custom_emoji_id_);
  env->SetLongField(s, icon_custom_emoji_id_fieldID, icon_custom_emoji_id_);
}

void messageForumTopicEdited::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageForumTopicEdited");
    s.store_field("name", name_);
    s.store_field("editIconCustomEmojiId", edit_icon_custom_emoji_id_);
    s.store_field("iconCustomEmojiId", icon_custom_emoji_id_);
    s.store_class_end();
  }
}

void messageForumTopicEdited::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageForumTopicEdited").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    edit_icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "editIconCustomEmojiId", "Z");
    icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "iconCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass messageForumTopicIsClosedToggled::Class;
jfieldID messageForumTopicIsClosedToggled::is_closed_fieldID;

messageForumTopicIsClosedToggled::messageForumTopicIsClosedToggled()
  : is_closed_()
{}

messageForumTopicIsClosedToggled::messageForumTopicIsClosedToggled(bool is_closed_)
  : is_closed_(is_closed_)
{}

const std::int32_t messageForumTopicIsClosedToggled::ID;

object_ptr<MessageContent> messageForumTopicIsClosedToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageForumTopicIsClosedToggled> res = make_object<messageForumTopicIsClosedToggled>();
  res->is_closed_ = (env->GetBooleanField(p, res->is_closed_fieldID) != 0);
  return std::move(res);
}

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

void messageForumTopicIsClosedToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageForumTopicIsClosedToggled");
    s.store_field("isClosed", is_closed_);
    s.store_class_end();
  }
}

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

jclass messageForumTopicIsHiddenToggled::Class;
jfieldID messageForumTopicIsHiddenToggled::is_hidden_fieldID;

messageForumTopicIsHiddenToggled::messageForumTopicIsHiddenToggled()
  : is_hidden_()
{}

messageForumTopicIsHiddenToggled::messageForumTopicIsHiddenToggled(bool is_hidden_)
  : is_hidden_(is_hidden_)
{}

const std::int32_t messageForumTopicIsHiddenToggled::ID;

object_ptr<MessageContent> messageForumTopicIsHiddenToggled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageForumTopicIsHiddenToggled> res = make_object<messageForumTopicIsHiddenToggled>();
  res->is_hidden_ = (env->GetBooleanField(p, res->is_hidden_fieldID) != 0);
  return std::move(res);
}

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

void messageForumTopicIsHiddenToggled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageForumTopicIsHiddenToggled");
    s.store_field("isHidden", is_hidden_);
    s.store_class_end();
  }
}

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

jclass messageSuggestProfilePhoto::Class;
jfieldID messageSuggestProfilePhoto::photo_fieldID;

messageSuggestProfilePhoto::messageSuggestProfilePhoto()
  : photo_()
{}

messageSuggestProfilePhoto::messageSuggestProfilePhoto(object_ptr<chatPhoto> &&photo_)
  : photo_(std::move(photo_))
{}

const std::int32_t messageSuggestProfilePhoto::ID;

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

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

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

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

jclass messageSuggestBirthdate::Class;
jfieldID messageSuggestBirthdate::birthdate_fieldID;

messageSuggestBirthdate::messageSuggestBirthdate()
  : birthdate_()
{}

messageSuggestBirthdate::messageSuggestBirthdate(object_ptr<birthdate> &&birthdate_)
  : birthdate_(std::move(birthdate_))
{}

const std::int32_t messageSuggestBirthdate::ID;

object_ptr<MessageContent> messageSuggestBirthdate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSuggestBirthdate> res = make_object<messageSuggestBirthdate>();
  res->birthdate_ = jni::fetch_tl_object<birthdate>(env, jni::fetch_object(env, p, res->birthdate_fieldID));
  return std::move(res);
}

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

void messageSuggestBirthdate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSuggestBirthdate");
    s.store_object_field("birthdate", static_cast<const BaseObject *>(birthdate_.get()));
    s.store_class_end();
  }
}

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

jclass messageCustomServiceAction::Class;
jfieldID messageCustomServiceAction::text_fieldID;

messageCustomServiceAction::messageCustomServiceAction()
  : text_()
{}

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

const std::int32_t messageCustomServiceAction::ID;

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

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

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

jclass messageGameScore::Class;
jfieldID messageGameScore::game_message_id_fieldID;
jfieldID messageGameScore::game_id_fieldID;
jfieldID messageGameScore::score_fieldID;

messageGameScore::messageGameScore()
  : game_message_id_()
  , game_id_()
  , score_()
{}

messageGameScore::messageGameScore(int53 game_message_id_, int64 game_id_, int32 score_)
  : game_message_id_(game_message_id_)
  , game_id_(game_id_)
  , score_(score_)
{}

const std::int32_t messageGameScore::ID;

object_ptr<MessageContent> messageGameScore::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGameScore> res = make_object<messageGameScore>();
  res->game_message_id_ = env->GetLongField(p, res->game_message_id_fieldID);
  res->game_id_ = env->GetLongField(p, res->game_id_fieldID);
  res->score_ = env->GetIntField(p, res->score_fieldID);
  return std::move(res);
}

void messageGameScore::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, game_message_id_fieldID, game_message_id_);
  env->SetLongField(s, game_id_fieldID, game_id_);
  env->SetIntField(s, score_fieldID, score_);
}

void messageGameScore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGameScore");
    s.store_field("gameMessageId", game_message_id_);
    s.store_field("gameId", game_id_);
    s.store_field("score", score_);
    s.store_class_end();
  }
}

void messageGameScore::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGameScore").c_str());
    game_message_id_fieldID = jni::get_field_id(env, Class, "gameMessageId", "J");
    game_id_fieldID = jni::get_field_id(env, Class, "gameId", "J");
    score_fieldID = jni::get_field_id(env, Class, "score", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageManagedBotCreated::Class;
jfieldID messageManagedBotCreated::bot_user_id_fieldID;

messageManagedBotCreated::messageManagedBotCreated()
  : bot_user_id_()
{}

messageManagedBotCreated::messageManagedBotCreated(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t messageManagedBotCreated::ID;

object_ptr<MessageContent> messageManagedBotCreated::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageManagedBotCreated> res = make_object<messageManagedBotCreated>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return std::move(res);
}

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

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

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

jclass messagePaymentSuccessful::Class;
jfieldID messagePaymentSuccessful::invoice_chat_id_fieldID;
jfieldID messagePaymentSuccessful::invoice_message_id_fieldID;
jfieldID messagePaymentSuccessful::currency_fieldID;
jfieldID messagePaymentSuccessful::total_amount_fieldID;
jfieldID messagePaymentSuccessful::subscription_until_date_fieldID;
jfieldID messagePaymentSuccessful::is_recurring_fieldID;
jfieldID messagePaymentSuccessful::is_first_recurring_fieldID;
jfieldID messagePaymentSuccessful::invoice_name_fieldID;

messagePaymentSuccessful::messagePaymentSuccessful()
  : invoice_chat_id_()
  , invoice_message_id_()
  , currency_()
  , total_amount_()
  , subscription_until_date_()
  , is_recurring_()
  , is_first_recurring_()
  , invoice_name_()
{}

messagePaymentSuccessful::messagePaymentSuccessful(int53 invoice_chat_id_, int53 invoice_message_id_, string const &currency_, int53 total_amount_, int32 subscription_until_date_, bool is_recurring_, bool is_first_recurring_, string const &invoice_name_)
  : invoice_chat_id_(invoice_chat_id_)
  , invoice_message_id_(invoice_message_id_)
  , currency_(currency_)
  , total_amount_(total_amount_)
  , subscription_until_date_(subscription_until_date_)
  , is_recurring_(is_recurring_)
  , is_first_recurring_(is_first_recurring_)
  , invoice_name_(invoice_name_)
{}

const std::int32_t messagePaymentSuccessful::ID;

object_ptr<MessageContent> messagePaymentSuccessful::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePaymentSuccessful> res = make_object<messagePaymentSuccessful>();
  res->invoice_chat_id_ = env->GetLongField(p, res->invoice_chat_id_fieldID);
  res->invoice_message_id_ = env->GetLongField(p, res->invoice_message_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->subscription_until_date_ = env->GetIntField(p, res->subscription_until_date_fieldID);
  res->is_recurring_ = (env->GetBooleanField(p, res->is_recurring_fieldID) != 0);
  res->is_first_recurring_ = (env->GetBooleanField(p, res->is_first_recurring_fieldID) != 0);
  res->invoice_name_ = jni::fetch_string(env, p, res->invoice_name_fieldID);
  return std::move(res);
}

void messagePaymentSuccessful::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, invoice_chat_id_fieldID, invoice_chat_id_);
  env->SetLongField(s, invoice_message_id_fieldID, invoice_message_id_);
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, total_amount_fieldID, total_amount_);
  env->SetIntField(s, subscription_until_date_fieldID, subscription_until_date_);
  env->SetBooleanField(s, is_recurring_fieldID, is_recurring_);
  env->SetBooleanField(s, is_first_recurring_fieldID, is_first_recurring_);
  { jstring nextString = jni::to_jstring(env, invoice_name_); if (nextString) { env->SetObjectField(s, invoice_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messagePaymentSuccessful::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePaymentSuccessful");
    s.store_field("invoiceChatId", invoice_chat_id_);
    s.store_field("invoiceMessageId", invoice_message_id_);
    s.store_field("currency", currency_);
    s.store_field("totalAmount", total_amount_);
    s.store_field("subscriptionUntilDate", subscription_until_date_);
    s.store_field("isRecurring", is_recurring_);
    s.store_field("isFirstRecurring", is_first_recurring_);
    s.store_field("invoiceName", invoice_name_);
    s.store_class_end();
  }
}

void messagePaymentSuccessful::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePaymentSuccessful").c_str());
    invoice_chat_id_fieldID = jni::get_field_id(env, Class, "invoiceChatId", "J");
    invoice_message_id_fieldID = jni::get_field_id(env, Class, "invoiceMessageId", "J");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    subscription_until_date_fieldID = jni::get_field_id(env, Class, "subscriptionUntilDate", "I");
    is_recurring_fieldID = jni::get_field_id(env, Class, "isRecurring", "Z");
    is_first_recurring_fieldID = jni::get_field_id(env, Class, "isFirstRecurring", "Z");
    invoice_name_fieldID = jni::get_field_id(env, Class, "invoiceName", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messagePaymentSuccessfulBot::Class;
jfieldID messagePaymentSuccessfulBot::currency_fieldID;
jfieldID messagePaymentSuccessfulBot::total_amount_fieldID;
jfieldID messagePaymentSuccessfulBot::subscription_until_date_fieldID;
jfieldID messagePaymentSuccessfulBot::is_recurring_fieldID;
jfieldID messagePaymentSuccessfulBot::is_first_recurring_fieldID;
jfieldID messagePaymentSuccessfulBot::invoice_payload_fieldID;
jfieldID messagePaymentSuccessfulBot::shipping_option_id_fieldID;
jfieldID messagePaymentSuccessfulBot::order_info_fieldID;
jfieldID messagePaymentSuccessfulBot::telegram_payment_charge_id_fieldID;
jfieldID messagePaymentSuccessfulBot::provider_payment_charge_id_fieldID;

messagePaymentSuccessfulBot::messagePaymentSuccessfulBot()
  : currency_()
  , total_amount_()
  , subscription_until_date_()
  , is_recurring_()
  , is_first_recurring_()
  , invoice_payload_()
  , shipping_option_id_()
  , order_info_()
  , telegram_payment_charge_id_()
  , provider_payment_charge_id_()
{}

messagePaymentSuccessfulBot::messagePaymentSuccessfulBot(string const &currency_, int53 total_amount_, int32 subscription_until_date_, bool is_recurring_, bool is_first_recurring_, bytes const &invoice_payload_, string const &shipping_option_id_, object_ptr<orderInfo> &&order_info_, string const &telegram_payment_charge_id_, string const &provider_payment_charge_id_)
  : currency_(currency_)
  , total_amount_(total_amount_)
  , subscription_until_date_(subscription_until_date_)
  , is_recurring_(is_recurring_)
  , is_first_recurring_(is_first_recurring_)
  , invoice_payload_(std::move(invoice_payload_))
  , shipping_option_id_(shipping_option_id_)
  , order_info_(std::move(order_info_))
  , telegram_payment_charge_id_(telegram_payment_charge_id_)
  , provider_payment_charge_id_(provider_payment_charge_id_)
{}

const std::int32_t messagePaymentSuccessfulBot::ID;

object_ptr<MessageContent> messagePaymentSuccessfulBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePaymentSuccessfulBot> res = make_object<messagePaymentSuccessfulBot>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->subscription_until_date_ = env->GetIntField(p, res->subscription_until_date_fieldID);
  res->is_recurring_ = (env->GetBooleanField(p, res->is_recurring_fieldID) != 0);
  res->is_first_recurring_ = (env->GetBooleanField(p, res->is_first_recurring_fieldID) != 0);
  res->invoice_payload_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->invoice_payload_fieldID));
  res->shipping_option_id_ = jni::fetch_string(env, p, res->shipping_option_id_fieldID);
  res->order_info_ = jni::fetch_tl_object<orderInfo>(env, jni::fetch_object(env, p, res->order_info_fieldID));
  res->telegram_payment_charge_id_ = jni::fetch_string(env, p, res->telegram_payment_charge_id_fieldID);
  res->provider_payment_charge_id_ = jni::fetch_string(env, p, res->provider_payment_charge_id_fieldID);
  return std::move(res);
}

void messagePaymentSuccessfulBot::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, total_amount_fieldID, total_amount_);
  env->SetIntField(s, subscription_until_date_fieldID, subscription_until_date_);
  env->SetBooleanField(s, is_recurring_fieldID, is_recurring_);
  env->SetBooleanField(s, is_first_recurring_fieldID, is_first_recurring_);
  { jbyteArray nextBytes = jni::to_bytes(env, invoice_payload_); if (nextBytes) { env->SetObjectField(s, invoice_payload_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  { jstring nextString = jni::to_jstring(env, shipping_option_id_); if (nextString) { env->SetObjectField(s, shipping_option_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (order_info_ != nullptr) { jobject next; order_info_->store(env, next); if (next) { env->SetObjectField(s, order_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, telegram_payment_charge_id_); if (nextString) { env->SetObjectField(s, telegram_payment_charge_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, provider_payment_charge_id_); if (nextString) { env->SetObjectField(s, provider_payment_charge_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messagePaymentSuccessfulBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePaymentSuccessfulBot");
    s.store_field("currency", currency_);
    s.store_field("totalAmount", total_amount_);
    s.store_field("subscriptionUntilDate", subscription_until_date_);
    s.store_field("isRecurring", is_recurring_);
    s.store_field("isFirstRecurring", is_first_recurring_);
    s.store_bytes_field("invoicePayload", invoice_payload_);
    s.store_field("shippingOptionId", shipping_option_id_);
    s.store_object_field("orderInfo", static_cast<const BaseObject *>(order_info_.get()));
    s.store_field("telegramPaymentChargeId", telegram_payment_charge_id_);
    s.store_field("providerPaymentChargeId", provider_payment_charge_id_);
    s.store_class_end();
  }
}

void messagePaymentSuccessfulBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePaymentSuccessfulBot").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    subscription_until_date_fieldID = jni::get_field_id(env, Class, "subscriptionUntilDate", "I");
    is_recurring_fieldID = jni::get_field_id(env, Class, "isRecurring", "Z");
    is_first_recurring_fieldID = jni::get_field_id(env, Class, "isFirstRecurring", "Z");
    invoice_payload_fieldID = jni::get_field_id(env, Class, "invoicePayload", "[B");
    shipping_option_id_fieldID = jni::get_field_id(env, Class, "shippingOptionId", "Ljava/lang/String;");
    order_info_fieldID = jni::get_field_id(env, Class, "orderInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$OrderInfo;").c_str());
    telegram_payment_charge_id_fieldID = jni::get_field_id(env, Class, "telegramPaymentChargeId", "Ljava/lang/String;");
    provider_payment_charge_id_fieldID = jni::get_field_id(env, Class, "providerPaymentChargeId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messagePaymentRefunded::Class;
jfieldID messagePaymentRefunded::owner_id_fieldID;
jfieldID messagePaymentRefunded::currency_fieldID;
jfieldID messagePaymentRefunded::total_amount_fieldID;
jfieldID messagePaymentRefunded::invoice_payload_fieldID;
jfieldID messagePaymentRefunded::telegram_payment_charge_id_fieldID;
jfieldID messagePaymentRefunded::provider_payment_charge_id_fieldID;

messagePaymentRefunded::messagePaymentRefunded()
  : owner_id_()
  , currency_()
  , total_amount_()
  , invoice_payload_()
  , telegram_payment_charge_id_()
  , provider_payment_charge_id_()
{}

messagePaymentRefunded::messagePaymentRefunded(object_ptr<MessageSender> &&owner_id_, string const &currency_, int53 total_amount_, bytes const &invoice_payload_, string const &telegram_payment_charge_id_, string const &provider_payment_charge_id_)
  : owner_id_(std::move(owner_id_))
  , currency_(currency_)
  , total_amount_(total_amount_)
  , invoice_payload_(std::move(invoice_payload_))
  , telegram_payment_charge_id_(telegram_payment_charge_id_)
  , provider_payment_charge_id_(provider_payment_charge_id_)
{}

const std::int32_t messagePaymentRefunded::ID;

object_ptr<MessageContent> messagePaymentRefunded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePaymentRefunded> res = make_object<messagePaymentRefunded>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->invoice_payload_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->invoice_payload_fieldID));
  res->telegram_payment_charge_id_ = jni::fetch_string(env, p, res->telegram_payment_charge_id_fieldID);
  res->provider_payment_charge_id_ = jni::fetch_string(env, p, res->provider_payment_charge_id_fieldID);
  return std::move(res);
}

void messagePaymentRefunded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, total_amount_fieldID, total_amount_);
  { jbyteArray nextBytes = jni::to_bytes(env, invoice_payload_); if (nextBytes) { env->SetObjectField(s, invoice_payload_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  { jstring nextString = jni::to_jstring(env, telegram_payment_charge_id_); if (nextString) { env->SetObjectField(s, telegram_payment_charge_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, provider_payment_charge_id_); if (nextString) { env->SetObjectField(s, provider_payment_charge_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messagePaymentRefunded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePaymentRefunded");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("currency", currency_);
    s.store_field("totalAmount", total_amount_);
    s.store_bytes_field("invoicePayload", invoice_payload_);
    s.store_field("telegramPaymentChargeId", telegram_payment_charge_id_);
    s.store_field("providerPaymentChargeId", provider_payment_charge_id_);
    s.store_class_end();
  }
}

void messagePaymentRefunded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePaymentRefunded").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    invoice_payload_fieldID = jni::get_field_id(env, Class, "invoicePayload", "[B");
    telegram_payment_charge_id_fieldID = jni::get_field_id(env, Class, "telegramPaymentChargeId", "Ljava/lang/String;");
    provider_payment_charge_id_fieldID = jni::get_field_id(env, Class, "providerPaymentChargeId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageGiftedPremium::Class;
jfieldID messageGiftedPremium::gifter_user_id_fieldID;
jfieldID messageGiftedPremium::receiver_user_id_fieldID;
jfieldID messageGiftedPremium::text_fieldID;
jfieldID messageGiftedPremium::currency_fieldID;
jfieldID messageGiftedPremium::amount_fieldID;
jfieldID messageGiftedPremium::cryptocurrency_fieldID;
jfieldID messageGiftedPremium::cryptocurrency_amount_fieldID;
jfieldID messageGiftedPremium::month_count_fieldID;
jfieldID messageGiftedPremium::day_count_fieldID;
jfieldID messageGiftedPremium::sticker_fieldID;

messageGiftedPremium::messageGiftedPremium()
  : gifter_user_id_()
  , receiver_user_id_()
  , text_()
  , currency_()
  , amount_()
  , cryptocurrency_()
  , cryptocurrency_amount_()
  , month_count_()
  , day_count_()
  , sticker_()
{}

messageGiftedPremium::messageGiftedPremium(int53 gifter_user_id_, int53 receiver_user_id_, object_ptr<formattedText> &&text_, string const &currency_, int53 amount_, string const &cryptocurrency_, int64 cryptocurrency_amount_, int32 month_count_, int32 day_count_, object_ptr<sticker> &&sticker_)
  : gifter_user_id_(gifter_user_id_)
  , receiver_user_id_(receiver_user_id_)
  , text_(std::move(text_))
  , currency_(currency_)
  , amount_(amount_)
  , cryptocurrency_(cryptocurrency_)
  , cryptocurrency_amount_(cryptocurrency_amount_)
  , month_count_(month_count_)
  , day_count_(day_count_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t messageGiftedPremium::ID;

object_ptr<MessageContent> messageGiftedPremium::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiftedPremium> res = make_object<messageGiftedPremium>();
  res->gifter_user_id_ = env->GetLongField(p, res->gifter_user_id_fieldID);
  res->receiver_user_id_ = env->GetLongField(p, res->receiver_user_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->cryptocurrency_ = jni::fetch_string(env, p, res->cryptocurrency_fieldID);
  res->cryptocurrency_amount_ = env->GetLongField(p, res->cryptocurrency_amount_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->day_count_ = env->GetIntField(p, res->day_count_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void messageGiftedPremium::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, gifter_user_id_fieldID, gifter_user_id_);
  env->SetLongField(s, receiver_user_id_fieldID, receiver_user_id_);
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  { jstring nextString = jni::to_jstring(env, cryptocurrency_); if (nextString) { env->SetObjectField(s, cryptocurrency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, cryptocurrency_amount_fieldID, cryptocurrency_amount_);
  env->SetIntField(s, month_count_fieldID, month_count_);
  env->SetIntField(s, day_count_fieldID, day_count_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageGiftedPremium::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiftedPremium");
    s.store_field("gifterUserId", gifter_user_id_);
    s.store_field("receiverUserId", receiver_user_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("cryptocurrency", cryptocurrency_);
    s.store_field("cryptocurrencyAmount", cryptocurrency_amount_);
    s.store_field("monthCount", month_count_);
    s.store_field("dayCount", day_count_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void messageGiftedPremium::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiftedPremium").c_str());
    gifter_user_id_fieldID = jni::get_field_id(env, Class, "gifterUserId", "J");
    receiver_user_id_fieldID = jni::get_field_id(env, Class, "receiverUserId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    cryptocurrency_fieldID = jni::get_field_id(env, Class, "cryptocurrency", "Ljava/lang/String;");
    cryptocurrency_amount_fieldID = jni::get_field_id(env, Class, "cryptocurrencyAmount", "J");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    day_count_fieldID = jni::get_field_id(env, Class, "dayCount", "I");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messagePremiumGiftCode::Class;
jfieldID messagePremiumGiftCode::creator_id_fieldID;
jfieldID messagePremiumGiftCode::text_fieldID;
jfieldID messagePremiumGiftCode::is_from_giveaway_fieldID;
jfieldID messagePremiumGiftCode::is_unclaimed_fieldID;
jfieldID messagePremiumGiftCode::currency_fieldID;
jfieldID messagePremiumGiftCode::amount_fieldID;
jfieldID messagePremiumGiftCode::cryptocurrency_fieldID;
jfieldID messagePremiumGiftCode::cryptocurrency_amount_fieldID;
jfieldID messagePremiumGiftCode::month_count_fieldID;
jfieldID messagePremiumGiftCode::day_count_fieldID;
jfieldID messagePremiumGiftCode::sticker_fieldID;
jfieldID messagePremiumGiftCode::code_fieldID;

messagePremiumGiftCode::messagePremiumGiftCode()
  : creator_id_()
  , text_()
  , is_from_giveaway_()
  , is_unclaimed_()
  , currency_()
  , amount_()
  , cryptocurrency_()
  , cryptocurrency_amount_()
  , month_count_()
  , day_count_()
  , sticker_()
  , code_()
{}

messagePremiumGiftCode::messagePremiumGiftCode(object_ptr<MessageSender> &&creator_id_, object_ptr<formattedText> &&text_, bool is_from_giveaway_, bool is_unclaimed_, string const &currency_, int53 amount_, string const &cryptocurrency_, int64 cryptocurrency_amount_, int32 month_count_, int32 day_count_, object_ptr<sticker> &&sticker_, string const &code_)
  : creator_id_(std::move(creator_id_))
  , text_(std::move(text_))
  , is_from_giveaway_(is_from_giveaway_)
  , is_unclaimed_(is_unclaimed_)
  , currency_(currency_)
  , amount_(amount_)
  , cryptocurrency_(cryptocurrency_)
  , cryptocurrency_amount_(cryptocurrency_amount_)
  , month_count_(month_count_)
  , day_count_(day_count_)
  , sticker_(std::move(sticker_))
  , code_(code_)
{}

const std::int32_t messagePremiumGiftCode::ID;

object_ptr<MessageContent> messagePremiumGiftCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePremiumGiftCode> res = make_object<messagePremiumGiftCode>();
  res->creator_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->creator_id_fieldID));
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->is_from_giveaway_ = (env->GetBooleanField(p, res->is_from_giveaway_fieldID) != 0);
  res->is_unclaimed_ = (env->GetBooleanField(p, res->is_unclaimed_fieldID) != 0);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->cryptocurrency_ = jni::fetch_string(env, p, res->cryptocurrency_fieldID);
  res->cryptocurrency_amount_ = env->GetLongField(p, res->cryptocurrency_amount_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->day_count_ = env->GetIntField(p, res->day_count_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->code_ = jni::fetch_string(env, p, res->code_fieldID);
  return std::move(res);
}

void messagePremiumGiftCode::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); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_from_giveaway_fieldID, is_from_giveaway_);
  env->SetBooleanField(s, is_unclaimed_fieldID, is_unclaimed_);
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  { jstring nextString = jni::to_jstring(env, cryptocurrency_); if (nextString) { env->SetObjectField(s, cryptocurrency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, cryptocurrency_amount_fieldID, cryptocurrency_amount_);
  env->SetIntField(s, month_count_fieldID, month_count_);
  env->SetIntField(s, day_count_fieldID, day_count_);
  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, code_); if (nextString) { env->SetObjectField(s, code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messagePremiumGiftCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePremiumGiftCode");
    s.store_object_field("creatorId", static_cast<const BaseObject *>(creator_id_.get()));
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("isFromGiveaway", is_from_giveaway_);
    s.store_field("isUnclaimed", is_unclaimed_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("cryptocurrency", cryptocurrency_);
    s.store_field("cryptocurrencyAmount", cryptocurrency_amount_);
    s.store_field("monthCount", month_count_);
    s.store_field("dayCount", day_count_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_field("code", code_);
    s.store_class_end();
  }
}

void messagePremiumGiftCode::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePremiumGiftCode").c_str());
    creator_id_fieldID = jni::get_field_id(env, Class, "creatorId", (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());
    is_from_giveaway_fieldID = jni::get_field_id(env, Class, "isFromGiveaway", "Z");
    is_unclaimed_fieldID = jni::get_field_id(env, Class, "isUnclaimed", "Z");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    cryptocurrency_fieldID = jni::get_field_id(env, Class, "cryptocurrency", "Ljava/lang/String;");
    cryptocurrency_amount_fieldID = jni::get_field_id(env, Class, "cryptocurrencyAmount", "J");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    day_count_fieldID = jni::get_field_id(env, Class, "dayCount", "I");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    code_fieldID = jni::get_field_id(env, Class, "code", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageGiveawayCreated::Class;
jfieldID messageGiveawayCreated::star_count_fieldID;

messageGiveawayCreated::messageGiveawayCreated()
  : star_count_()
{}

messageGiveawayCreated::messageGiveawayCreated(int53 star_count_)
  : star_count_(star_count_)
{}

const std::int32_t messageGiveawayCreated::ID;

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

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

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

jclass messageGiveaway::Class;
jfieldID messageGiveaway::parameters_fieldID;
jfieldID messageGiveaway::winner_count_fieldID;
jfieldID messageGiveaway::prize_fieldID;
jfieldID messageGiveaway::sticker_fieldID;

messageGiveaway::messageGiveaway()
  : parameters_()
  , winner_count_()
  , prize_()
  , sticker_()
{}

messageGiveaway::messageGiveaway(object_ptr<giveawayParameters> &&parameters_, int32 winner_count_, object_ptr<GiveawayPrize> &&prize_, object_ptr<sticker> &&sticker_)
  : parameters_(std::move(parameters_))
  , winner_count_(winner_count_)
  , prize_(std::move(prize_))
  , sticker_(std::move(sticker_))
{}

const std::int32_t messageGiveaway::ID;

object_ptr<MessageContent> messageGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiveaway> res = make_object<messageGiveaway>();
  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->prize_ = jni::fetch_tl_object<GiveawayPrize>(env, jni::fetch_object(env, p, res->prize_fieldID));
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void messageGiveaway::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (parameters_ != nullptr) { jobject next; parameters_->store(env, next); if (next) { env->SetObjectField(s, parameters_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, 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); } }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiveaway");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("winnerCount", winner_count_);
    s.store_object_field("prize", static_cast<const BaseObject *>(prize_.get()));
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void messageGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiveaway").c_str());
    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");
    prize_fieldID = jni::get_field_id(env, Class, "prize", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayPrize;").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageGiveawayCompleted::Class;
jfieldID messageGiveawayCompleted::giveaway_message_id_fieldID;
jfieldID messageGiveawayCompleted::winner_count_fieldID;
jfieldID messageGiveawayCompleted::is_star_giveaway_fieldID;
jfieldID messageGiveawayCompleted::unclaimed_prize_count_fieldID;

messageGiveawayCompleted::messageGiveawayCompleted()
  : giveaway_message_id_()
  , winner_count_()
  , is_star_giveaway_()
  , unclaimed_prize_count_()
{}

messageGiveawayCompleted::messageGiveawayCompleted(int53 giveaway_message_id_, int32 winner_count_, bool is_star_giveaway_, int32 unclaimed_prize_count_)
  : giveaway_message_id_(giveaway_message_id_)
  , winner_count_(winner_count_)
  , is_star_giveaway_(is_star_giveaway_)
  , unclaimed_prize_count_(unclaimed_prize_count_)
{}

const std::int32_t messageGiveawayCompleted::ID;

object_ptr<MessageContent> messageGiveawayCompleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiveawayCompleted> res = make_object<messageGiveawayCompleted>();
  res->giveaway_message_id_ = env->GetLongField(p, res->giveaway_message_id_fieldID);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->is_star_giveaway_ = (env->GetBooleanField(p, res->is_star_giveaway_fieldID) != 0);
  res->unclaimed_prize_count_ = env->GetIntField(p, res->unclaimed_prize_count_fieldID);
  return std::move(res);
}

void messageGiveawayCompleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, giveaway_message_id_fieldID, giveaway_message_id_);
  env->SetIntField(s, winner_count_fieldID, winner_count_);
  env->SetBooleanField(s, is_star_giveaway_fieldID, is_star_giveaway_);
  env->SetIntField(s, unclaimed_prize_count_fieldID, unclaimed_prize_count_);
}

void messageGiveawayCompleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiveawayCompleted");
    s.store_field("giveawayMessageId", giveaway_message_id_);
    s.store_field("winnerCount", winner_count_);
    s.store_field("isStarGiveaway", is_star_giveaway_);
    s.store_field("unclaimedPrizeCount", unclaimed_prize_count_);
    s.store_class_end();
  }
}

void messageGiveawayCompleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiveawayCompleted").c_str());
    giveaway_message_id_fieldID = jni::get_field_id(env, Class, "giveawayMessageId", "J");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    is_star_giveaway_fieldID = jni::get_field_id(env, Class, "isStarGiveaway", "Z");
    unclaimed_prize_count_fieldID = jni::get_field_id(env, Class, "unclaimedPrizeCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageGiveawayWinners::Class;
jfieldID messageGiveawayWinners::boosted_chat_id_fieldID;
jfieldID messageGiveawayWinners::giveaway_message_id_fieldID;
jfieldID messageGiveawayWinners::additional_chat_count_fieldID;
jfieldID messageGiveawayWinners::actual_winners_selection_date_fieldID;
jfieldID messageGiveawayWinners::only_new_members_fieldID;
jfieldID messageGiveawayWinners::was_refunded_fieldID;
jfieldID messageGiveawayWinners::prize_fieldID;
jfieldID messageGiveawayWinners::prize_description_fieldID;
jfieldID messageGiveawayWinners::winner_count_fieldID;
jfieldID messageGiveawayWinners::winner_user_ids_fieldID;
jfieldID messageGiveawayWinners::unclaimed_prize_count_fieldID;

messageGiveawayWinners::messageGiveawayWinners()
  : boosted_chat_id_()
  , giveaway_message_id_()
  , additional_chat_count_()
  , actual_winners_selection_date_()
  , only_new_members_()
  , was_refunded_()
  , prize_()
  , prize_description_()
  , winner_count_()
  , winner_user_ids_()
  , unclaimed_prize_count_()
{}

messageGiveawayWinners::messageGiveawayWinners(int53 boosted_chat_id_, int53 giveaway_message_id_, int32 additional_chat_count_, int32 actual_winners_selection_date_, bool only_new_members_, bool was_refunded_, object_ptr<GiveawayPrize> &&prize_, string const &prize_description_, int32 winner_count_, array<int53> &&winner_user_ids_, int32 unclaimed_prize_count_)
  : boosted_chat_id_(boosted_chat_id_)
  , giveaway_message_id_(giveaway_message_id_)
  , additional_chat_count_(additional_chat_count_)
  , actual_winners_selection_date_(actual_winners_selection_date_)
  , only_new_members_(only_new_members_)
  , was_refunded_(was_refunded_)
  , prize_(std::move(prize_))
  , prize_description_(prize_description_)
  , winner_count_(winner_count_)
  , winner_user_ids_(std::move(winner_user_ids_))
  , unclaimed_prize_count_(unclaimed_prize_count_)
{}

const std::int32_t messageGiveawayWinners::ID;

object_ptr<MessageContent> messageGiveawayWinners::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiveawayWinners> res = make_object<messageGiveawayWinners>();
  res->boosted_chat_id_ = env->GetLongField(p, res->boosted_chat_id_fieldID);
  res->giveaway_message_id_ = env->GetLongField(p, res->giveaway_message_id_fieldID);
  res->additional_chat_count_ = env->GetIntField(p, res->additional_chat_count_fieldID);
  res->actual_winners_selection_date_ = env->GetIntField(p, res->actual_winners_selection_date_fieldID);
  res->only_new_members_ = (env->GetBooleanField(p, res->only_new_members_fieldID) != 0);
  res->was_refunded_ = (env->GetBooleanField(p, res->was_refunded_fieldID) != 0);
  res->prize_ = jni::fetch_tl_object<GiveawayPrize>(env, jni::fetch_object(env, p, res->prize_fieldID));
  res->prize_description_ = jni::fetch_string(env, p, res->prize_description_fieldID);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->winner_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->winner_user_ids_fieldID));
  res->unclaimed_prize_count_ = env->GetIntField(p, res->unclaimed_prize_count_fieldID);
  return std::move(res);
}

void messageGiveawayWinners::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, boosted_chat_id_fieldID, boosted_chat_id_);
  env->SetLongField(s, giveaway_message_id_fieldID, giveaway_message_id_);
  env->SetIntField(s, additional_chat_count_fieldID, additional_chat_count_);
  env->SetIntField(s, actual_winners_selection_date_fieldID, actual_winners_selection_date_);
  env->SetBooleanField(s, only_new_members_fieldID, only_new_members_);
  env->SetBooleanField(s, was_refunded_fieldID, was_refunded_);
  if (prize_ != nullptr) { jobject next; prize_->store(env, next); if (next) { env->SetObjectField(s, prize_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, prize_description_); if (nextString) { env->SetObjectField(s, prize_description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, winner_count_fieldID, winner_count_);
  { auto arr_tmp_ = jni::store_vector(env, winner_user_ids_); if (arr_tmp_) { env->SetObjectField(s, winner_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, unclaimed_prize_count_fieldID, unclaimed_prize_count_);
}

void messageGiveawayWinners::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiveawayWinners");
    s.store_field("boostedChatId", boosted_chat_id_);
    s.store_field("giveawayMessageId", giveaway_message_id_);
    s.store_field("additionalChatCount", additional_chat_count_);
    s.store_field("actualWinnersSelectionDate", actual_winners_selection_date_);
    s.store_field("onlyNewMembers", only_new_members_);
    s.store_field("wasRefunded", was_refunded_);
    s.store_object_field("prize", static_cast<const BaseObject *>(prize_.get()));
    s.store_field("prizeDescription", prize_description_);
    s.store_field("winnerCount", winner_count_);
    { s.store_vector_begin("winnerUserIds", winner_user_ids_.size()); for (const auto &_value : winner_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("unclaimedPrizeCount", unclaimed_prize_count_);
    s.store_class_end();
  }
}

void messageGiveawayWinners::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiveawayWinners").c_str());
    boosted_chat_id_fieldID = jni::get_field_id(env, Class, "boostedChatId", "J");
    giveaway_message_id_fieldID = jni::get_field_id(env, Class, "giveawayMessageId", "J");
    additional_chat_count_fieldID = jni::get_field_id(env, Class, "additionalChatCount", "I");
    actual_winners_selection_date_fieldID = jni::get_field_id(env, Class, "actualWinnersSelectionDate", "I");
    only_new_members_fieldID = jni::get_field_id(env, Class, "onlyNewMembers", "Z");
    was_refunded_fieldID = jni::get_field_id(env, Class, "wasRefunded", "Z");
    prize_fieldID = jni::get_field_id(env, Class, "prize", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayPrize;").c_str());
    prize_description_fieldID = jni::get_field_id(env, Class, "prizeDescription", "Ljava/lang/String;");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    winner_user_ids_fieldID = jni::get_field_id(env, Class, "winnerUserIds", "[J");
    unclaimed_prize_count_fieldID = jni::get_field_id(env, Class, "unclaimedPrizeCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageGiftedStars::Class;
jfieldID messageGiftedStars::gifter_user_id_fieldID;
jfieldID messageGiftedStars::receiver_user_id_fieldID;
jfieldID messageGiftedStars::currency_fieldID;
jfieldID messageGiftedStars::amount_fieldID;
jfieldID messageGiftedStars::cryptocurrency_fieldID;
jfieldID messageGiftedStars::cryptocurrency_amount_fieldID;
jfieldID messageGiftedStars::star_count_fieldID;
jfieldID messageGiftedStars::transaction_id_fieldID;
jfieldID messageGiftedStars::sticker_fieldID;

messageGiftedStars::messageGiftedStars()
  : gifter_user_id_()
  , receiver_user_id_()
  , currency_()
  , amount_()
  , cryptocurrency_()
  , cryptocurrency_amount_()
  , star_count_()
  , transaction_id_()
  , sticker_()
{}

messageGiftedStars::messageGiftedStars(int53 gifter_user_id_, int53 receiver_user_id_, string const &currency_, int53 amount_, string const &cryptocurrency_, int64 cryptocurrency_amount_, int53 star_count_, string const &transaction_id_, object_ptr<sticker> &&sticker_)
  : gifter_user_id_(gifter_user_id_)
  , receiver_user_id_(receiver_user_id_)
  , currency_(currency_)
  , amount_(amount_)
  , cryptocurrency_(cryptocurrency_)
  , cryptocurrency_amount_(cryptocurrency_amount_)
  , star_count_(star_count_)
  , transaction_id_(transaction_id_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t messageGiftedStars::ID;

object_ptr<MessageContent> messageGiftedStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiftedStars> res = make_object<messageGiftedStars>();
  res->gifter_user_id_ = env->GetLongField(p, res->gifter_user_id_fieldID);
  res->receiver_user_id_ = env->GetLongField(p, res->receiver_user_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->cryptocurrency_ = jni::fetch_string(env, p, res->cryptocurrency_fieldID);
  res->cryptocurrency_amount_ = env->GetLongField(p, res->cryptocurrency_amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->transaction_id_ = jni::fetch_string(env, p, res->transaction_id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void messageGiftedStars::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, gifter_user_id_fieldID, gifter_user_id_);
  env->SetLongField(s, receiver_user_id_fieldID, receiver_user_id_);
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  { jstring nextString = jni::to_jstring(env, cryptocurrency_); if (nextString) { env->SetObjectField(s, cryptocurrency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, cryptocurrency_amount_fieldID, cryptocurrency_amount_);
  env->SetLongField(s, star_count_fieldID, star_count_);
  { jstring nextString = jni::to_jstring(env, transaction_id_); if (nextString) { env->SetObjectField(s, transaction_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageGiftedStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiftedStars");
    s.store_field("gifterUserId", gifter_user_id_);
    s.store_field("receiverUserId", receiver_user_id_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("cryptocurrency", cryptocurrency_);
    s.store_field("cryptocurrencyAmount", cryptocurrency_amount_);
    s.store_field("starCount", star_count_);
    s.store_field("transactionId", transaction_id_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void messageGiftedStars::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiftedStars").c_str());
    gifter_user_id_fieldID = jni::get_field_id(env, Class, "gifterUserId", "J");
    receiver_user_id_fieldID = jni::get_field_id(env, Class, "receiverUserId", "J");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    cryptocurrency_fieldID = jni::get_field_id(env, Class, "cryptocurrency", "Ljava/lang/String;");
    cryptocurrency_amount_fieldID = jni::get_field_id(env, Class, "cryptocurrencyAmount", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    transaction_id_fieldID = jni::get_field_id(env, Class, "transactionId", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageGiftedTon::Class;
jfieldID messageGiftedTon::gifter_user_id_fieldID;
jfieldID messageGiftedTon::receiver_user_id_fieldID;
jfieldID messageGiftedTon::ton_amount_fieldID;
jfieldID messageGiftedTon::transaction_id_fieldID;
jfieldID messageGiftedTon::sticker_fieldID;

messageGiftedTon::messageGiftedTon()
  : gifter_user_id_()
  , receiver_user_id_()
  , ton_amount_()
  , transaction_id_()
  , sticker_()
{}

messageGiftedTon::messageGiftedTon(int53 gifter_user_id_, int53 receiver_user_id_, int53 ton_amount_, string const &transaction_id_, object_ptr<sticker> &&sticker_)
  : gifter_user_id_(gifter_user_id_)
  , receiver_user_id_(receiver_user_id_)
  , ton_amount_(ton_amount_)
  , transaction_id_(transaction_id_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t messageGiftedTon::ID;

object_ptr<MessageContent> messageGiftedTon::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiftedTon> res = make_object<messageGiftedTon>();
  res->gifter_user_id_ = env->GetLongField(p, res->gifter_user_id_fieldID);
  res->receiver_user_id_ = env->GetLongField(p, res->receiver_user_id_fieldID);
  res->ton_amount_ = env->GetLongField(p, res->ton_amount_fieldID);
  res->transaction_id_ = jni::fetch_string(env, p, res->transaction_id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void messageGiftedTon::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, gifter_user_id_fieldID, gifter_user_id_);
  env->SetLongField(s, receiver_user_id_fieldID, receiver_user_id_);
  env->SetLongField(s, ton_amount_fieldID, ton_amount_);
  { jstring nextString = jni::to_jstring(env, transaction_id_); if (nextString) { env->SetObjectField(s, transaction_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageGiftedTon::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiftedTon");
    s.store_field("gifterUserId", gifter_user_id_);
    s.store_field("receiverUserId", receiver_user_id_);
    s.store_field("tonAmount", ton_amount_);
    s.store_field("transactionId", transaction_id_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void messageGiftedTon::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiftedTon").c_str());
    gifter_user_id_fieldID = jni::get_field_id(env, Class, "gifterUserId", "J");
    receiver_user_id_fieldID = jni::get_field_id(env, Class, "receiverUserId", "J");
    ton_amount_fieldID = jni::get_field_id(env, Class, "tonAmount", "J");
    transaction_id_fieldID = jni::get_field_id(env, Class, "transactionId", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageGiveawayPrizeStars::Class;
jfieldID messageGiveawayPrizeStars::star_count_fieldID;
jfieldID messageGiveawayPrizeStars::transaction_id_fieldID;
jfieldID messageGiveawayPrizeStars::boosted_chat_id_fieldID;
jfieldID messageGiveawayPrizeStars::giveaway_message_id_fieldID;
jfieldID messageGiveawayPrizeStars::is_unclaimed_fieldID;
jfieldID messageGiveawayPrizeStars::sticker_fieldID;

messageGiveawayPrizeStars::messageGiveawayPrizeStars()
  : star_count_()
  , transaction_id_()
  , boosted_chat_id_()
  , giveaway_message_id_()
  , is_unclaimed_()
  , sticker_()
{}

messageGiveawayPrizeStars::messageGiveawayPrizeStars(int53 star_count_, string const &transaction_id_, int53 boosted_chat_id_, int53 giveaway_message_id_, bool is_unclaimed_, object_ptr<sticker> &&sticker_)
  : star_count_(star_count_)
  , transaction_id_(transaction_id_)
  , boosted_chat_id_(boosted_chat_id_)
  , giveaway_message_id_(giveaway_message_id_)
  , is_unclaimed_(is_unclaimed_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t messageGiveawayPrizeStars::ID;

object_ptr<MessageContent> messageGiveawayPrizeStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGiveawayPrizeStars> res = make_object<messageGiveawayPrizeStars>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->transaction_id_ = jni::fetch_string(env, p, res->transaction_id_fieldID);
  res->boosted_chat_id_ = env->GetLongField(p, res->boosted_chat_id_fieldID);
  res->giveaway_message_id_ = env->GetLongField(p, res->giveaway_message_id_fieldID);
  res->is_unclaimed_ = (env->GetBooleanField(p, res->is_unclaimed_fieldID) != 0);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void messageGiveawayPrizeStars::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_);
  { jstring nextString = jni::to_jstring(env, transaction_id_); if (nextString) { env->SetObjectField(s, transaction_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, boosted_chat_id_fieldID, boosted_chat_id_);
  env->SetLongField(s, giveaway_message_id_fieldID, giveaway_message_id_);
  env->SetBooleanField(s, is_unclaimed_fieldID, is_unclaimed_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageGiveawayPrizeStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGiveawayPrizeStars");
    s.store_field("starCount", star_count_);
    s.store_field("transactionId", transaction_id_);
    s.store_field("boostedChatId", boosted_chat_id_);
    s.store_field("giveawayMessageId", giveaway_message_id_);
    s.store_field("isUnclaimed", is_unclaimed_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void messageGiveawayPrizeStars::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGiveawayPrizeStars").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    transaction_id_fieldID = jni::get_field_id(env, Class, "transactionId", "Ljava/lang/String;");
    boosted_chat_id_fieldID = jni::get_field_id(env, Class, "boostedChatId", "J");
    giveaway_message_id_fieldID = jni::get_field_id(env, Class, "giveawayMessageId", "J");
    is_unclaimed_fieldID = jni::get_field_id(env, Class, "isUnclaimed", "Z");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageGift::Class;
jfieldID messageGift::gift_fieldID;
jfieldID messageGift::sender_id_fieldID;
jfieldID messageGift::receiver_id_fieldID;
jfieldID messageGift::received_gift_id_fieldID;
jfieldID messageGift::text_fieldID;
jfieldID messageGift::unique_gift_number_fieldID;
jfieldID messageGift::sell_star_count_fieldID;
jfieldID messageGift::prepaid_upgrade_star_count_fieldID;
jfieldID messageGift::is_upgrade_separate_fieldID;
jfieldID messageGift::is_from_auction_fieldID;
jfieldID messageGift::is_private_fieldID;
jfieldID messageGift::is_saved_fieldID;
jfieldID messageGift::is_prepaid_upgrade_fieldID;
jfieldID messageGift::can_be_upgraded_fieldID;
jfieldID messageGift::was_converted_fieldID;
jfieldID messageGift::was_upgraded_fieldID;
jfieldID messageGift::was_refunded_fieldID;
jfieldID messageGift::upgraded_received_gift_id_fieldID;
jfieldID messageGift::prepaid_upgrade_hash_fieldID;

messageGift::messageGift()
  : gift_()
  , sender_id_()
  , receiver_id_()
  , received_gift_id_()
  , text_()
  , unique_gift_number_()
  , sell_star_count_()
  , prepaid_upgrade_star_count_()
  , is_upgrade_separate_()
  , is_from_auction_()
  , is_private_()
  , is_saved_()
  , is_prepaid_upgrade_()
  , can_be_upgraded_()
  , was_converted_()
  , was_upgraded_()
  , was_refunded_()
  , upgraded_received_gift_id_()
  , prepaid_upgrade_hash_()
{}

messageGift::messageGift(object_ptr<gift> &&gift_, object_ptr<MessageSender> &&sender_id_, object_ptr<MessageSender> &&receiver_id_, string const &received_gift_id_, object_ptr<formattedText> &&text_, int32 unique_gift_number_, int53 sell_star_count_, int53 prepaid_upgrade_star_count_, bool is_upgrade_separate_, bool is_from_auction_, bool is_private_, bool is_saved_, bool is_prepaid_upgrade_, bool can_be_upgraded_, bool was_converted_, bool was_upgraded_, bool was_refunded_, string const &upgraded_received_gift_id_, string const &prepaid_upgrade_hash_)
  : gift_(std::move(gift_))
  , sender_id_(std::move(sender_id_))
  , receiver_id_(std::move(receiver_id_))
  , received_gift_id_(received_gift_id_)
  , text_(std::move(text_))
  , unique_gift_number_(unique_gift_number_)
  , sell_star_count_(sell_star_count_)
  , prepaid_upgrade_star_count_(prepaid_upgrade_star_count_)
  , is_upgrade_separate_(is_upgrade_separate_)
  , is_from_auction_(is_from_auction_)
  , is_private_(is_private_)
  , is_saved_(is_saved_)
  , is_prepaid_upgrade_(is_prepaid_upgrade_)
  , can_be_upgraded_(can_be_upgraded_)
  , was_converted_(was_converted_)
  , was_upgraded_(was_upgraded_)
  , was_refunded_(was_refunded_)
  , upgraded_received_gift_id_(upgraded_received_gift_id_)
  , prepaid_upgrade_hash_(prepaid_upgrade_hash_)
{}

const std::int32_t messageGift::ID;

object_ptr<MessageContent> messageGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageGift> res = make_object<messageGift>();
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  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->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->unique_gift_number_ = env->GetIntField(p, res->unique_gift_number_fieldID);
  res->sell_star_count_ = env->GetLongField(p, res->sell_star_count_fieldID);
  res->prepaid_upgrade_star_count_ = env->GetLongField(p, res->prepaid_upgrade_star_count_fieldID);
  res->is_upgrade_separate_ = (env->GetBooleanField(p, res->is_upgrade_separate_fieldID) != 0);
  res->is_from_auction_ = (env->GetBooleanField(p, res->is_from_auction_fieldID) != 0);
  res->is_private_ = (env->GetBooleanField(p, res->is_private_fieldID) != 0);
  res->is_saved_ = (env->GetBooleanField(p, res->is_saved_fieldID) != 0);
  res->is_prepaid_upgrade_ = (env->GetBooleanField(p, res->is_prepaid_upgrade_fieldID) != 0);
  res->can_be_upgraded_ = (env->GetBooleanField(p, res->can_be_upgraded_fieldID) != 0);
  res->was_converted_ = (env->GetBooleanField(p, res->was_converted_fieldID) != 0);
  res->was_upgraded_ = (env->GetBooleanField(p, res->was_upgraded_fieldID) != 0);
  res->was_refunded_ = (env->GetBooleanField(p, res->was_refunded_fieldID) != 0);
  res->upgraded_received_gift_id_ = jni::fetch_string(env, p, res->upgraded_received_gift_id_fieldID);
  res->prepaid_upgrade_hash_ = jni::fetch_string(env, p, res->prepaid_upgrade_hash_fieldID);
  return std::move(res);
}

void messageGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  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); } }
  { jstring nextString = jni::to_jstring(env, received_gift_id_); if (nextString) { env->SetObjectField(s, received_gift_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, unique_gift_number_fieldID, unique_gift_number_);
  env->SetLongField(s, sell_star_count_fieldID, sell_star_count_);
  env->SetLongField(s, prepaid_upgrade_star_count_fieldID, prepaid_upgrade_star_count_);
  env->SetBooleanField(s, is_upgrade_separate_fieldID, is_upgrade_separate_);
  env->SetBooleanField(s, is_from_auction_fieldID, is_from_auction_);
  env->SetBooleanField(s, is_private_fieldID, is_private_);
  env->SetBooleanField(s, is_saved_fieldID, is_saved_);
  env->SetBooleanField(s, is_prepaid_upgrade_fieldID, is_prepaid_upgrade_);
  env->SetBooleanField(s, can_be_upgraded_fieldID, can_be_upgraded_);
  env->SetBooleanField(s, was_converted_fieldID, was_converted_);
  env->SetBooleanField(s, was_upgraded_fieldID, was_upgraded_);
  env->SetBooleanField(s, was_refunded_fieldID, was_refunded_);
  { jstring nextString = jni::to_jstring(env, upgraded_received_gift_id_); if (nextString) { env->SetObjectField(s, upgraded_received_gift_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, prepaid_upgrade_hash_); if (nextString) { env->SetObjectField(s, prepaid_upgrade_hash_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messageGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageGift");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    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_field("receivedGiftId", received_gift_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("uniqueGiftNumber", unique_gift_number_);
    s.store_field("sellStarCount", sell_star_count_);
    s.store_field("prepaidUpgradeStarCount", prepaid_upgrade_star_count_);
    s.store_field("isUpgradeSeparate", is_upgrade_separate_);
    s.store_field("isFromAuction", is_from_auction_);
    s.store_field("isPrivate", is_private_);
    s.store_field("isSaved", is_saved_);
    s.store_field("isPrepaidUpgrade", is_prepaid_upgrade_);
    s.store_field("canBeUpgraded", can_be_upgraded_);
    s.store_field("wasConverted", was_converted_);
    s.store_field("wasUpgraded", was_upgraded_);
    s.store_field("wasRefunded", was_refunded_);
    s.store_field("upgradedReceivedGiftId", upgraded_received_gift_id_);
    s.store_field("prepaidUpgradeHash", prepaid_upgrade_hash_);
    s.store_class_end();
  }
}

void messageGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageGift").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").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());
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    unique_gift_number_fieldID = jni::get_field_id(env, Class, "uniqueGiftNumber", "I");
    sell_star_count_fieldID = jni::get_field_id(env, Class, "sellStarCount", "J");
    prepaid_upgrade_star_count_fieldID = jni::get_field_id(env, Class, "prepaidUpgradeStarCount", "J");
    is_upgrade_separate_fieldID = jni::get_field_id(env, Class, "isUpgradeSeparate", "Z");
    is_from_auction_fieldID = jni::get_field_id(env, Class, "isFromAuction", "Z");
    is_private_fieldID = jni::get_field_id(env, Class, "isPrivate", "Z");
    is_saved_fieldID = jni::get_field_id(env, Class, "isSaved", "Z");
    is_prepaid_upgrade_fieldID = jni::get_field_id(env, Class, "isPrepaidUpgrade", "Z");
    can_be_upgraded_fieldID = jni::get_field_id(env, Class, "canBeUpgraded", "Z");
    was_converted_fieldID = jni::get_field_id(env, Class, "wasConverted", "Z");
    was_upgraded_fieldID = jni::get_field_id(env, Class, "wasUpgraded", "Z");
    was_refunded_fieldID = jni::get_field_id(env, Class, "wasRefunded", "Z");
    upgraded_received_gift_id_fieldID = jni::get_field_id(env, Class, "upgradedReceivedGiftId", "Ljava/lang/String;");
    prepaid_upgrade_hash_fieldID = jni::get_field_id(env, Class, "prepaidUpgradeHash", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageUpgradedGift::Class;
jfieldID messageUpgradedGift::gift_fieldID;
jfieldID messageUpgradedGift::sender_id_fieldID;
jfieldID messageUpgradedGift::receiver_id_fieldID;
jfieldID messageUpgradedGift::origin_fieldID;
jfieldID messageUpgradedGift::received_gift_id_fieldID;
jfieldID messageUpgradedGift::is_saved_fieldID;
jfieldID messageUpgradedGift::can_be_transferred_fieldID;
jfieldID messageUpgradedGift::was_transferred_fieldID;
jfieldID messageUpgradedGift::transfer_star_count_fieldID;
jfieldID messageUpgradedGift::drop_original_details_star_count_fieldID;
jfieldID messageUpgradedGift::next_transfer_date_fieldID;
jfieldID messageUpgradedGift::next_resale_date_fieldID;
jfieldID messageUpgradedGift::export_date_fieldID;
jfieldID messageUpgradedGift::craft_date_fieldID;

messageUpgradedGift::messageUpgradedGift()
  : gift_()
  , sender_id_()
  , receiver_id_()
  , origin_()
  , received_gift_id_()
  , is_saved_()
  , can_be_transferred_()
  , was_transferred_()
  , transfer_star_count_()
  , drop_original_details_star_count_()
  , next_transfer_date_()
  , next_resale_date_()
  , export_date_()
  , craft_date_()
{}

messageUpgradedGift::messageUpgradedGift(object_ptr<upgradedGift> &&gift_, object_ptr<MessageSender> &&sender_id_, object_ptr<MessageSender> &&receiver_id_, object_ptr<UpgradedGiftOrigin> &&origin_, string const &received_gift_id_, bool is_saved_, bool can_be_transferred_, bool was_transferred_, int53 transfer_star_count_, int53 drop_original_details_star_count_, int32 next_transfer_date_, int32 next_resale_date_, int32 export_date_, int32 craft_date_)
  : gift_(std::move(gift_))
  , sender_id_(std::move(sender_id_))
  , receiver_id_(std::move(receiver_id_))
  , origin_(std::move(origin_))
  , received_gift_id_(received_gift_id_)
  , is_saved_(is_saved_)
  , can_be_transferred_(can_be_transferred_)
  , was_transferred_(was_transferred_)
  , transfer_star_count_(transfer_star_count_)
  , drop_original_details_star_count_(drop_original_details_star_count_)
  , next_transfer_date_(next_transfer_date_)
  , next_resale_date_(next_resale_date_)
  , export_date_(export_date_)
  , craft_date_(craft_date_)
{}

const std::int32_t messageUpgradedGift::ID;

object_ptr<MessageContent> messageUpgradedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageUpgradedGift> res = make_object<messageUpgradedGift>();
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  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->origin_ = jni::fetch_tl_object<UpgradedGiftOrigin>(env, jni::fetch_object(env, p, res->origin_fieldID));
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->is_saved_ = (env->GetBooleanField(p, res->is_saved_fieldID) != 0);
  res->can_be_transferred_ = (env->GetBooleanField(p, res->can_be_transferred_fieldID) != 0);
  res->was_transferred_ = (env->GetBooleanField(p, res->was_transferred_fieldID) != 0);
  res->transfer_star_count_ = env->GetLongField(p, res->transfer_star_count_fieldID);
  res->drop_original_details_star_count_ = env->GetLongField(p, res->drop_original_details_star_count_fieldID);
  res->next_transfer_date_ = env->GetIntField(p, res->next_transfer_date_fieldID);
  res->next_resale_date_ = env->GetIntField(p, res->next_resale_date_fieldID);
  res->export_date_ = env->GetIntField(p, res->export_date_fieldID);
  res->craft_date_ = env->GetIntField(p, res->craft_date_fieldID);
  return std::move(res);
}

void messageUpgradedGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  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 (origin_ != nullptr) { jobject next; origin_->store(env, next); if (next) { env->SetObjectField(s, origin_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, received_gift_id_); if (nextString) { env->SetObjectField(s, received_gift_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_saved_fieldID, is_saved_);
  env->SetBooleanField(s, can_be_transferred_fieldID, can_be_transferred_);
  env->SetBooleanField(s, was_transferred_fieldID, was_transferred_);
  env->SetLongField(s, transfer_star_count_fieldID, transfer_star_count_);
  env->SetLongField(s, drop_original_details_star_count_fieldID, drop_original_details_star_count_);
  env->SetIntField(s, next_transfer_date_fieldID, next_transfer_date_);
  env->SetIntField(s, next_resale_date_fieldID, next_resale_date_);
  env->SetIntField(s, export_date_fieldID, export_date_);
  env->SetIntField(s, craft_date_fieldID, craft_date_);
}

void messageUpgradedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageUpgradedGift");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    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("origin", static_cast<const BaseObject *>(origin_.get()));
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_field("isSaved", is_saved_);
    s.store_field("canBeTransferred", can_be_transferred_);
    s.store_field("wasTransferred", was_transferred_);
    s.store_field("transferStarCount", transfer_star_count_);
    s.store_field("dropOriginalDetailsStarCount", drop_original_details_star_count_);
    s.store_field("nextTransferDate", next_transfer_date_);
    s.store_field("nextResaleDate", next_resale_date_);
    s.store_field("exportDate", export_date_);
    s.store_field("craftDate", craft_date_);
    s.store_class_end();
  }
}

void messageUpgradedGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageUpgradedGift").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").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());
    origin_fieldID = jni::get_field_id(env, Class, "origin", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftOrigin;").c_str());
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    is_saved_fieldID = jni::get_field_id(env, Class, "isSaved", "Z");
    can_be_transferred_fieldID = jni::get_field_id(env, Class, "canBeTransferred", "Z");
    was_transferred_fieldID = jni::get_field_id(env, Class, "wasTransferred", "Z");
    transfer_star_count_fieldID = jni::get_field_id(env, Class, "transferStarCount", "J");
    drop_original_details_star_count_fieldID = jni::get_field_id(env, Class, "dropOriginalDetailsStarCount", "J");
    next_transfer_date_fieldID = jni::get_field_id(env, Class, "nextTransferDate", "I");
    next_resale_date_fieldID = jni::get_field_id(env, Class, "nextResaleDate", "I");
    export_date_fieldID = jni::get_field_id(env, Class, "exportDate", "I");
    craft_date_fieldID = jni::get_field_id(env, Class, "craftDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageRefundedUpgradedGift::Class;
jfieldID messageRefundedUpgradedGift::gift_fieldID;
jfieldID messageRefundedUpgradedGift::sender_id_fieldID;
jfieldID messageRefundedUpgradedGift::receiver_id_fieldID;
jfieldID messageRefundedUpgradedGift::origin_fieldID;

messageRefundedUpgradedGift::messageRefundedUpgradedGift()
  : gift_()
  , sender_id_()
  , receiver_id_()
  , origin_()
{}

messageRefundedUpgradedGift::messageRefundedUpgradedGift(object_ptr<gift> &&gift_, object_ptr<MessageSender> &&sender_id_, object_ptr<MessageSender> &&receiver_id_, object_ptr<UpgradedGiftOrigin> &&origin_)
  : gift_(std::move(gift_))
  , sender_id_(std::move(sender_id_))
  , receiver_id_(std::move(receiver_id_))
  , origin_(std::move(origin_))
{}

const std::int32_t messageRefundedUpgradedGift::ID;

object_ptr<MessageContent> messageRefundedUpgradedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageRefundedUpgradedGift> res = make_object<messageRefundedUpgradedGift>();
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  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->origin_ = jni::fetch_tl_object<UpgradedGiftOrigin>(env, jni::fetch_object(env, p, res->origin_fieldID));
  return std::move(res);
}

void messageRefundedUpgradedGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  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 (origin_ != nullptr) { jobject next; origin_->store(env, next); if (next) { env->SetObjectField(s, origin_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageRefundedUpgradedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageRefundedUpgradedGift");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    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("origin", static_cast<const BaseObject *>(origin_.get()));
    s.store_class_end();
  }
}

void messageRefundedUpgradedGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageRefundedUpgradedGift").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").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());
    origin_fieldID = jni::get_field_id(env, Class, "origin", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftOrigin;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageUpgradedGiftPurchaseOffer::Class;
jfieldID messageUpgradedGiftPurchaseOffer::gift_fieldID;
jfieldID messageUpgradedGiftPurchaseOffer::state_fieldID;
jfieldID messageUpgradedGiftPurchaseOffer::price_fieldID;
jfieldID messageUpgradedGiftPurchaseOffer::expiration_date_fieldID;

messageUpgradedGiftPurchaseOffer::messageUpgradedGiftPurchaseOffer()
  : gift_()
  , state_()
  , price_()
  , expiration_date_()
{}

messageUpgradedGiftPurchaseOffer::messageUpgradedGiftPurchaseOffer(object_ptr<upgradedGift> &&gift_, object_ptr<GiftPurchaseOfferState> &&state_, object_ptr<GiftResalePrice> &&price_, int32 expiration_date_)
  : gift_(std::move(gift_))
  , state_(std::move(state_))
  , price_(std::move(price_))
  , expiration_date_(expiration_date_)
{}

const std::int32_t messageUpgradedGiftPurchaseOffer::ID;

object_ptr<MessageContent> messageUpgradedGiftPurchaseOffer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageUpgradedGiftPurchaseOffer> res = make_object<messageUpgradedGiftPurchaseOffer>();
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->state_ = jni::fetch_tl_object<GiftPurchaseOfferState>(env, jni::fetch_object(env, p, res->state_fieldID));
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  return std::move(res);
}

void messageUpgradedGiftPurchaseOffer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  if (state_ != nullptr) { jobject next; state_->store(env, next); if (next) { env->SetObjectField(s, state_fieldID, next); env->DeleteLocalRef(next); } }
  if (price_ != nullptr) { jobject next; price_->store(env, next); if (next) { env->SetObjectField(s, price_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, expiration_date_fieldID, expiration_date_);
}

void messageUpgradedGiftPurchaseOffer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageUpgradedGiftPurchaseOffer");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_object_field("state", static_cast<const BaseObject *>(state_.get()));
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_field("expirationDate", expiration_date_);
    s.store_class_end();
  }
}

void messageUpgradedGiftPurchaseOffer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageUpgradedGiftPurchaseOffer").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    state_fieldID = jni::get_field_id(env, Class, "state", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftPurchaseOfferState;").c_str());
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftResalePrice;").c_str());
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageUpgradedGiftPurchaseOfferRejected::Class;
jfieldID messageUpgradedGiftPurchaseOfferRejected::gift_fieldID;
jfieldID messageUpgradedGiftPurchaseOfferRejected::price_fieldID;
jfieldID messageUpgradedGiftPurchaseOfferRejected::offer_message_id_fieldID;
jfieldID messageUpgradedGiftPurchaseOfferRejected::was_expired_fieldID;

messageUpgradedGiftPurchaseOfferRejected::messageUpgradedGiftPurchaseOfferRejected()
  : gift_()
  , price_()
  , offer_message_id_()
  , was_expired_()
{}

messageUpgradedGiftPurchaseOfferRejected::messageUpgradedGiftPurchaseOfferRejected(object_ptr<upgradedGift> &&gift_, object_ptr<GiftResalePrice> &&price_, int53 offer_message_id_, bool was_expired_)
  : gift_(std::move(gift_))
  , price_(std::move(price_))
  , offer_message_id_(offer_message_id_)
  , was_expired_(was_expired_)
{}

const std::int32_t messageUpgradedGiftPurchaseOfferRejected::ID;

object_ptr<MessageContent> messageUpgradedGiftPurchaseOfferRejected::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageUpgradedGiftPurchaseOfferRejected> res = make_object<messageUpgradedGiftPurchaseOfferRejected>();
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  res->offer_message_id_ = env->GetLongField(p, res->offer_message_id_fieldID);
  res->was_expired_ = (env->GetBooleanField(p, res->was_expired_fieldID) != 0);
  return std::move(res);
}

void messageUpgradedGiftPurchaseOfferRejected::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  if (price_ != nullptr) { jobject next; price_->store(env, next); if (next) { env->SetObjectField(s, price_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, offer_message_id_fieldID, offer_message_id_);
  env->SetBooleanField(s, was_expired_fieldID, was_expired_);
}

void messageUpgradedGiftPurchaseOfferRejected::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageUpgradedGiftPurchaseOfferRejected");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_field("offerMessageId", offer_message_id_);
    s.store_field("wasExpired", was_expired_);
    s.store_class_end();
  }
}

void messageUpgradedGiftPurchaseOfferRejected::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageUpgradedGiftPurchaseOfferRejected").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftResalePrice;").c_str());
    offer_message_id_fieldID = jni::get_field_id(env, Class, "offerMessageId", "J");
    was_expired_fieldID = jni::get_field_id(env, Class, "wasExpired", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messagePaidMessagesRefunded::Class;
jfieldID messagePaidMessagesRefunded::message_count_fieldID;
jfieldID messagePaidMessagesRefunded::star_count_fieldID;

messagePaidMessagesRefunded::messagePaidMessagesRefunded()
  : message_count_()
  , star_count_()
{}

messagePaidMessagesRefunded::messagePaidMessagesRefunded(int32 message_count_, int53 star_count_)
  : message_count_(message_count_)
  , star_count_(star_count_)
{}

const std::int32_t messagePaidMessagesRefunded::ID;

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

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

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

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

jclass messagePaidMessagePriceChanged::Class;
jfieldID messagePaidMessagePriceChanged::paid_message_star_count_fieldID;

messagePaidMessagePriceChanged::messagePaidMessagePriceChanged()
  : paid_message_star_count_()
{}

messagePaidMessagePriceChanged::messagePaidMessagePriceChanged(int53 paid_message_star_count_)
  : paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t messagePaidMessagePriceChanged::ID;

object_ptr<MessageContent> messagePaidMessagePriceChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePaidMessagePriceChanged> res = make_object<messagePaidMessagePriceChanged>();
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return std::move(res);
}

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

void messagePaidMessagePriceChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePaidMessagePriceChanged");
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

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

jclass messageDirectMessagePriceChanged::Class;
jfieldID messageDirectMessagePriceChanged::is_enabled_fieldID;
jfieldID messageDirectMessagePriceChanged::paid_message_star_count_fieldID;

messageDirectMessagePriceChanged::messageDirectMessagePriceChanged()
  : is_enabled_()
  , paid_message_star_count_()
{}

messageDirectMessagePriceChanged::messageDirectMessagePriceChanged(bool is_enabled_, int53 paid_message_star_count_)
  : is_enabled_(is_enabled_)
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t messageDirectMessagePriceChanged::ID;

object_ptr<MessageContent> messageDirectMessagePriceChanged::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageDirectMessagePriceChanged> res = make_object<messageDirectMessagePriceChanged>();
  res->is_enabled_ = (env->GetBooleanField(p, res->is_enabled_fieldID) != 0);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return std::move(res);
}

void messageDirectMessagePriceChanged::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_enabled_fieldID, is_enabled_);
  env->SetLongField(s, paid_message_star_count_fieldID, paid_message_star_count_);
}

void messageDirectMessagePriceChanged::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageDirectMessagePriceChanged");
    s.store_field("isEnabled", is_enabled_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

void messageDirectMessagePriceChanged::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageDirectMessagePriceChanged").c_str());
    is_enabled_fieldID = jni::get_field_id(env, Class, "isEnabled", "Z");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass messageChecklistTasksDone::Class;
jfieldID messageChecklistTasksDone::checklist_message_id_fieldID;
jfieldID messageChecklistTasksDone::marked_as_done_task_ids_fieldID;
jfieldID messageChecklistTasksDone::marked_as_not_done_task_ids_fieldID;

messageChecklistTasksDone::messageChecklistTasksDone()
  : checklist_message_id_()
  , marked_as_done_task_ids_()
  , marked_as_not_done_task_ids_()
{}

messageChecklistTasksDone::messageChecklistTasksDone(int53 checklist_message_id_, array<int32> &&marked_as_done_task_ids_, array<int32> &&marked_as_not_done_task_ids_)
  : checklist_message_id_(checklist_message_id_)
  , marked_as_done_task_ids_(std::move(marked_as_done_task_ids_))
  , marked_as_not_done_task_ids_(std::move(marked_as_not_done_task_ids_))
{}

const std::int32_t messageChecklistTasksDone::ID;

object_ptr<MessageContent> messageChecklistTasksDone::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChecklistTasksDone> res = make_object<messageChecklistTasksDone>();
  res->checklist_message_id_ = env->GetLongField(p, res->checklist_message_id_fieldID);
  res->marked_as_done_task_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->marked_as_done_task_ids_fieldID));
  res->marked_as_not_done_task_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->marked_as_not_done_task_ids_fieldID));
  return std::move(res);
}

void messageChecklistTasksDone::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, checklist_message_id_fieldID, checklist_message_id_);
  { auto arr_tmp_ = jni::store_vector(env, marked_as_done_task_ids_); if (arr_tmp_) { env->SetObjectField(s, marked_as_done_task_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, marked_as_not_done_task_ids_); if (arr_tmp_) { env->SetObjectField(s, marked_as_not_done_task_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageChecklistTasksDone::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChecklistTasksDone");
    s.store_field("checklistMessageId", checklist_message_id_);
    { s.store_vector_begin("markedAsDoneTaskIds", marked_as_done_task_ids_.size()); for (const auto &_value : marked_as_done_task_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("markedAsNotDoneTaskIds", marked_as_not_done_task_ids_.size()); for (const auto &_value : marked_as_not_done_task_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void messageChecklistTasksDone::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageChecklistTasksDone").c_str());
    checklist_message_id_fieldID = jni::get_field_id(env, Class, "checklistMessageId", "J");
    marked_as_done_task_ids_fieldID = jni::get_field_id(env, Class, "markedAsDoneTaskIds", "[I");
    marked_as_not_done_task_ids_fieldID = jni::get_field_id(env, Class, "markedAsNotDoneTaskIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass messageChecklistTasksAdded::Class;
jfieldID messageChecklistTasksAdded::checklist_message_id_fieldID;
jfieldID messageChecklistTasksAdded::tasks_fieldID;

messageChecklistTasksAdded::messageChecklistTasksAdded()
  : checklist_message_id_()
  , tasks_()
{}

messageChecklistTasksAdded::messageChecklistTasksAdded(int53 checklist_message_id_, array<object_ptr<checklistTask>> &&tasks_)
  : checklist_message_id_(checklist_message_id_)
  , tasks_(std::move(tasks_))
{}

const std::int32_t messageChecklistTasksAdded::ID;

object_ptr<MessageContent> messageChecklistTasksAdded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChecklistTasksAdded> res = make_object<messageChecklistTasksAdded>();
  res->checklist_message_id_ = env->GetLongField(p, res->checklist_message_id_fieldID);
  res->tasks_ = jni::FetchVector<checklistTask>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->tasks_fieldID));
  return std::move(res);
}

void messageChecklistTasksAdded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, checklist_message_id_fieldID, checklist_message_id_);
  { auto arr_tmp_ = jni::store_vector(env, tasks_); if (arr_tmp_) { env->SetObjectField(s, tasks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageChecklistTasksAdded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChecklistTasksAdded");
    s.store_field("checklistMessageId", checklist_message_id_);
    { s.store_vector_begin("tasks", tasks_.size()); for (const auto &_value : tasks_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void messageChecklistTasksAdded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageChecklistTasksAdded").c_str());
    checklist_message_id_fieldID = jni::get_field_id(env, Class, "checklistMessageId", "J");
    tasks_fieldID = jni::get_field_id(env, Class, "tasks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChecklistTask;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageSuggestedPostApprovalFailed::Class;
jfieldID messageSuggestedPostApprovalFailed::suggested_post_message_id_fieldID;
jfieldID messageSuggestedPostApprovalFailed::price_fieldID;

messageSuggestedPostApprovalFailed::messageSuggestedPostApprovalFailed()
  : suggested_post_message_id_()
  , price_()
{}

messageSuggestedPostApprovalFailed::messageSuggestedPostApprovalFailed(int53 suggested_post_message_id_, object_ptr<SuggestedPostPrice> &&price_)
  : suggested_post_message_id_(suggested_post_message_id_)
  , price_(std::move(price_))
{}

const std::int32_t messageSuggestedPostApprovalFailed::ID;

object_ptr<MessageContent> messageSuggestedPostApprovalFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSuggestedPostApprovalFailed> res = make_object<messageSuggestedPostApprovalFailed>();
  res->suggested_post_message_id_ = env->GetLongField(p, res->suggested_post_message_id_fieldID);
  res->price_ = jni::fetch_tl_object<SuggestedPostPrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  return std::move(res);
}

void messageSuggestedPostApprovalFailed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, suggested_post_message_id_fieldID, suggested_post_message_id_);
  if (price_ != nullptr) { jobject next; price_->store(env, next); if (next) { env->SetObjectField(s, price_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageSuggestedPostApprovalFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSuggestedPostApprovalFailed");
    s.store_field("suggestedPostMessageId", suggested_post_message_id_);
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_class_end();
  }
}

void messageSuggestedPostApprovalFailed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSuggestedPostApprovalFailed").c_str());
    suggested_post_message_id_fieldID = jni::get_field_id(env, Class, "suggestedPostMessageId", "J");
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostPrice;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageSuggestedPostApproved::Class;
jfieldID messageSuggestedPostApproved::suggested_post_message_id_fieldID;
jfieldID messageSuggestedPostApproved::price_fieldID;
jfieldID messageSuggestedPostApproved::send_date_fieldID;

messageSuggestedPostApproved::messageSuggestedPostApproved()
  : suggested_post_message_id_()
  , price_()
  , send_date_()
{}

messageSuggestedPostApproved::messageSuggestedPostApproved(int53 suggested_post_message_id_, object_ptr<SuggestedPostPrice> &&price_, int32 send_date_)
  : suggested_post_message_id_(suggested_post_message_id_)
  , price_(std::move(price_))
  , send_date_(send_date_)
{}

const std::int32_t messageSuggestedPostApproved::ID;

object_ptr<MessageContent> messageSuggestedPostApproved::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSuggestedPostApproved> res = make_object<messageSuggestedPostApproved>();
  res->suggested_post_message_id_ = env->GetLongField(p, res->suggested_post_message_id_fieldID);
  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);
  return std::move(res);
}

void messageSuggestedPostApproved::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, suggested_post_message_id_fieldID, suggested_post_message_id_);
  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_);
}

void messageSuggestedPostApproved::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSuggestedPostApproved");
    s.store_field("suggestedPostMessageId", suggested_post_message_id_);
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_field("sendDate", send_date_);
    s.store_class_end();
  }
}

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

jclass messageSuggestedPostDeclined::Class;
jfieldID messageSuggestedPostDeclined::suggested_post_message_id_fieldID;
jfieldID messageSuggestedPostDeclined::comment_fieldID;

messageSuggestedPostDeclined::messageSuggestedPostDeclined()
  : suggested_post_message_id_()
  , comment_()
{}

messageSuggestedPostDeclined::messageSuggestedPostDeclined(int53 suggested_post_message_id_, string const &comment_)
  : suggested_post_message_id_(suggested_post_message_id_)
  , comment_(comment_)
{}

const std::int32_t messageSuggestedPostDeclined::ID;

object_ptr<MessageContent> messageSuggestedPostDeclined::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSuggestedPostDeclined> res = make_object<messageSuggestedPostDeclined>();
  res->suggested_post_message_id_ = env->GetLongField(p, res->suggested_post_message_id_fieldID);
  res->comment_ = jni::fetch_string(env, p, res->comment_fieldID);
  return std::move(res);
}

void messageSuggestedPostDeclined::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, suggested_post_message_id_fieldID, suggested_post_message_id_);
  { jstring nextString = jni::to_jstring(env, comment_); if (nextString) { env->SetObjectField(s, comment_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messageSuggestedPostDeclined::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSuggestedPostDeclined");
    s.store_field("suggestedPostMessageId", suggested_post_message_id_);
    s.store_field("comment", comment_);
    s.store_class_end();
  }
}

void messageSuggestedPostDeclined::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSuggestedPostDeclined").c_str());
    suggested_post_message_id_fieldID = jni::get_field_id(env, Class, "suggestedPostMessageId", "J");
    comment_fieldID = jni::get_field_id(env, Class, "comment", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageSuggestedPostPaid::Class;
jfieldID messageSuggestedPostPaid::suggested_post_message_id_fieldID;
jfieldID messageSuggestedPostPaid::star_amount_fieldID;
jfieldID messageSuggestedPostPaid::ton_amount_fieldID;

messageSuggestedPostPaid::messageSuggestedPostPaid()
  : suggested_post_message_id_()
  , star_amount_()
  , ton_amount_()
{}

messageSuggestedPostPaid::messageSuggestedPostPaid(int53 suggested_post_message_id_, object_ptr<starAmount> &&star_amount_, int53 ton_amount_)
  : suggested_post_message_id_(suggested_post_message_id_)
  , star_amount_(std::move(star_amount_))
  , ton_amount_(ton_amount_)
{}

const std::int32_t messageSuggestedPostPaid::ID;

object_ptr<MessageContent> messageSuggestedPostPaid::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSuggestedPostPaid> res = make_object<messageSuggestedPostPaid>();
  res->suggested_post_message_id_ = env->GetLongField(p, res->suggested_post_message_id_fieldID);
  res->star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->star_amount_fieldID));
  res->ton_amount_ = env->GetLongField(p, res->ton_amount_fieldID);
  return std::move(res);
}

void messageSuggestedPostPaid::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, suggested_post_message_id_fieldID, suggested_post_message_id_);
  if (star_amount_ != nullptr) { jobject next; star_amount_->store(env, next); if (next) { env->SetObjectField(s, star_amount_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, ton_amount_fieldID, ton_amount_);
}

void messageSuggestedPostPaid::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSuggestedPostPaid");
    s.store_field("suggestedPostMessageId", suggested_post_message_id_);
    s.store_object_field("starAmount", static_cast<const BaseObject *>(star_amount_.get()));
    s.store_field("tonAmount", ton_amount_);
    s.store_class_end();
  }
}

void messageSuggestedPostPaid::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSuggestedPostPaid").c_str());
    suggested_post_message_id_fieldID = jni::get_field_id(env, Class, "suggestedPostMessageId", "J");
    star_amount_fieldID = jni::get_field_id(env, Class, "starAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    ton_amount_fieldID = jni::get_field_id(env, Class, "tonAmount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass messageSuggestedPostRefunded::Class;
jfieldID messageSuggestedPostRefunded::suggested_post_message_id_fieldID;
jfieldID messageSuggestedPostRefunded::reason_fieldID;

messageSuggestedPostRefunded::messageSuggestedPostRefunded()
  : suggested_post_message_id_()
  , reason_()
{}

messageSuggestedPostRefunded::messageSuggestedPostRefunded(int53 suggested_post_message_id_, object_ptr<SuggestedPostRefundReason> &&reason_)
  : suggested_post_message_id_(suggested_post_message_id_)
  , reason_(std::move(reason_))
{}

const std::int32_t messageSuggestedPostRefunded::ID;

object_ptr<MessageContent> messageSuggestedPostRefunded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSuggestedPostRefunded> res = make_object<messageSuggestedPostRefunded>();
  res->suggested_post_message_id_ = env->GetLongField(p, res->suggested_post_message_id_fieldID);
  res->reason_ = jni::fetch_tl_object<SuggestedPostRefundReason>(env, jni::fetch_object(env, p, res->reason_fieldID));
  return std::move(res);
}

void messageSuggestedPostRefunded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, suggested_post_message_id_fieldID, suggested_post_message_id_);
  if (reason_ != nullptr) { jobject next; reason_->store(env, next); if (next) { env->SetObjectField(s, reason_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageSuggestedPostRefunded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSuggestedPostRefunded");
    s.store_field("suggestedPostMessageId", suggested_post_message_id_);
    s.store_object_field("reason", static_cast<const BaseObject *>(reason_.get()));
    s.store_class_end();
  }
}

void messageSuggestedPostRefunded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSuggestedPostRefunded").c_str());
    suggested_post_message_id_fieldID = jni::get_field_id(env, Class, "suggestedPostMessageId", "J");
    reason_fieldID = jni::get_field_id(env, Class, "reason", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostRefundReason;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageContactRegistered::Class;

messageContactRegistered::messageContactRegistered() {
}

const std::int32_t messageContactRegistered::ID;

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

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

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

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

jclass messageUsersShared::Class;
jfieldID messageUsersShared::users_fieldID;
jfieldID messageUsersShared::button_id_fieldID;

messageUsersShared::messageUsersShared()
  : users_()
  , button_id_()
{}

messageUsersShared::messageUsersShared(array<object_ptr<sharedUser>> &&users_, int32 button_id_)
  : users_(std::move(users_))
  , button_id_(button_id_)
{}

const std::int32_t messageUsersShared::ID;

object_ptr<MessageContent> messageUsersShared::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageUsersShared> res = make_object<messageUsersShared>();
  res->users_ = jni::FetchVector<sharedUser>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->users_fieldID));
  res->button_id_ = env->GetIntField(p, res->button_id_fieldID);
  return std::move(res);
}

void messageUsersShared::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, users_); if (arr_tmp_) { env->SetObjectField(s, users_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, button_id_fieldID, button_id_);
}

void messageUsersShared::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageUsersShared");
    { s.store_vector_begin("users", users_.size()); for (const auto &_value : users_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("buttonId", button_id_);
    s.store_class_end();
  }
}

void messageUsersShared::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageUsersShared").c_str());
    users_fieldID = jni::get_field_id(env, Class, "users", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$SharedUser;").c_str());
    button_id_fieldID = jni::get_field_id(env, Class, "buttonId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageChatShared::Class;
jfieldID messageChatShared::chat_fieldID;
jfieldID messageChatShared::button_id_fieldID;

messageChatShared::messageChatShared()
  : chat_()
  , button_id_()
{}

messageChatShared::messageChatShared(object_ptr<sharedChat> &&chat_, int32 button_id_)
  : chat_(std::move(chat_))
  , button_id_(button_id_)
{}

const std::int32_t messageChatShared::ID;

object_ptr<MessageContent> messageChatShared::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageChatShared> res = make_object<messageChatShared>();
  res->chat_ = jni::fetch_tl_object<sharedChat>(env, jni::fetch_object(env, p, res->chat_fieldID));
  res->button_id_ = env->GetIntField(p, res->button_id_fieldID);
  return std::move(res);
}

void messageChatShared::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (chat_ != nullptr) { jobject next; chat_->store(env, next); if (next) { env->SetObjectField(s, chat_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, button_id_fieldID, button_id_);
}

void messageChatShared::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageChatShared");
    s.store_object_field("chat", static_cast<const BaseObject *>(chat_.get()));
    s.store_field("buttonId", button_id_);
    s.store_class_end();
  }
}

void messageChatShared::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageChatShared").c_str());
    chat_fieldID = jni::get_field_id(env, Class, "chat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SharedChat;").c_str());
    button_id_fieldID = jni::get_field_id(env, Class, "buttonId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageBotWriteAccessAllowed::Class;
jfieldID messageBotWriteAccessAllowed::reason_fieldID;

messageBotWriteAccessAllowed::messageBotWriteAccessAllowed()
  : reason_()
{}

messageBotWriteAccessAllowed::messageBotWriteAccessAllowed(object_ptr<BotWriteAccessAllowReason> &&reason_)
  : reason_(std::move(reason_))
{}

const std::int32_t messageBotWriteAccessAllowed::ID;

object_ptr<MessageContent> messageBotWriteAccessAllowed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageBotWriteAccessAllowed> res = make_object<messageBotWriteAccessAllowed>();
  res->reason_ = jni::fetch_tl_object<BotWriteAccessAllowReason>(env, jni::fetch_object(env, p, res->reason_fieldID));
  return std::move(res);
}

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

void messageBotWriteAccessAllowed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageBotWriteAccessAllowed");
    s.store_object_field("reason", static_cast<const BaseObject *>(reason_.get()));
    s.store_class_end();
  }
}

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

jclass messageWebAppDataSent::Class;
jfieldID messageWebAppDataSent::button_text_fieldID;

messageWebAppDataSent::messageWebAppDataSent()
  : button_text_()
{}

messageWebAppDataSent::messageWebAppDataSent(string const &button_text_)
  : button_text_(button_text_)
{}

const std::int32_t messageWebAppDataSent::ID;

object_ptr<MessageContent> messageWebAppDataSent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageWebAppDataSent> res = make_object<messageWebAppDataSent>();
  res->button_text_ = jni::fetch_string(env, p, res->button_text_fieldID);
  return std::move(res);
}

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

void messageWebAppDataSent::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageWebAppDataSent");
    s.store_field("buttonText", button_text_);
    s.store_class_end();
  }
}

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

jclass messageWebAppDataReceived::Class;
jfieldID messageWebAppDataReceived::button_text_fieldID;
jfieldID messageWebAppDataReceived::data_fieldID;

messageWebAppDataReceived::messageWebAppDataReceived()
  : button_text_()
  , data_()
{}

messageWebAppDataReceived::messageWebAppDataReceived(string const &button_text_, string const &data_)
  : button_text_(button_text_)
  , data_(data_)
{}

const std::int32_t messageWebAppDataReceived::ID;

object_ptr<MessageContent> messageWebAppDataReceived::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageWebAppDataReceived> res = make_object<messageWebAppDataReceived>();
  res->button_text_ = jni::fetch_string(env, p, res->button_text_fieldID);
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  return std::move(res);
}

void messageWebAppDataReceived::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, button_text_); if (nextString) { env->SetObjectField(s, button_text_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, data_); if (nextString) { env->SetObjectField(s, data_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messageWebAppDataReceived::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageWebAppDataReceived");
    s.store_field("buttonText", button_text_);
    s.store_field("data", data_);
    s.store_class_end();
  }
}

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

messagePassportDataSent::messagePassportDataSent()
  : types_()
{}

messagePassportDataSent::messagePassportDataSent(array<object_ptr<PassportElementType>> &&types_)
  : types_(std::move(types_))
{}

const std::int32_t messagePassportDataSent::ID;

object_ptr<MessageContent> messagePassportDataSent::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePassportDataSent> res = make_object<messagePassportDataSent>();
  res->types_ = jni::FetchVector<PassportElementType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->types_fieldID));
  return std::move(res);
}

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

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

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

jclass messagePassportDataReceived::Class;
jfieldID messagePassportDataReceived::elements_fieldID;
jfieldID messagePassportDataReceived::credentials_fieldID;

messagePassportDataReceived::messagePassportDataReceived()
  : elements_()
  , credentials_()
{}

messagePassportDataReceived::messagePassportDataReceived(array<object_ptr<encryptedPassportElement>> &&elements_, object_ptr<encryptedCredentials> &&credentials_)
  : elements_(std::move(elements_))
  , credentials_(std::move(credentials_))
{}

const std::int32_t messagePassportDataReceived::ID;

object_ptr<MessageContent> messagePassportDataReceived::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messagePassportDataReceived> res = make_object<messagePassportDataReceived>();
  res->elements_ = jni::FetchVector<encryptedPassportElement>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->elements_fieldID));
  res->credentials_ = jni::fetch_tl_object<encryptedCredentials>(env, jni::fetch_object(env, p, res->credentials_fieldID));
  return std::move(res);
}

void messagePassportDataReceived::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, elements_); if (arr_tmp_) { env->SetObjectField(s, elements_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (credentials_ != nullptr) { jobject next; credentials_->store(env, next); if (next) { env->SetObjectField(s, credentials_fieldID, next); env->DeleteLocalRef(next); } }
}

void messagePassportDataReceived::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePassportDataReceived");
    { s.store_vector_begin("elements", elements_.size()); for (const auto &_value : elements_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("credentials", static_cast<const BaseObject *>(credentials_.get()));
    s.store_class_end();
  }
}

void messagePassportDataReceived::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessagePassportDataReceived").c_str());
    elements_fieldID = jni::get_field_id(env, Class, "elements", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$EncryptedPassportElement;").c_str());
    credentials_fieldID = jni::get_field_id(env, Class, "credentials", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EncryptedCredentials;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageProximityAlertTriggered::Class;
jfieldID messageProximityAlertTriggered::traveler_id_fieldID;
jfieldID messageProximityAlertTriggered::watcher_id_fieldID;
jfieldID messageProximityAlertTriggered::distance_fieldID;

messageProximityAlertTriggered::messageProximityAlertTriggered()
  : traveler_id_()
  , watcher_id_()
  , distance_()
{}

messageProximityAlertTriggered::messageProximityAlertTriggered(object_ptr<MessageSender> &&traveler_id_, object_ptr<MessageSender> &&watcher_id_, int32 distance_)
  : traveler_id_(std::move(traveler_id_))
  , watcher_id_(std::move(watcher_id_))
  , distance_(distance_)
{}

const std::int32_t messageProximityAlertTriggered::ID;

object_ptr<MessageContent> messageProximityAlertTriggered::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageProximityAlertTriggered> res = make_object<messageProximityAlertTriggered>();
  res->traveler_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->traveler_id_fieldID));
  res->watcher_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->watcher_id_fieldID));
  res->distance_ = env->GetIntField(p, res->distance_fieldID);
  return std::move(res);
}

void messageProximityAlertTriggered::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (traveler_id_ != nullptr) { jobject next; traveler_id_->store(env, next); if (next) { env->SetObjectField(s, traveler_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (watcher_id_ != nullptr) { jobject next; watcher_id_->store(env, next); if (next) { env->SetObjectField(s, watcher_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, distance_fieldID, distance_);
}

void messageProximityAlertTriggered::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageProximityAlertTriggered");
    s.store_object_field("travelerId", static_cast<const BaseObject *>(traveler_id_.get()));
    s.store_object_field("watcherId", static_cast<const BaseObject *>(watcher_id_.get()));
    s.store_field("distance", distance_);
    s.store_class_end();
  }
}

void messageProximityAlertTriggered::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageProximityAlertTriggered").c_str());
    traveler_id_fieldID = jni::get_field_id(env, Class, "travelerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    watcher_id_fieldID = jni::get_field_id(env, Class, "watcherId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    distance_fieldID = jni::get_field_id(env, Class, "distance", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageUnsupported::Class;

messageUnsupported::messageUnsupported() {
}

const std::int32_t messageUnsupported::ID;

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

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

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

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

jclass messageForwardInfo::Class;
jfieldID messageForwardInfo::origin_fieldID;
jfieldID messageForwardInfo::date_fieldID;
jfieldID messageForwardInfo::source_fieldID;
jfieldID messageForwardInfo::public_service_announcement_type_fieldID;

messageForwardInfo::messageForwardInfo()
  : origin_()
  , date_()
  , source_()
  , public_service_announcement_type_()
{}

messageForwardInfo::messageForwardInfo(object_ptr<MessageOrigin> &&origin_, int32 date_, object_ptr<forwardSource> &&source_, string const &public_service_announcement_type_)
  : origin_(std::move(origin_))
  , date_(date_)
  , source_(std::move(source_))
  , public_service_announcement_type_(public_service_announcement_type_)
{}

const std::int32_t messageForwardInfo::ID;

object_ptr<messageForwardInfo> messageForwardInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageForwardInfo> res = make_object<messageForwardInfo>();
  res->origin_ = jni::fetch_tl_object<MessageOrigin>(env, jni::fetch_object(env, p, res->origin_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->source_ = jni::fetch_tl_object<forwardSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  res->public_service_announcement_type_ = jni::fetch_string(env, p, res->public_service_announcement_type_fieldID);
  return res;
}

void messageForwardInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (origin_ != nullptr) { jobject next; origin_->store(env, next); if (next) { env->SetObjectField(s, origin_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  if (source_ != nullptr) { jobject next; source_->store(env, next); if (next) { env->SetObjectField(s, source_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, public_service_announcement_type_); if (nextString) { env->SetObjectField(s, public_service_announcement_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messageForwardInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageForwardInfo");
    s.store_object_field("origin", static_cast<const BaseObject *>(origin_.get()));
    s.store_field("date", date_);
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_field("publicServiceAnnouncementType", public_service_announcement_type_);
    s.store_class_end();
  }
}

void messageForwardInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageForwardInfo").c_str());
    origin_fieldID = jni::get_field_id(env, Class, "origin", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageOrigin;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForwardSource;").c_str());
    public_service_announcement_type_fieldID = jni::get_field_id(env, Class, "publicServiceAnnouncementType", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageImportInfo::Class;
jfieldID messageImportInfo::sender_name_fieldID;
jfieldID messageImportInfo::date_fieldID;

messageImportInfo::messageImportInfo()
  : sender_name_()
  , date_()
{}

messageImportInfo::messageImportInfo(string const &sender_name_, int32 date_)
  : sender_name_(sender_name_)
  , date_(date_)
{}

const std::int32_t messageImportInfo::ID;

object_ptr<messageImportInfo> messageImportInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageImportInfo> res = make_object<messageImportInfo>();
  res->sender_name_ = jni::fetch_string(env, p, res->sender_name_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void messageImportInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, sender_name_); if (nextString) { env->SetObjectField(s, sender_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, date_fieldID, date_);
}

void messageImportInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageImportInfo");
    s.store_field("senderName", sender_name_);
    s.store_field("date", date_);
    s.store_class_end();
  }
}

void messageImportInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageImportInfo").c_str());
    sender_name_fieldID = jni::get_field_id(env, Class, "senderName", "Ljava/lang/String;");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass messageLinkInfo::Class;
jfieldID messageLinkInfo::is_public_fieldID;
jfieldID messageLinkInfo::chat_id_fieldID;
jfieldID messageLinkInfo::topic_id_fieldID;
jfieldID messageLinkInfo::message_fieldID;
jfieldID messageLinkInfo::media_timestamp_fieldID;
jfieldID messageLinkInfo::checklist_task_id_fieldID;
jfieldID messageLinkInfo::poll_option_id_fieldID;
jfieldID messageLinkInfo::for_album_fieldID;

messageLinkInfo::messageLinkInfo()
  : is_public_()
  , chat_id_()
  , topic_id_()
  , message_()
  , media_timestamp_()
  , checklist_task_id_()
  , poll_option_id_()
  , for_album_()
{}

messageLinkInfo::messageLinkInfo(bool is_public_, int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<message> &&message_, int32 media_timestamp_, int32 checklist_task_id_, string const &poll_option_id_, bool for_album_)
  : is_public_(is_public_)
  , chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , message_(std::move(message_))
  , media_timestamp_(media_timestamp_)
  , checklist_task_id_(checklist_task_id_)
  , poll_option_id_(poll_option_id_)
  , for_album_(for_album_)
{}

const std::int32_t messageLinkInfo::ID;

object_ptr<messageLinkInfo> messageLinkInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageLinkInfo> res = make_object<messageLinkInfo>();
  res->is_public_ = (env->GetBooleanField(p, res->is_public_fieldID) != 0);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->media_timestamp_ = env->GetIntField(p, res->media_timestamp_fieldID);
  res->checklist_task_id_ = env->GetIntField(p, res->checklist_task_id_fieldID);
  res->poll_option_id_ = jni::fetch_string(env, p, res->poll_option_id_fieldID);
  res->for_album_ = (env->GetBooleanField(p, res->for_album_fieldID) != 0);
  return res;
}

void messageLinkInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_public_fieldID, is_public_);
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  if (topic_id_ != nullptr) { jobject next; topic_id_->store(env, next); if (next) { env->SetObjectField(s, topic_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, media_timestamp_fieldID, media_timestamp_);
  env->SetIntField(s, checklist_task_id_fieldID, checklist_task_id_);
  { jstring nextString = jni::to_jstring(env, poll_option_id_); if (nextString) { env->SetObjectField(s, poll_option_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, for_album_fieldID, for_album_);
}

void messageLinkInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageLinkInfo");
    s.store_field("isPublic", is_public_);
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_field("mediaTimestamp", media_timestamp_);
    s.store_field("checklistTaskId", checklist_task_id_);
    s.store_field("pollOptionId", poll_option_id_);
    s.store_field("forAlbum", for_album_);
    s.store_class_end();
  }
}

void messageLinkInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageLinkInfo").c_str());
    is_public_fieldID = jni::get_field_id(env, Class, "isPublic", "Z");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    media_timestamp_fieldID = jni::get_field_id(env, Class, "mediaTimestamp", "I");
    checklist_task_id_fieldID = jni::get_field_id(env, Class, "checklistTaskId", "I");
    poll_option_id_fieldID = jni::get_field_id(env, Class, "pollOptionId", "Ljava/lang/String;");
    for_album_fieldID = jni::get_field_id(env, Class, "forAlbum", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass MessageSender::Class;

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

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

jclass messageSenderUser::Class;
jfieldID messageSenderUser::user_id_fieldID;

messageSenderUser::messageSenderUser()
  : user_id_()
{}

messageSenderUser::messageSenderUser(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t messageSenderUser::ID;

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

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

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

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

jclass messageSenderChat::Class;
jfieldID messageSenderChat::chat_id_fieldID;

messageSenderChat::messageSenderChat()
  : chat_id_()
{}

messageSenderChat::messageSenderChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t messageSenderChat::ID;

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

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

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

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

jclass MessageSendingState::Class;

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

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

jclass messageSendingStatePending::Class;
jfieldID messageSendingStatePending::sending_id_fieldID;

messageSendingStatePending::messageSendingStatePending()
  : sending_id_()
{}

messageSendingStatePending::messageSendingStatePending(int32 sending_id_)
  : sending_id_(sending_id_)
{}

const std::int32_t messageSendingStatePending::ID;

object_ptr<MessageSendingState> messageSendingStatePending::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSendingStatePending> res = make_object<messageSendingStatePending>();
  res->sending_id_ = env->GetIntField(p, res->sending_id_fieldID);
  return std::move(res);
}

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

void messageSendingStatePending::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSendingStatePending");
    s.store_field("sendingId", sending_id_);
    s.store_class_end();
  }
}

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

jclass messageSendingStateFailed::Class;
jfieldID messageSendingStateFailed::error_fieldID;
jfieldID messageSendingStateFailed::can_retry_fieldID;
jfieldID messageSendingStateFailed::need_another_sender_fieldID;
jfieldID messageSendingStateFailed::need_another_reply_quote_fieldID;
jfieldID messageSendingStateFailed::need_drop_reply_fieldID;
jfieldID messageSendingStateFailed::required_paid_message_star_count_fieldID;
jfieldID messageSendingStateFailed::retry_after_fieldID;

messageSendingStateFailed::messageSendingStateFailed()
  : error_()
  , can_retry_()
  , need_another_sender_()
  , need_another_reply_quote_()
  , need_drop_reply_()
  , required_paid_message_star_count_()
  , retry_after_()
{}

messageSendingStateFailed::messageSendingStateFailed(object_ptr<error> &&error_, bool can_retry_, bool need_another_sender_, bool need_another_reply_quote_, bool need_drop_reply_, int53 required_paid_message_star_count_, double retry_after_)
  : error_(std::move(error_))
  , can_retry_(can_retry_)
  , need_another_sender_(need_another_sender_)
  , need_another_reply_quote_(need_another_reply_quote_)
  , need_drop_reply_(need_drop_reply_)
  , required_paid_message_star_count_(required_paid_message_star_count_)
  , retry_after_(retry_after_)
{}

const std::int32_t messageSendingStateFailed::ID;

object_ptr<MessageSendingState> messageSendingStateFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSendingStateFailed> res = make_object<messageSendingStateFailed>();
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  res->can_retry_ = (env->GetBooleanField(p, res->can_retry_fieldID) != 0);
  res->need_another_sender_ = (env->GetBooleanField(p, res->need_another_sender_fieldID) != 0);
  res->need_another_reply_quote_ = (env->GetBooleanField(p, res->need_another_reply_quote_fieldID) != 0);
  res->need_drop_reply_ = (env->GetBooleanField(p, res->need_drop_reply_fieldID) != 0);
  res->required_paid_message_star_count_ = env->GetLongField(p, res->required_paid_message_star_count_fieldID);
  res->retry_after_ = env->GetDoubleField(p, res->retry_after_fieldID);
  return std::move(res);
}

void messageSendingStateFailed::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (error_ != nullptr) { jobject next; error_->store(env, next); if (next) { env->SetObjectField(s, error_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_retry_fieldID, can_retry_);
  env->SetBooleanField(s, need_another_sender_fieldID, need_another_sender_);
  env->SetBooleanField(s, need_another_reply_quote_fieldID, need_another_reply_quote_);
  env->SetBooleanField(s, need_drop_reply_fieldID, need_drop_reply_);
  env->SetLongField(s, required_paid_message_star_count_fieldID, required_paid_message_star_count_);
  env->SetDoubleField(s, retry_after_fieldID, retry_after_);
}

void messageSendingStateFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSendingStateFailed");
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_field("canRetry", can_retry_);
    s.store_field("needAnotherSender", need_another_sender_);
    s.store_field("needAnotherReplyQuote", need_another_reply_quote_);
    s.store_field("needDropReply", need_drop_reply_);
    s.store_field("requiredPaidMessageStarCount", required_paid_message_star_count_);
    s.store_field("retryAfter", retry_after_);
    s.store_class_end();
  }
}

void messageSendingStateFailed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageSendingStateFailed").c_str());
    error_fieldID = jni::get_field_id(env, Class, "error", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Error;").c_str());
    can_retry_fieldID = jni::get_field_id(env, Class, "canRetry", "Z");
    need_another_sender_fieldID = jni::get_field_id(env, Class, "needAnotherSender", "Z");
    need_another_reply_quote_fieldID = jni::get_field_id(env, Class, "needAnotherReplyQuote", "Z");
    need_drop_reply_fieldID = jni::get_field_id(env, Class, "needDropReply", "Z");
    required_paid_message_star_count_fieldID = jni::get_field_id(env, Class, "requiredPaidMessageStarCount", "J");
    retry_after_fieldID = jni::get_field_id(env, Class, "retryAfter", "D");
    return true;
  }();
  (void)is_inited;
}

jclass MessageTopic::Class;

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

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

jclass messageTopicThread::Class;
jfieldID messageTopicThread::message_thread_id_fieldID;

messageTopicThread::messageTopicThread()
  : message_thread_id_()
{}

messageTopicThread::messageTopicThread(int53 message_thread_id_)
  : message_thread_id_(message_thread_id_)
{}

const std::int32_t messageTopicThread::ID;

object_ptr<MessageTopic> messageTopicThread::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageTopicThread> res = make_object<messageTopicThread>();
  res->message_thread_id_ = env->GetLongField(p, res->message_thread_id_fieldID);
  return std::move(res);
}

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

void messageTopicThread::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageTopicThread");
    s.store_field("messageThreadId", message_thread_id_);
    s.store_class_end();
  }
}

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

jclass messageTopicForum::Class;
jfieldID messageTopicForum::forum_topic_id_fieldID;

messageTopicForum::messageTopicForum()
  : forum_topic_id_()
{}

messageTopicForum::messageTopicForum(int32 forum_topic_id_)
  : forum_topic_id_(forum_topic_id_)
{}

const std::int32_t messageTopicForum::ID;

object_ptr<MessageTopic> messageTopicForum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageTopicForum> res = make_object<messageTopicForum>();
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  return std::move(res);
}

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

void messageTopicForum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageTopicForum");
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_class_end();
  }
}

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

jclass messageTopicDirectMessages::Class;
jfieldID messageTopicDirectMessages::direct_messages_chat_topic_id_fieldID;

messageTopicDirectMessages::messageTopicDirectMessages()
  : direct_messages_chat_topic_id_()
{}

messageTopicDirectMessages::messageTopicDirectMessages(int53 direct_messages_chat_topic_id_)
  : direct_messages_chat_topic_id_(direct_messages_chat_topic_id_)
{}

const std::int32_t messageTopicDirectMessages::ID;

object_ptr<MessageTopic> messageTopicDirectMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageTopicDirectMessages> res = make_object<messageTopicDirectMessages>();
  res->direct_messages_chat_topic_id_ = env->GetLongField(p, res->direct_messages_chat_topic_id_fieldID);
  return std::move(res);
}

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

void messageTopicDirectMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageTopicDirectMessages");
    s.store_field("directMessagesChatTopicId", direct_messages_chat_topic_id_);
    s.store_class_end();
  }
}

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

jclass messageTopicSavedMessages::Class;
jfieldID messageTopicSavedMessages::saved_messages_topic_id_fieldID;

messageTopicSavedMessages::messageTopicSavedMessages()
  : saved_messages_topic_id_()
{}

messageTopicSavedMessages::messageTopicSavedMessages(int53 saved_messages_topic_id_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
{}

const std::int32_t messageTopicSavedMessages::ID;

object_ptr<MessageTopic> messageTopicSavedMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageTopicSavedMessages> res = make_object<messageTopicSavedMessages>();
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  return std::move(res);
}

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

void messageTopicSavedMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageTopicSavedMessages");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_class_end();
  }
}

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

jclass NotificationSettingsScope::Class;

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

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

jclass notificationSettingsScopePrivateChats::Class;

notificationSettingsScopePrivateChats::notificationSettingsScopePrivateChats() {
}

const std::int32_t notificationSettingsScopePrivateChats::ID;

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

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

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

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

jclass notificationSettingsScopeGroupChats::Class;

notificationSettingsScopeGroupChats::notificationSettingsScopeGroupChats() {
}

const std::int32_t notificationSettingsScopeGroupChats::ID;

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

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

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

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

jclass notificationSettingsScopeChannelChats::Class;

notificationSettingsScopeChannelChats::notificationSettingsScopeChannelChats() {
}

const std::int32_t notificationSettingsScopeChannelChats::ID;

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

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

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

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

jclass orderInfo::Class;
jfieldID orderInfo::name_fieldID;
jfieldID orderInfo::phone_number_fieldID;
jfieldID orderInfo::email_address_fieldID;
jfieldID orderInfo::shipping_address_fieldID;

orderInfo::orderInfo()
  : name_()
  , phone_number_()
  , email_address_()
  , shipping_address_()
{}

orderInfo::orderInfo(string const &name_, string const &phone_number_, string const &email_address_, object_ptr<address> &&shipping_address_)
  : name_(name_)
  , phone_number_(phone_number_)
  , email_address_(email_address_)
  , shipping_address_(std::move(shipping_address_))
{}

const std::int32_t orderInfo::ID;

object_ptr<orderInfo> orderInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<orderInfo> res = make_object<orderInfo>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->email_address_ = jni::fetch_string(env, p, res->email_address_fieldID);
  res->shipping_address_ = jni::fetch_tl_object<address>(env, jni::fetch_object(env, p, res->shipping_address_fieldID));
  return res;
}

void orderInfo::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); } }
  { jstring nextString = jni::to_jstring(env, phone_number_); if (nextString) { env->SetObjectField(s, phone_number_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, email_address_); if (nextString) { env->SetObjectField(s, email_address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (shipping_address_ != nullptr) { jobject next; shipping_address_->store(env, next); if (next) { env->SetObjectField(s, shipping_address_fieldID, next); env->DeleteLocalRef(next); } }
}

void orderInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OrderInfo");
    s.store_field("name", name_);
    s.store_field("phoneNumber", phone_number_);
    s.store_field("emailAddress", email_address_);
    s.store_object_field("shippingAddress", static_cast<const BaseObject *>(shipping_address_.get()));
    s.store_class_end();
  }
}

void orderInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$OrderInfo").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    email_address_fieldID = jni::get_field_id(env, Class, "emailAddress", "Ljava/lang/String;");
    shipping_address_fieldID = jni::get_field_id(env, Class, "shippingAddress", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Address;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass paymentResult::Class;
jfieldID paymentResult::success_fieldID;
jfieldID paymentResult::verification_url_fieldID;

paymentResult::paymentResult()
  : success_()
  , verification_url_()
{}

paymentResult::paymentResult(bool success_, string const &verification_url_)
  : success_(success_)
  , verification_url_(verification_url_)
{}

const std::int32_t paymentResult::ID;

object_ptr<paymentResult> paymentResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentResult> res = make_object<paymentResult>();
  res->success_ = (env->GetBooleanField(p, res->success_fieldID) != 0);
  res->verification_url_ = jni::fetch_string(env, p, res->verification_url_fieldID);
  return res;
}

void paymentResult::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, success_fieldID, success_);
  { jstring nextString = jni::to_jstring(env, verification_url_); if (nextString) { env->SetObjectField(s, verification_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void paymentResult::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentResult");
    s.store_field("success", success_);
    s.store_field("verificationUrl", verification_url_);
    s.store_class_end();
  }
}

void paymentResult::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentResult").c_str());
    success_fieldID = jni::get_field_id(env, Class, "success", "Z");
    verification_url_fieldID = jni::get_field_id(env, Class, "verificationUrl", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass personalDocument::Class;
jfieldID personalDocument::files_fieldID;
jfieldID personalDocument::translation_fieldID;

personalDocument::personalDocument()
  : files_()
  , translation_()
{}

personalDocument::personalDocument(array<object_ptr<datedFile>> &&files_, array<object_ptr<datedFile>> &&translation_)
  : files_(std::move(files_))
  , translation_(std::move(translation_))
{}

const std::int32_t personalDocument::ID;

object_ptr<personalDocument> personalDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<personalDocument> res = make_object<personalDocument>();
  res->files_ = jni::FetchVector<datedFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->files_fieldID));
  res->translation_ = jni::FetchVector<datedFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->translation_fieldID));
  return res;
}

void personalDocument::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, files_); if (arr_tmp_) { env->SetObjectField(s, files_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, translation_); if (arr_tmp_) { env->SetObjectField(s, translation_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void personalDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PersonalDocument");
    { s.store_vector_begin("files", files_.size()); for (const auto &_value : files_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("translation", translation_.size()); for (const auto &_value : translation_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void personalDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PersonalDocument").c_str());
    files_fieldID = jni::get_field_id(env, Class, "files", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$DatedFile;").c_str());
    translation_fieldID = jni::get_field_id(env, Class, "translation", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$DatedFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumGiftPaymentOption::Class;
jfieldID premiumGiftPaymentOption::currency_fieldID;
jfieldID premiumGiftPaymentOption::amount_fieldID;
jfieldID premiumGiftPaymentOption::star_count_fieldID;
jfieldID premiumGiftPaymentOption::discount_percentage_fieldID;
jfieldID premiumGiftPaymentOption::month_count_fieldID;
jfieldID premiumGiftPaymentOption::store_product_id_fieldID;
jfieldID premiumGiftPaymentOption::sticker_fieldID;

premiumGiftPaymentOption::premiumGiftPaymentOption()
  : currency_()
  , amount_()
  , star_count_()
  , discount_percentage_()
  , month_count_()
  , store_product_id_()
  , sticker_()
{}

premiumGiftPaymentOption::premiumGiftPaymentOption(string const &currency_, int53 amount_, int53 star_count_, int32 discount_percentage_, int32 month_count_, string const &store_product_id_, object_ptr<sticker> &&sticker_)
  : currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
  , discount_percentage_(discount_percentage_)
  , month_count_(month_count_)
  , store_product_id_(store_product_id_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t premiumGiftPaymentOption::ID;

object_ptr<premiumGiftPaymentOption> premiumGiftPaymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumGiftPaymentOption> res = make_object<premiumGiftPaymentOption>();
  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->discount_percentage_ = env->GetIntField(p, res->discount_percentage_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->store_product_id_ = jni::fetch_string(env, p, res->store_product_id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void premiumGiftPaymentOption::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_);
  env->SetIntField(s, discount_percentage_fieldID, discount_percentage_);
  env->SetIntField(s, month_count_fieldID, month_count_);
  { jstring nextString = jni::to_jstring(env, store_product_id_); if (nextString) { env->SetObjectField(s, store_product_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void premiumGiftPaymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumGiftPaymentOption");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_field("discountPercentage", discount_percentage_);
    s.store_field("monthCount", month_count_);
    s.store_field("storeProductId", store_product_id_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void premiumGiftPaymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumGiftPaymentOption").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");
    discount_percentage_fieldID = jni::get_field_id(env, Class, "discountPercentage", "I");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    store_product_id_fieldID = jni::get_field_id(env, Class, "storeProductId", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass premiumStatePaymentOption::Class;
jfieldID premiumStatePaymentOption::payment_option_fieldID;
jfieldID premiumStatePaymentOption::is_current_fieldID;
jfieldID premiumStatePaymentOption::is_upgrade_fieldID;
jfieldID premiumStatePaymentOption::last_transaction_id_fieldID;

premiumStatePaymentOption::premiumStatePaymentOption()
  : payment_option_()
  , is_current_()
  , is_upgrade_()
  , last_transaction_id_()
{}

premiumStatePaymentOption::premiumStatePaymentOption(object_ptr<premiumPaymentOption> &&payment_option_, bool is_current_, bool is_upgrade_, string const &last_transaction_id_)
  : payment_option_(std::move(payment_option_))
  , is_current_(is_current_)
  , is_upgrade_(is_upgrade_)
  , last_transaction_id_(last_transaction_id_)
{}

const std::int32_t premiumStatePaymentOption::ID;

object_ptr<premiumStatePaymentOption> premiumStatePaymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumStatePaymentOption> res = make_object<premiumStatePaymentOption>();
  res->payment_option_ = jni::fetch_tl_object<premiumPaymentOption>(env, jni::fetch_object(env, p, res->payment_option_fieldID));
  res->is_current_ = (env->GetBooleanField(p, res->is_current_fieldID) != 0);
  res->is_upgrade_ = (env->GetBooleanField(p, res->is_upgrade_fieldID) != 0);
  res->last_transaction_id_ = jni::fetch_string(env, p, res->last_transaction_id_fieldID);
  return res;
}

void premiumStatePaymentOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (payment_option_ != nullptr) { jobject next; payment_option_->store(env, next); if (next) { env->SetObjectField(s, payment_option_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_current_fieldID, is_current_);
  env->SetBooleanField(s, is_upgrade_fieldID, is_upgrade_);
  { jstring nextString = jni::to_jstring(env, last_transaction_id_); if (nextString) { env->SetObjectField(s, last_transaction_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void premiumStatePaymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumStatePaymentOption");
    s.store_object_field("paymentOption", static_cast<const BaseObject *>(payment_option_.get()));
    s.store_field("isCurrent", is_current_);
    s.store_field("isUpgrade", is_upgrade_);
    s.store_field("lastTransactionId", last_transaction_id_);
    s.store_class_end();
  }
}

void premiumStatePaymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumStatePaymentOption").c_str());
    payment_option_fieldID = jni::get_field_id(env, Class, "paymentOption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PremiumPaymentOption;").c_str());
    is_current_fieldID = jni::get_field_id(env, Class, "isCurrent", "Z");
    is_upgrade_fieldID = jni::get_field_id(env, Class, "isUpgrade", "Z");
    last_transaction_id_fieldID = jni::get_field_id(env, Class, "lastTransactionId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass productInfo::Class;
jfieldID productInfo::title_fieldID;
jfieldID productInfo::description_fieldID;
jfieldID productInfo::photo_fieldID;

productInfo::productInfo()
  : title_()
  , description_()
  , photo_()
{}

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

const std::int32_t productInfo::ID;

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

void productInfo::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); } }
  if (description_ != nullptr) { jobject next; description_->store(env, next); if (next) { env->SetObjectField(s, description_fieldID, next); env->DeleteLocalRef(next); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass profilePhoto::Class;
jfieldID profilePhoto::id_fieldID;
jfieldID profilePhoto::small_fieldID;
jfieldID profilePhoto::big_fieldID;
jfieldID profilePhoto::minithumbnail_fieldID;
jfieldID profilePhoto::has_animation_fieldID;
jfieldID profilePhoto::is_personal_fieldID;

profilePhoto::profilePhoto()
  : id_()
  , small_()
  , big_()
  , minithumbnail_()
  , has_animation_()
  , is_personal_()
{}

profilePhoto::profilePhoto(int64 id_, object_ptr<file> &&small_, object_ptr<file> &&big_, object_ptr<minithumbnail> &&minithumbnail_, bool has_animation_, bool is_personal_)
  : id_(id_)
  , small_(std::move(small_))
  , big_(std::move(big_))
  , minithumbnail_(std::move(minithumbnail_))
  , has_animation_(has_animation_)
  , is_personal_(is_personal_)
{}

const std::int32_t profilePhoto::ID;

object_ptr<profilePhoto> profilePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<profilePhoto> res = make_object<profilePhoto>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->small_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->small_fieldID));
  res->big_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->big_fieldID));
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->has_animation_ = (env->GetBooleanField(p, res->has_animation_fieldID) != 0);
  res->is_personal_ = (env->GetBooleanField(p, res->is_personal_fieldID) != 0);
  return res;
}

void profilePhoto::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (small_ != nullptr) { jobject next; small_->store(env, next); if (next) { env->SetObjectField(s, small_fieldID, next); env->DeleteLocalRef(next); } }
  if (big_ != nullptr) { jobject next; big_->store(env, next); if (next) { env->SetObjectField(s, big_fieldID, next); env->DeleteLocalRef(next); } }
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, has_animation_fieldID, has_animation_);
  env->SetBooleanField(s, is_personal_fieldID, is_personal_);
}

void profilePhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProfilePhoto");
    s.store_field("id", id_);
    s.store_object_field("small", static_cast<const BaseObject *>(small_.get()));
    s.store_object_field("big", static_cast<const BaseObject *>(big_.get()));
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_field("hasAnimation", has_animation_);
    s.store_field("isPersonal", is_personal_);
    s.store_class_end();
  }
}

void profilePhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ProfilePhoto").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    small_fieldID = jni::get_field_id(env, Class, "small", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    big_fieldID = jni::get_field_id(env, Class, "big", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    has_animation_fieldID = jni::get_field_id(env, Class, "hasAnimation", "Z");
    is_personal_fieldID = jni::get_field_id(env, Class, "isPersonal", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass PublicForward::Class;

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

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

jclass publicForwardMessage::Class;
jfieldID publicForwardMessage::message_fieldID;

publicForwardMessage::publicForwardMessage()
  : message_()
{}

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

const std::int32_t publicForwardMessage::ID;

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

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

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

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

jclass publicForwardStory::Class;
jfieldID publicForwardStory::story_fieldID;

publicForwardStory::publicForwardStory()
  : story_()
{}

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

const std::int32_t publicForwardStory::ID;

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

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

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

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

jclass publicPostSearchLimits::Class;
jfieldID publicPostSearchLimits::daily_free_query_count_fieldID;
jfieldID publicPostSearchLimits::remaining_free_query_count_fieldID;
jfieldID publicPostSearchLimits::next_free_query_in_fieldID;
jfieldID publicPostSearchLimits::star_count_fieldID;
jfieldID publicPostSearchLimits::is_current_query_free_fieldID;

publicPostSearchLimits::publicPostSearchLimits()
  : daily_free_query_count_()
  , remaining_free_query_count_()
  , next_free_query_in_()
  , star_count_()
  , is_current_query_free_()
{}

publicPostSearchLimits::publicPostSearchLimits(int32 daily_free_query_count_, int32 remaining_free_query_count_, int32 next_free_query_in_, int53 star_count_, bool is_current_query_free_)
  : daily_free_query_count_(daily_free_query_count_)
  , remaining_free_query_count_(remaining_free_query_count_)
  , next_free_query_in_(next_free_query_in_)
  , star_count_(star_count_)
  , is_current_query_free_(is_current_query_free_)
{}

const std::int32_t publicPostSearchLimits::ID;

object_ptr<publicPostSearchLimits> publicPostSearchLimits::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<publicPostSearchLimits> res = make_object<publicPostSearchLimits>();
  res->daily_free_query_count_ = env->GetIntField(p, res->daily_free_query_count_fieldID);
  res->remaining_free_query_count_ = env->GetIntField(p, res->remaining_free_query_count_fieldID);
  res->next_free_query_in_ = env->GetIntField(p, res->next_free_query_in_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->is_current_query_free_ = (env->GetBooleanField(p, res->is_current_query_free_fieldID) != 0);
  return res;
}

void publicPostSearchLimits::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, daily_free_query_count_fieldID, daily_free_query_count_);
  env->SetIntField(s, remaining_free_query_count_fieldID, remaining_free_query_count_);
  env->SetIntField(s, next_free_query_in_fieldID, next_free_query_in_);
  env->SetLongField(s, star_count_fieldID, star_count_);
  env->SetBooleanField(s, is_current_query_free_fieldID, is_current_query_free_);
}

void publicPostSearchLimits::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PublicPostSearchLimits");
    s.store_field("dailyFreeQueryCount", daily_free_query_count_);
    s.store_field("remainingFreeQueryCount", remaining_free_query_count_);
    s.store_field("nextFreeQueryIn", next_free_query_in_);
    s.store_field("starCount", star_count_);
    s.store_field("isCurrentQueryFree", is_current_query_free_);
    s.store_class_end();
  }
}

void publicPostSearchLimits::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PublicPostSearchLimits").c_str());
    daily_free_query_count_fieldID = jni::get_field_id(env, Class, "dailyFreeQueryCount", "I");
    remaining_free_query_count_fieldID = jni::get_field_id(env, Class, "remainingFreeQueryCount", "I");
    next_free_query_in_fieldID = jni::get_field_id(env, Class, "nextFreeQueryIn", "I");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    is_current_query_free_fieldID = jni::get_field_id(env, Class, "isCurrentQueryFree", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass receivedGifts::Class;
jfieldID receivedGifts::total_count_fieldID;
jfieldID receivedGifts::gifts_fieldID;
jfieldID receivedGifts::are_notifications_enabled_fieldID;
jfieldID receivedGifts::next_offset_fieldID;

receivedGifts::receivedGifts()
  : total_count_()
  , gifts_()
  , are_notifications_enabled_()
  , next_offset_()
{}

receivedGifts::receivedGifts(int32 total_count_, array<object_ptr<receivedGift>> &&gifts_, bool are_notifications_enabled_, string const &next_offset_)
  : total_count_(total_count_)
  , gifts_(std::move(gifts_))
  , are_notifications_enabled_(are_notifications_enabled_)
  , next_offset_(next_offset_)
{}

const std::int32_t receivedGifts::ID;

object_ptr<receivedGifts> receivedGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<receivedGifts> res = make_object<receivedGifts>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->gifts_ = jni::FetchVector<receivedGift>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->gifts_fieldID));
  res->are_notifications_enabled_ = (env->GetBooleanField(p, res->are_notifications_enabled_fieldID) != 0);
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void receivedGifts::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, gifts_); if (arr_tmp_) { env->SetObjectField(s, gifts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, are_notifications_enabled_fieldID, are_notifications_enabled_);
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

void receivedGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReceivedGifts").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    gifts_fieldID = jni::get_field_id(env, Class, "gifts", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReceivedGift;").c_str());
    are_notifications_enabled_fieldID = jni::get_field_id(env, Class, "areNotificationsEnabled", "Z");
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass remoteFile::Class;
jfieldID remoteFile::id_fieldID;
jfieldID remoteFile::unique_id_fieldID;
jfieldID remoteFile::is_uploading_active_fieldID;
jfieldID remoteFile::is_uploading_completed_fieldID;
jfieldID remoteFile::uploaded_size_fieldID;

remoteFile::remoteFile()
  : id_()
  , unique_id_()
  , is_uploading_active_()
  , is_uploading_completed_()
  , uploaded_size_()
{}

remoteFile::remoteFile(string const &id_, string const &unique_id_, bool is_uploading_active_, bool is_uploading_completed_, int53 uploaded_size_)
  : id_(id_)
  , unique_id_(unique_id_)
  , is_uploading_active_(is_uploading_active_)
  , is_uploading_completed_(is_uploading_completed_)
  , uploaded_size_(uploaded_size_)
{}

const std::int32_t remoteFile::ID;

object_ptr<remoteFile> remoteFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<remoteFile> res = make_object<remoteFile>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->unique_id_ = jni::fetch_string(env, p, res->unique_id_fieldID);
  res->is_uploading_active_ = (env->GetBooleanField(p, res->is_uploading_active_fieldID) != 0);
  res->is_uploading_completed_ = (env->GetBooleanField(p, res->is_uploading_completed_fieldID) != 0);
  res->uploaded_size_ = env->GetLongField(p, res->uploaded_size_fieldID);
  return res;
}

void remoteFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, unique_id_); if (nextString) { env->SetObjectField(s, unique_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_uploading_active_fieldID, is_uploading_active_);
  env->SetBooleanField(s, is_uploading_completed_fieldID, is_uploading_completed_);
  env->SetLongField(s, uploaded_size_fieldID, uploaded_size_);
}

void remoteFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoteFile");
    s.store_field("id", id_);
    s.store_field("uniqueId", unique_id_);
    s.store_field("isUploadingActive", is_uploading_active_);
    s.store_field("isUploadingCompleted", is_uploading_completed_);
    s.store_field("uploadedSize", uploaded_size_);
    s.store_class_end();
  }
}

void remoteFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoteFile").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    unique_id_fieldID = jni::get_field_id(env, Class, "uniqueId", "Ljava/lang/String;");
    is_uploading_active_fieldID = jni::get_field_id(env, Class, "isUploadingActive", "Z");
    is_uploading_completed_fieldID = jni::get_field_id(env, Class, "isUploadingCompleted", "Z");
    uploaded_size_fieldID = jni::get_field_id(env, Class, "uploadedSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass shippingOption::Class;
jfieldID shippingOption::id_fieldID;
jfieldID shippingOption::title_fieldID;
jfieldID shippingOption::price_parts_fieldID;

shippingOption::shippingOption()
  : id_()
  , title_()
  , price_parts_()
{}

shippingOption::shippingOption(string const &id_, string const &title_, array<object_ptr<labeledPricePart>> &&price_parts_)
  : id_(id_)
  , title_(title_)
  , price_parts_(std::move(price_parts_))
{}

const std::int32_t shippingOption::ID;

object_ptr<shippingOption> shippingOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<shippingOption> res = make_object<shippingOption>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->price_parts_ = jni::FetchVector<labeledPricePart>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->price_parts_fieldID));
  return res;
}

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

void shippingOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ShippingOption");
    s.store_field("id", id_);
    s.store_field("title", title_);
    { s.store_vector_begin("priceParts", price_parts_.size()); for (const auto &_value : price_parts_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass starGiveawayPaymentOptions::Class;
jfieldID starGiveawayPaymentOptions::options_fieldID;

starGiveawayPaymentOptions::starGiveawayPaymentOptions()
  : options_()
{}

starGiveawayPaymentOptions::starGiveawayPaymentOptions(array<object_ptr<starGiveawayPaymentOption>> &&options_)
  : options_(std::move(options_))
{}

const std::int32_t starGiveawayPaymentOptions::ID;

object_ptr<starGiveawayPaymentOptions> starGiveawayPaymentOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starGiveawayPaymentOptions> res = make_object<starGiveawayPaymentOptions>();
  res->options_ = jni::FetchVector<starGiveawayPaymentOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  return res;
}

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

jclass StarTransactionType::Class;

object_ptr<StarTransactionType> StarTransactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case starTransactionTypePremiumBotDeposit::ID:
      return starTransactionTypePremiumBotDeposit::fetch(env, p);
    case starTransactionTypeAppStoreDeposit::ID:
      return starTransactionTypeAppStoreDeposit::fetch(env, p);
    case starTransactionTypeGooglePlayDeposit::ID:
      return starTransactionTypeGooglePlayDeposit::fetch(env, p);
    case starTransactionTypeFragmentDeposit::ID:
      return starTransactionTypeFragmentDeposit::fetch(env, p);
    case starTransactionTypeUserDeposit::ID:
      return starTransactionTypeUserDeposit::fetch(env, p);
    case starTransactionTypeGiveawayDeposit::ID:
      return starTransactionTypeGiveawayDeposit::fetch(env, p);
    case starTransactionTypeFragmentWithdrawal::ID:
      return starTransactionTypeFragmentWithdrawal::fetch(env, p);
    case starTransactionTypeTelegramAdsWithdrawal::ID:
      return starTransactionTypeTelegramAdsWithdrawal::fetch(env, p);
    case starTransactionTypeTelegramApiUsage::ID:
      return starTransactionTypeTelegramApiUsage::fetch(env, p);
    case starTransactionTypeBotPaidMediaPurchase::ID:
      return starTransactionTypeBotPaidMediaPurchase::fetch(env, p);
    case starTransactionTypeBotPaidMediaSale::ID:
      return starTransactionTypeBotPaidMediaSale::fetch(env, p);
    case starTransactionTypeChannelPaidMediaPurchase::ID:
      return starTransactionTypeChannelPaidMediaPurchase::fetch(env, p);
    case starTransactionTypeChannelPaidMediaSale::ID:
      return starTransactionTypeChannelPaidMediaSale::fetch(env, p);
    case starTransactionTypeBotInvoicePurchase::ID:
      return starTransactionTypeBotInvoicePurchase::fetch(env, p);
    case starTransactionTypeBotInvoiceSale::ID:
      return starTransactionTypeBotInvoiceSale::fetch(env, p);
    case starTransactionTypeBotSubscriptionPurchase::ID:
      return starTransactionTypeBotSubscriptionPurchase::fetch(env, p);
    case starTransactionTypeBotSubscriptionSale::ID:
      return starTransactionTypeBotSubscriptionSale::fetch(env, p);
    case starTransactionTypeChannelSubscriptionPurchase::ID:
      return starTransactionTypeChannelSubscriptionPurchase::fetch(env, p);
    case starTransactionTypeChannelSubscriptionSale::ID:
      return starTransactionTypeChannelSubscriptionSale::fetch(env, p);
    case starTransactionTypeGiftAuctionBid::ID:
      return starTransactionTypeGiftAuctionBid::fetch(env, p);
    case starTransactionTypeGiftPurchase::ID:
      return starTransactionTypeGiftPurchase::fetch(env, p);
    case starTransactionTypeGiftPurchaseOffer::ID:
      return starTransactionTypeGiftPurchaseOffer::fetch(env, p);
    case starTransactionTypeGiftTransfer::ID:
      return starTransactionTypeGiftTransfer::fetch(env, p);
    case starTransactionTypeGiftOriginalDetailsDrop::ID:
      return starTransactionTypeGiftOriginalDetailsDrop::fetch(env, p);
    case starTransactionTypeGiftSale::ID:
      return starTransactionTypeGiftSale::fetch(env, p);
    case starTransactionTypeGiftUpgrade::ID:
      return starTransactionTypeGiftUpgrade::fetch(env, p);
    case starTransactionTypeGiftUpgradePurchase::ID:
      return starTransactionTypeGiftUpgradePurchase::fetch(env, p);
    case starTransactionTypeUpgradedGiftPurchase::ID:
      return starTransactionTypeUpgradedGiftPurchase::fetch(env, p);
    case starTransactionTypeUpgradedGiftSale::ID:
      return starTransactionTypeUpgradedGiftSale::fetch(env, p);
    case starTransactionTypeChannelPaidReactionSend::ID:
      return starTransactionTypeChannelPaidReactionSend::fetch(env, p);
    case starTransactionTypeChannelPaidReactionReceive::ID:
      return starTransactionTypeChannelPaidReactionReceive::fetch(env, p);
    case starTransactionTypeAffiliateProgramCommission::ID:
      return starTransactionTypeAffiliateProgramCommission::fetch(env, p);
    case starTransactionTypePaidMessageSend::ID:
      return starTransactionTypePaidMessageSend::fetch(env, p);
    case starTransactionTypePaidMessageReceive::ID:
      return starTransactionTypePaidMessageReceive::fetch(env, p);
    case starTransactionTypePaidGroupCallMessageSend::ID:
      return starTransactionTypePaidGroupCallMessageSend::fetch(env, p);
    case starTransactionTypePaidGroupCallMessageReceive::ID:
      return starTransactionTypePaidGroupCallMessageReceive::fetch(env, p);
    case starTransactionTypePaidGroupCallReactionSend::ID:
      return starTransactionTypePaidGroupCallReactionSend::fetch(env, p);
    case starTransactionTypePaidGroupCallReactionReceive::ID:
      return starTransactionTypePaidGroupCallReactionReceive::fetch(env, p);
    case starTransactionTypeSuggestedPostPaymentSend::ID:
      return starTransactionTypeSuggestedPostPaymentSend::fetch(env, p);
    case starTransactionTypeSuggestedPostPaymentReceive::ID:
      return starTransactionTypeSuggestedPostPaymentReceive::fetch(env, p);
    case starTransactionTypePremiumPurchase::ID:
      return starTransactionTypePremiumPurchase::fetch(env, p);
    case starTransactionTypeBusinessBotTransferSend::ID:
      return starTransactionTypeBusinessBotTransferSend::fetch(env, p);
    case starTransactionTypeBusinessBotTransferReceive::ID:
      return starTransactionTypeBusinessBotTransferReceive::fetch(env, p);
    case starTransactionTypePublicPostSearch::ID:
      return starTransactionTypePublicPostSearch::fetch(env, p);
    case starTransactionTypeUnsupported::ID:
      return starTransactionTypeUnsupported::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass starTransactionTypePremiumBotDeposit::Class;

starTransactionTypePremiumBotDeposit::starTransactionTypePremiumBotDeposit() {
}

const std::int32_t starTransactionTypePremiumBotDeposit::ID;

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

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

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

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

jclass starTransactionTypeAppStoreDeposit::Class;

starTransactionTypeAppStoreDeposit::starTransactionTypeAppStoreDeposit() {
}

const std::int32_t starTransactionTypeAppStoreDeposit::ID;

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

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

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

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

jclass starTransactionTypeGooglePlayDeposit::Class;

starTransactionTypeGooglePlayDeposit::starTransactionTypeGooglePlayDeposit() {
}

const std::int32_t starTransactionTypeGooglePlayDeposit::ID;

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

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

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

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

jclass starTransactionTypeFragmentDeposit::Class;

starTransactionTypeFragmentDeposit::starTransactionTypeFragmentDeposit() {
}

const std::int32_t starTransactionTypeFragmentDeposit::ID;

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

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

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

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

jclass starTransactionTypeUserDeposit::Class;
jfieldID starTransactionTypeUserDeposit::user_id_fieldID;
jfieldID starTransactionTypeUserDeposit::sticker_fieldID;

starTransactionTypeUserDeposit::starTransactionTypeUserDeposit()
  : user_id_()
  , sticker_()
{}

starTransactionTypeUserDeposit::starTransactionTypeUserDeposit(int53 user_id_, object_ptr<sticker> &&sticker_)
  : user_id_(user_id_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t starTransactionTypeUserDeposit::ID;

object_ptr<StarTransactionType> starTransactionTypeUserDeposit::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeUserDeposit> res = make_object<starTransactionTypeUserDeposit>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void starTransactionTypeUserDeposit::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass starTransactionTypeGiveawayDeposit::Class;
jfieldID starTransactionTypeGiveawayDeposit::chat_id_fieldID;
jfieldID starTransactionTypeGiveawayDeposit::giveaway_message_id_fieldID;

starTransactionTypeGiveawayDeposit::starTransactionTypeGiveawayDeposit()
  : chat_id_()
  , giveaway_message_id_()
{}

starTransactionTypeGiveawayDeposit::starTransactionTypeGiveawayDeposit(int53 chat_id_, int53 giveaway_message_id_)
  : chat_id_(chat_id_)
  , giveaway_message_id_(giveaway_message_id_)
{}

const std::int32_t starTransactionTypeGiveawayDeposit::ID;

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

void starTransactionTypeGiveawayDeposit::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, giveaway_message_id_fieldID, giveaway_message_id_);
}

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

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

jclass starTransactionTypeFragmentWithdrawal::Class;
jfieldID starTransactionTypeFragmentWithdrawal::withdrawal_state_fieldID;

starTransactionTypeFragmentWithdrawal::starTransactionTypeFragmentWithdrawal()
  : withdrawal_state_()
{}

starTransactionTypeFragmentWithdrawal::starTransactionTypeFragmentWithdrawal(object_ptr<RevenueWithdrawalState> &&withdrawal_state_)
  : withdrawal_state_(std::move(withdrawal_state_))
{}

const std::int32_t starTransactionTypeFragmentWithdrawal::ID;

object_ptr<StarTransactionType> starTransactionTypeFragmentWithdrawal::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeFragmentWithdrawal> res = make_object<starTransactionTypeFragmentWithdrawal>();
  res->withdrawal_state_ = jni::fetch_tl_object<RevenueWithdrawalState>(env, jni::fetch_object(env, p, res->withdrawal_state_fieldID));
  return std::move(res);
}

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

void starTransactionTypeFragmentWithdrawal::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeFragmentWithdrawal");
    s.store_object_field("withdrawalState", static_cast<const BaseObject *>(withdrawal_state_.get()));
    s.store_class_end();
  }
}

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

jclass starTransactionTypeTelegramAdsWithdrawal::Class;

starTransactionTypeTelegramAdsWithdrawal::starTransactionTypeTelegramAdsWithdrawal() {
}

const std::int32_t starTransactionTypeTelegramAdsWithdrawal::ID;

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

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

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

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

jclass starTransactionTypeTelegramApiUsage::Class;
jfieldID starTransactionTypeTelegramApiUsage::request_count_fieldID;

starTransactionTypeTelegramApiUsage::starTransactionTypeTelegramApiUsage()
  : request_count_()
{}

starTransactionTypeTelegramApiUsage::starTransactionTypeTelegramApiUsage(int32 request_count_)
  : request_count_(request_count_)
{}

const std::int32_t starTransactionTypeTelegramApiUsage::ID;

object_ptr<StarTransactionType> starTransactionTypeTelegramApiUsage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeTelegramApiUsage> res = make_object<starTransactionTypeTelegramApiUsage>();
  res->request_count_ = env->GetIntField(p, res->request_count_fieldID);
  return std::move(res);
}

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

void starTransactionTypeTelegramApiUsage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeTelegramApiUsage");
    s.store_field("requestCount", request_count_);
    s.store_class_end();
  }
}

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

jclass starTransactionTypeBotPaidMediaPurchase::Class;
jfieldID starTransactionTypeBotPaidMediaPurchase::user_id_fieldID;
jfieldID starTransactionTypeBotPaidMediaPurchase::media_fieldID;

starTransactionTypeBotPaidMediaPurchase::starTransactionTypeBotPaidMediaPurchase()
  : user_id_()
  , media_()
{}

starTransactionTypeBotPaidMediaPurchase::starTransactionTypeBotPaidMediaPurchase(int53 user_id_, array<object_ptr<PaidMedia>> &&media_)
  : user_id_(user_id_)
  , media_(std::move(media_))
{}

const std::int32_t starTransactionTypeBotPaidMediaPurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeBotPaidMediaPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeBotPaidMediaPurchase> res = make_object<starTransactionTypeBotPaidMediaPurchase>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->media_ = jni::FetchVector<PaidMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->media_fieldID));
  return std::move(res);
}

void starTransactionTypeBotPaidMediaPurchase::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_);
  { auto arr_tmp_ = jni::store_vector(env, media_); if (arr_tmp_) { env->SetObjectField(s, media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void starTransactionTypeBotPaidMediaPurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeBotPaidMediaPurchase");
    s.store_field("userId", user_id_);
    { s.store_vector_begin("media", media_.size()); for (const auto &_value : media_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass starTransactionTypeBotPaidMediaSale::Class;
jfieldID starTransactionTypeBotPaidMediaSale::user_id_fieldID;
jfieldID starTransactionTypeBotPaidMediaSale::media_fieldID;
jfieldID starTransactionTypeBotPaidMediaSale::payload_fieldID;
jfieldID starTransactionTypeBotPaidMediaSale::affiliate_fieldID;

starTransactionTypeBotPaidMediaSale::starTransactionTypeBotPaidMediaSale()
  : user_id_()
  , media_()
  , payload_()
  , affiliate_()
{}

starTransactionTypeBotPaidMediaSale::starTransactionTypeBotPaidMediaSale(int53 user_id_, array<object_ptr<PaidMedia>> &&media_, string const &payload_, object_ptr<affiliateInfo> &&affiliate_)
  : user_id_(user_id_)
  , media_(std::move(media_))
  , payload_(payload_)
  , affiliate_(std::move(affiliate_))
{}

const std::int32_t starTransactionTypeBotPaidMediaSale::ID;

object_ptr<StarTransactionType> starTransactionTypeBotPaidMediaSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeBotPaidMediaSale> res = make_object<starTransactionTypeBotPaidMediaSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->media_ = jni::FetchVector<PaidMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->media_fieldID));
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  res->affiliate_ = jni::fetch_tl_object<affiliateInfo>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  return std::move(res);
}

void starTransactionTypeBotPaidMediaSale::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_);
  { auto arr_tmp_ = jni::store_vector(env, media_); if (arr_tmp_) { env->SetObjectField(s, media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, payload_); if (nextString) { env->SetObjectField(s, payload_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (affiliate_ != nullptr) { jobject next; affiliate_->store(env, next); if (next) { env->SetObjectField(s, affiliate_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeBotPaidMediaSale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeBotPaidMediaSale");
    s.store_field("userId", user_id_);
    { s.store_vector_begin("media", media_.size()); for (const auto &_value : media_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("payload", payload_);
    s.store_object_field("affiliate", static_cast<const BaseObject *>(affiliate_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeBotPaidMediaSale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeBotPaidMediaSale").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaidMedia;").c_str());
    payload_fieldID = jni::get_field_id(env, Class, "payload", "Ljava/lang/String;");
    affiliate_fieldID = jni::get_field_id(env, Class, "affiliate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeChannelPaidMediaPurchase::Class;
jfieldID starTransactionTypeChannelPaidMediaPurchase::chat_id_fieldID;
jfieldID starTransactionTypeChannelPaidMediaPurchase::message_id_fieldID;
jfieldID starTransactionTypeChannelPaidMediaPurchase::media_fieldID;

starTransactionTypeChannelPaidMediaPurchase::starTransactionTypeChannelPaidMediaPurchase()
  : chat_id_()
  , message_id_()
  , media_()
{}

starTransactionTypeChannelPaidMediaPurchase::starTransactionTypeChannelPaidMediaPurchase(int53 chat_id_, int53 message_id_, array<object_ptr<PaidMedia>> &&media_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , media_(std::move(media_))
{}

const std::int32_t starTransactionTypeChannelPaidMediaPurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeChannelPaidMediaPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeChannelPaidMediaPurchase> res = make_object<starTransactionTypeChannelPaidMediaPurchase>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->media_ = jni::FetchVector<PaidMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->media_fieldID));
  return std::move(res);
}

void starTransactionTypeChannelPaidMediaPurchase::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  { auto arr_tmp_ = jni::store_vector(env, media_); if (arr_tmp_) { env->SetObjectField(s, media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void starTransactionTypeChannelPaidMediaPurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeChannelPaidMediaPurchase");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    { s.store_vector_begin("media", media_.size()); for (const auto &_value : media_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void starTransactionTypeChannelPaidMediaPurchase::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeChannelPaidMediaPurchase").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaidMedia;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeChannelPaidMediaSale::Class;
jfieldID starTransactionTypeChannelPaidMediaSale::user_id_fieldID;
jfieldID starTransactionTypeChannelPaidMediaSale::message_id_fieldID;
jfieldID starTransactionTypeChannelPaidMediaSale::media_fieldID;

starTransactionTypeChannelPaidMediaSale::starTransactionTypeChannelPaidMediaSale()
  : user_id_()
  , message_id_()
  , media_()
{}

starTransactionTypeChannelPaidMediaSale::starTransactionTypeChannelPaidMediaSale(int53 user_id_, int53 message_id_, array<object_ptr<PaidMedia>> &&media_)
  : user_id_(user_id_)
  , message_id_(message_id_)
  , media_(std::move(media_))
{}

const std::int32_t starTransactionTypeChannelPaidMediaSale::ID;

object_ptr<StarTransactionType> starTransactionTypeChannelPaidMediaSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeChannelPaidMediaSale> res = make_object<starTransactionTypeChannelPaidMediaSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->media_ = jni::FetchVector<PaidMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->media_fieldID));
  return std::move(res);
}

void starTransactionTypeChannelPaidMediaSale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  { auto arr_tmp_ = jni::store_vector(env, media_); if (arr_tmp_) { env->SetObjectField(s, media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void starTransactionTypeChannelPaidMediaSale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeChannelPaidMediaSale");
    s.store_field("userId", user_id_);
    s.store_field("messageId", message_id_);
    { s.store_vector_begin("media", media_.size()); for (const auto &_value : media_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void starTransactionTypeChannelPaidMediaSale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeChannelPaidMediaSale").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaidMedia;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeBotInvoicePurchase::Class;
jfieldID starTransactionTypeBotInvoicePurchase::user_id_fieldID;
jfieldID starTransactionTypeBotInvoicePurchase::product_info_fieldID;

starTransactionTypeBotInvoicePurchase::starTransactionTypeBotInvoicePurchase()
  : user_id_()
  , product_info_()
{}

starTransactionTypeBotInvoicePurchase::starTransactionTypeBotInvoicePurchase(int53 user_id_, object_ptr<productInfo> &&product_info_)
  : user_id_(user_id_)
  , product_info_(std::move(product_info_))
{}

const std::int32_t starTransactionTypeBotInvoicePurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeBotInvoicePurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeBotInvoicePurchase> res = make_object<starTransactionTypeBotInvoicePurchase>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  return std::move(res);
}

void starTransactionTypeBotInvoicePurchase::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeBotInvoicePurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeBotInvoicePurchase");
    s.store_field("userId", user_id_);
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_class_end();
  }
}

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

jclass starTransactionTypeBotInvoiceSale::Class;
jfieldID starTransactionTypeBotInvoiceSale::user_id_fieldID;
jfieldID starTransactionTypeBotInvoiceSale::product_info_fieldID;
jfieldID starTransactionTypeBotInvoiceSale::invoice_payload_fieldID;
jfieldID starTransactionTypeBotInvoiceSale::affiliate_fieldID;

starTransactionTypeBotInvoiceSale::starTransactionTypeBotInvoiceSale()
  : user_id_()
  , product_info_()
  , invoice_payload_()
  , affiliate_()
{}

starTransactionTypeBotInvoiceSale::starTransactionTypeBotInvoiceSale(int53 user_id_, object_ptr<productInfo> &&product_info_, bytes const &invoice_payload_, object_ptr<affiliateInfo> &&affiliate_)
  : user_id_(user_id_)
  , product_info_(std::move(product_info_))
  , invoice_payload_(std::move(invoice_payload_))
  , affiliate_(std::move(affiliate_))
{}

const std::int32_t starTransactionTypeBotInvoiceSale::ID;

object_ptr<StarTransactionType> starTransactionTypeBotInvoiceSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeBotInvoiceSale> res = make_object<starTransactionTypeBotInvoiceSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  res->invoice_payload_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->invoice_payload_fieldID));
  res->affiliate_ = jni::fetch_tl_object<affiliateInfo>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  return std::move(res);
}

void starTransactionTypeBotInvoiceSale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jbyteArray nextBytes = jni::to_bytes(env, invoice_payload_); if (nextBytes) { env->SetObjectField(s, invoice_payload_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  if (affiliate_ != nullptr) { jobject next; affiliate_->store(env, next); if (next) { env->SetObjectField(s, affiliate_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeBotInvoiceSale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeBotInvoiceSale");
    s.store_field("userId", user_id_);
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_bytes_field("invoicePayload", invoice_payload_);
    s.store_object_field("affiliate", static_cast<const BaseObject *>(affiliate_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeBotInvoiceSale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeBotInvoiceSale").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    product_info_fieldID = jni::get_field_id(env, Class, "productInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProductInfo;").c_str());
    invoice_payload_fieldID = jni::get_field_id(env, Class, "invoicePayload", "[B");
    affiliate_fieldID = jni::get_field_id(env, Class, "affiliate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeBotSubscriptionPurchase::Class;
jfieldID starTransactionTypeBotSubscriptionPurchase::user_id_fieldID;
jfieldID starTransactionTypeBotSubscriptionPurchase::subscription_period_fieldID;
jfieldID starTransactionTypeBotSubscriptionPurchase::product_info_fieldID;

starTransactionTypeBotSubscriptionPurchase::starTransactionTypeBotSubscriptionPurchase()
  : user_id_()
  , subscription_period_()
  , product_info_()
{}

starTransactionTypeBotSubscriptionPurchase::starTransactionTypeBotSubscriptionPurchase(int53 user_id_, int32 subscription_period_, object_ptr<productInfo> &&product_info_)
  : user_id_(user_id_)
  , subscription_period_(subscription_period_)
  , product_info_(std::move(product_info_))
{}

const std::int32_t starTransactionTypeBotSubscriptionPurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeBotSubscriptionPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeBotSubscriptionPurchase> res = make_object<starTransactionTypeBotSubscriptionPurchase>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->subscription_period_ = env->GetIntField(p, res->subscription_period_fieldID);
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  return std::move(res);
}

void starTransactionTypeBotSubscriptionPurchase::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, subscription_period_fieldID, subscription_period_);
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeBotSubscriptionPurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeBotSubscriptionPurchase");
    s.store_field("userId", user_id_);
    s.store_field("subscriptionPeriod", subscription_period_);
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeBotSubscriptionPurchase::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeBotSubscriptionPurchase").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    subscription_period_fieldID = jni::get_field_id(env, Class, "subscriptionPeriod", "I");
    product_info_fieldID = jni::get_field_id(env, Class, "productInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProductInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeBotSubscriptionSale::Class;
jfieldID starTransactionTypeBotSubscriptionSale::user_id_fieldID;
jfieldID starTransactionTypeBotSubscriptionSale::subscription_period_fieldID;
jfieldID starTransactionTypeBotSubscriptionSale::product_info_fieldID;
jfieldID starTransactionTypeBotSubscriptionSale::invoice_payload_fieldID;
jfieldID starTransactionTypeBotSubscriptionSale::affiliate_fieldID;

starTransactionTypeBotSubscriptionSale::starTransactionTypeBotSubscriptionSale()
  : user_id_()
  , subscription_period_()
  , product_info_()
  , invoice_payload_()
  , affiliate_()
{}

starTransactionTypeBotSubscriptionSale::starTransactionTypeBotSubscriptionSale(int53 user_id_, int32 subscription_period_, object_ptr<productInfo> &&product_info_, bytes const &invoice_payload_, object_ptr<affiliateInfo> &&affiliate_)
  : user_id_(user_id_)
  , subscription_period_(subscription_period_)
  , product_info_(std::move(product_info_))
  , invoice_payload_(std::move(invoice_payload_))
  , affiliate_(std::move(affiliate_))
{}

const std::int32_t starTransactionTypeBotSubscriptionSale::ID;

object_ptr<StarTransactionType> starTransactionTypeBotSubscriptionSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeBotSubscriptionSale> res = make_object<starTransactionTypeBotSubscriptionSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->subscription_period_ = env->GetIntField(p, res->subscription_period_fieldID);
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  res->invoice_payload_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->invoice_payload_fieldID));
  res->affiliate_ = jni::fetch_tl_object<affiliateInfo>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  return std::move(res);
}

void starTransactionTypeBotSubscriptionSale::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, subscription_period_fieldID, subscription_period_);
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jbyteArray nextBytes = jni::to_bytes(env, invoice_payload_); if (nextBytes) { env->SetObjectField(s, invoice_payload_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  if (affiliate_ != nullptr) { jobject next; affiliate_->store(env, next); if (next) { env->SetObjectField(s, affiliate_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeBotSubscriptionSale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeBotSubscriptionSale");
    s.store_field("userId", user_id_);
    s.store_field("subscriptionPeriod", subscription_period_);
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_bytes_field("invoicePayload", invoice_payload_);
    s.store_object_field("affiliate", static_cast<const BaseObject *>(affiliate_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeBotSubscriptionSale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeBotSubscriptionSale").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    subscription_period_fieldID = jni::get_field_id(env, Class, "subscriptionPeriod", "I");
    product_info_fieldID = jni::get_field_id(env, Class, "productInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProductInfo;").c_str());
    invoice_payload_fieldID = jni::get_field_id(env, Class, "invoicePayload", "[B");
    affiliate_fieldID = jni::get_field_id(env, Class, "affiliate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeChannelSubscriptionPurchase::Class;
jfieldID starTransactionTypeChannelSubscriptionPurchase::chat_id_fieldID;
jfieldID starTransactionTypeChannelSubscriptionPurchase::subscription_period_fieldID;

starTransactionTypeChannelSubscriptionPurchase::starTransactionTypeChannelSubscriptionPurchase()
  : chat_id_()
  , subscription_period_()
{}

starTransactionTypeChannelSubscriptionPurchase::starTransactionTypeChannelSubscriptionPurchase(int53 chat_id_, int32 subscription_period_)
  : chat_id_(chat_id_)
  , subscription_period_(subscription_period_)
{}

const std::int32_t starTransactionTypeChannelSubscriptionPurchase::ID;

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

void starTransactionTypeChannelSubscriptionPurchase::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, subscription_period_fieldID, subscription_period_);
}

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

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

jclass starTransactionTypeChannelSubscriptionSale::Class;
jfieldID starTransactionTypeChannelSubscriptionSale::user_id_fieldID;
jfieldID starTransactionTypeChannelSubscriptionSale::subscription_period_fieldID;

starTransactionTypeChannelSubscriptionSale::starTransactionTypeChannelSubscriptionSale()
  : user_id_()
  , subscription_period_()
{}

starTransactionTypeChannelSubscriptionSale::starTransactionTypeChannelSubscriptionSale(int53 user_id_, int32 subscription_period_)
  : user_id_(user_id_)
  , subscription_period_(subscription_period_)
{}

const std::int32_t starTransactionTypeChannelSubscriptionSale::ID;

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

void starTransactionTypeChannelSubscriptionSale::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, subscription_period_fieldID, subscription_period_);
}

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

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

jclass starTransactionTypeGiftAuctionBid::Class;
jfieldID starTransactionTypeGiftAuctionBid::owner_id_fieldID;
jfieldID starTransactionTypeGiftAuctionBid::gift_fieldID;

starTransactionTypeGiftAuctionBid::starTransactionTypeGiftAuctionBid()
  : owner_id_()
  , gift_()
{}

starTransactionTypeGiftAuctionBid::starTransactionTypeGiftAuctionBid(object_ptr<MessageSender> &&owner_id_, object_ptr<gift> &&gift_)
  : owner_id_(std::move(owner_id_))
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftAuctionBid::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftAuctionBid::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftAuctionBid> res = make_object<starTransactionTypeGiftAuctionBid>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftAuctionBid::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeGiftAuctionBid::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeGiftAuctionBid");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeGiftAuctionBid::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeGiftAuctionBid").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeGiftPurchase::Class;
jfieldID starTransactionTypeGiftPurchase::owner_id_fieldID;
jfieldID starTransactionTypeGiftPurchase::gift_fieldID;

starTransactionTypeGiftPurchase::starTransactionTypeGiftPurchase()
  : owner_id_()
  , gift_()
{}

starTransactionTypeGiftPurchase::starTransactionTypeGiftPurchase(object_ptr<MessageSender> &&owner_id_, object_ptr<gift> &&gift_)
  : owner_id_(std::move(owner_id_))
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftPurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftPurchase> res = make_object<starTransactionTypeGiftPurchase>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftPurchase::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeGiftPurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeGiftPurchase");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeGiftPurchase::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeGiftPurchase").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeGiftPurchaseOffer::Class;
jfieldID starTransactionTypeGiftPurchaseOffer::gift_fieldID;

starTransactionTypeGiftPurchaseOffer::starTransactionTypeGiftPurchaseOffer()
  : gift_()
{}

starTransactionTypeGiftPurchaseOffer::starTransactionTypeGiftPurchaseOffer(object_ptr<upgradedGift> &&gift_)
  : gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftPurchaseOffer::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftPurchaseOffer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftPurchaseOffer> res = make_object<starTransactionTypeGiftPurchaseOffer>();
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

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

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

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

jclass starTransactionTypeGiftTransfer::Class;
jfieldID starTransactionTypeGiftTransfer::owner_id_fieldID;
jfieldID starTransactionTypeGiftTransfer::gift_fieldID;

starTransactionTypeGiftTransfer::starTransactionTypeGiftTransfer()
  : owner_id_()
  , gift_()
{}

starTransactionTypeGiftTransfer::starTransactionTypeGiftTransfer(object_ptr<MessageSender> &&owner_id_, object_ptr<upgradedGift> &&gift_)
  : owner_id_(std::move(owner_id_))
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftTransfer::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftTransfer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftTransfer> res = make_object<starTransactionTypeGiftTransfer>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftTransfer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeGiftTransfer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeGiftTransfer");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeGiftTransfer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeGiftTransfer").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeGiftOriginalDetailsDrop::Class;
jfieldID starTransactionTypeGiftOriginalDetailsDrop::owner_id_fieldID;
jfieldID starTransactionTypeGiftOriginalDetailsDrop::gift_fieldID;

starTransactionTypeGiftOriginalDetailsDrop::starTransactionTypeGiftOriginalDetailsDrop()
  : owner_id_()
  , gift_()
{}

starTransactionTypeGiftOriginalDetailsDrop::starTransactionTypeGiftOriginalDetailsDrop(object_ptr<MessageSender> &&owner_id_, object_ptr<upgradedGift> &&gift_)
  : owner_id_(std::move(owner_id_))
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftOriginalDetailsDrop::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftOriginalDetailsDrop::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftOriginalDetailsDrop> res = make_object<starTransactionTypeGiftOriginalDetailsDrop>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftOriginalDetailsDrop::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeGiftOriginalDetailsDrop::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeGiftOriginalDetailsDrop");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeGiftOriginalDetailsDrop::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeGiftOriginalDetailsDrop").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeGiftSale::Class;
jfieldID starTransactionTypeGiftSale::user_id_fieldID;
jfieldID starTransactionTypeGiftSale::gift_fieldID;

starTransactionTypeGiftSale::starTransactionTypeGiftSale()
  : user_id_()
  , gift_()
{}

starTransactionTypeGiftSale::starTransactionTypeGiftSale(int53 user_id_, object_ptr<gift> &&gift_)
  : user_id_(user_id_)
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftSale::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftSale> res = make_object<starTransactionTypeGiftSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftSale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass starTransactionTypeGiftUpgrade::Class;
jfieldID starTransactionTypeGiftUpgrade::user_id_fieldID;
jfieldID starTransactionTypeGiftUpgrade::gift_fieldID;

starTransactionTypeGiftUpgrade::starTransactionTypeGiftUpgrade()
  : user_id_()
  , gift_()
{}

starTransactionTypeGiftUpgrade::starTransactionTypeGiftUpgrade(int53 user_id_, object_ptr<upgradedGift> &&gift_)
  : user_id_(user_id_)
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftUpgrade::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftUpgrade::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftUpgrade> res = make_object<starTransactionTypeGiftUpgrade>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftUpgrade::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass starTransactionTypeGiftUpgradePurchase::Class;
jfieldID starTransactionTypeGiftUpgradePurchase::owner_id_fieldID;
jfieldID starTransactionTypeGiftUpgradePurchase::gift_fieldID;

starTransactionTypeGiftUpgradePurchase::starTransactionTypeGiftUpgradePurchase()
  : owner_id_()
  , gift_()
{}

starTransactionTypeGiftUpgradePurchase::starTransactionTypeGiftUpgradePurchase(object_ptr<MessageSender> &&owner_id_, object_ptr<gift> &&gift_)
  : owner_id_(std::move(owner_id_))
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeGiftUpgradePurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeGiftUpgradePurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeGiftUpgradePurchase> res = make_object<starTransactionTypeGiftUpgradePurchase>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeGiftUpgradePurchase::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypeGiftUpgradePurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeGiftUpgradePurchase");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_class_end();
  }
}

void starTransactionTypeGiftUpgradePurchase::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeGiftUpgradePurchase").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeUpgradedGiftPurchase::Class;
jfieldID starTransactionTypeUpgradedGiftPurchase::user_id_fieldID;
jfieldID starTransactionTypeUpgradedGiftPurchase::gift_fieldID;

starTransactionTypeUpgradedGiftPurchase::starTransactionTypeUpgradedGiftPurchase()
  : user_id_()
  , gift_()
{}

starTransactionTypeUpgradedGiftPurchase::starTransactionTypeUpgradedGiftPurchase(int53 user_id_, object_ptr<upgradedGift> &&gift_)
  : user_id_(user_id_)
  , gift_(std::move(gift_))
{}

const std::int32_t starTransactionTypeUpgradedGiftPurchase::ID;

object_ptr<StarTransactionType> starTransactionTypeUpgradedGiftPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeUpgradedGiftPurchase> res = make_object<starTransactionTypeUpgradedGiftPurchase>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

void starTransactionTypeUpgradedGiftPurchase::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass starTransactionTypeUpgradedGiftSale::Class;
jfieldID starTransactionTypeUpgradedGiftSale::user_id_fieldID;
jfieldID starTransactionTypeUpgradedGiftSale::gift_fieldID;
jfieldID starTransactionTypeUpgradedGiftSale::commission_per_mille_fieldID;
jfieldID starTransactionTypeUpgradedGiftSale::commission_star_amount_fieldID;
jfieldID starTransactionTypeUpgradedGiftSale::via_offer_fieldID;

starTransactionTypeUpgradedGiftSale::starTransactionTypeUpgradedGiftSale()
  : user_id_()
  , gift_()
  , commission_per_mille_()
  , commission_star_amount_()
  , via_offer_()
{}

starTransactionTypeUpgradedGiftSale::starTransactionTypeUpgradedGiftSale(int53 user_id_, object_ptr<upgradedGift> &&gift_, int32 commission_per_mille_, object_ptr<starAmount> &&commission_star_amount_, bool via_offer_)
  : user_id_(user_id_)
  , gift_(std::move(gift_))
  , commission_per_mille_(commission_per_mille_)
  , commission_star_amount_(std::move(commission_star_amount_))
  , via_offer_(via_offer_)
{}

const std::int32_t starTransactionTypeUpgradedGiftSale::ID;

object_ptr<StarTransactionType> starTransactionTypeUpgradedGiftSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeUpgradedGiftSale> res = make_object<starTransactionTypeUpgradedGiftSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->commission_star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->commission_star_amount_fieldID));
  res->via_offer_ = (env->GetBooleanField(p, res->via_offer_fieldID) != 0);
  return std::move(res);
}

void starTransactionTypeUpgradedGiftSale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  if (commission_star_amount_ != nullptr) { jobject next; commission_star_amount_->store(env, next); if (next) { env->SetObjectField(s, commission_star_amount_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, via_offer_fieldID, via_offer_);
}

void starTransactionTypeUpgradedGiftSale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypeUpgradedGiftSale");
    s.store_field("userId", user_id_);
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_object_field("commissionStarAmount", static_cast<const BaseObject *>(commission_star_amount_.get()));
    s.store_field("viaOffer", via_offer_);
    s.store_class_end();
  }
}

void starTransactionTypeUpgradedGiftSale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypeUpgradedGiftSale").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    commission_star_amount_fieldID = jni::get_field_id(env, Class, "commissionStarAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    via_offer_fieldID = jni::get_field_id(env, Class, "viaOffer", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeChannelPaidReactionSend::Class;
jfieldID starTransactionTypeChannelPaidReactionSend::chat_id_fieldID;
jfieldID starTransactionTypeChannelPaidReactionSend::message_id_fieldID;

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

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

const std::int32_t starTransactionTypeChannelPaidReactionSend::ID;

object_ptr<StarTransactionType> starTransactionTypeChannelPaidReactionSend::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypeChannelPaidReactionSend> res = make_object<starTransactionTypeChannelPaidReactionSend>();
  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 starTransactionTypeChannelPaidReactionSend::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
}

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

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

starTransactionTypeChannelPaidReactionReceive::starTransactionTypeChannelPaidReactionReceive()
  : user_id_()
  , message_id_()
{}

starTransactionTypeChannelPaidReactionReceive::starTransactionTypeChannelPaidReactionReceive(int53 user_id_, int53 message_id_)
  : user_id_(user_id_)
  , message_id_(message_id_)
{}

const std::int32_t starTransactionTypeChannelPaidReactionReceive::ID;

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

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

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

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

jclass starTransactionTypeAffiliateProgramCommission::Class;
jfieldID starTransactionTypeAffiliateProgramCommission::chat_id_fieldID;
jfieldID starTransactionTypeAffiliateProgramCommission::commission_per_mille_fieldID;

starTransactionTypeAffiliateProgramCommission::starTransactionTypeAffiliateProgramCommission()
  : chat_id_()
  , commission_per_mille_()
{}

starTransactionTypeAffiliateProgramCommission::starTransactionTypeAffiliateProgramCommission(int53 chat_id_, int32 commission_per_mille_)
  : chat_id_(chat_id_)
  , commission_per_mille_(commission_per_mille_)
{}

const std::int32_t starTransactionTypeAffiliateProgramCommission::ID;

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

void starTransactionTypeAffiliateProgramCommission::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, commission_per_mille_fieldID, commission_per_mille_);
}

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

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

jclass starTransactionTypePaidMessageSend::Class;
jfieldID starTransactionTypePaidMessageSend::chat_id_fieldID;
jfieldID starTransactionTypePaidMessageSend::message_count_fieldID;

starTransactionTypePaidMessageSend::starTransactionTypePaidMessageSend()
  : chat_id_()
  , message_count_()
{}

starTransactionTypePaidMessageSend::starTransactionTypePaidMessageSend(int53 chat_id_, int32 message_count_)
  : chat_id_(chat_id_)
  , message_count_(message_count_)
{}

const std::int32_t starTransactionTypePaidMessageSend::ID;

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

void starTransactionTypePaidMessageSend::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetIntField(s, message_count_fieldID, message_count_);
}

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

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

jclass starTransactionTypePaidMessageReceive::Class;
jfieldID starTransactionTypePaidMessageReceive::sender_id_fieldID;
jfieldID starTransactionTypePaidMessageReceive::message_count_fieldID;
jfieldID starTransactionTypePaidMessageReceive::commission_per_mille_fieldID;
jfieldID starTransactionTypePaidMessageReceive::commission_star_amount_fieldID;

starTransactionTypePaidMessageReceive::starTransactionTypePaidMessageReceive()
  : sender_id_()
  , message_count_()
  , commission_per_mille_()
  , commission_star_amount_()
{}

starTransactionTypePaidMessageReceive::starTransactionTypePaidMessageReceive(object_ptr<MessageSender> &&sender_id_, int32 message_count_, int32 commission_per_mille_, object_ptr<starAmount> &&commission_star_amount_)
  : sender_id_(std::move(sender_id_))
  , message_count_(message_count_)
  , commission_per_mille_(commission_per_mille_)
  , commission_star_amount_(std::move(commission_star_amount_))
{}

const std::int32_t starTransactionTypePaidMessageReceive::ID;

object_ptr<StarTransactionType> starTransactionTypePaidMessageReceive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypePaidMessageReceive> res = make_object<starTransactionTypePaidMessageReceive>();
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->message_count_ = env->GetIntField(p, res->message_count_fieldID);
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->commission_star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->commission_star_amount_fieldID));
  return std::move(res);
}

void starTransactionTypePaidMessageReceive::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, message_count_fieldID, message_count_);
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  if (commission_star_amount_ != nullptr) { jobject next; commission_star_amount_->store(env, next); if (next) { env->SetObjectField(s, commission_star_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypePaidMessageReceive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypePaidMessageReceive");
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("messageCount", message_count_);
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_object_field("commissionStarAmount", static_cast<const BaseObject *>(commission_star_amount_.get()));
    s.store_class_end();
  }
}

void starTransactionTypePaidMessageReceive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypePaidMessageReceive").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    message_count_fieldID = jni::get_field_id(env, Class, "messageCount", "I");
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    commission_star_amount_fieldID = jni::get_field_id(env, Class, "commissionStarAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypePaidGroupCallMessageSend::Class;
jfieldID starTransactionTypePaidGroupCallMessageSend::chat_id_fieldID;

starTransactionTypePaidGroupCallMessageSend::starTransactionTypePaidGroupCallMessageSend()
  : chat_id_()
{}

starTransactionTypePaidGroupCallMessageSend::starTransactionTypePaidGroupCallMessageSend(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t starTransactionTypePaidGroupCallMessageSend::ID;

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

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

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

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

jclass starTransactionTypePaidGroupCallMessageReceive::Class;
jfieldID starTransactionTypePaidGroupCallMessageReceive::sender_id_fieldID;
jfieldID starTransactionTypePaidGroupCallMessageReceive::commission_per_mille_fieldID;
jfieldID starTransactionTypePaidGroupCallMessageReceive::commission_star_amount_fieldID;

starTransactionTypePaidGroupCallMessageReceive::starTransactionTypePaidGroupCallMessageReceive()
  : sender_id_()
  , commission_per_mille_()
  , commission_star_amount_()
{}

starTransactionTypePaidGroupCallMessageReceive::starTransactionTypePaidGroupCallMessageReceive(object_ptr<MessageSender> &&sender_id_, int32 commission_per_mille_, object_ptr<starAmount> &&commission_star_amount_)
  : sender_id_(std::move(sender_id_))
  , commission_per_mille_(commission_per_mille_)
  , commission_star_amount_(std::move(commission_star_amount_))
{}

const std::int32_t starTransactionTypePaidGroupCallMessageReceive::ID;

object_ptr<StarTransactionType> starTransactionTypePaidGroupCallMessageReceive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypePaidGroupCallMessageReceive> res = make_object<starTransactionTypePaidGroupCallMessageReceive>();
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->commission_star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->commission_star_amount_fieldID));
  return std::move(res);
}

void starTransactionTypePaidGroupCallMessageReceive::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  if (commission_star_amount_ != nullptr) { jobject next; commission_star_amount_->store(env, next); if (next) { env->SetObjectField(s, commission_star_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypePaidGroupCallMessageReceive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypePaidGroupCallMessageReceive");
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_object_field("commissionStarAmount", static_cast<const BaseObject *>(commission_star_amount_.get()));
    s.store_class_end();
  }
}

void starTransactionTypePaidGroupCallMessageReceive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypePaidGroupCallMessageReceive").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    commission_star_amount_fieldID = jni::get_field_id(env, Class, "commissionStarAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypePaidGroupCallReactionSend::Class;
jfieldID starTransactionTypePaidGroupCallReactionSend::chat_id_fieldID;

starTransactionTypePaidGroupCallReactionSend::starTransactionTypePaidGroupCallReactionSend()
  : chat_id_()
{}

starTransactionTypePaidGroupCallReactionSend::starTransactionTypePaidGroupCallReactionSend(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t starTransactionTypePaidGroupCallReactionSend::ID;

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

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

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

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

jclass starTransactionTypePaidGroupCallReactionReceive::Class;
jfieldID starTransactionTypePaidGroupCallReactionReceive::sender_id_fieldID;
jfieldID starTransactionTypePaidGroupCallReactionReceive::commission_per_mille_fieldID;
jfieldID starTransactionTypePaidGroupCallReactionReceive::commission_star_amount_fieldID;

starTransactionTypePaidGroupCallReactionReceive::starTransactionTypePaidGroupCallReactionReceive()
  : sender_id_()
  , commission_per_mille_()
  , commission_star_amount_()
{}

starTransactionTypePaidGroupCallReactionReceive::starTransactionTypePaidGroupCallReactionReceive(object_ptr<MessageSender> &&sender_id_, int32 commission_per_mille_, object_ptr<starAmount> &&commission_star_amount_)
  : sender_id_(std::move(sender_id_))
  , commission_per_mille_(commission_per_mille_)
  , commission_star_amount_(std::move(commission_star_amount_))
{}

const std::int32_t starTransactionTypePaidGroupCallReactionReceive::ID;

object_ptr<StarTransactionType> starTransactionTypePaidGroupCallReactionReceive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypePaidGroupCallReactionReceive> res = make_object<starTransactionTypePaidGroupCallReactionReceive>();
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->commission_star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->commission_star_amount_fieldID));
  return std::move(res);
}

void starTransactionTypePaidGroupCallReactionReceive::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  if (commission_star_amount_ != nullptr) { jobject next; commission_star_amount_->store(env, next); if (next) { env->SetObjectField(s, commission_star_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypePaidGroupCallReactionReceive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypePaidGroupCallReactionReceive");
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_object_field("commissionStarAmount", static_cast<const BaseObject *>(commission_star_amount_.get()));
    s.store_class_end();
  }
}

void starTransactionTypePaidGroupCallReactionReceive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypePaidGroupCallReactionReceive").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    commission_star_amount_fieldID = jni::get_field_id(env, Class, "commissionStarAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeSuggestedPostPaymentSend::Class;
jfieldID starTransactionTypeSuggestedPostPaymentSend::chat_id_fieldID;

starTransactionTypeSuggestedPostPaymentSend::starTransactionTypeSuggestedPostPaymentSend()
  : chat_id_()
{}

starTransactionTypeSuggestedPostPaymentSend::starTransactionTypeSuggestedPostPaymentSend(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t starTransactionTypeSuggestedPostPaymentSend::ID;

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

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

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

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

jclass starTransactionTypeSuggestedPostPaymentReceive::Class;
jfieldID starTransactionTypeSuggestedPostPaymentReceive::user_id_fieldID;

starTransactionTypeSuggestedPostPaymentReceive::starTransactionTypeSuggestedPostPaymentReceive()
  : user_id_()
{}

starTransactionTypeSuggestedPostPaymentReceive::starTransactionTypeSuggestedPostPaymentReceive(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t starTransactionTypeSuggestedPostPaymentReceive::ID;

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

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

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

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

jclass starTransactionTypePremiumPurchase::Class;
jfieldID starTransactionTypePremiumPurchase::user_id_fieldID;
jfieldID starTransactionTypePremiumPurchase::month_count_fieldID;
jfieldID starTransactionTypePremiumPurchase::sticker_fieldID;

starTransactionTypePremiumPurchase::starTransactionTypePremiumPurchase()
  : user_id_()
  , month_count_()
  , sticker_()
{}

starTransactionTypePremiumPurchase::starTransactionTypePremiumPurchase(int53 user_id_, int32 month_count_, object_ptr<sticker> &&sticker_)
  : user_id_(user_id_)
  , month_count_(month_count_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t starTransactionTypePremiumPurchase::ID;

object_ptr<StarTransactionType> starTransactionTypePremiumPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransactionTypePremiumPurchase> res = make_object<starTransactionTypePremiumPurchase>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return std::move(res);
}

void starTransactionTypePremiumPurchase::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, month_count_fieldID, month_count_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransactionTypePremiumPurchase::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransactionTypePremiumPurchase");
    s.store_field("userId", user_id_);
    s.store_field("monthCount", month_count_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void starTransactionTypePremiumPurchase::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransactionTypePremiumPurchase").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass starTransactionTypeBusinessBotTransferSend::Class;
jfieldID starTransactionTypeBusinessBotTransferSend::user_id_fieldID;

starTransactionTypeBusinessBotTransferSend::starTransactionTypeBusinessBotTransferSend()
  : user_id_()
{}

starTransactionTypeBusinessBotTransferSend::starTransactionTypeBusinessBotTransferSend(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t starTransactionTypeBusinessBotTransferSend::ID;

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

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

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

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

jclass starTransactionTypeBusinessBotTransferReceive::Class;
jfieldID starTransactionTypeBusinessBotTransferReceive::user_id_fieldID;

starTransactionTypeBusinessBotTransferReceive::starTransactionTypeBusinessBotTransferReceive()
  : user_id_()
{}

starTransactionTypeBusinessBotTransferReceive::starTransactionTypeBusinessBotTransferReceive(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t starTransactionTypeBusinessBotTransferReceive::ID;

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

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

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

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

jclass starTransactionTypePublicPostSearch::Class;

starTransactionTypePublicPostSearch::starTransactionTypePublicPostSearch() {
}

const std::int32_t starTransactionTypePublicPostSearch::ID;

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

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

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

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

jclass starTransactionTypeUnsupported::Class;

starTransactionTypeUnsupported::starTransactionTypeUnsupported() {
}

const std::int32_t starTransactionTypeUnsupported::ID;

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

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

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

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

jclass StoryPrivacySettings::Class;

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

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

jclass storyPrivacySettingsEveryone::Class;
jfieldID storyPrivacySettingsEveryone::except_user_ids_fieldID;

storyPrivacySettingsEveryone::storyPrivacySettingsEveryone()
  : except_user_ids_()
{}

storyPrivacySettingsEveryone::storyPrivacySettingsEveryone(array<int53> &&except_user_ids_)
  : except_user_ids_(std::move(except_user_ids_))
{}

const std::int32_t storyPrivacySettingsEveryone::ID;

object_ptr<StoryPrivacySettings> storyPrivacySettingsEveryone::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyPrivacySettingsEveryone> res = make_object<storyPrivacySettingsEveryone>();
  res->except_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->except_user_ids_fieldID));
  return std::move(res);
}

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

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

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

jclass storyPrivacySettingsContacts::Class;
jfieldID storyPrivacySettingsContacts::except_user_ids_fieldID;

storyPrivacySettingsContacts::storyPrivacySettingsContacts()
  : except_user_ids_()
{}

storyPrivacySettingsContacts::storyPrivacySettingsContacts(array<int53> &&except_user_ids_)
  : except_user_ids_(std::move(except_user_ids_))
{}

const std::int32_t storyPrivacySettingsContacts::ID;

object_ptr<StoryPrivacySettings> storyPrivacySettingsContacts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyPrivacySettingsContacts> res = make_object<storyPrivacySettingsContacts>();
  res->except_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->except_user_ids_fieldID));
  return std::move(res);
}

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

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

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

jclass storyPrivacySettingsCloseFriends::Class;

storyPrivacySettingsCloseFriends::storyPrivacySettingsCloseFriends() {
}

const std::int32_t storyPrivacySettingsCloseFriends::ID;

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

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

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

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

jclass storyPrivacySettingsSelectedUsers::Class;
jfieldID storyPrivacySettingsSelectedUsers::user_ids_fieldID;

storyPrivacySettingsSelectedUsers::storyPrivacySettingsSelectedUsers()
  : user_ids_()
{}

storyPrivacySettingsSelectedUsers::storyPrivacySettingsSelectedUsers(array<int53> &&user_ids_)
  : user_ids_(std::move(user_ids_))
{}

const std::int32_t storyPrivacySettingsSelectedUsers::ID;

object_ptr<StoryPrivacySettings> storyPrivacySettingsSelectedUsers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyPrivacySettingsSelectedUsers> res = make_object<storyPrivacySettingsSelectedUsers>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return std::move(res);
}

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

jclass SuggestedPostRefundReason::Class;

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

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

jclass suggestedPostRefundReasonPostDeleted::Class;

suggestedPostRefundReasonPostDeleted::suggestedPostRefundReasonPostDeleted() {
}

const std::int32_t suggestedPostRefundReasonPostDeleted::ID;

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

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

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

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

jclass suggestedPostRefundReasonPaymentRefunded::Class;

suggestedPostRefundReasonPaymentRefunded::suggestedPostRefundReasonPaymentRefunded() {
}

const std::int32_t suggestedPostRefundReasonPaymentRefunded::ID;

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

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

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

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

jclass SuggestedPostState::Class;

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

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

jclass suggestedPostStatePending::Class;

suggestedPostStatePending::suggestedPostStatePending() {
}

const std::int32_t suggestedPostStatePending::ID;

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

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

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

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

jclass suggestedPostStateApproved::Class;

suggestedPostStateApproved::suggestedPostStateApproved() {
}

const std::int32_t suggestedPostStateApproved::ID;

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

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

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

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

jclass suggestedPostStateDeclined::Class;

suggestedPostStateDeclined::suggestedPostStateDeclined() {
}

const std::int32_t suggestedPostStateDeclined::ID;

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

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

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

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

jclass targetChatTypes::Class;
jfieldID targetChatTypes::allow_user_chats_fieldID;
jfieldID targetChatTypes::allow_bot_chats_fieldID;
jfieldID targetChatTypes::allow_group_chats_fieldID;
jfieldID targetChatTypes::allow_channel_chats_fieldID;

targetChatTypes::targetChatTypes()
  : allow_user_chats_()
  , allow_bot_chats_()
  , allow_group_chats_()
  , allow_channel_chats_()
{}

targetChatTypes::targetChatTypes(bool allow_user_chats_, bool allow_bot_chats_, bool allow_group_chats_, bool allow_channel_chats_)
  : allow_user_chats_(allow_user_chats_)
  , allow_bot_chats_(allow_bot_chats_)
  , allow_group_chats_(allow_group_chats_)
  , allow_channel_chats_(allow_channel_chats_)
{}

const std::int32_t targetChatTypes::ID;

object_ptr<targetChatTypes> targetChatTypes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<targetChatTypes> res = make_object<targetChatTypes>();
  res->allow_user_chats_ = (env->GetBooleanField(p, res->allow_user_chats_fieldID) != 0);
  res->allow_bot_chats_ = (env->GetBooleanField(p, res->allow_bot_chats_fieldID) != 0);
  res->allow_group_chats_ = (env->GetBooleanField(p, res->allow_group_chats_fieldID) != 0);
  res->allow_channel_chats_ = (env->GetBooleanField(p, res->allow_channel_chats_fieldID) != 0);
  return res;
}

void targetChatTypes::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, allow_user_chats_fieldID, allow_user_chats_);
  env->SetBooleanField(s, allow_bot_chats_fieldID, allow_bot_chats_);
  env->SetBooleanField(s, allow_group_chats_fieldID, allow_group_chats_);
  env->SetBooleanField(s, allow_channel_chats_fieldID, allow_channel_chats_);
}

void targetChatTypes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TargetChatTypes");
    s.store_field("allowUserChats", allow_user_chats_);
    s.store_field("allowBotChats", allow_bot_chats_);
    s.store_field("allowGroupChats", allow_group_chats_);
    s.store_field("allowChannelChats", allow_channel_chats_);
    s.store_class_end();
  }
}

void targetChatTypes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TargetChatTypes").c_str());
    allow_user_chats_fieldID = jni::get_field_id(env, Class, "allowUserChats", "Z");
    allow_bot_chats_fieldID = jni::get_field_id(env, Class, "allowBotChats", "Z");
    allow_group_chats_fieldID = jni::get_field_id(env, Class, "allowGroupChats", "Z");
    allow_channel_chats_fieldID = jni::get_field_id(env, Class, "allowChannelChats", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass TextParseMode::Class;

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

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

jclass textParseModeMarkdown::Class;
jfieldID textParseModeMarkdown::version_fieldID;

textParseModeMarkdown::textParseModeMarkdown()
  : version_()
{}

textParseModeMarkdown::textParseModeMarkdown(int32 version_)
  : version_(version_)
{}

const std::int32_t textParseModeMarkdown::ID;

object_ptr<TextParseMode> textParseModeMarkdown::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<textParseModeMarkdown> res = make_object<textParseModeMarkdown>();
  res->version_ = env->GetIntField(p, res->version_fieldID);
  return std::move(res);
}

void textParseModeMarkdown::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TextParseModeMarkdown");
    s.store_field("version", version_);
    s.store_class_end();
  }
}

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

jclass textParseModeHTML::Class;

textParseModeHTML::textParseModeHTML() {
}

const std::int32_t textParseModeHTML::ID;

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

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

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

jclass themeParameters::Class;
jfieldID themeParameters::background_color_fieldID;
jfieldID themeParameters::secondary_background_color_fieldID;
jfieldID themeParameters::header_background_color_fieldID;
jfieldID themeParameters::bottom_bar_background_color_fieldID;
jfieldID themeParameters::section_background_color_fieldID;
jfieldID themeParameters::section_separator_color_fieldID;
jfieldID themeParameters::text_color_fieldID;
jfieldID themeParameters::accent_text_color_fieldID;
jfieldID themeParameters::section_header_text_color_fieldID;
jfieldID themeParameters::subtitle_text_color_fieldID;
jfieldID themeParameters::destructive_text_color_fieldID;
jfieldID themeParameters::hint_color_fieldID;
jfieldID themeParameters::link_color_fieldID;
jfieldID themeParameters::button_color_fieldID;
jfieldID themeParameters::button_text_color_fieldID;

themeParameters::themeParameters()
  : background_color_()
  , secondary_background_color_()
  , header_background_color_()
  , bottom_bar_background_color_()
  , section_background_color_()
  , section_separator_color_()
  , text_color_()
  , accent_text_color_()
  , section_header_text_color_()
  , subtitle_text_color_()
  , destructive_text_color_()
  , hint_color_()
  , link_color_()
  , button_color_()
  , button_text_color_()
{}

themeParameters::themeParameters(int32 background_color_, int32 secondary_background_color_, int32 header_background_color_, int32 bottom_bar_background_color_, int32 section_background_color_, int32 section_separator_color_, int32 text_color_, int32 accent_text_color_, int32 section_header_text_color_, int32 subtitle_text_color_, int32 destructive_text_color_, int32 hint_color_, int32 link_color_, int32 button_color_, int32 button_text_color_)
  : background_color_(background_color_)
  , secondary_background_color_(secondary_background_color_)
  , header_background_color_(header_background_color_)
  , bottom_bar_background_color_(bottom_bar_background_color_)
  , section_background_color_(section_background_color_)
  , section_separator_color_(section_separator_color_)
  , text_color_(text_color_)
  , accent_text_color_(accent_text_color_)
  , section_header_text_color_(section_header_text_color_)
  , subtitle_text_color_(subtitle_text_color_)
  , destructive_text_color_(destructive_text_color_)
  , hint_color_(hint_color_)
  , link_color_(link_color_)
  , button_color_(button_color_)
  , button_text_color_(button_text_color_)
{}

const std::int32_t themeParameters::ID;

object_ptr<themeParameters> themeParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<themeParameters> res = make_object<themeParameters>();
  res->background_color_ = env->GetIntField(p, res->background_color_fieldID);
  res->secondary_background_color_ = env->GetIntField(p, res->secondary_background_color_fieldID);
  res->header_background_color_ = env->GetIntField(p, res->header_background_color_fieldID);
  res->bottom_bar_background_color_ = env->GetIntField(p, res->bottom_bar_background_color_fieldID);
  res->section_background_color_ = env->GetIntField(p, res->section_background_color_fieldID);
  res->section_separator_color_ = env->GetIntField(p, res->section_separator_color_fieldID);
  res->text_color_ = env->GetIntField(p, res->text_color_fieldID);
  res->accent_text_color_ = env->GetIntField(p, res->accent_text_color_fieldID);
  res->section_header_text_color_ = env->GetIntField(p, res->section_header_text_color_fieldID);
  res->subtitle_text_color_ = env->GetIntField(p, res->subtitle_text_color_fieldID);
  res->destructive_text_color_ = env->GetIntField(p, res->destructive_text_color_fieldID);
  res->hint_color_ = env->GetIntField(p, res->hint_color_fieldID);
  res->link_color_ = env->GetIntField(p, res->link_color_fieldID);
  res->button_color_ = env->GetIntField(p, res->button_color_fieldID);
  res->button_text_color_ = env->GetIntField(p, res->button_text_color_fieldID);
  return res;
}

void themeParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThemeParameters");
    s.store_field("backgroundColor", background_color_);
    s.store_field("secondaryBackgroundColor", secondary_background_color_);
    s.store_field("headerBackgroundColor", header_background_color_);
    s.store_field("bottomBarBackgroundColor", bottom_bar_background_color_);
    s.store_field("sectionBackgroundColor", section_background_color_);
    s.store_field("sectionSeparatorColor", section_separator_color_);
    s.store_field("textColor", text_color_);
    s.store_field("accentTextColor", accent_text_color_);
    s.store_field("sectionHeaderTextColor", section_header_text_color_);
    s.store_field("subtitleTextColor", subtitle_text_color_);
    s.store_field("destructiveTextColor", destructive_text_color_);
    s.store_field("hintColor", hint_color_);
    s.store_field("linkColor", link_color_);
    s.store_field("buttonColor", button_color_);
    s.store_field("buttonTextColor", button_text_color_);
    s.store_class_end();
  }
}

void themeParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThemeParameters").c_str());
    background_color_fieldID = jni::get_field_id(env, Class, "backgroundColor", "I");
    secondary_background_color_fieldID = jni::get_field_id(env, Class, "secondaryBackgroundColor", "I");
    header_background_color_fieldID = jni::get_field_id(env, Class, "headerBackgroundColor", "I");
    bottom_bar_background_color_fieldID = jni::get_field_id(env, Class, "bottomBarBackgroundColor", "I");
    section_background_color_fieldID = jni::get_field_id(env, Class, "sectionBackgroundColor", "I");
    section_separator_color_fieldID = jni::get_field_id(env, Class, "sectionSeparatorColor", "I");
    text_color_fieldID = jni::get_field_id(env, Class, "textColor", "I");
    accent_text_color_fieldID = jni::get_field_id(env, Class, "accentTextColor", "I");
    section_header_text_color_fieldID = jni::get_field_id(env, Class, "sectionHeaderTextColor", "I");
    subtitle_text_color_fieldID = jni::get_field_id(env, Class, "subtitleTextColor", "I");
    destructive_text_color_fieldID = jni::get_field_id(env, Class, "destructiveTextColor", "I");
    hint_color_fieldID = jni::get_field_id(env, Class, "hintColor", "I");
    link_color_fieldID = jni::get_field_id(env, Class, "linkColor", "I");
    button_color_fieldID = jni::get_field_id(env, Class, "buttonColor", "I");
    button_text_color_fieldID = jni::get_field_id(env, Class, "buttonTextColor", "I");
    return true;
  }();
  (void)is_inited;
}

jclass thumbnail::Class;
jfieldID thumbnail::format_fieldID;
jfieldID thumbnail::width_fieldID;
jfieldID thumbnail::height_fieldID;
jfieldID thumbnail::file_fieldID;

thumbnail::thumbnail()
  : format_()
  , width_()
  , height_()
  , file_()
{}

thumbnail::thumbnail(object_ptr<ThumbnailFormat> &&format_, int32 width_, int32 height_, object_ptr<file> &&file_)
  : format_(std::move(format_))
  , width_(width_)
  , height_(height_)
  , file_(std::move(file_))
{}

const std::int32_t thumbnail::ID;

object_ptr<thumbnail> thumbnail::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<thumbnail> res = make_object<thumbnail>();
  res->format_ = jni::fetch_tl_object<ThumbnailFormat>(env, jni::fetch_object(env, p, res->format_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->file_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->file_fieldID));
  return res;
}

void thumbnail::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (format_ != nullptr) { jobject next; format_->store(env, next); if (next) { env->SetObjectField(s, format_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  if (file_ != nullptr) { jobject next; file_->store(env, next); if (next) { env->SetObjectField(s, file_fieldID, next); env->DeleteLocalRef(next); } }
}

void thumbnail::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Thumbnail");
    s.store_object_field("format", static_cast<const BaseObject *>(format_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_object_field("file", static_cast<const BaseObject *>(file_.get()));
    s.store_class_end();
  }
}

void thumbnail::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Thumbnail").c_str());
    format_fieldID = jni::get_field_id(env, Class, "format", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThumbnailFormat;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    file_fieldID = jni::get_field_id(env, Class, "file", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass updates::Class;
jfieldID updates::updates_fieldID;

updates::updates()
  : updates_()
{}

updates::updates(array<object_ptr<Update>> &&updates_)
  : updates_(std::move(updates_))
{}

const std::int32_t updates::ID;

object_ptr<updates> updates::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<updates> res = make_object<updates>();
  res->updates_ = jni::FetchVector<Update>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->updates_fieldID));
  return res;
}

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

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

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

jclass upgradeGiftResult::Class;
jfieldID upgradeGiftResult::gift_fieldID;
jfieldID upgradeGiftResult::received_gift_id_fieldID;
jfieldID upgradeGiftResult::is_saved_fieldID;
jfieldID upgradeGiftResult::can_be_transferred_fieldID;
jfieldID upgradeGiftResult::transfer_star_count_fieldID;
jfieldID upgradeGiftResult::drop_original_details_star_count_fieldID;
jfieldID upgradeGiftResult::next_transfer_date_fieldID;
jfieldID upgradeGiftResult::next_resale_date_fieldID;
jfieldID upgradeGiftResult::export_date_fieldID;

upgradeGiftResult::upgradeGiftResult()
  : gift_()
  , received_gift_id_()
  , is_saved_()
  , can_be_transferred_()
  , transfer_star_count_()
  , drop_original_details_star_count_()
  , next_transfer_date_()
  , next_resale_date_()
  , export_date_()
{}

upgradeGiftResult::upgradeGiftResult(object_ptr<upgradedGift> &&gift_, string const &received_gift_id_, bool is_saved_, bool can_be_transferred_, int53 transfer_star_count_, int53 drop_original_details_star_count_, int32 next_transfer_date_, int32 next_resale_date_, int32 export_date_)
  : gift_(std::move(gift_))
  , received_gift_id_(received_gift_id_)
  , is_saved_(is_saved_)
  , can_be_transferred_(can_be_transferred_)
  , transfer_star_count_(transfer_star_count_)
  , drop_original_details_star_count_(drop_original_details_star_count_)
  , next_transfer_date_(next_transfer_date_)
  , next_resale_date_(next_resale_date_)
  , export_date_(export_date_)
{}

const std::int32_t upgradeGiftResult::ID;

object_ptr<upgradeGiftResult> upgradeGiftResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradeGiftResult> res = make_object<upgradeGiftResult>();
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->is_saved_ = (env->GetBooleanField(p, res->is_saved_fieldID) != 0);
  res->can_be_transferred_ = (env->GetBooleanField(p, res->can_be_transferred_fieldID) != 0);
  res->transfer_star_count_ = env->GetLongField(p, res->transfer_star_count_fieldID);
  res->drop_original_details_star_count_ = env->GetLongField(p, res->drop_original_details_star_count_fieldID);
  res->next_transfer_date_ = env->GetIntField(p, res->next_transfer_date_fieldID);
  res->next_resale_date_ = env->GetIntField(p, res->next_resale_date_fieldID);
  res->export_date_ = env->GetIntField(p, res->export_date_fieldID);
  return res;
}

void upgradeGiftResult::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, received_gift_id_); if (nextString) { env->SetObjectField(s, received_gift_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_saved_fieldID, is_saved_);
  env->SetBooleanField(s, can_be_transferred_fieldID, can_be_transferred_);
  env->SetLongField(s, transfer_star_count_fieldID, transfer_star_count_);
  env->SetLongField(s, drop_original_details_star_count_fieldID, drop_original_details_star_count_);
  env->SetIntField(s, next_transfer_date_fieldID, next_transfer_date_);
  env->SetIntField(s, next_resale_date_fieldID, next_resale_date_);
  env->SetIntField(s, export_date_fieldID, export_date_);
}

void upgradeGiftResult::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradeGiftResult");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_field("isSaved", is_saved_);
    s.store_field("canBeTransferred", can_be_transferred_);
    s.store_field("transferStarCount", transfer_star_count_);
    s.store_field("dropOriginalDetailsStarCount", drop_original_details_star_count_);
    s.store_field("nextTransferDate", next_transfer_date_);
    s.store_field("nextResaleDate", next_resale_date_);
    s.store_field("exportDate", export_date_);
    s.store_class_end();
  }
}

void upgradeGiftResult::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradeGiftResult").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    is_saved_fieldID = jni::get_field_id(env, Class, "isSaved", "Z");
    can_be_transferred_fieldID = jni::get_field_id(env, Class, "canBeTransferred", "Z");
    transfer_star_count_fieldID = jni::get_field_id(env, Class, "transferStarCount", "J");
    drop_original_details_star_count_fieldID = jni::get_field_id(env, Class, "dropOriginalDetailsStarCount", "J");
    next_transfer_date_fieldID = jni::get_field_id(env, Class, "nextTransferDate", "I");
    next_resale_date_fieldID = jni::get_field_id(env, Class, "nextResaleDate", "I");
    export_date_fieldID = jni::get_field_id(env, Class, "exportDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass user::Class;
jfieldID user::id_fieldID;
jfieldID user::first_name_fieldID;
jfieldID user::last_name_fieldID;
jfieldID user::usernames_fieldID;
jfieldID user::phone_number_fieldID;
jfieldID user::status_fieldID;
jfieldID user::profile_photo_fieldID;
jfieldID user::accent_color_id_fieldID;
jfieldID user::background_custom_emoji_id_fieldID;
jfieldID user::upgraded_gift_colors_fieldID;
jfieldID user::profile_accent_color_id_fieldID;
jfieldID user::profile_background_custom_emoji_id_fieldID;
jfieldID user::emoji_status_fieldID;
jfieldID user::is_contact_fieldID;
jfieldID user::is_mutual_contact_fieldID;
jfieldID user::is_close_friend_fieldID;
jfieldID user::verification_status_fieldID;
jfieldID user::is_premium_fieldID;
jfieldID user::is_support_fieldID;
jfieldID user::restriction_info_fieldID;
jfieldID user::active_story_state_fieldID;
jfieldID user::restricts_new_chats_fieldID;
jfieldID user::paid_message_star_count_fieldID;
jfieldID user::have_access_fieldID;
jfieldID user::type_fieldID;
jfieldID user::language_code_fieldID;
jfieldID user::added_to_attachment_menu_fieldID;

user::user()
  : id_()
  , first_name_()
  , last_name_()
  , usernames_()
  , phone_number_()
  , status_()
  , profile_photo_()
  , accent_color_id_()
  , background_custom_emoji_id_()
  , upgraded_gift_colors_()
  , profile_accent_color_id_()
  , profile_background_custom_emoji_id_()
  , emoji_status_()
  , is_contact_()
  , is_mutual_contact_()
  , is_close_friend_()
  , verification_status_()
  , is_premium_()
  , is_support_()
  , restriction_info_()
  , active_story_state_()
  , restricts_new_chats_()
  , paid_message_star_count_()
  , have_access_()
  , type_()
  , language_code_()
  , added_to_attachment_menu_()
{}

user::user(int53 id_, string const &first_name_, string const &last_name_, object_ptr<usernames> &&usernames_, string const &phone_number_, object_ptr<UserStatus> &&status_, object_ptr<profilePhoto> &&profile_photo_, int32 accent_color_id_, int64 background_custom_emoji_id_, object_ptr<upgradedGiftColors> &&upgraded_gift_colors_, int32 profile_accent_color_id_, int64 profile_background_custom_emoji_id_, object_ptr<emojiStatus> &&emoji_status_, bool is_contact_, bool is_mutual_contact_, bool is_close_friend_, object_ptr<verificationStatus> &&verification_status_, bool is_premium_, bool is_support_, object_ptr<restrictionInfo> &&restriction_info_, object_ptr<ActiveStoryState> &&active_story_state_, bool restricts_new_chats_, int53 paid_message_star_count_, bool have_access_, object_ptr<UserType> &&type_, string const &language_code_, bool added_to_attachment_menu_)
  : id_(id_)
  , first_name_(first_name_)
  , last_name_(last_name_)
  , usernames_(std::move(usernames_))
  , phone_number_(phone_number_)
  , status_(std::move(status_))
  , profile_photo_(std::move(profile_photo_))
  , accent_color_id_(accent_color_id_)
  , background_custom_emoji_id_(background_custom_emoji_id_)
  , upgraded_gift_colors_(std::move(upgraded_gift_colors_))
  , profile_accent_color_id_(profile_accent_color_id_)
  , profile_background_custom_emoji_id_(profile_background_custom_emoji_id_)
  , emoji_status_(std::move(emoji_status_))
  , is_contact_(is_contact_)
  , is_mutual_contact_(is_mutual_contact_)
  , is_close_friend_(is_close_friend_)
  , verification_status_(std::move(verification_status_))
  , is_premium_(is_premium_)
  , is_support_(is_support_)
  , restriction_info_(std::move(restriction_info_))
  , active_story_state_(std::move(active_story_state_))
  , restricts_new_chats_(restricts_new_chats_)
  , paid_message_star_count_(paid_message_star_count_)
  , have_access_(have_access_)
  , type_(std::move(type_))
  , language_code_(language_code_)
  , added_to_attachment_menu_(added_to_attachment_menu_)
{}

const std::int32_t user::ID;

object_ptr<user> user::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<user> res = make_object<user>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  res->usernames_ = jni::fetch_tl_object<usernames>(env, jni::fetch_object(env, p, res->usernames_fieldID));
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->status_ = jni::fetch_tl_object<UserStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  res->profile_photo_ = jni::fetch_tl_object<profilePhoto>(env, jni::fetch_object(env, p, res->profile_photo_fieldID));
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->background_custom_emoji_id_ = env->GetLongField(p, res->background_custom_emoji_id_fieldID);
  res->upgraded_gift_colors_ = jni::fetch_tl_object<upgradedGiftColors>(env, jni::fetch_object(env, p, res->upgraded_gift_colors_fieldID));
  res->profile_accent_color_id_ = env->GetIntField(p, res->profile_accent_color_id_fieldID);
  res->profile_background_custom_emoji_id_ = env->GetLongField(p, res->profile_background_custom_emoji_id_fieldID);
  res->emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->emoji_status_fieldID));
  res->is_contact_ = (env->GetBooleanField(p, res->is_contact_fieldID) != 0);
  res->is_mutual_contact_ = (env->GetBooleanField(p, res->is_mutual_contact_fieldID) != 0);
  res->is_close_friend_ = (env->GetBooleanField(p, res->is_close_friend_fieldID) != 0);
  res->verification_status_ = jni::fetch_tl_object<verificationStatus>(env, jni::fetch_object(env, p, res->verification_status_fieldID));
  res->is_premium_ = (env->GetBooleanField(p, res->is_premium_fieldID) != 0);
  res->is_support_ = (env->GetBooleanField(p, res->is_support_fieldID) != 0);
  res->restriction_info_ = jni::fetch_tl_object<restrictionInfo>(env, jni::fetch_object(env, p, res->restriction_info_fieldID));
  res->active_story_state_ = jni::fetch_tl_object<ActiveStoryState>(env, jni::fetch_object(env, p, res->active_story_state_fieldID));
  res->restricts_new_chats_ = (env->GetBooleanField(p, res->restricts_new_chats_fieldID) != 0);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  res->have_access_ = (env->GetBooleanField(p, res->have_access_fieldID) != 0);
  res->type_ = jni::fetch_tl_object<UserType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->added_to_attachment_menu_ = (env->GetBooleanField(p, res->added_to_attachment_menu_fieldID) != 0);
  return res;
}

void user::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, first_name_); if (nextString) { env->SetObjectField(s, first_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, last_name_); if (nextString) { env->SetObjectField(s, last_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (usernames_ != nullptr) { jobject next; usernames_->store(env, next); if (next) { env->SetObjectField(s, usernames_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, phone_number_); if (nextString) { env->SetObjectField(s, phone_number_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
  if (profile_photo_ != nullptr) { jobject next; profile_photo_->store(env, next); if (next) { env->SetObjectField(s, profile_photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, accent_color_id_fieldID, accent_color_id_);
  env->SetLongField(s, background_custom_emoji_id_fieldID, background_custom_emoji_id_);
  if (upgraded_gift_colors_ != nullptr) { jobject next; upgraded_gift_colors_->store(env, next); if (next) { env->SetObjectField(s, upgraded_gift_colors_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, profile_accent_color_id_fieldID, profile_accent_color_id_);
  env->SetLongField(s, profile_background_custom_emoji_id_fieldID, profile_background_custom_emoji_id_);
  if (emoji_status_ != nullptr) { jobject next; emoji_status_->store(env, next); if (next) { env->SetObjectField(s, emoji_status_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_contact_fieldID, is_contact_);
  env->SetBooleanField(s, is_mutual_contact_fieldID, is_mutual_contact_);
  env->SetBooleanField(s, is_close_friend_fieldID, is_close_friend_);
  if (verification_status_ != nullptr) { jobject next; verification_status_->store(env, next); if (next) { env->SetObjectField(s, verification_status_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_premium_fieldID, is_premium_);
  env->SetBooleanField(s, is_support_fieldID, is_support_);
  if (restriction_info_ != nullptr) { jobject next; restriction_info_->store(env, next); if (next) { env->SetObjectField(s, restriction_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (active_story_state_ != nullptr) { jobject next; active_story_state_->store(env, next); if (next) { env->SetObjectField(s, active_story_state_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, restricts_new_chats_fieldID, restricts_new_chats_);
  env->SetLongField(s, paid_message_star_count_fieldID, paid_message_star_count_);
  env->SetBooleanField(s, have_access_fieldID, have_access_);
  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, language_code_); if (nextString) { env->SetObjectField(s, language_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, added_to_attachment_menu_fieldID, added_to_attachment_menu_);
}

void user::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "User");
    s.store_field("id", id_);
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_object_field("usernames", static_cast<const BaseObject *>(usernames_.get()));
    s.store_field("phoneNumber", phone_number_);
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_object_field("profilePhoto", static_cast<const BaseObject *>(profile_photo_.get()));
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("backgroundCustomEmojiId", background_custom_emoji_id_);
    s.store_object_field("upgradedGiftColors", static_cast<const BaseObject *>(upgraded_gift_colors_.get()));
    s.store_field("profileAccentColorId", profile_accent_color_id_);
    s.store_field("profileBackgroundCustomEmojiId", profile_background_custom_emoji_id_);
    s.store_object_field("emojiStatus", static_cast<const BaseObject *>(emoji_status_.get()));
    s.store_field("isContact", is_contact_);
    s.store_field("isMutualContact", is_mutual_contact_);
    s.store_field("isCloseFriend", is_close_friend_);
    s.store_object_field("verificationStatus", static_cast<const BaseObject *>(verification_status_.get()));
    s.store_field("isPremium", is_premium_);
    s.store_field("isSupport", is_support_);
    s.store_object_field("restrictionInfo", static_cast<const BaseObject *>(restriction_info_.get()));
    s.store_object_field("activeStoryState", static_cast<const BaseObject *>(active_story_state_.get()));
    s.store_field("restrictsNewChats", restricts_new_chats_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_field("haveAccess", have_access_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("languageCode", language_code_);
    s.store_field("addedToAttachmentMenu", added_to_attachment_menu_);
    s.store_class_end();
  }
}

void user::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$User").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    first_name_fieldID = jni::get_field_id(env, Class, "firstName", "Ljava/lang/String;");
    last_name_fieldID = jni::get_field_id(env, Class, "lastName", "Ljava/lang/String;");
    usernames_fieldID = jni::get_field_id(env, Class, "usernames", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Usernames;").c_str());
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserStatus;").c_str());
    profile_photo_fieldID = jni::get_field_id(env, Class, "profilePhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProfilePhoto;").c_str());
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "backgroundCustomEmojiId", "J");
    upgraded_gift_colors_fieldID = jni::get_field_id(env, Class, "upgradedGiftColors", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftColors;").c_str());
    profile_accent_color_id_fieldID = jni::get_field_id(env, Class, "profileAccentColorId", "I");
    profile_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "profileBackgroundCustomEmojiId", "J");
    emoji_status_fieldID = jni::get_field_id(env, Class, "emojiStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatus;").c_str());
    is_contact_fieldID = jni::get_field_id(env, Class, "isContact", "Z");
    is_mutual_contact_fieldID = jni::get_field_id(env, Class, "isMutualContact", "Z");
    is_close_friend_fieldID = jni::get_field_id(env, Class, "isCloseFriend", "Z");
    verification_status_fieldID = jni::get_field_id(env, Class, "verificationStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VerificationStatus;").c_str());
    is_premium_fieldID = jni::get_field_id(env, Class, "isPremium", "Z");
    is_support_fieldID = jni::get_field_id(env, Class, "isSupport", "Z");
    restriction_info_fieldID = jni::get_field_id(env, Class, "restrictionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RestrictionInfo;").c_str());
    active_story_state_fieldID = jni::get_field_id(env, Class, "activeStoryState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ActiveStoryState;").c_str());
    restricts_new_chats_fieldID = jni::get_field_id(env, Class, "restrictsNewChats", "Z");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    have_access_fieldID = jni::get_field_id(env, Class, "haveAccess", "Z");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserType;").c_str());
    language_code_fieldID = jni::get_field_id(env, Class, "languageCode", "Ljava/lang/String;");
    added_to_attachment_menu_fieldID = jni::get_field_id(env, Class, "addedToAttachmentMenu", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass UserType::Class;

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

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

jclass userTypeRegular::Class;

userTypeRegular::userTypeRegular() {
}

const std::int32_t userTypeRegular::ID;

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

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

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

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

jclass userTypeDeleted::Class;

userTypeDeleted::userTypeDeleted() {
}

const std::int32_t userTypeDeleted::ID;

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

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

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

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

jclass userTypeBot::Class;
jfieldID userTypeBot::can_be_edited_fieldID;
jfieldID userTypeBot::can_join_groups_fieldID;
jfieldID userTypeBot::can_read_all_group_messages_fieldID;
jfieldID userTypeBot::has_main_web_app_fieldID;
jfieldID userTypeBot::has_topics_fieldID;
jfieldID userTypeBot::allows_users_to_create_topics_fieldID;
jfieldID userTypeBot::can_manage_bots_fieldID;
jfieldID userTypeBot::is_inline_fieldID;
jfieldID userTypeBot::inline_query_placeholder_fieldID;
jfieldID userTypeBot::supports_guest_queries_fieldID;
jfieldID userTypeBot::need_location_fieldID;
jfieldID userTypeBot::can_connect_to_business_fieldID;
jfieldID userTypeBot::can_be_added_to_attachment_menu_fieldID;
jfieldID userTypeBot::active_user_count_fieldID;

userTypeBot::userTypeBot()
  : can_be_edited_()
  , can_join_groups_()
  , can_read_all_group_messages_()
  , has_main_web_app_()
  , has_topics_()
  , allows_users_to_create_topics_()
  , can_manage_bots_()
  , is_inline_()
  , inline_query_placeholder_()
  , supports_guest_queries_()
  , need_location_()
  , can_connect_to_business_()
  , can_be_added_to_attachment_menu_()
  , active_user_count_()
{}

userTypeBot::userTypeBot(bool can_be_edited_, bool can_join_groups_, bool can_read_all_group_messages_, bool has_main_web_app_, bool has_topics_, bool allows_users_to_create_topics_, bool can_manage_bots_, bool is_inline_, string const &inline_query_placeholder_, bool supports_guest_queries_, bool need_location_, bool can_connect_to_business_, bool can_be_added_to_attachment_menu_, int32 active_user_count_)
  : can_be_edited_(can_be_edited_)
  , can_join_groups_(can_join_groups_)
  , can_read_all_group_messages_(can_read_all_group_messages_)
  , has_main_web_app_(has_main_web_app_)
  , has_topics_(has_topics_)
  , allows_users_to_create_topics_(allows_users_to_create_topics_)
  , can_manage_bots_(can_manage_bots_)
  , is_inline_(is_inline_)
  , inline_query_placeholder_(inline_query_placeholder_)
  , supports_guest_queries_(supports_guest_queries_)
  , need_location_(need_location_)
  , can_connect_to_business_(can_connect_to_business_)
  , can_be_added_to_attachment_menu_(can_be_added_to_attachment_menu_)
  , active_user_count_(active_user_count_)
{}

const std::int32_t userTypeBot::ID;

object_ptr<UserType> userTypeBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userTypeBot> res = make_object<userTypeBot>();
  res->can_be_edited_ = (env->GetBooleanField(p, res->can_be_edited_fieldID) != 0);
  res->can_join_groups_ = (env->GetBooleanField(p, res->can_join_groups_fieldID) != 0);
  res->can_read_all_group_messages_ = (env->GetBooleanField(p, res->can_read_all_group_messages_fieldID) != 0);
  res->has_main_web_app_ = (env->GetBooleanField(p, res->has_main_web_app_fieldID) != 0);
  res->has_topics_ = (env->GetBooleanField(p, res->has_topics_fieldID) != 0);
  res->allows_users_to_create_topics_ = (env->GetBooleanField(p, res->allows_users_to_create_topics_fieldID) != 0);
  res->can_manage_bots_ = (env->GetBooleanField(p, res->can_manage_bots_fieldID) != 0);
  res->is_inline_ = (env->GetBooleanField(p, res->is_inline_fieldID) != 0);
  res->inline_query_placeholder_ = jni::fetch_string(env, p, res->inline_query_placeholder_fieldID);
  res->supports_guest_queries_ = (env->GetBooleanField(p, res->supports_guest_queries_fieldID) != 0);
  res->need_location_ = (env->GetBooleanField(p, res->need_location_fieldID) != 0);
  res->can_connect_to_business_ = (env->GetBooleanField(p, res->can_connect_to_business_fieldID) != 0);
  res->can_be_added_to_attachment_menu_ = (env->GetBooleanField(p, res->can_be_added_to_attachment_menu_fieldID) != 0);
  res->active_user_count_ = env->GetIntField(p, res->active_user_count_fieldID);
  return std::move(res);
}

void userTypeBot::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_be_edited_fieldID, can_be_edited_);
  env->SetBooleanField(s, can_join_groups_fieldID, can_join_groups_);
  env->SetBooleanField(s, can_read_all_group_messages_fieldID, can_read_all_group_messages_);
  env->SetBooleanField(s, has_main_web_app_fieldID, has_main_web_app_);
  env->SetBooleanField(s, has_topics_fieldID, has_topics_);
  env->SetBooleanField(s, allows_users_to_create_topics_fieldID, allows_users_to_create_topics_);
  env->SetBooleanField(s, can_manage_bots_fieldID, can_manage_bots_);
  env->SetBooleanField(s, is_inline_fieldID, is_inline_);
  { jstring nextString = jni::to_jstring(env, inline_query_placeholder_); if (nextString) { env->SetObjectField(s, inline_query_placeholder_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, supports_guest_queries_fieldID, supports_guest_queries_);
  env->SetBooleanField(s, need_location_fieldID, need_location_);
  env->SetBooleanField(s, can_connect_to_business_fieldID, can_connect_to_business_);
  env->SetBooleanField(s, can_be_added_to_attachment_menu_fieldID, can_be_added_to_attachment_menu_);
  env->SetIntField(s, active_user_count_fieldID, active_user_count_);
}

void userTypeBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserTypeBot");
    s.store_field("canBeEdited", can_be_edited_);
    s.store_field("canJoinGroups", can_join_groups_);
    s.store_field("canReadAllGroupMessages", can_read_all_group_messages_);
    s.store_field("hasMainWebApp", has_main_web_app_);
    s.store_field("hasTopics", has_topics_);
    s.store_field("allowsUsersToCreateTopics", allows_users_to_create_topics_);
    s.store_field("canManageBots", can_manage_bots_);
    s.store_field("isInline", is_inline_);
    s.store_field("inlineQueryPlaceholder", inline_query_placeholder_);
    s.store_field("supportsGuestQueries", supports_guest_queries_);
    s.store_field("needLocation", need_location_);
    s.store_field("canConnectToBusiness", can_connect_to_business_);
    s.store_field("canBeAddedToAttachmentMenu", can_be_added_to_attachment_menu_);
    s.store_field("activeUserCount", active_user_count_);
    s.store_class_end();
  }
}

void userTypeBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UserTypeBot").c_str());
    can_be_edited_fieldID = jni::get_field_id(env, Class, "canBeEdited", "Z");
    can_join_groups_fieldID = jni::get_field_id(env, Class, "canJoinGroups", "Z");
    can_read_all_group_messages_fieldID = jni::get_field_id(env, Class, "canReadAllGroupMessages", "Z");
    has_main_web_app_fieldID = jni::get_field_id(env, Class, "hasMainWebApp", "Z");
    has_topics_fieldID = jni::get_field_id(env, Class, "hasTopics", "Z");
    allows_users_to_create_topics_fieldID = jni::get_field_id(env, Class, "allowsUsersToCreateTopics", "Z");
    can_manage_bots_fieldID = jni::get_field_id(env, Class, "canManageBots", "Z");
    is_inline_fieldID = jni::get_field_id(env, Class, "isInline", "Z");
    inline_query_placeholder_fieldID = jni::get_field_id(env, Class, "inlineQueryPlaceholder", "Ljava/lang/String;");
    supports_guest_queries_fieldID = jni::get_field_id(env, Class, "supportsGuestQueries", "Z");
    need_location_fieldID = jni::get_field_id(env, Class, "needLocation", "Z");
    can_connect_to_business_fieldID = jni::get_field_id(env, Class, "canConnectToBusiness", "Z");
    can_be_added_to_attachment_menu_fieldID = jni::get_field_id(env, Class, "canBeAddedToAttachmentMenu", "Z");
    active_user_count_fieldID = jni::get_field_id(env, Class, "activeUserCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass userTypeUnknown::Class;

userTypeUnknown::userTypeUnknown() {
}

const std::int32_t userTypeUnknown::ID;

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

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

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

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

jclass users::Class;
jfieldID users::total_count_fieldID;
jfieldID users::user_ids_fieldID;

users::users()
  : total_count_()
  , user_ids_()
{}

users::users(int32 total_count_, array<int53> &&user_ids_)
  : total_count_(total_count_)
  , user_ids_(std::move(user_ids_))
{}

const std::int32_t users::ID;

object_ptr<users> users::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<users> res = make_object<users>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return res;
}

void users::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, user_ids_); if (arr_tmp_) { env->SetObjectField(s, user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void users::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Users");
    s.store_field("totalCount", total_count_);
    { 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 users::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Users").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass validatedOrderInfo::Class;
jfieldID validatedOrderInfo::order_info_id_fieldID;
jfieldID validatedOrderInfo::shipping_options_fieldID;

validatedOrderInfo::validatedOrderInfo()
  : order_info_id_()
  , shipping_options_()
{}

validatedOrderInfo::validatedOrderInfo(string const &order_info_id_, array<object_ptr<shippingOption>> &&shipping_options_)
  : order_info_id_(order_info_id_)
  , shipping_options_(std::move(shipping_options_))
{}

const std::int32_t validatedOrderInfo::ID;

object_ptr<validatedOrderInfo> validatedOrderInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<validatedOrderInfo> res = make_object<validatedOrderInfo>();
  res->order_info_id_ = jni::fetch_string(env, p, res->order_info_id_fieldID);
  res->shipping_options_ = jni::FetchVector<shippingOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->shipping_options_fieldID));
  return res;
}

void validatedOrderInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, order_info_id_); if (nextString) { env->SetObjectField(s, order_info_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, shipping_options_); if (arr_tmp_) { env->SetObjectField(s, shipping_options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void validatedOrderInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ValidatedOrderInfo");
    s.store_field("orderInfoId", order_info_id_);
    { s.store_vector_begin("shippingOptions", shipping_options_.size()); for (const auto &_value : shipping_options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void validatedOrderInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ValidatedOrderInfo").c_str());
    order_info_id_fieldID = jni::get_field_id(env, Class, "orderInfoId", "Ljava/lang/String;");
    shipping_options_fieldID = jni::get_field_id(env, Class, "shippingOptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ShippingOption;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addChatFolderByInviteLink::Class;
jfieldID addChatFolderByInviteLink::invite_link_fieldID;
jfieldID addChatFolderByInviteLink::chat_ids_fieldID;

addChatFolderByInviteLink::addChatFolderByInviteLink()
  : invite_link_()
  , chat_ids_()
{}

addChatFolderByInviteLink::addChatFolderByInviteLink(string const &invite_link_, array<int53> &&chat_ids_)
  : invite_link_(invite_link_)
  , chat_ids_(std::move(chat_ids_))
{}

const std::int32_t addChatFolderByInviteLink::ID;

object_ptr<addChatFolderByInviteLink> addChatFolderByInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addChatFolderByInviteLink> res = make_object<addChatFolderByInviteLink>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return res;
}

void addChatFolderByInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddChatFolderByInviteLink");
    s.store_field("inviteLink", invite_link_);
    { 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();
  }
}

addChatFolderByInviteLink::ReturnType addChatFolderByInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addChatFolderByInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddChatFolderByInviteLink").c_str());
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    chat_ids_fieldID = jni::get_field_id(env, Class, "chatIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass addChatMembers::Class;
jfieldID addChatMembers::chat_id_fieldID;
jfieldID addChatMembers::user_ids_fieldID;

addChatMembers::addChatMembers()
  : chat_id_()
  , user_ids_()
{}

addChatMembers::addChatMembers(int53 chat_id_, array<int53> &&user_ids_)
  : chat_id_(chat_id_)
  , user_ids_(std::move(user_ids_))
{}

const std::int32_t addChatMembers::ID;

object_ptr<addChatMembers> addChatMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addChatMembers> res = make_object<addChatMembers>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return res;
}

void addChatMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddChatMembers");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("userIds", user_ids_.size()); for (const auto &_value : user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

addChatMembers::ReturnType addChatMembers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return failedToAddMembers::fetch(env, p);
}

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

jclass addPollOption::Class;
jfieldID addPollOption::chat_id_fieldID;
jfieldID addPollOption::message_id_fieldID;
jfieldID addPollOption::option_fieldID;

addPollOption::addPollOption()
  : chat_id_()
  , message_id_()
  , option_()
{}

addPollOption::addPollOption(int53 chat_id_, int53 message_id_, object_ptr<inputPollOption> &&option_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , option_(std::move(option_))
{}

const std::int32_t addPollOption::ID;

object_ptr<addPollOption> addPollOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addPollOption> res = make_object<addPollOption>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->option_ = jni::fetch_tl_object<inputPollOption>(env, jni::fetch_object(env, p, res->option_fieldID));
  return res;
}

void addPollOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddPollOption");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("option", static_cast<const BaseObject *>(option_.get()));
    s.store_class_end();
  }
}

addPollOption::ReturnType addPollOption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass addProxy::Class;
jfieldID addProxy::proxy_fieldID;
jfieldID addProxy::enable_fieldID;
jfieldID addProxy::comment_fieldID;

addProxy::addProxy()
  : proxy_()
  , enable_()
  , comment_()
{}

addProxy::addProxy(object_ptr<proxy> &&proxy_, bool enable_, string const &comment_)
  : proxy_(std::move(proxy_))
  , enable_(enable_)
  , comment_(comment_)
{}

const std::int32_t addProxy::ID;

object_ptr<addProxy> addProxy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addProxy> res = make_object<addProxy>();
  res->proxy_ = jni::fetch_tl_object<proxy>(env, jni::fetch_object(env, p, res->proxy_fieldID));
  res->enable_ = (env->GetBooleanField(p, res->enable_fieldID) != 0);
  res->comment_ = jni::fetch_string(env, p, res->comment_fieldID);
  return res;
}

void addProxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddProxy");
    s.store_object_field("proxy", static_cast<const BaseObject *>(proxy_.get()));
    s.store_field("enable", enable_);
    s.store_field("comment", comment_);
    s.store_class_end();
  }
}

addProxy::ReturnType addProxy::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return addedProxy::fetch(env, p);
}

void addProxy::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddProxy").c_str());
    proxy_fieldID = jni::get_field_id(env, Class, "proxy", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Proxy;").c_str());
    enable_fieldID = jni::get_field_id(env, Class, "enable", "Z");
    comment_fieldID = jni::get_field_id(env, Class, "comment", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass addRecentSticker::Class;
jfieldID addRecentSticker::is_attached_fieldID;
jfieldID addRecentSticker::sticker_fieldID;

addRecentSticker::addRecentSticker()
  : is_attached_()
  , sticker_()
{}

addRecentSticker::addRecentSticker(bool is_attached_, object_ptr<InputFile> &&sticker_)
  : is_attached_(is_attached_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t addRecentSticker::ID;

object_ptr<addRecentSticker> addRecentSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addRecentSticker> res = make_object<addRecentSticker>();
  res->is_attached_ = (env->GetBooleanField(p, res->is_attached_fieldID) != 0);
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

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

addRecentSticker::ReturnType addRecentSticker::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

void addRecentSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddRecentSticker").c_str());
    is_attached_fieldID = jni::get_field_id(env, Class, "isAttached", "Z");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass answerInlineQuery::Class;
jfieldID answerInlineQuery::inline_query_id_fieldID;
jfieldID answerInlineQuery::is_personal_fieldID;
jfieldID answerInlineQuery::button_fieldID;
jfieldID answerInlineQuery::results_fieldID;
jfieldID answerInlineQuery::cache_time_fieldID;
jfieldID answerInlineQuery::next_offset_fieldID;

answerInlineQuery::answerInlineQuery()
  : inline_query_id_()
  , is_personal_()
  , button_()
  , results_()
  , cache_time_()
  , next_offset_()
{}

answerInlineQuery::answerInlineQuery(int64 inline_query_id_, bool is_personal_, object_ptr<inlineQueryResultsButton> &&button_, array<object_ptr<InputInlineQueryResult>> &&results_, int32 cache_time_, string const &next_offset_)
  : inline_query_id_(inline_query_id_)
  , is_personal_(is_personal_)
  , button_(std::move(button_))
  , results_(std::move(results_))
  , cache_time_(cache_time_)
  , next_offset_(next_offset_)
{}

const std::int32_t answerInlineQuery::ID;

object_ptr<answerInlineQuery> answerInlineQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<answerInlineQuery> res = make_object<answerInlineQuery>();
  res->inline_query_id_ = env->GetLongField(p, res->inline_query_id_fieldID);
  res->is_personal_ = (env->GetBooleanField(p, res->is_personal_fieldID) != 0);
  res->button_ = jni::fetch_tl_object<inlineQueryResultsButton>(env, jni::fetch_object(env, p, res->button_fieldID));
  res->results_ = jni::FetchVector<InputInlineQueryResult>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->results_fieldID));
  res->cache_time_ = env->GetIntField(p, res->cache_time_fieldID);
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void answerInlineQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnswerInlineQuery");
    s.store_field("inlineQueryId", inline_query_id_);
    s.store_field("isPersonal", is_personal_);
    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("cacheTime", cache_time_);
    s.store_field("nextOffset", next_offset_);
    s.store_class_end();
  }
}

answerInlineQuery::ReturnType answerInlineQuery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void answerInlineQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnswerInlineQuery").c_str());
    inline_query_id_fieldID = jni::get_field_id(env, Class, "inlineQueryId", "J");
    is_personal_fieldID = jni::get_field_id(env, Class, "isPersonal", "Z");
    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$InputInlineQueryResult;").c_str());
    cache_time_fieldID = jni::get_field_id(env, Class, "cacheTime", "I");
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass answerPreCheckoutQuery::Class;
jfieldID answerPreCheckoutQuery::pre_checkout_query_id_fieldID;
jfieldID answerPreCheckoutQuery::error_message_fieldID;

answerPreCheckoutQuery::answerPreCheckoutQuery()
  : pre_checkout_query_id_()
  , error_message_()
{}

answerPreCheckoutQuery::answerPreCheckoutQuery(int64 pre_checkout_query_id_, string const &error_message_)
  : pre_checkout_query_id_(pre_checkout_query_id_)
  , error_message_(error_message_)
{}

const std::int32_t answerPreCheckoutQuery::ID;

object_ptr<answerPreCheckoutQuery> answerPreCheckoutQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<answerPreCheckoutQuery> res = make_object<answerPreCheckoutQuery>();
  res->pre_checkout_query_id_ = env->GetLongField(p, res->pre_checkout_query_id_fieldID);
  res->error_message_ = jni::fetch_string(env, p, res->error_message_fieldID);
  return res;
}

void answerPreCheckoutQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnswerPreCheckoutQuery");
    s.store_field("preCheckoutQueryId", pre_checkout_query_id_);
    s.store_field("errorMessage", error_message_);
    s.store_class_end();
  }
}

answerPreCheckoutQuery::ReturnType answerPreCheckoutQuery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void answerPreCheckoutQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnswerPreCheckoutQuery").c_str());
    pre_checkout_query_id_fieldID = jni::get_field_id(env, Class, "preCheckoutQueryId", "J");
    error_message_fieldID = jni::get_field_id(env, Class, "errorMessage", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass clickChatSponsoredMessage::Class;
jfieldID clickChatSponsoredMessage::chat_id_fieldID;
jfieldID clickChatSponsoredMessage::message_id_fieldID;
jfieldID clickChatSponsoredMessage::is_media_click_fieldID;
jfieldID clickChatSponsoredMessage::from_fullscreen_fieldID;

clickChatSponsoredMessage::clickChatSponsoredMessage()
  : chat_id_()
  , message_id_()
  , is_media_click_()
  , from_fullscreen_()
{}

clickChatSponsoredMessage::clickChatSponsoredMessage(int53 chat_id_, int53 message_id_, bool is_media_click_, bool from_fullscreen_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , is_media_click_(is_media_click_)
  , from_fullscreen_(from_fullscreen_)
{}

const std::int32_t clickChatSponsoredMessage::ID;

object_ptr<clickChatSponsoredMessage> clickChatSponsoredMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<clickChatSponsoredMessage> res = make_object<clickChatSponsoredMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_media_click_ = (env->GetBooleanField(p, res->is_media_click_fieldID) != 0);
  res->from_fullscreen_ = (env->GetBooleanField(p, res->from_fullscreen_fieldID) != 0);
  return res;
}

void clickChatSponsoredMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ClickChatSponsoredMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("isMediaClick", is_media_click_);
    s.store_field("fromFullscreen", from_fullscreen_);
    s.store_class_end();
  }
}

clickChatSponsoredMessage::ReturnType clickChatSponsoredMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void clickChatSponsoredMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ClickChatSponsoredMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    is_media_click_fieldID = jni::get_field_id(env, Class, "isMediaClick", "Z");
    from_fullscreen_fieldID = jni::get_field_id(env, Class, "fromFullscreen", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createCall::Class;
jfieldID createCall::user_id_fieldID;
jfieldID createCall::protocol_fieldID;
jfieldID createCall::is_video_fieldID;

createCall::createCall()
  : user_id_()
  , protocol_()
  , is_video_()
{}

createCall::createCall(int53 user_id_, object_ptr<callProtocol> &&protocol_, bool is_video_)
  : user_id_(user_id_)
  , protocol_(std::move(protocol_))
  , is_video_(is_video_)
{}

const std::int32_t createCall::ID;

object_ptr<createCall> createCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createCall> res = make_object<createCall>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->protocol_ = jni::fetch_tl_object<callProtocol>(env, jni::fetch_object(env, p, res->protocol_fieldID));
  res->is_video_ = (env->GetBooleanField(p, res->is_video_fieldID) != 0);
  return res;
}

void createCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateCall");
    s.store_field("userId", user_id_);
    s.store_object_field("protocol", static_cast<const BaseObject *>(protocol_.get()));
    s.store_field("isVideo", is_video_);
    s.store_class_end();
  }
}

createCall::ReturnType createCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return callId::fetch(env, p);
}

void createCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateCall").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    protocol_fieldID = jni::get_field_id(env, Class, "protocol", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CallProtocol;").c_str());
    is_video_fieldID = jni::get_field_id(env, Class, "isVideo", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createInvoiceLink::Class;
jfieldID createInvoiceLink::business_connection_id_fieldID;
jfieldID createInvoiceLink::invoice_fieldID;

createInvoiceLink::createInvoiceLink()
  : business_connection_id_()
  , invoice_()
{}

createInvoiceLink::createInvoiceLink(string const &business_connection_id_, object_ptr<InputMessageContent> &&invoice_)
  : business_connection_id_(business_connection_id_)
  , invoice_(std::move(invoice_))
{}

const std::int32_t createInvoiceLink::ID;

object_ptr<createInvoiceLink> createInvoiceLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createInvoiceLink> res = make_object<createInvoiceLink>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->invoice_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->invoice_fieldID));
  return res;
}

void createInvoiceLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateInvoiceLink");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_object_field("invoice", static_cast<const BaseObject *>(invoice_.get()));
    s.store_class_end();
  }
}

createInvoiceLink::ReturnType createInvoiceLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void createInvoiceLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateInvoiceLink").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    invoice_fieldID = jni::get_field_id(env, Class, "invoice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass createSupergroupChat::Class;
jfieldID createSupergroupChat::supergroup_id_fieldID;
jfieldID createSupergroupChat::force_fieldID;

createSupergroupChat::createSupergroupChat()
  : supergroup_id_()
  , force_()
{}

createSupergroupChat::createSupergroupChat(int53 supergroup_id_, bool force_)
  : supergroup_id_(supergroup_id_)
  , force_(force_)
{}

const std::int32_t createSupergroupChat::ID;

object_ptr<createSupergroupChat> createSupergroupChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createSupergroupChat> res = make_object<createSupergroupChat>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->force_ = (env->GetBooleanField(p, res->force_fieldID) != 0);
  return res;
}

void createSupergroupChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateSupergroupChat");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("force", force_);
    s.store_class_end();
  }
}

createSupergroupChat::ReturnType createSupergroupChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

void createSupergroupChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateSupergroupChat").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    force_fieldID = jni::get_field_id(env, Class, "force", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createVideoChat::Class;
jfieldID createVideoChat::chat_id_fieldID;
jfieldID createVideoChat::title_fieldID;
jfieldID createVideoChat::start_date_fieldID;
jfieldID createVideoChat::is_rtmp_stream_fieldID;

createVideoChat::createVideoChat()
  : chat_id_()
  , title_()
  , start_date_()
  , is_rtmp_stream_()
{}

createVideoChat::createVideoChat(int53 chat_id_, string const &title_, int32 start_date_, bool is_rtmp_stream_)
  : chat_id_(chat_id_)
  , title_(title_)
  , start_date_(start_date_)
  , is_rtmp_stream_(is_rtmp_stream_)
{}

const std::int32_t createVideoChat::ID;

object_ptr<createVideoChat> createVideoChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createVideoChat> res = make_object<createVideoChat>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  res->is_rtmp_stream_ = (env->GetBooleanField(p, res->is_rtmp_stream_fieldID) != 0);
  return res;
}

void createVideoChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateVideoChat");
    s.store_field("chatId", chat_id_);
    s.store_field("title", title_);
    s.store_field("startDate", start_date_);
    s.store_field("isRtmpStream", is_rtmp_stream_);
    s.store_class_end();
  }
}

createVideoChat::ReturnType createVideoChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return groupCallId::fetch(env, p);
}

void createVideoChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateVideoChat").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    is_rtmp_stream_fieldID = jni::get_field_id(env, Class, "isRtmpStream", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass deleteAllCallMessages::Class;
jfieldID deleteAllCallMessages::revoke_fieldID;

deleteAllCallMessages::deleteAllCallMessages()
  : revoke_()
{}

deleteAllCallMessages::deleteAllCallMessages(bool revoke_)
  : revoke_(revoke_)
{}

const std::int32_t deleteAllCallMessages::ID;

object_ptr<deleteAllCallMessages> deleteAllCallMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteAllCallMessages> res = make_object<deleteAllCallMessages>();
  res->revoke_ = (env->GetBooleanField(p, res->revoke_fieldID) != 0);
  return res;
}

void deleteAllCallMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteAllCallMessages");
    s.store_field("revoke", revoke_);
    s.store_class_end();
  }
}

deleteAllCallMessages::ReturnType deleteAllCallMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass disconnectAffiliateProgram::Class;
jfieldID disconnectAffiliateProgram::affiliate_fieldID;
jfieldID disconnectAffiliateProgram::url_fieldID;

disconnectAffiliateProgram::disconnectAffiliateProgram()
  : affiliate_()
  , url_()
{}

disconnectAffiliateProgram::disconnectAffiliateProgram(object_ptr<AffiliateType> &&affiliate_, string const &url_)
  : affiliate_(std::move(affiliate_))
  , url_(url_)
{}

const std::int32_t disconnectAffiliateProgram::ID;

object_ptr<disconnectAffiliateProgram> disconnectAffiliateProgram::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<disconnectAffiliateProgram> res = make_object<disconnectAffiliateProgram>();
  res->affiliate_ = jni::fetch_tl_object<AffiliateType>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return res;
}

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

disconnectAffiliateProgram::ReturnType disconnectAffiliateProgram::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return connectedAffiliateProgram::fetch(env, p);
}

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

jclass editMessageSchedulingState::Class;
jfieldID editMessageSchedulingState::chat_id_fieldID;
jfieldID editMessageSchedulingState::message_id_fieldID;
jfieldID editMessageSchedulingState::scheduling_state_fieldID;

editMessageSchedulingState::editMessageSchedulingState()
  : chat_id_()
  , message_id_()
  , scheduling_state_()
{}

editMessageSchedulingState::editMessageSchedulingState(int53 chat_id_, int53 message_id_, object_ptr<MessageSchedulingState> &&scheduling_state_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , scheduling_state_(std::move(scheduling_state_))
{}

const std::int32_t editMessageSchedulingState::ID;

object_ptr<editMessageSchedulingState> editMessageSchedulingState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editMessageSchedulingState> res = make_object<editMessageSchedulingState>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->scheduling_state_ = jni::fetch_tl_object<MessageSchedulingState>(env, jni::fetch_object(env, p, res->scheduling_state_fieldID));
  return res;
}

void editMessageSchedulingState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditMessageSchedulingState");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("schedulingState", static_cast<const BaseObject *>(scheduling_state_.get()));
    s.store_class_end();
  }
}

editMessageSchedulingState::ReturnType editMessageSchedulingState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editMessageSchedulingState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditMessageSchedulingState").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    scheduling_state_fieldID = jni::get_field_id(env, Class, "schedulingState", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSchedulingState;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass finishFileGeneration::Class;
jfieldID finishFileGeneration::generation_id_fieldID;
jfieldID finishFileGeneration::error_fieldID;

finishFileGeneration::finishFileGeneration()
  : generation_id_()
  , error_()
{}

finishFileGeneration::finishFileGeneration(int64 generation_id_, object_ptr<error> &&error_)
  : generation_id_(generation_id_)
  , error_(std::move(error_))
{}

const std::int32_t finishFileGeneration::ID;

object_ptr<finishFileGeneration> finishFileGeneration::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<finishFileGeneration> res = make_object<finishFileGeneration>();
  res->generation_id_ = env->GetLongField(p, res->generation_id_fieldID);
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  return res;
}

void finishFileGeneration::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FinishFileGeneration");
    s.store_field("generationId", generation_id_);
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_class_end();
  }
}

finishFileGeneration::ReturnType finishFileGeneration::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void finishFileGeneration::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FinishFileGeneration").c_str());
    generation_id_fieldID = jni::get_field_id(env, Class, "generationId", "J");
    error_fieldID = jni::get_field_id(env, Class, "error", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Error;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass getArchivedStickerSets::Class;
jfieldID getArchivedStickerSets::sticker_type_fieldID;
jfieldID getArchivedStickerSets::offset_sticker_set_id_fieldID;
jfieldID getArchivedStickerSets::limit_fieldID;

getArchivedStickerSets::getArchivedStickerSets()
  : sticker_type_()
  , offset_sticker_set_id_()
  , limit_()
{}

getArchivedStickerSets::getArchivedStickerSets(object_ptr<StickerType> &&sticker_type_, int64 offset_sticker_set_id_, int32 limit_)
  : sticker_type_(std::move(sticker_type_))
  , offset_sticker_set_id_(offset_sticker_set_id_)
  , limit_(limit_)
{}

const std::int32_t getArchivedStickerSets::ID;

object_ptr<getArchivedStickerSets> getArchivedStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getArchivedStickerSets> res = make_object<getArchivedStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->offset_sticker_set_id_ = env->GetLongField(p, res->offset_sticker_set_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getArchivedStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetArchivedStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("offsetStickerSetId", offset_sticker_set_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getArchivedStickerSets::ReturnType getArchivedStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSets::fetch(env, p);
}

void getArchivedStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetArchivedStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    offset_sticker_set_id_fieldID = jni::get_field_id(env, Class, "offsetStickerSetId", "J");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getBusinessFeatures::Class;
jfieldID getBusinessFeatures::source_fieldID;

getBusinessFeatures::getBusinessFeatures()
  : source_()
{}

getBusinessFeatures::getBusinessFeatures(object_ptr<BusinessFeature> &&source_)
  : source_(std::move(source_))
{}

const std::int32_t getBusinessFeatures::ID;

object_ptr<getBusinessFeatures> getBusinessFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBusinessFeatures> res = make_object<getBusinessFeatures>();
  res->source_ = jni::fetch_tl_object<BusinessFeature>(env, jni::fetch_object(env, p, res->source_fieldID));
  return res;
}

void getBusinessFeatures::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBusinessFeatures");
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_class_end();
  }
}

getBusinessFeatures::ReturnType getBusinessFeatures::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessFeatures::fetch(env, p);
}

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

jclass getChatInviteLinks::Class;
jfieldID getChatInviteLinks::chat_id_fieldID;
jfieldID getChatInviteLinks::creator_user_id_fieldID;
jfieldID getChatInviteLinks::is_revoked_fieldID;
jfieldID getChatInviteLinks::offset_date_fieldID;
jfieldID getChatInviteLinks::offset_invite_link_fieldID;
jfieldID getChatInviteLinks::limit_fieldID;

getChatInviteLinks::getChatInviteLinks()
  : chat_id_()
  , creator_user_id_()
  , is_revoked_()
  , offset_date_()
  , offset_invite_link_()
  , limit_()
{}

getChatInviteLinks::getChatInviteLinks(int53 chat_id_, int53 creator_user_id_, bool is_revoked_, int32 offset_date_, string const &offset_invite_link_, int32 limit_)
  : chat_id_(chat_id_)
  , creator_user_id_(creator_user_id_)
  , is_revoked_(is_revoked_)
  , offset_date_(offset_date_)
  , offset_invite_link_(offset_invite_link_)
  , limit_(limit_)
{}

const std::int32_t getChatInviteLinks::ID;

object_ptr<getChatInviteLinks> getChatInviteLinks::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatInviteLinks> res = make_object<getChatInviteLinks>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->creator_user_id_ = env->GetLongField(p, res->creator_user_id_fieldID);
  res->is_revoked_ = (env->GetBooleanField(p, res->is_revoked_fieldID) != 0);
  res->offset_date_ = env->GetIntField(p, res->offset_date_fieldID);
  res->offset_invite_link_ = jni::fetch_string(env, p, res->offset_invite_link_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatInviteLinks::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatInviteLinks");
    s.store_field("chatId", chat_id_);
    s.store_field("creatorUserId", creator_user_id_);
    s.store_field("isRevoked", is_revoked_);
    s.store_field("offsetDate", offset_date_);
    s.store_field("offsetInviteLink", offset_invite_link_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatInviteLinks::ReturnType getChatInviteLinks::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLinks::fetch(env, p);
}

void getChatInviteLinks::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatInviteLinks").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    creator_user_id_fieldID = jni::get_field_id(env, Class, "creatorUserId", "J");
    is_revoked_fieldID = jni::get_field_id(env, Class, "isRevoked", "Z");
    offset_date_fieldID = jni::get_field_id(env, Class, "offsetDate", "I");
    offset_invite_link_fieldID = jni::get_field_id(env, Class, "offsetInviteLink", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getChatsForChatFolderInviteLink::Class;
jfieldID getChatsForChatFolderInviteLink::chat_folder_id_fieldID;

getChatsForChatFolderInviteLink::getChatsForChatFolderInviteLink()
  : chat_folder_id_()
{}

getChatsForChatFolderInviteLink::getChatsForChatFolderInviteLink(int32 chat_folder_id_)
  : chat_folder_id_(chat_folder_id_)
{}

const std::int32_t getChatsForChatFolderInviteLink::ID;

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

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

getChatsForChatFolderInviteLink::ReturnType getChatsForChatFolderInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getConnectedAffiliatePrograms::Class;
jfieldID getConnectedAffiliatePrograms::affiliate_fieldID;
jfieldID getConnectedAffiliatePrograms::offset_fieldID;
jfieldID getConnectedAffiliatePrograms::limit_fieldID;

getConnectedAffiliatePrograms::getConnectedAffiliatePrograms()
  : affiliate_()
  , offset_()
  , limit_()
{}

getConnectedAffiliatePrograms::getConnectedAffiliatePrograms(object_ptr<AffiliateType> &&affiliate_, string const &offset_, int32 limit_)
  : affiliate_(std::move(affiliate_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getConnectedAffiliatePrograms::ID;

object_ptr<getConnectedAffiliatePrograms> getConnectedAffiliatePrograms::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getConnectedAffiliatePrograms> res = make_object<getConnectedAffiliatePrograms>();
  res->affiliate_ = jni::fetch_tl_object<AffiliateType>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getConnectedAffiliatePrograms::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetConnectedAffiliatePrograms");
    s.store_object_field("affiliate", static_cast<const BaseObject *>(affiliate_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getConnectedAffiliatePrograms::ReturnType getConnectedAffiliatePrograms::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return connectedAffiliatePrograms::fetch(env, p);
}

void getConnectedAffiliatePrograms::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetConnectedAffiliatePrograms").c_str());
    affiliate_fieldID = jni::get_field_id(env, Class, "affiliate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateType;").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 getConnectedWebsites::Class;

getConnectedWebsites::getConnectedWebsites() {
}

const std::int32_t getConnectedWebsites::ID;

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

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

getConnectedWebsites::ReturnType getConnectedWebsites::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return connectedWebsites::fetch(env, p);
}

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

jclass getContacts::Class;

getContacts::getContacts() {
}

const std::int32_t getContacts::ID;

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

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

getContacts::ReturnType getContacts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return users::fetch(env, p);
}

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

jclass getDatabaseStatistics::Class;

getDatabaseStatistics::getDatabaseStatistics() {
}

const std::int32_t getDatabaseStatistics::ID;

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

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

getDatabaseStatistics::ReturnType getDatabaseStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return databaseStatistics::fetch(env, p);
}

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

jclass getEmojiSuggestionsUrl::Class;
jfieldID getEmojiSuggestionsUrl::language_code_fieldID;

getEmojiSuggestionsUrl::getEmojiSuggestionsUrl()
  : language_code_()
{}

getEmojiSuggestionsUrl::getEmojiSuggestionsUrl(string const &language_code_)
  : language_code_(language_code_)
{}

const std::int32_t getEmojiSuggestionsUrl::ID;

object_ptr<getEmojiSuggestionsUrl> getEmojiSuggestionsUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getEmojiSuggestionsUrl> res = make_object<getEmojiSuggestionsUrl>();
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  return res;
}

void getEmojiSuggestionsUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetEmojiSuggestionsUrl");
    s.store_field("languageCode", language_code_);
    s.store_class_end();
  }
}

getEmojiSuggestionsUrl::ReturnType getEmojiSuggestionsUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass getExternalLinkInfo::Class;
jfieldID getExternalLinkInfo::link_fieldID;

getExternalLinkInfo::getExternalLinkInfo()
  : link_()
{}

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

const std::int32_t getExternalLinkInfo::ID;

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

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

getExternalLinkInfo::ReturnType getExternalLinkInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return LoginUrlInfo::fetch(env, p);
}

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

jclass getFile::Class;
jfieldID getFile::file_id_fieldID;

getFile::getFile()
  : file_id_()
{}

getFile::getFile(int32 file_id_)
  : file_id_(file_id_)
{}

const std::int32_t getFile::ID;

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

void getFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetFile");
    s.store_field("fileId", file_id_);
    s.store_class_end();
  }
}

getFile::ReturnType getFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return file::fetch(env, p);
}

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

jclass getForumTopics::Class;
jfieldID getForumTopics::chat_id_fieldID;
jfieldID getForumTopics::query_fieldID;
jfieldID getForumTopics::offset_date_fieldID;
jfieldID getForumTopics::offset_message_id_fieldID;
jfieldID getForumTopics::offset_forum_topic_id_fieldID;
jfieldID getForumTopics::limit_fieldID;

getForumTopics::getForumTopics()
  : chat_id_()
  , query_()
  , offset_date_()
  , offset_message_id_()
  , offset_forum_topic_id_()
  , limit_()
{}

getForumTopics::getForumTopics(int53 chat_id_, string const &query_, int32 offset_date_, int53 offset_message_id_, int32 offset_forum_topic_id_, int32 limit_)
  : chat_id_(chat_id_)
  , query_(query_)
  , offset_date_(offset_date_)
  , offset_message_id_(offset_message_id_)
  , offset_forum_topic_id_(offset_forum_topic_id_)
  , limit_(limit_)
{}

const std::int32_t getForumTopics::ID;

object_ptr<getForumTopics> getForumTopics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getForumTopics> res = make_object<getForumTopics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->offset_date_ = env->GetIntField(p, res->offset_date_fieldID);
  res->offset_message_id_ = env->GetLongField(p, res->offset_message_id_fieldID);
  res->offset_forum_topic_id_ = env->GetIntField(p, res->offset_forum_topic_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getForumTopics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetForumTopics");
    s.store_field("chatId", chat_id_);
    s.store_field("query", query_);
    s.store_field("offsetDate", offset_date_);
    s.store_field("offsetMessageId", offset_message_id_);
    s.store_field("offsetForumTopicId", offset_forum_topic_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getForumTopics::ReturnType getForumTopics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return forumTopics::fetch(env, p);
}

void getForumTopics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetForumTopics").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;");
    offset_date_fieldID = jni::get_field_id(env, Class, "offsetDate", "I");
    offset_message_id_fieldID = jni::get_field_id(env, Class, "offsetMessageId", "J");
    offset_forum_topic_id_fieldID = jni::get_field_id(env, Class, "offsetForumTopicId", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getGiftChatThemes::Class;
jfieldID getGiftChatThemes::offset_fieldID;
jfieldID getGiftChatThemes::limit_fieldID;

getGiftChatThemes::getGiftChatThemes()
  : offset_()
  , limit_()
{}

getGiftChatThemes::getGiftChatThemes(string const &offset_, int32 limit_)
  : offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getGiftChatThemes::ID;

object_ptr<getGiftChatThemes> getGiftChatThemes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getGiftChatThemes> res = make_object<getGiftChatThemes>();
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getGiftChatThemes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGiftChatThemes");
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getGiftChatThemes::ReturnType getGiftChatThemes::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftChatThemes::fetch(env, p);
}

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

getGiftUpgradePreview::getGiftUpgradePreview()
  : regular_gift_id_()
{}

getGiftUpgradePreview::getGiftUpgradePreview(int64 regular_gift_id_)
  : regular_gift_id_(regular_gift_id_)
{}

const std::int32_t getGiftUpgradePreview::ID;

object_ptr<getGiftUpgradePreview> getGiftUpgradePreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getGiftUpgradePreview> res = make_object<getGiftUpgradePreview>();
  res->regular_gift_id_ = env->GetLongField(p, res->regular_gift_id_fieldID);
  return res;
}

void getGiftUpgradePreview::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGiftUpgradePreview");
    s.store_field("regularGiftId", regular_gift_id_);
    s.store_class_end();
  }
}

getGiftUpgradePreview::ReturnType getGiftUpgradePreview::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftUpgradePreview::fetch(env, p);
}

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

jclass getGrossingWebAppBots::Class;
jfieldID getGrossingWebAppBots::offset_fieldID;
jfieldID getGrossingWebAppBots::limit_fieldID;

getGrossingWebAppBots::getGrossingWebAppBots()
  : offset_()
  , limit_()
{}

getGrossingWebAppBots::getGrossingWebAppBots(string const &offset_, int32 limit_)
  : offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getGrossingWebAppBots::ID;

object_ptr<getGrossingWebAppBots> getGrossingWebAppBots::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getGrossingWebAppBots> res = make_object<getGrossingWebAppBots>();
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getGrossingWebAppBots::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGrossingWebAppBots");
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getGrossingWebAppBots::ReturnType getGrossingWebAppBots::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundUsers::fetch(env, p);
}

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

getLanguagePackStrings::getLanguagePackStrings()
  : language_pack_id_()
  , keys_()
{}

getLanguagePackStrings::getLanguagePackStrings(string const &language_pack_id_, array<string> &&keys_)
  : language_pack_id_(language_pack_id_)
  , keys_(std::move(keys_))
{}

const std::int32_t getLanguagePackStrings::ID;

object_ptr<getLanguagePackStrings> getLanguagePackStrings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getLanguagePackStrings> res = make_object<getLanguagePackStrings>();
  res->language_pack_id_ = jni::fetch_string(env, p, res->language_pack_id_fieldID);
  res->keys_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->keys_fieldID));
  return res;
}

void getLanguagePackStrings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLanguagePackStrings");
    s.store_field("languagePackId", language_pack_id_);
    { s.store_vector_begin("keys", keys_.size()); for (const auto &_value : keys_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

getLanguagePackStrings::ReturnType getLanguagePackStrings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return languagePackStrings::fetch(env, p);
}

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

jclass getLogStream::Class;

getLogStream::getLogStream() {
}

const std::int32_t getLogStream::ID;

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

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

getLogStream::ReturnType getLogStream::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return LogStream::fetch(env, p);
}

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

jclass getLoginUrl::Class;
jfieldID getLoginUrl::chat_id_fieldID;
jfieldID getLoginUrl::message_id_fieldID;
jfieldID getLoginUrl::button_id_fieldID;
jfieldID getLoginUrl::allow_write_access_fieldID;

getLoginUrl::getLoginUrl()
  : chat_id_()
  , message_id_()
  , button_id_()
  , allow_write_access_()
{}

getLoginUrl::getLoginUrl(int53 chat_id_, int53 message_id_, int53 button_id_, bool allow_write_access_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , button_id_(button_id_)
  , allow_write_access_(allow_write_access_)
{}

const std::int32_t getLoginUrl::ID;

object_ptr<getLoginUrl> getLoginUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getLoginUrl> res = make_object<getLoginUrl>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->button_id_ = env->GetLongField(p, res->button_id_fieldID);
  res->allow_write_access_ = (env->GetBooleanField(p, res->allow_write_access_fieldID) != 0);
  return res;
}

void getLoginUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLoginUrl");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("buttonId", button_id_);
    s.store_field("allowWriteAccess", allow_write_access_);
    s.store_class_end();
  }
}

getLoginUrl::ReturnType getLoginUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void getLoginUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetLoginUrl").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    button_id_fieldID = jni::get_field_id(env, Class, "buttonId", "J");
    allow_write_access_fieldID = jni::get_field_id(env, Class, "allowWriteAccess", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getLoginUrlInfo::Class;
jfieldID getLoginUrlInfo::chat_id_fieldID;
jfieldID getLoginUrlInfo::message_id_fieldID;
jfieldID getLoginUrlInfo::button_id_fieldID;

getLoginUrlInfo::getLoginUrlInfo()
  : chat_id_()
  , message_id_()
  , button_id_()
{}

getLoginUrlInfo::getLoginUrlInfo(int53 chat_id_, int53 message_id_, int53 button_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , button_id_(button_id_)
{}

const std::int32_t getLoginUrlInfo::ID;

object_ptr<getLoginUrlInfo> getLoginUrlInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getLoginUrlInfo> res = make_object<getLoginUrlInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->button_id_ = env->GetLongField(p, res->button_id_fieldID);
  return res;
}

void getLoginUrlInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLoginUrlInfo");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("buttonId", button_id_);
    s.store_class_end();
  }
}

getLoginUrlInfo::ReturnType getLoginUrlInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return LoginUrlInfo::fetch(env, p);
}

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

jclass getMessageFileType::Class;
jfieldID getMessageFileType::message_file_head_fieldID;

getMessageFileType::getMessageFileType()
  : message_file_head_()
{}

getMessageFileType::getMessageFileType(string const &message_file_head_)
  : message_file_head_(message_file_head_)
{}

const std::int32_t getMessageFileType::ID;

object_ptr<getMessageFileType> getMessageFileType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageFileType> res = make_object<getMessageFileType>();
  res->message_file_head_ = jni::fetch_string(env, p, res->message_file_head_fieldID);
  return res;
}

void getMessageFileType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageFileType");
    s.store_field("messageFileHead", message_file_head_);
    s.store_class_end();
  }
}

getMessageFileType::ReturnType getMessageFileType::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return MessageFileType::fetch(env, p);
}

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

jclass getMessageProperties::Class;
jfieldID getMessageProperties::chat_id_fieldID;
jfieldID getMessageProperties::message_id_fieldID;

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

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

const std::int32_t getMessageProperties::ID;

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

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

getMessageProperties::ReturnType getMessageProperties::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageProperties::fetch(env, p);
}

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

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

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

const std::int32_t getMessageViewers::ID;

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

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

getMessageViewers::ReturnType getMessageViewers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageViewers::fetch(env, p);
}

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

getOauthLinkInfo::getOauthLinkInfo()
  : url_()
  , in_app_origin_()
{}

getOauthLinkInfo::getOauthLinkInfo(string const &url_, string const &in_app_origin_)
  : url_(url_)
  , in_app_origin_(in_app_origin_)
{}

const std::int32_t getOauthLinkInfo::ID;

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

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

getOauthLinkInfo::ReturnType getOauthLinkInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return oauthLinkInfo::fetch(env, p);
}

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

jclass getPhoneNumberInfoSync::Class;
jfieldID getPhoneNumberInfoSync::language_code_fieldID;
jfieldID getPhoneNumberInfoSync::phone_number_prefix_fieldID;

getPhoneNumberInfoSync::getPhoneNumberInfoSync()
  : language_code_()
  , phone_number_prefix_()
{}

getPhoneNumberInfoSync::getPhoneNumberInfoSync(string const &language_code_, string const &phone_number_prefix_)
  : language_code_(language_code_)
  , phone_number_prefix_(phone_number_prefix_)
{}

const std::int32_t getPhoneNumberInfoSync::ID;

object_ptr<getPhoneNumberInfoSync> getPhoneNumberInfoSync::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPhoneNumberInfoSync> res = make_object<getPhoneNumberInfoSync>();
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->phone_number_prefix_ = jni::fetch_string(env, p, res->phone_number_prefix_fieldID);
  return res;
}

void getPhoneNumberInfoSync::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPhoneNumberInfoSync");
    s.store_field("languageCode", language_code_);
    s.store_field("phoneNumberPrefix", phone_number_prefix_);
    s.store_class_end();
  }
}

getPhoneNumberInfoSync::ReturnType getPhoneNumberInfoSync::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return phoneNumberInfo::fetch(env, p);
}

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

jclass getPremiumGiveawayPaymentOptions::Class;
jfieldID getPremiumGiveawayPaymentOptions::boosted_chat_id_fieldID;

getPremiumGiveawayPaymentOptions::getPremiumGiveawayPaymentOptions()
  : boosted_chat_id_()
{}

getPremiumGiveawayPaymentOptions::getPremiumGiveawayPaymentOptions(int53 boosted_chat_id_)
  : boosted_chat_id_(boosted_chat_id_)
{}

const std::int32_t getPremiumGiveawayPaymentOptions::ID;

object_ptr<getPremiumGiveawayPaymentOptions> getPremiumGiveawayPaymentOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPremiumGiveawayPaymentOptions> res = make_object<getPremiumGiveawayPaymentOptions>();
  res->boosted_chat_id_ = env->GetLongField(p, res->boosted_chat_id_fieldID);
  return res;
}

void getPremiumGiveawayPaymentOptions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPremiumGiveawayPaymentOptions");
    s.store_field("boostedChatId", boosted_chat_id_);
    s.store_class_end();
  }
}

getPremiumGiveawayPaymentOptions::ReturnType getPremiumGiveawayPaymentOptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return premiumGiveawayPaymentOptions::fetch(env, p);
}

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

jclass getPremiumState::Class;

getPremiumState::getPremiumState() {
}

const std::int32_t getPremiumState::ID;

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

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

getPremiumState::ReturnType getPremiumState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return premiumState::fetch(env, p);
}

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

jclass getPublicPostSearchLimits::Class;
jfieldID getPublicPostSearchLimits::query_fieldID;

getPublicPostSearchLimits::getPublicPostSearchLimits()
  : query_()
{}

getPublicPostSearchLimits::getPublicPostSearchLimits(string const &query_)
  : query_(query_)
{}

const std::int32_t getPublicPostSearchLimits::ID;

object_ptr<getPublicPostSearchLimits> getPublicPostSearchLimits::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPublicPostSearchLimits> res = make_object<getPublicPostSearchLimits>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  return res;
}

void getPublicPostSearchLimits::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPublicPostSearchLimits");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

getPublicPostSearchLimits::ReturnType getPublicPostSearchLimits::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return publicPostSearchLimits::fetch(env, p);
}

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

jclass getReceivedGift::Class;
jfieldID getReceivedGift::received_gift_id_fieldID;

getReceivedGift::getReceivedGift()
  : received_gift_id_()
{}

getReceivedGift::getReceivedGift(string const &received_gift_id_)
  : received_gift_id_(received_gift_id_)
{}

const std::int32_t getReceivedGift::ID;

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

void getReceivedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetReceivedGift");
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_class_end();
  }
}

getReceivedGift::ReturnType getReceivedGift::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return receivedGift::fetch(env, p);
}

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

jclass getRecommendedChatFolders::Class;

getRecommendedChatFolders::getRecommendedChatFolders() {
}

const std::int32_t getRecommendedChatFolders::ID;

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

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

getRecommendedChatFolders::ReturnType getRecommendedChatFolders::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return recommendedChatFolders::fetch(env, p);
}

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

jclass getSavedAnimations::Class;

getSavedAnimations::getSavedAnimations() {
}

const std::int32_t getSavedAnimations::ID;

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

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

getSavedAnimations::ReturnType getSavedAnimations::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return animations::fetch(env, p);
}

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

jclass getSavedMessagesTopicHistory::Class;
jfieldID getSavedMessagesTopicHistory::saved_messages_topic_id_fieldID;
jfieldID getSavedMessagesTopicHistory::from_message_id_fieldID;
jfieldID getSavedMessagesTopicHistory::offset_fieldID;
jfieldID getSavedMessagesTopicHistory::limit_fieldID;

getSavedMessagesTopicHistory::getSavedMessagesTopicHistory()
  : saved_messages_topic_id_()
  , from_message_id_()
  , offset_()
  , limit_()
{}

getSavedMessagesTopicHistory::getSavedMessagesTopicHistory(int53 saved_messages_topic_id_, int53 from_message_id_, int32 offset_, int32 limit_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getSavedMessagesTopicHistory::ID;

object_ptr<getSavedMessagesTopicHistory> getSavedMessagesTopicHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getSavedMessagesTopicHistory> res = make_object<getSavedMessagesTopicHistory>();
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getSavedMessagesTopicHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSavedMessagesTopicHistory");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getSavedMessagesTopicHistory::ReturnType getSavedMessagesTopicHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void getSavedMessagesTopicHistory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetSavedMessagesTopicHistory").c_str());
    saved_messages_topic_id_fieldID = jni::get_field_id(env, Class, "savedMessagesTopicId", "J");
    from_message_id_fieldID = jni::get_field_id(env, Class, "fromMessageId", "J");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getStarSubscriptions::Class;
jfieldID getStarSubscriptions::only_expiring_fieldID;
jfieldID getStarSubscriptions::offset_fieldID;

getStarSubscriptions::getStarSubscriptions()
  : only_expiring_()
  , offset_()
{}

getStarSubscriptions::getStarSubscriptions(bool only_expiring_, string const &offset_)
  : only_expiring_(only_expiring_)
  , offset_(offset_)
{}

const std::int32_t getStarSubscriptions::ID;

object_ptr<getStarSubscriptions> getStarSubscriptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStarSubscriptions> res = make_object<getStarSubscriptions>();
  res->only_expiring_ = (env->GetBooleanField(p, res->only_expiring_fieldID) != 0);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  return res;
}

void getStarSubscriptions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStarSubscriptions");
    s.store_field("onlyExpiring", only_expiring_);
    s.store_field("offset", offset_);
    s.store_class_end();
  }
}

getStarSubscriptions::ReturnType getStarSubscriptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starSubscriptions::fetch(env, p);
}

void getStarSubscriptions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStarSubscriptions").c_str());
    only_expiring_fieldID = jni::get_field_id(env, Class, "onlyExpiring", "Z");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getStickerSet::Class;
jfieldID getStickerSet::set_id_fieldID;

getStickerSet::getStickerSet()
  : set_id_()
{}

getStickerSet::getStickerSet(int64 set_id_)
  : set_id_(set_id_)
{}

const std::int32_t getStickerSet::ID;

object_ptr<getStickerSet> getStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStickerSet> res = make_object<getStickerSet>();
  res->set_id_ = env->GetLongField(p, res->set_id_fieldID);
  return res;
}

void getStickerSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStickerSet");
    s.store_field("setId", set_id_);
    s.store_class_end();
  }
}

getStickerSet::ReturnType getStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSet::fetch(env, p);
}

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

jclass getSuggestedStickerSetName::Class;
jfieldID getSuggestedStickerSetName::title_fieldID;

getSuggestedStickerSetName::getSuggestedStickerSetName()
  : title_()
{}

getSuggestedStickerSetName::getSuggestedStickerSetName(string const &title_)
  : title_(title_)
{}

const std::int32_t getSuggestedStickerSetName::ID;

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

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

getSuggestedStickerSetName::ReturnType getSuggestedStickerSetName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getUpgradedGiftWithdrawalUrl::Class;
jfieldID getUpgradedGiftWithdrawalUrl::received_gift_id_fieldID;
jfieldID getUpgradedGiftWithdrawalUrl::password_fieldID;

getUpgradedGiftWithdrawalUrl::getUpgradedGiftWithdrawalUrl()
  : received_gift_id_()
  , password_()
{}

getUpgradedGiftWithdrawalUrl::getUpgradedGiftWithdrawalUrl(string const &received_gift_id_, string const &password_)
  : received_gift_id_(received_gift_id_)
  , password_(password_)
{}

const std::int32_t getUpgradedGiftWithdrawalUrl::ID;

object_ptr<getUpgradedGiftWithdrawalUrl> getUpgradedGiftWithdrawalUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getUpgradedGiftWithdrawalUrl> res = make_object<getUpgradedGiftWithdrawalUrl>();
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void getUpgradedGiftWithdrawalUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetUpgradedGiftWithdrawalUrl");
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_field("password", password_);
    s.store_class_end();
  }
}

getUpgradedGiftWithdrawalUrl::ReturnType getUpgradedGiftWithdrawalUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass getUserLink::Class;

getUserLink::getUserLink() {
}

const std::int32_t getUserLink::ID;

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

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

getUserLink::ReturnType getUserLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return userLink::fetch(env, p);
}

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

jclass getUserProfileAudios::Class;
jfieldID getUserProfileAudios::user_id_fieldID;
jfieldID getUserProfileAudios::offset_fieldID;
jfieldID getUserProfileAudios::limit_fieldID;

getUserProfileAudios::getUserProfileAudios()
  : user_id_()
  , offset_()
  , limit_()
{}

getUserProfileAudios::getUserProfileAudios(int53 user_id_, int32 offset_, int32 limit_)
  : user_id_(user_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getUserProfileAudios::ID;

object_ptr<getUserProfileAudios> getUserProfileAudios::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getUserProfileAudios> res = make_object<getUserProfileAudios>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getUserProfileAudios::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetUserProfileAudios");
    s.store_field("userId", user_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getUserProfileAudios::ReturnType getUserProfileAudios::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return audios::fetch(env, p);
}

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

jclass getUserProfilePhotos::Class;
jfieldID getUserProfilePhotos::user_id_fieldID;
jfieldID getUserProfilePhotos::offset_fieldID;
jfieldID getUserProfilePhotos::limit_fieldID;

getUserProfilePhotos::getUserProfilePhotos()
  : user_id_()
  , offset_()
  , limit_()
{}

getUserProfilePhotos::getUserProfilePhotos(int53 user_id_, int32 offset_, int32 limit_)
  : user_id_(user_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getUserProfilePhotos::ID;

object_ptr<getUserProfilePhotos> getUserProfilePhotos::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getUserProfilePhotos> res = make_object<getUserProfilePhotos>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getUserProfilePhotos::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetUserProfilePhotos");
    s.store_field("userId", user_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getUserProfilePhotos::ReturnType getUserProfilePhotos::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatPhotos::fetch(env, p);
}

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

jclass giftPremiumWithStars::Class;
jfieldID giftPremiumWithStars::user_id_fieldID;
jfieldID giftPremiumWithStars::star_count_fieldID;
jfieldID giftPremiumWithStars::month_count_fieldID;
jfieldID giftPremiumWithStars::text_fieldID;

giftPremiumWithStars::giftPremiumWithStars()
  : user_id_()
  , star_count_()
  , month_count_()
  , text_()
{}

giftPremiumWithStars::giftPremiumWithStars(int53 user_id_, int53 star_count_, int32 month_count_, object_ptr<formattedText> &&text_)
  : user_id_(user_id_)
  , star_count_(star_count_)
  , month_count_(month_count_)
  , text_(std::move(text_))
{}

const std::int32_t giftPremiumWithStars::ID;

object_ptr<giftPremiumWithStars> giftPremiumWithStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftPremiumWithStars> res = make_object<giftPremiumWithStars>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_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 res;
}

void giftPremiumWithStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftPremiumWithStars");
    s.store_field("userId", user_id_);
    s.store_field("starCount", star_count_);
    s.store_field("monthCount", month_count_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

giftPremiumWithStars::ReturnType giftPremiumWithStars::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void giftPremiumWithStars::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftPremiumWithStars").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "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 parseTextEntities::Class;
jfieldID parseTextEntities::text_fieldID;
jfieldID parseTextEntities::parse_mode_fieldID;

parseTextEntities::parseTextEntities()
  : text_()
  , parse_mode_()
{}

parseTextEntities::parseTextEntities(string const &text_, object_ptr<TextParseMode> &&parse_mode_)
  : text_(text_)
  , parse_mode_(std::move(parse_mode_))
{}

const std::int32_t parseTextEntities::ID;

object_ptr<parseTextEntities> parseTextEntities::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<parseTextEntities> res = make_object<parseTextEntities>();
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->parse_mode_ = jni::fetch_tl_object<TextParseMode>(env, jni::fetch_object(env, p, res->parse_mode_fieldID));
  return res;
}

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

parseTextEntities::ReturnType parseTextEntities::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

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

jclass readdQuickReplyShortcutMessages::Class;
jfieldID readdQuickReplyShortcutMessages::shortcut_name_fieldID;
jfieldID readdQuickReplyShortcutMessages::message_ids_fieldID;

readdQuickReplyShortcutMessages::readdQuickReplyShortcutMessages()
  : shortcut_name_()
  , message_ids_()
{}

readdQuickReplyShortcutMessages::readdQuickReplyShortcutMessages(string const &shortcut_name_, array<int53> &&message_ids_)
  : shortcut_name_(shortcut_name_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t readdQuickReplyShortcutMessages::ID;

object_ptr<readdQuickReplyShortcutMessages> readdQuickReplyShortcutMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<readdQuickReplyShortcutMessages> res = make_object<readdQuickReplyShortcutMessages>();
  res->shortcut_name_ = jni::fetch_string(env, p, res->shortcut_name_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return res;
}

void readdQuickReplyShortcutMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReaddQuickReplyShortcutMessages");
    s.store_field("shortcutName", shortcut_name_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

readdQuickReplyShortcutMessages::ReturnType readdQuickReplyShortcutMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return quickReplyMessages::fetch(env, p);
}

void readdQuickReplyShortcutMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReaddQuickReplyShortcutMessages").c_str());
    shortcut_name_fieldID = jni::get_field_id(env, Class, "shortcutName", "Ljava/lang/String;");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass recognizeSpeech::Class;
jfieldID recognizeSpeech::chat_id_fieldID;
jfieldID recognizeSpeech::message_id_fieldID;

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

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

const std::int32_t recognizeSpeech::ID;

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

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

recognizeSpeech::ReturnType recognizeSpeech::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

removeMessageSenderBotVerification::removeMessageSenderBotVerification()
  : bot_user_id_()
  , verified_id_()
{}

removeMessageSenderBotVerification::removeMessageSenderBotVerification(int53 bot_user_id_, object_ptr<MessageSender> &&verified_id_)
  : bot_user_id_(bot_user_id_)
  , verified_id_(std::move(verified_id_))
{}

const std::int32_t removeMessageSenderBotVerification::ID;

object_ptr<removeMessageSenderBotVerification> removeMessageSenderBotVerification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeMessageSenderBotVerification> res = make_object<removeMessageSenderBotVerification>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->verified_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->verified_id_fieldID));
  return res;
}

void removeMessageSenderBotVerification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveMessageSenderBotVerification");
    s.store_field("botUserId", bot_user_id_);
    s.store_object_field("verifiedId", static_cast<const BaseObject *>(verified_id_.get()));
    s.store_class_end();
  }
}

removeMessageSenderBotVerification::ReturnType removeMessageSenderBotVerification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeMessageSenderBotVerification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveMessageSenderBotVerification").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    verified_id_fieldID = jni::get_field_id(env, Class, "verifiedId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass removeNotification::Class;
jfieldID removeNotification::notification_group_id_fieldID;
jfieldID removeNotification::notification_id_fieldID;

removeNotification::removeNotification()
  : notification_group_id_()
  , notification_id_()
{}

removeNotification::removeNotification(int32 notification_group_id_, int32 notification_id_)
  : notification_group_id_(notification_group_id_)
  , notification_id_(notification_id_)
{}

const std::int32_t removeNotification::ID;

object_ptr<removeNotification> removeNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeNotification> res = make_object<removeNotification>();
  res->notification_group_id_ = env->GetIntField(p, res->notification_group_id_fieldID);
  res->notification_id_ = env->GetIntField(p, res->notification_id_fieldID);
  return res;
}

void removeNotification::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveNotification");
    s.store_field("notificationGroupId", notification_group_id_);
    s.store_field("notificationId", notification_id_);
    s.store_class_end();
  }
}

removeNotification::ReturnType removeNotification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeNotification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveNotification").c_str());
    notification_group_id_fieldID = jni::get_field_id(env, Class, "notificationGroupId", "I");
    notification_id_fieldID = jni::get_field_id(env, Class, "notificationId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass removeNotificationGroup::Class;
jfieldID removeNotificationGroup::notification_group_id_fieldID;
jfieldID removeNotificationGroup::max_notification_id_fieldID;

removeNotificationGroup::removeNotificationGroup()
  : notification_group_id_()
  , max_notification_id_()
{}

removeNotificationGroup::removeNotificationGroup(int32 notification_group_id_, int32 max_notification_id_)
  : notification_group_id_(notification_group_id_)
  , max_notification_id_(max_notification_id_)
{}

const std::int32_t removeNotificationGroup::ID;

object_ptr<removeNotificationGroup> removeNotificationGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeNotificationGroup> res = make_object<removeNotificationGroup>();
  res->notification_group_id_ = env->GetIntField(p, res->notification_group_id_fieldID);
  res->max_notification_id_ = env->GetIntField(p, res->max_notification_id_fieldID);
  return res;
}

void removeNotificationGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveNotificationGroup");
    s.store_field("notificationGroupId", notification_group_id_);
    s.store_field("maxNotificationId", max_notification_id_);
    s.store_class_end();
  }
}

removeNotificationGroup::ReturnType removeNotificationGroup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeNotificationGroup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveNotificationGroup").c_str());
    notification_group_id_fieldID = jni::get_field_id(env, Class, "notificationGroupId", "I");
    max_notification_id_fieldID = jni::get_field_id(env, Class, "maxNotificationId", "I");
    return true;
  }();
  (void)is_inited;
}

jclass removeProfileAudio::Class;
jfieldID removeProfileAudio::file_id_fieldID;

removeProfileAudio::removeProfileAudio()
  : file_id_()
{}

removeProfileAudio::removeProfileAudio(int32 file_id_)
  : file_id_(file_id_)
{}

const std::int32_t removeProfileAudio::ID;

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

void removeProfileAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveProfileAudio");
    s.store_field("fileId", file_id_);
    s.store_class_end();
  }
}

removeProfileAudio::ReturnType removeProfileAudio::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeSearchedForTag::Class;
jfieldID removeSearchedForTag::tag_fieldID;

removeSearchedForTag::removeSearchedForTag()
  : tag_()
{}

removeSearchedForTag::removeSearchedForTag(string const &tag_)
  : tag_(tag_)
{}

const std::int32_t removeSearchedForTag::ID;

object_ptr<removeSearchedForTag> removeSearchedForTag::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeSearchedForTag> res = make_object<removeSearchedForTag>();
  res->tag_ = jni::fetch_string(env, p, res->tag_fieldID);
  return res;
}

void removeSearchedForTag::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveSearchedForTag");
    s.store_field("tag", tag_);
    s.store_class_end();
  }
}

removeSearchedForTag::ReturnType removeSearchedForTag::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reorderChatFolders::Class;
jfieldID reorderChatFolders::chat_folder_ids_fieldID;
jfieldID reorderChatFolders::main_chat_list_position_fieldID;

reorderChatFolders::reorderChatFolders()
  : chat_folder_ids_()
  , main_chat_list_position_()
{}

reorderChatFolders::reorderChatFolders(array<int32> &&chat_folder_ids_, int32 main_chat_list_position_)
  : chat_folder_ids_(std::move(chat_folder_ids_))
  , main_chat_list_position_(main_chat_list_position_)
{}

const std::int32_t reorderChatFolders::ID;

object_ptr<reorderChatFolders> reorderChatFolders::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderChatFolders> res = make_object<reorderChatFolders>();
  res->chat_folder_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->chat_folder_ids_fieldID));
  res->main_chat_list_position_ = env->GetIntField(p, res->main_chat_list_position_fieldID);
  return res;
}

void reorderChatFolders::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderChatFolders");
    { s.store_vector_begin("chatFolderIds", chat_folder_ids_.size()); for (const auto &_value : chat_folder_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("mainChatListPosition", main_chat_list_position_);
    s.store_class_end();
  }
}

reorderChatFolders::ReturnType reorderChatFolders::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reorderChatFolders::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReorderChatFolders").c_str());
    chat_folder_ids_fieldID = jni::get_field_id(env, Class, "chatFolderIds", "[I");
    main_chat_list_position_fieldID = jni::get_field_id(env, Class, "mainChatListPosition", "I");
    return true;
  }();
  (void)is_inited;
}

jclass reorderStoryAlbumStories::Class;
jfieldID reorderStoryAlbumStories::chat_id_fieldID;
jfieldID reorderStoryAlbumStories::story_album_id_fieldID;
jfieldID reorderStoryAlbumStories::story_ids_fieldID;

reorderStoryAlbumStories::reorderStoryAlbumStories()
  : chat_id_()
  , story_album_id_()
  , story_ids_()
{}

reorderStoryAlbumStories::reorderStoryAlbumStories(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 reorderStoryAlbumStories::ID;

object_ptr<reorderStoryAlbumStories> reorderStoryAlbumStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderStoryAlbumStories> res = make_object<reorderStoryAlbumStories>();
  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 reorderStoryAlbumStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderStoryAlbumStories");
    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();
  }
}

reorderStoryAlbumStories::ReturnType reorderStoryAlbumStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyAlbum::fetch(env, p);
}

void reorderStoryAlbumStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReorderStoryAlbumStories").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 reportChatSponsoredMessage::Class;
jfieldID reportChatSponsoredMessage::chat_id_fieldID;
jfieldID reportChatSponsoredMessage::message_id_fieldID;
jfieldID reportChatSponsoredMessage::option_id_fieldID;

reportChatSponsoredMessage::reportChatSponsoredMessage()
  : chat_id_()
  , message_id_()
  , option_id_()
{}

reportChatSponsoredMessage::reportChatSponsoredMessage(int53 chat_id_, int53 message_id_, bytes const &option_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , option_id_(std::move(option_id_))
{}

const std::int32_t reportChatSponsoredMessage::ID;

object_ptr<reportChatSponsoredMessage> reportChatSponsoredMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportChatSponsoredMessage> res = make_object<reportChatSponsoredMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->option_id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->option_id_fieldID));
  return res;
}

void reportChatSponsoredMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportChatSponsoredMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_bytes_field("optionId", option_id_);
    s.store_class_end();
  }
}

reportChatSponsoredMessage::ReturnType reportChatSponsoredMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ReportSponsoredResult::fetch(env, p);
}

void reportChatSponsoredMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportChatSponsoredMessage").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_id_fieldID = jni::get_field_id(env, Class, "optionId", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass requestPasswordRecovery::Class;

requestPasswordRecovery::requestPasswordRecovery() {
}

const std::int32_t requestPasswordRecovery::ID;

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

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

requestPasswordRecovery::ReturnType requestPasswordRecovery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emailAddressAuthenticationCodeInfo::fetch(env, p);
}

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

jclass resendEmailAddressVerificationCode::Class;

resendEmailAddressVerificationCode::resendEmailAddressVerificationCode() {
}

const std::int32_t resendEmailAddressVerificationCode::ID;

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

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

resendEmailAddressVerificationCode::ReturnType resendEmailAddressVerificationCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emailAddressAuthenticationCodeInfo::fetch(env, p);
}

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

jclass resetAllNotificationSettings::Class;

resetAllNotificationSettings::resetAllNotificationSettings() {
}

const std::int32_t resetAllNotificationSettings::ID;

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

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

resetAllNotificationSettings::ReturnType resetAllNotificationSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass searchSecretMessages::Class;
jfieldID searchSecretMessages::chat_id_fieldID;
jfieldID searchSecretMessages::query_fieldID;
jfieldID searchSecretMessages::offset_fieldID;
jfieldID searchSecretMessages::limit_fieldID;
jfieldID searchSecretMessages::filter_fieldID;

searchSecretMessages::searchSecretMessages()
  : chat_id_()
  , query_()
  , offset_()
  , limit_()
  , filter_()
{}

searchSecretMessages::searchSecretMessages(int53 chat_id_, string const &query_, string const &offset_, int32 limit_, object_ptr<SearchMessagesFilter> &&filter_)
  : chat_id_(chat_id_)
  , query_(query_)
  , offset_(offset_)
  , limit_(limit_)
  , filter_(std::move(filter_))
{}

const std::int32_t searchSecretMessages::ID;

object_ptr<searchSecretMessages> searchSecretMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchSecretMessages> res = make_object<searchSecretMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  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->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  return res;
}

void searchSecretMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchSecretMessages");
    s.store_field("chatId", chat_id_);
    s.store_field("query", query_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_class_end();
  }
}

searchSecretMessages::ReturnType searchSecretMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundMessages::fetch(env, p);
}

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

jclass searchStringsByPrefix::Class;
jfieldID searchStringsByPrefix::strings_fieldID;
jfieldID searchStringsByPrefix::query_fieldID;
jfieldID searchStringsByPrefix::limit_fieldID;
jfieldID searchStringsByPrefix::return_none_for_empty_query_fieldID;

searchStringsByPrefix::searchStringsByPrefix()
  : strings_()
  , query_()
  , limit_()
  , return_none_for_empty_query_()
{}

searchStringsByPrefix::searchStringsByPrefix(array<string> &&strings_, string const &query_, int32 limit_, bool return_none_for_empty_query_)
  : strings_(std::move(strings_))
  , query_(query_)
  , limit_(limit_)
  , return_none_for_empty_query_(return_none_for_empty_query_)
{}

const std::int32_t searchStringsByPrefix::ID;

object_ptr<searchStringsByPrefix> searchStringsByPrefix::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchStringsByPrefix> res = make_object<searchStringsByPrefix>();
  res->strings_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->strings_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->return_none_for_empty_query_ = (env->GetBooleanField(p, res->return_none_for_empty_query_fieldID) != 0);
  return res;
}

void searchStringsByPrefix::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchStringsByPrefix");
    { s.store_vector_begin("strings", strings_.size()); for (const auto &_value : strings_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_field("returnNoneForEmptyQuery", return_none_for_empty_query_);
    s.store_class_end();
  }
}

searchStringsByPrefix::ReturnType searchStringsByPrefix::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundPositions::fetch(env, p);
}

void searchStringsByPrefix::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchStringsByPrefix").c_str());
    strings_fieldID = jni::get_field_id(env, Class, "strings", "[Ljava/lang/String;");
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return_none_for_empty_query_fieldID = jni::get_field_id(env, Class, "returnNoneForEmptyQuery", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass sendGift::Class;
jfieldID sendGift::gift_id_fieldID;
jfieldID sendGift::owner_id_fieldID;
jfieldID sendGift::text_fieldID;
jfieldID sendGift::is_private_fieldID;
jfieldID sendGift::pay_for_upgrade_fieldID;

sendGift::sendGift()
  : gift_id_()
  , owner_id_()
  , text_()
  , is_private_()
  , pay_for_upgrade_()
{}

sendGift::sendGift(int64 gift_id_, object_ptr<MessageSender> &&owner_id_, object_ptr<formattedText> &&text_, bool is_private_, bool pay_for_upgrade_)
  : gift_id_(gift_id_)
  , owner_id_(std::move(owner_id_))
  , text_(std::move(text_))
  , is_private_(is_private_)
  , pay_for_upgrade_(pay_for_upgrade_)
{}

const std::int32_t sendGift::ID;

object_ptr<sendGift> sendGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendGift> res = make_object<sendGift>();
  res->gift_id_ = env->GetLongField(p, res->gift_id_fieldID);
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->is_private_ = (env->GetBooleanField(p, res->is_private_fieldID) != 0);
  res->pay_for_upgrade_ = (env->GetBooleanField(p, res->pay_for_upgrade_fieldID) != 0);
  return res;
}

void sendGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendGift");
    s.store_field("giftId", gift_id_);
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("isPrivate", is_private_);
    s.store_field("payForUpgrade", pay_for_upgrade_);
    s.store_class_end();
  }
}

sendGift::ReturnType sendGift::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendGift").c_str());
    gift_id_fieldID = jni::get_field_id(env, Class, "giftId", "J");
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (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());
    is_private_fieldID = jni::get_field_id(env, Class, "isPrivate", "Z");
    pay_for_upgrade_fieldID = jni::get_field_id(env, Class, "payForUpgrade", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass sendMessageViewMetrics::Class;
jfieldID sendMessageViewMetrics::chat_id_fieldID;
jfieldID sendMessageViewMetrics::message_id_fieldID;
jfieldID sendMessageViewMetrics::time_in_view_ms_fieldID;
jfieldID sendMessageViewMetrics::active_time_in_view_ms_fieldID;
jfieldID sendMessageViewMetrics::height_to_viewport_ratio_per_mille_fieldID;
jfieldID sendMessageViewMetrics::seen_range_ratio_per_mille_fieldID;

sendMessageViewMetrics::sendMessageViewMetrics()
  : chat_id_()
  , message_id_()
  , time_in_view_ms_()
  , active_time_in_view_ms_()
  , height_to_viewport_ratio_per_mille_()
  , seen_range_ratio_per_mille_()
{}

sendMessageViewMetrics::sendMessageViewMetrics(int53 chat_id_, int53 message_id_, int32 time_in_view_ms_, int32 active_time_in_view_ms_, int32 height_to_viewport_ratio_per_mille_, int32 seen_range_ratio_per_mille_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , time_in_view_ms_(time_in_view_ms_)
  , active_time_in_view_ms_(active_time_in_view_ms_)
  , height_to_viewport_ratio_per_mille_(height_to_viewport_ratio_per_mille_)
  , seen_range_ratio_per_mille_(seen_range_ratio_per_mille_)
{}

const std::int32_t sendMessageViewMetrics::ID;

object_ptr<sendMessageViewMetrics> sendMessageViewMetrics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendMessageViewMetrics> res = make_object<sendMessageViewMetrics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->time_in_view_ms_ = env->GetIntField(p, res->time_in_view_ms_fieldID);
  res->active_time_in_view_ms_ = env->GetIntField(p, res->active_time_in_view_ms_fieldID);
  res->height_to_viewport_ratio_per_mille_ = env->GetIntField(p, res->height_to_viewport_ratio_per_mille_fieldID);
  res->seen_range_ratio_per_mille_ = env->GetIntField(p, res->seen_range_ratio_per_mille_fieldID);
  return res;
}

void sendMessageViewMetrics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendMessageViewMetrics");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("timeInViewMs", time_in_view_ms_);
    s.store_field("activeTimeInViewMs", active_time_in_view_ms_);
    s.store_field("heightToViewportRatioPerMille", height_to_viewport_ratio_per_mille_);
    s.store_field("seenRangeRatioPerMille", seen_range_ratio_per_mille_);
    s.store_class_end();
  }
}

sendMessageViewMetrics::ReturnType sendMessageViewMetrics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendMessageViewMetrics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendMessageViewMetrics").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    time_in_view_ms_fieldID = jni::get_field_id(env, Class, "timeInViewMs", "I");
    active_time_in_view_ms_fieldID = jni::get_field_id(env, Class, "activeTimeInViewMs", "I");
    height_to_viewport_ratio_per_mille_fieldID = jni::get_field_id(env, Class, "heightToViewportRatioPerMille", "I");
    seen_range_ratio_per_mille_fieldID = jni::get_field_id(env, Class, "seenRangeRatioPerMille", "I");
    return true;
  }();
  (void)is_inited;
}

jclass sendPassportAuthorizationForm::Class;
jfieldID sendPassportAuthorizationForm::authorization_form_id_fieldID;
jfieldID sendPassportAuthorizationForm::types_fieldID;

sendPassportAuthorizationForm::sendPassportAuthorizationForm()
  : authorization_form_id_()
  , types_()
{}

sendPassportAuthorizationForm::sendPassportAuthorizationForm(int32 authorization_form_id_, array<object_ptr<PassportElementType>> &&types_)
  : authorization_form_id_(authorization_form_id_)
  , types_(std::move(types_))
{}

const std::int32_t sendPassportAuthorizationForm::ID;

object_ptr<sendPassportAuthorizationForm> sendPassportAuthorizationForm::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendPassportAuthorizationForm> res = make_object<sendPassportAuthorizationForm>();
  res->authorization_form_id_ = env->GetIntField(p, res->authorization_form_id_fieldID);
  res->types_ = jni::FetchVector<PassportElementType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->types_fieldID));
  return res;
}

void sendPassportAuthorizationForm::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendPassportAuthorizationForm");
    s.store_field("authorizationFormId", authorization_form_id_);
    { s.store_vector_begin("types", types_.size()); for (const auto &_value : types_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

sendPassportAuthorizationForm::ReturnType sendPassportAuthorizationForm::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendPassportAuthorizationForm::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendPassportAuthorizationForm").c_str());
    authorization_form_id_fieldID = jni::get_field_id(env, Class, "authorizationFormId", "I");
    types_fieldID = jni::get_field_id(env, Class, "types", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PassportElementType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass sendResoldGift::Class;
jfieldID sendResoldGift::gift_name_fieldID;
jfieldID sendResoldGift::owner_id_fieldID;
jfieldID sendResoldGift::price_fieldID;

sendResoldGift::sendResoldGift()
  : gift_name_()
  , owner_id_()
  , price_()
{}

sendResoldGift::sendResoldGift(string const &gift_name_, object_ptr<MessageSender> &&owner_id_, object_ptr<GiftResalePrice> &&price_)
  : gift_name_(gift_name_)
  , owner_id_(std::move(owner_id_))
  , price_(std::move(price_))
{}

const std::int32_t sendResoldGift::ID;

object_ptr<sendResoldGift> sendResoldGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendResoldGift> res = make_object<sendResoldGift>();
  res->gift_name_ = jni::fetch_string(env, p, res->gift_name_fieldID);
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  return res;
}

void sendResoldGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendResoldGift");
    s.store_field("giftName", gift_name_);
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_class_end();
  }
}

sendResoldGift::ReturnType sendResoldGift::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return GiftResaleResult::fetch(env, p);
}

void sendResoldGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendResoldGift").c_str());
    gift_name_fieldID = jni::get_field_id(env, Class, "giftName", "Ljava/lang/String;");
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftResalePrice;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setAutosaveSettings::Class;
jfieldID setAutosaveSettings::scope_fieldID;
jfieldID setAutosaveSettings::settings_fieldID;

setAutosaveSettings::setAutosaveSettings()
  : scope_()
  , settings_()
{}

setAutosaveSettings::setAutosaveSettings(object_ptr<AutosaveSettingsScope> &&scope_, object_ptr<scopeAutosaveSettings> &&settings_)
  : scope_(std::move(scope_))
  , settings_(std::move(settings_))
{}

const std::int32_t setAutosaveSettings::ID;

object_ptr<setAutosaveSettings> setAutosaveSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAutosaveSettings> res = make_object<setAutosaveSettings>();
  res->scope_ = jni::fetch_tl_object<AutosaveSettingsScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->settings_ = jni::fetch_tl_object<scopeAutosaveSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

void setAutosaveSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetAutosaveSettings");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

setAutosaveSettings::ReturnType setAutosaveSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setAutosaveSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetAutosaveSettings").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AutosaveSettingsScope;").c_str());
    settings_fieldID = jni::get_field_id(env, Class, "settings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeAutosaveSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setBio::Class;
jfieldID setBio::bio_fieldID;

setBio::setBio()
  : bio_()
{}

setBio::setBio(string const &bio_)
  : bio_(bio_)
{}

const std::int32_t setBio::ID;

object_ptr<setBio> setBio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBio> res = make_object<setBio>();
  res->bio_ = jni::fetch_string(env, p, res->bio_fieldID);
  return res;
}

void setBio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBio");
    s.store_field("bio", bio_);
    s.store_class_end();
  }
}

setBio::ReturnType setBio::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBusinessAwayMessageSettings::Class;
jfieldID setBusinessAwayMessageSettings::away_message_settings_fieldID;

setBusinessAwayMessageSettings::setBusinessAwayMessageSettings()
  : away_message_settings_()
{}

setBusinessAwayMessageSettings::setBusinessAwayMessageSettings(object_ptr<businessAwayMessageSettings> &&away_message_settings_)
  : away_message_settings_(std::move(away_message_settings_))
{}

const std::int32_t setBusinessAwayMessageSettings::ID;

object_ptr<setBusinessAwayMessageSettings> setBusinessAwayMessageSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessAwayMessageSettings> res = make_object<setBusinessAwayMessageSettings>();
  res->away_message_settings_ = jni::fetch_tl_object<businessAwayMessageSettings>(env, jni::fetch_object(env, p, res->away_message_settings_fieldID));
  return res;
}

void setBusinessAwayMessageSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessAwayMessageSettings");
    s.store_object_field("awayMessageSettings", static_cast<const BaseObject *>(away_message_settings_.get()));
    s.store_class_end();
  }
}

setBusinessAwayMessageSettings::ReturnType setBusinessAwayMessageSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatAffiliateProgram::Class;
jfieldID setChatAffiliateProgram::chat_id_fieldID;
jfieldID setChatAffiliateProgram::parameters_fieldID;

setChatAffiliateProgram::setChatAffiliateProgram()
  : chat_id_()
  , parameters_()
{}

setChatAffiliateProgram::setChatAffiliateProgram(int53 chat_id_, object_ptr<affiliateProgramParameters> &&parameters_)
  : chat_id_(chat_id_)
  , parameters_(std::move(parameters_))
{}

const std::int32_t setChatAffiliateProgram::ID;

object_ptr<setChatAffiliateProgram> setChatAffiliateProgram::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatAffiliateProgram> res = make_object<setChatAffiliateProgram>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->parameters_ = jni::fetch_tl_object<affiliateProgramParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  return res;
}

void setChatAffiliateProgram::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatAffiliateProgram");
    s.store_field("chatId", chat_id_);
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_class_end();
  }
}

setChatAffiliateProgram::ReturnType setChatAffiliateProgram::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDefaultChannelAdministratorRights::Class;
jfieldID setDefaultChannelAdministratorRights::default_channel_administrator_rights_fieldID;

setDefaultChannelAdministratorRights::setDefaultChannelAdministratorRights()
  : default_channel_administrator_rights_()
{}

setDefaultChannelAdministratorRights::setDefaultChannelAdministratorRights(object_ptr<chatAdministratorRights> &&default_channel_administrator_rights_)
  : default_channel_administrator_rights_(std::move(default_channel_administrator_rights_))
{}

const std::int32_t setDefaultChannelAdministratorRights::ID;

object_ptr<setDefaultChannelAdministratorRights> setDefaultChannelAdministratorRights::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDefaultChannelAdministratorRights> res = make_object<setDefaultChannelAdministratorRights>();
  res->default_channel_administrator_rights_ = jni::fetch_tl_object<chatAdministratorRights>(env, jni::fetch_object(env, p, res->default_channel_administrator_rights_fieldID));
  return res;
}

void setDefaultChannelAdministratorRights::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetDefaultChannelAdministratorRights");
    s.store_object_field("defaultChannelAdministratorRights", static_cast<const BaseObject *>(default_channel_administrator_rights_.get()));
    s.store_class_end();
  }
}

setDefaultChannelAdministratorRights::ReturnType setDefaultChannelAdministratorRights::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDefaultMessageAutoDeleteTime::Class;
jfieldID setDefaultMessageAutoDeleteTime::message_auto_delete_time_fieldID;

setDefaultMessageAutoDeleteTime::setDefaultMessageAutoDeleteTime()
  : message_auto_delete_time_()
{}

setDefaultMessageAutoDeleteTime::setDefaultMessageAutoDeleteTime(object_ptr<messageAutoDeleteTime> &&message_auto_delete_time_)
  : message_auto_delete_time_(std::move(message_auto_delete_time_))
{}

const std::int32_t setDefaultMessageAutoDeleteTime::ID;

object_ptr<setDefaultMessageAutoDeleteTime> setDefaultMessageAutoDeleteTime::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDefaultMessageAutoDeleteTime> res = make_object<setDefaultMessageAutoDeleteTime>();
  res->message_auto_delete_time_ = jni::fetch_tl_object<messageAutoDeleteTime>(env, jni::fetch_object(env, p, res->message_auto_delete_time_fieldID));
  return res;
}

void setDefaultMessageAutoDeleteTime::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetDefaultMessageAutoDeleteTime");
    s.store_object_field("messageAutoDeleteTime", static_cast<const BaseObject *>(message_auto_delete_time_.get()));
    s.store_class_end();
  }
}

setDefaultMessageAutoDeleteTime::ReturnType setDefaultMessageAutoDeleteTime::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDirectMessagesChatTopicIsMarkedAsUnread::Class;
jfieldID setDirectMessagesChatTopicIsMarkedAsUnread::chat_id_fieldID;
jfieldID setDirectMessagesChatTopicIsMarkedAsUnread::topic_id_fieldID;
jfieldID setDirectMessagesChatTopicIsMarkedAsUnread::is_marked_as_unread_fieldID;

setDirectMessagesChatTopicIsMarkedAsUnread::setDirectMessagesChatTopicIsMarkedAsUnread()
  : chat_id_()
  , topic_id_()
  , is_marked_as_unread_()
{}

setDirectMessagesChatTopicIsMarkedAsUnread::setDirectMessagesChatTopicIsMarkedAsUnread(int53 chat_id_, int53 topic_id_, bool is_marked_as_unread_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
  , is_marked_as_unread_(is_marked_as_unread_)
{}

const std::int32_t setDirectMessagesChatTopicIsMarkedAsUnread::ID;

object_ptr<setDirectMessagesChatTopicIsMarkedAsUnread> setDirectMessagesChatTopicIsMarkedAsUnread::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDirectMessagesChatTopicIsMarkedAsUnread> res = make_object<setDirectMessagesChatTopicIsMarkedAsUnread>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = env->GetLongField(p, res->topic_id_fieldID);
  res->is_marked_as_unread_ = (env->GetBooleanField(p, res->is_marked_as_unread_fieldID) != 0);
  return res;
}

void setDirectMessagesChatTopicIsMarkedAsUnread::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetDirectMessagesChatTopicIsMarkedAsUnread");
    s.store_field("chatId", chat_id_);
    s.store_field("topicId", topic_id_);
    s.store_field("isMarkedAsUnread", is_marked_as_unread_);
    s.store_class_end();
  }
}

setDirectMessagesChatTopicIsMarkedAsUnread::ReturnType setDirectMessagesChatTopicIsMarkedAsUnread::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setFileGenerationProgress::Class;
jfieldID setFileGenerationProgress::generation_id_fieldID;
jfieldID setFileGenerationProgress::expected_size_fieldID;
jfieldID setFileGenerationProgress::local_prefix_size_fieldID;

setFileGenerationProgress::setFileGenerationProgress()
  : generation_id_()
  , expected_size_()
  , local_prefix_size_()
{}

setFileGenerationProgress::setFileGenerationProgress(int64 generation_id_, int53 expected_size_, int53 local_prefix_size_)
  : generation_id_(generation_id_)
  , expected_size_(expected_size_)
  , local_prefix_size_(local_prefix_size_)
{}

const std::int32_t setFileGenerationProgress::ID;

object_ptr<setFileGenerationProgress> setFileGenerationProgress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setFileGenerationProgress> res = make_object<setFileGenerationProgress>();
  res->generation_id_ = env->GetLongField(p, res->generation_id_fieldID);
  res->expected_size_ = env->GetLongField(p, res->expected_size_fieldID);
  res->local_prefix_size_ = env->GetLongField(p, res->local_prefix_size_fieldID);
  return res;
}

void setFileGenerationProgress::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetFileGenerationProgress");
    s.store_field("generationId", generation_id_);
    s.store_field("expectedSize", expected_size_);
    s.store_field("localPrefixSize", local_prefix_size_);
    s.store_class_end();
  }
}

setFileGenerationProgress::ReturnType setFileGenerationProgress::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setFileGenerationProgress::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetFileGenerationProgress").c_str());
    generation_id_fieldID = jni::get_field_id(env, Class, "generationId", "J");
    expected_size_fieldID = jni::get_field_id(env, Class, "expectedSize", "J");
    local_prefix_size_fieldID = jni::get_field_id(env, Class, "localPrefixSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setGiftResalePrice::Class;
jfieldID setGiftResalePrice::received_gift_id_fieldID;
jfieldID setGiftResalePrice::price_fieldID;

setGiftResalePrice::setGiftResalePrice()
  : received_gift_id_()
  , price_()
{}

setGiftResalePrice::setGiftResalePrice(string const &received_gift_id_, object_ptr<GiftResalePrice> &&price_)
  : received_gift_id_(received_gift_id_)
  , price_(std::move(price_))
{}

const std::int32_t setGiftResalePrice::ID;

object_ptr<setGiftResalePrice> setGiftResalePrice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setGiftResalePrice> res = make_object<setGiftResalePrice>();
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  return res;
}

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

setGiftResalePrice::ReturnType setGiftResalePrice::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass shareUsersWithBot::Class;
jfieldID shareUsersWithBot::source_fieldID;
jfieldID shareUsersWithBot::button_id_fieldID;
jfieldID shareUsersWithBot::shared_user_ids_fieldID;
jfieldID shareUsersWithBot::only_check_fieldID;

shareUsersWithBot::shareUsersWithBot()
  : source_()
  , button_id_()
  , shared_user_ids_()
  , only_check_()
{}

shareUsersWithBot::shareUsersWithBot(object_ptr<KeyboardButtonSource> &&source_, int32 button_id_, array<int53> &&shared_user_ids_, bool only_check_)
  : source_(std::move(source_))
  , button_id_(button_id_)
  , shared_user_ids_(std::move(shared_user_ids_))
  , only_check_(only_check_)
{}

const std::int32_t shareUsersWithBot::ID;

object_ptr<shareUsersWithBot> shareUsersWithBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<shareUsersWithBot> res = make_object<shareUsersWithBot>();
  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_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->shared_user_ids_fieldID));
  res->only_check_ = (env->GetBooleanField(p, res->only_check_fieldID) != 0);
  return res;
}

void shareUsersWithBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ShareUsersWithBot");
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_field("buttonId", button_id_);
    { s.store_vector_begin("sharedUserIds", shared_user_ids_.size()); for (const auto &_value : shared_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("onlyCheck", only_check_);
    s.store_class_end();
  }
}

shareUsersWithBot::ReturnType shareUsersWithBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void shareUsersWithBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ShareUsersWithBot").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_user_ids_fieldID = jni::get_field_id(env, Class, "sharedUserIds", "[J");
    only_check_fieldID = jni::get_field_id(env, Class, "onlyCheck", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass suggestUserBirthdate::Class;
jfieldID suggestUserBirthdate::user_id_fieldID;
jfieldID suggestUserBirthdate::birthdate_fieldID;

suggestUserBirthdate::suggestUserBirthdate()
  : user_id_()
  , birthdate_()
{}

suggestUserBirthdate::suggestUserBirthdate(int53 user_id_, object_ptr<birthdate> &&birthdate_)
  : user_id_(user_id_)
  , birthdate_(std::move(birthdate_))
{}

const std::int32_t suggestUserBirthdate::ID;

object_ptr<suggestUserBirthdate> suggestUserBirthdate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestUserBirthdate> res = make_object<suggestUserBirthdate>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->birthdate_ = jni::fetch_tl_object<birthdate>(env, jni::fetch_object(env, p, res->birthdate_fieldID));
  return res;
}

void suggestUserBirthdate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SuggestUserBirthdate");
    s.store_field("userId", user_id_);
    s.store_object_field("birthdate", static_cast<const BaseObject *>(birthdate_.get()));
    s.store_class_end();
  }
}

suggestUserBirthdate::ReturnType suggestUserBirthdate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass summarizeMessage::Class;
jfieldID summarizeMessage::chat_id_fieldID;
jfieldID summarizeMessage::message_id_fieldID;
jfieldID summarizeMessage::translate_to_language_code_fieldID;
jfieldID summarizeMessage::tone_fieldID;

summarizeMessage::summarizeMessage()
  : chat_id_()
  , message_id_()
  , translate_to_language_code_()
  , tone_()
{}

summarizeMessage::summarizeMessage(int53 chat_id_, int53 message_id_, string const &translate_to_language_code_, string const &tone_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , translate_to_language_code_(translate_to_language_code_)
  , tone_(tone_)
{}

const std::int32_t summarizeMessage::ID;

object_ptr<summarizeMessage> summarizeMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<summarizeMessage> res = make_object<summarizeMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->translate_to_language_code_ = jni::fetch_string(env, p, res->translate_to_language_code_fieldID);
  res->tone_ = jni::fetch_string(env, p, res->tone_fieldID);
  return res;
}

void summarizeMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SummarizeMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("translateToLanguageCode", translate_to_language_code_);
    s.store_field("tone", tone_);
    s.store_class_end();
  }
}

summarizeMessage::ReturnType summarizeMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

void summarizeMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SummarizeMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    translate_to_language_code_fieldID = jni::get_field_id(env, Class, "translateToLanguageCode", "Ljava/lang/String;");
    tone_fieldID = jni::get_field_id(env, Class, "tone", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass testCallBytes::Class;
jfieldID testCallBytes::x_fieldID;

testCallBytes::testCallBytes()
  : x_()
{}

testCallBytes::testCallBytes(bytes const &x_)
  : x_(std::move(x_))
{}

const std::int32_t testCallBytes::ID;

object_ptr<testCallBytes> testCallBytes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testCallBytes> res = make_object<testCallBytes>();
  res->x_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->x_fieldID));
  return res;
}

void testCallBytes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestCallBytes");
    s.store_bytes_field("x", x_);
    s.store_class_end();
  }
}

testCallBytes::ReturnType testCallBytes::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testBytes::fetch(env, p);
}

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

jclass toggleBotCanManageEmojiStatus::Class;
jfieldID toggleBotCanManageEmojiStatus::bot_user_id_fieldID;
jfieldID toggleBotCanManageEmojiStatus::can_manage_emoji_status_fieldID;

toggleBotCanManageEmojiStatus::toggleBotCanManageEmojiStatus()
  : bot_user_id_()
  , can_manage_emoji_status_()
{}

toggleBotCanManageEmojiStatus::toggleBotCanManageEmojiStatus(int53 bot_user_id_, bool can_manage_emoji_status_)
  : bot_user_id_(bot_user_id_)
  , can_manage_emoji_status_(can_manage_emoji_status_)
{}

const std::int32_t toggleBotCanManageEmojiStatus::ID;

object_ptr<toggleBotCanManageEmojiStatus> toggleBotCanManageEmojiStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleBotCanManageEmojiStatus> res = make_object<toggleBotCanManageEmojiStatus>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->can_manage_emoji_status_ = (env->GetBooleanField(p, res->can_manage_emoji_status_fieldID) != 0);
  return res;
}

void toggleBotCanManageEmojiStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleBotCanManageEmojiStatus");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("canManageEmojiStatus", can_manage_emoji_status_);
    s.store_class_end();
  }
}

toggleBotCanManageEmojiStatus::ReturnType toggleBotCanManageEmojiStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleBotCanManageEmojiStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleBotCanManageEmojiStatus").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    can_manage_emoji_status_fieldID = jni::get_field_id(env, Class, "canManageEmojiStatus", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleDirectMessagesChatTopicCanSendUnpaidMessages::Class;
jfieldID toggleDirectMessagesChatTopicCanSendUnpaidMessages::chat_id_fieldID;
jfieldID toggleDirectMessagesChatTopicCanSendUnpaidMessages::topic_id_fieldID;
jfieldID toggleDirectMessagesChatTopicCanSendUnpaidMessages::can_send_unpaid_messages_fieldID;
jfieldID toggleDirectMessagesChatTopicCanSendUnpaidMessages::refund_payments_fieldID;

toggleDirectMessagesChatTopicCanSendUnpaidMessages::toggleDirectMessagesChatTopicCanSendUnpaidMessages()
  : chat_id_()
  , topic_id_()
  , can_send_unpaid_messages_()
  , refund_payments_()
{}

toggleDirectMessagesChatTopicCanSendUnpaidMessages::toggleDirectMessagesChatTopicCanSendUnpaidMessages(int53 chat_id_, int53 topic_id_, bool can_send_unpaid_messages_, bool refund_payments_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
  , can_send_unpaid_messages_(can_send_unpaid_messages_)
  , refund_payments_(refund_payments_)
{}

const std::int32_t toggleDirectMessagesChatTopicCanSendUnpaidMessages::ID;

object_ptr<toggleDirectMessagesChatTopicCanSendUnpaidMessages> toggleDirectMessagesChatTopicCanSendUnpaidMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleDirectMessagesChatTopicCanSendUnpaidMessages> res = make_object<toggleDirectMessagesChatTopicCanSendUnpaidMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = env->GetLongField(p, res->topic_id_fieldID);
  res->can_send_unpaid_messages_ = (env->GetBooleanField(p, res->can_send_unpaid_messages_fieldID) != 0);
  res->refund_payments_ = (env->GetBooleanField(p, res->refund_payments_fieldID) != 0);
  return res;
}

void toggleDirectMessagesChatTopicCanSendUnpaidMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleDirectMessagesChatTopicCanSendUnpaidMessages");
    s.store_field("chatId", chat_id_);
    s.store_field("topicId", topic_id_);
    s.store_field("canSendUnpaidMessages", can_send_unpaid_messages_);
    s.store_field("refundPayments", refund_payments_);
    s.store_class_end();
  }
}

toggleDirectMessagesChatTopicCanSendUnpaidMessages::ReturnType toggleDirectMessagesChatTopicCanSendUnpaidMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleDirectMessagesChatTopicCanSendUnpaidMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleDirectMessagesChatTopicCanSendUnpaidMessages").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", "J");
    can_send_unpaid_messages_fieldID = jni::get_field_id(env, Class, "canSendUnpaidMessages", "Z");
    refund_payments_fieldID = jni::get_field_id(env, Class, "refundPayments", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleSessionCanAcceptSecretChats::Class;
jfieldID toggleSessionCanAcceptSecretChats::session_id_fieldID;
jfieldID toggleSessionCanAcceptSecretChats::can_accept_secret_chats_fieldID;

toggleSessionCanAcceptSecretChats::toggleSessionCanAcceptSecretChats()
  : session_id_()
  , can_accept_secret_chats_()
{}

toggleSessionCanAcceptSecretChats::toggleSessionCanAcceptSecretChats(int64 session_id_, bool can_accept_secret_chats_)
  : session_id_(session_id_)
  , can_accept_secret_chats_(can_accept_secret_chats_)
{}

const std::int32_t toggleSessionCanAcceptSecretChats::ID;

object_ptr<toggleSessionCanAcceptSecretChats> toggleSessionCanAcceptSecretChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSessionCanAcceptSecretChats> res = make_object<toggleSessionCanAcceptSecretChats>();
  res->session_id_ = env->GetLongField(p, res->session_id_fieldID);
  res->can_accept_secret_chats_ = (env->GetBooleanField(p, res->can_accept_secret_chats_fieldID) != 0);
  return res;
}

void toggleSessionCanAcceptSecretChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSessionCanAcceptSecretChats");
    s.store_field("sessionId", session_id_);
    s.store_field("canAcceptSecretChats", can_accept_secret_chats_);
    s.store_class_end();
  }
}

toggleSessionCanAcceptSecretChats::ReturnType toggleSessionCanAcceptSecretChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleSessionCanAcceptSecretChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleSessionCanAcceptSecretChats").c_str());
    session_id_fieldID = jni::get_field_id(env, Class, "sessionId", "J");
    can_accept_secret_chats_fieldID = jni::get_field_id(env, Class, "canAcceptSecretChats", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleSupergroupIsForum::Class;
jfieldID toggleSupergroupIsForum::supergroup_id_fieldID;
jfieldID toggleSupergroupIsForum::is_forum_fieldID;
jfieldID toggleSupergroupIsForum::has_forum_tabs_fieldID;

toggleSupergroupIsForum::toggleSupergroupIsForum()
  : supergroup_id_()
  , is_forum_()
  , has_forum_tabs_()
{}

toggleSupergroupIsForum::toggleSupergroupIsForum(int53 supergroup_id_, bool is_forum_, bool has_forum_tabs_)
  : supergroup_id_(supergroup_id_)
  , is_forum_(is_forum_)
  , has_forum_tabs_(has_forum_tabs_)
{}

const std::int32_t toggleSupergroupIsForum::ID;

object_ptr<toggleSupergroupIsForum> toggleSupergroupIsForum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupIsForum> res = make_object<toggleSupergroupIsForum>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->is_forum_ = (env->GetBooleanField(p, res->is_forum_fieldID) != 0);
  res->has_forum_tabs_ = (env->GetBooleanField(p, res->has_forum_tabs_fieldID) != 0);
  return res;
}

void toggleSupergroupIsForum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSupergroupIsForum");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("isForum", is_forum_);
    s.store_field("hasForumTabs", has_forum_tabs_);
    s.store_class_end();
  }
}

toggleSupergroupIsForum::ReturnType toggleSupergroupIsForum::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupJoinByRequest::Class;
jfieldID toggleSupergroupJoinByRequest::supergroup_id_fieldID;
jfieldID toggleSupergroupJoinByRequest::join_by_request_fieldID;

toggleSupergroupJoinByRequest::toggleSupergroupJoinByRequest()
  : supergroup_id_()
  , join_by_request_()
{}

toggleSupergroupJoinByRequest::toggleSupergroupJoinByRequest(int53 supergroup_id_, bool join_by_request_)
  : supergroup_id_(supergroup_id_)
  , join_by_request_(join_by_request_)
{}

const std::int32_t toggleSupergroupJoinByRequest::ID;

object_ptr<toggleSupergroupJoinByRequest> toggleSupergroupJoinByRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupJoinByRequest> res = make_object<toggleSupergroupJoinByRequest>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->join_by_request_ = (env->GetBooleanField(p, res->join_by_request_fieldID) != 0);
  return res;
}

void toggleSupergroupJoinByRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSupergroupJoinByRequest");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("joinByRequest", join_by_request_);
    s.store_class_end();
  }
}

toggleSupergroupJoinByRequest::ReturnType toggleSupergroupJoinByRequest::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleSupergroupJoinByRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleSupergroupJoinByRequest").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    join_by_request_fieldID = jni::get_field_id(env, Class, "joinByRequest", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass unpinAllDirectMessagesChatTopicMessages::Class;
jfieldID unpinAllDirectMessagesChatTopicMessages::chat_id_fieldID;
jfieldID unpinAllDirectMessagesChatTopicMessages::topic_id_fieldID;

unpinAllDirectMessagesChatTopicMessages::unpinAllDirectMessagesChatTopicMessages()
  : chat_id_()
  , topic_id_()
{}

unpinAllDirectMessagesChatTopicMessages::unpinAllDirectMessagesChatTopicMessages(int53 chat_id_, int53 topic_id_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
{}

const std::int32_t unpinAllDirectMessagesChatTopicMessages::ID;

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

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

unpinAllDirectMessagesChatTopicMessages::ReturnType unpinAllDirectMessagesChatTopicMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass upgradeBasicGroupChatToSupergroupChat::Class;
jfieldID upgradeBasicGroupChatToSupergroupChat::chat_id_fieldID;

upgradeBasicGroupChatToSupergroupChat::upgradeBasicGroupChatToSupergroupChat()
  : chat_id_()
{}

upgradeBasicGroupChatToSupergroupChat::upgradeBasicGroupChatToSupergroupChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t upgradeBasicGroupChatToSupergroupChat::ID;

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

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

upgradeBasicGroupChatToSupergroupChat::ReturnType upgradeBasicGroupChatToSupergroupChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

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

jclass uploadStickerFile::Class;
jfieldID uploadStickerFile::user_id_fieldID;
jfieldID uploadStickerFile::sticker_format_fieldID;
jfieldID uploadStickerFile::sticker_fieldID;

uploadStickerFile::uploadStickerFile()
  : user_id_()
  , sticker_format_()
  , sticker_()
{}

uploadStickerFile::uploadStickerFile(int53 user_id_, object_ptr<StickerFormat> &&sticker_format_, object_ptr<InputFile> &&sticker_)
  : user_id_(user_id_)
  , sticker_format_(std::move(sticker_format_))
  , sticker_(std::move(sticker_))
{}

const std::int32_t uploadStickerFile::ID;

object_ptr<uploadStickerFile> uploadStickerFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<uploadStickerFile> res = make_object<uploadStickerFile>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->sticker_format_ = jni::fetch_tl_object<StickerFormat>(env, jni::fetch_object(env, p, res->sticker_format_fieldID));
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void uploadStickerFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UploadStickerFile");
    s.store_field("userId", user_id_);
    s.store_object_field("stickerFormat", static_cast<const BaseObject *>(sticker_format_.get()));
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

uploadStickerFile::ReturnType uploadStickerFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return file::fetch(env, p);
}

void uploadStickerFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UploadStickerFile").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    sticker_format_fieldID = jni::get_field_id(env, Class, "stickerFormat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerFormat;").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;
}
}  // namespace td_api
}  // namespace td
