#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 accentColor::Class;
jfieldID accentColor::id_fieldID;
jfieldID accentColor::built_in_accent_color_id_fieldID;
jfieldID accentColor::light_theme_colors_fieldID;
jfieldID accentColor::dark_theme_colors_fieldID;
jfieldID accentColor::min_channel_chat_boost_level_fieldID;

accentColor::accentColor()
  : id_()
  , built_in_accent_color_id_()
  , light_theme_colors_()
  , dark_theme_colors_()
  , min_channel_chat_boost_level_()
{}

accentColor::accentColor(int32 id_, int32 built_in_accent_color_id_, array<int32> &&light_theme_colors_, array<int32> &&dark_theme_colors_, int32 min_channel_chat_boost_level_)
  : id_(id_)
  , built_in_accent_color_id_(built_in_accent_color_id_)
  , light_theme_colors_(std::move(light_theme_colors_))
  , dark_theme_colors_(std::move(dark_theme_colors_))
  , min_channel_chat_boost_level_(min_channel_chat_boost_level_)
{}

const std::int32_t accentColor::ID;

object_ptr<accentColor> accentColor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<accentColor> res = make_object<accentColor>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->built_in_accent_color_id_ = env->GetIntField(p, res->built_in_accent_color_id_fieldID);
  res->light_theme_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->light_theme_colors_fieldID));
  res->dark_theme_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->dark_theme_colors_fieldID));
  res->min_channel_chat_boost_level_ = env->GetIntField(p, res->min_channel_chat_boost_level_fieldID);
  return res;
}

void accentColor::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetIntField(s, built_in_accent_color_id_fieldID, built_in_accent_color_id_);
  { auto arr_tmp_ = jni::store_vector(env, light_theme_colors_); if (arr_tmp_) { env->SetObjectField(s, light_theme_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, dark_theme_colors_); if (arr_tmp_) { env->SetObjectField(s, dark_theme_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, min_channel_chat_boost_level_fieldID, min_channel_chat_boost_level_);
}

void accentColor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AccentColor");
    s.store_field("id", id_);
    s.store_field("builtInAccentColorId", built_in_accent_color_id_);
    { s.store_vector_begin("lightThemeColors", light_theme_colors_.size()); for (const auto &_value : light_theme_colors_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("darkThemeColors", dark_theme_colors_.size()); for (const auto &_value : dark_theme_colors_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("minChannelChatBoostLevel", min_channel_chat_boost_level_);
    s.store_class_end();
  }
}

void accentColor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AccentColor").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    built_in_accent_color_id_fieldID = jni::get_field_id(env, Class, "builtInAccentColorId", "I");
    light_theme_colors_fieldID = jni::get_field_id(env, Class, "lightThemeColors", "[I");
    dark_theme_colors_fieldID = jni::get_field_id(env, Class, "darkThemeColors", "[I");
    min_channel_chat_boost_level_fieldID = jni::get_field_id(env, Class, "minChannelChatBoostLevel", "I");
    return true;
  }();
  (void)is_inited;
}

jclass affiliateInfo::Class;
jfieldID affiliateInfo::commission_per_mille_fieldID;
jfieldID affiliateInfo::affiliate_chat_id_fieldID;
jfieldID affiliateInfo::star_amount_fieldID;

affiliateInfo::affiliateInfo()
  : commission_per_mille_()
  , affiliate_chat_id_()
  , star_amount_()
{}

affiliateInfo::affiliateInfo(int32 commission_per_mille_, int53 affiliate_chat_id_, object_ptr<starAmount> &&star_amount_)
  : commission_per_mille_(commission_per_mille_)
  , affiliate_chat_id_(affiliate_chat_id_)
  , star_amount_(std::move(star_amount_))
{}

const std::int32_t affiliateInfo::ID;

object_ptr<affiliateInfo> affiliateInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<affiliateInfo> res = make_object<affiliateInfo>();
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->affiliate_chat_id_ = env->GetLongField(p, res->affiliate_chat_id_fieldID);
  res->star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->star_amount_fieldID));
  return res;
}

void affiliateInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  env->SetLongField(s, affiliate_chat_id_fieldID, affiliate_chat_id_);
  if (star_amount_ != nullptr) { jobject next; star_amount_->store(env, next); if (next) { env->SetObjectField(s, star_amount_fieldID, next); env->DeleteLocalRef(next); } }
}

void affiliateInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AffiliateInfo");
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_field("affiliateChatId", affiliate_chat_id_);
    s.store_object_field("starAmount", static_cast<const BaseObject *>(star_amount_.get()));
    s.store_class_end();
  }
}

void affiliateInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AffiliateInfo").c_str());
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    affiliate_chat_id_fieldID = jni::get_field_id(env, Class, "affiliateChatId", "J");
    star_amount_fieldID = jni::get_field_id(env, Class, "starAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass animatedEmoji::Class;
jfieldID animatedEmoji::sticker_fieldID;
jfieldID animatedEmoji::sticker_width_fieldID;
jfieldID animatedEmoji::sticker_height_fieldID;
jfieldID animatedEmoji::fitzpatrick_type_fieldID;
jfieldID animatedEmoji::sound_fieldID;

animatedEmoji::animatedEmoji()
  : sticker_()
  , sticker_width_()
  , sticker_height_()
  , fitzpatrick_type_()
  , sound_()
{}

animatedEmoji::animatedEmoji(object_ptr<sticker> &&sticker_, int32 sticker_width_, int32 sticker_height_, int32 fitzpatrick_type_, object_ptr<file> &&sound_)
  : sticker_(std::move(sticker_))
  , sticker_width_(sticker_width_)
  , sticker_height_(sticker_height_)
  , fitzpatrick_type_(fitzpatrick_type_)
  , sound_(std::move(sound_))
{}

const std::int32_t animatedEmoji::ID;

object_ptr<animatedEmoji> animatedEmoji::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<animatedEmoji> res = make_object<animatedEmoji>();
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->sticker_width_ = env->GetIntField(p, res->sticker_width_fieldID);
  res->sticker_height_ = env->GetIntField(p, res->sticker_height_fieldID);
  res->fitzpatrick_type_ = env->GetIntField(p, res->fitzpatrick_type_fieldID);
  res->sound_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->sound_fieldID));
  return res;
}

void animatedEmoji::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->SetIntField(s, sticker_width_fieldID, sticker_width_);
  env->SetIntField(s, sticker_height_fieldID, sticker_height_);
  env->SetIntField(s, fitzpatrick_type_fieldID, fitzpatrick_type_);
  if (sound_ != nullptr) { jobject next; sound_->store(env, next); if (next) { env->SetObjectField(s, sound_fieldID, next); env->DeleteLocalRef(next); } }
}

void animatedEmoji::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnimatedEmoji");
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_field("stickerWidth", sticker_width_);
    s.store_field("stickerHeight", sticker_height_);
    s.store_field("fitzpatrickType", fitzpatrick_type_);
    s.store_object_field("sound", static_cast<const BaseObject *>(sound_.get()));
    s.store_class_end();
  }
}

void animatedEmoji::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnimatedEmoji").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    sticker_width_fieldID = jni::get_field_id(env, Class, "stickerWidth", "I");
    sticker_height_fieldID = jni::get_field_id(env, Class, "stickerHeight", "I");
    fitzpatrick_type_fieldID = jni::get_field_id(env, Class, "fitzpatrickType", "I");
    sound_fieldID = jni::get_field_id(env, Class, "sound", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass auctionBid::Class;
jfieldID auctionBid::star_count_fieldID;
jfieldID auctionBid::bid_date_fieldID;
jfieldID auctionBid::position_fieldID;

auctionBid::auctionBid()
  : star_count_()
  , bid_date_()
  , position_()
{}

auctionBid::auctionBid(int53 star_count_, int32 bid_date_, int32 position_)
  : star_count_(star_count_)
  , bid_date_(bid_date_)
  , position_(position_)
{}

const std::int32_t auctionBid::ID;

object_ptr<auctionBid> auctionBid::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<auctionBid> res = make_object<auctionBid>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->bid_date_ = env->GetIntField(p, res->bid_date_fieldID);
  res->position_ = env->GetIntField(p, res->position_fieldID);
  return res;
}

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

void auctionBid::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AuctionBid");
    s.store_field("starCount", star_count_);
    s.store_field("bidDate", bid_date_);
    s.store_field("position", position_);
    s.store_class_end();
  }
}

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

jclass AuctionState::Class;

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

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

jclass auctionStateActive::Class;
jfieldID auctionStateActive::start_date_fieldID;
jfieldID auctionStateActive::end_date_fieldID;
jfieldID auctionStateActive::min_bid_fieldID;
jfieldID auctionStateActive::bid_levels_fieldID;
jfieldID auctionStateActive::top_bidder_user_ids_fieldID;
jfieldID auctionStateActive::rounds_fieldID;
jfieldID auctionStateActive::current_round_end_date_fieldID;
jfieldID auctionStateActive::current_round_number_fieldID;
jfieldID auctionStateActive::total_round_count_fieldID;
jfieldID auctionStateActive::distributed_item_count_fieldID;
jfieldID auctionStateActive::left_item_count_fieldID;
jfieldID auctionStateActive::acquired_item_count_fieldID;
jfieldID auctionStateActive::user_bid_fieldID;

auctionStateActive::auctionStateActive()
  : start_date_()
  , end_date_()
  , min_bid_()
  , bid_levels_()
  , top_bidder_user_ids_()
  , rounds_()
  , current_round_end_date_()
  , current_round_number_()
  , total_round_count_()
  , distributed_item_count_()
  , left_item_count_()
  , acquired_item_count_()
  , user_bid_()
{}

auctionStateActive::auctionStateActive(int32 start_date_, int32 end_date_, int53 min_bid_, array<object_ptr<auctionBid>> &&bid_levels_, array<int53> &&top_bidder_user_ids_, array<object_ptr<auctionRound>> &&rounds_, int32 current_round_end_date_, int32 current_round_number_, int32 total_round_count_, int32 distributed_item_count_, int32 left_item_count_, int32 acquired_item_count_, object_ptr<userAuctionBid> &&user_bid_)
  : start_date_(start_date_)
  , end_date_(end_date_)
  , min_bid_(min_bid_)
  , bid_levels_(std::move(bid_levels_))
  , top_bidder_user_ids_(std::move(top_bidder_user_ids_))
  , rounds_(std::move(rounds_))
  , current_round_end_date_(current_round_end_date_)
  , current_round_number_(current_round_number_)
  , total_round_count_(total_round_count_)
  , distributed_item_count_(distributed_item_count_)
  , left_item_count_(left_item_count_)
  , acquired_item_count_(acquired_item_count_)
  , user_bid_(std::move(user_bid_))
{}

const std::int32_t auctionStateActive::ID;

object_ptr<AuctionState> auctionStateActive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<auctionStateActive> res = make_object<auctionStateActive>();
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  res->end_date_ = env->GetIntField(p, res->end_date_fieldID);
  res->min_bid_ = env->GetLongField(p, res->min_bid_fieldID);
  res->bid_levels_ = jni::FetchVector<auctionBid>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->bid_levels_fieldID));
  res->top_bidder_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->top_bidder_user_ids_fieldID));
  res->rounds_ = jni::FetchVector<auctionRound>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->rounds_fieldID));
  res->current_round_end_date_ = env->GetIntField(p, res->current_round_end_date_fieldID);
  res->current_round_number_ = env->GetIntField(p, res->current_round_number_fieldID);
  res->total_round_count_ = env->GetIntField(p, res->total_round_count_fieldID);
  res->distributed_item_count_ = env->GetIntField(p, res->distributed_item_count_fieldID);
  res->left_item_count_ = env->GetIntField(p, res->left_item_count_fieldID);
  res->acquired_item_count_ = env->GetIntField(p, res->acquired_item_count_fieldID);
  res->user_bid_ = jni::fetch_tl_object<userAuctionBid>(env, jni::fetch_object(env, p, res->user_bid_fieldID));
  return std::move(res);
}

void auctionStateActive::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, start_date_fieldID, start_date_);
  env->SetIntField(s, end_date_fieldID, end_date_);
  env->SetLongField(s, min_bid_fieldID, min_bid_);
  { auto arr_tmp_ = jni::store_vector(env, bid_levels_); if (arr_tmp_) { env->SetObjectField(s, bid_levels_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, top_bidder_user_ids_); if (arr_tmp_) { env->SetObjectField(s, top_bidder_user_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, rounds_); if (arr_tmp_) { env->SetObjectField(s, rounds_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, current_round_end_date_fieldID, current_round_end_date_);
  env->SetIntField(s, current_round_number_fieldID, current_round_number_);
  env->SetIntField(s, total_round_count_fieldID, total_round_count_);
  env->SetIntField(s, distributed_item_count_fieldID, distributed_item_count_);
  env->SetIntField(s, left_item_count_fieldID, left_item_count_);
  env->SetIntField(s, acquired_item_count_fieldID, acquired_item_count_);
  if (user_bid_ != nullptr) { jobject next; user_bid_->store(env, next); if (next) { env->SetObjectField(s, user_bid_fieldID, next); env->DeleteLocalRef(next); } }
}

void auctionStateActive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AuctionStateActive");
    s.store_field("startDate", start_date_);
    s.store_field("endDate", end_date_);
    s.store_field("minBid", min_bid_);
    { s.store_vector_begin("bidLevels", bid_levels_.size()); for (const auto &_value : bid_levels_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("topBidderUserIds", top_bidder_user_ids_.size()); for (const auto &_value : top_bidder_user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("rounds", rounds_.size()); for (const auto &_value : rounds_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("currentRoundEndDate", current_round_end_date_);
    s.store_field("currentRoundNumber", current_round_number_);
    s.store_field("totalRoundCount", total_round_count_);
    s.store_field("distributedItemCount", distributed_item_count_);
    s.store_field("leftItemCount", left_item_count_);
    s.store_field("acquiredItemCount", acquired_item_count_);
    s.store_object_field("userBid", static_cast<const BaseObject *>(user_bid_.get()));
    s.store_class_end();
  }
}

void auctionStateActive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AuctionStateActive").c_str());
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    end_date_fieldID = jni::get_field_id(env, Class, "endDate", "I");
    min_bid_fieldID = jni::get_field_id(env, Class, "minBid", "J");
    bid_levels_fieldID = jni::get_field_id(env, Class, "bidLevels", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AuctionBid;").c_str());
    top_bidder_user_ids_fieldID = jni::get_field_id(env, Class, "topBidderUserIds", "[J");
    rounds_fieldID = jni::get_field_id(env, Class, "rounds", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AuctionRound;").c_str());
    current_round_end_date_fieldID = jni::get_field_id(env, Class, "currentRoundEndDate", "I");
    current_round_number_fieldID = jni::get_field_id(env, Class, "currentRoundNumber", "I");
    total_round_count_fieldID = jni::get_field_id(env, Class, "totalRoundCount", "I");
    distributed_item_count_fieldID = jni::get_field_id(env, Class, "distributedItemCount", "I");
    left_item_count_fieldID = jni::get_field_id(env, Class, "leftItemCount", "I");
    acquired_item_count_fieldID = jni::get_field_id(env, Class, "acquiredItemCount", "I");
    user_bid_fieldID = jni::get_field_id(env, Class, "userBid", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserAuctionBid;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass auctionStateFinished::Class;
jfieldID auctionStateFinished::start_date_fieldID;
jfieldID auctionStateFinished::end_date_fieldID;
jfieldID auctionStateFinished::average_price_fieldID;
jfieldID auctionStateFinished::acquired_item_count_fieldID;
jfieldID auctionStateFinished::telegram_listed_item_count_fieldID;
jfieldID auctionStateFinished::fragment_listed_item_count_fieldID;
jfieldID auctionStateFinished::fragment_url_fieldID;

auctionStateFinished::auctionStateFinished()
  : start_date_()
  , end_date_()
  , average_price_()
  , acquired_item_count_()
  , telegram_listed_item_count_()
  , fragment_listed_item_count_()
  , fragment_url_()
{}

auctionStateFinished::auctionStateFinished(int32 start_date_, int32 end_date_, int53 average_price_, int32 acquired_item_count_, int32 telegram_listed_item_count_, int32 fragment_listed_item_count_, string const &fragment_url_)
  : start_date_(start_date_)
  , end_date_(end_date_)
  , average_price_(average_price_)
  , acquired_item_count_(acquired_item_count_)
  , telegram_listed_item_count_(telegram_listed_item_count_)
  , fragment_listed_item_count_(fragment_listed_item_count_)
  , fragment_url_(fragment_url_)
{}

const std::int32_t auctionStateFinished::ID;

object_ptr<AuctionState> auctionStateFinished::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<auctionStateFinished> res = make_object<auctionStateFinished>();
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  res->end_date_ = env->GetIntField(p, res->end_date_fieldID);
  res->average_price_ = env->GetLongField(p, res->average_price_fieldID);
  res->acquired_item_count_ = env->GetIntField(p, res->acquired_item_count_fieldID);
  res->telegram_listed_item_count_ = env->GetIntField(p, res->telegram_listed_item_count_fieldID);
  res->fragment_listed_item_count_ = env->GetIntField(p, res->fragment_listed_item_count_fieldID);
  res->fragment_url_ = jni::fetch_string(env, p, res->fragment_url_fieldID);
  return std::move(res);
}

void auctionStateFinished::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, start_date_fieldID, start_date_);
  env->SetIntField(s, end_date_fieldID, end_date_);
  env->SetLongField(s, average_price_fieldID, average_price_);
  env->SetIntField(s, acquired_item_count_fieldID, acquired_item_count_);
  env->SetIntField(s, telegram_listed_item_count_fieldID, telegram_listed_item_count_);
  env->SetIntField(s, fragment_listed_item_count_fieldID, fragment_listed_item_count_);
  { jstring nextString = jni::to_jstring(env, fragment_url_); if (nextString) { env->SetObjectField(s, fragment_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void auctionStateFinished::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AuctionStateFinished");
    s.store_field("startDate", start_date_);
    s.store_field("endDate", end_date_);
    s.store_field("averagePrice", average_price_);
    s.store_field("acquiredItemCount", acquired_item_count_);
    s.store_field("telegramListedItemCount", telegram_listed_item_count_);
    s.store_field("fragmentListedItemCount", fragment_listed_item_count_);
    s.store_field("fragmentUrl", fragment_url_);
    s.store_class_end();
  }
}

void auctionStateFinished::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AuctionStateFinished").c_str());
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    end_date_fieldID = jni::get_field_id(env, Class, "endDate", "I");
    average_price_fieldID = jni::get_field_id(env, Class, "averagePrice", "J");
    acquired_item_count_fieldID = jni::get_field_id(env, Class, "acquiredItemCount", "I");
    telegram_listed_item_count_fieldID = jni::get_field_id(env, Class, "telegramListedItemCount", "I");
    fragment_listed_item_count_fieldID = jni::get_field_id(env, Class, "fragmentListedItemCount", "I");
    fragment_url_fieldID = jni::get_field_id(env, Class, "fragmentUrl", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass botInfo::Class;
jfieldID botInfo::short_description_fieldID;
jfieldID botInfo::description_fieldID;
jfieldID botInfo::photo_fieldID;
jfieldID botInfo::animation_fieldID;
jfieldID botInfo::manager_bot_user_id_fieldID;
jfieldID botInfo::menu_button_fieldID;
jfieldID botInfo::commands_fieldID;
jfieldID botInfo::privacy_policy_url_fieldID;
jfieldID botInfo::default_group_administrator_rights_fieldID;
jfieldID botInfo::default_channel_administrator_rights_fieldID;
jfieldID botInfo::affiliate_program_fieldID;
jfieldID botInfo::web_app_background_light_color_fieldID;
jfieldID botInfo::web_app_background_dark_color_fieldID;
jfieldID botInfo::web_app_header_light_color_fieldID;
jfieldID botInfo::web_app_header_dark_color_fieldID;
jfieldID botInfo::verification_parameters_fieldID;
jfieldID botInfo::can_get_revenue_statistics_fieldID;
jfieldID botInfo::can_manage_emoji_status_fieldID;
jfieldID botInfo::has_media_previews_fieldID;
jfieldID botInfo::edit_commands_link_fieldID;
jfieldID botInfo::edit_description_link_fieldID;
jfieldID botInfo::edit_description_media_link_fieldID;
jfieldID botInfo::edit_settings_link_fieldID;

botInfo::botInfo()
  : short_description_()
  , description_()
  , photo_()
  , animation_()
  , manager_bot_user_id_()
  , menu_button_()
  , commands_()
  , privacy_policy_url_()
  , default_group_administrator_rights_()
  , default_channel_administrator_rights_()
  , affiliate_program_()
  , web_app_background_light_color_()
  , web_app_background_dark_color_()
  , web_app_header_light_color_()
  , web_app_header_dark_color_()
  , verification_parameters_()
  , can_get_revenue_statistics_()
  , can_manage_emoji_status_()
  , has_media_previews_()
  , edit_commands_link_()
  , edit_description_link_()
  , edit_description_media_link_()
  , edit_settings_link_()
{}

botInfo::botInfo(string const &short_description_, string const &description_, object_ptr<photo> &&photo_, object_ptr<animation> &&animation_, int53 manager_bot_user_id_, object_ptr<botMenuButton> &&menu_button_, array<object_ptr<botCommand>> &&commands_, string const &privacy_policy_url_, object_ptr<chatAdministratorRights> &&default_group_administrator_rights_, object_ptr<chatAdministratorRights> &&default_channel_administrator_rights_, object_ptr<affiliateProgramInfo> &&affiliate_program_, int32 web_app_background_light_color_, int32 web_app_background_dark_color_, int32 web_app_header_light_color_, int32 web_app_header_dark_color_, object_ptr<botVerificationParameters> &&verification_parameters_, bool can_get_revenue_statistics_, bool can_manage_emoji_status_, bool has_media_previews_, object_ptr<InternalLinkType> &&edit_commands_link_, object_ptr<InternalLinkType> &&edit_description_link_, object_ptr<InternalLinkType> &&edit_description_media_link_, object_ptr<InternalLinkType> &&edit_settings_link_)
  : short_description_(short_description_)
  , description_(description_)
  , photo_(std::move(photo_))
  , animation_(std::move(animation_))
  , manager_bot_user_id_(manager_bot_user_id_)
  , menu_button_(std::move(menu_button_))
  , commands_(std::move(commands_))
  , privacy_policy_url_(privacy_policy_url_)
  , default_group_administrator_rights_(std::move(default_group_administrator_rights_))
  , default_channel_administrator_rights_(std::move(default_channel_administrator_rights_))
  , affiliate_program_(std::move(affiliate_program_))
  , web_app_background_light_color_(web_app_background_light_color_)
  , web_app_background_dark_color_(web_app_background_dark_color_)
  , web_app_header_light_color_(web_app_header_light_color_)
  , web_app_header_dark_color_(web_app_header_dark_color_)
  , verification_parameters_(std::move(verification_parameters_))
  , can_get_revenue_statistics_(can_get_revenue_statistics_)
  , can_manage_emoji_status_(can_manage_emoji_status_)
  , has_media_previews_(has_media_previews_)
  , edit_commands_link_(std::move(edit_commands_link_))
  , edit_description_link_(std::move(edit_description_link_))
  , edit_description_media_link_(std::move(edit_description_media_link_))
  , edit_settings_link_(std::move(edit_settings_link_))
{}

const std::int32_t botInfo::ID;

object_ptr<botInfo> botInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botInfo> res = make_object<botInfo>();
  res->short_description_ = jni::fetch_string(env, p, res->short_description_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->manager_bot_user_id_ = env->GetLongField(p, res->manager_bot_user_id_fieldID);
  res->menu_button_ = jni::fetch_tl_object<botMenuButton>(env, jni::fetch_object(env, p, res->menu_button_fieldID));
  res->commands_ = jni::FetchVector<botCommand>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->commands_fieldID));
  res->privacy_policy_url_ = jni::fetch_string(env, p, res->privacy_policy_url_fieldID);
  res->default_group_administrator_rights_ = jni::fetch_tl_object<chatAdministratorRights>(env, jni::fetch_object(env, p, res->default_group_administrator_rights_fieldID));
  res->default_channel_administrator_rights_ = jni::fetch_tl_object<chatAdministratorRights>(env, jni::fetch_object(env, p, res->default_channel_administrator_rights_fieldID));
  res->affiliate_program_ = jni::fetch_tl_object<affiliateProgramInfo>(env, jni::fetch_object(env, p, res->affiliate_program_fieldID));
  res->web_app_background_light_color_ = env->GetIntField(p, res->web_app_background_light_color_fieldID);
  res->web_app_background_dark_color_ = env->GetIntField(p, res->web_app_background_dark_color_fieldID);
  res->web_app_header_light_color_ = env->GetIntField(p, res->web_app_header_light_color_fieldID);
  res->web_app_header_dark_color_ = env->GetIntField(p, res->web_app_header_dark_color_fieldID);
  res->verification_parameters_ = jni::fetch_tl_object<botVerificationParameters>(env, jni::fetch_object(env, p, res->verification_parameters_fieldID));
  res->can_get_revenue_statistics_ = (env->GetBooleanField(p, res->can_get_revenue_statistics_fieldID) != 0);
  res->can_manage_emoji_status_ = (env->GetBooleanField(p, res->can_manage_emoji_status_fieldID) != 0);
  res->has_media_previews_ = (env->GetBooleanField(p, res->has_media_previews_fieldID) != 0);
  res->edit_commands_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->edit_commands_link_fieldID));
  res->edit_description_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->edit_description_link_fieldID));
  res->edit_description_media_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->edit_description_media_link_fieldID));
  res->edit_settings_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->edit_settings_link_fieldID));
  return res;
}

void botInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, short_description_); if (nextString) { env->SetObjectField(s, short_description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, manager_bot_user_id_fieldID, manager_bot_user_id_);
  if (menu_button_ != nullptr) { jobject next; menu_button_->store(env, next); if (next) { env->SetObjectField(s, menu_button_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, commands_); if (arr_tmp_) { env->SetObjectField(s, commands_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, privacy_policy_url_); if (nextString) { env->SetObjectField(s, privacy_policy_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (default_group_administrator_rights_ != nullptr) { jobject next; default_group_administrator_rights_->store(env, next); if (next) { env->SetObjectField(s, default_group_administrator_rights_fieldID, next); env->DeleteLocalRef(next); } }
  if (default_channel_administrator_rights_ != nullptr) { jobject next; default_channel_administrator_rights_->store(env, next); if (next) { env->SetObjectField(s, default_channel_administrator_rights_fieldID, next); env->DeleteLocalRef(next); } }
  if (affiliate_program_ != nullptr) { jobject next; affiliate_program_->store(env, next); if (next) { env->SetObjectField(s, affiliate_program_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, web_app_background_light_color_fieldID, web_app_background_light_color_);
  env->SetIntField(s, web_app_background_dark_color_fieldID, web_app_background_dark_color_);
  env->SetIntField(s, web_app_header_light_color_fieldID, web_app_header_light_color_);
  env->SetIntField(s, web_app_header_dark_color_fieldID, web_app_header_dark_color_);
  if (verification_parameters_ != nullptr) { jobject next; verification_parameters_->store(env, next); if (next) { env->SetObjectField(s, verification_parameters_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_get_revenue_statistics_fieldID, can_get_revenue_statistics_);
  env->SetBooleanField(s, can_manage_emoji_status_fieldID, can_manage_emoji_status_);
  env->SetBooleanField(s, has_media_previews_fieldID, has_media_previews_);
  if (edit_commands_link_ != nullptr) { jobject next; edit_commands_link_->store(env, next); if (next) { env->SetObjectField(s, edit_commands_link_fieldID, next); env->DeleteLocalRef(next); } }
  if (edit_description_link_ != nullptr) { jobject next; edit_description_link_->store(env, next); if (next) { env->SetObjectField(s, edit_description_link_fieldID, next); env->DeleteLocalRef(next); } }
  if (edit_description_media_link_ != nullptr) { jobject next; edit_description_media_link_->store(env, next); if (next) { env->SetObjectField(s, edit_description_media_link_fieldID, next); env->DeleteLocalRef(next); } }
  if (edit_settings_link_ != nullptr) { jobject next; edit_settings_link_->store(env, next); if (next) { env->SetObjectField(s, edit_settings_link_fieldID, next); env->DeleteLocalRef(next); } }
}

void botInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotInfo");
    s.store_field("shortDescription", short_description_);
    s.store_field("description", description_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_field("managerBotUserId", manager_bot_user_id_);
    s.store_object_field("menuButton", static_cast<const BaseObject *>(menu_button_.get()));
    { s.store_vector_begin("commands", commands_.size()); for (const auto &_value : commands_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("privacyPolicyUrl", privacy_policy_url_);
    s.store_object_field("defaultGroupAdministratorRights", static_cast<const BaseObject *>(default_group_administrator_rights_.get()));
    s.store_object_field("defaultChannelAdministratorRights", static_cast<const BaseObject *>(default_channel_administrator_rights_.get()));
    s.store_object_field("affiliateProgram", static_cast<const BaseObject *>(affiliate_program_.get()));
    s.store_field("webAppBackgroundLightColor", web_app_background_light_color_);
    s.store_field("webAppBackgroundDarkColor", web_app_background_dark_color_);
    s.store_field("webAppHeaderLightColor", web_app_header_light_color_);
    s.store_field("webAppHeaderDarkColor", web_app_header_dark_color_);
    s.store_object_field("verificationParameters", static_cast<const BaseObject *>(verification_parameters_.get()));
    s.store_field("canGetRevenueStatistics", can_get_revenue_statistics_);
    s.store_field("canManageEmojiStatus", can_manage_emoji_status_);
    s.store_field("hasMediaPreviews", has_media_previews_);
    s.store_object_field("editCommandsLink", static_cast<const BaseObject *>(edit_commands_link_.get()));
    s.store_object_field("editDescriptionLink", static_cast<const BaseObject *>(edit_description_link_.get()));
    s.store_object_field("editDescriptionMediaLink", static_cast<const BaseObject *>(edit_description_media_link_.get()));
    s.store_object_field("editSettingsLink", static_cast<const BaseObject *>(edit_settings_link_.get()));
    s.store_class_end();
  }
}

void botInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotInfo").c_str());
    short_description_fieldID = jni::get_field_id(env, Class, "shortDescription", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    manager_bot_user_id_fieldID = jni::get_field_id(env, Class, "managerBotUserId", "J");
    menu_button_fieldID = jni::get_field_id(env, Class, "menuButton", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotMenuButton;").c_str());
    commands_fieldID = jni::get_field_id(env, Class, "commands", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BotCommand;").c_str());
    privacy_policy_url_fieldID = jni::get_field_id(env, Class, "privacyPolicyUrl", "Ljava/lang/String;");
    default_group_administrator_rights_fieldID = jni::get_field_id(env, Class, "defaultGroupAdministratorRights", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAdministratorRights;").c_str());
    default_channel_administrator_rights_fieldID = jni::get_field_id(env, Class, "defaultChannelAdministratorRights", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAdministratorRights;").c_str());
    affiliate_program_fieldID = jni::get_field_id(env, Class, "affiliateProgram", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateProgramInfo;").c_str());
    web_app_background_light_color_fieldID = jni::get_field_id(env, Class, "webAppBackgroundLightColor", "I");
    web_app_background_dark_color_fieldID = jni::get_field_id(env, Class, "webAppBackgroundDarkColor", "I");
    web_app_header_light_color_fieldID = jni::get_field_id(env, Class, "webAppHeaderLightColor", "I");
    web_app_header_dark_color_fieldID = jni::get_field_id(env, Class, "webAppHeaderDarkColor", "I");
    verification_parameters_fieldID = jni::get_field_id(env, Class, "verificationParameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotVerificationParameters;").c_str());
    can_get_revenue_statistics_fieldID = jni::get_field_id(env, Class, "canGetRevenueStatistics", "Z");
    can_manage_emoji_status_fieldID = jni::get_field_id(env, Class, "canManageEmojiStatus", "Z");
    has_media_previews_fieldID = jni::get_field_id(env, Class, "hasMediaPreviews", "Z");
    edit_commands_link_fieldID = jni::get_field_id(env, Class, "editCommandsLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    edit_description_link_fieldID = jni::get_field_id(env, Class, "editDescriptionLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    edit_description_media_link_fieldID = jni::get_field_id(env, Class, "editDescriptionMediaLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    edit_settings_link_fieldID = jni::get_field_id(env, Class, "editSettingsLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass botVerificationParameters::Class;
jfieldID botVerificationParameters::icon_custom_emoji_id_fieldID;
jfieldID botVerificationParameters::organization_name_fieldID;
jfieldID botVerificationParameters::default_custom_description_fieldID;
jfieldID botVerificationParameters::can_set_custom_description_fieldID;

botVerificationParameters::botVerificationParameters()
  : icon_custom_emoji_id_()
  , organization_name_()
  , default_custom_description_()
  , can_set_custom_description_()
{}

botVerificationParameters::botVerificationParameters(int64 icon_custom_emoji_id_, string const &organization_name_, object_ptr<formattedText> &&default_custom_description_, bool can_set_custom_description_)
  : icon_custom_emoji_id_(icon_custom_emoji_id_)
  , organization_name_(organization_name_)
  , default_custom_description_(std::move(default_custom_description_))
  , can_set_custom_description_(can_set_custom_description_)
{}

const std::int32_t botVerificationParameters::ID;

object_ptr<botVerificationParameters> botVerificationParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botVerificationParameters> res = make_object<botVerificationParameters>();
  res->icon_custom_emoji_id_ = env->GetLongField(p, res->icon_custom_emoji_id_fieldID);
  res->organization_name_ = jni::fetch_string(env, p, res->organization_name_fieldID);
  res->default_custom_description_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->default_custom_description_fieldID));
  res->can_set_custom_description_ = (env->GetBooleanField(p, res->can_set_custom_description_fieldID) != 0);
  return res;
}

void botVerificationParameters::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, icon_custom_emoji_id_fieldID, icon_custom_emoji_id_);
  { jstring nextString = jni::to_jstring(env, organization_name_); if (nextString) { env->SetObjectField(s, organization_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (default_custom_description_ != nullptr) { jobject next; default_custom_description_->store(env, next); if (next) { env->SetObjectField(s, default_custom_description_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_set_custom_description_fieldID, can_set_custom_description_);
}

void botVerificationParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotVerificationParameters");
    s.store_field("iconCustomEmojiId", icon_custom_emoji_id_);
    s.store_field("organizationName", organization_name_);
    s.store_object_field("defaultCustomDescription", static_cast<const BaseObject *>(default_custom_description_.get()));
    s.store_field("canSetCustomDescription", can_set_custom_description_);
    s.store_class_end();
  }
}

void botVerificationParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotVerificationParameters").c_str());
    icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "iconCustomEmojiId", "J");
    organization_name_fieldID = jni::get_field_id(env, Class, "organizationName", "Ljava/lang/String;");
    default_custom_description_fieldID = jni::get_field_id(env, Class, "defaultCustomDescription", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    can_set_custom_description_fieldID = jni::get_field_id(env, Class, "canSetCustomDescription", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass businessBotRights::Class;
jfieldID businessBotRights::can_reply_fieldID;
jfieldID businessBotRights::can_read_messages_fieldID;
jfieldID businessBotRights::can_delete_sent_messages_fieldID;
jfieldID businessBotRights::can_delete_all_messages_fieldID;
jfieldID businessBotRights::can_edit_name_fieldID;
jfieldID businessBotRights::can_edit_bio_fieldID;
jfieldID businessBotRights::can_edit_profile_photo_fieldID;
jfieldID businessBotRights::can_edit_username_fieldID;
jfieldID businessBotRights::can_view_gifts_and_stars_fieldID;
jfieldID businessBotRights::can_sell_gifts_fieldID;
jfieldID businessBotRights::can_change_gift_settings_fieldID;
jfieldID businessBotRights::can_transfer_and_upgrade_gifts_fieldID;
jfieldID businessBotRights::can_transfer_stars_fieldID;
jfieldID businessBotRights::can_manage_stories_fieldID;

businessBotRights::businessBotRights()
  : can_reply_()
  , can_read_messages_()
  , can_delete_sent_messages_()
  , can_delete_all_messages_()
  , can_edit_name_()
  , can_edit_bio_()
  , can_edit_profile_photo_()
  , can_edit_username_()
  , can_view_gifts_and_stars_()
  , can_sell_gifts_()
  , can_change_gift_settings_()
  , can_transfer_and_upgrade_gifts_()
  , can_transfer_stars_()
  , can_manage_stories_()
{}

businessBotRights::businessBotRights(bool can_reply_, bool can_read_messages_, bool can_delete_sent_messages_, bool can_delete_all_messages_, bool can_edit_name_, bool can_edit_bio_, bool can_edit_profile_photo_, bool can_edit_username_, bool can_view_gifts_and_stars_, bool can_sell_gifts_, bool can_change_gift_settings_, bool can_transfer_and_upgrade_gifts_, bool can_transfer_stars_, bool can_manage_stories_)
  : can_reply_(can_reply_)
  , can_read_messages_(can_read_messages_)
  , can_delete_sent_messages_(can_delete_sent_messages_)
  , can_delete_all_messages_(can_delete_all_messages_)
  , can_edit_name_(can_edit_name_)
  , can_edit_bio_(can_edit_bio_)
  , can_edit_profile_photo_(can_edit_profile_photo_)
  , can_edit_username_(can_edit_username_)
  , can_view_gifts_and_stars_(can_view_gifts_and_stars_)
  , can_sell_gifts_(can_sell_gifts_)
  , can_change_gift_settings_(can_change_gift_settings_)
  , can_transfer_and_upgrade_gifts_(can_transfer_and_upgrade_gifts_)
  , can_transfer_stars_(can_transfer_stars_)
  , can_manage_stories_(can_manage_stories_)
{}

const std::int32_t businessBotRights::ID;

object_ptr<businessBotRights> businessBotRights::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessBotRights> res = make_object<businessBotRights>();
  res->can_reply_ = (env->GetBooleanField(p, res->can_reply_fieldID) != 0);
  res->can_read_messages_ = (env->GetBooleanField(p, res->can_read_messages_fieldID) != 0);
  res->can_delete_sent_messages_ = (env->GetBooleanField(p, res->can_delete_sent_messages_fieldID) != 0);
  res->can_delete_all_messages_ = (env->GetBooleanField(p, res->can_delete_all_messages_fieldID) != 0);
  res->can_edit_name_ = (env->GetBooleanField(p, res->can_edit_name_fieldID) != 0);
  res->can_edit_bio_ = (env->GetBooleanField(p, res->can_edit_bio_fieldID) != 0);
  res->can_edit_profile_photo_ = (env->GetBooleanField(p, res->can_edit_profile_photo_fieldID) != 0);
  res->can_edit_username_ = (env->GetBooleanField(p, res->can_edit_username_fieldID) != 0);
  res->can_view_gifts_and_stars_ = (env->GetBooleanField(p, res->can_view_gifts_and_stars_fieldID) != 0);
  res->can_sell_gifts_ = (env->GetBooleanField(p, res->can_sell_gifts_fieldID) != 0);
  res->can_change_gift_settings_ = (env->GetBooleanField(p, res->can_change_gift_settings_fieldID) != 0);
  res->can_transfer_and_upgrade_gifts_ = (env->GetBooleanField(p, res->can_transfer_and_upgrade_gifts_fieldID) != 0);
  res->can_transfer_stars_ = (env->GetBooleanField(p, res->can_transfer_stars_fieldID) != 0);
  res->can_manage_stories_ = (env->GetBooleanField(p, res->can_manage_stories_fieldID) != 0);
  return res;
}

void businessBotRights::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_reply_fieldID, can_reply_);
  env->SetBooleanField(s, can_read_messages_fieldID, can_read_messages_);
  env->SetBooleanField(s, can_delete_sent_messages_fieldID, can_delete_sent_messages_);
  env->SetBooleanField(s, can_delete_all_messages_fieldID, can_delete_all_messages_);
  env->SetBooleanField(s, can_edit_name_fieldID, can_edit_name_);
  env->SetBooleanField(s, can_edit_bio_fieldID, can_edit_bio_);
  env->SetBooleanField(s, can_edit_profile_photo_fieldID, can_edit_profile_photo_);
  env->SetBooleanField(s, can_edit_username_fieldID, can_edit_username_);
  env->SetBooleanField(s, can_view_gifts_and_stars_fieldID, can_view_gifts_and_stars_);
  env->SetBooleanField(s, can_sell_gifts_fieldID, can_sell_gifts_);
  env->SetBooleanField(s, can_change_gift_settings_fieldID, can_change_gift_settings_);
  env->SetBooleanField(s, can_transfer_and_upgrade_gifts_fieldID, can_transfer_and_upgrade_gifts_);
  env->SetBooleanField(s, can_transfer_stars_fieldID, can_transfer_stars_);
  env->SetBooleanField(s, can_manage_stories_fieldID, can_manage_stories_);
}

void businessBotRights::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessBotRights");
    s.store_field("canReply", can_reply_);
    s.store_field("canReadMessages", can_read_messages_);
    s.store_field("canDeleteSentMessages", can_delete_sent_messages_);
    s.store_field("canDeleteAllMessages", can_delete_all_messages_);
    s.store_field("canEditName", can_edit_name_);
    s.store_field("canEditBio", can_edit_bio_);
    s.store_field("canEditProfilePhoto", can_edit_profile_photo_);
    s.store_field("canEditUsername", can_edit_username_);
    s.store_field("canViewGiftsAndStars", can_view_gifts_and_stars_);
    s.store_field("canSellGifts", can_sell_gifts_);
    s.store_field("canChangeGiftSettings", can_change_gift_settings_);
    s.store_field("canTransferAndUpgradeGifts", can_transfer_and_upgrade_gifts_);
    s.store_field("canTransferStars", can_transfer_stars_);
    s.store_field("canManageStories", can_manage_stories_);
    s.store_class_end();
  }
}

void businessBotRights::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessBotRights").c_str());
    can_reply_fieldID = jni::get_field_id(env, Class, "canReply", "Z");
    can_read_messages_fieldID = jni::get_field_id(env, Class, "canReadMessages", "Z");
    can_delete_sent_messages_fieldID = jni::get_field_id(env, Class, "canDeleteSentMessages", "Z");
    can_delete_all_messages_fieldID = jni::get_field_id(env, Class, "canDeleteAllMessages", "Z");
    can_edit_name_fieldID = jni::get_field_id(env, Class, "canEditName", "Z");
    can_edit_bio_fieldID = jni::get_field_id(env, Class, "canEditBio", "Z");
    can_edit_profile_photo_fieldID = jni::get_field_id(env, Class, "canEditProfilePhoto", "Z");
    can_edit_username_fieldID = jni::get_field_id(env, Class, "canEditUsername", "Z");
    can_view_gifts_and_stars_fieldID = jni::get_field_id(env, Class, "canViewGiftsAndStars", "Z");
    can_sell_gifts_fieldID = jni::get_field_id(env, Class, "canSellGifts", "Z");
    can_change_gift_settings_fieldID = jni::get_field_id(env, Class, "canChangeGiftSettings", "Z");
    can_transfer_and_upgrade_gifts_fieldID = jni::get_field_id(env, Class, "canTransferAndUpgradeGifts", "Z");
    can_transfer_stars_fieldID = jni::get_field_id(env, Class, "canTransferStars", "Z");
    can_manage_stories_fieldID = jni::get_field_id(env, Class, "canManageStories", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass businessMessages::Class;
jfieldID businessMessages::messages_fieldID;

businessMessages::businessMessages()
  : messages_()
{}

businessMessages::businessMessages(array<object_ptr<businessMessage>> &&messages_)
  : messages_(std::move(messages_))
{}

const std::int32_t businessMessages::ID;

object_ptr<businessMessages> businessMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessMessages> res = make_object<businessMessages>();
  res->messages_ = jni::FetchVector<businessMessage>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->messages_fieldID));
  return res;
}

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

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

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

jclass CallProblem::Class;

object_ptr<CallProblem> CallProblem::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case callProblemEcho::ID:
      return callProblemEcho::fetch(env, p);
    case callProblemNoise::ID:
      return callProblemNoise::fetch(env, p);
    case callProblemInterruptions::ID:
      return callProblemInterruptions::fetch(env, p);
    case callProblemDistortedSpeech::ID:
      return callProblemDistortedSpeech::fetch(env, p);
    case callProblemSilentLocal::ID:
      return callProblemSilentLocal::fetch(env, p);
    case callProblemSilentRemote::ID:
      return callProblemSilentRemote::fetch(env, p);
    case callProblemDropped::ID:
      return callProblemDropped::fetch(env, p);
    case callProblemDistortedVideo::ID:
      return callProblemDistortedVideo::fetch(env, p);
    case callProblemPixelatedVideo::ID:
      return callProblemPixelatedVideo::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass callProblemEcho::Class;

callProblemEcho::callProblemEcho() {
}

const std::int32_t callProblemEcho::ID;

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

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

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

jclass callProblemNoise::Class;

callProblemNoise::callProblemNoise() {
}

const std::int32_t callProblemNoise::ID;

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

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

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

jclass callProblemInterruptions::Class;

callProblemInterruptions::callProblemInterruptions() {
}

const std::int32_t callProblemInterruptions::ID;

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

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

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

jclass callProblemDistortedSpeech::Class;

callProblemDistortedSpeech::callProblemDistortedSpeech() {
}

const std::int32_t callProblemDistortedSpeech::ID;

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

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

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

jclass callProblemSilentLocal::Class;

callProblemSilentLocal::callProblemSilentLocal() {
}

const std::int32_t callProblemSilentLocal::ID;

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

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

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

jclass callProblemSilentRemote::Class;

callProblemSilentRemote::callProblemSilentRemote() {
}

const std::int32_t callProblemSilentRemote::ID;

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

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

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

jclass callProblemDropped::Class;

callProblemDropped::callProblemDropped() {
}

const std::int32_t callProblemDropped::ID;

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

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

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

jclass callProblemDistortedVideo::Class;

callProblemDistortedVideo::callProblemDistortedVideo() {
}

const std::int32_t callProblemDistortedVideo::ID;

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

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

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

jclass callProblemPixelatedVideo::Class;

callProblemPixelatedVideo::callProblemPixelatedVideo() {
}

const std::int32_t callProblemPixelatedVideo::ID;

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

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

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

jclass callbackQueryAnswer::Class;
jfieldID callbackQueryAnswer::text_fieldID;
jfieldID callbackQueryAnswer::show_alert_fieldID;
jfieldID callbackQueryAnswer::url_fieldID;

callbackQueryAnswer::callbackQueryAnswer()
  : text_()
  , show_alert_()
  , url_()
{}

callbackQueryAnswer::callbackQueryAnswer(string const &text_, bool show_alert_, string const &url_)
  : text_(text_)
  , show_alert_(show_alert_)
  , url_(url_)
{}

const std::int32_t callbackQueryAnswer::ID;

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

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

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

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

jclass chat::Class;
jfieldID chat::id_fieldID;
jfieldID chat::type_fieldID;
jfieldID chat::title_fieldID;
jfieldID chat::photo_fieldID;
jfieldID chat::accent_color_id_fieldID;
jfieldID chat::background_custom_emoji_id_fieldID;
jfieldID chat::upgraded_gift_colors_fieldID;
jfieldID chat::profile_accent_color_id_fieldID;
jfieldID chat::profile_background_custom_emoji_id_fieldID;
jfieldID chat::permissions_fieldID;
jfieldID chat::last_message_fieldID;
jfieldID chat::positions_fieldID;
jfieldID chat::chat_lists_fieldID;
jfieldID chat::message_sender_id_fieldID;
jfieldID chat::block_list_fieldID;
jfieldID chat::has_protected_content_fieldID;
jfieldID chat::is_translatable_fieldID;
jfieldID chat::is_marked_as_unread_fieldID;
jfieldID chat::view_as_topics_fieldID;
jfieldID chat::has_scheduled_messages_fieldID;
jfieldID chat::can_be_deleted_only_for_self_fieldID;
jfieldID chat::can_be_deleted_for_all_users_fieldID;
jfieldID chat::can_be_reported_fieldID;
jfieldID chat::default_disable_notification_fieldID;
jfieldID chat::unread_count_fieldID;
jfieldID chat::last_read_inbox_message_id_fieldID;
jfieldID chat::last_read_outbox_message_id_fieldID;
jfieldID chat::unread_mention_count_fieldID;
jfieldID chat::unread_reaction_count_fieldID;
jfieldID chat::unread_poll_vote_count_fieldID;
jfieldID chat::notification_settings_fieldID;
jfieldID chat::available_reactions_fieldID;
jfieldID chat::message_auto_delete_time_fieldID;
jfieldID chat::emoji_status_fieldID;
jfieldID chat::background_fieldID;
jfieldID chat::theme_fieldID;
jfieldID chat::action_bar_fieldID;
jfieldID chat::business_bot_manage_bar_fieldID;
jfieldID chat::video_chat_fieldID;
jfieldID chat::pending_join_requests_fieldID;
jfieldID chat::reply_markup_message_id_fieldID;
jfieldID chat::draft_message_fieldID;
jfieldID chat::client_data_fieldID;

chat::chat()
  : id_()
  , type_()
  , title_()
  , photo_()
  , accent_color_id_()
  , background_custom_emoji_id_()
  , upgraded_gift_colors_()
  , profile_accent_color_id_()
  , profile_background_custom_emoji_id_()
  , permissions_()
  , last_message_()
  , positions_()
  , chat_lists_()
  , message_sender_id_()
  , block_list_()
  , has_protected_content_()
  , is_translatable_()
  , is_marked_as_unread_()
  , view_as_topics_()
  , has_scheduled_messages_()
  , can_be_deleted_only_for_self_()
  , can_be_deleted_for_all_users_()
  , can_be_reported_()
  , default_disable_notification_()
  , unread_count_()
  , last_read_inbox_message_id_()
  , last_read_outbox_message_id_()
  , unread_mention_count_()
  , unread_reaction_count_()
  , unread_poll_vote_count_()
  , notification_settings_()
  , available_reactions_()
  , message_auto_delete_time_()
  , emoji_status_()
  , background_()
  , theme_()
  , action_bar_()
  , business_bot_manage_bar_()
  , video_chat_()
  , pending_join_requests_()
  , reply_markup_message_id_()
  , draft_message_()
  , client_data_()
{}

chat::chat(int53 id_, object_ptr<ChatType> &&type_, string const &title_, object_ptr<chatPhotoInfo> &&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<chatPermissions> &&permissions_, object_ptr<message> &&last_message_, array<object_ptr<chatPosition>> &&positions_, array<object_ptr<ChatList>> &&chat_lists_, object_ptr<MessageSender> &&message_sender_id_, object_ptr<BlockList> &&block_list_, bool has_protected_content_, bool is_translatable_, bool is_marked_as_unread_, bool view_as_topics_, bool has_scheduled_messages_, bool can_be_deleted_only_for_self_, bool can_be_deleted_for_all_users_, bool can_be_reported_, bool default_disable_notification_, int32 unread_count_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int32 unread_mention_count_, int32 unread_reaction_count_, int32 unread_poll_vote_count_, object_ptr<chatNotificationSettings> &&notification_settings_, object_ptr<ChatAvailableReactions> &&available_reactions_, int32 message_auto_delete_time_, object_ptr<emojiStatus> &&emoji_status_, object_ptr<chatBackground> &&background_, object_ptr<ChatTheme> &&theme_, object_ptr<ChatActionBar> &&action_bar_, object_ptr<businessBotManageBar> &&business_bot_manage_bar_, object_ptr<videoChat> &&video_chat_, object_ptr<chatJoinRequestsInfo> &&pending_join_requests_, int53 reply_markup_message_id_, object_ptr<draftMessage> &&draft_message_, string const &client_data_)
  : id_(id_)
  , type_(std::move(type_))
  , title_(title_)
  , photo_(std::move(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_)
  , permissions_(std::move(permissions_))
  , last_message_(std::move(last_message_))
  , positions_(std::move(positions_))
  , chat_lists_(std::move(chat_lists_))
  , message_sender_id_(std::move(message_sender_id_))
  , block_list_(std::move(block_list_))
  , has_protected_content_(has_protected_content_)
  , is_translatable_(is_translatable_)
  , is_marked_as_unread_(is_marked_as_unread_)
  , view_as_topics_(view_as_topics_)
  , has_scheduled_messages_(has_scheduled_messages_)
  , can_be_deleted_only_for_self_(can_be_deleted_only_for_self_)
  , can_be_deleted_for_all_users_(can_be_deleted_for_all_users_)
  , can_be_reported_(can_be_reported_)
  , default_disable_notification_(default_disable_notification_)
  , unread_count_(unread_count_)
  , last_read_inbox_message_id_(last_read_inbox_message_id_)
  , last_read_outbox_message_id_(last_read_outbox_message_id_)
  , unread_mention_count_(unread_mention_count_)
  , unread_reaction_count_(unread_reaction_count_)
  , unread_poll_vote_count_(unread_poll_vote_count_)
  , notification_settings_(std::move(notification_settings_))
  , available_reactions_(std::move(available_reactions_))
  , message_auto_delete_time_(message_auto_delete_time_)
  , emoji_status_(std::move(emoji_status_))
  , background_(std::move(background_))
  , theme_(std::move(theme_))
  , action_bar_(std::move(action_bar_))
  , business_bot_manage_bar_(std::move(business_bot_manage_bar_))
  , video_chat_(std::move(video_chat_))
  , pending_join_requests_(std::move(pending_join_requests_))
  , reply_markup_message_id_(reply_markup_message_id_)
  , draft_message_(std::move(draft_message_))
  , client_data_(client_data_)
{}

const std::int32_t chat::ID;

object_ptr<chat> chat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chat> res = make_object<chat>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->type_ = jni::fetch_tl_object<ChatType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->photo_ = jni::fetch_tl_object<chatPhotoInfo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->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->permissions_ = jni::fetch_tl_object<chatPermissions>(env, jni::fetch_object(env, p, res->permissions_fieldID));
  res->last_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->last_message_fieldID));
  res->positions_ = jni::FetchVector<chatPosition>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->positions_fieldID));
  res->chat_lists_ = jni::FetchVector<ChatList>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->chat_lists_fieldID));
  res->message_sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->message_sender_id_fieldID));
  res->block_list_ = jni::fetch_tl_object<BlockList>(env, jni::fetch_object(env, p, res->block_list_fieldID));
  res->has_protected_content_ = (env->GetBooleanField(p, res->has_protected_content_fieldID) != 0);
  res->is_translatable_ = (env->GetBooleanField(p, res->is_translatable_fieldID) != 0);
  res->is_marked_as_unread_ = (env->GetBooleanField(p, res->is_marked_as_unread_fieldID) != 0);
  res->view_as_topics_ = (env->GetBooleanField(p, res->view_as_topics_fieldID) != 0);
  res->has_scheduled_messages_ = (env->GetBooleanField(p, res->has_scheduled_messages_fieldID) != 0);
  res->can_be_deleted_only_for_self_ = (env->GetBooleanField(p, res->can_be_deleted_only_for_self_fieldID) != 0);
  res->can_be_deleted_for_all_users_ = (env->GetBooleanField(p, res->can_be_deleted_for_all_users_fieldID) != 0);
  res->can_be_reported_ = (env->GetBooleanField(p, res->can_be_reported_fieldID) != 0);
  res->default_disable_notification_ = (env->GetBooleanField(p, res->default_disable_notification_fieldID) != 0);
  res->unread_count_ = env->GetIntField(p, res->unread_count_fieldID);
  res->last_read_inbox_message_id_ = env->GetLongField(p, res->last_read_inbox_message_id_fieldID);
  res->last_read_outbox_message_id_ = env->GetLongField(p, res->last_read_outbox_message_id_fieldID);
  res->unread_mention_count_ = env->GetIntField(p, res->unread_mention_count_fieldID);
  res->unread_reaction_count_ = env->GetIntField(p, res->unread_reaction_count_fieldID);
  res->unread_poll_vote_count_ = env->GetIntField(p, res->unread_poll_vote_count_fieldID);
  res->notification_settings_ = jni::fetch_tl_object<chatNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  res->available_reactions_ = jni::fetch_tl_object<ChatAvailableReactions>(env, jni::fetch_object(env, p, res->available_reactions_fieldID));
  res->message_auto_delete_time_ = env->GetIntField(p, res->message_auto_delete_time_fieldID);
  res->emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->emoji_status_fieldID));
  res->background_ = jni::fetch_tl_object<chatBackground>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->theme_ = jni::fetch_tl_object<ChatTheme>(env, jni::fetch_object(env, p, res->theme_fieldID));
  res->action_bar_ = jni::fetch_tl_object<ChatActionBar>(env, jni::fetch_object(env, p, res->action_bar_fieldID));
  res->business_bot_manage_bar_ = jni::fetch_tl_object<businessBotManageBar>(env, jni::fetch_object(env, p, res->business_bot_manage_bar_fieldID));
  res->video_chat_ = jni::fetch_tl_object<videoChat>(env, jni::fetch_object(env, p, res->video_chat_fieldID));
  res->pending_join_requests_ = jni::fetch_tl_object<chatJoinRequestsInfo>(env, jni::fetch_object(env, p, res->pending_join_requests_fieldID));
  res->reply_markup_message_id_ = env->GetLongField(p, res->reply_markup_message_id_fieldID);
  res->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  res->client_data_ = jni::fetch_string(env, p, res->client_data_fieldID);
  return res;
}

void chat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, accent_color_id_fieldID, accent_color_id_);
  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 (permissions_ != nullptr) { jobject next; permissions_->store(env, next); if (next) { env->SetObjectField(s, permissions_fieldID, next); env->DeleteLocalRef(next); } }
  if (last_message_ != nullptr) { jobject next; last_message_->store(env, next); if (next) { env->SetObjectField(s, last_message_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, positions_); if (arr_tmp_) { env->SetObjectField(s, positions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, chat_lists_); if (arr_tmp_) { env->SetObjectField(s, chat_lists_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (message_sender_id_ != nullptr) { jobject next; message_sender_id_->store(env, next); if (next) { env->SetObjectField(s, message_sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (block_list_ != nullptr) { jobject next; block_list_->store(env, next); if (next) { env->SetObjectField(s, block_list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, has_protected_content_fieldID, has_protected_content_);
  env->SetBooleanField(s, is_translatable_fieldID, is_translatable_);
  env->SetBooleanField(s, is_marked_as_unread_fieldID, is_marked_as_unread_);
  env->SetBooleanField(s, view_as_topics_fieldID, view_as_topics_);
  env->SetBooleanField(s, has_scheduled_messages_fieldID, has_scheduled_messages_);
  env->SetBooleanField(s, can_be_deleted_only_for_self_fieldID, can_be_deleted_only_for_self_);
  env->SetBooleanField(s, can_be_deleted_for_all_users_fieldID, can_be_deleted_for_all_users_);
  env->SetBooleanField(s, can_be_reported_fieldID, can_be_reported_);
  env->SetBooleanField(s, default_disable_notification_fieldID, default_disable_notification_);
  env->SetIntField(s, unread_count_fieldID, unread_count_);
  env->SetLongField(s, last_read_inbox_message_id_fieldID, last_read_inbox_message_id_);
  env->SetLongField(s, last_read_outbox_message_id_fieldID, last_read_outbox_message_id_);
  env->SetIntField(s, unread_mention_count_fieldID, unread_mention_count_);
  env->SetIntField(s, unread_reaction_count_fieldID, unread_reaction_count_);
  env->SetIntField(s, unread_poll_vote_count_fieldID, unread_poll_vote_count_);
  if (notification_settings_ != nullptr) { jobject next; notification_settings_->store(env, next); if (next) { env->SetObjectField(s, notification_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (available_reactions_ != nullptr) { jobject next; available_reactions_->store(env, next); if (next) { env->SetObjectField(s, available_reactions_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, message_auto_delete_time_fieldID, message_auto_delete_time_);
  if (emoji_status_ != nullptr) { jobject next; emoji_status_->store(env, next); if (next) { env->SetObjectField(s, emoji_status_fieldID, next); env->DeleteLocalRef(next); } }
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
  if (theme_ != nullptr) { jobject next; theme_->store(env, next); if (next) { env->SetObjectField(s, theme_fieldID, next); env->DeleteLocalRef(next); } }
  if (action_bar_ != nullptr) { jobject next; action_bar_->store(env, next); if (next) { env->SetObjectField(s, action_bar_fieldID, next); env->DeleteLocalRef(next); } }
  if (business_bot_manage_bar_ != nullptr) { jobject next; business_bot_manage_bar_->store(env, next); if (next) { env->SetObjectField(s, business_bot_manage_bar_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_chat_ != nullptr) { jobject next; video_chat_->store(env, next); if (next) { env->SetObjectField(s, video_chat_fieldID, next); env->DeleteLocalRef(next); } }
  if (pending_join_requests_ != nullptr) { jobject next; pending_join_requests_->store(env, next); if (next) { env->SetObjectField(s, pending_join_requests_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, reply_markup_message_id_fieldID, reply_markup_message_id_);
  if (draft_message_ != nullptr) { jobject next; draft_message_->store(env, next); if (next) { env->SetObjectField(s, draft_message_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, client_data_); if (nextString) { env->SetObjectField(s, client_data_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void chat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Chat");
    s.store_field("id", id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("title", title_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("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("permissions", static_cast<const BaseObject *>(permissions_.get()));
    s.store_object_field("lastMessage", static_cast<const BaseObject *>(last_message_.get()));
    { s.store_vector_begin("positions", positions_.size()); for (const auto &_value : positions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("chatLists", chat_lists_.size()); for (const auto &_value : chat_lists_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("messageSenderId", static_cast<const BaseObject *>(message_sender_id_.get()));
    s.store_object_field("blockList", static_cast<const BaseObject *>(block_list_.get()));
    s.store_field("hasProtectedContent", has_protected_content_);
    s.store_field("isTranslatable", is_translatable_);
    s.store_field("isMarkedAsUnread", is_marked_as_unread_);
    s.store_field("viewAsTopics", view_as_topics_);
    s.store_field("hasScheduledMessages", has_scheduled_messages_);
    s.store_field("canBeDeletedOnlyForSelf", can_be_deleted_only_for_self_);
    s.store_field("canBeDeletedForAllUsers", can_be_deleted_for_all_users_);
    s.store_field("canBeReported", can_be_reported_);
    s.store_field("defaultDisableNotification", default_disable_notification_);
    s.store_field("unreadCount", unread_count_);
    s.store_field("lastReadInboxMessageId", last_read_inbox_message_id_);
    s.store_field("lastReadOutboxMessageId", last_read_outbox_message_id_);
    s.store_field("unreadMentionCount", unread_mention_count_);
    s.store_field("unreadReactionCount", unread_reaction_count_);
    s.store_field("unreadPollVoteCount", unread_poll_vote_count_);
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_object_field("availableReactions", static_cast<const BaseObject *>(available_reactions_.get()));
    s.store_field("messageAutoDeleteTime", message_auto_delete_time_);
    s.store_object_field("emojiStatus", static_cast<const BaseObject *>(emoji_status_.get()));
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_object_field("theme", static_cast<const BaseObject *>(theme_.get()));
    s.store_object_field("actionBar", static_cast<const BaseObject *>(action_bar_.get()));
    s.store_object_field("businessBotManageBar", static_cast<const BaseObject *>(business_bot_manage_bar_.get()));
    s.store_object_field("videoChat", static_cast<const BaseObject *>(video_chat_.get()));
    s.store_object_field("pendingJoinRequests", static_cast<const BaseObject *>(pending_join_requests_.get()));
    s.store_field("replyMarkupMessageId", reply_markup_message_id_);
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_field("clientData", client_data_);
    s.store_class_end();
  }
}

void chat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Chat").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatType;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhotoInfo;").c_str());
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    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");
    permissions_fieldID = jni::get_field_id(env, Class, "permissions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPermissions;").c_str());
    last_message_fieldID = jni::get_field_id(env, Class, "lastMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    positions_fieldID = jni::get_field_id(env, Class, "positions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatPosition;").c_str());
    chat_lists_fieldID = jni::get_field_id(env, Class, "chatLists", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    message_sender_id_fieldID = jni::get_field_id(env, Class, "messageSenderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    block_list_fieldID = jni::get_field_id(env, Class, "blockList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BlockList;").c_str());
    has_protected_content_fieldID = jni::get_field_id(env, Class, "hasProtectedContent", "Z");
    is_translatable_fieldID = jni::get_field_id(env, Class, "isTranslatable", "Z");
    is_marked_as_unread_fieldID = jni::get_field_id(env, Class, "isMarkedAsUnread", "Z");
    view_as_topics_fieldID = jni::get_field_id(env, Class, "viewAsTopics", "Z");
    has_scheduled_messages_fieldID = jni::get_field_id(env, Class, "hasScheduledMessages", "Z");
    can_be_deleted_only_for_self_fieldID = jni::get_field_id(env, Class, "canBeDeletedOnlyForSelf", "Z");
    can_be_deleted_for_all_users_fieldID = jni::get_field_id(env, Class, "canBeDeletedForAllUsers", "Z");
    can_be_reported_fieldID = jni::get_field_id(env, Class, "canBeReported", "Z");
    default_disable_notification_fieldID = jni::get_field_id(env, Class, "defaultDisableNotification", "Z");
    unread_count_fieldID = jni::get_field_id(env, Class, "unreadCount", "I");
    last_read_inbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadInboxMessageId", "J");
    last_read_outbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadOutboxMessageId", "J");
    unread_mention_count_fieldID = jni::get_field_id(env, Class, "unreadMentionCount", "I");
    unread_reaction_count_fieldID = jni::get_field_id(env, Class, "unreadReactionCount", "I");
    unread_poll_vote_count_fieldID = jni::get_field_id(env, Class, "unreadPollVoteCount", "I");
    notification_settings_fieldID = jni::get_field_id(env, Class, "notificationSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatNotificationSettings;").c_str());
    available_reactions_fieldID = jni::get_field_id(env, Class, "availableReactions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAvailableReactions;").c_str());
    message_auto_delete_time_fieldID = jni::get_field_id(env, Class, "messageAutoDeleteTime", "I");
    emoji_status_fieldID = jni::get_field_id(env, Class, "emojiStatus", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatus;").c_str());
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBackground;").c_str());
    theme_fieldID = jni::get_field_id(env, Class, "theme", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatTheme;").c_str());
    action_bar_fieldID = jni::get_field_id(env, Class, "actionBar", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatActionBar;").c_str());
    business_bot_manage_bar_fieldID = jni::get_field_id(env, Class, "businessBotManageBar", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessBotManageBar;").c_str());
    video_chat_fieldID = jni::get_field_id(env, Class, "videoChat", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$VideoChat;").c_str());
    pending_join_requests_fieldID = jni::get_field_id(env, Class, "pendingJoinRequests", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatJoinRequestsInfo;").c_str());
    reply_markup_message_id_fieldID = jni::get_field_id(env, Class, "replyMarkupMessageId", "J");
    draft_message_fieldID = jni::get_field_id(env, Class, "draftMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DraftMessage;").c_str());
    client_data_fieldID = jni::get_field_id(env, Class, "clientData", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass chatAdministrators::Class;
jfieldID chatAdministrators::administrators_fieldID;

chatAdministrators::chatAdministrators()
  : administrators_()
{}

chatAdministrators::chatAdministrators(array<object_ptr<chatAdministrator>> &&administrators_)
  : administrators_(std::move(administrators_))
{}

const std::int32_t chatAdministrators::ID;

object_ptr<chatAdministrators> chatAdministrators::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatAdministrators> res = make_object<chatAdministrators>();
  res->administrators_ = jni::FetchVector<chatAdministrator>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->administrators_fieldID));
  return res;
}

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

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

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

jclass chatBoostLinkInfo::Class;
jfieldID chatBoostLinkInfo::is_public_fieldID;
jfieldID chatBoostLinkInfo::chat_id_fieldID;

chatBoostLinkInfo::chatBoostLinkInfo()
  : is_public_()
  , chat_id_()
{}

chatBoostLinkInfo::chatBoostLinkInfo(bool is_public_, int53 chat_id_)
  : is_public_(is_public_)
  , chat_id_(chat_id_)
{}

const std::int32_t chatBoostLinkInfo::ID;

object_ptr<chatBoostLinkInfo> chatBoostLinkInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostLinkInfo> res = make_object<chatBoostLinkInfo>();
  res->is_public_ = (env->GetBooleanField(p, res->is_public_fieldID) != 0);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

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

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

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

jclass ChatBoostSource::Class;

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

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

jclass chatBoostSourceGiftCode::Class;
jfieldID chatBoostSourceGiftCode::user_id_fieldID;
jfieldID chatBoostSourceGiftCode::gift_code_fieldID;

chatBoostSourceGiftCode::chatBoostSourceGiftCode()
  : user_id_()
  , gift_code_()
{}

chatBoostSourceGiftCode::chatBoostSourceGiftCode(int53 user_id_, string const &gift_code_)
  : user_id_(user_id_)
  , gift_code_(gift_code_)
{}

const std::int32_t chatBoostSourceGiftCode::ID;

object_ptr<ChatBoostSource> chatBoostSourceGiftCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostSourceGiftCode> res = make_object<chatBoostSourceGiftCode>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_code_ = jni::fetch_string(env, p, res->gift_code_fieldID);
  return std::move(res);
}

void chatBoostSourceGiftCode::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  { jstring nextString = jni::to_jstring(env, gift_code_); if (nextString) { env->SetObjectField(s, gift_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass chatBoostSourceGiveaway::Class;
jfieldID chatBoostSourceGiveaway::user_id_fieldID;
jfieldID chatBoostSourceGiveaway::gift_code_fieldID;
jfieldID chatBoostSourceGiveaway::star_count_fieldID;
jfieldID chatBoostSourceGiveaway::giveaway_message_id_fieldID;
jfieldID chatBoostSourceGiveaway::is_unclaimed_fieldID;

chatBoostSourceGiveaway::chatBoostSourceGiveaway()
  : user_id_()
  , gift_code_()
  , star_count_()
  , giveaway_message_id_()
  , is_unclaimed_()
{}

chatBoostSourceGiveaway::chatBoostSourceGiveaway(int53 user_id_, string const &gift_code_, int53 star_count_, int53 giveaway_message_id_, bool is_unclaimed_)
  : user_id_(user_id_)
  , gift_code_(gift_code_)
  , star_count_(star_count_)
  , giveaway_message_id_(giveaway_message_id_)
  , is_unclaimed_(is_unclaimed_)
{}

const std::int32_t chatBoostSourceGiveaway::ID;

object_ptr<ChatBoostSource> chatBoostSourceGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostSourceGiveaway> res = make_object<chatBoostSourceGiveaway>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_code_ = jni::fetch_string(env, p, res->gift_code_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->giveaway_message_id_ = env->GetLongField(p, res->giveaway_message_id_fieldID);
  res->is_unclaimed_ = (env->GetBooleanField(p, res->is_unclaimed_fieldID) != 0);
  return std::move(res);
}

void chatBoostSourceGiveaway::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  { jstring nextString = jni::to_jstring(env, gift_code_); if (nextString) { env->SetObjectField(s, gift_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, star_count_fieldID, star_count_);
  env->SetLongField(s, giveaway_message_id_fieldID, giveaway_message_id_);
  env->SetBooleanField(s, is_unclaimed_fieldID, is_unclaimed_);
}

void chatBoostSourceGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBoostSourceGiveaway");
    s.store_field("userId", user_id_);
    s.store_field("giftCode", gift_code_);
    s.store_field("starCount", star_count_);
    s.store_field("giveawayMessageId", giveaway_message_id_);
    s.store_field("isUnclaimed", is_unclaimed_);
    s.store_class_end();
  }
}

void chatBoostSourceGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBoostSourceGiveaway").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    gift_code_fieldID = jni::get_field_id(env, Class, "giftCode", "Ljava/lang/String;");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    giveaway_message_id_fieldID = jni::get_field_id(env, Class, "giveawayMessageId", "J");
    is_unclaimed_fieldID = jni::get_field_id(env, Class, "isUnclaimed", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatBoostSourcePremium::Class;
jfieldID chatBoostSourcePremium::user_id_fieldID;

chatBoostSourcePremium::chatBoostSourcePremium()
  : user_id_()
{}

chatBoostSourcePremium::chatBoostSourcePremium(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t chatBoostSourcePremium::ID;

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

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

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

jclass chatEvents::Class;
jfieldID chatEvents::events_fieldID;

chatEvents::chatEvents()
  : events_()
{}

chatEvents::chatEvents(array<object_ptr<chatEvent>> &&events_)
  : events_(std::move(events_))
{}

const std::int32_t chatEvents::ID;

object_ptr<chatEvents> chatEvents::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatEvents> res = make_object<chatEvents>();
  res->events_ = jni::FetchVector<chatEvent>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->events_fieldID));
  return res;
}

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

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

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

jclass chatFolderName::Class;
jfieldID chatFolderName::text_fieldID;
jfieldID chatFolderName::animate_custom_emoji_fieldID;

chatFolderName::chatFolderName()
  : text_()
  , animate_custom_emoji_()
{}

chatFolderName::chatFolderName(object_ptr<formattedText> &&text_, bool animate_custom_emoji_)
  : text_(std::move(text_))
  , animate_custom_emoji_(animate_custom_emoji_)
{}

const std::int32_t chatFolderName::ID;

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

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

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

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

jclass chatJoinRequests::Class;
jfieldID chatJoinRequests::total_count_fieldID;
jfieldID chatJoinRequests::requests_fieldID;

chatJoinRequests::chatJoinRequests()
  : total_count_()
  , requests_()
{}

chatJoinRequests::chatJoinRequests(int32 total_count_, array<object_ptr<chatJoinRequest>> &&requests_)
  : total_count_(total_count_)
  , requests_(std::move(requests_))
{}

const std::int32_t chatJoinRequests::ID;

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

void chatJoinRequests::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, requests_); if (arr_tmp_) { env->SetObjectField(s, requests_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

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

jclass chatMessageSender::Class;
jfieldID chatMessageSender::sender_fieldID;
jfieldID chatMessageSender::needs_premium_fieldID;

chatMessageSender::chatMessageSender()
  : sender_()
  , needs_premium_()
{}

chatMessageSender::chatMessageSender(object_ptr<MessageSender> &&sender_, bool needs_premium_)
  : sender_(std::move(sender_))
  , needs_premium_(needs_premium_)
{}

const std::int32_t chatMessageSender::ID;

object_ptr<chatMessageSender> chatMessageSender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatMessageSender> res = make_object<chatMessageSender>();
  res->sender_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_fieldID));
  res->needs_premium_ = (env->GetBooleanField(p, res->needs_premium_fieldID) != 0);
  return res;
}

void chatMessageSender::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (sender_ != nullptr) { jobject next; sender_->store(env, next); if (next) { env->SetObjectField(s, sender_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, needs_premium_fieldID, needs_premium_);
}

void chatMessageSender::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatMessageSender");
    s.store_object_field("sender", static_cast<const BaseObject *>(sender_.get()));
    s.store_field("needsPremium", needs_premium_);
    s.store_class_end();
  }
}

void chatMessageSender::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatMessageSender").c_str());
    sender_fieldID = jni::get_field_id(env, Class, "sender", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    needs_premium_fieldID = jni::get_field_id(env, Class, "needsPremium", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatMessageSenders::Class;
jfieldID chatMessageSenders::senders_fieldID;

chatMessageSenders::chatMessageSenders()
  : senders_()
{}

chatMessageSenders::chatMessageSenders(array<object_ptr<chatMessageSender>> &&senders_)
  : senders_(std::move(senders_))
{}

const std::int32_t chatMessageSenders::ID;

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

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

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

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

jclass chatRevenueTransaction::Class;
jfieldID chatRevenueTransaction::cryptocurrency_fieldID;
jfieldID chatRevenueTransaction::cryptocurrency_amount_fieldID;
jfieldID chatRevenueTransaction::type_fieldID;

chatRevenueTransaction::chatRevenueTransaction()
  : cryptocurrency_()
  , cryptocurrency_amount_()
  , type_()
{}

chatRevenueTransaction::chatRevenueTransaction(string const &cryptocurrency_, int64 cryptocurrency_amount_, object_ptr<ChatRevenueTransactionType> &&type_)
  : cryptocurrency_(cryptocurrency_)
  , cryptocurrency_amount_(cryptocurrency_amount_)
  , type_(std::move(type_))
{}

const std::int32_t chatRevenueTransaction::ID;

object_ptr<chatRevenueTransaction> chatRevenueTransaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueTransaction> res = make_object<chatRevenueTransaction>();
  res->cryptocurrency_ = jni::fetch_string(env, p, res->cryptocurrency_fieldID);
  res->cryptocurrency_amount_ = env->GetLongField(p, res->cryptocurrency_amount_fieldID);
  res->type_ = jni::fetch_tl_object<ChatRevenueTransactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

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

void chatRevenueTransaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueTransaction");
    s.store_field("cryptocurrency", cryptocurrency_);
    s.store_field("cryptocurrencyAmount", cryptocurrency_amount_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void chatRevenueTransaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueTransaction").c_str());
    cryptocurrency_fieldID = jni::get_field_id(env, Class, "cryptocurrency", "Ljava/lang/String;");
    cryptocurrency_amount_fieldID = jni::get_field_id(env, Class, "cryptocurrencyAmount", "J");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatRevenueTransactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass ChatTheme::Class;

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

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

jclass chatThemeEmoji::Class;
jfieldID chatThemeEmoji::name_fieldID;

chatThemeEmoji::chatThemeEmoji()
  : name_()
{}

chatThemeEmoji::chatThemeEmoji(string const &name_)
  : name_(name_)
{}

const std::int32_t chatThemeEmoji::ID;

object_ptr<ChatTheme> chatThemeEmoji::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatThemeEmoji> res = make_object<chatThemeEmoji>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return std::move(res);
}

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

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

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

jclass chatThemeGift::Class;
jfieldID chatThemeGift::gift_theme_fieldID;

chatThemeGift::chatThemeGift()
  : gift_theme_()
{}

chatThemeGift::chatThemeGift(object_ptr<giftChatTheme> &&gift_theme_)
  : gift_theme_(std::move(gift_theme_))
{}

const std::int32_t chatThemeGift::ID;

object_ptr<ChatTheme> chatThemeGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatThemeGift> res = make_object<chatThemeGift>();
  res->gift_theme_ = jni::fetch_tl_object<giftChatTheme>(env, jni::fetch_object(env, p, res->gift_theme_fieldID));
  return std::move(res);
}

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

void chatThemeGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatThemeGift");
    s.store_object_field("giftTheme", static_cast<const BaseObject *>(gift_theme_.get()));
    s.store_class_end();
  }
}

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

jclass checklist::Class;
jfieldID checklist::title_fieldID;
jfieldID checklist::tasks_fieldID;
jfieldID checklist::others_can_add_tasks_fieldID;
jfieldID checklist::can_add_tasks_fieldID;
jfieldID checklist::others_can_mark_tasks_as_done_fieldID;
jfieldID checklist::can_mark_tasks_as_done_fieldID;

checklist::checklist()
  : title_()
  , tasks_()
  , others_can_add_tasks_()
  , can_add_tasks_()
  , others_can_mark_tasks_as_done_()
  , can_mark_tasks_as_done_()
{}

checklist::checklist(object_ptr<formattedText> &&title_, array<object_ptr<checklistTask>> &&tasks_, bool others_can_add_tasks_, bool can_add_tasks_, bool others_can_mark_tasks_as_done_, bool can_mark_tasks_as_done_)
  : title_(std::move(title_))
  , tasks_(std::move(tasks_))
  , others_can_add_tasks_(others_can_add_tasks_)
  , can_add_tasks_(can_add_tasks_)
  , others_can_mark_tasks_as_done_(others_can_mark_tasks_as_done_)
  , can_mark_tasks_as_done_(can_mark_tasks_as_done_)
{}

const std::int32_t checklist::ID;

object_ptr<checklist> checklist::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checklist> res = make_object<checklist>();
  res->title_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->title_fieldID));
  res->tasks_ = jni::FetchVector<checklistTask>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->tasks_fieldID));
  res->others_can_add_tasks_ = (env->GetBooleanField(p, res->others_can_add_tasks_fieldID) != 0);
  res->can_add_tasks_ = (env->GetBooleanField(p, res->can_add_tasks_fieldID) != 0);
  res->others_can_mark_tasks_as_done_ = (env->GetBooleanField(p, res->others_can_mark_tasks_as_done_fieldID) != 0);
  res->can_mark_tasks_as_done_ = (env->GetBooleanField(p, res->can_mark_tasks_as_done_fieldID) != 0);
  return res;
}

void checklist::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (title_ != nullptr) { jobject next; title_->store(env, next); if (next) { env->SetObjectField(s, title_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, tasks_); if (arr_tmp_) { env->SetObjectField(s, tasks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, others_can_add_tasks_fieldID, others_can_add_tasks_);
  env->SetBooleanField(s, can_add_tasks_fieldID, can_add_tasks_);
  env->SetBooleanField(s, others_can_mark_tasks_as_done_fieldID, others_can_mark_tasks_as_done_);
  env->SetBooleanField(s, can_mark_tasks_as_done_fieldID, can_mark_tasks_as_done_);
}

void checklist::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Checklist");
    s.store_object_field("title", static_cast<const BaseObject *>(title_.get()));
    { 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_field("othersCanAddTasks", others_can_add_tasks_);
    s.store_field("canAddTasks", can_add_tasks_);
    s.store_field("othersCanMarkTasksAsDone", others_can_mark_tasks_as_done_);
    s.store_field("canMarkTasksAsDone", can_mark_tasks_as_done_);
    s.store_class_end();
  }
}

void checklist::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Checklist").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    tasks_fieldID = jni::get_field_id(env, Class, "tasks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChecklistTask;").c_str());
    others_can_add_tasks_fieldID = jni::get_field_id(env, Class, "othersCanAddTasks", "Z");
    can_add_tasks_fieldID = jni::get_field_id(env, Class, "canAddTasks", "Z");
    others_can_mark_tasks_as_done_fieldID = jni::get_field_id(env, Class, "othersCanMarkTasksAsDone", "Z");
    can_mark_tasks_as_done_fieldID = jni::get_field_id(env, Class, "canMarkTasksAsDone", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass closeBirthdayUser::Class;
jfieldID closeBirthdayUser::user_id_fieldID;
jfieldID closeBirthdayUser::birthdate_fieldID;

closeBirthdayUser::closeBirthdayUser()
  : user_id_()
  , birthdate_()
{}

closeBirthdayUser::closeBirthdayUser(int53 user_id_, object_ptr<birthdate> &&birthdate_)
  : user_id_(user_id_)
  , birthdate_(std::move(birthdate_))
{}

const std::int32_t closeBirthdayUser::ID;

object_ptr<closeBirthdayUser> closeBirthdayUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<closeBirthdayUser> res = make_object<closeBirthdayUser>();
  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 closeBirthdayUser::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 (birthdate_ != nullptr) { jobject next; birthdate_->store(env, next); if (next) { env->SetObjectField(s, birthdate_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

closedVectorPath::closedVectorPath()
  : commands_()
{}

closedVectorPath::closedVectorPath(array<object_ptr<VectorPathCommand>> &&commands_)
  : commands_(std::move(commands_))
{}

const std::int32_t closedVectorPath::ID;

object_ptr<closedVectorPath> closedVectorPath::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<closedVectorPath> res = make_object<closedVectorPath>();
  res->commands_ = jni::FetchVector<VectorPathCommand>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->commands_fieldID));
  return res;
}

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

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

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

jclass databaseStatistics::Class;
jfieldID databaseStatistics::statistics_fieldID;

databaseStatistics::databaseStatistics()
  : statistics_()
{}

databaseStatistics::databaseStatistics(string const &statistics_)
  : statistics_(statistics_)
{}

const std::int32_t databaseStatistics::ID;

object_ptr<databaseStatistics> databaseStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<databaseStatistics> res = make_object<databaseStatistics>();
  res->statistics_ = jni::fetch_string(env, p, res->statistics_fieldID);
  return res;
}

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

void databaseStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DatabaseStatistics");
    s.store_field("statistics", statistics_);
    s.store_class_end();
  }
}

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

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

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

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

const std::int32_t date::ID;

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

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

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

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

jclass DateTimePartPrecision::Class;

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

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

jclass dateTimePartPrecisionNone::Class;

dateTimePartPrecisionNone::dateTimePartPrecisionNone() {
}

const std::int32_t dateTimePartPrecisionNone::ID;

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

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

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

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

jclass dateTimePartPrecisionShort::Class;

dateTimePartPrecisionShort::dateTimePartPrecisionShort() {
}

const std::int32_t dateTimePartPrecisionShort::ID;

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

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

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

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

jclass dateTimePartPrecisionLong::Class;

dateTimePartPrecisionLong::dateTimePartPrecisionLong() {
}

const std::int32_t dateTimePartPrecisionLong::ID;

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

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

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

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

jclass directMessagesChatTopic::Class;
jfieldID directMessagesChatTopic::chat_id_fieldID;
jfieldID directMessagesChatTopic::id_fieldID;
jfieldID directMessagesChatTopic::sender_id_fieldID;
jfieldID directMessagesChatTopic::order_fieldID;
jfieldID directMessagesChatTopic::can_send_unpaid_messages_fieldID;
jfieldID directMessagesChatTopic::is_marked_as_unread_fieldID;
jfieldID directMessagesChatTopic::unread_count_fieldID;
jfieldID directMessagesChatTopic::last_read_inbox_message_id_fieldID;
jfieldID directMessagesChatTopic::last_read_outbox_message_id_fieldID;
jfieldID directMessagesChatTopic::unread_reaction_count_fieldID;
jfieldID directMessagesChatTopic::last_message_fieldID;
jfieldID directMessagesChatTopic::draft_message_fieldID;

directMessagesChatTopic::directMessagesChatTopic()
  : chat_id_()
  , id_()
  , sender_id_()
  , order_()
  , can_send_unpaid_messages_()
  , is_marked_as_unread_()
  , unread_count_()
  , last_read_inbox_message_id_()
  , last_read_outbox_message_id_()
  , unread_reaction_count_()
  , last_message_()
  , draft_message_()
{}

directMessagesChatTopic::directMessagesChatTopic(int53 chat_id_, int53 id_, object_ptr<MessageSender> &&sender_id_, int64 order_, bool can_send_unpaid_messages_, bool is_marked_as_unread_, int53 unread_count_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int53 unread_reaction_count_, object_ptr<message> &&last_message_, object_ptr<draftMessage> &&draft_message_)
  : chat_id_(chat_id_)
  , id_(id_)
  , sender_id_(std::move(sender_id_))
  , order_(order_)
  , can_send_unpaid_messages_(can_send_unpaid_messages_)
  , is_marked_as_unread_(is_marked_as_unread_)
  , unread_count_(unread_count_)
  , last_read_inbox_message_id_(last_read_inbox_message_id_)
  , last_read_outbox_message_id_(last_read_outbox_message_id_)
  , unread_reaction_count_(unread_reaction_count_)
  , last_message_(std::move(last_message_))
  , draft_message_(std::move(draft_message_))
{}

const std::int32_t directMessagesChatTopic::ID;

object_ptr<directMessagesChatTopic> directMessagesChatTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<directMessagesChatTopic> res = make_object<directMessagesChatTopic>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->order_ = env->GetLongField(p, res->order_fieldID);
  res->can_send_unpaid_messages_ = (env->GetBooleanField(p, res->can_send_unpaid_messages_fieldID) != 0);
  res->is_marked_as_unread_ = (env->GetBooleanField(p, res->is_marked_as_unread_fieldID) != 0);
  res->unread_count_ = env->GetLongField(p, res->unread_count_fieldID);
  res->last_read_inbox_message_id_ = env->GetLongField(p, res->last_read_inbox_message_id_fieldID);
  res->last_read_outbox_message_id_ = env->GetLongField(p, res->last_read_outbox_message_id_fieldID);
  res->unread_reaction_count_ = env->GetLongField(p, res->unread_reaction_count_fieldID);
  res->last_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->last_message_fieldID));
  res->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  return res;
}

void directMessagesChatTopic::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, id_fieldID, id_);
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, order_fieldID, order_);
  env->SetBooleanField(s, can_send_unpaid_messages_fieldID, can_send_unpaid_messages_);
  env->SetBooleanField(s, is_marked_as_unread_fieldID, is_marked_as_unread_);
  env->SetLongField(s, unread_count_fieldID, unread_count_);
  env->SetLongField(s, last_read_inbox_message_id_fieldID, last_read_inbox_message_id_);
  env->SetLongField(s, last_read_outbox_message_id_fieldID, last_read_outbox_message_id_);
  env->SetLongField(s, unread_reaction_count_fieldID, unread_reaction_count_);
  if (last_message_ != nullptr) { jobject next; last_message_->store(env, next); if (next) { env->SetObjectField(s, last_message_fieldID, next); env->DeleteLocalRef(next); } }
  if (draft_message_ != nullptr) { jobject next; draft_message_->store(env, next); if (next) { env->SetObjectField(s, draft_message_fieldID, next); env->DeleteLocalRef(next); } }
}

void directMessagesChatTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DirectMessagesChatTopic");
    s.store_field("chatId", chat_id_);
    s.store_field("id", id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("order", order_);
    s.store_field("canSendUnpaidMessages", can_send_unpaid_messages_);
    s.store_field("isMarkedAsUnread", is_marked_as_unread_);
    s.store_field("unreadCount", unread_count_);
    s.store_field("lastReadInboxMessageId", last_read_inbox_message_id_);
    s.store_field("lastReadOutboxMessageId", last_read_outbox_message_id_);
    s.store_field("unreadReactionCount", unread_reaction_count_);
    s.store_object_field("lastMessage", static_cast<const BaseObject *>(last_message_.get()));
    s.store_object_field("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_class_end();
  }
}

void directMessagesChatTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DirectMessagesChatTopic").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    order_fieldID = jni::get_field_id(env, Class, "order", "J");
    can_send_unpaid_messages_fieldID = jni::get_field_id(env, Class, "canSendUnpaidMessages", "Z");
    is_marked_as_unread_fieldID = jni::get_field_id(env, Class, "isMarkedAsUnread", "Z");
    unread_count_fieldID = jni::get_field_id(env, Class, "unreadCount", "J");
    last_read_inbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadInboxMessageId", "J");
    last_read_outbox_message_id_fieldID = jni::get_field_id(env, Class, "lastReadOutboxMessageId", "J");
    unread_reaction_count_fieldID = jni::get_field_id(env, Class, "unreadReactionCount", "J");
    last_message_fieldID = jni::get_field_id(env, Class, "lastMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    draft_message_fieldID = jni::get_field_id(env, Class, "draftMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DraftMessage;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass EmailAddressResetState::Class;

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

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

jclass emailAddressResetStateAvailable::Class;
jfieldID emailAddressResetStateAvailable::wait_period_fieldID;

emailAddressResetStateAvailable::emailAddressResetStateAvailable()
  : wait_period_()
{}

emailAddressResetStateAvailable::emailAddressResetStateAvailable(int32 wait_period_)
  : wait_period_(wait_period_)
{}

const std::int32_t emailAddressResetStateAvailable::ID;

object_ptr<EmailAddressResetState> emailAddressResetStateAvailable::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emailAddressResetStateAvailable> res = make_object<emailAddressResetStateAvailable>();
  res->wait_period_ = env->GetIntField(p, res->wait_period_fieldID);
  return std::move(res);
}

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

void emailAddressResetStateAvailable::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmailAddressResetStateAvailable");
    s.store_field("waitPeriod", wait_period_);
    s.store_class_end();
  }
}

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

jclass emailAddressResetStatePending::Class;
jfieldID emailAddressResetStatePending::reset_in_fieldID;

emailAddressResetStatePending::emailAddressResetStatePending()
  : reset_in_()
{}

emailAddressResetStatePending::emailAddressResetStatePending(int32 reset_in_)
  : reset_in_(reset_in_)
{}

const std::int32_t emailAddressResetStatePending::ID;

object_ptr<EmailAddressResetState> emailAddressResetStatePending::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emailAddressResetStatePending> res = make_object<emailAddressResetStatePending>();
  res->reset_in_ = env->GetIntField(p, res->reset_in_fieldID);
  return std::move(res);
}

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

void emailAddressResetStatePending::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmailAddressResetStatePending");
    s.store_field("resetIn", reset_in_);
    s.store_class_end();
  }
}

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

jclass factCheck::Class;
jfieldID factCheck::text_fieldID;
jfieldID factCheck::country_code_fieldID;

factCheck::factCheck()
  : text_()
  , country_code_()
{}

factCheck::factCheck(object_ptr<formattedText> &&text_, string const &country_code_)
  : text_(std::move(text_))
  , country_code_(country_code_)
{}

const std::int32_t factCheck::ID;

object_ptr<factCheck> factCheck::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<factCheck> res = make_object<factCheck>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->country_code_ = jni::fetch_string(env, p, res->country_code_fieldID);
  return res;
}

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

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

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

jclass failedToAddMembers::Class;
jfieldID failedToAddMembers::failed_to_add_members_fieldID;

failedToAddMembers::failedToAddMembers()
  : failed_to_add_members_()
{}

failedToAddMembers::failedToAddMembers(array<object_ptr<failedToAddMember>> &&failed_to_add_members_)
  : failed_to_add_members_(std::move(failed_to_add_members_))
{}

const std::int32_t failedToAddMembers::ID;

object_ptr<failedToAddMembers> failedToAddMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<failedToAddMembers> res = make_object<failedToAddMembers>();
  res->failed_to_add_members_ = jni::FetchVector<failedToAddMember>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->failed_to_add_members_fieldID));
  return res;
}

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

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

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

jclass file::Class;
jfieldID file::id_fieldID;
jfieldID file::size_fieldID;
jfieldID file::expected_size_fieldID;
jfieldID file::local_fieldID;
jfieldID file::remote_fieldID;

file::file()
  : id_()
  , size_()
  , expected_size_()
  , local_()
  , remote_()
{}

file::file(int32 id_, int53 size_, int53 expected_size_, object_ptr<localFile> &&local_, object_ptr<remoteFile> &&remote_)
  : id_(id_)
  , size_(size_)
  , expected_size_(expected_size_)
  , local_(std::move(local_))
  , remote_(std::move(remote_))
{}

const std::int32_t file::ID;

object_ptr<file> file::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<file> res = make_object<file>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->size_ = env->GetLongField(p, res->size_fieldID);
  res->expected_size_ = env->GetLongField(p, res->expected_size_fieldID);
  res->local_ = jni::fetch_tl_object<localFile>(env, jni::fetch_object(env, p, res->local_fieldID));
  res->remote_ = jni::fetch_tl_object<remoteFile>(env, jni::fetch_object(env, p, res->remote_fieldID));
  return res;
}

void file::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetLongField(s, size_fieldID, size_);
  env->SetLongField(s, expected_size_fieldID, expected_size_);
  if (local_ != nullptr) { jobject next; local_->store(env, next); if (next) { env->SetObjectField(s, local_fieldID, next); env->DeleteLocalRef(next); } }
  if (remote_ != nullptr) { jobject next; remote_->store(env, next); if (next) { env->SetObjectField(s, remote_fieldID, next); env->DeleteLocalRef(next); } }
}

void file::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "File");
    s.store_field("id", id_);
    s.store_field("size", size_);
    s.store_field("expectedSize", expected_size_);
    s.store_object_field("local", static_cast<const BaseObject *>(local_.get()));
    s.store_object_field("remote", static_cast<const BaseObject *>(remote_.get()));
    s.store_class_end();
  }
}

void file::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$File").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    size_fieldID = jni::get_field_id(env, Class, "size", "J");
    expected_size_fieldID = jni::get_field_id(env, Class, "expectedSize", "J");
    local_fieldID = jni::get_field_id(env, Class, "local", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LocalFile;").c_str());
    remote_fieldID = jni::get_field_id(env, Class, "remote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RemoteFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass foundMessages::Class;
jfieldID foundMessages::total_count_fieldID;
jfieldID foundMessages::messages_fieldID;
jfieldID foundMessages::next_offset_fieldID;

foundMessages::foundMessages()
  : total_count_()
  , messages_()
  , next_offset_()
{}

foundMessages::foundMessages(int32 total_count_, array<object_ptr<message>> &&messages_, string const &next_offset_)
  : total_count_(total_count_)
  , messages_(std::move(messages_))
  , next_offset_(next_offset_)
{}

const std::int32_t foundMessages::ID;

object_ptr<foundMessages> foundMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundMessages> res = make_object<foundMessages>();
  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_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

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

void foundMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FoundMessages");
    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("nextOffset", next_offset_);
    s.store_class_end();
  }
}

void foundMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FoundMessages").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_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass foundPosition::Class;
jfieldID foundPosition::position_fieldID;

foundPosition::foundPosition()
  : position_()
{}

foundPosition::foundPosition(int32 position_)
  : position_(position_)
{}

const std::int32_t foundPosition::ID;

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

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

void foundPosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FoundPosition");
    s.store_field("position", position_);
    s.store_class_end();
  }
}

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

jclass foundUsers::Class;
jfieldID foundUsers::user_ids_fieldID;
jfieldID foundUsers::next_offset_fieldID;

foundUsers::foundUsers()
  : user_ids_()
  , next_offset_()
{}

foundUsers::foundUsers(array<int53> &&user_ids_, string const &next_offset_)
  : user_ids_(std::move(user_ids_))
  , next_offset_(next_offset_)
{}

const std::int32_t foundUsers::ID;

object_ptr<foundUsers> foundUsers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundUsers> res = make_object<foundUsers>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

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

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

void foundUsers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FoundUsers").c_str());
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass groupCallInfo::Class;
jfieldID groupCallInfo::group_call_id_fieldID;
jfieldID groupCallInfo::join_payload_fieldID;

groupCallInfo::groupCallInfo()
  : group_call_id_()
  , join_payload_()
{}

groupCallInfo::groupCallInfo(int32 group_call_id_, string const &join_payload_)
  : group_call_id_(group_call_id_)
  , join_payload_(join_payload_)
{}

const std::int32_t groupCallInfo::ID;

object_ptr<groupCallInfo> groupCallInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallInfo> res = make_object<groupCallInfo>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->join_payload_ = jni::fetch_string(env, p, res->join_payload_fieldID);
  return res;
}

void groupCallInfo::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_);
  { jstring nextString = jni::to_jstring(env, join_payload_); if (nextString) { env->SetObjectField(s, join_payload_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass groupCallMessage::Class;
jfieldID groupCallMessage::message_id_fieldID;
jfieldID groupCallMessage::sender_id_fieldID;
jfieldID groupCallMessage::date_fieldID;
jfieldID groupCallMessage::text_fieldID;
jfieldID groupCallMessage::paid_message_star_count_fieldID;
jfieldID groupCallMessage::is_from_owner_fieldID;
jfieldID groupCallMessage::can_be_deleted_fieldID;

groupCallMessage::groupCallMessage()
  : message_id_()
  , sender_id_()
  , date_()
  , text_()
  , paid_message_star_count_()
  , is_from_owner_()
  , can_be_deleted_()
{}

groupCallMessage::groupCallMessage(int32 message_id_, object_ptr<MessageSender> &&sender_id_, int32 date_, object_ptr<formattedText> &&text_, int53 paid_message_star_count_, bool is_from_owner_, bool can_be_deleted_)
  : message_id_(message_id_)
  , sender_id_(std::move(sender_id_))
  , date_(date_)
  , text_(std::move(text_))
  , paid_message_star_count_(paid_message_star_count_)
  , is_from_owner_(is_from_owner_)
  , can_be_deleted_(can_be_deleted_)
{}

const std::int32_t groupCallMessage::ID;

object_ptr<groupCallMessage> groupCallMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallMessage> res = make_object<groupCallMessage>();
  res->message_id_ = env->GetIntField(p, res->message_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  res->is_from_owner_ = (env->GetBooleanField(p, res->is_from_owner_fieldID) != 0);
  res->can_be_deleted_ = (env->GetBooleanField(p, res->can_be_deleted_fieldID) != 0);
  return res;
}

void groupCallMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, message_id_fieldID, message_id_);
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, paid_message_star_count_fieldID, paid_message_star_count_);
  env->SetBooleanField(s, is_from_owner_fieldID, is_from_owner_);
  env->SetBooleanField(s, can_be_deleted_fieldID, can_be_deleted_);
}

void groupCallMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallMessage");
    s.store_field("messageId", message_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("date", date_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_field("isFromOwner", is_from_owner_);
    s.store_field("canBeDeleted", can_be_deleted_);
    s.store_class_end();
  }
}

void groupCallMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallMessage").c_str());
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "I");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    is_from_owner_fieldID = jni::get_field_id(env, Class, "isFromOwner", "Z");
    can_be_deleted_fieldID = jni::get_field_id(env, Class, "canBeDeleted", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass identityDocument::Class;
jfieldID identityDocument::number_fieldID;
jfieldID identityDocument::expiration_date_fieldID;
jfieldID identityDocument::front_side_fieldID;
jfieldID identityDocument::reverse_side_fieldID;
jfieldID identityDocument::selfie_fieldID;
jfieldID identityDocument::translation_fieldID;

identityDocument::identityDocument()
  : number_()
  , expiration_date_()
  , front_side_()
  , reverse_side_()
  , selfie_()
  , translation_()
{}

identityDocument::identityDocument(string const &number_, object_ptr<date> &&expiration_date_, object_ptr<datedFile> &&front_side_, object_ptr<datedFile> &&reverse_side_, object_ptr<datedFile> &&selfie_, array<object_ptr<datedFile>> &&translation_)
  : number_(number_)
  , expiration_date_(std::move(expiration_date_))
  , front_side_(std::move(front_side_))
  , reverse_side_(std::move(reverse_side_))
  , selfie_(std::move(selfie_))
  , translation_(std::move(translation_))
{}

const std::int32_t identityDocument::ID;

object_ptr<identityDocument> identityDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<identityDocument> res = make_object<identityDocument>();
  res->number_ = jni::fetch_string(env, p, res->number_fieldID);
  res->expiration_date_ = jni::fetch_tl_object<date>(env, jni::fetch_object(env, p, res->expiration_date_fieldID));
  res->front_side_ = jni::fetch_tl_object<datedFile>(env, jni::fetch_object(env, p, res->front_side_fieldID));
  res->reverse_side_ = jni::fetch_tl_object<datedFile>(env, jni::fetch_object(env, p, res->reverse_side_fieldID));
  res->selfie_ = jni::fetch_tl_object<datedFile>(env, jni::fetch_object(env, p, res->selfie_fieldID));
  res->translation_ = jni::FetchVector<datedFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->translation_fieldID));
  return res;
}

void identityDocument::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, number_); if (nextString) { env->SetObjectField(s, number_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (expiration_date_ != nullptr) { jobject next; expiration_date_->store(env, next); if (next) { env->SetObjectField(s, expiration_date_fieldID, next); env->DeleteLocalRef(next); } }
  if (front_side_ != nullptr) { jobject next; front_side_->store(env, next); if (next) { env->SetObjectField(s, front_side_fieldID, next); env->DeleteLocalRef(next); } }
  if (reverse_side_ != nullptr) { jobject next; reverse_side_->store(env, next); if (next) { env->SetObjectField(s, reverse_side_fieldID, next); env->DeleteLocalRef(next); } }
  if (selfie_ != nullptr) { jobject next; selfie_->store(env, next); if (next) { env->SetObjectField(s, selfie_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, translation_); if (arr_tmp_) { env->SetObjectField(s, translation_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void identityDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "IdentityDocument");
    s.store_field("number", number_);
    s.store_object_field("expirationDate", static_cast<const BaseObject *>(expiration_date_.get()));
    s.store_object_field("frontSide", static_cast<const BaseObject *>(front_side_.get()));
    s.store_object_field("reverseSide", static_cast<const BaseObject *>(reverse_side_.get()));
    s.store_object_field("selfie", static_cast<const BaseObject *>(selfie_.get()));
    { 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 identityDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$IdentityDocument").c_str());
    number_fieldID = jni::get_field_id(env, Class, "number", "Ljava/lang/String;");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Date;").c_str());
    front_side_fieldID = jni::get_field_id(env, Class, "frontSide", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DatedFile;").c_str());
    reverse_side_fieldID = jni::get_field_id(env, Class, "reverseSide", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DatedFile;").c_str());
    selfie_fieldID = jni::get_field_id(env, Class, "selfie", (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 inputBusinessChatLink::Class;
jfieldID inputBusinessChatLink::text_fieldID;
jfieldID inputBusinessChatLink::title_fieldID;

inputBusinessChatLink::inputBusinessChatLink()
  : text_()
  , title_()
{}

inputBusinessChatLink::inputBusinessChatLink(object_ptr<formattedText> &&text_, string const &title_)
  : text_(std::move(text_))
  , title_(title_)
{}

const std::int32_t inputBusinessChatLink::ID;

object_ptr<inputBusinessChatLink> inputBusinessChatLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputBusinessChatLink> res = make_object<inputBusinessChatLink>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  return res;
}

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

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

jclass InputPassportElement::Class;

object_ptr<InputPassportElement> InputPassportElement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case inputPassportElementPersonalDetails::ID:
      return inputPassportElementPersonalDetails::fetch(env, p);
    case inputPassportElementPassport::ID:
      return inputPassportElementPassport::fetch(env, p);
    case inputPassportElementDriverLicense::ID:
      return inputPassportElementDriverLicense::fetch(env, p);
    case inputPassportElementIdentityCard::ID:
      return inputPassportElementIdentityCard::fetch(env, p);
    case inputPassportElementInternalPassport::ID:
      return inputPassportElementInternalPassport::fetch(env, p);
    case inputPassportElementAddress::ID:
      return inputPassportElementAddress::fetch(env, p);
    case inputPassportElementUtilityBill::ID:
      return inputPassportElementUtilityBill::fetch(env, p);
    case inputPassportElementBankStatement::ID:
      return inputPassportElementBankStatement::fetch(env, p);
    case inputPassportElementRentalAgreement::ID:
      return inputPassportElementRentalAgreement::fetch(env, p);
    case inputPassportElementPassportRegistration::ID:
      return inputPassportElementPassportRegistration::fetch(env, p);
    case inputPassportElementTemporaryRegistration::ID:
      return inputPassportElementTemporaryRegistration::fetch(env, p);
    case inputPassportElementPhoneNumber::ID:
      return inputPassportElementPhoneNumber::fetch(env, p);
    case inputPassportElementEmailAddress::ID:
      return inputPassportElementEmailAddress::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass inputPassportElementPersonalDetails::Class;
jfieldID inputPassportElementPersonalDetails::personal_details_fieldID;

inputPassportElementPersonalDetails::inputPassportElementPersonalDetails()
  : personal_details_()
{}

inputPassportElementPersonalDetails::inputPassportElementPersonalDetails(object_ptr<personalDetails> &&personal_details_)
  : personal_details_(std::move(personal_details_))
{}

const std::int32_t inputPassportElementPersonalDetails::ID;

object_ptr<InputPassportElement> inputPassportElementPersonalDetails::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementPersonalDetails> res = make_object<inputPassportElementPersonalDetails>();
  res->personal_details_ = jni::fetch_tl_object<personalDetails>(env, jni::fetch_object(env, p, res->personal_details_fieldID));
  return std::move(res);
}

void inputPassportElementPersonalDetails::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementPersonalDetails");
    s.store_object_field("personalDetails", static_cast<const BaseObject *>(personal_details_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementPassport::Class;
jfieldID inputPassportElementPassport::passport_fieldID;

inputPassportElementPassport::inputPassportElementPassport()
  : passport_()
{}

inputPassportElementPassport::inputPassportElementPassport(object_ptr<inputIdentityDocument> &&passport_)
  : passport_(std::move(passport_))
{}

const std::int32_t inputPassportElementPassport::ID;

object_ptr<InputPassportElement> inputPassportElementPassport::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementPassport> res = make_object<inputPassportElementPassport>();
  res->passport_ = jni::fetch_tl_object<inputIdentityDocument>(env, jni::fetch_object(env, p, res->passport_fieldID));
  return std::move(res);
}

void inputPassportElementPassport::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementPassport");
    s.store_object_field("passport", static_cast<const BaseObject *>(passport_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementDriverLicense::Class;
jfieldID inputPassportElementDriverLicense::driver_license_fieldID;

inputPassportElementDriverLicense::inputPassportElementDriverLicense()
  : driver_license_()
{}

inputPassportElementDriverLicense::inputPassportElementDriverLicense(object_ptr<inputIdentityDocument> &&driver_license_)
  : driver_license_(std::move(driver_license_))
{}

const std::int32_t inputPassportElementDriverLicense::ID;

object_ptr<InputPassportElement> inputPassportElementDriverLicense::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementDriverLicense> res = make_object<inputPassportElementDriverLicense>();
  res->driver_license_ = jni::fetch_tl_object<inputIdentityDocument>(env, jni::fetch_object(env, p, res->driver_license_fieldID));
  return std::move(res);
}

void inputPassportElementDriverLicense::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementDriverLicense");
    s.store_object_field("driverLicense", static_cast<const BaseObject *>(driver_license_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementIdentityCard::Class;
jfieldID inputPassportElementIdentityCard::identity_card_fieldID;

inputPassportElementIdentityCard::inputPassportElementIdentityCard()
  : identity_card_()
{}

inputPassportElementIdentityCard::inputPassportElementIdentityCard(object_ptr<inputIdentityDocument> &&identity_card_)
  : identity_card_(std::move(identity_card_))
{}

const std::int32_t inputPassportElementIdentityCard::ID;

object_ptr<InputPassportElement> inputPassportElementIdentityCard::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementIdentityCard> res = make_object<inputPassportElementIdentityCard>();
  res->identity_card_ = jni::fetch_tl_object<inputIdentityDocument>(env, jni::fetch_object(env, p, res->identity_card_fieldID));
  return std::move(res);
}

void inputPassportElementIdentityCard::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementIdentityCard");
    s.store_object_field("identityCard", static_cast<const BaseObject *>(identity_card_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementInternalPassport::Class;
jfieldID inputPassportElementInternalPassport::internal_passport_fieldID;

inputPassportElementInternalPassport::inputPassportElementInternalPassport()
  : internal_passport_()
{}

inputPassportElementInternalPassport::inputPassportElementInternalPassport(object_ptr<inputIdentityDocument> &&internal_passport_)
  : internal_passport_(std::move(internal_passport_))
{}

const std::int32_t inputPassportElementInternalPassport::ID;

object_ptr<InputPassportElement> inputPassportElementInternalPassport::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementInternalPassport> res = make_object<inputPassportElementInternalPassport>();
  res->internal_passport_ = jni::fetch_tl_object<inputIdentityDocument>(env, jni::fetch_object(env, p, res->internal_passport_fieldID));
  return std::move(res);
}

void inputPassportElementInternalPassport::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementInternalPassport");
    s.store_object_field("internalPassport", static_cast<const BaseObject *>(internal_passport_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementAddress::Class;
jfieldID inputPassportElementAddress::address_fieldID;

inputPassportElementAddress::inputPassportElementAddress()
  : address_()
{}

inputPassportElementAddress::inputPassportElementAddress(object_ptr<address> &&address_)
  : address_(std::move(address_))
{}

const std::int32_t inputPassportElementAddress::ID;

object_ptr<InputPassportElement> inputPassportElementAddress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementAddress> res = make_object<inputPassportElementAddress>();
  res->address_ = jni::fetch_tl_object<address>(env, jni::fetch_object(env, p, res->address_fieldID));
  return std::move(res);
}

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

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

jclass inputPassportElementUtilityBill::Class;
jfieldID inputPassportElementUtilityBill::utility_bill_fieldID;

inputPassportElementUtilityBill::inputPassportElementUtilityBill()
  : utility_bill_()
{}

inputPassportElementUtilityBill::inputPassportElementUtilityBill(object_ptr<inputPersonalDocument> &&utility_bill_)
  : utility_bill_(std::move(utility_bill_))
{}

const std::int32_t inputPassportElementUtilityBill::ID;

object_ptr<InputPassportElement> inputPassportElementUtilityBill::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementUtilityBill> res = make_object<inputPassportElementUtilityBill>();
  res->utility_bill_ = jni::fetch_tl_object<inputPersonalDocument>(env, jni::fetch_object(env, p, res->utility_bill_fieldID));
  return std::move(res);
}

void inputPassportElementUtilityBill::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementUtilityBill");
    s.store_object_field("utilityBill", static_cast<const BaseObject *>(utility_bill_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementBankStatement::Class;
jfieldID inputPassportElementBankStatement::bank_statement_fieldID;

inputPassportElementBankStatement::inputPassportElementBankStatement()
  : bank_statement_()
{}

inputPassportElementBankStatement::inputPassportElementBankStatement(object_ptr<inputPersonalDocument> &&bank_statement_)
  : bank_statement_(std::move(bank_statement_))
{}

const std::int32_t inputPassportElementBankStatement::ID;

object_ptr<InputPassportElement> inputPassportElementBankStatement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementBankStatement> res = make_object<inputPassportElementBankStatement>();
  res->bank_statement_ = jni::fetch_tl_object<inputPersonalDocument>(env, jni::fetch_object(env, p, res->bank_statement_fieldID));
  return std::move(res);
}

void inputPassportElementBankStatement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementBankStatement");
    s.store_object_field("bankStatement", static_cast<const BaseObject *>(bank_statement_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementRentalAgreement::Class;
jfieldID inputPassportElementRentalAgreement::rental_agreement_fieldID;

inputPassportElementRentalAgreement::inputPassportElementRentalAgreement()
  : rental_agreement_()
{}

inputPassportElementRentalAgreement::inputPassportElementRentalAgreement(object_ptr<inputPersonalDocument> &&rental_agreement_)
  : rental_agreement_(std::move(rental_agreement_))
{}

const std::int32_t inputPassportElementRentalAgreement::ID;

object_ptr<InputPassportElement> inputPassportElementRentalAgreement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementRentalAgreement> res = make_object<inputPassportElementRentalAgreement>();
  res->rental_agreement_ = jni::fetch_tl_object<inputPersonalDocument>(env, jni::fetch_object(env, p, res->rental_agreement_fieldID));
  return std::move(res);
}

void inputPassportElementRentalAgreement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementRentalAgreement");
    s.store_object_field("rentalAgreement", static_cast<const BaseObject *>(rental_agreement_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementPassportRegistration::Class;
jfieldID inputPassportElementPassportRegistration::passport_registration_fieldID;

inputPassportElementPassportRegistration::inputPassportElementPassportRegistration()
  : passport_registration_()
{}

inputPassportElementPassportRegistration::inputPassportElementPassportRegistration(object_ptr<inputPersonalDocument> &&passport_registration_)
  : passport_registration_(std::move(passport_registration_))
{}

const std::int32_t inputPassportElementPassportRegistration::ID;

object_ptr<InputPassportElement> inputPassportElementPassportRegistration::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementPassportRegistration> res = make_object<inputPassportElementPassportRegistration>();
  res->passport_registration_ = jni::fetch_tl_object<inputPersonalDocument>(env, jni::fetch_object(env, p, res->passport_registration_fieldID));
  return std::move(res);
}

void inputPassportElementPassportRegistration::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementPassportRegistration");
    s.store_object_field("passportRegistration", static_cast<const BaseObject *>(passport_registration_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementTemporaryRegistration::Class;
jfieldID inputPassportElementTemporaryRegistration::temporary_registration_fieldID;

inputPassportElementTemporaryRegistration::inputPassportElementTemporaryRegistration()
  : temporary_registration_()
{}

inputPassportElementTemporaryRegistration::inputPassportElementTemporaryRegistration(object_ptr<inputPersonalDocument> &&temporary_registration_)
  : temporary_registration_(std::move(temporary_registration_))
{}

const std::int32_t inputPassportElementTemporaryRegistration::ID;

object_ptr<InputPassportElement> inputPassportElementTemporaryRegistration::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementTemporaryRegistration> res = make_object<inputPassportElementTemporaryRegistration>();
  res->temporary_registration_ = jni::fetch_tl_object<inputPersonalDocument>(env, jni::fetch_object(env, p, res->temporary_registration_fieldID));
  return std::move(res);
}

void inputPassportElementTemporaryRegistration::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementTemporaryRegistration");
    s.store_object_field("temporaryRegistration", static_cast<const BaseObject *>(temporary_registration_.get()));
    s.store_class_end();
  }
}

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

jclass inputPassportElementPhoneNumber::Class;
jfieldID inputPassportElementPhoneNumber::phone_number_fieldID;

inputPassportElementPhoneNumber::inputPassportElementPhoneNumber()
  : phone_number_()
{}

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

const std::int32_t inputPassportElementPhoneNumber::ID;

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

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

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

jclass inputPassportElementEmailAddress::Class;
jfieldID inputPassportElementEmailAddress::email_address_fieldID;

inputPassportElementEmailAddress::inputPassportElementEmailAddress()
  : email_address_()
{}

inputPassportElementEmailAddress::inputPassportElementEmailAddress(string const &email_address_)
  : email_address_(email_address_)
{}

const std::int32_t inputPassportElementEmailAddress::ID;

object_ptr<InputPassportElement> inputPassportElementEmailAddress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPassportElementEmailAddress> res = make_object<inputPassportElementEmailAddress>();
  res->email_address_ = jni::fetch_string(env, p, res->email_address_fieldID);
  return std::move(res);
}

void inputPassportElementEmailAddress::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPassportElementEmailAddress");
    s.store_field("emailAddress", email_address_);
    s.store_class_end();
  }
}

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

jclass inputPersonalDocument::Class;
jfieldID inputPersonalDocument::files_fieldID;
jfieldID inputPersonalDocument::translation_fieldID;

inputPersonalDocument::inputPersonalDocument()
  : files_()
  , translation_()
{}

inputPersonalDocument::inputPersonalDocument(array<object_ptr<InputFile>> &&files_, array<object_ptr<InputFile>> &&translation_)
  : files_(std::move(files_))
  , translation_(std::move(translation_))
{}

const std::int32_t inputPersonalDocument::ID;

object_ptr<inputPersonalDocument> inputPersonalDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPersonalDocument> res = make_object<inputPersonalDocument>();
  res->files_ = jni::FetchVector<InputFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->files_fieldID));
  res->translation_ = jni::FetchVector<InputFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->translation_fieldID));
  return res;
}

void inputPersonalDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPersonalDocument");
    { 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 inputPersonalDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputPersonalDocument").c_str());
    files_fieldID = jni::get_field_id(env, Class, "files", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    translation_fieldID = jni::get_field_id(env, Class, "translation", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass InputStoryAreaType::Class;

object_ptr<InputStoryAreaType> InputStoryAreaType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case inputStoryAreaTypeLocation::ID:
      return inputStoryAreaTypeLocation::fetch(env, p);
    case inputStoryAreaTypeFoundVenue::ID:
      return inputStoryAreaTypeFoundVenue::fetch(env, p);
    case inputStoryAreaTypePreviousVenue::ID:
      return inputStoryAreaTypePreviousVenue::fetch(env, p);
    case inputStoryAreaTypeSuggestedReaction::ID:
      return inputStoryAreaTypeSuggestedReaction::fetch(env, p);
    case inputStoryAreaTypeMessage::ID:
      return inputStoryAreaTypeMessage::fetch(env, p);
    case inputStoryAreaTypeLink::ID:
      return inputStoryAreaTypeLink::fetch(env, p);
    case inputStoryAreaTypeWeather::ID:
      return inputStoryAreaTypeWeather::fetch(env, p);
    case inputStoryAreaTypeUpgradedGift::ID:
      return inputStoryAreaTypeUpgradedGift::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass inputStoryAreaTypeLocation::Class;
jfieldID inputStoryAreaTypeLocation::location_fieldID;
jfieldID inputStoryAreaTypeLocation::address_fieldID;

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

inputStoryAreaTypeLocation::inputStoryAreaTypeLocation(object_ptr<location> &&location_, object_ptr<locationAddress> &&address_)
  : location_(std::move(location_))
  , address_(std::move(address_))
{}

const std::int32_t inputStoryAreaTypeLocation::ID;

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

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

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

jclass inputStoryAreaTypeFoundVenue::Class;
jfieldID inputStoryAreaTypeFoundVenue::query_id_fieldID;
jfieldID inputStoryAreaTypeFoundVenue::result_id_fieldID;

inputStoryAreaTypeFoundVenue::inputStoryAreaTypeFoundVenue()
  : query_id_()
  , result_id_()
{}

inputStoryAreaTypeFoundVenue::inputStoryAreaTypeFoundVenue(int64 query_id_, string const &result_id_)
  : query_id_(query_id_)
  , result_id_(result_id_)
{}

const std::int32_t inputStoryAreaTypeFoundVenue::ID;

object_ptr<InputStoryAreaType> inputStoryAreaTypeFoundVenue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryAreaTypeFoundVenue> res = make_object<inputStoryAreaTypeFoundVenue>();
  res->query_id_ = env->GetLongField(p, res->query_id_fieldID);
  res->result_id_ = jni::fetch_string(env, p, res->result_id_fieldID);
  return std::move(res);
}

void inputStoryAreaTypeFoundVenue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryAreaTypeFoundVenue");
    s.store_field("queryId", query_id_);
    s.store_field("resultId", result_id_);
    s.store_class_end();
  }
}

void inputStoryAreaTypeFoundVenue::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputStoryAreaTypeFoundVenue").c_str());
    query_id_fieldID = jni::get_field_id(env, Class, "queryId", "J");
    result_id_fieldID = jni::get_field_id(env, Class, "resultId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass inputStoryAreaTypePreviousVenue::Class;
jfieldID inputStoryAreaTypePreviousVenue::venue_provider_fieldID;
jfieldID inputStoryAreaTypePreviousVenue::venue_id_fieldID;

inputStoryAreaTypePreviousVenue::inputStoryAreaTypePreviousVenue()
  : venue_provider_()
  , venue_id_()
{}

inputStoryAreaTypePreviousVenue::inputStoryAreaTypePreviousVenue(string const &venue_provider_, string const &venue_id_)
  : venue_provider_(venue_provider_)
  , venue_id_(venue_id_)
{}

const std::int32_t inputStoryAreaTypePreviousVenue::ID;

object_ptr<InputStoryAreaType> inputStoryAreaTypePreviousVenue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryAreaTypePreviousVenue> res = make_object<inputStoryAreaTypePreviousVenue>();
  res->venue_provider_ = jni::fetch_string(env, p, res->venue_provider_fieldID);
  res->venue_id_ = jni::fetch_string(env, p, res->venue_id_fieldID);
  return std::move(res);
}

void inputStoryAreaTypePreviousVenue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryAreaTypePreviousVenue");
    s.store_field("venueProvider", venue_provider_);
    s.store_field("venueId", venue_id_);
    s.store_class_end();
  }
}

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

jclass inputStoryAreaTypeSuggestedReaction::Class;
jfieldID inputStoryAreaTypeSuggestedReaction::reaction_type_fieldID;
jfieldID inputStoryAreaTypeSuggestedReaction::is_dark_fieldID;
jfieldID inputStoryAreaTypeSuggestedReaction::is_flipped_fieldID;

inputStoryAreaTypeSuggestedReaction::inputStoryAreaTypeSuggestedReaction()
  : reaction_type_()
  , is_dark_()
  , is_flipped_()
{}

inputStoryAreaTypeSuggestedReaction::inputStoryAreaTypeSuggestedReaction(object_ptr<ReactionType> &&reaction_type_, bool is_dark_, bool is_flipped_)
  : reaction_type_(std::move(reaction_type_))
  , is_dark_(is_dark_)
  , is_flipped_(is_flipped_)
{}

const std::int32_t inputStoryAreaTypeSuggestedReaction::ID;

object_ptr<InputStoryAreaType> inputStoryAreaTypeSuggestedReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryAreaTypeSuggestedReaction> res = make_object<inputStoryAreaTypeSuggestedReaction>();
  res->reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->reaction_type_fieldID));
  res->is_dark_ = (env->GetBooleanField(p, res->is_dark_fieldID) != 0);
  res->is_flipped_ = (env->GetBooleanField(p, res->is_flipped_fieldID) != 0);
  return std::move(res);
}

void inputStoryAreaTypeSuggestedReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryAreaTypeSuggestedReaction");
    s.store_object_field("reactionType", static_cast<const BaseObject *>(reaction_type_.get()));
    s.store_field("isDark", is_dark_);
    s.store_field("isFlipped", is_flipped_);
    s.store_class_end();
  }
}

void inputStoryAreaTypeSuggestedReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputStoryAreaTypeSuggestedReaction").c_str());
    reaction_type_fieldID = jni::get_field_id(env, Class, "reactionType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    is_dark_fieldID = jni::get_field_id(env, Class, "isDark", "Z");
    is_flipped_fieldID = jni::get_field_id(env, Class, "isFlipped", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputStoryAreaTypeMessage::Class;
jfieldID inputStoryAreaTypeMessage::chat_id_fieldID;
jfieldID inputStoryAreaTypeMessage::message_id_fieldID;

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

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

const std::int32_t inputStoryAreaTypeMessage::ID;

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

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

inputStoryAreaTypeLink::inputStoryAreaTypeLink()
  : url_()
{}

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

const std::int32_t inputStoryAreaTypeLink::ID;

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

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

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

jclass inputStoryAreaTypeWeather::Class;
jfieldID inputStoryAreaTypeWeather::temperature_fieldID;
jfieldID inputStoryAreaTypeWeather::emoji_fieldID;
jfieldID inputStoryAreaTypeWeather::background_color_fieldID;

inputStoryAreaTypeWeather::inputStoryAreaTypeWeather()
  : temperature_()
  , emoji_()
  , background_color_()
{}

inputStoryAreaTypeWeather::inputStoryAreaTypeWeather(double temperature_, string const &emoji_, int32 background_color_)
  : temperature_(temperature_)
  , emoji_(emoji_)
  , background_color_(background_color_)
{}

const std::int32_t inputStoryAreaTypeWeather::ID;

object_ptr<InputStoryAreaType> inputStoryAreaTypeWeather::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryAreaTypeWeather> res = make_object<inputStoryAreaTypeWeather>();
  res->temperature_ = env->GetDoubleField(p, res->temperature_fieldID);
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->background_color_ = env->GetIntField(p, res->background_color_fieldID);
  return std::move(res);
}

void inputStoryAreaTypeWeather::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryAreaTypeWeather");
    s.store_field("temperature", temperature_);
    s.store_field("emoji", emoji_);
    s.store_field("backgroundColor", background_color_);
    s.store_class_end();
  }
}

void inputStoryAreaTypeWeather::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputStoryAreaTypeWeather").c_str());
    temperature_fieldID = jni::get_field_id(env, Class, "temperature", "D");
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    background_color_fieldID = jni::get_field_id(env, Class, "backgroundColor", "I");
    return true;
  }();
  (void)is_inited;
}

jclass inputStoryAreaTypeUpgradedGift::Class;
jfieldID inputStoryAreaTypeUpgradedGift::gift_name_fieldID;

inputStoryAreaTypeUpgradedGift::inputStoryAreaTypeUpgradedGift()
  : gift_name_()
{}

inputStoryAreaTypeUpgradedGift::inputStoryAreaTypeUpgradedGift(string const &gift_name_)
  : gift_name_(gift_name_)
{}

const std::int32_t inputStoryAreaTypeUpgradedGift::ID;

object_ptr<InputStoryAreaType> inputStoryAreaTypeUpgradedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryAreaTypeUpgradedGift> res = make_object<inputStoryAreaTypeUpgradedGift>();
  res->gift_name_ = jni::fetch_string(env, p, res->gift_name_fieldID);
  return std::move(res);
}

void inputStoryAreaTypeUpgradedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryAreaTypeUpgradedGift");
    s.store_field("giftName", gift_name_);
    s.store_class_end();
  }
}

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

jclass languagePackInfo::Class;
jfieldID languagePackInfo::id_fieldID;
jfieldID languagePackInfo::base_language_pack_id_fieldID;
jfieldID languagePackInfo::name_fieldID;
jfieldID languagePackInfo::native_name_fieldID;
jfieldID languagePackInfo::plural_code_fieldID;
jfieldID languagePackInfo::is_official_fieldID;
jfieldID languagePackInfo::is_rtl_fieldID;
jfieldID languagePackInfo::is_beta_fieldID;
jfieldID languagePackInfo::is_installed_fieldID;
jfieldID languagePackInfo::total_string_count_fieldID;
jfieldID languagePackInfo::translated_string_count_fieldID;
jfieldID languagePackInfo::local_string_count_fieldID;
jfieldID languagePackInfo::translation_url_fieldID;

languagePackInfo::languagePackInfo()
  : id_()
  , base_language_pack_id_()
  , name_()
  , native_name_()
  , plural_code_()
  , is_official_()
  , is_rtl_()
  , is_beta_()
  , is_installed_()
  , total_string_count_()
  , translated_string_count_()
  , local_string_count_()
  , translation_url_()
{}

languagePackInfo::languagePackInfo(string const &id_, string const &base_language_pack_id_, string const &name_, string const &native_name_, string const &plural_code_, bool is_official_, bool is_rtl_, bool is_beta_, bool is_installed_, int32 total_string_count_, int32 translated_string_count_, int32 local_string_count_, string const &translation_url_)
  : id_(id_)
  , base_language_pack_id_(base_language_pack_id_)
  , name_(name_)
  , native_name_(native_name_)
  , plural_code_(plural_code_)
  , is_official_(is_official_)
  , is_rtl_(is_rtl_)
  , is_beta_(is_beta_)
  , is_installed_(is_installed_)
  , total_string_count_(total_string_count_)
  , translated_string_count_(translated_string_count_)
  , local_string_count_(local_string_count_)
  , translation_url_(translation_url_)
{}

const std::int32_t languagePackInfo::ID;

object_ptr<languagePackInfo> languagePackInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<languagePackInfo> res = make_object<languagePackInfo>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->base_language_pack_id_ = jni::fetch_string(env, p, res->base_language_pack_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->native_name_ = jni::fetch_string(env, p, res->native_name_fieldID);
  res->plural_code_ = jni::fetch_string(env, p, res->plural_code_fieldID);
  res->is_official_ = (env->GetBooleanField(p, res->is_official_fieldID) != 0);
  res->is_rtl_ = (env->GetBooleanField(p, res->is_rtl_fieldID) != 0);
  res->is_beta_ = (env->GetBooleanField(p, res->is_beta_fieldID) != 0);
  res->is_installed_ = (env->GetBooleanField(p, res->is_installed_fieldID) != 0);
  res->total_string_count_ = env->GetIntField(p, res->total_string_count_fieldID);
  res->translated_string_count_ = env->GetIntField(p, res->translated_string_count_fieldID);
  res->local_string_count_ = env->GetIntField(p, res->local_string_count_fieldID);
  res->translation_url_ = jni::fetch_string(env, p, res->translation_url_fieldID);
  return res;
}

void languagePackInfo::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, base_language_pack_id_); if (nextString) { env->SetObjectField(s, base_language_pack_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, native_name_); if (nextString) { env->SetObjectField(s, native_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, plural_code_); if (nextString) { env->SetObjectField(s, plural_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_official_fieldID, is_official_);
  env->SetBooleanField(s, is_rtl_fieldID, is_rtl_);
  env->SetBooleanField(s, is_beta_fieldID, is_beta_);
  env->SetBooleanField(s, is_installed_fieldID, is_installed_);
  env->SetIntField(s, total_string_count_fieldID, total_string_count_);
  env->SetIntField(s, translated_string_count_fieldID, translated_string_count_);
  env->SetIntField(s, local_string_count_fieldID, local_string_count_);
  { jstring nextString = jni::to_jstring(env, translation_url_); if (nextString) { env->SetObjectField(s, translation_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void languagePackInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LanguagePackInfo");
    s.store_field("id", id_);
    s.store_field("baseLanguagePackId", base_language_pack_id_);
    s.store_field("name", name_);
    s.store_field("nativeName", native_name_);
    s.store_field("pluralCode", plural_code_);
    s.store_field("isOfficial", is_official_);
    s.store_field("isRtl", is_rtl_);
    s.store_field("isBeta", is_beta_);
    s.store_field("isInstalled", is_installed_);
    s.store_field("totalStringCount", total_string_count_);
    s.store_field("translatedStringCount", translated_string_count_);
    s.store_field("localStringCount", local_string_count_);
    s.store_field("translationUrl", translation_url_);
    s.store_class_end();
  }
}

void languagePackInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LanguagePackInfo").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    base_language_pack_id_fieldID = jni::get_field_id(env, Class, "baseLanguagePackId", "Ljava/lang/String;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    native_name_fieldID = jni::get_field_id(env, Class, "nativeName", "Ljava/lang/String;");
    plural_code_fieldID = jni::get_field_id(env, Class, "pluralCode", "Ljava/lang/String;");
    is_official_fieldID = jni::get_field_id(env, Class, "isOfficial", "Z");
    is_rtl_fieldID = jni::get_field_id(env, Class, "isRtl", "Z");
    is_beta_fieldID = jni::get_field_id(env, Class, "isBeta", "Z");
    is_installed_fieldID = jni::get_field_id(env, Class, "isInstalled", "Z");
    total_string_count_fieldID = jni::get_field_id(env, Class, "totalStringCount", "I");
    translated_string_count_fieldID = jni::get_field_id(env, Class, "translatedStringCount", "I");
    local_string_count_fieldID = jni::get_field_id(env, Class, "localStringCount", "I");
    translation_url_fieldID = jni::get_field_id(env, Class, "translationUrl", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageCopyOptions::Class;
jfieldID messageCopyOptions::send_copy_fieldID;
jfieldID messageCopyOptions::replace_caption_fieldID;
jfieldID messageCopyOptions::new_caption_fieldID;
jfieldID messageCopyOptions::new_show_caption_above_media_fieldID;

messageCopyOptions::messageCopyOptions()
  : send_copy_()
  , replace_caption_()
  , new_caption_()
  , new_show_caption_above_media_()
{}

messageCopyOptions::messageCopyOptions(bool send_copy_, bool replace_caption_, object_ptr<formattedText> &&new_caption_, bool new_show_caption_above_media_)
  : send_copy_(send_copy_)
  , replace_caption_(replace_caption_)
  , new_caption_(std::move(new_caption_))
  , new_show_caption_above_media_(new_show_caption_above_media_)
{}

const std::int32_t messageCopyOptions::ID;

object_ptr<messageCopyOptions> messageCopyOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageCopyOptions> res = make_object<messageCopyOptions>();
  res->send_copy_ = (env->GetBooleanField(p, res->send_copy_fieldID) != 0);
  res->replace_caption_ = (env->GetBooleanField(p, res->replace_caption_fieldID) != 0);
  res->new_caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->new_caption_fieldID));
  res->new_show_caption_above_media_ = (env->GetBooleanField(p, res->new_show_caption_above_media_fieldID) != 0);
  return res;
}

void messageCopyOptions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, send_copy_fieldID, send_copy_);
  env->SetBooleanField(s, replace_caption_fieldID, replace_caption_);
  if (new_caption_ != nullptr) { jobject next; new_caption_->store(env, next); if (next) { env->SetObjectField(s, new_caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, new_show_caption_above_media_fieldID, new_show_caption_above_media_);
}

void messageCopyOptions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageCopyOptions");
    s.store_field("sendCopy", send_copy_);
    s.store_field("replaceCaption", replace_caption_);
    s.store_object_field("newCaption", static_cast<const BaseObject *>(new_caption_.get()));
    s.store_field("newShowCaptionAboveMedia", new_show_caption_above_media_);
    s.store_class_end();
  }
}

void messageCopyOptions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageCopyOptions").c_str());
    send_copy_fieldID = jni::get_field_id(env, Class, "sendCopy", "Z");
    replace_caption_fieldID = jni::get_field_id(env, Class, "replaceCaption", "Z");
    new_caption_fieldID = jni::get_field_id(env, Class, "newCaption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    new_show_caption_above_media_fieldID = jni::get_field_id(env, Class, "newShowCaptionAboveMedia", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageEffect::Class;
jfieldID messageEffect::id_fieldID;
jfieldID messageEffect::static_icon_fieldID;
jfieldID messageEffect::emoji_fieldID;
jfieldID messageEffect::is_premium_fieldID;
jfieldID messageEffect::type_fieldID;

messageEffect::messageEffect()
  : id_()
  , static_icon_()
  , emoji_()
  , is_premium_()
  , type_()
{}

messageEffect::messageEffect(int64 id_, object_ptr<sticker> &&static_icon_, string const &emoji_, bool is_premium_, object_ptr<MessageEffectType> &&type_)
  : id_(id_)
  , static_icon_(std::move(static_icon_))
  , emoji_(emoji_)
  , is_premium_(is_premium_)
  , type_(std::move(type_))
{}

const std::int32_t messageEffect::ID;

object_ptr<messageEffect> messageEffect::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageEffect> res = make_object<messageEffect>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->static_icon_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->static_icon_fieldID));
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->is_premium_ = (env->GetBooleanField(p, res->is_premium_fieldID) != 0);
  res->type_ = jni::fetch_tl_object<MessageEffectType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void messageEffect::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  if (static_icon_ != nullptr) { jobject next; static_icon_->store(env, next); if (next) { env->SetObjectField(s, static_icon_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_premium_fieldID, is_premium_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageEffect::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageEffect");
    s.store_field("id", id_);
    s.store_object_field("staticIcon", static_cast<const BaseObject *>(static_icon_.get()));
    s.store_field("emoji", emoji_);
    s.store_field("isPremium", is_premium_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void messageEffect::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageEffect").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    static_icon_fieldID = jni::get_field_id(env, Class, "staticIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    is_premium_fieldID = jni::get_field_id(env, Class, "isPremium", "Z");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageEffectType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass MessageReplyTo::Class;

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

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

jclass messageReplyToMessage::Class;
jfieldID messageReplyToMessage::chat_id_fieldID;
jfieldID messageReplyToMessage::message_id_fieldID;
jfieldID messageReplyToMessage::quote_fieldID;
jfieldID messageReplyToMessage::checklist_task_id_fieldID;
jfieldID messageReplyToMessage::poll_option_id_fieldID;
jfieldID messageReplyToMessage::origin_fieldID;
jfieldID messageReplyToMessage::origin_send_date_fieldID;
jfieldID messageReplyToMessage::content_fieldID;

messageReplyToMessage::messageReplyToMessage()
  : chat_id_()
  , message_id_()
  , quote_()
  , checklist_task_id_()
  , poll_option_id_()
  , origin_()
  , origin_send_date_()
  , content_()
{}

messageReplyToMessage::messageReplyToMessage(int53 chat_id_, int53 message_id_, object_ptr<textQuote> &&quote_, int32 checklist_task_id_, string const &poll_option_id_, object_ptr<MessageOrigin> &&origin_, int32 origin_send_date_, object_ptr<MessageContent> &&content_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , quote_(std::move(quote_))
  , checklist_task_id_(checklist_task_id_)
  , poll_option_id_(poll_option_id_)
  , origin_(std::move(origin_))
  , origin_send_date_(origin_send_date_)
  , content_(std::move(content_))
{}

const std::int32_t messageReplyToMessage::ID;

object_ptr<MessageReplyTo> messageReplyToMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageReplyToMessage> res = make_object<messageReplyToMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->quote_ = jni::fetch_tl_object<textQuote>(env, jni::fetch_object(env, p, res->quote_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->origin_ = jni::fetch_tl_object<MessageOrigin>(env, jni::fetch_object(env, p, res->origin_fieldID));
  res->origin_send_date_ = env->GetIntField(p, res->origin_send_date_fieldID);
  res->content_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  return std::move(res);
}

void messageReplyToMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  if (quote_ != nullptr) { jobject next; quote_->store(env, next); if (next) { env->SetObjectField(s, quote_fieldID, next); env->DeleteLocalRef(next); } }
  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); } }
  if (origin_ != nullptr) { jobject next; origin_->store(env, next); if (next) { env->SetObjectField(s, origin_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, origin_send_date_fieldID, origin_send_date_);
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageReplyToMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageReplyToMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("quote", static_cast<const BaseObject *>(quote_.get()));
    s.store_field("checklistTaskId", checklist_task_id_);
    s.store_field("pollOptionId", poll_option_id_);
    s.store_object_field("origin", static_cast<const BaseObject *>(origin_.get()));
    s.store_field("originSendDate", origin_send_date_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_class_end();
  }
}

void messageReplyToMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageReplyToMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    quote_fieldID = jni::get_field_id(env, Class, "quote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TextQuote;").c_str());
    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;");
    origin_fieldID = jni::get_field_id(env, Class, "origin", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageOrigin;").c_str());
    origin_send_date_fieldID = jni::get_field_id(env, Class, "originSendDate", "I");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageReplyToStory::Class;
jfieldID messageReplyToStory::story_poster_chat_id_fieldID;
jfieldID messageReplyToStory::story_id_fieldID;

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

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

const std::int32_t messageReplyToStory::ID;

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

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

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

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

jclass outline::Class;
jfieldID outline::paths_fieldID;

outline::outline()
  : paths_()
{}

outline::outline(array<object_ptr<closedVectorPath>> &&paths_)
  : paths_(std::move(paths_))
{}

const std::int32_t outline::ID;

object_ptr<outline> outline::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<outline> res = make_object<outline>();
  res->paths_ = jni::FetchVector<closedVectorPath>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->paths_fieldID));
  return res;
}

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

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

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

jclass photo::Class;
jfieldID photo::has_stickers_fieldID;
jfieldID photo::minithumbnail_fieldID;
jfieldID photo::sizes_fieldID;

photo::photo()
  : has_stickers_()
  , minithumbnail_()
  , sizes_()
{}

photo::photo(bool has_stickers_, object_ptr<minithumbnail> &&minithumbnail_, array<object_ptr<photoSize>> &&sizes_)
  : has_stickers_(has_stickers_)
  , minithumbnail_(std::move(minithumbnail_))
  , sizes_(std::move(sizes_))
{}

const std::int32_t photo::ID;

object_ptr<photo> photo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<photo> res = make_object<photo>();
  res->has_stickers_ = (env->GetBooleanField(p, res->has_stickers_fieldID) != 0);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->sizes_ = jni::FetchVector<photoSize>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->sizes_fieldID));
  return res;
}

void photo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, has_stickers_fieldID, has_stickers_);
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, sizes_); if (arr_tmp_) { env->SetObjectField(s, sizes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void photo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Photo");
    s.store_field("hasStickers", has_stickers_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    { s.store_vector_begin("sizes", sizes_.size()); for (const auto &_value : sizes_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void photo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Photo").c_str());
    has_stickers_fieldID = jni::get_field_id(env, Class, "hasStickers", "Z");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    sizes_fieldID = jni::get_field_id(env, Class, "sizes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PhotoSize;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pollVoteStatistics::Class;
jfieldID pollVoteStatistics::vote_graph_fieldID;

pollVoteStatistics::pollVoteStatistics()
  : vote_graph_()
{}

pollVoteStatistics::pollVoteStatistics(object_ptr<StatisticalGraph> &&vote_graph_)
  : vote_graph_(std::move(vote_graph_))
{}

const std::int32_t pollVoteStatistics::ID;

object_ptr<pollVoteStatistics> pollVoteStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pollVoteStatistics> res = make_object<pollVoteStatistics>();
  res->vote_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->vote_graph_fieldID));
  return res;
}

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

void pollVoteStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PollVoteStatistics");
    s.store_object_field("voteGraph", static_cast<const BaseObject *>(vote_graph_.get()));
    s.store_class_end();
  }
}

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

jclass premiumGiftPaymentOptions::Class;
jfieldID premiumGiftPaymentOptions::options_fieldID;

premiumGiftPaymentOptions::premiumGiftPaymentOptions()
  : options_()
{}

premiumGiftPaymentOptions::premiumGiftPaymentOptions(array<object_ptr<premiumGiftPaymentOption>> &&options_)
  : options_(std::move(options_))
{}

const std::int32_t premiumGiftPaymentOptions::ID;

object_ptr<premiumGiftPaymentOptions> premiumGiftPaymentOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumGiftPaymentOptions> res = make_object<premiumGiftPaymentOptions>();
  res->options_ = jni::FetchVector<premiumGiftPaymentOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  return res;
}

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

jclass reportOption::Class;
jfieldID reportOption::id_fieldID;
jfieldID reportOption::text_fieldID;

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

reportOption::reportOption(bytes const &id_, string const &text_)
  : id_(std::move(id_))
  , text_(text_)
{}

const std::int32_t reportOption::ID;

object_ptr<reportOption> reportOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportOption> res = make_object<reportOption>();
  res->id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->id_fieldID));
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  return res;
}

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

void reportOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportOption");
    s.store_bytes_field("id", id_);
    s.store_field("text", text_);
    s.store_class_end();
  }
}

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

jclass restrictionInfo::Class;
jfieldID restrictionInfo::restriction_reason_fieldID;
jfieldID restrictionInfo::has_sensitive_content_fieldID;

restrictionInfo::restrictionInfo()
  : restriction_reason_()
  , has_sensitive_content_()
{}

restrictionInfo::restrictionInfo(string const &restriction_reason_, bool has_sensitive_content_)
  : restriction_reason_(restriction_reason_)
  , has_sensitive_content_(has_sensitive_content_)
{}

const std::int32_t restrictionInfo::ID;

object_ptr<restrictionInfo> restrictionInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<restrictionInfo> res = make_object<restrictionInfo>();
  res->restriction_reason_ = jni::fetch_string(env, p, res->restriction_reason_fieldID);
  res->has_sensitive_content_ = (env->GetBooleanField(p, res->has_sensitive_content_fieldID) != 0);
  return res;
}

void restrictionInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, restriction_reason_); if (nextString) { env->SetObjectField(s, restriction_reason_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, has_sensitive_content_fieldID, has_sensitive_content_);
}

void restrictionInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RestrictionInfo");
    s.store_field("restrictionReason", restriction_reason_);
    s.store_field("hasSensitiveContent", has_sensitive_content_);
    s.store_class_end();
  }
}

void restrictionInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RestrictionInfo").c_str());
    restriction_reason_fieldID = jni::get_field_id(env, Class, "restrictionReason", "Ljava/lang/String;");
    has_sensitive_content_fieldID = jni::get_field_id(env, Class, "hasSensitiveContent", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass sponsoredMessages::Class;
jfieldID sponsoredMessages::messages_fieldID;
jfieldID sponsoredMessages::messages_between_fieldID;

sponsoredMessages::sponsoredMessages()
  : messages_()
  , messages_between_()
{}

sponsoredMessages::sponsoredMessages(array<object_ptr<sponsoredMessage>> &&messages_, int32 messages_between_)
  : messages_(std::move(messages_))
  , messages_between_(messages_between_)
{}

const std::int32_t sponsoredMessages::ID;

object_ptr<sponsoredMessages> sponsoredMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sponsoredMessages> res = make_object<sponsoredMessages>();
  res->messages_ = jni::FetchVector<sponsoredMessage>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->messages_fieldID));
  res->messages_between_ = env->GetIntField(p, res->messages_between_fieldID);
  return res;
}

void sponsoredMessages::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, messages_); if (arr_tmp_) { env->SetObjectField(s, messages_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, messages_between_fieldID, messages_between_);
}

void sponsoredMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SponsoredMessages");
    { 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("messagesBetween", messages_between_);
    s.store_class_end();
  }
}

void sponsoredMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SponsoredMessages").c_str());
    messages_fieldID = jni::get_field_id(env, Class, "messages", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$SponsoredMessage;").c_str());
    messages_between_fieldID = jni::get_field_id(env, Class, "messagesBetween", "I");
    return true;
  }();
  (void)is_inited;
}

jclass starAmount::Class;
jfieldID starAmount::star_count_fieldID;
jfieldID starAmount::nanostar_count_fieldID;

starAmount::starAmount()
  : star_count_()
  , nanostar_count_()
{}

starAmount::starAmount(int53 star_count_, int32 nanostar_count_)
  : star_count_(star_count_)
  , nanostar_count_(nanostar_count_)
{}

const std::int32_t starAmount::ID;

object_ptr<starAmount> starAmount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starAmount> res = make_object<starAmount>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->nanostar_count_ = env->GetIntField(p, res->nanostar_count_fieldID);
  return res;
}

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

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

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

jclass starTransaction::Class;
jfieldID starTransaction::id_fieldID;
jfieldID starTransaction::star_amount_fieldID;
jfieldID starTransaction::is_refund_fieldID;
jfieldID starTransaction::date_fieldID;
jfieldID starTransaction::type_fieldID;

starTransaction::starTransaction()
  : id_()
  , star_amount_()
  , is_refund_()
  , date_()
  , type_()
{}

starTransaction::starTransaction(string const &id_, object_ptr<starAmount> &&star_amount_, bool is_refund_, int32 date_, object_ptr<StarTransactionType> &&type_)
  : id_(id_)
  , star_amount_(std::move(star_amount_))
  , is_refund_(is_refund_)
  , date_(date_)
  , type_(std::move(type_))
{}

const std::int32_t starTransaction::ID;

object_ptr<starTransaction> starTransaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starTransaction> res = make_object<starTransaction>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->star_amount_fieldID));
  res->is_refund_ = (env->GetBooleanField(p, res->is_refund_fieldID) != 0);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->type_ = jni::fetch_tl_object<StarTransactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void starTransaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (star_amount_ != nullptr) { jobject next; star_amount_->store(env, next); if (next) { env->SetObjectField(s, star_amount_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_refund_fieldID, is_refund_);
  env->SetIntField(s, date_fieldID, date_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void starTransaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarTransaction");
    s.store_field("id", id_);
    s.store_object_field("starAmount", static_cast<const BaseObject *>(star_amount_.get()));
    s.store_field("isRefund", is_refund_);
    s.store_field("date", date_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void starTransaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarTransaction").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    star_amount_fieldID = jni::get_field_id(env, Class, "starAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    is_refund_fieldID = jni::get_field_id(env, Class, "isRefund", "Z");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarTransactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass StickerFormat::Class;

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

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

jclass stickerFormatWebp::Class;

stickerFormatWebp::stickerFormatWebp() {
}

const std::int32_t stickerFormatWebp::ID;

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

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

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

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

jclass stickerFormatTgs::Class;

stickerFormatTgs::stickerFormatTgs() {
}

const std::int32_t stickerFormatTgs::ID;

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

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

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

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

jclass stickerFormatWebm::Class;

stickerFormatWebm::stickerFormatWebm() {
}

const std::int32_t stickerFormatWebm::ID;

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

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

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

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

jclass story::Class;
jfieldID story::id_fieldID;
jfieldID story::poster_chat_id_fieldID;
jfieldID story::poster_id_fieldID;
jfieldID story::date_fieldID;
jfieldID story::is_being_posted_fieldID;
jfieldID story::is_being_edited_fieldID;
jfieldID story::is_edited_fieldID;
jfieldID story::is_posted_to_chat_page_fieldID;
jfieldID story::is_visible_only_for_self_fieldID;
jfieldID story::can_be_added_to_album_fieldID;
jfieldID story::can_be_deleted_fieldID;
jfieldID story::can_be_edited_fieldID;
jfieldID story::can_be_forwarded_fieldID;
jfieldID story::can_be_replied_fieldID;
jfieldID story::can_set_privacy_settings_fieldID;
jfieldID story::can_toggle_is_posted_to_chat_page_fieldID;
jfieldID story::can_get_statistics_fieldID;
jfieldID story::can_get_interactions_fieldID;
jfieldID story::has_expired_viewers_fieldID;
jfieldID story::repost_info_fieldID;
jfieldID story::interaction_info_fieldID;
jfieldID story::chosen_reaction_type_fieldID;
jfieldID story::privacy_settings_fieldID;
jfieldID story::content_fieldID;
jfieldID story::areas_fieldID;
jfieldID story::caption_fieldID;
jfieldID story::album_ids_fieldID;

story::story()
  : id_()
  , poster_chat_id_()
  , poster_id_()
  , date_()
  , is_being_posted_()
  , is_being_edited_()
  , is_edited_()
  , is_posted_to_chat_page_()
  , is_visible_only_for_self_()
  , can_be_added_to_album_()
  , can_be_deleted_()
  , can_be_edited_()
  , can_be_forwarded_()
  , can_be_replied_()
  , can_set_privacy_settings_()
  , can_toggle_is_posted_to_chat_page_()
  , can_get_statistics_()
  , can_get_interactions_()
  , has_expired_viewers_()
  , repost_info_()
  , interaction_info_()
  , chosen_reaction_type_()
  , privacy_settings_()
  , content_()
  , areas_()
  , caption_()
  , album_ids_()
{}

story::story(int32 id_, int53 poster_chat_id_, object_ptr<MessageSender> &&poster_id_, int32 date_, bool is_being_posted_, bool is_being_edited_, bool is_edited_, bool is_posted_to_chat_page_, bool is_visible_only_for_self_, bool can_be_added_to_album_, bool can_be_deleted_, bool can_be_edited_, bool can_be_forwarded_, bool can_be_replied_, bool can_set_privacy_settings_, bool can_toggle_is_posted_to_chat_page_, bool can_get_statistics_, bool can_get_interactions_, bool has_expired_viewers_, object_ptr<storyRepostInfo> &&repost_info_, object_ptr<storyInteractionInfo> &&interaction_info_, object_ptr<ReactionType> &&chosen_reaction_type_, object_ptr<StoryPrivacySettings> &&privacy_settings_, object_ptr<StoryContent> &&content_, array<object_ptr<storyArea>> &&areas_, object_ptr<formattedText> &&caption_, array<int32> &&album_ids_)
  : id_(id_)
  , poster_chat_id_(poster_chat_id_)
  , poster_id_(std::move(poster_id_))
  , date_(date_)
  , is_being_posted_(is_being_posted_)
  , is_being_edited_(is_being_edited_)
  , is_edited_(is_edited_)
  , is_posted_to_chat_page_(is_posted_to_chat_page_)
  , is_visible_only_for_self_(is_visible_only_for_self_)
  , can_be_added_to_album_(can_be_added_to_album_)
  , can_be_deleted_(can_be_deleted_)
  , can_be_edited_(can_be_edited_)
  , can_be_forwarded_(can_be_forwarded_)
  , can_be_replied_(can_be_replied_)
  , can_set_privacy_settings_(can_set_privacy_settings_)
  , can_toggle_is_posted_to_chat_page_(can_toggle_is_posted_to_chat_page_)
  , can_get_statistics_(can_get_statistics_)
  , can_get_interactions_(can_get_interactions_)
  , has_expired_viewers_(has_expired_viewers_)
  , repost_info_(std::move(repost_info_))
  , interaction_info_(std::move(interaction_info_))
  , chosen_reaction_type_(std::move(chosen_reaction_type_))
  , privacy_settings_(std::move(privacy_settings_))
  , content_(std::move(content_))
  , areas_(std::move(areas_))
  , caption_(std::move(caption_))
  , album_ids_(std::move(album_ids_))
{}

const std::int32_t story::ID;

object_ptr<story> story::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<story> res = make_object<story>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->poster_chat_id_ = env->GetLongField(p, res->poster_chat_id_fieldID);
  res->poster_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->poster_id_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->is_being_posted_ = (env->GetBooleanField(p, res->is_being_posted_fieldID) != 0);
  res->is_being_edited_ = (env->GetBooleanField(p, res->is_being_edited_fieldID) != 0);
  res->is_edited_ = (env->GetBooleanField(p, res->is_edited_fieldID) != 0);
  res->is_posted_to_chat_page_ = (env->GetBooleanField(p, res->is_posted_to_chat_page_fieldID) != 0);
  res->is_visible_only_for_self_ = (env->GetBooleanField(p, res->is_visible_only_for_self_fieldID) != 0);
  res->can_be_added_to_album_ = (env->GetBooleanField(p, res->can_be_added_to_album_fieldID) != 0);
  res->can_be_deleted_ = (env->GetBooleanField(p, res->can_be_deleted_fieldID) != 0);
  res->can_be_edited_ = (env->GetBooleanField(p, res->can_be_edited_fieldID) != 0);
  res->can_be_forwarded_ = (env->GetBooleanField(p, res->can_be_forwarded_fieldID) != 0);
  res->can_be_replied_ = (env->GetBooleanField(p, res->can_be_replied_fieldID) != 0);
  res->can_set_privacy_settings_ = (env->GetBooleanField(p, res->can_set_privacy_settings_fieldID) != 0);
  res->can_toggle_is_posted_to_chat_page_ = (env->GetBooleanField(p, res->can_toggle_is_posted_to_chat_page_fieldID) != 0);
  res->can_get_statistics_ = (env->GetBooleanField(p, res->can_get_statistics_fieldID) != 0);
  res->can_get_interactions_ = (env->GetBooleanField(p, res->can_get_interactions_fieldID) != 0);
  res->has_expired_viewers_ = (env->GetBooleanField(p, res->has_expired_viewers_fieldID) != 0);
  res->repost_info_ = jni::fetch_tl_object<storyRepostInfo>(env, jni::fetch_object(env, p, res->repost_info_fieldID));
  res->interaction_info_ = jni::fetch_tl_object<storyInteractionInfo>(env, jni::fetch_object(env, p, res->interaction_info_fieldID));
  res->chosen_reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->chosen_reaction_type_fieldID));
  res->privacy_settings_ = jni::fetch_tl_object<StoryPrivacySettings>(env, jni::fetch_object(env, p, res->privacy_settings_fieldID));
  res->content_ = jni::fetch_tl_object<StoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  res->areas_ = jni::FetchVector<storyArea>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->areas_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->album_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->album_ids_fieldID));
  return res;
}

void story::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetLongField(s, poster_chat_id_fieldID, poster_chat_id_);
  if (poster_id_ != nullptr) { jobject next; poster_id_->store(env, next); if (next) { env->SetObjectField(s, poster_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  env->SetBooleanField(s, is_being_posted_fieldID, is_being_posted_);
  env->SetBooleanField(s, is_being_edited_fieldID, is_being_edited_);
  env->SetBooleanField(s, is_edited_fieldID, is_edited_);
  env->SetBooleanField(s, is_posted_to_chat_page_fieldID, is_posted_to_chat_page_);
  env->SetBooleanField(s, is_visible_only_for_self_fieldID, is_visible_only_for_self_);
  env->SetBooleanField(s, can_be_added_to_album_fieldID, can_be_added_to_album_);
  env->SetBooleanField(s, can_be_deleted_fieldID, can_be_deleted_);
  env->SetBooleanField(s, can_be_edited_fieldID, can_be_edited_);
  env->SetBooleanField(s, can_be_forwarded_fieldID, can_be_forwarded_);
  env->SetBooleanField(s, can_be_replied_fieldID, can_be_replied_);
  env->SetBooleanField(s, can_set_privacy_settings_fieldID, can_set_privacy_settings_);
  env->SetBooleanField(s, can_toggle_is_posted_to_chat_page_fieldID, can_toggle_is_posted_to_chat_page_);
  env->SetBooleanField(s, can_get_statistics_fieldID, can_get_statistics_);
  env->SetBooleanField(s, can_get_interactions_fieldID, can_get_interactions_);
  env->SetBooleanField(s, has_expired_viewers_fieldID, has_expired_viewers_);
  if (repost_info_ != nullptr) { jobject next; repost_info_->store(env, next); if (next) { env->SetObjectField(s, repost_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (interaction_info_ != nullptr) { jobject next; interaction_info_->store(env, next); if (next) { env->SetObjectField(s, interaction_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (chosen_reaction_type_ != nullptr) { jobject next; chosen_reaction_type_->store(env, next); if (next) { env->SetObjectField(s, chosen_reaction_type_fieldID, next); env->DeleteLocalRef(next); } }
  if (privacy_settings_ != nullptr) { jobject next; privacy_settings_->store(env, next); if (next) { env->SetObjectField(s, privacy_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, areas_); if (arr_tmp_) { env->SetObjectField(s, areas_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); } }
  { auto arr_tmp_ = jni::store_vector(env, album_ids_); if (arr_tmp_) { env->SetObjectField(s, album_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void story::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Story");
    s.store_field("id", id_);
    s.store_field("posterChatId", poster_chat_id_);
    s.store_object_field("posterId", static_cast<const BaseObject *>(poster_id_.get()));
    s.store_field("date", date_);
    s.store_field("isBeingPosted", is_being_posted_);
    s.store_field("isBeingEdited", is_being_edited_);
    s.store_field("isEdited", is_edited_);
    s.store_field("isPostedToChatPage", is_posted_to_chat_page_);
    s.store_field("isVisibleOnlyForSelf", is_visible_only_for_self_);
    s.store_field("canBeAddedToAlbum", can_be_added_to_album_);
    s.store_field("canBeDeleted", can_be_deleted_);
    s.store_field("canBeEdited", can_be_edited_);
    s.store_field("canBeForwarded", can_be_forwarded_);
    s.store_field("canBeReplied", can_be_replied_);
    s.store_field("canSetPrivacySettings", can_set_privacy_settings_);
    s.store_field("canToggleIsPostedToChatPage", can_toggle_is_posted_to_chat_page_);
    s.store_field("canGetStatistics", can_get_statistics_);
    s.store_field("canGetInteractions", can_get_interactions_);
    s.store_field("hasExpiredViewers", has_expired_viewers_);
    s.store_object_field("repostInfo", static_cast<const BaseObject *>(repost_info_.get()));
    s.store_object_field("interactionInfo", static_cast<const BaseObject *>(interaction_info_.get()));
    s.store_object_field("chosenReactionType", static_cast<const BaseObject *>(chosen_reaction_type_.get()));
    s.store_object_field("privacySettings", static_cast<const BaseObject *>(privacy_settings_.get()));
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    { s.store_vector_begin("areas", areas_.size()); for (const auto &_value : areas_) { 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_vector_begin("albumIds", album_ids_.size()); for (const auto &_value : album_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void story::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Story").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    poster_chat_id_fieldID = jni::get_field_id(env, Class, "posterChatId", "J");
    poster_id_fieldID = jni::get_field_id(env, Class, "posterId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    is_being_posted_fieldID = jni::get_field_id(env, Class, "isBeingPosted", "Z");
    is_being_edited_fieldID = jni::get_field_id(env, Class, "isBeingEdited", "Z");
    is_edited_fieldID = jni::get_field_id(env, Class, "isEdited", "Z");
    is_posted_to_chat_page_fieldID = jni::get_field_id(env, Class, "isPostedToChatPage", "Z");
    is_visible_only_for_self_fieldID = jni::get_field_id(env, Class, "isVisibleOnlyForSelf", "Z");
    can_be_added_to_album_fieldID = jni::get_field_id(env, Class, "canBeAddedToAlbum", "Z");
    can_be_deleted_fieldID = jni::get_field_id(env, Class, "canBeDeleted", "Z");
    can_be_edited_fieldID = jni::get_field_id(env, Class, "canBeEdited", "Z");
    can_be_forwarded_fieldID = jni::get_field_id(env, Class, "canBeForwarded", "Z");
    can_be_replied_fieldID = jni::get_field_id(env, Class, "canBeReplied", "Z");
    can_set_privacy_settings_fieldID = jni::get_field_id(env, Class, "canSetPrivacySettings", "Z");
    can_toggle_is_posted_to_chat_page_fieldID = jni::get_field_id(env, Class, "canToggleIsPostedToChatPage", "Z");
    can_get_statistics_fieldID = jni::get_field_id(env, Class, "canGetStatistics", "Z");
    can_get_interactions_fieldID = jni::get_field_id(env, Class, "canGetInteractions", "Z");
    has_expired_viewers_fieldID = jni::get_field_id(env, Class, "hasExpiredViewers", "Z");
    repost_info_fieldID = jni::get_field_id(env, Class, "repostInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryRepostInfo;").c_str());
    interaction_info_fieldID = jni::get_field_id(env, Class, "interactionInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryInteractionInfo;").c_str());
    chosen_reaction_type_fieldID = jni::get_field_id(env, Class, "chosenReactionType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    privacy_settings_fieldID = jni::get_field_id(env, Class, "privacySettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryPrivacySettings;").c_str());
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryContent;").c_str());
    areas_fieldID = jni::get_field_id(env, Class, "areas", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StoryArea;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    album_ids_fieldID = jni::get_field_id(env, Class, "albumIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass storyArea::Class;
jfieldID storyArea::position_fieldID;
jfieldID storyArea::type_fieldID;

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

storyArea::storyArea(object_ptr<storyAreaPosition> &&position_, object_ptr<StoryAreaType> &&type_)
  : position_(std::move(position_))
  , type_(std::move(type_))
{}

const std::int32_t storyArea::ID;

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

void storyArea::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (position_ != nullptr) { jobject next; position_->store(env, next); if (next) { env->SetObjectField(s, position_fieldID, next); env->DeleteLocalRef(next); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass StoryContent::Class;

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

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

jclass storyContentPhoto::Class;
jfieldID storyContentPhoto::photo_fieldID;

storyContentPhoto::storyContentPhoto()
  : photo_()
{}

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

const std::int32_t storyContentPhoto::ID;

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

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

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

storyContentVideo::storyContentVideo()
  : video_()
  , alternative_video_()
{}

storyContentVideo::storyContentVideo(object_ptr<storyVideo> &&video_, object_ptr<storyVideo> &&alternative_video_)
  : video_(std::move(video_))
  , alternative_video_(std::move(alternative_video_))
{}

const std::int32_t storyContentVideo::ID;

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

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

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

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

jclass storyContentLive::Class;
jfieldID storyContentLive::group_call_id_fieldID;
jfieldID storyContentLive::is_rtmp_stream_fieldID;

storyContentLive::storyContentLive()
  : group_call_id_()
  , is_rtmp_stream_()
{}

storyContentLive::storyContentLive(int32 group_call_id_, bool is_rtmp_stream_)
  : group_call_id_(group_call_id_)
  , is_rtmp_stream_(is_rtmp_stream_)
{}

const std::int32_t storyContentLive::ID;

object_ptr<StoryContent> storyContentLive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyContentLive> res = make_object<storyContentLive>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->is_rtmp_stream_ = (env->GetBooleanField(p, res->is_rtmp_stream_fieldID) != 0);
  return std::move(res);
}

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

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

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

jclass storyContentUnsupported::Class;

storyContentUnsupported::storyContentUnsupported() {
}

const std::int32_t storyContentUnsupported::ID;

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

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

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

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

jclass storyRepostInfo::Class;
jfieldID storyRepostInfo::origin_fieldID;
jfieldID storyRepostInfo::is_content_modified_fieldID;

storyRepostInfo::storyRepostInfo()
  : origin_()
  , is_content_modified_()
{}

storyRepostInfo::storyRepostInfo(object_ptr<StoryOrigin> &&origin_, bool is_content_modified_)
  : origin_(std::move(origin_))
  , is_content_modified_(is_content_modified_)
{}

const std::int32_t storyRepostInfo::ID;

object_ptr<storyRepostInfo> storyRepostInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyRepostInfo> res = make_object<storyRepostInfo>();
  res->origin_ = jni::fetch_tl_object<StoryOrigin>(env, jni::fetch_object(env, p, res->origin_fieldID));
  res->is_content_modified_ = (env->GetBooleanField(p, res->is_content_modified_fieldID) != 0);
  return res;
}

void storyRepostInfo::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->SetBooleanField(s, is_content_modified_fieldID, is_content_modified_);
}

void storyRepostInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryRepostInfo");
    s.store_object_field("origin", static_cast<const BaseObject *>(origin_.get()));
    s.store_field("isContentModified", is_content_modified_);
    s.store_class_end();
  }
}

void storyRepostInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryRepostInfo").c_str());
    origin_fieldID = jni::get_field_id(env, Class, "origin", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryOrigin;").c_str());
    is_content_modified_fieldID = jni::get_field_id(env, Class, "isContentModified", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass SuggestedAction::Class;

object_ptr<SuggestedAction> SuggestedAction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case suggestedActionEnableArchiveAndMuteNewChats::ID:
      return suggestedActionEnableArchiveAndMuteNewChats::fetch(env, p);
    case suggestedActionCheckPassword::ID:
      return suggestedActionCheckPassword::fetch(env, p);
    case suggestedActionCheckPhoneNumber::ID:
      return suggestedActionCheckPhoneNumber::fetch(env, p);
    case suggestedActionViewChecksHint::ID:
      return suggestedActionViewChecksHint::fetch(env, p);
    case suggestedActionConvertToBroadcastGroup::ID:
      return suggestedActionConvertToBroadcastGroup::fetch(env, p);
    case suggestedActionSetPassword::ID:
      return suggestedActionSetPassword::fetch(env, p);
    case suggestedActionUpgradePremium::ID:
      return suggestedActionUpgradePremium::fetch(env, p);
    case suggestedActionRestorePremium::ID:
      return suggestedActionRestorePremium::fetch(env, p);
    case suggestedActionSubscribeToAnnualPremium::ID:
      return suggestedActionSubscribeToAnnualPremium::fetch(env, p);
    case suggestedActionGiftPremiumForChristmas::ID:
      return suggestedActionGiftPremiumForChristmas::fetch(env, p);
    case suggestedActionSetBirthdate::ID:
      return suggestedActionSetBirthdate::fetch(env, p);
    case suggestedActionSetProfilePhoto::ID:
      return suggestedActionSetProfilePhoto::fetch(env, p);
    case suggestedActionExtendPremium::ID:
      return suggestedActionExtendPremium::fetch(env, p);
    case suggestedActionExtendStarSubscriptions::ID:
      return suggestedActionExtendStarSubscriptions::fetch(env, p);
    case suggestedActionCustom::ID:
      return suggestedActionCustom::fetch(env, p);
    case suggestedActionSetLoginEmailAddress::ID:
      return suggestedActionSetLoginEmailAddress::fetch(env, p);
    case suggestedActionAddLoginPasskey::ID:
      return suggestedActionAddLoginPasskey::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass suggestedActionEnableArchiveAndMuteNewChats::Class;

suggestedActionEnableArchiveAndMuteNewChats::suggestedActionEnableArchiveAndMuteNewChats() {
}

const std::int32_t suggestedActionEnableArchiveAndMuteNewChats::ID;

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

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

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

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

jclass suggestedActionCheckPassword::Class;

suggestedActionCheckPassword::suggestedActionCheckPassword() {
}

const std::int32_t suggestedActionCheckPassword::ID;

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

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

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

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

jclass suggestedActionCheckPhoneNumber::Class;

suggestedActionCheckPhoneNumber::suggestedActionCheckPhoneNumber() {
}

const std::int32_t suggestedActionCheckPhoneNumber::ID;

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

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

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

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

jclass suggestedActionViewChecksHint::Class;

suggestedActionViewChecksHint::suggestedActionViewChecksHint() {
}

const std::int32_t suggestedActionViewChecksHint::ID;

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

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

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

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

jclass suggestedActionConvertToBroadcastGroup::Class;
jfieldID suggestedActionConvertToBroadcastGroup::supergroup_id_fieldID;

suggestedActionConvertToBroadcastGroup::suggestedActionConvertToBroadcastGroup()
  : supergroup_id_()
{}

suggestedActionConvertToBroadcastGroup::suggestedActionConvertToBroadcastGroup(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t suggestedActionConvertToBroadcastGroup::ID;

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

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

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

jclass suggestedActionSetPassword::Class;
jfieldID suggestedActionSetPassword::authorization_delay_fieldID;

suggestedActionSetPassword::suggestedActionSetPassword()
  : authorization_delay_()
{}

suggestedActionSetPassword::suggestedActionSetPassword(int32 authorization_delay_)
  : authorization_delay_(authorization_delay_)
{}

const std::int32_t suggestedActionSetPassword::ID;

object_ptr<SuggestedAction> suggestedActionSetPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestedActionSetPassword> res = make_object<suggestedActionSetPassword>();
  res->authorization_delay_ = env->GetIntField(p, res->authorization_delay_fieldID);
  return std::move(res);
}

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

void suggestedActionSetPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SuggestedActionSetPassword");
    s.store_field("authorizationDelay", authorization_delay_);
    s.store_class_end();
  }
}

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

jclass suggestedActionUpgradePremium::Class;

suggestedActionUpgradePremium::suggestedActionUpgradePremium() {
}

const std::int32_t suggestedActionUpgradePremium::ID;

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

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

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

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

jclass suggestedActionRestorePremium::Class;

suggestedActionRestorePremium::suggestedActionRestorePremium() {
}

const std::int32_t suggestedActionRestorePremium::ID;

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

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

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

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

jclass suggestedActionSubscribeToAnnualPremium::Class;

suggestedActionSubscribeToAnnualPremium::suggestedActionSubscribeToAnnualPremium() {
}

const std::int32_t suggestedActionSubscribeToAnnualPremium::ID;

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

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

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

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

jclass suggestedActionGiftPremiumForChristmas::Class;

suggestedActionGiftPremiumForChristmas::suggestedActionGiftPremiumForChristmas() {
}

const std::int32_t suggestedActionGiftPremiumForChristmas::ID;

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

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

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

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

jclass suggestedActionSetBirthdate::Class;

suggestedActionSetBirthdate::suggestedActionSetBirthdate() {
}

const std::int32_t suggestedActionSetBirthdate::ID;

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

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

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

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

jclass suggestedActionSetProfilePhoto::Class;

suggestedActionSetProfilePhoto::suggestedActionSetProfilePhoto() {
}

const std::int32_t suggestedActionSetProfilePhoto::ID;

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

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

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

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

jclass suggestedActionExtendPremium::Class;
jfieldID suggestedActionExtendPremium::manage_premium_subscription_url_fieldID;

suggestedActionExtendPremium::suggestedActionExtendPremium()
  : manage_premium_subscription_url_()
{}

suggestedActionExtendPremium::suggestedActionExtendPremium(string const &manage_premium_subscription_url_)
  : manage_premium_subscription_url_(manage_premium_subscription_url_)
{}

const std::int32_t suggestedActionExtendPremium::ID;

object_ptr<SuggestedAction> suggestedActionExtendPremium::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestedActionExtendPremium> res = make_object<suggestedActionExtendPremium>();
  res->manage_premium_subscription_url_ = jni::fetch_string(env, p, res->manage_premium_subscription_url_fieldID);
  return std::move(res);
}

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

void suggestedActionExtendPremium::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SuggestedActionExtendPremium");
    s.store_field("managePremiumSubscriptionUrl", manage_premium_subscription_url_);
    s.store_class_end();
  }
}

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

jclass suggestedActionExtendStarSubscriptions::Class;

suggestedActionExtendStarSubscriptions::suggestedActionExtendStarSubscriptions() {
}

const std::int32_t suggestedActionExtendStarSubscriptions::ID;

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

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

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

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

jclass suggestedActionCustom::Class;
jfieldID suggestedActionCustom::name_fieldID;
jfieldID suggestedActionCustom::title_fieldID;
jfieldID suggestedActionCustom::description_fieldID;
jfieldID suggestedActionCustom::url_fieldID;

suggestedActionCustom::suggestedActionCustom()
  : name_()
  , title_()
  , description_()
  , url_()
{}

suggestedActionCustom::suggestedActionCustom(string const &name_, object_ptr<formattedText> &&title_, object_ptr<formattedText> &&description_, string const &url_)
  : name_(name_)
  , title_(std::move(title_))
  , description_(std::move(description_))
  , url_(url_)
{}

const std::int32_t suggestedActionCustom::ID;

object_ptr<SuggestedAction> suggestedActionCustom::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestedActionCustom> res = make_object<suggestedActionCustom>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->title_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->title_fieldID));
  res->description_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->description_fieldID));
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void suggestedActionCustom::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (title_ != nullptr) { jobject next; title_->store(env, next); if (next) { env->SetObjectField(s, title_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); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void suggestedActionCustom::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SuggestedActionCustom");
    s.store_field("name", name_);
    s.store_object_field("title", static_cast<const BaseObject *>(title_.get()));
    s.store_object_field("description", static_cast<const BaseObject *>(description_.get()));
    s.store_field("url", url_);
    s.store_class_end();
  }
}

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

jclass suggestedActionSetLoginEmailAddress::Class;
jfieldID suggestedActionSetLoginEmailAddress::can_be_hidden_fieldID;

suggestedActionSetLoginEmailAddress::suggestedActionSetLoginEmailAddress()
  : can_be_hidden_()
{}

suggestedActionSetLoginEmailAddress::suggestedActionSetLoginEmailAddress(bool can_be_hidden_)
  : can_be_hidden_(can_be_hidden_)
{}

const std::int32_t suggestedActionSetLoginEmailAddress::ID;

object_ptr<SuggestedAction> suggestedActionSetLoginEmailAddress::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestedActionSetLoginEmailAddress> res = make_object<suggestedActionSetLoginEmailAddress>();
  res->can_be_hidden_ = (env->GetBooleanField(p, res->can_be_hidden_fieldID) != 0);
  return std::move(res);
}

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

void suggestedActionSetLoginEmailAddress::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SuggestedActionSetLoginEmailAddress");
    s.store_field("canBeHidden", can_be_hidden_);
    s.store_class_end();
  }
}

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

jclass suggestedActionAddLoginPasskey::Class;

suggestedActionAddLoginPasskey::suggestedActionAddLoginPasskey() {
}

const std::int32_t suggestedActionAddLoginPasskey::ID;

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

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

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

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

jclass TextEntityType::Class;

object_ptr<TextEntityType> TextEntityType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case textEntityTypeMention::ID:
      return textEntityTypeMention::fetch(env, p);
    case textEntityTypeHashtag::ID:
      return textEntityTypeHashtag::fetch(env, p);
    case textEntityTypeCashtag::ID:
      return textEntityTypeCashtag::fetch(env, p);
    case textEntityTypeBotCommand::ID:
      return textEntityTypeBotCommand::fetch(env, p);
    case textEntityTypeUrl::ID:
      return textEntityTypeUrl::fetch(env, p);
    case textEntityTypeEmailAddress::ID:
      return textEntityTypeEmailAddress::fetch(env, p);
    case textEntityTypePhoneNumber::ID:
      return textEntityTypePhoneNumber::fetch(env, p);
    case textEntityTypeBankCardNumber::ID:
      return textEntityTypeBankCardNumber::fetch(env, p);
    case textEntityTypeBold::ID:
      return textEntityTypeBold::fetch(env, p);
    case textEntityTypeItalic::ID:
      return textEntityTypeItalic::fetch(env, p);
    case textEntityTypeUnderline::ID:
      return textEntityTypeUnderline::fetch(env, p);
    case textEntityTypeStrikethrough::ID:
      return textEntityTypeStrikethrough::fetch(env, p);
    case textEntityTypeSpoiler::ID:
      return textEntityTypeSpoiler::fetch(env, p);
    case textEntityTypeCode::ID:
      return textEntityTypeCode::fetch(env, p);
    case textEntityTypePre::ID:
      return textEntityTypePre::fetch(env, p);
    case textEntityTypePreCode::ID:
      return textEntityTypePreCode::fetch(env, p);
    case textEntityTypeBlockQuote::ID:
      return textEntityTypeBlockQuote::fetch(env, p);
    case textEntityTypeExpandableBlockQuote::ID:
      return textEntityTypeExpandableBlockQuote::fetch(env, p);
    case textEntityTypeTextUrl::ID:
      return textEntityTypeTextUrl::fetch(env, p);
    case textEntityTypeMentionName::ID:
      return textEntityTypeMentionName::fetch(env, p);
    case textEntityTypeCustomEmoji::ID:
      return textEntityTypeCustomEmoji::fetch(env, p);
    case textEntityTypeMediaTimestamp::ID:
      return textEntityTypeMediaTimestamp::fetch(env, p);
    case textEntityTypeDateTime::ID:
      return textEntityTypeDateTime::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass textEntityTypeMention::Class;

textEntityTypeMention::textEntityTypeMention() {
}

const std::int32_t textEntityTypeMention::ID;

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

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

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

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

jclass textEntityTypeHashtag::Class;

textEntityTypeHashtag::textEntityTypeHashtag() {
}

const std::int32_t textEntityTypeHashtag::ID;

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

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

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

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

jclass textEntityTypeCashtag::Class;

textEntityTypeCashtag::textEntityTypeCashtag() {
}

const std::int32_t textEntityTypeCashtag::ID;

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

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

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

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

jclass textEntityTypeBotCommand::Class;

textEntityTypeBotCommand::textEntityTypeBotCommand() {
}

const std::int32_t textEntityTypeBotCommand::ID;

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

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

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

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

jclass textEntityTypeUrl::Class;

textEntityTypeUrl::textEntityTypeUrl() {
}

const std::int32_t textEntityTypeUrl::ID;

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

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

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

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

jclass textEntityTypeEmailAddress::Class;

textEntityTypeEmailAddress::textEntityTypeEmailAddress() {
}

const std::int32_t textEntityTypeEmailAddress::ID;

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

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

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

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

jclass textEntityTypePhoneNumber::Class;

textEntityTypePhoneNumber::textEntityTypePhoneNumber() {
}

const std::int32_t textEntityTypePhoneNumber::ID;

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

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

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

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

jclass textEntityTypeBankCardNumber::Class;

textEntityTypeBankCardNumber::textEntityTypeBankCardNumber() {
}

const std::int32_t textEntityTypeBankCardNumber::ID;

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

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

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

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

jclass textEntityTypeBold::Class;

textEntityTypeBold::textEntityTypeBold() {
}

const std::int32_t textEntityTypeBold::ID;

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

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

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

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

jclass textEntityTypeItalic::Class;

textEntityTypeItalic::textEntityTypeItalic() {
}

const std::int32_t textEntityTypeItalic::ID;

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

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

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

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

jclass textEntityTypeUnderline::Class;

textEntityTypeUnderline::textEntityTypeUnderline() {
}

const std::int32_t textEntityTypeUnderline::ID;

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

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

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

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

jclass textEntityTypeStrikethrough::Class;

textEntityTypeStrikethrough::textEntityTypeStrikethrough() {
}

const std::int32_t textEntityTypeStrikethrough::ID;

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

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

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

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

jclass textEntityTypeSpoiler::Class;

textEntityTypeSpoiler::textEntityTypeSpoiler() {
}

const std::int32_t textEntityTypeSpoiler::ID;

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

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

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

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

jclass textEntityTypeCode::Class;

textEntityTypeCode::textEntityTypeCode() {
}

const std::int32_t textEntityTypeCode::ID;

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

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

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

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

jclass textEntityTypePre::Class;

textEntityTypePre::textEntityTypePre() {
}

const std::int32_t textEntityTypePre::ID;

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

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

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

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

jclass textEntityTypePreCode::Class;
jfieldID textEntityTypePreCode::language_fieldID;

textEntityTypePreCode::textEntityTypePreCode()
  : language_()
{}

textEntityTypePreCode::textEntityTypePreCode(string const &language_)
  : language_(language_)
{}

const std::int32_t textEntityTypePreCode::ID;

object_ptr<TextEntityType> textEntityTypePreCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<textEntityTypePreCode> res = make_object<textEntityTypePreCode>();
  res->language_ = jni::fetch_string(env, p, res->language_fieldID);
  return std::move(res);
}

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

void textEntityTypePreCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TextEntityTypePreCode");
    s.store_field("language", language_);
    s.store_class_end();
  }
}

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

jclass textEntityTypeBlockQuote::Class;

textEntityTypeBlockQuote::textEntityTypeBlockQuote() {
}

const std::int32_t textEntityTypeBlockQuote::ID;

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

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

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

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

jclass textEntityTypeExpandableBlockQuote::Class;

textEntityTypeExpandableBlockQuote::textEntityTypeExpandableBlockQuote() {
}

const std::int32_t textEntityTypeExpandableBlockQuote::ID;

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

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

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

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

jclass textEntityTypeTextUrl::Class;
jfieldID textEntityTypeTextUrl::url_fieldID;

textEntityTypeTextUrl::textEntityTypeTextUrl()
  : url_()
{}

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

const std::int32_t textEntityTypeTextUrl::ID;

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

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

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

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

jclass textEntityTypeMentionName::Class;
jfieldID textEntityTypeMentionName::user_id_fieldID;

textEntityTypeMentionName::textEntityTypeMentionName()
  : user_id_()
{}

textEntityTypeMentionName::textEntityTypeMentionName(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t textEntityTypeMentionName::ID;

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

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

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

jclass textEntityTypeCustomEmoji::Class;
jfieldID textEntityTypeCustomEmoji::custom_emoji_id_fieldID;

textEntityTypeCustomEmoji::textEntityTypeCustomEmoji()
  : custom_emoji_id_()
{}

textEntityTypeCustomEmoji::textEntityTypeCustomEmoji(int64 custom_emoji_id_)
  : custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t textEntityTypeCustomEmoji::ID;

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

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

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

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

jclass textEntityTypeMediaTimestamp::Class;
jfieldID textEntityTypeMediaTimestamp::media_timestamp_fieldID;

textEntityTypeMediaTimestamp::textEntityTypeMediaTimestamp()
  : media_timestamp_()
{}

textEntityTypeMediaTimestamp::textEntityTypeMediaTimestamp(int32 media_timestamp_)
  : media_timestamp_(media_timestamp_)
{}

const std::int32_t textEntityTypeMediaTimestamp::ID;

object_ptr<TextEntityType> textEntityTypeMediaTimestamp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<textEntityTypeMediaTimestamp> res = make_object<textEntityTypeMediaTimestamp>();
  res->media_timestamp_ = env->GetIntField(p, res->media_timestamp_fieldID);
  return std::move(res);
}

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

void textEntityTypeMediaTimestamp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TextEntityTypeMediaTimestamp");
    s.store_field("mediaTimestamp", media_timestamp_);
    s.store_class_end();
  }
}

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

jclass textEntityTypeDateTime::Class;
jfieldID textEntityTypeDateTime::unix_time_fieldID;
jfieldID textEntityTypeDateTime::formatting_type_fieldID;

textEntityTypeDateTime::textEntityTypeDateTime()
  : unix_time_()
  , formatting_type_()
{}

textEntityTypeDateTime::textEntityTypeDateTime(int32 unix_time_, object_ptr<DateTimeFormattingType> &&formatting_type_)
  : unix_time_(unix_time_)
  , formatting_type_(std::move(formatting_type_))
{}

const std::int32_t textEntityTypeDateTime::ID;

object_ptr<TextEntityType> textEntityTypeDateTime::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<textEntityTypeDateTime> res = make_object<textEntityTypeDateTime>();
  res->unix_time_ = env->GetIntField(p, res->unix_time_fieldID);
  res->formatting_type_ = jni::fetch_tl_object<DateTimeFormattingType>(env, jni::fetch_object(env, p, res->formatting_type_fieldID));
  return std::move(res);
}

void textEntityTypeDateTime::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, unix_time_fieldID, unix_time_);
  if (formatting_type_ != nullptr) { jobject next; formatting_type_->store(env, next); if (next) { env->SetObjectField(s, formatting_type_fieldID, next); env->DeleteLocalRef(next); } }
}

void textEntityTypeDateTime::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TextEntityTypeDateTime");
    s.store_field("unixTime", unix_time_);
    s.store_object_field("formattingType", static_cast<const BaseObject *>(formatting_type_.get()));
    s.store_class_end();
  }
}

void textEntityTypeDateTime::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TextEntityTypeDateTime").c_str());
    unix_time_fieldID = jni::get_field_id(env, Class, "unixTime", "I");
    formatting_type_fieldID = jni::get_field_id(env, Class, "formattingType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DateTimeFormattingType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass timeZone::Class;
jfieldID timeZone::id_fieldID;
jfieldID timeZone::name_fieldID;
jfieldID timeZone::utc_time_offset_fieldID;

timeZone::timeZone()
  : id_()
  , name_()
  , utc_time_offset_()
{}

timeZone::timeZone(string const &id_, string const &name_, int32 utc_time_offset_)
  : id_(id_)
  , name_(name_)
  , utc_time_offset_(utc_time_offset_)
{}

const std::int32_t timeZone::ID;

object_ptr<timeZone> timeZone::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<timeZone> res = make_object<timeZone>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->utc_time_offset_ = env->GetIntField(p, res->utc_time_offset_fieldID);
  return res;
}

void timeZone::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, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, utc_time_offset_fieldID, utc_time_offset_);
}

void timeZone::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TimeZone");
    s.store_field("id", id_);
    s.store_field("name", name_);
    s.store_field("utcTimeOffset", utc_time_offset_);
    s.store_class_end();
  }
}

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

jclass TopChatCategory::Class;

object_ptr<TopChatCategory> TopChatCategory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case topChatCategoryUsers::ID:
      return topChatCategoryUsers::fetch(env, p);
    case topChatCategoryBots::ID:
      return topChatCategoryBots::fetch(env, p);
    case topChatCategoryGroups::ID:
      return topChatCategoryGroups::fetch(env, p);
    case topChatCategoryChannels::ID:
      return topChatCategoryChannels::fetch(env, p);
    case topChatCategoryInlineBots::ID:
      return topChatCategoryInlineBots::fetch(env, p);
    case topChatCategoryGuestBots::ID:
      return topChatCategoryGuestBots::fetch(env, p);
    case topChatCategoryWebAppBots::ID:
      return topChatCategoryWebAppBots::fetch(env, p);
    case topChatCategoryCalls::ID:
      return topChatCategoryCalls::fetch(env, p);
    case topChatCategoryForwardChats::ID:
      return topChatCategoryForwardChats::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass topChatCategoryUsers::Class;

topChatCategoryUsers::topChatCategoryUsers() {
}

const std::int32_t topChatCategoryUsers::ID;

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

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

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

jclass topChatCategoryBots::Class;

topChatCategoryBots::topChatCategoryBots() {
}

const std::int32_t topChatCategoryBots::ID;

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

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

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

jclass topChatCategoryGroups::Class;

topChatCategoryGroups::topChatCategoryGroups() {
}

const std::int32_t topChatCategoryGroups::ID;

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

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

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

jclass topChatCategoryChannels::Class;

topChatCategoryChannels::topChatCategoryChannels() {
}

const std::int32_t topChatCategoryChannels::ID;

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

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

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

jclass topChatCategoryInlineBots::Class;

topChatCategoryInlineBots::topChatCategoryInlineBots() {
}

const std::int32_t topChatCategoryInlineBots::ID;

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

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

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

jclass topChatCategoryGuestBots::Class;

topChatCategoryGuestBots::topChatCategoryGuestBots() {
}

const std::int32_t topChatCategoryGuestBots::ID;

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

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

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

jclass topChatCategoryWebAppBots::Class;

topChatCategoryWebAppBots::topChatCategoryWebAppBots() {
}

const std::int32_t topChatCategoryWebAppBots::ID;

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

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

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

jclass topChatCategoryCalls::Class;

topChatCategoryCalls::topChatCategoryCalls() {
}

const std::int32_t topChatCategoryCalls::ID;

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

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

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

jclass topChatCategoryForwardChats::Class;

topChatCategoryForwardChats::topChatCategoryForwardChats() {
}

const std::int32_t topChatCategoryForwardChats::ID;

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

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

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

jclass TransactionDirection::Class;

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

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

jclass transactionDirectionIncoming::Class;

transactionDirectionIncoming::transactionDirectionIncoming() {
}

const std::int32_t transactionDirectionIncoming::ID;

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

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

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

jclass transactionDirectionOutgoing::Class;

transactionDirectionOutgoing::transactionDirectionOutgoing() {
}

const std::int32_t transactionDirectionOutgoing::ID;

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

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

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

jclass upgradedGiftBackdropCount::Class;
jfieldID upgradedGiftBackdropCount::backdrop_fieldID;
jfieldID upgradedGiftBackdropCount::total_count_fieldID;

upgradedGiftBackdropCount::upgradedGiftBackdropCount()
  : backdrop_()
  , total_count_()
{}

upgradedGiftBackdropCount::upgradedGiftBackdropCount(object_ptr<upgradedGiftBackdrop> &&backdrop_, int32 total_count_)
  : backdrop_(std::move(backdrop_))
  , total_count_(total_count_)
{}

const std::int32_t upgradedGiftBackdropCount::ID;

object_ptr<upgradedGiftBackdropCount> upgradedGiftBackdropCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftBackdropCount> res = make_object<upgradedGiftBackdropCount>();
  res->backdrop_ = jni::fetch_tl_object<upgradedGiftBackdrop>(env, jni::fetch_object(env, p, res->backdrop_fieldID));
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  return res;
}

void upgradedGiftBackdropCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (backdrop_ != nullptr) { jobject next; backdrop_->store(env, next); if (next) { env->SetObjectField(s, backdrop_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, total_count_fieldID, total_count_);
}

void upgradedGiftBackdropCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftBackdropCount");
    s.store_object_field("backdrop", static_cast<const BaseObject *>(backdrop_.get()));
    s.store_field("totalCount", total_count_);
    s.store_class_end();
  }
}

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

jclass verificationStatus::Class;
jfieldID verificationStatus::is_verified_fieldID;
jfieldID verificationStatus::is_scam_fieldID;
jfieldID verificationStatus::is_fake_fieldID;
jfieldID verificationStatus::bot_verification_icon_custom_emoji_id_fieldID;

verificationStatus::verificationStatus()
  : is_verified_()
  , is_scam_()
  , is_fake_()
  , bot_verification_icon_custom_emoji_id_()
{}

verificationStatus::verificationStatus(bool is_verified_, bool is_scam_, bool is_fake_, int64 bot_verification_icon_custom_emoji_id_)
  : is_verified_(is_verified_)
  , is_scam_(is_scam_)
  , is_fake_(is_fake_)
  , bot_verification_icon_custom_emoji_id_(bot_verification_icon_custom_emoji_id_)
{}

const std::int32_t verificationStatus::ID;

object_ptr<verificationStatus> verificationStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<verificationStatus> res = make_object<verificationStatus>();
  res->is_verified_ = (env->GetBooleanField(p, res->is_verified_fieldID) != 0);
  res->is_scam_ = (env->GetBooleanField(p, res->is_scam_fieldID) != 0);
  res->is_fake_ = (env->GetBooleanField(p, res->is_fake_fieldID) != 0);
  res->bot_verification_icon_custom_emoji_id_ = env->GetLongField(p, res->bot_verification_icon_custom_emoji_id_fieldID);
  return res;
}

void verificationStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_verified_fieldID, is_verified_);
  env->SetBooleanField(s, is_scam_fieldID, is_scam_);
  env->SetBooleanField(s, is_fake_fieldID, is_fake_);
  env->SetLongField(s, bot_verification_icon_custom_emoji_id_fieldID, bot_verification_icon_custom_emoji_id_);
}

void verificationStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VerificationStatus");
    s.store_field("isVerified", is_verified_);
    s.store_field("isScam", is_scam_);
    s.store_field("isFake", is_fake_);
    s.store_field("botVerificationIconCustomEmojiId", bot_verification_icon_custom_emoji_id_);
    s.store_class_end();
  }
}

void verificationStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VerificationStatus").c_str());
    is_verified_fieldID = jni::get_field_id(env, Class, "isVerified", "Z");
    is_scam_fieldID = jni::get_field_id(env, Class, "isScam", "Z");
    is_fake_fieldID = jni::get_field_id(env, Class, "isFake", "Z");
    bot_verification_icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "botVerificationIconCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass addChatToList::Class;
jfieldID addChatToList::chat_id_fieldID;
jfieldID addChatToList::chat_list_fieldID;

addChatToList::addChatToList()
  : chat_id_()
  , chat_list_()
{}

addChatToList::addChatToList(int53 chat_id_, object_ptr<ChatList> &&chat_list_)
  : chat_id_(chat_id_)
  , chat_list_(std::move(chat_list_))
{}

const std::int32_t addChatToList::ID;

object_ptr<addChatToList> addChatToList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addChatToList> res = make_object<addChatToList>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  return res;
}

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

addChatToList::ReturnType addChatToList::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass addChecklistTasks::Class;
jfieldID addChecklistTasks::chat_id_fieldID;
jfieldID addChecklistTasks::message_id_fieldID;
jfieldID addChecklistTasks::tasks_fieldID;

addChecklistTasks::addChecklistTasks()
  : chat_id_()
  , message_id_()
  , tasks_()
{}

addChecklistTasks::addChecklistTasks(int53 chat_id_, int53 message_id_, array<object_ptr<inputChecklistTask>> &&tasks_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , tasks_(std::move(tasks_))
{}

const std::int32_t addChecklistTasks::ID;

object_ptr<addChecklistTasks> addChecklistTasks::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addChecklistTasks> res = make_object<addChecklistTasks>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->tasks_ = jni::FetchVector<inputChecklistTask>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->tasks_fieldID));
  return res;
}

void addChecklistTasks::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddChecklistTasks");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", 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();
  }
}

addChecklistTasks::ReturnType addChecklistTasks::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addChecklistTasks::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddChecklistTasks").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    tasks_fieldID = jni::get_field_id(env, Class, "tasks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputChecklistTask;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addLocalMessage::Class;
jfieldID addLocalMessage::chat_id_fieldID;
jfieldID addLocalMessage::sender_id_fieldID;
jfieldID addLocalMessage::reply_to_fieldID;
jfieldID addLocalMessage::disable_notification_fieldID;
jfieldID addLocalMessage::input_message_content_fieldID;

addLocalMessage::addLocalMessage()
  : chat_id_()
  , sender_id_()
  , reply_to_()
  , disable_notification_()
  , input_message_content_()
{}

addLocalMessage::addLocalMessage(int53 chat_id_, object_ptr<MessageSender> &&sender_id_, object_ptr<InputMessageReplyTo> &&reply_to_, bool disable_notification_, object_ptr<InputMessageContent> &&input_message_content_)
  : chat_id_(chat_id_)
  , sender_id_(std::move(sender_id_))
  , reply_to_(std::move(reply_to_))
  , disable_notification_(disable_notification_)
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t addLocalMessage::ID;

object_ptr<addLocalMessage> addLocalMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addLocalMessage> res = make_object<addLocalMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->disable_notification_ = (env->GetBooleanField(p, res->disable_notification_fieldID) != 0);
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void addLocalMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddLocalMessage");
    s.store_field("chatId", chat_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_field("disableNotification", disable_notification_);
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

addLocalMessage::ReturnType addLocalMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void addLocalMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddLocalMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    disable_notification_fieldID = jni::get_field_id(env, Class, "disableNotification", "Z");
    input_message_content_fieldID = jni::get_field_id(env, Class, "inputMessageContent", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addPendingPaidMessageReaction::Class;
jfieldID addPendingPaidMessageReaction::chat_id_fieldID;
jfieldID addPendingPaidMessageReaction::message_id_fieldID;
jfieldID addPendingPaidMessageReaction::star_count_fieldID;
jfieldID addPendingPaidMessageReaction::type_fieldID;

addPendingPaidMessageReaction::addPendingPaidMessageReaction()
  : chat_id_()
  , message_id_()
  , star_count_()
  , type_()
{}

addPendingPaidMessageReaction::addPendingPaidMessageReaction(int53 chat_id_, int53 message_id_, int53 star_count_, object_ptr<PaidReactionType> &&type_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , star_count_(star_count_)
  , type_(std::move(type_))
{}

const std::int32_t addPendingPaidMessageReaction::ID;

object_ptr<addPendingPaidMessageReaction> addPendingPaidMessageReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addPendingPaidMessageReaction> res = make_object<addPendingPaidMessageReaction>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->type_ = jni::fetch_tl_object<PaidReactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void addPendingPaidMessageReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddPendingPaidMessageReaction");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("starCount", star_count_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

addPendingPaidMessageReaction::ReturnType addPendingPaidMessageReaction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addPendingPaidMessageReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddPendingPaidMessageReaction").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PaidReactionType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addQuickReplyShortcutInlineQueryResultMessage::Class;
jfieldID addQuickReplyShortcutInlineQueryResultMessage::shortcut_name_fieldID;
jfieldID addQuickReplyShortcutInlineQueryResultMessage::reply_to_message_id_fieldID;
jfieldID addQuickReplyShortcutInlineQueryResultMessage::query_id_fieldID;
jfieldID addQuickReplyShortcutInlineQueryResultMessage::result_id_fieldID;
jfieldID addQuickReplyShortcutInlineQueryResultMessage::hide_via_bot_fieldID;

addQuickReplyShortcutInlineQueryResultMessage::addQuickReplyShortcutInlineQueryResultMessage()
  : shortcut_name_()
  , reply_to_message_id_()
  , query_id_()
  , result_id_()
  , hide_via_bot_()
{}

addQuickReplyShortcutInlineQueryResultMessage::addQuickReplyShortcutInlineQueryResultMessage(string const &shortcut_name_, int53 reply_to_message_id_, int64 query_id_, string const &result_id_, bool hide_via_bot_)
  : shortcut_name_(shortcut_name_)
  , reply_to_message_id_(reply_to_message_id_)
  , query_id_(query_id_)
  , result_id_(result_id_)
  , hide_via_bot_(hide_via_bot_)
{}

const std::int32_t addQuickReplyShortcutInlineQueryResultMessage::ID;

object_ptr<addQuickReplyShortcutInlineQueryResultMessage> addQuickReplyShortcutInlineQueryResultMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addQuickReplyShortcutInlineQueryResultMessage> res = make_object<addQuickReplyShortcutInlineQueryResultMessage>();
  res->shortcut_name_ = jni::fetch_string(env, p, res->shortcut_name_fieldID);
  res->reply_to_message_id_ = env->GetLongField(p, res->reply_to_message_id_fieldID);
  res->query_id_ = env->GetLongField(p, res->query_id_fieldID);
  res->result_id_ = jni::fetch_string(env, p, res->result_id_fieldID);
  res->hide_via_bot_ = (env->GetBooleanField(p, res->hide_via_bot_fieldID) != 0);
  return res;
}

void addQuickReplyShortcutInlineQueryResultMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddQuickReplyShortcutInlineQueryResultMessage");
    s.store_field("shortcutName", shortcut_name_);
    s.store_field("replyToMessageId", reply_to_message_id_);
    s.store_field("queryId", query_id_);
    s.store_field("resultId", result_id_);
    s.store_field("hideViaBot", hide_via_bot_);
    s.store_class_end();
  }
}

addQuickReplyShortcutInlineQueryResultMessage::ReturnType addQuickReplyShortcutInlineQueryResultMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return quickReplyMessage::fetch(env, p);
}

void addQuickReplyShortcutInlineQueryResultMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddQuickReplyShortcutInlineQueryResultMessage").c_str());
    shortcut_name_fieldID = jni::get_field_id(env, Class, "shortcutName", "Ljava/lang/String;");
    reply_to_message_id_fieldID = jni::get_field_id(env, Class, "replyToMessageId", "J");
    query_id_fieldID = jni::get_field_id(env, Class, "queryId", "J");
    result_id_fieldID = jni::get_field_id(env, Class, "resultId", "Ljava/lang/String;");
    hide_via_bot_fieldID = jni::get_field_id(env, Class, "hideViaBot", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass addRecentlyFoundChat::Class;
jfieldID addRecentlyFoundChat::chat_id_fieldID;

addRecentlyFoundChat::addRecentlyFoundChat()
  : chat_id_()
{}

addRecentlyFoundChat::addRecentlyFoundChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t addRecentlyFoundChat::ID;

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

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

addRecentlyFoundChat::ReturnType addRecentlyFoundChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass allowBotToSendMessages::Class;
jfieldID allowBotToSendMessages::bot_user_id_fieldID;

allowBotToSendMessages::allowBotToSendMessages()
  : bot_user_id_()
{}

allowBotToSendMessages::allowBotToSendMessages(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t allowBotToSendMessages::ID;

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

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

allowBotToSendMessages::ReturnType allowBotToSendMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass blockMessageSenderFromReplies::Class;
jfieldID blockMessageSenderFromReplies::message_id_fieldID;
jfieldID blockMessageSenderFromReplies::delete_message_fieldID;
jfieldID blockMessageSenderFromReplies::delete_all_messages_fieldID;
jfieldID blockMessageSenderFromReplies::report_spam_fieldID;

blockMessageSenderFromReplies::blockMessageSenderFromReplies()
  : message_id_()
  , delete_message_()
  , delete_all_messages_()
  , report_spam_()
{}

blockMessageSenderFromReplies::blockMessageSenderFromReplies(int53 message_id_, bool delete_message_, bool delete_all_messages_, bool report_spam_)
  : message_id_(message_id_)
  , delete_message_(delete_message_)
  , delete_all_messages_(delete_all_messages_)
  , report_spam_(report_spam_)
{}

const std::int32_t blockMessageSenderFromReplies::ID;

object_ptr<blockMessageSenderFromReplies> blockMessageSenderFromReplies::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<blockMessageSenderFromReplies> res = make_object<blockMessageSenderFromReplies>();
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->delete_message_ = (env->GetBooleanField(p, res->delete_message_fieldID) != 0);
  res->delete_all_messages_ = (env->GetBooleanField(p, res->delete_all_messages_fieldID) != 0);
  res->report_spam_ = (env->GetBooleanField(p, res->report_spam_fieldID) != 0);
  return res;
}

void blockMessageSenderFromReplies::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BlockMessageSenderFromReplies");
    s.store_field("messageId", message_id_);
    s.store_field("deleteMessage", delete_message_);
    s.store_field("deleteAllMessages", delete_all_messages_);
    s.store_field("reportSpam", report_spam_);
    s.store_class_end();
  }
}

blockMessageSenderFromReplies::ReturnType blockMessageSenderFromReplies::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void blockMessageSenderFromReplies::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BlockMessageSenderFromReplies").c_str());
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    delete_message_fieldID = jni::get_field_id(env, Class, "deleteMessage", "Z");
    delete_all_messages_fieldID = jni::get_field_id(env, Class, "deleteAllMessages", "Z");
    report_spam_fieldID = jni::get_field_id(env, Class, "reportSpam", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass buyGiftUpgrade::Class;
jfieldID buyGiftUpgrade::owner_id_fieldID;
jfieldID buyGiftUpgrade::prepaid_upgrade_hash_fieldID;
jfieldID buyGiftUpgrade::star_count_fieldID;

buyGiftUpgrade::buyGiftUpgrade()
  : owner_id_()
  , prepaid_upgrade_hash_()
  , star_count_()
{}

buyGiftUpgrade::buyGiftUpgrade(object_ptr<MessageSender> &&owner_id_, string const &prepaid_upgrade_hash_, int53 star_count_)
  : owner_id_(std::move(owner_id_))
  , prepaid_upgrade_hash_(prepaid_upgrade_hash_)
  , star_count_(star_count_)
{}

const std::int32_t buyGiftUpgrade::ID;

object_ptr<buyGiftUpgrade> buyGiftUpgrade::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<buyGiftUpgrade> res = make_object<buyGiftUpgrade>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->prepaid_upgrade_hash_ = jni::fetch_string(env, p, res->prepaid_upgrade_hash_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

void buyGiftUpgrade::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BuyGiftUpgrade");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("prepaidUpgradeHash", prepaid_upgrade_hash_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

buyGiftUpgrade::ReturnType buyGiftUpgrade::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void buyGiftUpgrade::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BuyGiftUpgrade").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    prepaid_upgrade_hash_fieldID = jni::get_field_id(env, Class, "prepaidUpgradeHash", "Ljava/lang/String;");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass canBotSendMessages::Class;
jfieldID canBotSendMessages::bot_user_id_fieldID;

canBotSendMessages::canBotSendMessages()
  : bot_user_id_()
{}

canBotSendMessages::canBotSendMessages(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t canBotSendMessages::ID;

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

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

canBotSendMessages::ReturnType canBotSendMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass changeStickerSet::Class;
jfieldID changeStickerSet::set_id_fieldID;
jfieldID changeStickerSet::is_installed_fieldID;
jfieldID changeStickerSet::is_archived_fieldID;

changeStickerSet::changeStickerSet()
  : set_id_()
  , is_installed_()
  , is_archived_()
{}

changeStickerSet::changeStickerSet(int64 set_id_, bool is_installed_, bool is_archived_)
  : set_id_(set_id_)
  , is_installed_(is_installed_)
  , is_archived_(is_archived_)
{}

const std::int32_t changeStickerSet::ID;

object_ptr<changeStickerSet> changeStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<changeStickerSet> res = make_object<changeStickerSet>();
  res->set_id_ = env->GetLongField(p, res->set_id_fieldID);
  res->is_installed_ = (env->GetBooleanField(p, res->is_installed_fieldID) != 0);
  res->is_archived_ = (env->GetBooleanField(p, res->is_archived_fieldID) != 0);
  return res;
}

void changeStickerSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChangeStickerSet");
    s.store_field("setId", set_id_);
    s.store_field("isInstalled", is_installed_);
    s.store_field("isArchived", is_archived_);
    s.store_class_end();
  }
}

changeStickerSet::ReturnType changeStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void changeStickerSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChangeStickerSet").c_str());
    set_id_fieldID = jni::get_field_id(env, Class, "setId", "J");
    is_installed_fieldID = jni::get_field_id(env, Class, "isInstalled", "Z");
    is_archived_fieldID = jni::get_field_id(env, Class, "isArchived", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass checkChatInviteLink::Class;
jfieldID checkChatInviteLink::invite_link_fieldID;

checkChatInviteLink::checkChatInviteLink()
  : invite_link_()
{}

checkChatInviteLink::checkChatInviteLink(string const &invite_link_)
  : invite_link_(invite_link_)
{}

const std::int32_t checkChatInviteLink::ID;

object_ptr<checkChatInviteLink> checkChatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkChatInviteLink> res = make_object<checkChatInviteLink>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return res;
}

void checkChatInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckChatInviteLink");
    s.store_field("inviteLink", invite_link_);
    s.store_class_end();
  }
}

checkChatInviteLink::ReturnType checkChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLinkInfo::fetch(env, p);
}

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

jclass checkPhoneNumberCode::Class;
jfieldID checkPhoneNumberCode::code_fieldID;

checkPhoneNumberCode::checkPhoneNumberCode()
  : code_()
{}

checkPhoneNumberCode::checkPhoneNumberCode(string const &code_)
  : code_(code_)
{}

const std::int32_t checkPhoneNumberCode::ID;

object_ptr<checkPhoneNumberCode> checkPhoneNumberCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkPhoneNumberCode> res = make_object<checkPhoneNumberCode>();
  res->code_ = jni::fetch_string(env, p, res->code_fieldID);
  return res;
}

void checkPhoneNumberCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckPhoneNumberCode");
    s.store_field("code", code_);
    s.store_class_end();
  }
}

checkPhoneNumberCode::ReturnType checkPhoneNumberCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clearRecentReactions::Class;

clearRecentReactions::clearRecentReactions() {
}

const std::int32_t clearRecentReactions::ID;

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

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

clearRecentReactions::ReturnType clearRecentReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass closeWebApp::Class;
jfieldID closeWebApp::web_app_launch_id_fieldID;

closeWebApp::closeWebApp()
  : web_app_launch_id_()
{}

closeWebApp::closeWebApp(int64 web_app_launch_id_)
  : web_app_launch_id_(web_app_launch_id_)
{}

const std::int32_t closeWebApp::ID;

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

void closeWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CloseWebApp");
    s.store_field("webAppLaunchId", web_app_launch_id_);
    s.store_class_end();
  }
}

closeWebApp::ReturnType closeWebApp::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass commitPendingPaidMessageReactions::Class;
jfieldID commitPendingPaidMessageReactions::chat_id_fieldID;
jfieldID commitPendingPaidMessageReactions::message_id_fieldID;

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

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

const std::int32_t commitPendingPaidMessageReactions::ID;

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

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

commitPendingPaidMessageReactions::ReturnType commitPendingPaidMessageReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

connectAffiliateProgram::connectAffiliateProgram()
  : affiliate_()
  , bot_user_id_()
{}

connectAffiliateProgram::connectAffiliateProgram(object_ptr<AffiliateType> &&affiliate_, int53 bot_user_id_)
  : affiliate_(std::move(affiliate_))
  , bot_user_id_(bot_user_id_)
{}

const std::int32_t connectAffiliateProgram::ID;

object_ptr<connectAffiliateProgram> connectAffiliateProgram::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<connectAffiliateProgram> res = make_object<connectAffiliateProgram>();
  res->affiliate_ = jni::fetch_tl_object<AffiliateType>(env, jni::fetch_object(env, p, res->affiliate_fieldID));
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  return res;
}

void connectAffiliateProgram::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectAffiliateProgram");
    s.store_object_field("affiliate", static_cast<const BaseObject *>(affiliate_.get()));
    s.store_field("botUserId", bot_user_id_);
    s.store_class_end();
  }
}

connectAffiliateProgram::ReturnType connectAffiliateProgram::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return connectedAffiliateProgram::fetch(env, p);
}

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

jclass createChatFolder::Class;
jfieldID createChatFolder::folder_fieldID;

createChatFolder::createChatFolder()
  : folder_()
{}

createChatFolder::createChatFolder(object_ptr<chatFolder> &&folder_)
  : folder_(std::move(folder_))
{}

const std::int32_t createChatFolder::ID;

object_ptr<createChatFolder> createChatFolder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createChatFolder> res = make_object<createChatFolder>();
  res->folder_ = jni::fetch_tl_object<chatFolder>(env, jni::fetch_object(env, p, res->folder_fieldID));
  return res;
}

void createChatFolder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateChatFolder");
    s.store_object_field("folder", static_cast<const BaseObject *>(folder_.get()));
    s.store_class_end();
  }
}

createChatFolder::ReturnType createChatFolder::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderInfo::fetch(env, p);
}

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

jclass createChatSubscriptionInviteLink::Class;
jfieldID createChatSubscriptionInviteLink::chat_id_fieldID;
jfieldID createChatSubscriptionInviteLink::name_fieldID;
jfieldID createChatSubscriptionInviteLink::subscription_pricing_fieldID;

createChatSubscriptionInviteLink::createChatSubscriptionInviteLink()
  : chat_id_()
  , name_()
  , subscription_pricing_()
{}

createChatSubscriptionInviteLink::createChatSubscriptionInviteLink(int53 chat_id_, string const &name_, object_ptr<starSubscriptionPricing> &&subscription_pricing_)
  : chat_id_(chat_id_)
  , name_(name_)
  , subscription_pricing_(std::move(subscription_pricing_))
{}

const std::int32_t createChatSubscriptionInviteLink::ID;

object_ptr<createChatSubscriptionInviteLink> createChatSubscriptionInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createChatSubscriptionInviteLink> res = make_object<createChatSubscriptionInviteLink>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->subscription_pricing_ = jni::fetch_tl_object<starSubscriptionPricing>(env, jni::fetch_object(env, p, res->subscription_pricing_fieldID));
  return res;
}

void createChatSubscriptionInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateChatSubscriptionInviteLink");
    s.store_field("chatId", chat_id_);
    s.store_field("name", name_);
    s.store_object_field("subscriptionPricing", static_cast<const BaseObject *>(subscription_pricing_.get()));
    s.store_class_end();
  }
}

createChatSubscriptionInviteLink::ReturnType createChatSubscriptionInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLink::fetch(env, p);
}

void createChatSubscriptionInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateChatSubscriptionInviteLink").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    subscription_pricing_fieldID = jni::get_field_id(env, Class, "subscriptionPricing", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarSubscriptionPricing;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass createGiftCollection::Class;
jfieldID createGiftCollection::owner_id_fieldID;
jfieldID createGiftCollection::name_fieldID;
jfieldID createGiftCollection::received_gift_ids_fieldID;

createGiftCollection::createGiftCollection()
  : owner_id_()
  , name_()
  , received_gift_ids_()
{}

createGiftCollection::createGiftCollection(object_ptr<MessageSender> &&owner_id_, string const &name_, array<string> &&received_gift_ids_)
  : owner_id_(std::move(owner_id_))
  , name_(name_)
  , received_gift_ids_(std::move(received_gift_ids_))
{}

const std::int32_t createGiftCollection::ID;

object_ptr<createGiftCollection> createGiftCollection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createGiftCollection> res = make_object<createGiftCollection>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->received_gift_ids_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->received_gift_ids_fieldID));
  return res;
}

void createGiftCollection::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateGiftCollection");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("name", name_);
    { s.store_vector_begin("receivedGiftIds", received_gift_ids_.size()); for (const auto &_value : received_gift_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

createGiftCollection::ReturnType createGiftCollection::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftCollection::fetch(env, p);
}

void createGiftCollection::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateGiftCollection").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    received_gift_ids_fieldID = jni::get_field_id(env, Class, "receivedGiftIds", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass createNewBasicGroupChat::Class;
jfieldID createNewBasicGroupChat::user_ids_fieldID;
jfieldID createNewBasicGroupChat::title_fieldID;
jfieldID createNewBasicGroupChat::message_auto_delete_time_fieldID;

createNewBasicGroupChat::createNewBasicGroupChat()
  : user_ids_()
  , title_()
  , message_auto_delete_time_()
{}

createNewBasicGroupChat::createNewBasicGroupChat(array<int53> &&user_ids_, string const &title_, int32 message_auto_delete_time_)
  : user_ids_(std::move(user_ids_))
  , title_(title_)
  , message_auto_delete_time_(message_auto_delete_time_)
{}

const std::int32_t createNewBasicGroupChat::ID;

object_ptr<createNewBasicGroupChat> createNewBasicGroupChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createNewBasicGroupChat> res = make_object<createNewBasicGroupChat>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->message_auto_delete_time_ = env->GetIntField(p, res->message_auto_delete_time_fieldID);
  return res;
}

void createNewBasicGroupChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateNewBasicGroupChat");
    { s.store_vector_begin("userIds", user_ids_.size()); for (const auto &_value : user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("title", title_);
    s.store_field("messageAutoDeleteTime", message_auto_delete_time_);
    s.store_class_end();
  }
}

createNewBasicGroupChat::ReturnType createNewBasicGroupChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return createdBasicGroupChat::fetch(env, p);
}

void createNewBasicGroupChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateNewBasicGroupChat").c_str());
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    message_auto_delete_time_fieldID = jni::get_field_id(env, Class, "messageAutoDeleteTime", "I");
    return true;
  }();
  (void)is_inited;
}

jclass createTemporaryPassword::Class;
jfieldID createTemporaryPassword::password_fieldID;
jfieldID createTemporaryPassword::valid_for_fieldID;

createTemporaryPassword::createTemporaryPassword()
  : password_()
  , valid_for_()
{}

createTemporaryPassword::createTemporaryPassword(string const &password_, int32 valid_for_)
  : password_(password_)
  , valid_for_(valid_for_)
{}

const std::int32_t createTemporaryPassword::ID;

object_ptr<createTemporaryPassword> createTemporaryPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createTemporaryPassword> res = make_object<createTemporaryPassword>();
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  res->valid_for_ = env->GetIntField(p, res->valid_for_fieldID);
  return res;
}

void createTemporaryPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateTemporaryPassword");
    s.store_field("password", password_);
    s.store_field("validFor", valid_for_);
    s.store_class_end();
  }
}

createTemporaryPassword::ReturnType createTemporaryPassword::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return temporaryPasswordState::fetch(env, p);
}

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

jclass declineSuggestedPost::Class;
jfieldID declineSuggestedPost::chat_id_fieldID;
jfieldID declineSuggestedPost::message_id_fieldID;
jfieldID declineSuggestedPost::comment_fieldID;

declineSuggestedPost::declineSuggestedPost()
  : chat_id_()
  , message_id_()
  , comment_()
{}

declineSuggestedPost::declineSuggestedPost(int53 chat_id_, int53 message_id_, string const &comment_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , comment_(comment_)
{}

const std::int32_t declineSuggestedPost::ID;

object_ptr<declineSuggestedPost> declineSuggestedPost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<declineSuggestedPost> res = make_object<declineSuggestedPost>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->comment_ = jni::fetch_string(env, p, res->comment_fieldID);
  return res;
}

void declineSuggestedPost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeclineSuggestedPost");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("comment", comment_);
    s.store_class_end();
  }
}

declineSuggestedPost::ReturnType declineSuggestedPost::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void declineSuggestedPost::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeclineSuggestedPost").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    comment_fieldID = jni::get_field_id(env, Class, "comment", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass deleteChatMessagesBySender::Class;
jfieldID deleteChatMessagesBySender::chat_id_fieldID;
jfieldID deleteChatMessagesBySender::sender_id_fieldID;

deleteChatMessagesBySender::deleteChatMessagesBySender()
  : chat_id_()
  , sender_id_()
{}

deleteChatMessagesBySender::deleteChatMessagesBySender(int53 chat_id_, object_ptr<MessageSender> &&sender_id_)
  : chat_id_(chat_id_)
  , sender_id_(std::move(sender_id_))
{}

const std::int32_t deleteChatMessagesBySender::ID;

object_ptr<deleteChatMessagesBySender> deleteChatMessagesBySender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteChatMessagesBySender> res = make_object<deleteChatMessagesBySender>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  return res;
}

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

deleteChatMessagesBySender::ReturnType deleteChatMessagesBySender::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteGroupCallMessages::Class;
jfieldID deleteGroupCallMessages::group_call_id_fieldID;
jfieldID deleteGroupCallMessages::message_ids_fieldID;
jfieldID deleteGroupCallMessages::report_spam_fieldID;

deleteGroupCallMessages::deleteGroupCallMessages()
  : group_call_id_()
  , message_ids_()
  , report_spam_()
{}

deleteGroupCallMessages::deleteGroupCallMessages(int32 group_call_id_, array<int32> &&message_ids_, bool report_spam_)
  : group_call_id_(group_call_id_)
  , message_ids_(std::move(message_ids_))
  , report_spam_(report_spam_)
{}

const std::int32_t deleteGroupCallMessages::ID;

object_ptr<deleteGroupCallMessages> deleteGroupCallMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteGroupCallMessages> res = make_object<deleteGroupCallMessages>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  res->report_spam_ = (env->GetBooleanField(p, res->report_spam_fieldID) != 0);
  return res;
}

void deleteGroupCallMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteGroupCallMessages");
    s.store_field("groupCallId", group_call_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("reportSpam", report_spam_);
    s.store_class_end();
  }
}

deleteGroupCallMessages::ReturnType deleteGroupCallMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteGroupCallMessagesBySender::Class;
jfieldID deleteGroupCallMessagesBySender::group_call_id_fieldID;
jfieldID deleteGroupCallMessagesBySender::sender_id_fieldID;
jfieldID deleteGroupCallMessagesBySender::report_spam_fieldID;

deleteGroupCallMessagesBySender::deleteGroupCallMessagesBySender()
  : group_call_id_()
  , sender_id_()
  , report_spam_()
{}

deleteGroupCallMessagesBySender::deleteGroupCallMessagesBySender(int32 group_call_id_, object_ptr<MessageSender> &&sender_id_, bool report_spam_)
  : group_call_id_(group_call_id_)
  , sender_id_(std::move(sender_id_))
  , report_spam_(report_spam_)
{}

const std::int32_t deleteGroupCallMessagesBySender::ID;

object_ptr<deleteGroupCallMessagesBySender> deleteGroupCallMessagesBySender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteGroupCallMessagesBySender> res = make_object<deleteGroupCallMessagesBySender>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->report_spam_ = (env->GetBooleanField(p, res->report_spam_fieldID) != 0);
  return res;
}

void deleteGroupCallMessagesBySender::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteGroupCallMessagesBySender");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("reportSpam", report_spam_);
    s.store_class_end();
  }
}

deleteGroupCallMessagesBySender::ReturnType deleteGroupCallMessagesBySender::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteGroupCallMessagesBySender::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteGroupCallMessagesBySender").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    report_spam_fieldID = jni::get_field_id(env, Class, "reportSpam", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass deleteLanguagePack::Class;
jfieldID deleteLanguagePack::language_pack_id_fieldID;

deleteLanguagePack::deleteLanguagePack()
  : language_pack_id_()
{}

deleteLanguagePack::deleteLanguagePack(string const &language_pack_id_)
  : language_pack_id_(language_pack_id_)
{}

const std::int32_t deleteLanguagePack::ID;

object_ptr<deleteLanguagePack> deleteLanguagePack::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteLanguagePack> res = make_object<deleteLanguagePack>();
  res->language_pack_id_ = jni::fetch_string(env, p, res->language_pack_id_fieldID);
  return res;
}

void deleteLanguagePack::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteLanguagePack");
    s.store_field("languagePackId", language_pack_id_);
    s.store_class_end();
  }
}

deleteLanguagePack::ReturnType deleteLanguagePack::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass downloadFile::Class;
jfieldID downloadFile::file_id_fieldID;
jfieldID downloadFile::priority_fieldID;
jfieldID downloadFile::offset_fieldID;
jfieldID downloadFile::limit_fieldID;
jfieldID downloadFile::synchronous_fieldID;

downloadFile::downloadFile()
  : file_id_()
  , priority_()
  , offset_()
  , limit_()
  , synchronous_()
{}

downloadFile::downloadFile(int32 file_id_, int32 priority_, int53 offset_, int53 limit_, bool synchronous_)
  : file_id_(file_id_)
  , priority_(priority_)
  , offset_(offset_)
  , limit_(limit_)
  , synchronous_(synchronous_)
{}

const std::int32_t downloadFile::ID;

object_ptr<downloadFile> downloadFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<downloadFile> res = make_object<downloadFile>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->priority_ = env->GetIntField(p, res->priority_fieldID);
  res->offset_ = env->GetLongField(p, res->offset_fieldID);
  res->limit_ = env->GetLongField(p, res->limit_fieldID);
  res->synchronous_ = (env->GetBooleanField(p, res->synchronous_fieldID) != 0);
  return res;
}

void downloadFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DownloadFile");
    s.store_field("fileId", file_id_);
    s.store_field("priority", priority_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_field("synchronous", synchronous_);
    s.store_class_end();
  }
}

downloadFile::ReturnType downloadFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return file::fetch(env, p);
}

void downloadFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DownloadFile").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    priority_fieldID = jni::get_field_id(env, Class, "priority", "I");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "J");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "J");
    synchronous_fieldID = jni::get_field_id(env, Class, "synchronous", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass editBusinessMessageLiveLocation::Class;
jfieldID editBusinessMessageLiveLocation::business_connection_id_fieldID;
jfieldID editBusinessMessageLiveLocation::chat_id_fieldID;
jfieldID editBusinessMessageLiveLocation::message_id_fieldID;
jfieldID editBusinessMessageLiveLocation::reply_markup_fieldID;
jfieldID editBusinessMessageLiveLocation::location_fieldID;
jfieldID editBusinessMessageLiveLocation::live_period_fieldID;
jfieldID editBusinessMessageLiveLocation::heading_fieldID;
jfieldID editBusinessMessageLiveLocation::proximity_alert_radius_fieldID;

editBusinessMessageLiveLocation::editBusinessMessageLiveLocation()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
  , location_()
  , live_period_()
  , heading_()
  , proximity_alert_radius_()
{}

editBusinessMessageLiveLocation::editBusinessMessageLiveLocation(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<location> &&location_, int32 live_period_, int32 heading_, int32 proximity_alert_radius_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , location_(std::move(location_))
  , live_period_(live_period_)
  , heading_(heading_)
  , proximity_alert_radius_(proximity_alert_radius_)
{}

const std::int32_t editBusinessMessageLiveLocation::ID;

object_ptr<editBusinessMessageLiveLocation> editBusinessMessageLiveLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessMessageLiveLocation> res = make_object<editBusinessMessageLiveLocation>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->live_period_ = env->GetIntField(p, res->live_period_fieldID);
  res->heading_ = env->GetIntField(p, res->heading_fieldID);
  res->proximity_alert_radius_ = env->GetIntField(p, res->proximity_alert_radius_fieldID);
  return res;
}

void editBusinessMessageLiveLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessMessageLiveLocation");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("livePeriod", live_period_);
    s.store_field("heading", heading_);
    s.store_field("proximityAlertRadius", proximity_alert_radius_);
    s.store_class_end();
  }
}

editBusinessMessageLiveLocation::ReturnType editBusinessMessageLiveLocation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void editBusinessMessageLiveLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessMessageLiveLocation").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    live_period_fieldID = jni::get_field_id(env, Class, "livePeriod", "I");
    heading_fieldID = jni::get_field_id(env, Class, "heading", "I");
    proximity_alert_radius_fieldID = jni::get_field_id(env, Class, "proximityAlertRadius", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getBotInfoShortDescription::Class;
jfieldID getBotInfoShortDescription::bot_user_id_fieldID;
jfieldID getBotInfoShortDescription::language_code_fieldID;

getBotInfoShortDescription::getBotInfoShortDescription()
  : bot_user_id_()
  , language_code_()
{}

getBotInfoShortDescription::getBotInfoShortDescription(int53 bot_user_id_, string const &language_code_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
{}

const std::int32_t getBotInfoShortDescription::ID;

object_ptr<getBotInfoShortDescription> getBotInfoShortDescription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotInfoShortDescription> res = make_object<getBotInfoShortDescription>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  return res;
}

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

getBotInfoShortDescription::ReturnType getBotInfoShortDescription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getChatBoostFeatures::Class;
jfieldID getChatBoostFeatures::is_channel_fieldID;

getChatBoostFeatures::getChatBoostFeatures()
  : is_channel_()
{}

getChatBoostFeatures::getChatBoostFeatures(bool is_channel_)
  : is_channel_(is_channel_)
{}

const std::int32_t getChatBoostFeatures::ID;

object_ptr<getChatBoostFeatures> getChatBoostFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatBoostFeatures> res = make_object<getChatBoostFeatures>();
  res->is_channel_ = (env->GetBooleanField(p, res->is_channel_fieldID) != 0);
  return res;
}

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

getChatBoostFeatures::ReturnType getChatBoostFeatures::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostFeatures::fetch(env, p);
}

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

jclass getChatFolderChatCount::Class;
jfieldID getChatFolderChatCount::folder_fieldID;

getChatFolderChatCount::getChatFolderChatCount()
  : folder_()
{}

getChatFolderChatCount::getChatFolderChatCount(object_ptr<chatFolder> &&folder_)
  : folder_(std::move(folder_))
{}

const std::int32_t getChatFolderChatCount::ID;

object_ptr<getChatFolderChatCount> getChatFolderChatCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatFolderChatCount> res = make_object<getChatFolderChatCount>();
  res->folder_ = jni::fetch_tl_object<chatFolder>(env, jni::fetch_object(env, p, res->folder_fieldID));
  return res;
}

void getChatFolderChatCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatFolderChatCount");
    s.store_object_field("folder", static_cast<const BaseObject *>(folder_.get()));
    s.store_class_end();
  }
}

getChatFolderChatCount::ReturnType getChatFolderChatCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return count::fetch(env, p);
}

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

jclass getChatHistory::Class;
jfieldID getChatHistory::chat_id_fieldID;
jfieldID getChatHistory::from_message_id_fieldID;
jfieldID getChatHistory::offset_fieldID;
jfieldID getChatHistory::limit_fieldID;
jfieldID getChatHistory::only_local_fieldID;

getChatHistory::getChatHistory()
  : chat_id_()
  , from_message_id_()
  , offset_()
  , limit_()
  , only_local_()
{}

getChatHistory::getChatHistory(int53 chat_id_, int53 from_message_id_, int32 offset_, int32 limit_, bool only_local_)
  : chat_id_(chat_id_)
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
  , only_local_(only_local_)
{}

const std::int32_t getChatHistory::ID;

object_ptr<getChatHistory> getChatHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatHistory> res = make_object<getChatHistory>();
  res->chat_id_ = env->GetLongField(p, res->chat_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);
  res->only_local_ = (env->GetBooleanField(p, res->only_local_fieldID) != 0);
  return res;
}

void getChatHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatHistory");
    s.store_field("chatId", chat_id_);
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_field("onlyLocal", only_local_);
    s.store_class_end();
  }
}

getChatHistory::ReturnType getChatHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void getChatHistory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatHistory").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "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");
    only_local_fieldID = jni::get_field_id(env, Class, "onlyLocal", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getChatMessageCount::Class;
jfieldID getChatMessageCount::chat_id_fieldID;
jfieldID getChatMessageCount::topic_id_fieldID;
jfieldID getChatMessageCount::filter_fieldID;
jfieldID getChatMessageCount::return_local_fieldID;

getChatMessageCount::getChatMessageCount()
  : chat_id_()
  , topic_id_()
  , filter_()
  , return_local_()
{}

getChatMessageCount::getChatMessageCount(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<SearchMessagesFilter> &&filter_, bool return_local_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , filter_(std::move(filter_))
  , return_local_(return_local_)
{}

const std::int32_t getChatMessageCount::ID;

object_ptr<getChatMessageCount> getChatMessageCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatMessageCount> res = make_object<getChatMessageCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  res->return_local_ = (env->GetBooleanField(p, res->return_local_fieldID) != 0);
  return res;
}

void getChatMessageCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatMessageCount");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_field("returnLocal", return_local_);
    s.store_class_end();
  }
}

getChatMessageCount::ReturnType getChatMessageCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return count::fetch(env, p);
}

void getChatMessageCount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatMessageCount").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesFilter;").c_str());
    return_local_fieldID = jni::get_field_id(env, Class, "returnLocal", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getChatRevenueTransactions::Class;
jfieldID getChatRevenueTransactions::chat_id_fieldID;
jfieldID getChatRevenueTransactions::offset_fieldID;
jfieldID getChatRevenueTransactions::limit_fieldID;

getChatRevenueTransactions::getChatRevenueTransactions()
  : chat_id_()
  , offset_()
  , limit_()
{}

getChatRevenueTransactions::getChatRevenueTransactions(int53 chat_id_, string const &offset_, int32 limit_)
  : chat_id_(chat_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getChatRevenueTransactions::ID;

object_ptr<getChatRevenueTransactions> getChatRevenueTransactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatRevenueTransactions> res = make_object<getChatRevenueTransactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatRevenueTransactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatRevenueTransactions");
    s.store_field("chatId", chat_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatRevenueTransactions::ReturnType getChatRevenueTransactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatRevenueTransactions::fetch(env, p);
}

void getChatRevenueTransactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatRevenueTransactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    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 getChatRevenueWithdrawalUrl::Class;
jfieldID getChatRevenueWithdrawalUrl::chat_id_fieldID;
jfieldID getChatRevenueWithdrawalUrl::password_fieldID;

getChatRevenueWithdrawalUrl::getChatRevenueWithdrawalUrl()
  : chat_id_()
  , password_()
{}

getChatRevenueWithdrawalUrl::getChatRevenueWithdrawalUrl(int53 chat_id_, string const &password_)
  : chat_id_(chat_id_)
  , password_(password_)
{}

const std::int32_t getChatRevenueWithdrawalUrl::ID;

object_ptr<getChatRevenueWithdrawalUrl> getChatRevenueWithdrawalUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatRevenueWithdrawalUrl> res = make_object<getChatRevenueWithdrawalUrl>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

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

getChatRevenueWithdrawalUrl::ReturnType getChatRevenueWithdrawalUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass getChatSparseMessagePositions::Class;
jfieldID getChatSparseMessagePositions::chat_id_fieldID;
jfieldID getChatSparseMessagePositions::filter_fieldID;
jfieldID getChatSparseMessagePositions::from_message_id_fieldID;
jfieldID getChatSparseMessagePositions::limit_fieldID;
jfieldID getChatSparseMessagePositions::saved_messages_topic_id_fieldID;

getChatSparseMessagePositions::getChatSparseMessagePositions()
  : chat_id_()
  , filter_()
  , from_message_id_()
  , limit_()
  , saved_messages_topic_id_()
{}

getChatSparseMessagePositions::getChatSparseMessagePositions(int53 chat_id_, object_ptr<SearchMessagesFilter> &&filter_, int53 from_message_id_, int32 limit_, int53 saved_messages_topic_id_)
  : chat_id_(chat_id_)
  , filter_(std::move(filter_))
  , from_message_id_(from_message_id_)
  , limit_(limit_)
  , saved_messages_topic_id_(saved_messages_topic_id_)
{}

const std::int32_t getChatSparseMessagePositions::ID;

object_ptr<getChatSparseMessagePositions> getChatSparseMessagePositions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatSparseMessagePositions> res = make_object<getChatSparseMessagePositions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  return res;
}

void getChatSparseMessagePositions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatSparseMessagePositions");
    s.store_field("chatId", chat_id_);
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("limit", limit_);
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_class_end();
  }
}

getChatSparseMessagePositions::ReturnType getChatSparseMessagePositions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messagePositions::fetch(env, p);
}

void getChatSparseMessagePositions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatSparseMessagePositions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesFilter;").c_str());
    from_message_id_fieldID = jni::get_field_id(env, Class, "fromMessageId", "J");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    saved_messages_topic_id_fieldID = jni::get_field_id(env, Class, "savedMessagesTopicId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass getCollectibleItemInfo::Class;
jfieldID getCollectibleItemInfo::type_fieldID;

getCollectibleItemInfo::getCollectibleItemInfo()
  : type_()
{}

getCollectibleItemInfo::getCollectibleItemInfo(object_ptr<CollectibleItemType> &&type_)
  : type_(std::move(type_))
{}

const std::int32_t getCollectibleItemInfo::ID;

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

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

getCollectibleItemInfo::ReturnType getCollectibleItemInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return collectibleItemInfo::fetch(env, p);
}

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

jclass getCommands::Class;
jfieldID getCommands::scope_fieldID;
jfieldID getCommands::language_code_fieldID;

getCommands::getCommands()
  : scope_()
  , language_code_()
{}

getCommands::getCommands(object_ptr<BotCommandScope> &&scope_, string const &language_code_)
  : scope_(std::move(scope_))
  , language_code_(language_code_)
{}

const std::int32_t getCommands::ID;

object_ptr<getCommands> getCommands::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getCommands> res = make_object<getCommands>();
  res->scope_ = jni::fetch_tl_object<BotCommandScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  return res;
}

void getCommands::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetCommands");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_field("languageCode", language_code_);
    s.store_class_end();
  }
}

getCommands::ReturnType getCommands::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botCommands::fetch(env, p);
}

void getCommands::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetCommands").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotCommandScope;").c_str());
    language_code_fieldID = jni::get_field_id(env, Class, "languageCode", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getCreatedPublicChats::Class;
jfieldID getCreatedPublicChats::type_fieldID;

getCreatedPublicChats::getCreatedPublicChats()
  : type_()
{}

getCreatedPublicChats::getCreatedPublicChats(object_ptr<PublicChatType> &&type_)
  : type_(std::move(type_))
{}

const std::int32_t getCreatedPublicChats::ID;

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

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

getCreatedPublicChats::ReturnType getCreatedPublicChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getEmojiReaction::Class;
jfieldID getEmojiReaction::emoji_fieldID;

getEmojiReaction::getEmojiReaction()
  : emoji_()
{}

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

const std::int32_t getEmojiReaction::ID;

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

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

getEmojiReaction::ReturnType getEmojiReaction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiReaction::fetch(env, p);
}

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

jclass getFileMimeType::Class;
jfieldID getFileMimeType::file_name_fieldID;

getFileMimeType::getFileMimeType()
  : file_name_()
{}

getFileMimeType::getFileMimeType(string const &file_name_)
  : file_name_(file_name_)
{}

const std::int32_t getFileMimeType::ID;

object_ptr<getFileMimeType> getFileMimeType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getFileMimeType> res = make_object<getFileMimeType>();
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  return res;
}

void getFileMimeType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetFileMimeType");
    s.store_field("fileName", file_name_);
    s.store_class_end();
  }
}

getFileMimeType::ReturnType getFileMimeType::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getGreetingStickers::Class;

getGreetingStickers::getGreetingStickers() {
}

const std::int32_t getGreetingStickers::ID;

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

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

getGreetingStickers::ReturnType getGreetingStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getGroupCall::Class;
jfieldID getGroupCall::group_call_id_fieldID;

getGroupCall::getGroupCall()
  : group_call_id_()
{}

getGroupCall::getGroupCall(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t getGroupCall::ID;

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

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

getGroupCall::ReturnType getGroupCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return groupCall::fetch(env, p);
}

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

jclass getLogTags::Class;

getLogTags::getLogTags() {
}

const std::int32_t getLogTags::ID;

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

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

getLogTags::ReturnType getLogTags::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return logTags::fetch(env, p);
}

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

jclass getMessageLinkInfo::Class;
jfieldID getMessageLinkInfo::url_fieldID;

getMessageLinkInfo::getMessageLinkInfo()
  : url_()
{}

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

const std::int32_t getMessageLinkInfo::ID;

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

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

getMessageLinkInfo::ReturnType getMessageLinkInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageLinkInfo::fetch(env, p);
}

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

jclass getMessagePublicForwards::Class;
jfieldID getMessagePublicForwards::chat_id_fieldID;
jfieldID getMessagePublicForwards::message_id_fieldID;
jfieldID getMessagePublicForwards::offset_fieldID;
jfieldID getMessagePublicForwards::limit_fieldID;

getMessagePublicForwards::getMessagePublicForwards()
  : chat_id_()
  , message_id_()
  , offset_()
  , limit_()
{}

getMessagePublicForwards::getMessagePublicForwards(int53 chat_id_, int53 message_id_, string const &offset_, int32 limit_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getMessagePublicForwards::ID;

object_ptr<getMessagePublicForwards> getMessagePublicForwards::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessagePublicForwards> res = make_object<getMessagePublicForwards>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getMessagePublicForwards::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessagePublicForwards");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getMessagePublicForwards::ReturnType getMessagePublicForwards::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return publicForwards::fetch(env, p);
}

void getMessagePublicForwards::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessagePublicForwards").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    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 getOption::Class;
jfieldID getOption::name_fieldID;

getOption::getOption()
  : name_()
{}

getOption::getOption(string const &name_)
  : name_(name_)
{}

const std::int32_t getOption::ID;

object_ptr<getOption> getOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getOption> res = make_object<getOption>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

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

getOption::ReturnType getOption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return OptionValue::fetch(env, p);
}

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

jclass getPaymentForm::Class;
jfieldID getPaymentForm::input_invoice_fieldID;
jfieldID getPaymentForm::theme_fieldID;

getPaymentForm::getPaymentForm()
  : input_invoice_()
  , theme_()
{}

getPaymentForm::getPaymentForm(object_ptr<InputInvoice> &&input_invoice_, object_ptr<themeParameters> &&theme_)
  : input_invoice_(std::move(input_invoice_))
  , theme_(std::move(theme_))
{}

const std::int32_t getPaymentForm::ID;

object_ptr<getPaymentForm> getPaymentForm::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPaymentForm> res = make_object<getPaymentForm>();
  res->input_invoice_ = jni::fetch_tl_object<InputInvoice>(env, jni::fetch_object(env, p, res->input_invoice_fieldID));
  res->theme_ = jni::fetch_tl_object<themeParameters>(env, jni::fetch_object(env, p, res->theme_fieldID));
  return res;
}

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

getPaymentForm::ReturnType getPaymentForm::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return paymentForm::fetch(env, p);
}

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

jclass getPollOptionProperties::Class;
jfieldID getPollOptionProperties::chat_id_fieldID;
jfieldID getPollOptionProperties::message_id_fieldID;
jfieldID getPollOptionProperties::poll_option_id_fieldID;

getPollOptionProperties::getPollOptionProperties()
  : chat_id_()
  , message_id_()
  , poll_option_id_()
{}

getPollOptionProperties::getPollOptionProperties(int53 chat_id_, int53 message_id_, string const &poll_option_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , poll_option_id_(poll_option_id_)
{}

const std::int32_t getPollOptionProperties::ID;

object_ptr<getPollOptionProperties> getPollOptionProperties::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPollOptionProperties> res = make_object<getPollOptionProperties>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->poll_option_id_ = jni::fetch_string(env, p, res->poll_option_id_fieldID);
  return res;
}

void getPollOptionProperties::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPollOptionProperties");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("pollOptionId", poll_option_id_);
    s.store_class_end();
  }
}

getPollOptionProperties::ReturnType getPollOptionProperties::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return pollOptionProperties::fetch(env, p);
}

void getPollOptionProperties::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetPollOptionProperties").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    poll_option_id_fieldID = jni::get_field_id(env, Class, "pollOptionId", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getPreferredCountryLanguage::Class;
jfieldID getPreferredCountryLanguage::country_code_fieldID;

getPreferredCountryLanguage::getPreferredCountryLanguage()
  : country_code_()
{}

getPreferredCountryLanguage::getPreferredCountryLanguage(string const &country_code_)
  : country_code_(country_code_)
{}

const std::int32_t getPreferredCountryLanguage::ID;

object_ptr<getPreferredCountryLanguage> getPreferredCountryLanguage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPreferredCountryLanguage> res = make_object<getPreferredCountryLanguage>();
  res->country_code_ = jni::fetch_string(env, p, res->country_code_fieldID);
  return res;
}

void getPreferredCountryLanguage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPreferredCountryLanguage");
    s.store_field("countryCode", country_code_);
    s.store_class_end();
  }
}

getPreferredCountryLanguage::ReturnType getPreferredCountryLanguage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getPreparedKeyboardButton::Class;
jfieldID getPreparedKeyboardButton::bot_user_id_fieldID;
jfieldID getPreparedKeyboardButton::prepared_button_id_fieldID;

getPreparedKeyboardButton::getPreparedKeyboardButton()
  : bot_user_id_()
  , prepared_button_id_()
{}

getPreparedKeyboardButton::getPreparedKeyboardButton(int53 bot_user_id_, string const &prepared_button_id_)
  : bot_user_id_(bot_user_id_)
  , prepared_button_id_(prepared_button_id_)
{}

const std::int32_t getPreparedKeyboardButton::ID;

object_ptr<getPreparedKeyboardButton> getPreparedKeyboardButton::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPreparedKeyboardButton> res = make_object<getPreparedKeyboardButton>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->prepared_button_id_ = jni::fetch_string(env, p, res->prepared_button_id_fieldID);
  return res;
}

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

getPreparedKeyboardButton::ReturnType getPreparedKeyboardButton::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return keyboardButton::fetch(env, p);
}

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

jclass getProxies::Class;

getProxies::getProxies() {
}

const std::int32_t getProxies::ID;

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

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

getProxies::ReturnType getProxies::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return addedProxies::fetch(env, p);
}

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

jclass getReceivedGifts::Class;
jfieldID getReceivedGifts::business_connection_id_fieldID;
jfieldID getReceivedGifts::owner_id_fieldID;
jfieldID getReceivedGifts::collection_id_fieldID;
jfieldID getReceivedGifts::exclude_unsaved_fieldID;
jfieldID getReceivedGifts::exclude_saved_fieldID;
jfieldID getReceivedGifts::exclude_unlimited_fieldID;
jfieldID getReceivedGifts::exclude_upgradable_fieldID;
jfieldID getReceivedGifts::exclude_non_upgradable_fieldID;
jfieldID getReceivedGifts::exclude_upgraded_fieldID;
jfieldID getReceivedGifts::exclude_without_colors_fieldID;
jfieldID getReceivedGifts::exclude_hosted_fieldID;
jfieldID getReceivedGifts::sort_by_price_fieldID;
jfieldID getReceivedGifts::offset_fieldID;
jfieldID getReceivedGifts::limit_fieldID;

getReceivedGifts::getReceivedGifts()
  : business_connection_id_()
  , owner_id_()
  , collection_id_()
  , exclude_unsaved_()
  , exclude_saved_()
  , exclude_unlimited_()
  , exclude_upgradable_()
  , exclude_non_upgradable_()
  , exclude_upgraded_()
  , exclude_without_colors_()
  , exclude_hosted_()
  , sort_by_price_()
  , offset_()
  , limit_()
{}

getReceivedGifts::getReceivedGifts(string const &business_connection_id_, object_ptr<MessageSender> &&owner_id_, int32 collection_id_, bool exclude_unsaved_, bool exclude_saved_, bool exclude_unlimited_, bool exclude_upgradable_, bool exclude_non_upgradable_, bool exclude_upgraded_, bool exclude_without_colors_, bool exclude_hosted_, bool sort_by_price_, string const &offset_, int32 limit_)
  : business_connection_id_(business_connection_id_)
  , owner_id_(std::move(owner_id_))
  , collection_id_(collection_id_)
  , exclude_unsaved_(exclude_unsaved_)
  , exclude_saved_(exclude_saved_)
  , exclude_unlimited_(exclude_unlimited_)
  , exclude_upgradable_(exclude_upgradable_)
  , exclude_non_upgradable_(exclude_non_upgradable_)
  , exclude_upgraded_(exclude_upgraded_)
  , exclude_without_colors_(exclude_without_colors_)
  , exclude_hosted_(exclude_hosted_)
  , sort_by_price_(sort_by_price_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getReceivedGifts::ID;

object_ptr<getReceivedGifts> getReceivedGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getReceivedGifts> res = make_object<getReceivedGifts>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->collection_id_ = env->GetIntField(p, res->collection_id_fieldID);
  res->exclude_unsaved_ = (env->GetBooleanField(p, res->exclude_unsaved_fieldID) != 0);
  res->exclude_saved_ = (env->GetBooleanField(p, res->exclude_saved_fieldID) != 0);
  res->exclude_unlimited_ = (env->GetBooleanField(p, res->exclude_unlimited_fieldID) != 0);
  res->exclude_upgradable_ = (env->GetBooleanField(p, res->exclude_upgradable_fieldID) != 0);
  res->exclude_non_upgradable_ = (env->GetBooleanField(p, res->exclude_non_upgradable_fieldID) != 0);
  res->exclude_upgraded_ = (env->GetBooleanField(p, res->exclude_upgraded_fieldID) != 0);
  res->exclude_without_colors_ = (env->GetBooleanField(p, res->exclude_without_colors_fieldID) != 0);
  res->exclude_hosted_ = (env->GetBooleanField(p, res->exclude_hosted_fieldID) != 0);
  res->sort_by_price_ = (env->GetBooleanField(p, res->sort_by_price_fieldID) != 0);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getReceivedGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetReceivedGifts");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("collectionId", collection_id_);
    s.store_field("excludeUnsaved", exclude_unsaved_);
    s.store_field("excludeSaved", exclude_saved_);
    s.store_field("excludeUnlimited", exclude_unlimited_);
    s.store_field("excludeUpgradable", exclude_upgradable_);
    s.store_field("excludeNonUpgradable", exclude_non_upgradable_);
    s.store_field("excludeUpgraded", exclude_upgraded_);
    s.store_field("excludeWithoutColors", exclude_without_colors_);
    s.store_field("excludeHosted", exclude_hosted_);
    s.store_field("sortByPrice", sort_by_price_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getReceivedGifts::ReturnType getReceivedGifts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return receivedGifts::fetch(env, p);
}

void getReceivedGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetReceivedGifts").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    collection_id_fieldID = jni::get_field_id(env, Class, "collectionId", "I");
    exclude_unsaved_fieldID = jni::get_field_id(env, Class, "excludeUnsaved", "Z");
    exclude_saved_fieldID = jni::get_field_id(env, Class, "excludeSaved", "Z");
    exclude_unlimited_fieldID = jni::get_field_id(env, Class, "excludeUnlimited", "Z");
    exclude_upgradable_fieldID = jni::get_field_id(env, Class, "excludeUpgradable", "Z");
    exclude_non_upgradable_fieldID = jni::get_field_id(env, Class, "excludeNonUpgradable", "Z");
    exclude_upgraded_fieldID = jni::get_field_id(env, Class, "excludeUpgraded", "Z");
    exclude_without_colors_fieldID = jni::get_field_id(env, Class, "excludeWithoutColors", "Z");
    exclude_hosted_fieldID = jni::get_field_id(env, Class, "excludeHosted", "Z");
    sort_by_price_fieldID = jni::get_field_id(env, Class, "sortByPrice", "Z");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getRecentInlineBots::Class;

getRecentInlineBots::getRecentInlineBots() {
}

const std::int32_t getRecentInlineBots::ID;

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

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

getRecentInlineBots::ReturnType getRecentInlineBots::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return users::fetch(env, p);
}

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

jclass getStarPaymentOptions::Class;

getStarPaymentOptions::getStarPaymentOptions() {
}

const std::int32_t getStarPaymentOptions::ID;

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

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

getStarPaymentOptions::ReturnType getStarPaymentOptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starPaymentOptions::fetch(env, p);
}

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

jclass getStorageStatistics::Class;
jfieldID getStorageStatistics::chat_limit_fieldID;

getStorageStatistics::getStorageStatistics()
  : chat_limit_()
{}

getStorageStatistics::getStorageStatistics(int32 chat_limit_)
  : chat_limit_(chat_limit_)
{}

const std::int32_t getStorageStatistics::ID;

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

void getStorageStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStorageStatistics");
    s.store_field("chatLimit", chat_limit_);
    s.store_class_end();
  }
}

getStorageStatistics::ReturnType getStorageStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storageStatistics::fetch(env, p);
}

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

jclass getSupergroupFullInfo::Class;
jfieldID getSupergroupFullInfo::supergroup_id_fieldID;

getSupergroupFullInfo::getSupergroupFullInfo()
  : supergroup_id_()
{}

getSupergroupFullInfo::getSupergroupFullInfo(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t getSupergroupFullInfo::ID;

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

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

getSupergroupFullInfo::ReturnType getSupergroupFullInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return supergroupFullInfo::fetch(env, p);
}

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

jclass getTemporaryPasswordState::Class;

getTemporaryPasswordState::getTemporaryPasswordState() {
}

const std::int32_t getTemporaryPasswordState::ID;

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

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

getTemporaryPasswordState::ReturnType getTemporaryPasswordState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return temporaryPasswordState::fetch(env, p);
}

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

jclass getTextEntities::Class;
jfieldID getTextEntities::text_fieldID;

getTextEntities::getTextEntities()
  : text_()
{}

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

const std::int32_t getTextEntities::ID;

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

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

getTextEntities::ReturnType getTextEntities::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return textEntities::fetch(env, p);
}

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

jclass leaveChat::Class;
jfieldID leaveChat::chat_id_fieldID;

leaveChat::leaveChat()
  : chat_id_()
{}

leaveChat::leaveChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t leaveChat::ID;

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

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

leaveChat::ReturnType leaveChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass listenToAudio::Class;
jfieldID listenToAudio::audio_file_id_fieldID;
jfieldID listenToAudio::duration_fieldID;

listenToAudio::listenToAudio()
  : audio_file_id_()
  , duration_()
{}

listenToAudio::listenToAudio(int32 audio_file_id_, int32 duration_)
  : audio_file_id_(audio_file_id_)
  , duration_(duration_)
{}

const std::int32_t listenToAudio::ID;

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

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

listenToAudio::ReturnType listenToAudio::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass openMessageContent::Class;
jfieldID openMessageContent::chat_id_fieldID;
jfieldID openMessageContent::message_id_fieldID;

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

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

const std::int32_t openMessageContent::ID;

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

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

openMessageContent::ReturnType openMessageContent::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void openMessageContent::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$OpenMessageContent").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 optimizeStorage::Class;
jfieldID optimizeStorage::size_fieldID;
jfieldID optimizeStorage::ttl_fieldID;
jfieldID optimizeStorage::count_fieldID;
jfieldID optimizeStorage::immunity_delay_fieldID;
jfieldID optimizeStorage::file_types_fieldID;
jfieldID optimizeStorage::chat_ids_fieldID;
jfieldID optimizeStorage::exclude_chat_ids_fieldID;
jfieldID optimizeStorage::return_deleted_file_statistics_fieldID;
jfieldID optimizeStorage::chat_limit_fieldID;

optimizeStorage::optimizeStorage()
  : size_()
  , ttl_()
  , count_()
  , immunity_delay_()
  , file_types_()
  , chat_ids_()
  , exclude_chat_ids_()
  , return_deleted_file_statistics_()
  , chat_limit_()
{}

optimizeStorage::optimizeStorage(int53 size_, int32 ttl_, int32 count_, int32 immunity_delay_, array<object_ptr<FileType>> &&file_types_, array<int53> &&chat_ids_, array<int53> &&exclude_chat_ids_, bool return_deleted_file_statistics_, int32 chat_limit_)
  : size_(size_)
  , ttl_(ttl_)
  , count_(count_)
  , immunity_delay_(immunity_delay_)
  , file_types_(std::move(file_types_))
  , chat_ids_(std::move(chat_ids_))
  , exclude_chat_ids_(std::move(exclude_chat_ids_))
  , return_deleted_file_statistics_(return_deleted_file_statistics_)
  , chat_limit_(chat_limit_)
{}

const std::int32_t optimizeStorage::ID;

object_ptr<optimizeStorage> optimizeStorage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<optimizeStorage> res = make_object<optimizeStorage>();
  res->size_ = env->GetLongField(p, res->size_fieldID);
  res->ttl_ = env->GetIntField(p, res->ttl_fieldID);
  res->count_ = env->GetIntField(p, res->count_fieldID);
  res->immunity_delay_ = env->GetIntField(p, res->immunity_delay_fieldID);
  res->file_types_ = jni::FetchVector<FileType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->file_types_fieldID));
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  res->exclude_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->exclude_chat_ids_fieldID));
  res->return_deleted_file_statistics_ = (env->GetBooleanField(p, res->return_deleted_file_statistics_fieldID) != 0);
  res->chat_limit_ = env->GetIntField(p, res->chat_limit_fieldID);
  return res;
}

void optimizeStorage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "OptimizeStorage");
    s.store_field("size", size_);
    s.store_field("ttl", ttl_);
    s.store_field("count", count_);
    s.store_field("immunityDelay", immunity_delay_);
    { s.store_vector_begin("fileTypes", file_types_.size()); for (const auto &_value : file_types_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("chatIds", chat_ids_.size()); for (const auto &_value : chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    { s.store_vector_begin("excludeChatIds", exclude_chat_ids_.size()); for (const auto &_value : exclude_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("returnDeletedFileStatistics", return_deleted_file_statistics_);
    s.store_field("chatLimit", chat_limit_);
    s.store_class_end();
  }
}

optimizeStorage::ReturnType optimizeStorage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storageStatistics::fetch(env, p);
}

void optimizeStorage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$OptimizeStorage").c_str());
    size_fieldID = jni::get_field_id(env, Class, "size", "J");
    ttl_fieldID = jni::get_field_id(env, Class, "ttl", "I");
    count_fieldID = jni::get_field_id(env, Class, "count", "I");
    immunity_delay_fieldID = jni::get_field_id(env, Class, "immunityDelay", "I");
    file_types_fieldID = jni::get_field_id(env, Class, "fileTypes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$FileType;").c_str());
    chat_ids_fieldID = jni::get_field_id(env, Class, "chatIds", "[J");
    exclude_chat_ids_fieldID = jni::get_field_id(env, Class, "excludeChatIds", "[J");
    return_deleted_file_statistics_fieldID = jni::get_field_id(env, Class, "returnDeletedFileStatistics", "Z");
    chat_limit_fieldID = jni::get_field_id(env, Class, "chatLimit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass postStory::Class;
jfieldID postStory::chat_id_fieldID;
jfieldID postStory::content_fieldID;
jfieldID postStory::areas_fieldID;
jfieldID postStory::caption_fieldID;
jfieldID postStory::privacy_settings_fieldID;
jfieldID postStory::album_ids_fieldID;
jfieldID postStory::active_period_fieldID;
jfieldID postStory::from_story_full_id_fieldID;
jfieldID postStory::is_posted_to_chat_page_fieldID;
jfieldID postStory::protect_content_fieldID;

postStory::postStory()
  : chat_id_()
  , content_()
  , areas_()
  , caption_()
  , privacy_settings_()
  , album_ids_()
  , active_period_()
  , from_story_full_id_()
  , is_posted_to_chat_page_()
  , protect_content_()
{}

postStory::postStory(int53 chat_id_, object_ptr<InputStoryContent> &&content_, object_ptr<inputStoryAreas> &&areas_, object_ptr<formattedText> &&caption_, object_ptr<StoryPrivacySettings> &&privacy_settings_, array<int32> &&album_ids_, int32 active_period_, object_ptr<storyFullId> &&from_story_full_id_, bool is_posted_to_chat_page_, bool protect_content_)
  : chat_id_(chat_id_)
  , content_(std::move(content_))
  , areas_(std::move(areas_))
  , caption_(std::move(caption_))
  , privacy_settings_(std::move(privacy_settings_))
  , album_ids_(std::move(album_ids_))
  , active_period_(active_period_)
  , from_story_full_id_(std::move(from_story_full_id_))
  , is_posted_to_chat_page_(is_posted_to_chat_page_)
  , protect_content_(protect_content_)
{}

const std::int32_t postStory::ID;

object_ptr<postStory> postStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<postStory> res = make_object<postStory>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->content_ = jni::fetch_tl_object<InputStoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  res->areas_ = jni::fetch_tl_object<inputStoryAreas>(env, jni::fetch_object(env, p, res->areas_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->privacy_settings_ = jni::fetch_tl_object<StoryPrivacySettings>(env, jni::fetch_object(env, p, res->privacy_settings_fieldID));
  res->album_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->album_ids_fieldID));
  res->active_period_ = env->GetIntField(p, res->active_period_fieldID);
  res->from_story_full_id_ = jni::fetch_tl_object<storyFullId>(env, jni::fetch_object(env, p, res->from_story_full_id_fieldID));
  res->is_posted_to_chat_page_ = (env->GetBooleanField(p, res->is_posted_to_chat_page_fieldID) != 0);
  res->protect_content_ = (env->GetBooleanField(p, res->protect_content_fieldID) != 0);
  return res;
}

void postStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PostStory");
    s.store_field("chatId", chat_id_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_object_field("areas", static_cast<const BaseObject *>(areas_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_object_field("privacySettings", static_cast<const BaseObject *>(privacy_settings_.get()));
    { s.store_vector_begin("albumIds", album_ids_.size()); for (const auto &_value : album_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("activePeriod", active_period_);
    s.store_object_field("fromStoryFullId", static_cast<const BaseObject *>(from_story_full_id_.get()));
    s.store_field("isPostedToChatPage", is_posted_to_chat_page_);
    s.store_field("protectContent", protect_content_);
    s.store_class_end();
  }
}

postStory::ReturnType postStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return story::fetch(env, p);
}

void postStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PostStory").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryContent;").c_str());
    areas_fieldID = jni::get_field_id(env, Class, "areas", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryAreas;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    privacy_settings_fieldID = jni::get_field_id(env, Class, "privacySettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryPrivacySettings;").c_str());
    album_ids_fieldID = jni::get_field_id(env, Class, "albumIds", "[I");
    active_period_fieldID = jni::get_field_id(env, Class, "activePeriod", "I");
    from_story_full_id_fieldID = jni::get_field_id(env, Class, "fromStoryFullId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryFullId;").c_str());
    is_posted_to_chat_page_fieldID = jni::get_field_id(env, Class, "isPostedToChatPage", "Z");
    protect_content_fieldID = jni::get_field_id(env, Class, "protectContent", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass processChatFolderNewChats::Class;
jfieldID processChatFolderNewChats::chat_folder_id_fieldID;
jfieldID processChatFolderNewChats::added_chat_ids_fieldID;

processChatFolderNewChats::processChatFolderNewChats()
  : chat_folder_id_()
  , added_chat_ids_()
{}

processChatFolderNewChats::processChatFolderNewChats(int32 chat_folder_id_, array<int53> &&added_chat_ids_)
  : chat_folder_id_(chat_folder_id_)
  , added_chat_ids_(std::move(added_chat_ids_))
{}

const std::int32_t processChatFolderNewChats::ID;

object_ptr<processChatFolderNewChats> processChatFolderNewChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<processChatFolderNewChats> res = make_object<processChatFolderNewChats>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  res->added_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->added_chat_ids_fieldID));
  return res;
}

void processChatFolderNewChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProcessChatFolderNewChats");
    s.store_field("chatFolderId", chat_folder_id_);
    { s.store_vector_begin("addedChatIds", added_chat_ids_.size()); for (const auto &_value : added_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

processChatFolderNewChats::ReturnType processChatFolderNewChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeContacts::Class;
jfieldID removeContacts::user_ids_fieldID;

removeContacts::removeContacts()
  : user_ids_()
{}

removeContacts::removeContacts(array<int53> &&user_ids_)
  : user_ids_(std::move(user_ids_))
{}

const std::int32_t removeContacts::ID;

object_ptr<removeContacts> removeContacts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeContacts> res = make_object<removeContacts>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  return res;
}

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

removeContacts::ReturnType removeContacts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeInstalledBackground::Class;
jfieldID removeInstalledBackground::background_id_fieldID;

removeInstalledBackground::removeInstalledBackground()
  : background_id_()
{}

removeInstalledBackground::removeInstalledBackground(int64 background_id_)
  : background_id_(background_id_)
{}

const std::int32_t removeInstalledBackground::ID;

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

void removeInstalledBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveInstalledBackground");
    s.store_field("backgroundId", background_id_);
    s.store_class_end();
  }
}

removeInstalledBackground::ReturnType removeInstalledBackground::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeTextCompositionStyle::Class;
jfieldID removeTextCompositionStyle::name_fieldID;

removeTextCompositionStyle::removeTextCompositionStyle()
  : name_()
{}

removeTextCompositionStyle::removeTextCompositionStyle(string const &name_)
  : name_(name_)
{}

const std::int32_t removeTextCompositionStyle::ID;

object_ptr<removeTextCompositionStyle> removeTextCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeTextCompositionStyle> res = make_object<removeTextCompositionStyle>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  return res;
}

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

removeTextCompositionStyle::ReturnType removeTextCompositionStyle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reorderBotMediaPreviews::Class;
jfieldID reorderBotMediaPreviews::bot_user_id_fieldID;
jfieldID reorderBotMediaPreviews::language_code_fieldID;
jfieldID reorderBotMediaPreviews::file_ids_fieldID;

reorderBotMediaPreviews::reorderBotMediaPreviews()
  : bot_user_id_()
  , language_code_()
  , file_ids_()
{}

reorderBotMediaPreviews::reorderBotMediaPreviews(int53 bot_user_id_, string const &language_code_, array<int32> &&file_ids_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
  , file_ids_(std::move(file_ids_))
{}

const std::int32_t reorderBotMediaPreviews::ID;

object_ptr<reorderBotMediaPreviews> reorderBotMediaPreviews::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderBotMediaPreviews> res = make_object<reorderBotMediaPreviews>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->file_ids_fieldID));
  return res;
}

void reorderBotMediaPreviews::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderBotMediaPreviews");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    { s.store_vector_begin("fileIds", file_ids_.size()); for (const auto &_value : file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

reorderBotMediaPreviews::ReturnType reorderBotMediaPreviews::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reorderBotMediaPreviews::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReorderBotMediaPreviews").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    language_code_fieldID = jni::get_field_id(env, Class, "languageCode", "Ljava/lang/String;");
    file_ids_fieldID = jni::get_field_id(env, Class, "fileIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass reorderQuickReplyShortcuts::Class;
jfieldID reorderQuickReplyShortcuts::shortcut_ids_fieldID;

reorderQuickReplyShortcuts::reorderQuickReplyShortcuts()
  : shortcut_ids_()
{}

reorderQuickReplyShortcuts::reorderQuickReplyShortcuts(array<int32> &&shortcut_ids_)
  : shortcut_ids_(std::move(shortcut_ids_))
{}

const std::int32_t reorderQuickReplyShortcuts::ID;

object_ptr<reorderQuickReplyShortcuts> reorderQuickReplyShortcuts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderQuickReplyShortcuts> res = make_object<reorderQuickReplyShortcuts>();
  res->shortcut_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->shortcut_ids_fieldID));
  return res;
}

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

reorderQuickReplyShortcuts::ReturnType reorderQuickReplyShortcuts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reportPhoneNumberCodeMissing::Class;
jfieldID reportPhoneNumberCodeMissing::mobile_network_code_fieldID;

reportPhoneNumberCodeMissing::reportPhoneNumberCodeMissing()
  : mobile_network_code_()
{}

reportPhoneNumberCodeMissing::reportPhoneNumberCodeMissing(string const &mobile_network_code_)
  : mobile_network_code_(mobile_network_code_)
{}

const std::int32_t reportPhoneNumberCodeMissing::ID;

object_ptr<reportPhoneNumberCodeMissing> reportPhoneNumberCodeMissing::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportPhoneNumberCodeMissing> res = make_object<reportPhoneNumberCodeMissing>();
  res->mobile_network_code_ = jni::fetch_string(env, p, res->mobile_network_code_fieldID);
  return res;
}

void reportPhoneNumberCodeMissing::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportPhoneNumberCodeMissing");
    s.store_field("mobileNetworkCode", mobile_network_code_);
    s.store_class_end();
  }
}

reportPhoneNumberCodeMissing::ReturnType reportPhoneNumberCodeMissing::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass searchPublicChats::Class;
jfieldID searchPublicChats::query_fieldID;

searchPublicChats::searchPublicChats()
  : query_()
{}

searchPublicChats::searchPublicChats(string const &query_)
  : query_(query_)
{}

const std::int32_t searchPublicChats::ID;

object_ptr<searchPublicChats> searchPublicChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchPublicChats> res = make_object<searchPublicChats>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  return res;
}

void searchPublicChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchPublicChats");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

searchPublicChats::ReturnType searchPublicChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass sendBusinessMessage::Class;
jfieldID sendBusinessMessage::business_connection_id_fieldID;
jfieldID sendBusinessMessage::chat_id_fieldID;
jfieldID sendBusinessMessage::reply_to_fieldID;
jfieldID sendBusinessMessage::disable_notification_fieldID;
jfieldID sendBusinessMessage::protect_content_fieldID;
jfieldID sendBusinessMessage::effect_id_fieldID;
jfieldID sendBusinessMessage::reply_markup_fieldID;
jfieldID sendBusinessMessage::input_message_content_fieldID;

sendBusinessMessage::sendBusinessMessage()
  : business_connection_id_()
  , chat_id_()
  , reply_to_()
  , disable_notification_()
  , protect_content_()
  , effect_id_()
  , reply_markup_()
  , input_message_content_()
{}

sendBusinessMessage::sendBusinessMessage(string const &business_connection_id_, int53 chat_id_, object_ptr<InputMessageReplyTo> &&reply_to_, bool disable_notification_, bool protect_content_, int64 effect_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , reply_to_(std::move(reply_to_))
  , disable_notification_(disable_notification_)
  , protect_content_(protect_content_)
  , effect_id_(effect_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t sendBusinessMessage::ID;

object_ptr<sendBusinessMessage> sendBusinessMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendBusinessMessage> res = make_object<sendBusinessMessage>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->disable_notification_ = (env->GetBooleanField(p, res->disable_notification_fieldID) != 0);
  res->protect_content_ = (env->GetBooleanField(p, res->protect_content_fieldID) != 0);
  res->effect_id_ = env->GetLongField(p, res->effect_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void sendBusinessMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendBusinessMessage");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_field("disableNotification", disable_notification_);
    s.store_field("protectContent", protect_content_);
    s.store_field("effectId", effect_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

sendBusinessMessage::ReturnType sendBusinessMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void sendBusinessMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendBusinessMessage").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    disable_notification_fieldID = jni::get_field_id(env, Class, "disableNotification", "Z");
    protect_content_fieldID = jni::get_field_id(env, Class, "protectContent", "Z");
    effect_id_fieldID = jni::get_field_id(env, Class, "effectId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    input_message_content_fieldID = jni::get_field_id(env, Class, "inputMessageContent", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass sendCallRating::Class;
jfieldID sendCallRating::call_id_fieldID;
jfieldID sendCallRating::rating_fieldID;
jfieldID sendCallRating::comment_fieldID;
jfieldID sendCallRating::problems_fieldID;

sendCallRating::sendCallRating()
  : call_id_()
  , rating_()
  , comment_()
  , problems_()
{}

sendCallRating::sendCallRating(object_ptr<InputCall> &&call_id_, int32 rating_, string const &comment_, array<object_ptr<CallProblem>> &&problems_)
  : call_id_(std::move(call_id_))
  , rating_(rating_)
  , comment_(comment_)
  , problems_(std::move(problems_))
{}

const std::int32_t sendCallRating::ID;

object_ptr<sendCallRating> sendCallRating::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendCallRating> res = make_object<sendCallRating>();
  res->call_id_ = jni::fetch_tl_object<InputCall>(env, jni::fetch_object(env, p, res->call_id_fieldID));
  res->rating_ = env->GetIntField(p, res->rating_fieldID);
  res->comment_ = jni::fetch_string(env, p, res->comment_fieldID);
  res->problems_ = jni::FetchVector<CallProblem>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->problems_fieldID));
  return res;
}

void sendCallRating::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendCallRating");
    s.store_object_field("callId", static_cast<const BaseObject *>(call_id_.get()));
    s.store_field("rating", rating_);
    s.store_field("comment", comment_);
    { s.store_vector_begin("problems", problems_.size()); for (const auto &_value : problems_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

sendCallRating::ReturnType sendCallRating::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendCallRating::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendCallRating").c_str());
    call_id_fieldID = jni::get_field_id(env, Class, "callId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputCall;").c_str());
    rating_fieldID = jni::get_field_id(env, Class, "rating", "I");
    comment_fieldID = jni::get_field_id(env, Class, "comment", "Ljava/lang/String;");
    problems_fieldID = jni::get_field_id(env, Class, "problems", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$CallProblem;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setBotInfoShortDescription::Class;
jfieldID setBotInfoShortDescription::bot_user_id_fieldID;
jfieldID setBotInfoShortDescription::language_code_fieldID;
jfieldID setBotInfoShortDescription::short_description_fieldID;

setBotInfoShortDescription::setBotInfoShortDescription()
  : bot_user_id_()
  , language_code_()
  , short_description_()
{}

setBotInfoShortDescription::setBotInfoShortDescription(int53 bot_user_id_, string const &language_code_, string const &short_description_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
  , short_description_(short_description_)
{}

const std::int32_t setBotInfoShortDescription::ID;

object_ptr<setBotInfoShortDescription> setBotInfoShortDescription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBotInfoShortDescription> res = make_object<setBotInfoShortDescription>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->short_description_ = jni::fetch_string(env, p, res->short_description_fieldID);
  return res;
}

void setBotInfoShortDescription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBotInfoShortDescription");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_field("shortDescription", short_description_);
    s.store_class_end();
  }
}

setBotInfoShortDescription::ReturnType setBotInfoShortDescription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setGroupCallParticipantVolumeLevel::Class;
jfieldID setGroupCallParticipantVolumeLevel::group_call_id_fieldID;
jfieldID setGroupCallParticipantVolumeLevel::participant_id_fieldID;
jfieldID setGroupCallParticipantVolumeLevel::volume_level_fieldID;

setGroupCallParticipantVolumeLevel::setGroupCallParticipantVolumeLevel()
  : group_call_id_()
  , participant_id_()
  , volume_level_()
{}

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

const std::int32_t setGroupCallParticipantVolumeLevel::ID;

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

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

setGroupCallParticipantVolumeLevel::ReturnType setGroupCallParticipantVolumeLevel::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setMessageFactCheck::Class;
jfieldID setMessageFactCheck::chat_id_fieldID;
jfieldID setMessageFactCheck::message_id_fieldID;
jfieldID setMessageFactCheck::text_fieldID;

setMessageFactCheck::setMessageFactCheck()
  : chat_id_()
  , message_id_()
  , text_()
{}

setMessageFactCheck::setMessageFactCheck(int53 chat_id_, int53 message_id_, object_ptr<formattedText> &&text_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , text_(std::move(text_))
{}

const std::int32_t setMessageFactCheck::ID;

object_ptr<setMessageFactCheck> setMessageFactCheck::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setMessageFactCheck> res = make_object<setMessageFactCheck>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return res;
}

void setMessageFactCheck::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetMessageFactCheck");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

setMessageFactCheck::ReturnType setMessageFactCheck::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setMessageFactCheck::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetMessageFactCheck").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setOption::Class;
jfieldID setOption::name_fieldID;
jfieldID setOption::value_fieldID;

setOption::setOption()
  : name_()
  , value_()
{}

setOption::setOption(string const &name_, object_ptr<OptionValue> &&value_)
  : name_(name_)
  , value_(std::move(value_))
{}

const std::int32_t setOption::ID;

object_ptr<setOption> setOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setOption> res = make_object<setOption>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->value_ = jni::fetch_tl_object<OptionValue>(env, jni::fetch_object(env, p, res->value_fieldID));
  return res;
}

void setOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetOption");
    s.store_field("name", name_);
    s.store_object_field("value", static_cast<const BaseObject *>(value_.get()));
    s.store_class_end();
  }
}

setOption::ReturnType setOption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setPassportElement::Class;
jfieldID setPassportElement::element_fieldID;
jfieldID setPassportElement::password_fieldID;

setPassportElement::setPassportElement()
  : element_()
  , password_()
{}

setPassportElement::setPassportElement(object_ptr<InputPassportElement> &&element_, string const &password_)
  : element_(std::move(element_))
  , password_(password_)
{}

const std::int32_t setPassportElement::ID;

object_ptr<setPassportElement> setPassportElement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPassportElement> res = make_object<setPassportElement>();
  res->element_ = jni::fetch_tl_object<InputPassportElement>(env, jni::fetch_object(env, p, res->element_fieldID));
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void setPassportElement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPassportElement");
    s.store_object_field("element", static_cast<const BaseObject *>(element_.get()));
    s.store_field("password", password_);
    s.store_class_end();
  }
}

setPassportElement::ReturnType setPassportElement::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return PassportElement::fetch(env, p);
}

void setPassportElement::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetPassportElement").c_str());
    element_fieldID = jni::get_field_id(env, Class, "element", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputPassportElement;").c_str());
    password_fieldID = jni::get_field_id(env, Class, "password", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setPinnedSavedMessagesTopics::Class;
jfieldID setPinnedSavedMessagesTopics::saved_messages_topic_ids_fieldID;

setPinnedSavedMessagesTopics::setPinnedSavedMessagesTopics()
  : saved_messages_topic_ids_()
{}

setPinnedSavedMessagesTopics::setPinnedSavedMessagesTopics(array<int53> &&saved_messages_topic_ids_)
  : saved_messages_topic_ids_(std::move(saved_messages_topic_ids_))
{}

const std::int32_t setPinnedSavedMessagesTopics::ID;

object_ptr<setPinnedSavedMessagesTopics> setPinnedSavedMessagesTopics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPinnedSavedMessagesTopics> res = make_object<setPinnedSavedMessagesTopics>();
  res->saved_messages_topic_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->saved_messages_topic_ids_fieldID));
  return res;
}

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

setPinnedSavedMessagesTopics::ReturnType setPinnedSavedMessagesTopics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass stopPoll::Class;
jfieldID stopPoll::chat_id_fieldID;
jfieldID stopPoll::message_id_fieldID;
jfieldID stopPoll::reply_markup_fieldID;

stopPoll::stopPoll()
  : chat_id_()
  , message_id_()
  , reply_markup_()
{}

stopPoll::stopPoll(int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t stopPoll::ID;

object_ptr<stopPoll> stopPoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stopPoll> res = make_object<stopPoll>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  return res;
}

void stopPoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StopPoll");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_class_end();
  }
}

stopPoll::ReturnType stopPoll::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void stopPoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StopPoll").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass testCallVectorInt::Class;
jfieldID testCallVectorInt::x_fieldID;

testCallVectorInt::testCallVectorInt()
  : x_()
{}

testCallVectorInt::testCallVectorInt(array<int32> &&x_)
  : x_(std::move(x_))
{}

const std::int32_t testCallVectorInt::ID;

object_ptr<testCallVectorInt> testCallVectorInt::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testCallVectorInt> res = make_object<testCallVectorInt>();
  res->x_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->x_fieldID));
  return res;
}

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

testCallVectorInt::ReturnType testCallVectorInt::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testVectorInt::fetch(env, p);
}

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

jclass testReturnError::Class;
jfieldID testReturnError::error_fieldID;

testReturnError::testReturnError()
  : error_()
{}

testReturnError::testReturnError(object_ptr<error> &&error_)
  : error_(std::move(error_))
{}

const std::int32_t testReturnError::ID;

object_ptr<testReturnError> testReturnError::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testReturnError> res = make_object<testReturnError>();
  res->error_ = jni::fetch_tl_object<error>(env, jni::fetch_object(env, p, res->error_fieldID));
  return res;
}

void testReturnError::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestReturnError");
    s.store_object_field("error", static_cast<const BaseObject *>(error_.get()));
    s.store_class_end();
  }
}

testReturnError::ReturnType testReturnError::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return error::fetch(env, p);
}

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

jclass testUseUpdate::Class;

testUseUpdate::testUseUpdate() {
}

const std::int32_t testUseUpdate::ID;

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

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

testUseUpdate::ReturnType testUseUpdate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return Update::fetch(env, p);
}

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

jclass toggleChatDefaultDisableNotification::Class;
jfieldID toggleChatDefaultDisableNotification::chat_id_fieldID;
jfieldID toggleChatDefaultDisableNotification::default_disable_notification_fieldID;

toggleChatDefaultDisableNotification::toggleChatDefaultDisableNotification()
  : chat_id_()
  , default_disable_notification_()
{}

toggleChatDefaultDisableNotification::toggleChatDefaultDisableNotification(int53 chat_id_, bool default_disable_notification_)
  : chat_id_(chat_id_)
  , default_disable_notification_(default_disable_notification_)
{}

const std::int32_t toggleChatDefaultDisableNotification::ID;

object_ptr<toggleChatDefaultDisableNotification> toggleChatDefaultDisableNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatDefaultDisableNotification> res = make_object<toggleChatDefaultDisableNotification>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->default_disable_notification_ = (env->GetBooleanField(p, res->default_disable_notification_fieldID) != 0);
  return res;
}

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

toggleChatDefaultDisableNotification::ReturnType toggleChatDefaultDisableNotification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleChatGiftNotifications::Class;
jfieldID toggleChatGiftNotifications::chat_id_fieldID;
jfieldID toggleChatGiftNotifications::are_enabled_fieldID;

toggleChatGiftNotifications::toggleChatGiftNotifications()
  : chat_id_()
  , are_enabled_()
{}

toggleChatGiftNotifications::toggleChatGiftNotifications(int53 chat_id_, bool are_enabled_)
  : chat_id_(chat_id_)
  , are_enabled_(are_enabled_)
{}

const std::int32_t toggleChatGiftNotifications::ID;

object_ptr<toggleChatGiftNotifications> toggleChatGiftNotifications::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatGiftNotifications> res = make_object<toggleChatGiftNotifications>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->are_enabled_ = (env->GetBooleanField(p, res->are_enabled_fieldID) != 0);
  return res;
}

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

toggleChatGiftNotifications::ReturnType toggleChatGiftNotifications::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleChatIsMarkedAsUnread::Class;
jfieldID toggleChatIsMarkedAsUnread::chat_id_fieldID;
jfieldID toggleChatIsMarkedAsUnread::is_marked_as_unread_fieldID;

toggleChatIsMarkedAsUnread::toggleChatIsMarkedAsUnread()
  : chat_id_()
  , is_marked_as_unread_()
{}

toggleChatIsMarkedAsUnread::toggleChatIsMarkedAsUnread(int53 chat_id_, bool is_marked_as_unread_)
  : chat_id_(chat_id_)
  , is_marked_as_unread_(is_marked_as_unread_)
{}

const std::int32_t toggleChatIsMarkedAsUnread::ID;

object_ptr<toggleChatIsMarkedAsUnread> toggleChatIsMarkedAsUnread::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatIsMarkedAsUnread> res = make_object<toggleChatIsMarkedAsUnread>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_marked_as_unread_ = (env->GetBooleanField(p, res->is_marked_as_unread_fieldID) != 0);
  return res;
}

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

toggleChatIsMarkedAsUnread::ReturnType toggleChatIsMarkedAsUnread::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleChatIsTranslatable::Class;
jfieldID toggleChatIsTranslatable::chat_id_fieldID;
jfieldID toggleChatIsTranslatable::is_translatable_fieldID;

toggleChatIsTranslatable::toggleChatIsTranslatable()
  : chat_id_()
  , is_translatable_()
{}

toggleChatIsTranslatable::toggleChatIsTranslatable(int53 chat_id_, bool is_translatable_)
  : chat_id_(chat_id_)
  , is_translatable_(is_translatable_)
{}

const std::int32_t toggleChatIsTranslatable::ID;

object_ptr<toggleChatIsTranslatable> toggleChatIsTranslatable::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatIsTranslatable> res = make_object<toggleChatIsTranslatable>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_translatable_ = (env->GetBooleanField(p, res->is_translatable_fieldID) != 0);
  return res;
}

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

toggleChatIsTranslatable::ReturnType toggleChatIsTranslatable::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleForumTopicIsClosed::Class;
jfieldID toggleForumTopicIsClosed::chat_id_fieldID;
jfieldID toggleForumTopicIsClosed::forum_topic_id_fieldID;
jfieldID toggleForumTopicIsClosed::is_closed_fieldID;

toggleForumTopicIsClosed::toggleForumTopicIsClosed()
  : chat_id_()
  , forum_topic_id_()
  , is_closed_()
{}

toggleForumTopicIsClosed::toggleForumTopicIsClosed(int53 chat_id_, int32 forum_topic_id_, bool is_closed_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , is_closed_(is_closed_)
{}

const std::int32_t toggleForumTopicIsClosed::ID;

object_ptr<toggleForumTopicIsClosed> toggleForumTopicIsClosed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleForumTopicIsClosed> res = make_object<toggleForumTopicIsClosed>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->is_closed_ = (env->GetBooleanField(p, res->is_closed_fieldID) != 0);
  return res;
}

void toggleForumTopicIsClosed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleForumTopicIsClosed");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_field("isClosed", is_closed_);
    s.store_class_end();
  }
}

toggleForumTopicIsClosed::ReturnType toggleForumTopicIsClosed::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleForumTopicIsClosed::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleForumTopicIsClosed").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    forum_topic_id_fieldID = jni::get_field_id(env, Class, "forumTopicId", "I");
    is_closed_fieldID = jni::get_field_id(env, Class, "isClosed", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleSupergroupIsAllHistoryAvailable::Class;
jfieldID toggleSupergroupIsAllHistoryAvailable::supergroup_id_fieldID;
jfieldID toggleSupergroupIsAllHistoryAvailable::is_all_history_available_fieldID;

toggleSupergroupIsAllHistoryAvailable::toggleSupergroupIsAllHistoryAvailable()
  : supergroup_id_()
  , is_all_history_available_()
{}

toggleSupergroupIsAllHistoryAvailable::toggleSupergroupIsAllHistoryAvailable(int53 supergroup_id_, bool is_all_history_available_)
  : supergroup_id_(supergroup_id_)
  , is_all_history_available_(is_all_history_available_)
{}

const std::int32_t toggleSupergroupIsAllHistoryAvailable::ID;

object_ptr<toggleSupergroupIsAllHistoryAvailable> toggleSupergroupIsAllHistoryAvailable::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupIsAllHistoryAvailable> res = make_object<toggleSupergroupIsAllHistoryAvailable>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->is_all_history_available_ = (env->GetBooleanField(p, res->is_all_history_available_fieldID) != 0);
  return res;
}

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

toggleSupergroupIsAllHistoryAvailable::ReturnType toggleSupergroupIsAllHistoryAvailable::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleVideoChatEnabledStartNotification::Class;
jfieldID toggleVideoChatEnabledStartNotification::group_call_id_fieldID;
jfieldID toggleVideoChatEnabledStartNotification::enabled_start_notification_fieldID;

toggleVideoChatEnabledStartNotification::toggleVideoChatEnabledStartNotification()
  : group_call_id_()
  , enabled_start_notification_()
{}

toggleVideoChatEnabledStartNotification::toggleVideoChatEnabledStartNotification(int32 group_call_id_, bool enabled_start_notification_)
  : group_call_id_(group_call_id_)
  , enabled_start_notification_(enabled_start_notification_)
{}

const std::int32_t toggleVideoChatEnabledStartNotification::ID;

object_ptr<toggleVideoChatEnabledStartNotification> toggleVideoChatEnabledStartNotification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleVideoChatEnabledStartNotification> res = make_object<toggleVideoChatEnabledStartNotification>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->enabled_start_notification_ = (env->GetBooleanField(p, res->enabled_start_notification_fieldID) != 0);
  return res;
}

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

toggleVideoChatEnabledStartNotification::ReturnType toggleVideoChatEnabledStartNotification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass transferBusinessAccountStars::Class;
jfieldID transferBusinessAccountStars::business_connection_id_fieldID;
jfieldID transferBusinessAccountStars::star_count_fieldID;

transferBusinessAccountStars::transferBusinessAccountStars()
  : business_connection_id_()
  , star_count_()
{}

transferBusinessAccountStars::transferBusinessAccountStars(string const &business_connection_id_, int53 star_count_)
  : business_connection_id_(business_connection_id_)
  , star_count_(star_count_)
{}

const std::int32_t transferBusinessAccountStars::ID;

object_ptr<transferBusinessAccountStars> transferBusinessAccountStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<transferBusinessAccountStars> res = make_object<transferBusinessAccountStars>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

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

transferBusinessAccountStars::ReturnType transferBusinessAccountStars::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass unpinAllForumTopicMessages::Class;
jfieldID unpinAllForumTopicMessages::chat_id_fieldID;
jfieldID unpinAllForumTopicMessages::forum_topic_id_fieldID;

unpinAllForumTopicMessages::unpinAllForumTopicMessages()
  : chat_id_()
  , forum_topic_id_()
{}

unpinAllForumTopicMessages::unpinAllForumTopicMessages(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t unpinAllForumTopicMessages::ID;

object_ptr<unpinAllForumTopicMessages> unpinAllForumTopicMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<unpinAllForumTopicMessages> res = make_object<unpinAllForumTopicMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  return res;
}

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

unpinAllForumTopicMessages::ReturnType unpinAllForumTopicMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass viewVideoMessageAdvertisement::Class;
jfieldID viewVideoMessageAdvertisement::advertisement_unique_id_fieldID;

viewVideoMessageAdvertisement::viewVideoMessageAdvertisement()
  : advertisement_unique_id_()
{}

viewVideoMessageAdvertisement::viewVideoMessageAdvertisement(int53 advertisement_unique_id_)
  : advertisement_unique_id_(advertisement_unique_id_)
{}

const std::int32_t viewVideoMessageAdvertisement::ID;

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

void viewVideoMessageAdvertisement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ViewVideoMessageAdvertisement");
    s.store_field("advertisementUniqueId", advertisement_unique_id_);
    s.store_class_end();
  }
}

viewVideoMessageAdvertisement::ReturnType viewVideoMessageAdvertisement::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void viewVideoMessageAdvertisement::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ViewVideoMessageAdvertisement").c_str());
    advertisement_unique_id_fieldID = jni::get_field_id(env, Class, "advertisementUniqueId", "J");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
