#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 ActiveStoryState::Class;

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

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

jclass activeStoryStateLive::Class;
jfieldID activeStoryStateLive::story_id_fieldID;

activeStoryStateLive::activeStoryStateLive()
  : story_id_()
{}

activeStoryStateLive::activeStoryStateLive(int32 story_id_)
  : story_id_(story_id_)
{}

const std::int32_t activeStoryStateLive::ID;

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

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

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

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

jclass activeStoryStateUnread::Class;

activeStoryStateUnread::activeStoryStateUnread() {
}

const std::int32_t activeStoryStateUnread::ID;

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

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

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

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

jclass activeStoryStateRead::Class;

activeStoryStateRead::activeStoryStateRead() {
}

const std::int32_t activeStoryStateRead::ID;

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

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

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

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

jclass archiveChatListSettings::Class;
jfieldID archiveChatListSettings::archive_and_mute_new_chats_from_unknown_users_fieldID;
jfieldID archiveChatListSettings::keep_unmuted_chats_archived_fieldID;
jfieldID archiveChatListSettings::keep_chats_from_folders_archived_fieldID;

archiveChatListSettings::archiveChatListSettings()
  : archive_and_mute_new_chats_from_unknown_users_()
  , keep_unmuted_chats_archived_()
  , keep_chats_from_folders_archived_()
{}

archiveChatListSettings::archiveChatListSettings(bool archive_and_mute_new_chats_from_unknown_users_, bool keep_unmuted_chats_archived_, bool keep_chats_from_folders_archived_)
  : archive_and_mute_new_chats_from_unknown_users_(archive_and_mute_new_chats_from_unknown_users_)
  , keep_unmuted_chats_archived_(keep_unmuted_chats_archived_)
  , keep_chats_from_folders_archived_(keep_chats_from_folders_archived_)
{}

const std::int32_t archiveChatListSettings::ID;

object_ptr<archiveChatListSettings> archiveChatListSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<archiveChatListSettings> res = make_object<archiveChatListSettings>();
  res->archive_and_mute_new_chats_from_unknown_users_ = (env->GetBooleanField(p, res->archive_and_mute_new_chats_from_unknown_users_fieldID) != 0);
  res->keep_unmuted_chats_archived_ = (env->GetBooleanField(p, res->keep_unmuted_chats_archived_fieldID) != 0);
  res->keep_chats_from_folders_archived_ = (env->GetBooleanField(p, res->keep_chats_from_folders_archived_fieldID) != 0);
  return res;
}

void archiveChatListSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, archive_and_mute_new_chats_from_unknown_users_fieldID, archive_and_mute_new_chats_from_unknown_users_);
  env->SetBooleanField(s, keep_unmuted_chats_archived_fieldID, keep_unmuted_chats_archived_);
  env->SetBooleanField(s, keep_chats_from_folders_archived_fieldID, keep_chats_from_folders_archived_);
}

void archiveChatListSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ArchiveChatListSettings");
    s.store_field("archiveAndMuteNewChatsFromUnknownUsers", archive_and_mute_new_chats_from_unknown_users_);
    s.store_field("keepUnmutedChatsArchived", keep_unmuted_chats_archived_);
    s.store_field("keepChatsFromFoldersArchived", keep_chats_from_folders_archived_);
    s.store_class_end();
  }
}

void archiveChatListSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ArchiveChatListSettings").c_str());
    archive_and_mute_new_chats_from_unknown_users_fieldID = jni::get_field_id(env, Class, "archiveAndMuteNewChatsFromUnknownUsers", "Z");
    keep_unmuted_chats_archived_fieldID = jni::get_field_id(env, Class, "keepUnmutedChatsArchived", "Z");
    keep_chats_from_folders_archived_fieldID = jni::get_field_id(env, Class, "keepChatsFromFoldersArchived", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass audio::Class;
jfieldID audio::duration_fieldID;
jfieldID audio::title_fieldID;
jfieldID audio::performer_fieldID;
jfieldID audio::file_name_fieldID;
jfieldID audio::mime_type_fieldID;
jfieldID audio::album_cover_minithumbnail_fieldID;
jfieldID audio::album_cover_thumbnail_fieldID;
jfieldID audio::external_album_covers_fieldID;
jfieldID audio::audio_fieldID;

audio::audio()
  : duration_()
  , title_()
  , performer_()
  , file_name_()
  , mime_type_()
  , album_cover_minithumbnail_()
  , album_cover_thumbnail_()
  , external_album_covers_()
  , audio_()
{}

audio::audio(int32 duration_, string const &title_, string const &performer_, string const &file_name_, string const &mime_type_, object_ptr<minithumbnail> &&album_cover_minithumbnail_, object_ptr<thumbnail> &&album_cover_thumbnail_, array<object_ptr<thumbnail>> &&external_album_covers_, object_ptr<file> &&audio_)
  : duration_(duration_)
  , title_(title_)
  , performer_(performer_)
  , file_name_(file_name_)
  , mime_type_(mime_type_)
  , album_cover_minithumbnail_(std::move(album_cover_minithumbnail_))
  , album_cover_thumbnail_(std::move(album_cover_thumbnail_))
  , external_album_covers_(std::move(external_album_covers_))
  , audio_(std::move(audio_))
{}

const std::int32_t audio::ID;

object_ptr<audio> audio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<audio> res = make_object<audio>();
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->performer_ = jni::fetch_string(env, p, res->performer_fieldID);
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->album_cover_minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->album_cover_minithumbnail_fieldID));
  res->album_cover_thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->album_cover_thumbnail_fieldID));
  res->external_album_covers_ = jni::FetchVector<thumbnail>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->external_album_covers_fieldID));
  res->audio_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->audio_fieldID));
  return res;
}

void audio::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, duration_fieldID, duration_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, performer_); if (nextString) { env->SetObjectField(s, performer_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, file_name_); if (nextString) { env->SetObjectField(s, file_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (album_cover_minithumbnail_ != nullptr) { jobject next; album_cover_minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, album_cover_minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (album_cover_thumbnail_ != nullptr) { jobject next; album_cover_thumbnail_->store(env, next); if (next) { env->SetObjectField(s, album_cover_thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, external_album_covers_); if (arr_tmp_) { env->SetObjectField(s, external_album_covers_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (audio_ != nullptr) { jobject next; audio_->store(env, next); if (next) { env->SetObjectField(s, audio_fieldID, next); env->DeleteLocalRef(next); } }
}

void audio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Audio");
    s.store_field("duration", duration_);
    s.store_field("title", title_);
    s.store_field("performer", performer_);
    s.store_field("fileName", file_name_);
    s.store_field("mimeType", mime_type_);
    s.store_object_field("albumCoverMinithumbnail", static_cast<const BaseObject *>(album_cover_minithumbnail_.get()));
    s.store_object_field("albumCoverThumbnail", static_cast<const BaseObject *>(album_cover_thumbnail_.get()));
    { s.store_vector_begin("externalAlbumCovers", external_album_covers_.size()); for (const auto &_value : external_album_covers_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("audio", static_cast<const BaseObject *>(audio_.get()));
    s.store_class_end();
  }
}

void audio::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Audio").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    performer_fieldID = jni::get_field_id(env, Class, "performer", "Ljava/lang/String;");
    file_name_fieldID = jni::get_field_id(env, Class, "fileName", "Ljava/lang/String;");
    mime_type_fieldID = jni::get_field_id(env, Class, "mimeType", "Ljava/lang/String;");
    album_cover_minithumbnail_fieldID = jni::get_field_id(env, Class, "albumCoverMinithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    album_cover_thumbnail_fieldID = jni::get_field_id(env, Class, "albumCoverThumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    external_album_covers_fieldID = jni::get_field_id(env, Class, "externalAlbumCovers", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass availableReaction::Class;
jfieldID availableReaction::type_fieldID;
jfieldID availableReaction::needs_premium_fieldID;

availableReaction::availableReaction()
  : type_()
  , needs_premium_()
{}

availableReaction::availableReaction(object_ptr<ReactionType> &&type_, bool needs_premium_)
  : type_(std::move(type_))
  , needs_premium_(needs_premium_)
{}

const std::int32_t availableReaction::ID;

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

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

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

void availableReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AvailableReaction").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    needs_premium_fieldID = jni::get_field_id(env, Class, "needsPremium", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass background::Class;
jfieldID background::id_fieldID;
jfieldID background::is_default_fieldID;
jfieldID background::is_dark_fieldID;
jfieldID background::name_fieldID;
jfieldID background::document_fieldID;
jfieldID background::type_fieldID;

background::background()
  : id_()
  , is_default_()
  , is_dark_()
  , name_()
  , document_()
  , type_()
{}

background::background(int64 id_, bool is_default_, bool is_dark_, string const &name_, object_ptr<document> &&document_, object_ptr<BackgroundType> &&type_)
  : id_(id_)
  , is_default_(is_default_)
  , is_dark_(is_dark_)
  , name_(name_)
  , document_(std::move(document_))
  , type_(std::move(type_))
{}

const std::int32_t background::ID;

object_ptr<background> background::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<background> res = make_object<background>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->is_default_ = (env->GetBooleanField(p, res->is_default_fieldID) != 0);
  res->is_dark_ = (env->GetBooleanField(p, res->is_dark_fieldID) != 0);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->document_ = jni::fetch_tl_object<document>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->type_ = jni::fetch_tl_object<BackgroundType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void background::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetBooleanField(s, is_default_fieldID, is_default_);
  env->SetBooleanField(s, is_dark_fieldID, is_dark_);
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (document_ != nullptr) { jobject next; document_->store(env, next); if (next) { env->SetObjectField(s, document_fieldID, next); env->DeleteLocalRef(next); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void background::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Background");
    s.store_field("id", id_);
    s.store_field("isDefault", is_default_);
    s.store_field("isDark", is_dark_);
    s.store_field("name", name_);
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void background::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Background").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    is_default_fieldID = jni::get_field_id(env, Class, "isDefault", "Z");
    is_dark_fieldID = jni::get_field_id(env, Class, "isDark", "Z");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Document;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BackgroundType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass basicGroupFullInfo::Class;
jfieldID basicGroupFullInfo::photo_fieldID;
jfieldID basicGroupFullInfo::description_fieldID;
jfieldID basicGroupFullInfo::creator_user_id_fieldID;
jfieldID basicGroupFullInfo::members_fieldID;
jfieldID basicGroupFullInfo::can_hide_members_fieldID;
jfieldID basicGroupFullInfo::can_toggle_aggressive_anti_spam_fieldID;
jfieldID basicGroupFullInfo::invite_link_fieldID;
jfieldID basicGroupFullInfo::bot_commands_fieldID;

basicGroupFullInfo::basicGroupFullInfo()
  : photo_()
  , description_()
  , creator_user_id_()
  , members_()
  , can_hide_members_()
  , can_toggle_aggressive_anti_spam_()
  , invite_link_()
  , bot_commands_()
{}

basicGroupFullInfo::basicGroupFullInfo(object_ptr<chatPhoto> &&photo_, string const &description_, int53 creator_user_id_, array<object_ptr<chatMember>> &&members_, bool can_hide_members_, bool can_toggle_aggressive_anti_spam_, object_ptr<chatInviteLink> &&invite_link_, array<object_ptr<botCommands>> &&bot_commands_)
  : photo_(std::move(photo_))
  , description_(description_)
  , creator_user_id_(creator_user_id_)
  , members_(std::move(members_))
  , can_hide_members_(can_hide_members_)
  , can_toggle_aggressive_anti_spam_(can_toggle_aggressive_anti_spam_)
  , invite_link_(std::move(invite_link_))
  , bot_commands_(std::move(bot_commands_))
{}

const std::int32_t basicGroupFullInfo::ID;

object_ptr<basicGroupFullInfo> basicGroupFullInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<basicGroupFullInfo> res = make_object<basicGroupFullInfo>();
  res->photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->creator_user_id_ = env->GetLongField(p, res->creator_user_id_fieldID);
  res->members_ = jni::FetchVector<chatMember>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->members_fieldID));
  res->can_hide_members_ = (env->GetBooleanField(p, res->can_hide_members_fieldID) != 0);
  res->can_toggle_aggressive_anti_spam_ = (env->GetBooleanField(p, res->can_toggle_aggressive_anti_spam_fieldID) != 0);
  res->invite_link_ = jni::fetch_tl_object<chatInviteLink>(env, jni::fetch_object(env, p, res->invite_link_fieldID));
  res->bot_commands_ = jni::FetchVector<botCommands>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->bot_commands_fieldID));
  return res;
}

void basicGroupFullInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, creator_user_id_fieldID, creator_user_id_);
  { auto arr_tmp_ = jni::store_vector(env, members_); if (arr_tmp_) { env->SetObjectField(s, members_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, can_hide_members_fieldID, can_hide_members_);
  env->SetBooleanField(s, can_toggle_aggressive_anti_spam_fieldID, can_toggle_aggressive_anti_spam_);
  if (invite_link_ != nullptr) { jobject next; invite_link_->store(env, next); if (next) { env->SetObjectField(s, invite_link_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, bot_commands_); if (arr_tmp_) { env->SetObjectField(s, bot_commands_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void basicGroupFullInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BasicGroupFullInfo");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("description", description_);
    s.store_field("creatorUserId", creator_user_id_);
    { s.store_vector_begin("members", members_.size()); for (const auto &_value : members_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("canHideMembers", can_hide_members_);
    s.store_field("canToggleAggressiveAntiSpam", can_toggle_aggressive_anti_spam_);
    s.store_object_field("inviteLink", static_cast<const BaseObject *>(invite_link_.get()));
    { s.store_vector_begin("botCommands", bot_commands_.size()); for (const auto &_value : bot_commands_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void basicGroupFullInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BasicGroupFullInfo").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    creator_user_id_fieldID = jni::get_field_id(env, Class, "creatorUserId", "J");
    members_fieldID = jni::get_field_id(env, Class, "members", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ChatMember;").c_str());
    can_hide_members_fieldID = jni::get_field_id(env, Class, "canHideMembers", "Z");
    can_toggle_aggressive_anti_spam_fieldID = jni::get_field_id(env, Class, "canToggleAggressiveAntiSpam", "Z");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatInviteLink;").c_str());
    bot_commands_fieldID = jni::get_field_id(env, Class, "botCommands", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BotCommands;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass botCommands::Class;
jfieldID botCommands::bot_user_id_fieldID;
jfieldID botCommands::commands_fieldID;

botCommands::botCommands()
  : bot_user_id_()
  , commands_()
{}

botCommands::botCommands(int53 bot_user_id_, array<object_ptr<botCommand>> &&commands_)
  : bot_user_id_(bot_user_id_)
  , commands_(std::move(commands_))
{}

const std::int32_t botCommands::ID;

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

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

void botCommands::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotCommands");
    s.store_field("botUserId", bot_user_id_);
    { 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 botCommands::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotCommands").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    commands_fieldID = jni::get_field_id(env, Class, "commands", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$BotCommand;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass businessChatLinks::Class;
jfieldID businessChatLinks::links_fieldID;

businessChatLinks::businessChatLinks()
  : links_()
{}

businessChatLinks::businessChatLinks(array<object_ptr<businessChatLink>> &&links_)
  : links_(std::move(links_))
{}

const std::int32_t businessChatLinks::ID;

object_ptr<businessChatLinks> businessChatLinks::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessChatLinks> res = make_object<businessChatLinks>();
  res->links_ = jni::FetchVector<businessChatLink>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->links_fieldID));
  return res;
}

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

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

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

jclass businessFeaturePromotionAnimation::Class;
jfieldID businessFeaturePromotionAnimation::feature_fieldID;
jfieldID businessFeaturePromotionAnimation::animation_fieldID;

businessFeaturePromotionAnimation::businessFeaturePromotionAnimation()
  : feature_()
  , animation_()
{}

businessFeaturePromotionAnimation::businessFeaturePromotionAnimation(object_ptr<BusinessFeature> &&feature_, object_ptr<animation> &&animation_)
  : feature_(std::move(feature_))
  , animation_(std::move(animation_))
{}

const std::int32_t businessFeaturePromotionAnimation::ID;

object_ptr<businessFeaturePromotionAnimation> businessFeaturePromotionAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessFeaturePromotionAnimation> res = make_object<businessFeaturePromotionAnimation>();
  res->feature_ = jni::fetch_tl_object<BusinessFeature>(env, jni::fetch_object(env, p, res->feature_fieldID));
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  return res;
}

void businessFeaturePromotionAnimation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (feature_ != nullptr) { jobject next; feature_->store(env, next); if (next) { env->SetObjectField(s, feature_fieldID, next); env->DeleteLocalRef(next); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
}

void businessFeaturePromotionAnimation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessFeaturePromotionAnimation");
    s.store_object_field("feature", static_cast<const BaseObject *>(feature_.get()));
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_class_end();
  }
}

void businessFeaturePromotionAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessFeaturePromotionAnimation").c_str());
    feature_fieldID = jni::get_field_id(env, Class, "feature", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessFeature;").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass businessGreetingMessageSettings::Class;
jfieldID businessGreetingMessageSettings::shortcut_id_fieldID;
jfieldID businessGreetingMessageSettings::recipients_fieldID;
jfieldID businessGreetingMessageSettings::inactivity_days_fieldID;

businessGreetingMessageSettings::businessGreetingMessageSettings()
  : shortcut_id_()
  , recipients_()
  , inactivity_days_()
{}

businessGreetingMessageSettings::businessGreetingMessageSettings(int32 shortcut_id_, object_ptr<businessRecipients> &&recipients_, int32 inactivity_days_)
  : shortcut_id_(shortcut_id_)
  , recipients_(std::move(recipients_))
  , inactivity_days_(inactivity_days_)
{}

const std::int32_t businessGreetingMessageSettings::ID;

object_ptr<businessGreetingMessageSettings> businessGreetingMessageSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessGreetingMessageSettings> res = make_object<businessGreetingMessageSettings>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->recipients_ = jni::fetch_tl_object<businessRecipients>(env, jni::fetch_object(env, p, res->recipients_fieldID));
  res->inactivity_days_ = env->GetIntField(p, res->inactivity_days_fieldID);
  return res;
}

void businessGreetingMessageSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, shortcut_id_fieldID, shortcut_id_);
  if (recipients_ != nullptr) { jobject next; recipients_->store(env, next); if (next) { env->SetObjectField(s, recipients_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, inactivity_days_fieldID, inactivity_days_);
}

void businessGreetingMessageSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessGreetingMessageSettings");
    s.store_field("shortcutId", shortcut_id_);
    s.store_object_field("recipients", static_cast<const BaseObject *>(recipients_.get()));
    s.store_field("inactivityDays", inactivity_days_);
    s.store_class_end();
  }
}

void businessGreetingMessageSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessGreetingMessageSettings").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    recipients_fieldID = jni::get_field_id(env, Class, "recipients", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessRecipients;").c_str());
    inactivity_days_fieldID = jni::get_field_id(env, Class, "inactivityDays", "I");
    return true;
  }();
  (void)is_inited;
}

jclass businessStartPage::Class;
jfieldID businessStartPage::title_fieldID;
jfieldID businessStartPage::message_fieldID;
jfieldID businessStartPage::sticker_fieldID;

businessStartPage::businessStartPage()
  : title_()
  , message_()
  , sticker_()
{}

businessStartPage::businessStartPage(string const &title_, string const &message_, object_ptr<sticker> &&sticker_)
  : title_(title_)
  , message_(message_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t businessStartPage::ID;

object_ptr<businessStartPage> businessStartPage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessStartPage> res = make_object<businessStartPage>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->message_ = jni::fetch_string(env, p, res->message_fieldID);
  res->sticker_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

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

void businessStartPage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessStartPage");
    s.store_field("title", title_);
    s.store_field("message", message_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

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

jclass chatBoost::Class;
jfieldID chatBoost::id_fieldID;
jfieldID chatBoost::count_fieldID;
jfieldID chatBoost::source_fieldID;
jfieldID chatBoost::start_date_fieldID;
jfieldID chatBoost::expiration_date_fieldID;

chatBoost::chatBoost()
  : id_()
  , count_()
  , source_()
  , start_date_()
  , expiration_date_()
{}

chatBoost::chatBoost(string const &id_, int32 count_, object_ptr<ChatBoostSource> &&source_, int32 start_date_, int32 expiration_date_)
  : id_(id_)
  , count_(count_)
  , source_(std::move(source_))
  , start_date_(start_date_)
  , expiration_date_(expiration_date_)
{}

const std::int32_t chatBoost::ID;

object_ptr<chatBoost> chatBoost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoost> res = make_object<chatBoost>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->count_ = env->GetIntField(p, res->count_fieldID);
  res->source_ = jni::fetch_tl_object<ChatBoostSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  return res;
}

void chatBoost::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, count_fieldID, count_);
  if (source_ != nullptr) { jobject next; source_->store(env, next); if (next) { env->SetObjectField(s, source_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, start_date_fieldID, start_date_);
  env->SetIntField(s, expiration_date_fieldID, expiration_date_);
}

void chatBoost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBoost");
    s.store_field("id", id_);
    s.store_field("count", count_);
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_field("startDate", start_date_);
    s.store_field("expirationDate", expiration_date_);
    s.store_class_end();
  }
}

void chatBoost::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBoost").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    count_fieldID = jni::get_field_id(env, Class, "count", "I");
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatBoostSource;").c_str());
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatBoostSlot::Class;
jfieldID chatBoostSlot::slot_id_fieldID;
jfieldID chatBoostSlot::currently_boosted_chat_id_fieldID;
jfieldID chatBoostSlot::start_date_fieldID;
jfieldID chatBoostSlot::expiration_date_fieldID;
jfieldID chatBoostSlot::cooldown_until_date_fieldID;

chatBoostSlot::chatBoostSlot()
  : slot_id_()
  , currently_boosted_chat_id_()
  , start_date_()
  , expiration_date_()
  , cooldown_until_date_()
{}

chatBoostSlot::chatBoostSlot(int32 slot_id_, int53 currently_boosted_chat_id_, int32 start_date_, int32 expiration_date_, int32 cooldown_until_date_)
  : slot_id_(slot_id_)
  , currently_boosted_chat_id_(currently_boosted_chat_id_)
  , start_date_(start_date_)
  , expiration_date_(expiration_date_)
  , cooldown_until_date_(cooldown_until_date_)
{}

const std::int32_t chatBoostSlot::ID;

object_ptr<chatBoostSlot> chatBoostSlot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostSlot> res = make_object<chatBoostSlot>();
  res->slot_id_ = env->GetIntField(p, res->slot_id_fieldID);
  res->currently_boosted_chat_id_ = env->GetLongField(p, res->currently_boosted_chat_id_fieldID);
  res->start_date_ = env->GetIntField(p, res->start_date_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  res->cooldown_until_date_ = env->GetIntField(p, res->cooldown_until_date_fieldID);
  return res;
}

void chatBoostSlot::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, slot_id_fieldID, slot_id_);
  env->SetLongField(s, currently_boosted_chat_id_fieldID, currently_boosted_chat_id_);
  env->SetIntField(s, start_date_fieldID, start_date_);
  env->SetIntField(s, expiration_date_fieldID, expiration_date_);
  env->SetIntField(s, cooldown_until_date_fieldID, cooldown_until_date_);
}

void chatBoostSlot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBoostSlot");
    s.store_field("slotId", slot_id_);
    s.store_field("currentlyBoostedChatId", currently_boosted_chat_id_);
    s.store_field("startDate", start_date_);
    s.store_field("expirationDate", expiration_date_);
    s.store_field("cooldownUntilDate", cooldown_until_date_);
    s.store_class_end();
  }
}

void chatBoostSlot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBoostSlot").c_str());
    slot_id_fieldID = jni::get_field_id(env, Class, "slotId", "I");
    currently_boosted_chat_id_fieldID = jni::get_field_id(env, Class, "currentlyBoostedChatId", "J");
    start_date_fieldID = jni::get_field_id(env, Class, "startDate", "I");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    cooldown_until_date_fieldID = jni::get_field_id(env, Class, "cooldownUntilDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatFolderIcon::Class;
jfieldID chatFolderIcon::name_fieldID;

chatFolderIcon::chatFolderIcon()
  : name_()
{}

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

const std::int32_t chatFolderIcon::ID;

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

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

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

jclass ChatMembersFilter::Class;

object_ptr<ChatMembersFilter> ChatMembersFilter::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case chatMembersFilterContacts::ID:
      return chatMembersFilterContacts::fetch(env, p);
    case chatMembersFilterAdministrators::ID:
      return chatMembersFilterAdministrators::fetch(env, p);
    case chatMembersFilterMembers::ID:
      return chatMembersFilterMembers::fetch(env, p);
    case chatMembersFilterMention::ID:
      return chatMembersFilterMention::fetch(env, p);
    case chatMembersFilterRestricted::ID:
      return chatMembersFilterRestricted::fetch(env, p);
    case chatMembersFilterBanned::ID:
      return chatMembersFilterBanned::fetch(env, p);
    case chatMembersFilterBots::ID:
      return chatMembersFilterBots::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass chatMembersFilterContacts::Class;

chatMembersFilterContacts::chatMembersFilterContacts() {
}

const std::int32_t chatMembersFilterContacts::ID;

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

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

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

jclass chatMembersFilterAdministrators::Class;

chatMembersFilterAdministrators::chatMembersFilterAdministrators() {
}

const std::int32_t chatMembersFilterAdministrators::ID;

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

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

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

jclass chatMembersFilterMembers::Class;

chatMembersFilterMembers::chatMembersFilterMembers() {
}

const std::int32_t chatMembersFilterMembers::ID;

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

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

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

jclass chatMembersFilterMention::Class;
jfieldID chatMembersFilterMention::topic_id_fieldID;

chatMembersFilterMention::chatMembersFilterMention()
  : topic_id_()
{}

chatMembersFilterMention::chatMembersFilterMention(object_ptr<MessageTopic> &&topic_id_)
  : topic_id_(std::move(topic_id_))
{}

const std::int32_t chatMembersFilterMention::ID;

object_ptr<ChatMembersFilter> chatMembersFilterMention::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatMembersFilterMention> res = make_object<chatMembersFilterMention>();
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  return std::move(res);
}

void chatMembersFilterMention::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatMembersFilterMention");
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_class_end();
  }
}

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

jclass chatMembersFilterRestricted::Class;

chatMembersFilterRestricted::chatMembersFilterRestricted() {
}

const std::int32_t chatMembersFilterRestricted::ID;

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

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

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

jclass chatMembersFilterBanned::Class;

chatMembersFilterBanned::chatMembersFilterBanned() {
}

const std::int32_t chatMembersFilterBanned::ID;

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

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

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

jclass chatMembersFilterBots::Class;

chatMembersFilterBots::chatMembersFilterBots() {
}

const std::int32_t chatMembersFilterBots::ID;

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

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

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

jclass connectedAffiliateProgram::Class;
jfieldID connectedAffiliateProgram::url_fieldID;
jfieldID connectedAffiliateProgram::bot_user_id_fieldID;
jfieldID connectedAffiliateProgram::parameters_fieldID;
jfieldID connectedAffiliateProgram::connection_date_fieldID;
jfieldID connectedAffiliateProgram::is_disconnected_fieldID;
jfieldID connectedAffiliateProgram::user_count_fieldID;
jfieldID connectedAffiliateProgram::revenue_star_count_fieldID;

connectedAffiliateProgram::connectedAffiliateProgram()
  : url_()
  , bot_user_id_()
  , parameters_()
  , connection_date_()
  , is_disconnected_()
  , user_count_()
  , revenue_star_count_()
{}

connectedAffiliateProgram::connectedAffiliateProgram(string const &url_, int53 bot_user_id_, object_ptr<affiliateProgramParameters> &&parameters_, int32 connection_date_, bool is_disconnected_, int64 user_count_, int53 revenue_star_count_)
  : url_(url_)
  , bot_user_id_(bot_user_id_)
  , parameters_(std::move(parameters_))
  , connection_date_(connection_date_)
  , is_disconnected_(is_disconnected_)
  , user_count_(user_count_)
  , revenue_star_count_(revenue_star_count_)
{}

const std::int32_t connectedAffiliateProgram::ID;

object_ptr<connectedAffiliateProgram> connectedAffiliateProgram::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<connectedAffiliateProgram> res = make_object<connectedAffiliateProgram>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->parameters_ = jni::fetch_tl_object<affiliateProgramParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->connection_date_ = env->GetIntField(p, res->connection_date_fieldID);
  res->is_disconnected_ = (env->GetBooleanField(p, res->is_disconnected_fieldID) != 0);
  res->user_count_ = env->GetLongField(p, res->user_count_fieldID);
  res->revenue_star_count_ = env->GetLongField(p, res->revenue_star_count_fieldID);
  return res;
}

void connectedAffiliateProgram::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, bot_user_id_fieldID, bot_user_id_);
  if (parameters_ != nullptr) { jobject next; parameters_->store(env, next); if (next) { env->SetObjectField(s, parameters_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, connection_date_fieldID, connection_date_);
  env->SetBooleanField(s, is_disconnected_fieldID, is_disconnected_);
  env->SetLongField(s, user_count_fieldID, user_count_);
  env->SetLongField(s, revenue_star_count_fieldID, revenue_star_count_);
}

void connectedAffiliateProgram::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectedAffiliateProgram");
    s.store_field("url", url_);
    s.store_field("botUserId", bot_user_id_);
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("connectionDate", connection_date_);
    s.store_field("isDisconnected", is_disconnected_);
    s.store_field("userCount", user_count_);
    s.store_field("revenueStarCount", revenue_star_count_);
    s.store_class_end();
  }
}

void connectedAffiliateProgram::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectedAffiliateProgram").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AffiliateProgramParameters;").c_str());
    connection_date_fieldID = jni::get_field_id(env, Class, "connectionDate", "I");
    is_disconnected_fieldID = jni::get_field_id(env, Class, "isDisconnected", "Z");
    user_count_fieldID = jni::get_field_id(env, Class, "userCount", "J");
    revenue_star_count_fieldID = jni::get_field_id(env, Class, "revenueStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass currentWeather::Class;
jfieldID currentWeather::temperature_fieldID;
jfieldID currentWeather::emoji_fieldID;

currentWeather::currentWeather()
  : temperature_()
  , emoji_()
{}

currentWeather::currentWeather(double temperature_, string const &emoji_)
  : temperature_(temperature_)
  , emoji_(emoji_)
{}

const std::int32_t currentWeather::ID;

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

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

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

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

jclass diffEntity::Class;
jfieldID diffEntity::offset_fieldID;
jfieldID diffEntity::length_fieldID;
jfieldID diffEntity::type_fieldID;

diffEntity::diffEntity()
  : offset_()
  , length_()
  , type_()
{}

diffEntity::diffEntity(int32 offset_, int32 length_, object_ptr<DiffEntityType> &&type_)
  : offset_(offset_)
  , length_(length_)
  , type_(std::move(type_))
{}

const std::int32_t diffEntity::ID;

object_ptr<diffEntity> diffEntity::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<diffEntity> res = make_object<diffEntity>();
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->length_ = env->GetIntField(p, res->length_fieldID);
  res->type_ = jni::fetch_tl_object<DiffEntityType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void diffEntity::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, offset_fieldID, offset_);
  env->SetIntField(s, length_fieldID, length_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void diffEntity::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DiffEntity");
    s.store_field("offset", offset_);
    s.store_field("length", length_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void diffEntity::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DiffEntity").c_str());
    offset_fieldID = jni::get_field_id(env, Class, "offset", "I");
    length_fieldID = jni::get_field_id(env, Class, "length", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$DiffEntityType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass document::Class;
jfieldID document::file_name_fieldID;
jfieldID document::mime_type_fieldID;
jfieldID document::minithumbnail_fieldID;
jfieldID document::thumbnail_fieldID;
jfieldID document::document_fieldID;

document::document()
  : file_name_()
  , mime_type_()
  , minithumbnail_()
  , thumbnail_()
  , document_()
{}

document::document(string const &file_name_, string const &mime_type_, object_ptr<minithumbnail> &&minithumbnail_, object_ptr<thumbnail> &&thumbnail_, object_ptr<file> &&document_)
  : file_name_(file_name_)
  , mime_type_(mime_type_)
  , minithumbnail_(std::move(minithumbnail_))
  , thumbnail_(std::move(thumbnail_))
  , document_(std::move(document_))
{}

const std::int32_t document::ID;

object_ptr<document> document::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<document> res = make_object<document>();
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->document_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->document_fieldID));
  return res;
}

void document::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, file_name_); if (nextString) { env->SetObjectField(s, file_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (document_ != nullptr) { jobject next; document_->store(env, next); if (next) { env->SetObjectField(s, document_fieldID, next); env->DeleteLocalRef(next); } }
}

void document::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Document");
    s.store_field("fileName", file_name_);
    s.store_field("mimeType", mime_type_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("document", static_cast<const BaseObject *>(document_.get()));
    s.store_class_end();
  }
}

void document::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Document").c_str());
    file_name_fieldID = jni::get_field_id(env, Class, "fileName", "Ljava/lang/String;");
    mime_type_fieldID = jni::get_field_id(env, Class, "mimeType", "Ljava/lang/String;");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass emojiKeywords::Class;
jfieldID emojiKeywords::emoji_keywords_fieldID;

emojiKeywords::emojiKeywords()
  : emoji_keywords_()
{}

emojiKeywords::emojiKeywords(array<object_ptr<emojiKeyword>> &&emoji_keywords_)
  : emoji_keywords_(std::move(emoji_keywords_))
{}

const std::int32_t emojiKeywords::ID;

object_ptr<emojiKeywords> emojiKeywords::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiKeywords> res = make_object<emojiKeywords>();
  res->emoji_keywords_ = jni::FetchVector<emojiKeyword>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->emoji_keywords_fieldID));
  return res;
}

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

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

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

jclass emojis::Class;
jfieldID emojis::emojis_fieldID;

emojis::emojis()
  : emojis_()
{}

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

const std::int32_t emojis::ID;

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

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

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

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

jclass error::Class;
jfieldID error::code_fieldID;
jfieldID error::message_fieldID;

error::error()
  : code_()
  , message_()
{}

error::error(int32 code_, string const &message_)
  : code_(code_)
  , message_(message_)
{}

const std::int32_t error::ID;

object_ptr<error> error::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<error> res = make_object<error>();
  res->code_ = env->GetIntField(p, res->code_fieldID);
  res->message_ = jni::fetch_string(env, p, res->message_fieldID);
  return res;
}

void error::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, code_fieldID, code_);
  { jstring nextString = jni::to_jstring(env, message_); if (nextString) { env->SetObjectField(s, message_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void error::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Error");
    s.store_field("code", code_);
    s.store_field("message", message_);
    s.store_class_end();
  }
}

void error::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Error").c_str());
    code_fieldID = jni::get_field_id(env, Class, "code", "I");
    message_fieldID = jni::get_field_id(env, Class, "message", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass fileDownload::Class;
jfieldID fileDownload::file_id_fieldID;
jfieldID fileDownload::message_fieldID;
jfieldID fileDownload::add_date_fieldID;
jfieldID fileDownload::complete_date_fieldID;
jfieldID fileDownload::is_paused_fieldID;

fileDownload::fileDownload()
  : file_id_()
  , message_()
  , add_date_()
  , complete_date_()
  , is_paused_()
{}

fileDownload::fileDownload(int32 file_id_, object_ptr<message> &&message_, int32 add_date_, int32 complete_date_, bool is_paused_)
  : file_id_(file_id_)
  , message_(std::move(message_))
  , add_date_(add_date_)
  , complete_date_(complete_date_)
  , is_paused_(is_paused_)
{}

const std::int32_t fileDownload::ID;

object_ptr<fileDownload> fileDownload::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<fileDownload> res = make_object<fileDownload>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->add_date_ = env->GetIntField(p, res->add_date_fieldID);
  res->complete_date_ = env->GetIntField(p, res->complete_date_fieldID);
  res->is_paused_ = (env->GetBooleanField(p, res->is_paused_fieldID) != 0);
  return res;
}

void fileDownload::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, file_id_fieldID, file_id_);
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, add_date_fieldID, add_date_);
  env->SetIntField(s, complete_date_fieldID, complete_date_);
  env->SetBooleanField(s, is_paused_fieldID, is_paused_);
}

void fileDownload::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FileDownload");
    s.store_field("fileId", file_id_);
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_field("addDate", add_date_);
    s.store_field("completeDate", complete_date_);
    s.store_field("isPaused", is_paused_);
    s.store_class_end();
  }
}

void fileDownload::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FileDownload").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    add_date_fieldID = jni::get_field_id(env, Class, "addDate", "I");
    complete_date_fieldID = jni::get_field_id(env, Class, "completeDate", "I");
    is_paused_fieldID = jni::get_field_id(env, Class, "isPaused", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass FirebaseAuthenticationSettings::Class;

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

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

jclass firebaseAuthenticationSettingsAndroid::Class;

firebaseAuthenticationSettingsAndroid::firebaseAuthenticationSettingsAndroid() {
}

const std::int32_t firebaseAuthenticationSettingsAndroid::ID;

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

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

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

jclass firebaseAuthenticationSettingsIos::Class;
jfieldID firebaseAuthenticationSettingsIos::device_token_fieldID;
jfieldID firebaseAuthenticationSettingsIos::is_app_sandbox_fieldID;

firebaseAuthenticationSettingsIos::firebaseAuthenticationSettingsIos()
  : device_token_()
  , is_app_sandbox_()
{}

firebaseAuthenticationSettingsIos::firebaseAuthenticationSettingsIos(string const &device_token_, bool is_app_sandbox_)
  : device_token_(device_token_)
  , is_app_sandbox_(is_app_sandbox_)
{}

const std::int32_t firebaseAuthenticationSettingsIos::ID;

object_ptr<FirebaseAuthenticationSettings> firebaseAuthenticationSettingsIos::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<firebaseAuthenticationSettingsIos> res = make_object<firebaseAuthenticationSettingsIos>();
  res->device_token_ = jni::fetch_string(env, p, res->device_token_fieldID);
  res->is_app_sandbox_ = (env->GetBooleanField(p, res->is_app_sandbox_fieldID) != 0);
  return std::move(res);
}

void firebaseAuthenticationSettingsIos::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FirebaseAuthenticationSettingsIos");
    s.store_field("deviceToken", device_token_);
    s.store_field("isAppSandbox", is_app_sandbox_);
    s.store_class_end();
  }
}

void firebaseAuthenticationSettingsIos::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FirebaseAuthenticationSettingsIos").c_str());
    device_token_fieldID = jni::get_field_id(env, Class, "deviceToken", "Ljava/lang/String;");
    is_app_sandbox_fieldID = jni::get_field_id(env, Class, "isAppSandbox", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass forumTopic::Class;
jfieldID forumTopic::info_fieldID;
jfieldID forumTopic::last_message_fieldID;
jfieldID forumTopic::order_fieldID;
jfieldID forumTopic::is_pinned_fieldID;
jfieldID forumTopic::unread_count_fieldID;
jfieldID forumTopic::last_read_inbox_message_id_fieldID;
jfieldID forumTopic::last_read_outbox_message_id_fieldID;
jfieldID forumTopic::unread_mention_count_fieldID;
jfieldID forumTopic::unread_reaction_count_fieldID;
jfieldID forumTopic::unread_poll_vote_count_fieldID;
jfieldID forumTopic::notification_settings_fieldID;
jfieldID forumTopic::draft_message_fieldID;

forumTopic::forumTopic()
  : info_()
  , last_message_()
  , order_()
  , is_pinned_()
  , unread_count_()
  , last_read_inbox_message_id_()
  , last_read_outbox_message_id_()
  , unread_mention_count_()
  , unread_reaction_count_()
  , unread_poll_vote_count_()
  , notification_settings_()
  , draft_message_()
{}

forumTopic::forumTopic(object_ptr<forumTopicInfo> &&info_, object_ptr<message> &&last_message_, int64 order_, bool is_pinned_, 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<draftMessage> &&draft_message_)
  : info_(std::move(info_))
  , last_message_(std::move(last_message_))
  , order_(order_)
  , is_pinned_(is_pinned_)
  , 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_))
  , draft_message_(std::move(draft_message_))
{}

const std::int32_t forumTopic::ID;

object_ptr<forumTopic> forumTopic::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<forumTopic> res = make_object<forumTopic>();
  res->info_ = jni::fetch_tl_object<forumTopicInfo>(env, jni::fetch_object(env, p, res->info_fieldID));
  res->last_message_ = jni::fetch_tl_object<message>(env, jni::fetch_object(env, p, res->last_message_fieldID));
  res->order_ = env->GetLongField(p, res->order_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_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->draft_message_ = jni::fetch_tl_object<draftMessage>(env, jni::fetch_object(env, p, res->draft_message_fieldID));
  return res;
}

void forumTopic::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (info_ != nullptr) { jobject next; info_->store(env, next); if (next) { env->SetObjectField(s, info_fieldID, next); env->DeleteLocalRef(next); } }
  if (last_message_ != nullptr) { jobject next; last_message_->store(env, next); if (next) { env->SetObjectField(s, last_message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, order_fieldID, order_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
  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 (draft_message_ != nullptr) { jobject next; draft_message_->store(env, next); if (next) { env->SetObjectField(s, draft_message_fieldID, next); env->DeleteLocalRef(next); } }
}

void forumTopic::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ForumTopic");
    s.store_object_field("info", static_cast<const BaseObject *>(info_.get()));
    s.store_object_field("lastMessage", static_cast<const BaseObject *>(last_message_.get()));
    s.store_field("order", order_);
    s.store_field("isPinned", is_pinned_);
    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("draftMessage", static_cast<const BaseObject *>(draft_message_.get()));
    s.store_class_end();
  }
}

void forumTopic::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ForumTopic").c_str());
    info_fieldID = jni::get_field_id(env, Class, "info", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ForumTopicInfo;").c_str());
    last_message_fieldID = jni::get_field_id(env, Class, "lastMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Message;").c_str());
    order_fieldID = jni::get_field_id(env, Class, "order", "J");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "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());
    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 forumTopicIcon::Class;
jfieldID forumTopicIcon::color_fieldID;
jfieldID forumTopicIcon::custom_emoji_id_fieldID;

forumTopicIcon::forumTopicIcon()
  : color_()
  , custom_emoji_id_()
{}

forumTopicIcon::forumTopicIcon(int32 color_, int64 custom_emoji_id_)
  : color_(color_)
  , custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t forumTopicIcon::ID;

object_ptr<forumTopicIcon> forumTopicIcon::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<forumTopicIcon> res = make_object<forumTopicIcon>();
  res->color_ = env->GetIntField(p, res->color_fieldID);
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  return res;
}

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

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

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

jclass gameHighScore::Class;
jfieldID gameHighScore::position_fieldID;
jfieldID gameHighScore::user_id_fieldID;
jfieldID gameHighScore::score_fieldID;

gameHighScore::gameHighScore()
  : position_()
  , user_id_()
  , score_()
{}

gameHighScore::gameHighScore(int32 position_, int53 user_id_, int32 score_)
  : position_(position_)
  , user_id_(user_id_)
  , score_(score_)
{}

const std::int32_t gameHighScore::ID;

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

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

void gameHighScore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GameHighScore");
    s.store_field("position", position_);
    s.store_field("userId", user_id_);
    s.store_field("score", score_);
    s.store_class_end();
  }
}

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

jclass giftChatTheme::Class;
jfieldID giftChatTheme::gift_fieldID;
jfieldID giftChatTheme::light_settings_fieldID;
jfieldID giftChatTheme::dark_settings_fieldID;

giftChatTheme::giftChatTheme()
  : gift_()
  , light_settings_()
  , dark_settings_()
{}

giftChatTheme::giftChatTheme(object_ptr<upgradedGift> &&gift_, object_ptr<themeSettings> &&light_settings_, object_ptr<themeSettings> &&dark_settings_)
  : gift_(std::move(gift_))
  , light_settings_(std::move(light_settings_))
  , dark_settings_(std::move(dark_settings_))
{}

const std::int32_t giftChatTheme::ID;

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

void giftChatTheme::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  if (light_settings_ != nullptr) { jobject next; light_settings_->store(env, next); if (next) { env->SetObjectField(s, light_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (dark_settings_ != nullptr) { jobject next; dark_settings_->store(env, next); if (next) { env->SetObjectField(s, dark_settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void giftChatTheme::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftChatTheme");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_object_field("lightSettings", static_cast<const BaseObject *>(light_settings_.get()));
    s.store_object_field("darkSettings", static_cast<const BaseObject *>(dark_settings_.get()));
    s.store_class_end();
  }
}

void giftChatTheme::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftChatTheme").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    light_settings_fieldID = jni::get_field_id(env, Class, "lightSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThemeSettings;").c_str());
    dark_settings_fieldID = jni::get_field_id(env, Class, "darkSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThemeSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass giftUpgradeVariants::Class;
jfieldID giftUpgradeVariants::models_fieldID;
jfieldID giftUpgradeVariants::symbols_fieldID;
jfieldID giftUpgradeVariants::backdrops_fieldID;

giftUpgradeVariants::giftUpgradeVariants()
  : models_()
  , symbols_()
  , backdrops_()
{}

giftUpgradeVariants::giftUpgradeVariants(array<object_ptr<upgradedGiftModel>> &&models_, array<object_ptr<upgradedGiftSymbol>> &&symbols_, array<object_ptr<upgradedGiftBackdrop>> &&backdrops_)
  : models_(std::move(models_))
  , symbols_(std::move(symbols_))
  , backdrops_(std::move(backdrops_))
{}

const std::int32_t giftUpgradeVariants::ID;

object_ptr<giftUpgradeVariants> giftUpgradeVariants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftUpgradeVariants> res = make_object<giftUpgradeVariants>();
  res->models_ = jni::FetchVector<upgradedGiftModel>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->models_fieldID));
  res->symbols_ = jni::FetchVector<upgradedGiftSymbol>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->symbols_fieldID));
  res->backdrops_ = jni::FetchVector<upgradedGiftBackdrop>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->backdrops_fieldID));
  return res;
}

void giftUpgradeVariants::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, models_); if (arr_tmp_) { env->SetObjectField(s, models_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, symbols_); if (arr_tmp_) { env->SetObjectField(s, symbols_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, backdrops_); if (arr_tmp_) { env->SetObjectField(s, backdrops_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void giftUpgradeVariants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftUpgradeVariants");
    { s.store_vector_begin("models", models_.size()); for (const auto &_value : models_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("symbols", symbols_.size()); for (const auto &_value : symbols_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("backdrops", backdrops_.size()); for (const auto &_value : backdrops_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void giftUpgradeVariants::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftUpgradeVariants").c_str());
    models_fieldID = jni::get_field_id(env, Class, "models", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftModel;").c_str());
    symbols_fieldID = jni::get_field_id(env, Class, "symbols", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftSymbol;").c_str());
    backdrops_fieldID = jni::get_field_id(env, Class, "backdrops", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftBackdrop;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass giftsForCrafting::Class;
jfieldID giftsForCrafting::total_count_fieldID;
jfieldID giftsForCrafting::gifts_fieldID;
jfieldID giftsForCrafting::attribute_persistence_probabilities_fieldID;
jfieldID giftsForCrafting::next_offset_fieldID;

giftsForCrafting::giftsForCrafting()
  : total_count_()
  , gifts_()
  , attribute_persistence_probabilities_()
  , next_offset_()
{}

giftsForCrafting::giftsForCrafting(int32 total_count_, array<object_ptr<receivedGift>> &&gifts_, array<object_ptr<attributeCraftPersistenceProbability>> &&attribute_persistence_probabilities_, string const &next_offset_)
  : total_count_(total_count_)
  , gifts_(std::move(gifts_))
  , attribute_persistence_probabilities_(std::move(attribute_persistence_probabilities_))
  , next_offset_(next_offset_)
{}

const std::int32_t giftsForCrafting::ID;

object_ptr<giftsForCrafting> giftsForCrafting::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftsForCrafting> res = make_object<giftsForCrafting>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->gifts_ = jni::FetchVector<receivedGift>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->gifts_fieldID));
  res->attribute_persistence_probabilities_ = jni::FetchVector<attributeCraftPersistenceProbability>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->attribute_persistence_probabilities_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void giftsForCrafting::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, gifts_); if (arr_tmp_) { env->SetObjectField(s, gifts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, attribute_persistence_probabilities_); if (arr_tmp_) { env->SetObjectField(s, attribute_persistence_probabilities_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 giftsForCrafting::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftsForCrafting");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("gifts", gifts_.size()); for (const auto &_value : gifts_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("attributePersistenceProbabilities", attribute_persistence_probabilities_.size()); for (const auto &_value : attribute_persistence_probabilities_) { 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 giftsForCrafting::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftsForCrafting").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    gifts_fieldID = jni::get_field_id(env, Class, "gifts", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReceivedGift;").c_str());
    attribute_persistence_probabilities_fieldID = jni::get_field_id(env, Class, "attributePersistenceProbabilities", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AttributeCraftPersistenceProbability;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass GiveawayInfo::Class;

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

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

jclass giveawayInfoOngoing::Class;
jfieldID giveawayInfoOngoing::creation_date_fieldID;
jfieldID giveawayInfoOngoing::status_fieldID;
jfieldID giveawayInfoOngoing::is_ended_fieldID;

giveawayInfoOngoing::giveawayInfoOngoing()
  : creation_date_()
  , status_()
  , is_ended_()
{}

giveawayInfoOngoing::giveawayInfoOngoing(int32 creation_date_, object_ptr<GiveawayParticipantStatus> &&status_, bool is_ended_)
  : creation_date_(creation_date_)
  , status_(std::move(status_))
  , is_ended_(is_ended_)
{}

const std::int32_t giveawayInfoOngoing::ID;

object_ptr<GiveawayInfo> giveawayInfoOngoing::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayInfoOngoing> res = make_object<giveawayInfoOngoing>();
  res->creation_date_ = env->GetIntField(p, res->creation_date_fieldID);
  res->status_ = jni::fetch_tl_object<GiveawayParticipantStatus>(env, jni::fetch_object(env, p, res->status_fieldID));
  res->is_ended_ = (env->GetBooleanField(p, res->is_ended_fieldID) != 0);
  return std::move(res);
}

void giveawayInfoOngoing::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, creation_date_fieldID, creation_date_);
  if (status_ != nullptr) { jobject next; status_->store(env, next); if (next) { env->SetObjectField(s, status_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_ended_fieldID, is_ended_);
}

void giveawayInfoOngoing::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiveawayInfoOngoing");
    s.store_field("creationDate", creation_date_);
    s.store_object_field("status", static_cast<const BaseObject *>(status_.get()));
    s.store_field("isEnded", is_ended_);
    s.store_class_end();
  }
}

void giveawayInfoOngoing::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiveawayInfoOngoing").c_str());
    creation_date_fieldID = jni::get_field_id(env, Class, "creationDate", "I");
    status_fieldID = jni::get_field_id(env, Class, "status", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayParticipantStatus;").c_str());
    is_ended_fieldID = jni::get_field_id(env, Class, "isEnded", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass giveawayInfoCompleted::Class;
jfieldID giveawayInfoCompleted::creation_date_fieldID;
jfieldID giveawayInfoCompleted::actual_winners_selection_date_fieldID;
jfieldID giveawayInfoCompleted::was_refunded_fieldID;
jfieldID giveawayInfoCompleted::is_winner_fieldID;
jfieldID giveawayInfoCompleted::winner_count_fieldID;
jfieldID giveawayInfoCompleted::activation_count_fieldID;
jfieldID giveawayInfoCompleted::gift_code_fieldID;
jfieldID giveawayInfoCompleted::won_star_count_fieldID;

giveawayInfoCompleted::giveawayInfoCompleted()
  : creation_date_()
  , actual_winners_selection_date_()
  , was_refunded_()
  , is_winner_()
  , winner_count_()
  , activation_count_()
  , gift_code_()
  , won_star_count_()
{}

giveawayInfoCompleted::giveawayInfoCompleted(int32 creation_date_, int32 actual_winners_selection_date_, bool was_refunded_, bool is_winner_, int32 winner_count_, int32 activation_count_, string const &gift_code_, int53 won_star_count_)
  : creation_date_(creation_date_)
  , actual_winners_selection_date_(actual_winners_selection_date_)
  , was_refunded_(was_refunded_)
  , is_winner_(is_winner_)
  , winner_count_(winner_count_)
  , activation_count_(activation_count_)
  , gift_code_(gift_code_)
  , won_star_count_(won_star_count_)
{}

const std::int32_t giveawayInfoCompleted::ID;

object_ptr<GiveawayInfo> giveawayInfoCompleted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayInfoCompleted> res = make_object<giveawayInfoCompleted>();
  res->creation_date_ = env->GetIntField(p, res->creation_date_fieldID);
  res->actual_winners_selection_date_ = env->GetIntField(p, res->actual_winners_selection_date_fieldID);
  res->was_refunded_ = (env->GetBooleanField(p, res->was_refunded_fieldID) != 0);
  res->is_winner_ = (env->GetBooleanField(p, res->is_winner_fieldID) != 0);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->activation_count_ = env->GetIntField(p, res->activation_count_fieldID);
  res->gift_code_ = jni::fetch_string(env, p, res->gift_code_fieldID);
  res->won_star_count_ = env->GetLongField(p, res->won_star_count_fieldID);
  return std::move(res);
}

void giveawayInfoCompleted::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, creation_date_fieldID, creation_date_);
  env->SetIntField(s, actual_winners_selection_date_fieldID, actual_winners_selection_date_);
  env->SetBooleanField(s, was_refunded_fieldID, was_refunded_);
  env->SetBooleanField(s, is_winner_fieldID, is_winner_);
  env->SetIntField(s, winner_count_fieldID, winner_count_);
  env->SetIntField(s, activation_count_fieldID, activation_count_);
  { jstring nextString = jni::to_jstring(env, gift_code_); if (nextString) { env->SetObjectField(s, gift_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, won_star_count_fieldID, won_star_count_);
}

void giveawayInfoCompleted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiveawayInfoCompleted");
    s.store_field("creationDate", creation_date_);
    s.store_field("actualWinnersSelectionDate", actual_winners_selection_date_);
    s.store_field("wasRefunded", was_refunded_);
    s.store_field("isWinner", is_winner_);
    s.store_field("winnerCount", winner_count_);
    s.store_field("activationCount", activation_count_);
    s.store_field("giftCode", gift_code_);
    s.store_field("wonStarCount", won_star_count_);
    s.store_class_end();
  }
}

void giveawayInfoCompleted::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiveawayInfoCompleted").c_str());
    creation_date_fieldID = jni::get_field_id(env, Class, "creationDate", "I");
    actual_winners_selection_date_fieldID = jni::get_field_id(env, Class, "actualWinnersSelectionDate", "I");
    was_refunded_fieldID = jni::get_field_id(env, Class, "wasRefunded", "Z");
    is_winner_fieldID = jni::get_field_id(env, Class, "isWinner", "Z");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    activation_count_fieldID = jni::get_field_id(env, Class, "activationCount", "I");
    gift_code_fieldID = jni::get_field_id(env, Class, "giftCode", "Ljava/lang/String;");
    won_star_count_fieldID = jni::get_field_id(env, Class, "wonStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass giveawayParameters::Class;
jfieldID giveawayParameters::boosted_chat_id_fieldID;
jfieldID giveawayParameters::additional_chat_ids_fieldID;
jfieldID giveawayParameters::winners_selection_date_fieldID;
jfieldID giveawayParameters::only_new_members_fieldID;
jfieldID giveawayParameters::has_public_winners_fieldID;
jfieldID giveawayParameters::country_codes_fieldID;
jfieldID giveawayParameters::prize_description_fieldID;

giveawayParameters::giveawayParameters()
  : boosted_chat_id_()
  , additional_chat_ids_()
  , winners_selection_date_()
  , only_new_members_()
  , has_public_winners_()
  , country_codes_()
  , prize_description_()
{}

giveawayParameters::giveawayParameters(int53 boosted_chat_id_, array<int53> &&additional_chat_ids_, int32 winners_selection_date_, bool only_new_members_, bool has_public_winners_, array<string> &&country_codes_, string const &prize_description_)
  : boosted_chat_id_(boosted_chat_id_)
  , additional_chat_ids_(std::move(additional_chat_ids_))
  , winners_selection_date_(winners_selection_date_)
  , only_new_members_(only_new_members_)
  , has_public_winners_(has_public_winners_)
  , country_codes_(std::move(country_codes_))
  , prize_description_(prize_description_)
{}

const std::int32_t giveawayParameters::ID;

object_ptr<giveawayParameters> giveawayParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayParameters> res = make_object<giveawayParameters>();
  res->boosted_chat_id_ = env->GetLongField(p, res->boosted_chat_id_fieldID);
  res->additional_chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->additional_chat_ids_fieldID));
  res->winners_selection_date_ = env->GetIntField(p, res->winners_selection_date_fieldID);
  res->only_new_members_ = (env->GetBooleanField(p, res->only_new_members_fieldID) != 0);
  res->has_public_winners_ = (env->GetBooleanField(p, res->has_public_winners_fieldID) != 0);
  res->country_codes_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->country_codes_fieldID));
  res->prize_description_ = jni::fetch_string(env, p, res->prize_description_fieldID);
  return res;
}

void giveawayParameters::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, boosted_chat_id_fieldID, boosted_chat_id_);
  { auto arr_tmp_ = jni::store_vector(env, additional_chat_ids_); if (arr_tmp_) { env->SetObjectField(s, additional_chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, winners_selection_date_fieldID, winners_selection_date_);
  env->SetBooleanField(s, only_new_members_fieldID, only_new_members_);
  env->SetBooleanField(s, has_public_winners_fieldID, has_public_winners_);
  { auto arr_tmp_ = jni::store_vector(env, country_codes_); if (arr_tmp_) { env->SetObjectField(s, country_codes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, prize_description_); if (nextString) { env->SetObjectField(s, prize_description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void giveawayParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiveawayParameters");
    s.store_field("boostedChatId", boosted_chat_id_);
    { s.store_vector_begin("additionalChatIds", additional_chat_ids_.size()); for (const auto &_value : additional_chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("winnersSelectionDate", winners_selection_date_);
    s.store_field("onlyNewMembers", only_new_members_);
    s.store_field("hasPublicWinners", has_public_winners_);
    { s.store_vector_begin("countryCodes", country_codes_.size()); for (const auto &_value : country_codes_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("prizeDescription", prize_description_);
    s.store_class_end();
  }
}

void giveawayParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiveawayParameters").c_str());
    boosted_chat_id_fieldID = jni::get_field_id(env, Class, "boostedChatId", "J");
    additional_chat_ids_fieldID = jni::get_field_id(env, Class, "additionalChatIds", "[J");
    winners_selection_date_fieldID = jni::get_field_id(env, Class, "winnersSelectionDate", "I");
    only_new_members_fieldID = jni::get_field_id(env, Class, "onlyNewMembers", "Z");
    has_public_winners_fieldID = jni::get_field_id(env, Class, "hasPublicWinners", "Z");
    country_codes_fieldID = jni::get_field_id(env, Class, "countryCodes", "[Ljava/lang/String;");
    prize_description_fieldID = jni::get_field_id(env, Class, "prizeDescription", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass groupCall::Class;
jfieldID groupCall::id_fieldID;
jfieldID groupCall::unique_id_fieldID;
jfieldID groupCall::title_fieldID;
jfieldID groupCall::invite_link_fieldID;
jfieldID groupCall::paid_message_star_count_fieldID;
jfieldID groupCall::scheduled_start_date_fieldID;
jfieldID groupCall::enabled_start_notification_fieldID;
jfieldID groupCall::is_active_fieldID;
jfieldID groupCall::is_video_chat_fieldID;
jfieldID groupCall::is_live_story_fieldID;
jfieldID groupCall::is_rtmp_stream_fieldID;
jfieldID groupCall::is_joined_fieldID;
jfieldID groupCall::need_rejoin_fieldID;
jfieldID groupCall::is_owned_fieldID;
jfieldID groupCall::can_be_managed_fieldID;
jfieldID groupCall::participant_count_fieldID;
jfieldID groupCall::has_hidden_listeners_fieldID;
jfieldID groupCall::loaded_all_participants_fieldID;
jfieldID groupCall::message_sender_id_fieldID;
jfieldID groupCall::recent_speakers_fieldID;
jfieldID groupCall::is_my_video_enabled_fieldID;
jfieldID groupCall::is_my_video_paused_fieldID;
jfieldID groupCall::can_enable_video_fieldID;
jfieldID groupCall::mute_new_participants_fieldID;
jfieldID groupCall::can_toggle_mute_new_participants_fieldID;
jfieldID groupCall::can_send_messages_fieldID;
jfieldID groupCall::are_messages_allowed_fieldID;
jfieldID groupCall::can_toggle_are_messages_allowed_fieldID;
jfieldID groupCall::can_delete_messages_fieldID;
jfieldID groupCall::record_duration_fieldID;
jfieldID groupCall::is_video_recorded_fieldID;
jfieldID groupCall::duration_fieldID;

groupCall::groupCall()
  : id_()
  , unique_id_()
  , title_()
  , invite_link_()
  , paid_message_star_count_()
  , scheduled_start_date_()
  , enabled_start_notification_()
  , is_active_()
  , is_video_chat_()
  , is_live_story_()
  , is_rtmp_stream_()
  , is_joined_()
  , need_rejoin_()
  , is_owned_()
  , can_be_managed_()
  , participant_count_()
  , has_hidden_listeners_()
  , loaded_all_participants_()
  , message_sender_id_()
  , recent_speakers_()
  , is_my_video_enabled_()
  , is_my_video_paused_()
  , can_enable_video_()
  , mute_new_participants_()
  , can_toggle_mute_new_participants_()
  , can_send_messages_()
  , are_messages_allowed_()
  , can_toggle_are_messages_allowed_()
  , can_delete_messages_()
  , record_duration_()
  , is_video_recorded_()
  , duration_()
{}

groupCall::groupCall(int32 id_, int64 unique_id_, string const &title_, string const &invite_link_, int53 paid_message_star_count_, int32 scheduled_start_date_, bool enabled_start_notification_, bool is_active_, bool is_video_chat_, bool is_live_story_, bool is_rtmp_stream_, bool is_joined_, bool need_rejoin_, bool is_owned_, bool can_be_managed_, int32 participant_count_, bool has_hidden_listeners_, bool loaded_all_participants_, object_ptr<MessageSender> &&message_sender_id_, array<object_ptr<groupCallRecentSpeaker>> &&recent_speakers_, bool is_my_video_enabled_, bool is_my_video_paused_, bool can_enable_video_, bool mute_new_participants_, bool can_toggle_mute_new_participants_, bool can_send_messages_, bool are_messages_allowed_, bool can_toggle_are_messages_allowed_, bool can_delete_messages_, int32 record_duration_, bool is_video_recorded_, int32 duration_)
  : id_(id_)
  , unique_id_(unique_id_)
  , title_(title_)
  , invite_link_(invite_link_)
  , paid_message_star_count_(paid_message_star_count_)
  , scheduled_start_date_(scheduled_start_date_)
  , enabled_start_notification_(enabled_start_notification_)
  , is_active_(is_active_)
  , is_video_chat_(is_video_chat_)
  , is_live_story_(is_live_story_)
  , is_rtmp_stream_(is_rtmp_stream_)
  , is_joined_(is_joined_)
  , need_rejoin_(need_rejoin_)
  , is_owned_(is_owned_)
  , can_be_managed_(can_be_managed_)
  , participant_count_(participant_count_)
  , has_hidden_listeners_(has_hidden_listeners_)
  , loaded_all_participants_(loaded_all_participants_)
  , message_sender_id_(std::move(message_sender_id_))
  , recent_speakers_(std::move(recent_speakers_))
  , is_my_video_enabled_(is_my_video_enabled_)
  , is_my_video_paused_(is_my_video_paused_)
  , can_enable_video_(can_enable_video_)
  , mute_new_participants_(mute_new_participants_)
  , can_toggle_mute_new_participants_(can_toggle_mute_new_participants_)
  , can_send_messages_(can_send_messages_)
  , are_messages_allowed_(are_messages_allowed_)
  , can_toggle_are_messages_allowed_(can_toggle_are_messages_allowed_)
  , can_delete_messages_(can_delete_messages_)
  , record_duration_(record_duration_)
  , is_video_recorded_(is_video_recorded_)
  , duration_(duration_)
{}

const std::int32_t groupCall::ID;

object_ptr<groupCall> groupCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCall> res = make_object<groupCall>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->unique_id_ = env->GetLongField(p, res->unique_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  res->scheduled_start_date_ = env->GetIntField(p, res->scheduled_start_date_fieldID);
  res->enabled_start_notification_ = (env->GetBooleanField(p, res->enabled_start_notification_fieldID) != 0);
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  res->is_video_chat_ = (env->GetBooleanField(p, res->is_video_chat_fieldID) != 0);
  res->is_live_story_ = (env->GetBooleanField(p, res->is_live_story_fieldID) != 0);
  res->is_rtmp_stream_ = (env->GetBooleanField(p, res->is_rtmp_stream_fieldID) != 0);
  res->is_joined_ = (env->GetBooleanField(p, res->is_joined_fieldID) != 0);
  res->need_rejoin_ = (env->GetBooleanField(p, res->need_rejoin_fieldID) != 0);
  res->is_owned_ = (env->GetBooleanField(p, res->is_owned_fieldID) != 0);
  res->can_be_managed_ = (env->GetBooleanField(p, res->can_be_managed_fieldID) != 0);
  res->participant_count_ = env->GetIntField(p, res->participant_count_fieldID);
  res->has_hidden_listeners_ = (env->GetBooleanField(p, res->has_hidden_listeners_fieldID) != 0);
  res->loaded_all_participants_ = (env->GetBooleanField(p, res->loaded_all_participants_fieldID) != 0);
  res->message_sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->message_sender_id_fieldID));
  res->recent_speakers_ = jni::FetchVector<groupCallRecentSpeaker>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->recent_speakers_fieldID));
  res->is_my_video_enabled_ = (env->GetBooleanField(p, res->is_my_video_enabled_fieldID) != 0);
  res->is_my_video_paused_ = (env->GetBooleanField(p, res->is_my_video_paused_fieldID) != 0);
  res->can_enable_video_ = (env->GetBooleanField(p, res->can_enable_video_fieldID) != 0);
  res->mute_new_participants_ = (env->GetBooleanField(p, res->mute_new_participants_fieldID) != 0);
  res->can_toggle_mute_new_participants_ = (env->GetBooleanField(p, res->can_toggle_mute_new_participants_fieldID) != 0);
  res->can_send_messages_ = (env->GetBooleanField(p, res->can_send_messages_fieldID) != 0);
  res->are_messages_allowed_ = (env->GetBooleanField(p, res->are_messages_allowed_fieldID) != 0);
  res->can_toggle_are_messages_allowed_ = (env->GetBooleanField(p, res->can_toggle_are_messages_allowed_fieldID) != 0);
  res->can_delete_messages_ = (env->GetBooleanField(p, res->can_delete_messages_fieldID) != 0);
  res->record_duration_ = env->GetIntField(p, res->record_duration_fieldID);
  res->is_video_recorded_ = (env->GetBooleanField(p, res->is_video_recorded_fieldID) != 0);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  return res;
}

void groupCall::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetLongField(s, unique_id_fieldID, unique_id_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, invite_link_); if (nextString) { env->SetObjectField(s, invite_link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, paid_message_star_count_fieldID, paid_message_star_count_);
  env->SetIntField(s, scheduled_start_date_fieldID, scheduled_start_date_);
  env->SetBooleanField(s, enabled_start_notification_fieldID, enabled_start_notification_);
  env->SetBooleanField(s, is_active_fieldID, is_active_);
  env->SetBooleanField(s, is_video_chat_fieldID, is_video_chat_);
  env->SetBooleanField(s, is_live_story_fieldID, is_live_story_);
  env->SetBooleanField(s, is_rtmp_stream_fieldID, is_rtmp_stream_);
  env->SetBooleanField(s, is_joined_fieldID, is_joined_);
  env->SetBooleanField(s, need_rejoin_fieldID, need_rejoin_);
  env->SetBooleanField(s, is_owned_fieldID, is_owned_);
  env->SetBooleanField(s, can_be_managed_fieldID, can_be_managed_);
  env->SetIntField(s, participant_count_fieldID, participant_count_);
  env->SetBooleanField(s, has_hidden_listeners_fieldID, has_hidden_listeners_);
  env->SetBooleanField(s, loaded_all_participants_fieldID, loaded_all_participants_);
  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); } }
  { auto arr_tmp_ = jni::store_vector(env, recent_speakers_); if (arr_tmp_) { env->SetObjectField(s, recent_speakers_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_my_video_enabled_fieldID, is_my_video_enabled_);
  env->SetBooleanField(s, is_my_video_paused_fieldID, is_my_video_paused_);
  env->SetBooleanField(s, can_enable_video_fieldID, can_enable_video_);
  env->SetBooleanField(s, mute_new_participants_fieldID, mute_new_participants_);
  env->SetBooleanField(s, can_toggle_mute_new_participants_fieldID, can_toggle_mute_new_participants_);
  env->SetBooleanField(s, can_send_messages_fieldID, can_send_messages_);
  env->SetBooleanField(s, are_messages_allowed_fieldID, are_messages_allowed_);
  env->SetBooleanField(s, can_toggle_are_messages_allowed_fieldID, can_toggle_are_messages_allowed_);
  env->SetBooleanField(s, can_delete_messages_fieldID, can_delete_messages_);
  env->SetIntField(s, record_duration_fieldID, record_duration_);
  env->SetBooleanField(s, is_video_recorded_fieldID, is_video_recorded_);
  env->SetIntField(s, duration_fieldID, duration_);
}

void groupCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCall");
    s.store_field("id", id_);
    s.store_field("uniqueId", unique_id_);
    s.store_field("title", title_);
    s.store_field("inviteLink", invite_link_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_field("scheduledStartDate", scheduled_start_date_);
    s.store_field("enabledStartNotification", enabled_start_notification_);
    s.store_field("isActive", is_active_);
    s.store_field("isVideoChat", is_video_chat_);
    s.store_field("isLiveStory", is_live_story_);
    s.store_field("isRtmpStream", is_rtmp_stream_);
    s.store_field("isJoined", is_joined_);
    s.store_field("needRejoin", need_rejoin_);
    s.store_field("isOwned", is_owned_);
    s.store_field("canBeManaged", can_be_managed_);
    s.store_field("participantCount", participant_count_);
    s.store_field("hasHiddenListeners", has_hidden_listeners_);
    s.store_field("loadedAllParticipants", loaded_all_participants_);
    s.store_object_field("messageSenderId", static_cast<const BaseObject *>(message_sender_id_.get()));
    { s.store_vector_begin("recentSpeakers", recent_speakers_.size()); for (const auto &_value : recent_speakers_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("isMyVideoEnabled", is_my_video_enabled_);
    s.store_field("isMyVideoPaused", is_my_video_paused_);
    s.store_field("canEnableVideo", can_enable_video_);
    s.store_field("muteNewParticipants", mute_new_participants_);
    s.store_field("canToggleMuteNewParticipants", can_toggle_mute_new_participants_);
    s.store_field("canSendMessages", can_send_messages_);
    s.store_field("areMessagesAllowed", are_messages_allowed_);
    s.store_field("canToggleAreMessagesAllowed", can_toggle_are_messages_allowed_);
    s.store_field("canDeleteMessages", can_delete_messages_);
    s.store_field("recordDuration", record_duration_);
    s.store_field("isVideoRecorded", is_video_recorded_);
    s.store_field("duration", duration_);
    s.store_class_end();
  }
}

void groupCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCall").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    unique_id_fieldID = jni::get_field_id(env, Class, "uniqueId", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    scheduled_start_date_fieldID = jni::get_field_id(env, Class, "scheduledStartDate", "I");
    enabled_start_notification_fieldID = jni::get_field_id(env, Class, "enabledStartNotification", "Z");
    is_active_fieldID = jni::get_field_id(env, Class, "isActive", "Z");
    is_video_chat_fieldID = jni::get_field_id(env, Class, "isVideoChat", "Z");
    is_live_story_fieldID = jni::get_field_id(env, Class, "isLiveStory", "Z");
    is_rtmp_stream_fieldID = jni::get_field_id(env, Class, "isRtmpStream", "Z");
    is_joined_fieldID = jni::get_field_id(env, Class, "isJoined", "Z");
    need_rejoin_fieldID = jni::get_field_id(env, Class, "needRejoin", "Z");
    is_owned_fieldID = jni::get_field_id(env, Class, "isOwned", "Z");
    can_be_managed_fieldID = jni::get_field_id(env, Class, "canBeManaged", "Z");
    participant_count_fieldID = jni::get_field_id(env, Class, "participantCount", "I");
    has_hidden_listeners_fieldID = jni::get_field_id(env, Class, "hasHiddenListeners", "Z");
    loaded_all_participants_fieldID = jni::get_field_id(env, Class, "loadedAllParticipants", "Z");
    message_sender_id_fieldID = jni::get_field_id(env, Class, "messageSenderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    recent_speakers_fieldID = jni::get_field_id(env, Class, "recentSpeakers", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GroupCallRecentSpeaker;").c_str());
    is_my_video_enabled_fieldID = jni::get_field_id(env, Class, "isMyVideoEnabled", "Z");
    is_my_video_paused_fieldID = jni::get_field_id(env, Class, "isMyVideoPaused", "Z");
    can_enable_video_fieldID = jni::get_field_id(env, Class, "canEnableVideo", "Z");
    mute_new_participants_fieldID = jni::get_field_id(env, Class, "muteNewParticipants", "Z");
    can_toggle_mute_new_participants_fieldID = jni::get_field_id(env, Class, "canToggleMuteNewParticipants", "Z");
    can_send_messages_fieldID = jni::get_field_id(env, Class, "canSendMessages", "Z");
    are_messages_allowed_fieldID = jni::get_field_id(env, Class, "areMessagesAllowed", "Z");
    can_toggle_are_messages_allowed_fieldID = jni::get_field_id(env, Class, "canToggleAreMessagesAllowed", "Z");
    can_delete_messages_fieldID = jni::get_field_id(env, Class, "canDeleteMessages", "Z");
    record_duration_fieldID = jni::get_field_id(env, Class, "recordDuration", "I");
    is_video_recorded_fieldID = jni::get_field_id(env, Class, "isVideoRecorded", "Z");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    return true;
  }();
  (void)is_inited;
}

jclass groupCallParticipant::Class;
jfieldID groupCallParticipant::participant_id_fieldID;
jfieldID groupCallParticipant::audio_source_id_fieldID;
jfieldID groupCallParticipant::screen_sharing_audio_source_id_fieldID;
jfieldID groupCallParticipant::video_info_fieldID;
jfieldID groupCallParticipant::screen_sharing_video_info_fieldID;
jfieldID groupCallParticipant::bio_fieldID;
jfieldID groupCallParticipant::is_current_user_fieldID;
jfieldID groupCallParticipant::is_speaking_fieldID;
jfieldID groupCallParticipant::is_hand_raised_fieldID;
jfieldID groupCallParticipant::can_be_muted_for_all_users_fieldID;
jfieldID groupCallParticipant::can_be_unmuted_for_all_users_fieldID;
jfieldID groupCallParticipant::can_be_muted_for_current_user_fieldID;
jfieldID groupCallParticipant::can_be_unmuted_for_current_user_fieldID;
jfieldID groupCallParticipant::is_muted_for_all_users_fieldID;
jfieldID groupCallParticipant::is_muted_for_current_user_fieldID;
jfieldID groupCallParticipant::can_unmute_self_fieldID;
jfieldID groupCallParticipant::volume_level_fieldID;
jfieldID groupCallParticipant::order_fieldID;

groupCallParticipant::groupCallParticipant()
  : participant_id_()
  , audio_source_id_()
  , screen_sharing_audio_source_id_()
  , video_info_()
  , screen_sharing_video_info_()
  , bio_()
  , is_current_user_()
  , is_speaking_()
  , is_hand_raised_()
  , can_be_muted_for_all_users_()
  , can_be_unmuted_for_all_users_()
  , can_be_muted_for_current_user_()
  , can_be_unmuted_for_current_user_()
  , is_muted_for_all_users_()
  , is_muted_for_current_user_()
  , can_unmute_self_()
  , volume_level_()
  , order_()
{}

groupCallParticipant::groupCallParticipant(object_ptr<MessageSender> &&participant_id_, int32 audio_source_id_, int32 screen_sharing_audio_source_id_, object_ptr<groupCallParticipantVideoInfo> &&video_info_, object_ptr<groupCallParticipantVideoInfo> &&screen_sharing_video_info_, string const &bio_, bool is_current_user_, bool is_speaking_, bool is_hand_raised_, bool can_be_muted_for_all_users_, bool can_be_unmuted_for_all_users_, bool can_be_muted_for_current_user_, bool can_be_unmuted_for_current_user_, bool is_muted_for_all_users_, bool is_muted_for_current_user_, bool can_unmute_self_, int32 volume_level_, string const &order_)
  : participant_id_(std::move(participant_id_))
  , audio_source_id_(audio_source_id_)
  , screen_sharing_audio_source_id_(screen_sharing_audio_source_id_)
  , video_info_(std::move(video_info_))
  , screen_sharing_video_info_(std::move(screen_sharing_video_info_))
  , bio_(bio_)
  , is_current_user_(is_current_user_)
  , is_speaking_(is_speaking_)
  , is_hand_raised_(is_hand_raised_)
  , can_be_muted_for_all_users_(can_be_muted_for_all_users_)
  , can_be_unmuted_for_all_users_(can_be_unmuted_for_all_users_)
  , can_be_muted_for_current_user_(can_be_muted_for_current_user_)
  , can_be_unmuted_for_current_user_(can_be_unmuted_for_current_user_)
  , is_muted_for_all_users_(is_muted_for_all_users_)
  , is_muted_for_current_user_(is_muted_for_current_user_)
  , can_unmute_self_(can_unmute_self_)
  , volume_level_(volume_level_)
  , order_(order_)
{}

const std::int32_t groupCallParticipant::ID;

object_ptr<groupCallParticipant> groupCallParticipant::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallParticipant> res = make_object<groupCallParticipant>();
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->audio_source_id_ = env->GetIntField(p, res->audio_source_id_fieldID);
  res->screen_sharing_audio_source_id_ = env->GetIntField(p, res->screen_sharing_audio_source_id_fieldID);
  res->video_info_ = jni::fetch_tl_object<groupCallParticipantVideoInfo>(env, jni::fetch_object(env, p, res->video_info_fieldID));
  res->screen_sharing_video_info_ = jni::fetch_tl_object<groupCallParticipantVideoInfo>(env, jni::fetch_object(env, p, res->screen_sharing_video_info_fieldID));
  res->bio_ = jni::fetch_string(env, p, res->bio_fieldID);
  res->is_current_user_ = (env->GetBooleanField(p, res->is_current_user_fieldID) != 0);
  res->is_speaking_ = (env->GetBooleanField(p, res->is_speaking_fieldID) != 0);
  res->is_hand_raised_ = (env->GetBooleanField(p, res->is_hand_raised_fieldID) != 0);
  res->can_be_muted_for_all_users_ = (env->GetBooleanField(p, res->can_be_muted_for_all_users_fieldID) != 0);
  res->can_be_unmuted_for_all_users_ = (env->GetBooleanField(p, res->can_be_unmuted_for_all_users_fieldID) != 0);
  res->can_be_muted_for_current_user_ = (env->GetBooleanField(p, res->can_be_muted_for_current_user_fieldID) != 0);
  res->can_be_unmuted_for_current_user_ = (env->GetBooleanField(p, res->can_be_unmuted_for_current_user_fieldID) != 0);
  res->is_muted_for_all_users_ = (env->GetBooleanField(p, res->is_muted_for_all_users_fieldID) != 0);
  res->is_muted_for_current_user_ = (env->GetBooleanField(p, res->is_muted_for_current_user_fieldID) != 0);
  res->can_unmute_self_ = (env->GetBooleanField(p, res->can_unmute_self_fieldID) != 0);
  res->volume_level_ = env->GetIntField(p, res->volume_level_fieldID);
  res->order_ = jni::fetch_string(env, p, res->order_fieldID);
  return res;
}

void groupCallParticipant::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (participant_id_ != nullptr) { jobject next; participant_id_->store(env, next); if (next) { env->SetObjectField(s, participant_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, audio_source_id_fieldID, audio_source_id_);
  env->SetIntField(s, screen_sharing_audio_source_id_fieldID, screen_sharing_audio_source_id_);
  if (video_info_ != nullptr) { jobject next; video_info_->store(env, next); if (next) { env->SetObjectField(s, video_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (screen_sharing_video_info_ != nullptr) { jobject next; screen_sharing_video_info_->store(env, next); if (next) { env->SetObjectField(s, screen_sharing_video_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, bio_); if (nextString) { env->SetObjectField(s, bio_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_current_user_fieldID, is_current_user_);
  env->SetBooleanField(s, is_speaking_fieldID, is_speaking_);
  env->SetBooleanField(s, is_hand_raised_fieldID, is_hand_raised_);
  env->SetBooleanField(s, can_be_muted_for_all_users_fieldID, can_be_muted_for_all_users_);
  env->SetBooleanField(s, can_be_unmuted_for_all_users_fieldID, can_be_unmuted_for_all_users_);
  env->SetBooleanField(s, can_be_muted_for_current_user_fieldID, can_be_muted_for_current_user_);
  env->SetBooleanField(s, can_be_unmuted_for_current_user_fieldID, can_be_unmuted_for_current_user_);
  env->SetBooleanField(s, is_muted_for_all_users_fieldID, is_muted_for_all_users_);
  env->SetBooleanField(s, is_muted_for_current_user_fieldID, is_muted_for_current_user_);
  env->SetBooleanField(s, can_unmute_self_fieldID, can_unmute_self_);
  env->SetIntField(s, volume_level_fieldID, volume_level_);
  { jstring nextString = jni::to_jstring(env, order_); if (nextString) { env->SetObjectField(s, order_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void groupCallParticipant::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallParticipant");
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_field("audioSourceId", audio_source_id_);
    s.store_field("screenSharingAudioSourceId", screen_sharing_audio_source_id_);
    s.store_object_field("videoInfo", static_cast<const BaseObject *>(video_info_.get()));
    s.store_object_field("screenSharingVideoInfo", static_cast<const BaseObject *>(screen_sharing_video_info_.get()));
    s.store_field("bio", bio_);
    s.store_field("isCurrentUser", is_current_user_);
    s.store_field("isSpeaking", is_speaking_);
    s.store_field("isHandRaised", is_hand_raised_);
    s.store_field("canBeMutedForAllUsers", can_be_muted_for_all_users_);
    s.store_field("canBeUnmutedForAllUsers", can_be_unmuted_for_all_users_);
    s.store_field("canBeMutedForCurrentUser", can_be_muted_for_current_user_);
    s.store_field("canBeUnmutedForCurrentUser", can_be_unmuted_for_current_user_);
    s.store_field("isMutedForAllUsers", is_muted_for_all_users_);
    s.store_field("isMutedForCurrentUser", is_muted_for_current_user_);
    s.store_field("canUnmuteSelf", can_unmute_self_);
    s.store_field("volumeLevel", volume_level_);
    s.store_field("order", order_);
    s.store_class_end();
  }
}

void groupCallParticipant::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallParticipant").c_str());
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    audio_source_id_fieldID = jni::get_field_id(env, Class, "audioSourceId", "I");
    screen_sharing_audio_source_id_fieldID = jni::get_field_id(env, Class, "screenSharingAudioSourceId", "I");
    video_info_fieldID = jni::get_field_id(env, Class, "videoInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCallParticipantVideoInfo;").c_str());
    screen_sharing_video_info_fieldID = jni::get_field_id(env, Class, "screenSharingVideoInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCallParticipantVideoInfo;").c_str());
    bio_fieldID = jni::get_field_id(env, Class, "bio", "Ljava/lang/String;");
    is_current_user_fieldID = jni::get_field_id(env, Class, "isCurrentUser", "Z");
    is_speaking_fieldID = jni::get_field_id(env, Class, "isSpeaking", "Z");
    is_hand_raised_fieldID = jni::get_field_id(env, Class, "isHandRaised", "Z");
    can_be_muted_for_all_users_fieldID = jni::get_field_id(env, Class, "canBeMutedForAllUsers", "Z");
    can_be_unmuted_for_all_users_fieldID = jni::get_field_id(env, Class, "canBeUnmutedForAllUsers", "Z");
    can_be_muted_for_current_user_fieldID = jni::get_field_id(env, Class, "canBeMutedForCurrentUser", "Z");
    can_be_unmuted_for_current_user_fieldID = jni::get_field_id(env, Class, "canBeUnmutedForCurrentUser", "Z");
    is_muted_for_all_users_fieldID = jni::get_field_id(env, Class, "isMutedForAllUsers", "Z");
    is_muted_for_current_user_fieldID = jni::get_field_id(env, Class, "isMutedForCurrentUser", "Z");
    can_unmute_self_fieldID = jni::get_field_id(env, Class, "canUnmuteSelf", "Z");
    volume_level_fieldID = jni::get_field_id(env, Class, "volumeLevel", "I");
    order_fieldID = jni::get_field_id(env, Class, "order", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass groupCallStreams::Class;
jfieldID groupCallStreams::streams_fieldID;

groupCallStreams::groupCallStreams()
  : streams_()
{}

groupCallStreams::groupCallStreams(array<object_ptr<groupCallStream>> &&streams_)
  : streams_(std::move(streams_))
{}

const std::int32_t groupCallStreams::ID;

object_ptr<groupCallStreams> groupCallStreams::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallStreams> res = make_object<groupCallStreams>();
  res->streams_ = jni::FetchVector<groupCallStream>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->streams_fieldID));
  return res;
}

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

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

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

jclass InputBackground::Class;

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

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

jclass inputBackgroundLocal::Class;
jfieldID inputBackgroundLocal::background_fieldID;

inputBackgroundLocal::inputBackgroundLocal()
  : background_()
{}

inputBackgroundLocal::inputBackgroundLocal(object_ptr<InputFile> &&background_)
  : background_(std::move(background_))
{}

const std::int32_t inputBackgroundLocal::ID;

object_ptr<InputBackground> inputBackgroundLocal::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputBackgroundLocal> res = make_object<inputBackgroundLocal>();
  res->background_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->background_fieldID));
  return std::move(res);
}

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

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

jclass inputBackgroundRemote::Class;
jfieldID inputBackgroundRemote::background_id_fieldID;

inputBackgroundRemote::inputBackgroundRemote()
  : background_id_()
{}

inputBackgroundRemote::inputBackgroundRemote(int64 background_id_)
  : background_id_(background_id_)
{}

const std::int32_t inputBackgroundRemote::ID;

object_ptr<InputBackground> inputBackgroundRemote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputBackgroundRemote> res = make_object<inputBackgroundRemote>();
  res->background_id_ = env->GetLongField(p, res->background_id_fieldID);
  return std::move(res);
}

void inputBackgroundRemote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputBackgroundRemote");
    s.store_field("backgroundId", background_id_);
    s.store_class_end();
  }
}

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

jclass inputBackgroundPrevious::Class;
jfieldID inputBackgroundPrevious::message_id_fieldID;

inputBackgroundPrevious::inputBackgroundPrevious()
  : message_id_()
{}

inputBackgroundPrevious::inputBackgroundPrevious(int53 message_id_)
  : message_id_(message_id_)
{}

const std::int32_t inputBackgroundPrevious::ID;

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

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

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

jclass inputBusinessStartPage::Class;
jfieldID inputBusinessStartPage::title_fieldID;
jfieldID inputBusinessStartPage::message_fieldID;
jfieldID inputBusinessStartPage::sticker_fieldID;

inputBusinessStartPage::inputBusinessStartPage()
  : title_()
  , message_()
  , sticker_()
{}

inputBusinessStartPage::inputBusinessStartPage(string const &title_, string const &message_, object_ptr<InputFile> &&sticker_)
  : title_(title_)
  , message_(message_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t inputBusinessStartPage::ID;

object_ptr<inputBusinessStartPage> inputBusinessStartPage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputBusinessStartPage> res = make_object<inputBusinessStartPage>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->message_ = jni::fetch_string(env, p, res->message_fieldID);
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void inputBusinessStartPage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputBusinessStartPage");
    s.store_field("title", title_);
    s.store_field("message", message_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void inputBusinessStartPage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputBusinessStartPage").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    message_fieldID = jni::get_field_id(env, Class, "message", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass InputChatTheme::Class;

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

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

jclass inputChatThemeEmoji::Class;
jfieldID inputChatThemeEmoji::name_fieldID;

inputChatThemeEmoji::inputChatThemeEmoji()
  : name_()
{}

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

const std::int32_t inputChatThemeEmoji::ID;

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

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

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

jclass inputChatThemeGift::Class;
jfieldID inputChatThemeGift::name_fieldID;

inputChatThemeGift::inputChatThemeGift()
  : name_()
{}

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

const std::int32_t inputChatThemeGift::ID;

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

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

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

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

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

inputIdentityDocument::inputIdentityDocument(string const &number_, object_ptr<date> &&expiration_date_, object_ptr<InputFile> &&front_side_, object_ptr<InputFile> &&reverse_side_, object_ptr<InputFile> &&selfie_, array<object_ptr<InputFile>> &&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 inputIdentityDocument::ID;

object_ptr<inputIdentityDocument> inputIdentityDocument::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputIdentityDocument> res = make_object<inputIdentityDocument>();
  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<InputFile>(env, jni::fetch_object(env, p, res->front_side_fieldID));
  res->reverse_side_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->reverse_side_fieldID));
  res->selfie_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->selfie_fieldID));
  res->translation_ = jni::FetchVector<InputFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->translation_fieldID));
  return res;
}

void inputIdentityDocument::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputIdentityDocument");
    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 inputIdentityDocument::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputIdentityDocument").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$InputFile;").c_str());
    reverse_side_fieldID = jni::get_field_id(env, Class, "reverseSide", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    selfie_fieldID = jni::get_field_id(env, Class, "selfie", (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 inputStoryAreas::Class;
jfieldID inputStoryAreas::areas_fieldID;

inputStoryAreas::inputStoryAreas()
  : areas_()
{}

inputStoryAreas::inputStoryAreas(array<object_ptr<inputStoryArea>> &&areas_)
  : areas_(std::move(areas_))
{}

const std::int32_t inputStoryAreas::ID;

object_ptr<inputStoryAreas> inputStoryAreas::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryAreas> res = make_object<inputStoryAreas>();
  res->areas_ = jni::FetchVector<inputStoryArea>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->areas_fieldID));
  return res;
}

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

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

jclass KeyboardButtonType::Class;

object_ptr<KeyboardButtonType> KeyboardButtonType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case keyboardButtonTypeText::ID:
      return keyboardButtonTypeText::fetch(env, p);
    case keyboardButtonTypeRequestPhoneNumber::ID:
      return keyboardButtonTypeRequestPhoneNumber::fetch(env, p);
    case keyboardButtonTypeRequestLocation::ID:
      return keyboardButtonTypeRequestLocation::fetch(env, p);
    case keyboardButtonTypeRequestPoll::ID:
      return keyboardButtonTypeRequestPoll::fetch(env, p);
    case keyboardButtonTypeRequestUsers::ID:
      return keyboardButtonTypeRequestUsers::fetch(env, p);
    case keyboardButtonTypeRequestChat::ID:
      return keyboardButtonTypeRequestChat::fetch(env, p);
    case keyboardButtonTypeRequestManagedBot::ID:
      return keyboardButtonTypeRequestManagedBot::fetch(env, p);
    case keyboardButtonTypeWebApp::ID:
      return keyboardButtonTypeWebApp::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass keyboardButtonTypeText::Class;

keyboardButtonTypeText::keyboardButtonTypeText() {
}

const std::int32_t keyboardButtonTypeText::ID;

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

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

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

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

jclass keyboardButtonTypeRequestPhoneNumber::Class;

keyboardButtonTypeRequestPhoneNumber::keyboardButtonTypeRequestPhoneNumber() {
}

const std::int32_t keyboardButtonTypeRequestPhoneNumber::ID;

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

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

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

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

jclass keyboardButtonTypeRequestLocation::Class;

keyboardButtonTypeRequestLocation::keyboardButtonTypeRequestLocation() {
}

const std::int32_t keyboardButtonTypeRequestLocation::ID;

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

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

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

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

jclass keyboardButtonTypeRequestPoll::Class;
jfieldID keyboardButtonTypeRequestPoll::force_regular_fieldID;
jfieldID keyboardButtonTypeRequestPoll::force_quiz_fieldID;

keyboardButtonTypeRequestPoll::keyboardButtonTypeRequestPoll()
  : force_regular_()
  , force_quiz_()
{}

keyboardButtonTypeRequestPoll::keyboardButtonTypeRequestPoll(bool force_regular_, bool force_quiz_)
  : force_regular_(force_regular_)
  , force_quiz_(force_quiz_)
{}

const std::int32_t keyboardButtonTypeRequestPoll::ID;

object_ptr<KeyboardButtonType> keyboardButtonTypeRequestPoll::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<keyboardButtonTypeRequestPoll> res = make_object<keyboardButtonTypeRequestPoll>();
  res->force_regular_ = (env->GetBooleanField(p, res->force_regular_fieldID) != 0);
  res->force_quiz_ = (env->GetBooleanField(p, res->force_quiz_fieldID) != 0);
  return std::move(res);
}

void keyboardButtonTypeRequestPoll::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, force_regular_fieldID, force_regular_);
  env->SetBooleanField(s, force_quiz_fieldID, force_quiz_);
}

void keyboardButtonTypeRequestPoll::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "KeyboardButtonTypeRequestPoll");
    s.store_field("forceRegular", force_regular_);
    s.store_field("forceQuiz", force_quiz_);
    s.store_class_end();
  }
}

void keyboardButtonTypeRequestPoll::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$KeyboardButtonTypeRequestPoll").c_str());
    force_regular_fieldID = jni::get_field_id(env, Class, "forceRegular", "Z");
    force_quiz_fieldID = jni::get_field_id(env, Class, "forceQuiz", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass keyboardButtonTypeRequestUsers::Class;
jfieldID keyboardButtonTypeRequestUsers::id_fieldID;
jfieldID keyboardButtonTypeRequestUsers::restrict_user_is_bot_fieldID;
jfieldID keyboardButtonTypeRequestUsers::user_is_bot_fieldID;
jfieldID keyboardButtonTypeRequestUsers::restrict_user_is_premium_fieldID;
jfieldID keyboardButtonTypeRequestUsers::user_is_premium_fieldID;
jfieldID keyboardButtonTypeRequestUsers::max_quantity_fieldID;
jfieldID keyboardButtonTypeRequestUsers::request_name_fieldID;
jfieldID keyboardButtonTypeRequestUsers::request_username_fieldID;
jfieldID keyboardButtonTypeRequestUsers::request_photo_fieldID;

keyboardButtonTypeRequestUsers::keyboardButtonTypeRequestUsers()
  : id_()
  , restrict_user_is_bot_()
  , user_is_bot_()
  , restrict_user_is_premium_()
  , user_is_premium_()
  , max_quantity_()
  , request_name_()
  , request_username_()
  , request_photo_()
{}

keyboardButtonTypeRequestUsers::keyboardButtonTypeRequestUsers(int32 id_, bool restrict_user_is_bot_, bool user_is_bot_, bool restrict_user_is_premium_, bool user_is_premium_, int32 max_quantity_, bool request_name_, bool request_username_, bool request_photo_)
  : id_(id_)
  , restrict_user_is_bot_(restrict_user_is_bot_)
  , user_is_bot_(user_is_bot_)
  , restrict_user_is_premium_(restrict_user_is_premium_)
  , user_is_premium_(user_is_premium_)
  , max_quantity_(max_quantity_)
  , request_name_(request_name_)
  , request_username_(request_username_)
  , request_photo_(request_photo_)
{}

const std::int32_t keyboardButtonTypeRequestUsers::ID;

object_ptr<KeyboardButtonType> keyboardButtonTypeRequestUsers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<keyboardButtonTypeRequestUsers> res = make_object<keyboardButtonTypeRequestUsers>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->restrict_user_is_bot_ = (env->GetBooleanField(p, res->restrict_user_is_bot_fieldID) != 0);
  res->user_is_bot_ = (env->GetBooleanField(p, res->user_is_bot_fieldID) != 0);
  res->restrict_user_is_premium_ = (env->GetBooleanField(p, res->restrict_user_is_premium_fieldID) != 0);
  res->user_is_premium_ = (env->GetBooleanField(p, res->user_is_premium_fieldID) != 0);
  res->max_quantity_ = env->GetIntField(p, res->max_quantity_fieldID);
  res->request_name_ = (env->GetBooleanField(p, res->request_name_fieldID) != 0);
  res->request_username_ = (env->GetBooleanField(p, res->request_username_fieldID) != 0);
  res->request_photo_ = (env->GetBooleanField(p, res->request_photo_fieldID) != 0);
  return std::move(res);
}

void keyboardButtonTypeRequestUsers::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetBooleanField(s, restrict_user_is_bot_fieldID, restrict_user_is_bot_);
  env->SetBooleanField(s, user_is_bot_fieldID, user_is_bot_);
  env->SetBooleanField(s, restrict_user_is_premium_fieldID, restrict_user_is_premium_);
  env->SetBooleanField(s, user_is_premium_fieldID, user_is_premium_);
  env->SetIntField(s, max_quantity_fieldID, max_quantity_);
  env->SetBooleanField(s, request_name_fieldID, request_name_);
  env->SetBooleanField(s, request_username_fieldID, request_username_);
  env->SetBooleanField(s, request_photo_fieldID, request_photo_);
}

void keyboardButtonTypeRequestUsers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "KeyboardButtonTypeRequestUsers");
    s.store_field("id", id_);
    s.store_field("restrictUserIsBot", restrict_user_is_bot_);
    s.store_field("userIsBot", user_is_bot_);
    s.store_field("restrictUserIsPremium", restrict_user_is_premium_);
    s.store_field("userIsPremium", user_is_premium_);
    s.store_field("maxQuantity", max_quantity_);
    s.store_field("requestName", request_name_);
    s.store_field("requestUsername", request_username_);
    s.store_field("requestPhoto", request_photo_);
    s.store_class_end();
  }
}

void keyboardButtonTypeRequestUsers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$KeyboardButtonTypeRequestUsers").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    restrict_user_is_bot_fieldID = jni::get_field_id(env, Class, "restrictUserIsBot", "Z");
    user_is_bot_fieldID = jni::get_field_id(env, Class, "userIsBot", "Z");
    restrict_user_is_premium_fieldID = jni::get_field_id(env, Class, "restrictUserIsPremium", "Z");
    user_is_premium_fieldID = jni::get_field_id(env, Class, "userIsPremium", "Z");
    max_quantity_fieldID = jni::get_field_id(env, Class, "maxQuantity", "I");
    request_name_fieldID = jni::get_field_id(env, Class, "requestName", "Z");
    request_username_fieldID = jni::get_field_id(env, Class, "requestUsername", "Z");
    request_photo_fieldID = jni::get_field_id(env, Class, "requestPhoto", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass keyboardButtonTypeRequestChat::Class;
jfieldID keyboardButtonTypeRequestChat::id_fieldID;
jfieldID keyboardButtonTypeRequestChat::chat_is_channel_fieldID;
jfieldID keyboardButtonTypeRequestChat::restrict_chat_is_forum_fieldID;
jfieldID keyboardButtonTypeRequestChat::chat_is_forum_fieldID;
jfieldID keyboardButtonTypeRequestChat::restrict_chat_has_username_fieldID;
jfieldID keyboardButtonTypeRequestChat::chat_has_username_fieldID;
jfieldID keyboardButtonTypeRequestChat::chat_is_created_fieldID;
jfieldID keyboardButtonTypeRequestChat::user_administrator_rights_fieldID;
jfieldID keyboardButtonTypeRequestChat::bot_administrator_rights_fieldID;
jfieldID keyboardButtonTypeRequestChat::bot_is_member_fieldID;
jfieldID keyboardButtonTypeRequestChat::request_title_fieldID;
jfieldID keyboardButtonTypeRequestChat::request_username_fieldID;
jfieldID keyboardButtonTypeRequestChat::request_photo_fieldID;

keyboardButtonTypeRequestChat::keyboardButtonTypeRequestChat()
  : id_()
  , chat_is_channel_()
  , restrict_chat_is_forum_()
  , chat_is_forum_()
  , restrict_chat_has_username_()
  , chat_has_username_()
  , chat_is_created_()
  , user_administrator_rights_()
  , bot_administrator_rights_()
  , bot_is_member_()
  , request_title_()
  , request_username_()
  , request_photo_()
{}

keyboardButtonTypeRequestChat::keyboardButtonTypeRequestChat(int32 id_, bool chat_is_channel_, bool restrict_chat_is_forum_, bool chat_is_forum_, bool restrict_chat_has_username_, bool chat_has_username_, bool chat_is_created_, object_ptr<chatAdministratorRights> &&user_administrator_rights_, object_ptr<chatAdministratorRights> &&bot_administrator_rights_, bool bot_is_member_, bool request_title_, bool request_username_, bool request_photo_)
  : id_(id_)
  , chat_is_channel_(chat_is_channel_)
  , restrict_chat_is_forum_(restrict_chat_is_forum_)
  , chat_is_forum_(chat_is_forum_)
  , restrict_chat_has_username_(restrict_chat_has_username_)
  , chat_has_username_(chat_has_username_)
  , chat_is_created_(chat_is_created_)
  , user_administrator_rights_(std::move(user_administrator_rights_))
  , bot_administrator_rights_(std::move(bot_administrator_rights_))
  , bot_is_member_(bot_is_member_)
  , request_title_(request_title_)
  , request_username_(request_username_)
  , request_photo_(request_photo_)
{}

const std::int32_t keyboardButtonTypeRequestChat::ID;

object_ptr<KeyboardButtonType> keyboardButtonTypeRequestChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<keyboardButtonTypeRequestChat> res = make_object<keyboardButtonTypeRequestChat>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->chat_is_channel_ = (env->GetBooleanField(p, res->chat_is_channel_fieldID) != 0);
  res->restrict_chat_is_forum_ = (env->GetBooleanField(p, res->restrict_chat_is_forum_fieldID) != 0);
  res->chat_is_forum_ = (env->GetBooleanField(p, res->chat_is_forum_fieldID) != 0);
  res->restrict_chat_has_username_ = (env->GetBooleanField(p, res->restrict_chat_has_username_fieldID) != 0);
  res->chat_has_username_ = (env->GetBooleanField(p, res->chat_has_username_fieldID) != 0);
  res->chat_is_created_ = (env->GetBooleanField(p, res->chat_is_created_fieldID) != 0);
  res->user_administrator_rights_ = jni::fetch_tl_object<chatAdministratorRights>(env, jni::fetch_object(env, p, res->user_administrator_rights_fieldID));
  res->bot_administrator_rights_ = jni::fetch_tl_object<chatAdministratorRights>(env, jni::fetch_object(env, p, res->bot_administrator_rights_fieldID));
  res->bot_is_member_ = (env->GetBooleanField(p, res->bot_is_member_fieldID) != 0);
  res->request_title_ = (env->GetBooleanField(p, res->request_title_fieldID) != 0);
  res->request_username_ = (env->GetBooleanField(p, res->request_username_fieldID) != 0);
  res->request_photo_ = (env->GetBooleanField(p, res->request_photo_fieldID) != 0);
  return std::move(res);
}

void keyboardButtonTypeRequestChat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  env->SetBooleanField(s, chat_is_channel_fieldID, chat_is_channel_);
  env->SetBooleanField(s, restrict_chat_is_forum_fieldID, restrict_chat_is_forum_);
  env->SetBooleanField(s, chat_is_forum_fieldID, chat_is_forum_);
  env->SetBooleanField(s, restrict_chat_has_username_fieldID, restrict_chat_has_username_);
  env->SetBooleanField(s, chat_has_username_fieldID, chat_has_username_);
  env->SetBooleanField(s, chat_is_created_fieldID, chat_is_created_);
  if (user_administrator_rights_ != nullptr) { jobject next; user_administrator_rights_->store(env, next); if (next) { env->SetObjectField(s, user_administrator_rights_fieldID, next); env->DeleteLocalRef(next); } }
  if (bot_administrator_rights_ != nullptr) { jobject next; bot_administrator_rights_->store(env, next); if (next) { env->SetObjectField(s, bot_administrator_rights_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, bot_is_member_fieldID, bot_is_member_);
  env->SetBooleanField(s, request_title_fieldID, request_title_);
  env->SetBooleanField(s, request_username_fieldID, request_username_);
  env->SetBooleanField(s, request_photo_fieldID, request_photo_);
}

void keyboardButtonTypeRequestChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "KeyboardButtonTypeRequestChat");
    s.store_field("id", id_);
    s.store_field("chatIsChannel", chat_is_channel_);
    s.store_field("restrictChatIsForum", restrict_chat_is_forum_);
    s.store_field("chatIsForum", chat_is_forum_);
    s.store_field("restrictChatHasUsername", restrict_chat_has_username_);
    s.store_field("chatHasUsername", chat_has_username_);
    s.store_field("chatIsCreated", chat_is_created_);
    s.store_object_field("userAdministratorRights", static_cast<const BaseObject *>(user_administrator_rights_.get()));
    s.store_object_field("botAdministratorRights", static_cast<const BaseObject *>(bot_administrator_rights_.get()));
    s.store_field("botIsMember", bot_is_member_);
    s.store_field("requestTitle", request_title_);
    s.store_field("requestUsername", request_username_);
    s.store_field("requestPhoto", request_photo_);
    s.store_class_end();
  }
}

void keyboardButtonTypeRequestChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$KeyboardButtonTypeRequestChat").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    chat_is_channel_fieldID = jni::get_field_id(env, Class, "chatIsChannel", "Z");
    restrict_chat_is_forum_fieldID = jni::get_field_id(env, Class, "restrictChatIsForum", "Z");
    chat_is_forum_fieldID = jni::get_field_id(env, Class, "chatIsForum", "Z");
    restrict_chat_has_username_fieldID = jni::get_field_id(env, Class, "restrictChatHasUsername", "Z");
    chat_has_username_fieldID = jni::get_field_id(env, Class, "chatHasUsername", "Z");
    chat_is_created_fieldID = jni::get_field_id(env, Class, "chatIsCreated", "Z");
    user_administrator_rights_fieldID = jni::get_field_id(env, Class, "userAdministratorRights", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAdministratorRights;").c_str());
    bot_administrator_rights_fieldID = jni::get_field_id(env, Class, "botAdministratorRights", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAdministratorRights;").c_str());
    bot_is_member_fieldID = jni::get_field_id(env, Class, "botIsMember", "Z");
    request_title_fieldID = jni::get_field_id(env, Class, "requestTitle", "Z");
    request_username_fieldID = jni::get_field_id(env, Class, "requestUsername", "Z");
    request_photo_fieldID = jni::get_field_id(env, Class, "requestPhoto", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass keyboardButtonTypeRequestManagedBot::Class;
jfieldID keyboardButtonTypeRequestManagedBot::id_fieldID;
jfieldID keyboardButtonTypeRequestManagedBot::suggested_name_fieldID;
jfieldID keyboardButtonTypeRequestManagedBot::suggested_username_fieldID;

keyboardButtonTypeRequestManagedBot::keyboardButtonTypeRequestManagedBot()
  : id_()
  , suggested_name_()
  , suggested_username_()
{}

keyboardButtonTypeRequestManagedBot::keyboardButtonTypeRequestManagedBot(int32 id_, string const &suggested_name_, string const &suggested_username_)
  : id_(id_)
  , suggested_name_(suggested_name_)
  , suggested_username_(suggested_username_)
{}

const std::int32_t keyboardButtonTypeRequestManagedBot::ID;

object_ptr<KeyboardButtonType> keyboardButtonTypeRequestManagedBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<keyboardButtonTypeRequestManagedBot> res = make_object<keyboardButtonTypeRequestManagedBot>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->suggested_name_ = jni::fetch_string(env, p, res->suggested_name_fieldID);
  res->suggested_username_ = jni::fetch_string(env, p, res->suggested_username_fieldID);
  return std::move(res);
}

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

void keyboardButtonTypeRequestManagedBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "KeyboardButtonTypeRequestManagedBot");
    s.store_field("id", id_);
    s.store_field("suggestedName", suggested_name_);
    s.store_field("suggestedUsername", suggested_username_);
    s.store_class_end();
  }
}

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

jclass keyboardButtonTypeWebApp::Class;
jfieldID keyboardButtonTypeWebApp::url_fieldID;

keyboardButtonTypeWebApp::keyboardButtonTypeWebApp()
  : url_()
{}

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

const std::int32_t keyboardButtonTypeWebApp::ID;

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

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

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

jclass linkPreview::Class;
jfieldID linkPreview::url_fieldID;
jfieldID linkPreview::display_url_fieldID;
jfieldID linkPreview::site_name_fieldID;
jfieldID linkPreview::title_fieldID;
jfieldID linkPreview::description_fieldID;
jfieldID linkPreview::author_fieldID;
jfieldID linkPreview::type_fieldID;
jfieldID linkPreview::has_large_media_fieldID;
jfieldID linkPreview::show_large_media_fieldID;
jfieldID linkPreview::show_media_above_description_fieldID;
jfieldID linkPreview::skip_confirmation_fieldID;
jfieldID linkPreview::show_above_text_fieldID;
jfieldID linkPreview::instant_view_version_fieldID;

linkPreview::linkPreview()
  : url_()
  , display_url_()
  , site_name_()
  , title_()
  , description_()
  , author_()
  , type_()
  , has_large_media_()
  , show_large_media_()
  , show_media_above_description_()
  , skip_confirmation_()
  , show_above_text_()
  , instant_view_version_()
{}

linkPreview::linkPreview(string const &url_, string const &display_url_, string const &site_name_, string const &title_, object_ptr<formattedText> &&description_, string const &author_, object_ptr<LinkPreviewType> &&type_, bool has_large_media_, bool show_large_media_, bool show_media_above_description_, bool skip_confirmation_, bool show_above_text_, int32 instant_view_version_)
  : url_(url_)
  , display_url_(display_url_)
  , site_name_(site_name_)
  , title_(title_)
  , description_(std::move(description_))
  , author_(author_)
  , type_(std::move(type_))
  , has_large_media_(has_large_media_)
  , show_large_media_(show_large_media_)
  , show_media_above_description_(show_media_above_description_)
  , skip_confirmation_(skip_confirmation_)
  , show_above_text_(show_above_text_)
  , instant_view_version_(instant_view_version_)
{}

const std::int32_t linkPreview::ID;

object_ptr<linkPreview> linkPreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreview> res = make_object<linkPreview>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->display_url_ = jni::fetch_string(env, p, res->display_url_fieldID);
  res->site_name_ = jni::fetch_string(env, p, res->site_name_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->description_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->description_fieldID));
  res->author_ = jni::fetch_string(env, p, res->author_fieldID);
  res->type_ = jni::fetch_tl_object<LinkPreviewType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->has_large_media_ = (env->GetBooleanField(p, res->has_large_media_fieldID) != 0);
  res->show_large_media_ = (env->GetBooleanField(p, res->show_large_media_fieldID) != 0);
  res->show_media_above_description_ = (env->GetBooleanField(p, res->show_media_above_description_fieldID) != 0);
  res->skip_confirmation_ = (env->GetBooleanField(p, res->skip_confirmation_fieldID) != 0);
  res->show_above_text_ = (env->GetBooleanField(p, res->show_above_text_fieldID) != 0);
  res->instant_view_version_ = env->GetIntField(p, res->instant_view_version_fieldID);
  return res;
}

void linkPreview::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, display_url_); if (nextString) { env->SetObjectField(s, display_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, site_name_); if (nextString) { env->SetObjectField(s, site_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (description_ != nullptr) { jobject next; description_->store(env, next); if (next) { env->SetObjectField(s, description_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, author_); if (nextString) { env->SetObjectField(s, author_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, has_large_media_fieldID, has_large_media_);
  env->SetBooleanField(s, show_large_media_fieldID, show_large_media_);
  env->SetBooleanField(s, show_media_above_description_fieldID, show_media_above_description_);
  env->SetBooleanField(s, skip_confirmation_fieldID, skip_confirmation_);
  env->SetBooleanField(s, show_above_text_fieldID, show_above_text_);
  env->SetIntField(s, instant_view_version_fieldID, instant_view_version_);
}

void linkPreview::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreview");
    s.store_field("url", url_);
    s.store_field("displayUrl", display_url_);
    s.store_field("siteName", site_name_);
    s.store_field("title", title_);
    s.store_object_field("description", static_cast<const BaseObject *>(description_.get()));
    s.store_field("author", author_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("hasLargeMedia", has_large_media_);
    s.store_field("showLargeMedia", show_large_media_);
    s.store_field("showMediaAboveDescription", show_media_above_description_);
    s.store_field("skipConfirmation", skip_confirmation_);
    s.store_field("showAboveText", show_above_text_);
    s.store_field("instantViewVersion", instant_view_version_);
    s.store_class_end();
  }
}

void linkPreview::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreview").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    display_url_fieldID = jni::get_field_id(env, Class, "displayUrl", "Ljava/lang/String;");
    site_name_fieldID = jni::get_field_id(env, Class, "siteName", "Ljava/lang/String;");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    author_fieldID = jni::get_field_id(env, Class, "author", "Ljava/lang/String;");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LinkPreviewType;").c_str());
    has_large_media_fieldID = jni::get_field_id(env, Class, "hasLargeMedia", "Z");
    show_large_media_fieldID = jni::get_field_id(env, Class, "showLargeMedia", "Z");
    show_media_above_description_fieldID = jni::get_field_id(env, Class, "showMediaAboveDescription", "Z");
    skip_confirmation_fieldID = jni::get_field_id(env, Class, "skipConfirmation", "Z");
    show_above_text_fieldID = jni::get_field_id(env, Class, "showAboveText", "Z");
    instant_view_version_fieldID = jni::get_field_id(env, Class, "instantViewVersion", "I");
    return true;
  }();
  (void)is_inited;
}

jclass LogStream::Class;

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

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

jclass logStreamDefault::Class;

logStreamDefault::logStreamDefault() {
}

const std::int32_t logStreamDefault::ID;

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

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

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

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

jclass logStreamFile::Class;
jfieldID logStreamFile::path_fieldID;
jfieldID logStreamFile::max_file_size_fieldID;
jfieldID logStreamFile::redirect_stderr_fieldID;

logStreamFile::logStreamFile()
  : path_()
  , max_file_size_()
  , redirect_stderr_()
{}

logStreamFile::logStreamFile(string const &path_, int53 max_file_size_, bool redirect_stderr_)
  : path_(path_)
  , max_file_size_(max_file_size_)
  , redirect_stderr_(redirect_stderr_)
{}

const std::int32_t logStreamFile::ID;

object_ptr<LogStream> logStreamFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<logStreamFile> res = make_object<logStreamFile>();
  res->path_ = jni::fetch_string(env, p, res->path_fieldID);
  res->max_file_size_ = env->GetLongField(p, res->max_file_size_fieldID);
  res->redirect_stderr_ = (env->GetBooleanField(p, res->redirect_stderr_fieldID) != 0);
  return std::move(res);
}

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

void logStreamFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LogStreamFile");
    s.store_field("path", path_);
    s.store_field("maxFileSize", max_file_size_);
    s.store_field("redirectStderr", redirect_stderr_);
    s.store_class_end();
  }
}

void logStreamFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LogStreamFile").c_str());
    path_fieldID = jni::get_field_id(env, Class, "path", "Ljava/lang/String;");
    max_file_size_fieldID = jni::get_field_id(env, Class, "maxFileSize", "J");
    redirect_stderr_fieldID = jni::get_field_id(env, Class, "redirectStderr", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass logStreamEmpty::Class;

logStreamEmpty::logStreamEmpty() {
}

const std::int32_t logStreamEmpty::ID;

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

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

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

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

jclass MessageEffectType::Class;

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

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

jclass messageEffectTypeEmojiReaction::Class;
jfieldID messageEffectTypeEmojiReaction::select_animation_fieldID;
jfieldID messageEffectTypeEmojiReaction::effect_animation_fieldID;

messageEffectTypeEmojiReaction::messageEffectTypeEmojiReaction()
  : select_animation_()
  , effect_animation_()
{}

messageEffectTypeEmojiReaction::messageEffectTypeEmojiReaction(object_ptr<sticker> &&select_animation_, object_ptr<sticker> &&effect_animation_)
  : select_animation_(std::move(select_animation_))
  , effect_animation_(std::move(effect_animation_))
{}

const std::int32_t messageEffectTypeEmojiReaction::ID;

object_ptr<MessageEffectType> messageEffectTypeEmojiReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageEffectTypeEmojiReaction> res = make_object<messageEffectTypeEmojiReaction>();
  res->select_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->select_animation_fieldID));
  res->effect_animation_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->effect_animation_fieldID));
  return std::move(res);
}

void messageEffectTypeEmojiReaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (select_animation_ != nullptr) { jobject next; select_animation_->store(env, next); if (next) { env->SetObjectField(s, select_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (effect_animation_ != nullptr) { jobject next; effect_animation_->store(env, next); if (next) { env->SetObjectField(s, effect_animation_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageEffectTypeEmojiReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageEffectTypeEmojiReaction");
    s.store_object_field("selectAnimation", static_cast<const BaseObject *>(select_animation_.get()));
    s.store_object_field("effectAnimation", static_cast<const BaseObject *>(effect_animation_.get()));
    s.store_class_end();
  }
}

void messageEffectTypeEmojiReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageEffectTypeEmojiReaction").c_str());
    select_animation_fieldID = jni::get_field_id(env, Class, "selectAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    effect_animation_fieldID = jni::get_field_id(env, Class, "effectAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass messageEffectTypePremiumSticker::Class;
jfieldID messageEffectTypePremiumSticker::sticker_fieldID;

messageEffectTypePremiumSticker::messageEffectTypePremiumSticker()
  : sticker_()
{}

messageEffectTypePremiumSticker::messageEffectTypePremiumSticker(object_ptr<sticker> &&sticker_)
  : sticker_(std::move(sticker_))
{}

const std::int32_t messageEffectTypePremiumSticker::ID;

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

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

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

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

jclass MessageSource::Class;

object_ptr<MessageSource> MessageSource::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case messageSourceChatHistory::ID:
      return messageSourceChatHistory::fetch(env, p);
    case messageSourceMessageThreadHistory::ID:
      return messageSourceMessageThreadHistory::fetch(env, p);
    case messageSourceForumTopicHistory::ID:
      return messageSourceForumTopicHistory::fetch(env, p);
    case messageSourceDirectMessagesChatTopicHistory::ID:
      return messageSourceDirectMessagesChatTopicHistory::fetch(env, p);
    case messageSourceHistoryPreview::ID:
      return messageSourceHistoryPreview::fetch(env, p);
    case messageSourceChatList::ID:
      return messageSourceChatList::fetch(env, p);
    case messageSourceSearch::ID:
      return messageSourceSearch::fetch(env, p);
    case messageSourceChatEventLog::ID:
      return messageSourceChatEventLog::fetch(env, p);
    case messageSourceNotification::ID:
      return messageSourceNotification::fetch(env, p);
    case messageSourceScreenshot::ID:
      return messageSourceScreenshot::fetch(env, p);
    case messageSourceOther::ID:
      return messageSourceOther::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass messageSourceChatHistory::Class;

messageSourceChatHistory::messageSourceChatHistory() {
}

const std::int32_t messageSourceChatHistory::ID;

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

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

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

jclass messageSourceMessageThreadHistory::Class;

messageSourceMessageThreadHistory::messageSourceMessageThreadHistory() {
}

const std::int32_t messageSourceMessageThreadHistory::ID;

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

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

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

jclass messageSourceForumTopicHistory::Class;

messageSourceForumTopicHistory::messageSourceForumTopicHistory() {
}

const std::int32_t messageSourceForumTopicHistory::ID;

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

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

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

jclass messageSourceDirectMessagesChatTopicHistory::Class;

messageSourceDirectMessagesChatTopicHistory::messageSourceDirectMessagesChatTopicHistory() {
}

const std::int32_t messageSourceDirectMessagesChatTopicHistory::ID;

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

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

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

jclass messageSourceHistoryPreview::Class;

messageSourceHistoryPreview::messageSourceHistoryPreview() {
}

const std::int32_t messageSourceHistoryPreview::ID;

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

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

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

jclass messageSourceChatList::Class;

messageSourceChatList::messageSourceChatList() {
}

const std::int32_t messageSourceChatList::ID;

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

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

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

jclass messageSourceSearch::Class;

messageSourceSearch::messageSourceSearch() {
}

const std::int32_t messageSourceSearch::ID;

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

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

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

jclass messageSourceChatEventLog::Class;

messageSourceChatEventLog::messageSourceChatEventLog() {
}

const std::int32_t messageSourceChatEventLog::ID;

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

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

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

jclass messageSourceNotification::Class;

messageSourceNotification::messageSourceNotification() {
}

const std::int32_t messageSourceNotification::ID;

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

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

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

jclass messageSourceScreenshot::Class;

messageSourceScreenshot::messageSourceScreenshot() {
}

const std::int32_t messageSourceScreenshot::ID;

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

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

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

jclass messageSourceOther::Class;

messageSourceOther::messageSourceOther() {
}

const std::int32_t messageSourceOther::ID;

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

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

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

jclass networkStatistics::Class;
jfieldID networkStatistics::since_date_fieldID;
jfieldID networkStatistics::entries_fieldID;

networkStatistics::networkStatistics()
  : since_date_()
  , entries_()
{}

networkStatistics::networkStatistics(int32 since_date_, array<object_ptr<NetworkStatisticsEntry>> &&entries_)
  : since_date_(since_date_)
  , entries_(std::move(entries_))
{}

const std::int32_t networkStatistics::ID;

object_ptr<networkStatistics> networkStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<networkStatistics> res = make_object<networkStatistics>();
  res->since_date_ = env->GetIntField(p, res->since_date_fieldID);
  res->entries_ = jni::FetchVector<NetworkStatisticsEntry>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->entries_fieldID));
  return res;
}

void networkStatistics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, since_date_fieldID, since_date_);
  { auto arr_tmp_ = jni::store_vector(env, entries_); if (arr_tmp_) { env->SetObjectField(s, entries_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void networkStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NetworkStatistics");
    s.store_field("sinceDate", since_date_);
    { s.store_vector_begin("entries", entries_.size()); for (const auto &_value : entries_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void networkStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NetworkStatistics").c_str());
    since_date_fieldID = jni::get_field_id(env, Class, "sinceDate", "I");
    entries_fieldID = jni::get_field_id(env, Class, "entries", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$NetworkStatisticsEntry;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass newChatPrivacySettings::Class;
jfieldID newChatPrivacySettings::allow_new_chats_from_unknown_users_fieldID;
jfieldID newChatPrivacySettings::incoming_paid_message_star_count_fieldID;

newChatPrivacySettings::newChatPrivacySettings()
  : allow_new_chats_from_unknown_users_()
  , incoming_paid_message_star_count_()
{}

newChatPrivacySettings::newChatPrivacySettings(bool allow_new_chats_from_unknown_users_, int53 incoming_paid_message_star_count_)
  : allow_new_chats_from_unknown_users_(allow_new_chats_from_unknown_users_)
  , incoming_paid_message_star_count_(incoming_paid_message_star_count_)
{}

const std::int32_t newChatPrivacySettings::ID;

object_ptr<newChatPrivacySettings> newChatPrivacySettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<newChatPrivacySettings> res = make_object<newChatPrivacySettings>();
  res->allow_new_chats_from_unknown_users_ = (env->GetBooleanField(p, res->allow_new_chats_from_unknown_users_fieldID) != 0);
  res->incoming_paid_message_star_count_ = env->GetLongField(p, res->incoming_paid_message_star_count_fieldID);
  return res;
}

void newChatPrivacySettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, allow_new_chats_from_unknown_users_fieldID, allow_new_chats_from_unknown_users_);
  env->SetLongField(s, incoming_paid_message_star_count_fieldID, incoming_paid_message_star_count_);
}

void newChatPrivacySettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "NewChatPrivacySettings");
    s.store_field("allowNewChatsFromUnknownUsers", allow_new_chats_from_unknown_users_);
    s.store_field("incomingPaidMessageStarCount", incoming_paid_message_star_count_);
    s.store_class_end();
  }
}

void newChatPrivacySettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$NewChatPrivacySettings").c_str());
    allow_new_chats_from_unknown_users_fieldID = jni::get_field_id(env, Class, "allowNewChatsFromUnknownUsers", "Z");
    incoming_paid_message_star_count_fieldID = jni::get_field_id(env, Class, "incomingPaidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass notificationSounds::Class;
jfieldID notificationSounds::notification_sounds_fieldID;

notificationSounds::notificationSounds()
  : notification_sounds_()
{}

notificationSounds::notificationSounds(array<object_ptr<notificationSound>> &&notification_sounds_)
  : notification_sounds_(std::move(notification_sounds_))
{}

const std::int32_t notificationSounds::ID;

object_ptr<notificationSounds> notificationSounds::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<notificationSounds> res = make_object<notificationSounds>();
  res->notification_sounds_ = jni::FetchVector<notificationSound>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->notification_sounds_fieldID));
  return res;
}

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

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

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

jclass passkey::Class;
jfieldID passkey::id_fieldID;
jfieldID passkey::name_fieldID;
jfieldID passkey::addition_date_fieldID;
jfieldID passkey::last_usage_date_fieldID;
jfieldID passkey::software_icon_custom_emoji_id_fieldID;

passkey::passkey()
  : id_()
  , name_()
  , addition_date_()
  , last_usage_date_()
  , software_icon_custom_emoji_id_()
{}

passkey::passkey(string const &id_, string const &name_, int32 addition_date_, int32 last_usage_date_, int64 software_icon_custom_emoji_id_)
  : id_(id_)
  , name_(name_)
  , addition_date_(addition_date_)
  , last_usage_date_(last_usage_date_)
  , software_icon_custom_emoji_id_(software_icon_custom_emoji_id_)
{}

const std::int32_t passkey::ID;

object_ptr<passkey> passkey::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passkey> res = make_object<passkey>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->addition_date_ = env->GetIntField(p, res->addition_date_fieldID);
  res->last_usage_date_ = env->GetIntField(p, res->last_usage_date_fieldID);
  res->software_icon_custom_emoji_id_ = env->GetLongField(p, res->software_icon_custom_emoji_id_fieldID);
  return res;
}

void passkey::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, addition_date_fieldID, addition_date_);
  env->SetIntField(s, last_usage_date_fieldID, last_usage_date_);
  env->SetLongField(s, software_icon_custom_emoji_id_fieldID, software_icon_custom_emoji_id_);
}

void passkey::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Passkey");
    s.store_field("id", id_);
    s.store_field("name", name_);
    s.store_field("additionDate", addition_date_);
    s.store_field("lastUsageDate", last_usage_date_);
    s.store_field("softwareIconCustomEmojiId", software_icon_custom_emoji_id_);
    s.store_class_end();
  }
}

void passkey::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Passkey").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;");
    addition_date_fieldID = jni::get_field_id(env, Class, "additionDate", "I");
    last_usage_date_fieldID = jni::get_field_id(env, Class, "lastUsageDate", "I");
    software_icon_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "softwareIconCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass passportElements::Class;
jfieldID passportElements::elements_fieldID;

passportElements::passportElements()
  : elements_()
{}

passportElements::passportElements(array<object_ptr<PassportElement>> &&elements_)
  : elements_(std::move(elements_))
{}

const std::int32_t passportElements::ID;

object_ptr<passportElements> passportElements::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passportElements> res = make_object<passportElements>();
  res->elements_ = jni::FetchVector<PassportElement>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->elements_fieldID));
  return res;
}

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

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

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

jclass passportRequiredElement::Class;
jfieldID passportRequiredElement::suitable_elements_fieldID;

passportRequiredElement::passportRequiredElement()
  : suitable_elements_()
{}

passportRequiredElement::passportRequiredElement(array<object_ptr<passportSuitableElement>> &&suitable_elements_)
  : suitable_elements_(std::move(suitable_elements_))
{}

const std::int32_t passportRequiredElement::ID;

object_ptr<passportRequiredElement> passportRequiredElement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passportRequiredElement> res = make_object<passportRequiredElement>();
  res->suitable_elements_ = jni::FetchVector<passportSuitableElement>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->suitable_elements_fieldID));
  return res;
}

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

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

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

jclass passwordState::Class;
jfieldID passwordState::has_password_fieldID;
jfieldID passwordState::password_hint_fieldID;
jfieldID passwordState::has_recovery_email_address_fieldID;
jfieldID passwordState::has_passport_data_fieldID;
jfieldID passwordState::recovery_email_address_code_info_fieldID;
jfieldID passwordState::login_email_address_pattern_fieldID;
jfieldID passwordState::pending_reset_date_fieldID;

passwordState::passwordState()
  : has_password_()
  , password_hint_()
  , has_recovery_email_address_()
  , has_passport_data_()
  , recovery_email_address_code_info_()
  , login_email_address_pattern_()
  , pending_reset_date_()
{}

passwordState::passwordState(bool has_password_, string const &password_hint_, bool has_recovery_email_address_, bool has_passport_data_, object_ptr<emailAddressAuthenticationCodeInfo> &&recovery_email_address_code_info_, string const &login_email_address_pattern_, int32 pending_reset_date_)
  : has_password_(has_password_)
  , password_hint_(password_hint_)
  , has_recovery_email_address_(has_recovery_email_address_)
  , has_passport_data_(has_passport_data_)
  , recovery_email_address_code_info_(std::move(recovery_email_address_code_info_))
  , login_email_address_pattern_(login_email_address_pattern_)
  , pending_reset_date_(pending_reset_date_)
{}

const std::int32_t passwordState::ID;

object_ptr<passwordState> passwordState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passwordState> res = make_object<passwordState>();
  res->has_password_ = (env->GetBooleanField(p, res->has_password_fieldID) != 0);
  res->password_hint_ = jni::fetch_string(env, p, res->password_hint_fieldID);
  res->has_recovery_email_address_ = (env->GetBooleanField(p, res->has_recovery_email_address_fieldID) != 0);
  res->has_passport_data_ = (env->GetBooleanField(p, res->has_passport_data_fieldID) != 0);
  res->recovery_email_address_code_info_ = jni::fetch_tl_object<emailAddressAuthenticationCodeInfo>(env, jni::fetch_object(env, p, res->recovery_email_address_code_info_fieldID));
  res->login_email_address_pattern_ = jni::fetch_string(env, p, res->login_email_address_pattern_fieldID);
  res->pending_reset_date_ = env->GetIntField(p, res->pending_reset_date_fieldID);
  return res;
}

void passwordState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, has_password_fieldID, has_password_);
  { jstring nextString = jni::to_jstring(env, password_hint_); if (nextString) { env->SetObjectField(s, password_hint_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, has_recovery_email_address_fieldID, has_recovery_email_address_);
  env->SetBooleanField(s, has_passport_data_fieldID, has_passport_data_);
  if (recovery_email_address_code_info_ != nullptr) { jobject next; recovery_email_address_code_info_->store(env, next); if (next) { env->SetObjectField(s, recovery_email_address_code_info_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, login_email_address_pattern_); if (nextString) { env->SetObjectField(s, login_email_address_pattern_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, pending_reset_date_fieldID, pending_reset_date_);
}

void passwordState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PasswordState");
    s.store_field("hasPassword", has_password_);
    s.store_field("passwordHint", password_hint_);
    s.store_field("hasRecoveryEmailAddress", has_recovery_email_address_);
    s.store_field("hasPassportData", has_passport_data_);
    s.store_object_field("recoveryEmailAddressCodeInfo", static_cast<const BaseObject *>(recovery_email_address_code_info_.get()));
    s.store_field("loginEmailAddressPattern", login_email_address_pattern_);
    s.store_field("pendingResetDate", pending_reset_date_);
    s.store_class_end();
  }
}

void passwordState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PasswordState").c_str());
    has_password_fieldID = jni::get_field_id(env, Class, "hasPassword", "Z");
    password_hint_fieldID = jni::get_field_id(env, Class, "passwordHint", "Ljava/lang/String;");
    has_recovery_email_address_fieldID = jni::get_field_id(env, Class, "hasRecoveryEmailAddress", "Z");
    has_passport_data_fieldID = jni::get_field_id(env, Class, "hasPassportData", "Z");
    recovery_email_address_code_info_fieldID = jni::get_field_id(env, Class, "recoveryEmailAddressCodeInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmailAddressAuthenticationCodeInfo;").c_str());
    login_email_address_pattern_fieldID = jni::get_field_id(env, Class, "loginEmailAddressPattern", "Ljava/lang/String;");
    pending_reset_date_fieldID = jni::get_field_id(env, Class, "pendingResetDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass point::Class;
jfieldID point::x_fieldID;
jfieldID point::y_fieldID;

point::point()
  : x_()
  , y_()
{}

point::point(double x_, double y_)
  : x_(x_)
  , y_(y_)
{}

const std::int32_t point::ID;

object_ptr<point> point::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<point> res = make_object<point>();
  res->x_ = env->GetDoubleField(p, res->x_fieldID);
  res->y_ = env->GetDoubleField(p, res->y_fieldID);
  return res;
}

void point::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetDoubleField(s, x_fieldID, x_);
  env->SetDoubleField(s, y_fieldID, y_);
}

void point::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Point");
    s.store_field("x", x_);
    s.store_field("y", y_);
    s.store_class_end();
  }
}

void point::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Point").c_str());
    x_fieldID = jni::get_field_id(env, Class, "x", "D");
    y_fieldID = jni::get_field_id(env, Class, "y", "D");
    return true;
  }();
  (void)is_inited;
}

jclass premiumGiveawayPaymentOptions::Class;
jfieldID premiumGiveawayPaymentOptions::options_fieldID;

premiumGiveawayPaymentOptions::premiumGiveawayPaymentOptions()
  : options_()
{}

premiumGiveawayPaymentOptions::premiumGiveawayPaymentOptions(array<object_ptr<premiumGiveawayPaymentOption>> &&options_)
  : options_(std::move(options_))
{}

const std::int32_t premiumGiveawayPaymentOptions::ID;

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

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

jclass ProfileTab::Class;

object_ptr<ProfileTab> ProfileTab::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case profileTabPosts::ID:
      return profileTabPosts::fetch(env, p);
    case profileTabGifts::ID:
      return profileTabGifts::fetch(env, p);
    case profileTabMedia::ID:
      return profileTabMedia::fetch(env, p);
    case profileTabFiles::ID:
      return profileTabFiles::fetch(env, p);
    case profileTabLinks::ID:
      return profileTabLinks::fetch(env, p);
    case profileTabMusic::ID:
      return profileTabMusic::fetch(env, p);
    case profileTabVoice::ID:
      return profileTabVoice::fetch(env, p);
    case profileTabGifs::ID:
      return profileTabGifs::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass profileTabPosts::Class;

profileTabPosts::profileTabPosts() {
}

const std::int32_t profileTabPosts::ID;

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

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

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

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

jclass profileTabGifts::Class;

profileTabGifts::profileTabGifts() {
}

const std::int32_t profileTabGifts::ID;

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

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

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

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

jclass profileTabMedia::Class;

profileTabMedia::profileTabMedia() {
}

const std::int32_t profileTabMedia::ID;

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

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

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

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

jclass profileTabFiles::Class;

profileTabFiles::profileTabFiles() {
}

const std::int32_t profileTabFiles::ID;

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

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

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

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

jclass profileTabLinks::Class;

profileTabLinks::profileTabLinks() {
}

const std::int32_t profileTabLinks::ID;

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

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

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

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

jclass profileTabMusic::Class;

profileTabMusic::profileTabMusic() {
}

const std::int32_t profileTabMusic::ID;

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

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

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

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

jclass profileTabVoice::Class;

profileTabVoice::profileTabVoice() {
}

const std::int32_t profileTabVoice::ID;

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

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

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

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

jclass profileTabGifs::Class;

profileTabGifs::profileTabGifs() {
}

const std::int32_t profileTabGifs::ID;

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

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

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

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

jclass quickReplyMessages::Class;
jfieldID quickReplyMessages::messages_fieldID;

quickReplyMessages::quickReplyMessages()
  : messages_()
{}

quickReplyMessages::quickReplyMessages(array<object_ptr<quickReplyMessage>> &&messages_)
  : messages_(std::move(messages_))
{}

const std::int32_t quickReplyMessages::ID;

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

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

jclass reactionNotificationSettings::Class;
jfieldID reactionNotificationSettings::message_reaction_source_fieldID;
jfieldID reactionNotificationSettings::story_reaction_source_fieldID;
jfieldID reactionNotificationSettings::poll_vote_source_fieldID;
jfieldID reactionNotificationSettings::sound_id_fieldID;
jfieldID reactionNotificationSettings::show_preview_fieldID;

reactionNotificationSettings::reactionNotificationSettings()
  : message_reaction_source_()
  , story_reaction_source_()
  , poll_vote_source_()
  , sound_id_()
  , show_preview_()
{}

reactionNotificationSettings::reactionNotificationSettings(object_ptr<ReactionNotificationSource> &&message_reaction_source_, object_ptr<ReactionNotificationSource> &&story_reaction_source_, object_ptr<ReactionNotificationSource> &&poll_vote_source_, int64 sound_id_, bool show_preview_)
  : message_reaction_source_(std::move(message_reaction_source_))
  , story_reaction_source_(std::move(story_reaction_source_))
  , poll_vote_source_(std::move(poll_vote_source_))
  , sound_id_(sound_id_)
  , show_preview_(show_preview_)
{}

const std::int32_t reactionNotificationSettings::ID;

object_ptr<reactionNotificationSettings> reactionNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reactionNotificationSettings> res = make_object<reactionNotificationSettings>();
  res->message_reaction_source_ = jni::fetch_tl_object<ReactionNotificationSource>(env, jni::fetch_object(env, p, res->message_reaction_source_fieldID));
  res->story_reaction_source_ = jni::fetch_tl_object<ReactionNotificationSource>(env, jni::fetch_object(env, p, res->story_reaction_source_fieldID));
  res->poll_vote_source_ = jni::fetch_tl_object<ReactionNotificationSource>(env, jni::fetch_object(env, p, res->poll_vote_source_fieldID));
  res->sound_id_ = env->GetLongField(p, res->sound_id_fieldID);
  res->show_preview_ = (env->GetBooleanField(p, res->show_preview_fieldID) != 0);
  return res;
}

void reactionNotificationSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_reaction_source_ != nullptr) { jobject next; message_reaction_source_->store(env, next); if (next) { env->SetObjectField(s, message_reaction_source_fieldID, next); env->DeleteLocalRef(next); } }
  if (story_reaction_source_ != nullptr) { jobject next; story_reaction_source_->store(env, next); if (next) { env->SetObjectField(s, story_reaction_source_fieldID, next); env->DeleteLocalRef(next); } }
  if (poll_vote_source_ != nullptr) { jobject next; poll_vote_source_->store(env, next); if (next) { env->SetObjectField(s, poll_vote_source_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, sound_id_fieldID, sound_id_);
  env->SetBooleanField(s, show_preview_fieldID, show_preview_);
}

void reactionNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReactionNotificationSettings");
    s.store_object_field("messageReactionSource", static_cast<const BaseObject *>(message_reaction_source_.get()));
    s.store_object_field("storyReactionSource", static_cast<const BaseObject *>(story_reaction_source_.get()));
    s.store_object_field("pollVoteSource", static_cast<const BaseObject *>(poll_vote_source_.get()));
    s.store_field("soundId", sound_id_);
    s.store_field("showPreview", show_preview_);
    s.store_class_end();
  }
}

void reactionNotificationSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReactionNotificationSettings").c_str());
    message_reaction_source_fieldID = jni::get_field_id(env, Class, "messageReactionSource", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionNotificationSource;").c_str());
    story_reaction_source_fieldID = jni::get_field_id(env, Class, "storyReactionSource", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionNotificationSource;").c_str());
    poll_vote_source_fieldID = jni::get_field_id(env, Class, "pollVoteSource", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionNotificationSource;").c_str());
    sound_id_fieldID = jni::get_field_id(env, Class, "soundId", "J");
    show_preview_fieldID = jni::get_field_id(env, Class, "showPreview", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass ResetPasswordResult::Class;

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

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

jclass resetPasswordResultOk::Class;

resetPasswordResultOk::resetPasswordResultOk() {
}

const std::int32_t resetPasswordResultOk::ID;

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

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

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

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

jclass resetPasswordResultPending::Class;
jfieldID resetPasswordResultPending::pending_reset_date_fieldID;

resetPasswordResultPending::resetPasswordResultPending()
  : pending_reset_date_()
{}

resetPasswordResultPending::resetPasswordResultPending(int32 pending_reset_date_)
  : pending_reset_date_(pending_reset_date_)
{}

const std::int32_t resetPasswordResultPending::ID;

object_ptr<ResetPasswordResult> resetPasswordResultPending::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<resetPasswordResultPending> res = make_object<resetPasswordResultPending>();
  res->pending_reset_date_ = env->GetIntField(p, res->pending_reset_date_fieldID);
  return std::move(res);
}

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

void resetPasswordResultPending::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ResetPasswordResultPending");
    s.store_field("pendingResetDate", pending_reset_date_);
    s.store_class_end();
  }
}

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

jclass resetPasswordResultDeclined::Class;
jfieldID resetPasswordResultDeclined::retry_date_fieldID;

resetPasswordResultDeclined::resetPasswordResultDeclined()
  : retry_date_()
{}

resetPasswordResultDeclined::resetPasswordResultDeclined(int32 retry_date_)
  : retry_date_(retry_date_)
{}

const std::int32_t resetPasswordResultDeclined::ID;

object_ptr<ResetPasswordResult> resetPasswordResultDeclined::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<resetPasswordResultDeclined> res = make_object<resetPasswordResultDeclined>();
  res->retry_date_ = env->GetIntField(p, res->retry_date_fieldID);
  return std::move(res);
}

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

void resetPasswordResultDeclined::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ResetPasswordResultDeclined");
    s.store_field("retryDate", retry_date_);
    s.store_class_end();
  }
}

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

jclass savedCredentials::Class;
jfieldID savedCredentials::id_fieldID;
jfieldID savedCredentials::title_fieldID;

savedCredentials::savedCredentials()
  : id_()
  , title_()
{}

savedCredentials::savedCredentials(string const &id_, string const &title_)
  : id_(id_)
  , title_(title_)
{}

const std::int32_t savedCredentials::ID;

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

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

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

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

jclass SettingsSection::Class;

object_ptr<SettingsSection> SettingsSection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case settingsSectionAppearance::ID:
      return settingsSectionAppearance::fetch(env, p);
    case settingsSectionAskQuestion::ID:
      return settingsSectionAskQuestion::fetch(env, p);
    case settingsSectionBusiness::ID:
      return settingsSectionBusiness::fetch(env, p);
    case settingsSectionChatFolders::ID:
      return settingsSectionChatFolders::fetch(env, p);
    case settingsSectionDataAndStorage::ID:
      return settingsSectionDataAndStorage::fetch(env, p);
    case settingsSectionDevices::ID:
      return settingsSectionDevices::fetch(env, p);
    case settingsSectionEditProfile::ID:
      return settingsSectionEditProfile::fetch(env, p);
    case settingsSectionFaq::ID:
      return settingsSectionFaq::fetch(env, p);
    case settingsSectionFeatures::ID:
      return settingsSectionFeatures::fetch(env, p);
    case settingsSectionInAppBrowser::ID:
      return settingsSectionInAppBrowser::fetch(env, p);
    case settingsSectionLanguage::ID:
      return settingsSectionLanguage::fetch(env, p);
    case settingsSectionMyStars::ID:
      return settingsSectionMyStars::fetch(env, p);
    case settingsSectionMyToncoins::ID:
      return settingsSectionMyToncoins::fetch(env, p);
    case settingsSectionNotifications::ID:
      return settingsSectionNotifications::fetch(env, p);
    case settingsSectionPowerSaving::ID:
      return settingsSectionPowerSaving::fetch(env, p);
    case settingsSectionPremium::ID:
      return settingsSectionPremium::fetch(env, p);
    case settingsSectionPrivacyAndSecurity::ID:
      return settingsSectionPrivacyAndSecurity::fetch(env, p);
    case settingsSectionPrivacyPolicy::ID:
      return settingsSectionPrivacyPolicy::fetch(env, p);
    case settingsSectionQrCode::ID:
      return settingsSectionQrCode::fetch(env, p);
    case settingsSectionSearch::ID:
      return settingsSectionSearch::fetch(env, p);
    case settingsSectionSendGift::ID:
      return settingsSectionSendGift::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass settingsSectionAppearance::Class;
jfieldID settingsSectionAppearance::subsection_fieldID;

settingsSectionAppearance::settingsSectionAppearance()
  : subsection_()
{}

settingsSectionAppearance::settingsSectionAppearance(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionAppearance::ID;

object_ptr<SettingsSection> settingsSectionAppearance::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionAppearance> res = make_object<settingsSectionAppearance>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionAppearance::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionAppearance");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionAskQuestion::Class;

settingsSectionAskQuestion::settingsSectionAskQuestion() {
}

const std::int32_t settingsSectionAskQuestion::ID;

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

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

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

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

jclass settingsSectionBusiness::Class;
jfieldID settingsSectionBusiness::subsection_fieldID;

settingsSectionBusiness::settingsSectionBusiness()
  : subsection_()
{}

settingsSectionBusiness::settingsSectionBusiness(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionBusiness::ID;

object_ptr<SettingsSection> settingsSectionBusiness::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionBusiness> res = make_object<settingsSectionBusiness>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionBusiness::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionBusiness");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionChatFolders::Class;
jfieldID settingsSectionChatFolders::subsection_fieldID;

settingsSectionChatFolders::settingsSectionChatFolders()
  : subsection_()
{}

settingsSectionChatFolders::settingsSectionChatFolders(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionChatFolders::ID;

object_ptr<SettingsSection> settingsSectionChatFolders::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionChatFolders> res = make_object<settingsSectionChatFolders>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionChatFolders::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionChatFolders");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionDataAndStorage::Class;
jfieldID settingsSectionDataAndStorage::subsection_fieldID;

settingsSectionDataAndStorage::settingsSectionDataAndStorage()
  : subsection_()
{}

settingsSectionDataAndStorage::settingsSectionDataAndStorage(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionDataAndStorage::ID;

object_ptr<SettingsSection> settingsSectionDataAndStorage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionDataAndStorage> res = make_object<settingsSectionDataAndStorage>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionDataAndStorage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionDataAndStorage");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionDevices::Class;
jfieldID settingsSectionDevices::subsection_fieldID;

settingsSectionDevices::settingsSectionDevices()
  : subsection_()
{}

settingsSectionDevices::settingsSectionDevices(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionDevices::ID;

object_ptr<SettingsSection> settingsSectionDevices::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionDevices> res = make_object<settingsSectionDevices>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionDevices::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionDevices");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionEditProfile::Class;
jfieldID settingsSectionEditProfile::subsection_fieldID;

settingsSectionEditProfile::settingsSectionEditProfile()
  : subsection_()
{}

settingsSectionEditProfile::settingsSectionEditProfile(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionEditProfile::ID;

object_ptr<SettingsSection> settingsSectionEditProfile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionEditProfile> res = make_object<settingsSectionEditProfile>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionEditProfile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionEditProfile");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionFaq::Class;

settingsSectionFaq::settingsSectionFaq() {
}

const std::int32_t settingsSectionFaq::ID;

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

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

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

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

jclass settingsSectionFeatures::Class;

settingsSectionFeatures::settingsSectionFeatures() {
}

const std::int32_t settingsSectionFeatures::ID;

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

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

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

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

jclass settingsSectionInAppBrowser::Class;
jfieldID settingsSectionInAppBrowser::subsection_fieldID;

settingsSectionInAppBrowser::settingsSectionInAppBrowser()
  : subsection_()
{}

settingsSectionInAppBrowser::settingsSectionInAppBrowser(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionInAppBrowser::ID;

object_ptr<SettingsSection> settingsSectionInAppBrowser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionInAppBrowser> res = make_object<settingsSectionInAppBrowser>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionInAppBrowser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionInAppBrowser");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionLanguage::Class;
jfieldID settingsSectionLanguage::subsection_fieldID;

settingsSectionLanguage::settingsSectionLanguage()
  : subsection_()
{}

settingsSectionLanguage::settingsSectionLanguage(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionLanguage::ID;

object_ptr<SettingsSection> settingsSectionLanguage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionLanguage> res = make_object<settingsSectionLanguage>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionLanguage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionLanguage");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionMyStars::Class;
jfieldID settingsSectionMyStars::subsection_fieldID;

settingsSectionMyStars::settingsSectionMyStars()
  : subsection_()
{}

settingsSectionMyStars::settingsSectionMyStars(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionMyStars::ID;

object_ptr<SettingsSection> settingsSectionMyStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionMyStars> res = make_object<settingsSectionMyStars>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionMyStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionMyStars");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionMyToncoins::Class;

settingsSectionMyToncoins::settingsSectionMyToncoins() {
}

const std::int32_t settingsSectionMyToncoins::ID;

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

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

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

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

jclass settingsSectionNotifications::Class;
jfieldID settingsSectionNotifications::subsection_fieldID;

settingsSectionNotifications::settingsSectionNotifications()
  : subsection_()
{}

settingsSectionNotifications::settingsSectionNotifications(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionNotifications::ID;

object_ptr<SettingsSection> settingsSectionNotifications::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionNotifications> res = make_object<settingsSectionNotifications>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionNotifications::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionNotifications");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionPowerSaving::Class;
jfieldID settingsSectionPowerSaving::subsection_fieldID;

settingsSectionPowerSaving::settingsSectionPowerSaving()
  : subsection_()
{}

settingsSectionPowerSaving::settingsSectionPowerSaving(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionPowerSaving::ID;

object_ptr<SettingsSection> settingsSectionPowerSaving::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionPowerSaving> res = make_object<settingsSectionPowerSaving>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionPowerSaving::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionPowerSaving");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionPremium::Class;

settingsSectionPremium::settingsSectionPremium() {
}

const std::int32_t settingsSectionPremium::ID;

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

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

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

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

jclass settingsSectionPrivacyAndSecurity::Class;
jfieldID settingsSectionPrivacyAndSecurity::subsection_fieldID;

settingsSectionPrivacyAndSecurity::settingsSectionPrivacyAndSecurity()
  : subsection_()
{}

settingsSectionPrivacyAndSecurity::settingsSectionPrivacyAndSecurity(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionPrivacyAndSecurity::ID;

object_ptr<SettingsSection> settingsSectionPrivacyAndSecurity::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionPrivacyAndSecurity> res = make_object<settingsSectionPrivacyAndSecurity>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionPrivacyAndSecurity::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionPrivacyAndSecurity");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionPrivacyPolicy::Class;

settingsSectionPrivacyPolicy::settingsSectionPrivacyPolicy() {
}

const std::int32_t settingsSectionPrivacyPolicy::ID;

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

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

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

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

jclass settingsSectionQrCode::Class;
jfieldID settingsSectionQrCode::subsection_fieldID;

settingsSectionQrCode::settingsSectionQrCode()
  : subsection_()
{}

settingsSectionQrCode::settingsSectionQrCode(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionQrCode::ID;

object_ptr<SettingsSection> settingsSectionQrCode::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionQrCode> res = make_object<settingsSectionQrCode>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionQrCode::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionQrCode");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass settingsSectionSearch::Class;

settingsSectionSearch::settingsSectionSearch() {
}

const std::int32_t settingsSectionSearch::ID;

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

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

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

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

jclass settingsSectionSendGift::Class;
jfieldID settingsSectionSendGift::subsection_fieldID;

settingsSectionSendGift::settingsSectionSendGift()
  : subsection_()
{}

settingsSectionSendGift::settingsSectionSendGift(string const &subsection_)
  : subsection_(subsection_)
{}

const std::int32_t settingsSectionSendGift::ID;

object_ptr<SettingsSection> settingsSectionSendGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<settingsSectionSendGift> res = make_object<settingsSectionSendGift>();
  res->subsection_ = jni::fetch_string(env, p, res->subsection_fieldID);
  return std::move(res);
}

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

void settingsSectionSendGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SettingsSectionSendGift");
    s.store_field("subsection", subsection_);
    s.store_class_end();
  }
}

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

jclass sponsoredChats::Class;
jfieldID sponsoredChats::chats_fieldID;

sponsoredChats::sponsoredChats()
  : chats_()
{}

sponsoredChats::sponsoredChats(array<object_ptr<sponsoredChat>> &&chats_)
  : chats_(std::move(chats_))
{}

const std::int32_t sponsoredChats::ID;

object_ptr<sponsoredChats> sponsoredChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sponsoredChats> res = make_object<sponsoredChats>();
  res->chats_ = jni::FetchVector<sponsoredChat>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->chats_fieldID));
  return res;
}

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

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

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

jclass StarSubscriptionType::Class;

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

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

jclass starSubscriptionTypeChannel::Class;
jfieldID starSubscriptionTypeChannel::can_reuse_fieldID;
jfieldID starSubscriptionTypeChannel::invite_link_fieldID;

starSubscriptionTypeChannel::starSubscriptionTypeChannel()
  : can_reuse_()
  , invite_link_()
{}

starSubscriptionTypeChannel::starSubscriptionTypeChannel(bool can_reuse_, string const &invite_link_)
  : can_reuse_(can_reuse_)
  , invite_link_(invite_link_)
{}

const std::int32_t starSubscriptionTypeChannel::ID;

object_ptr<StarSubscriptionType> starSubscriptionTypeChannel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starSubscriptionTypeChannel> res = make_object<starSubscriptionTypeChannel>();
  res->can_reuse_ = (env->GetBooleanField(p, res->can_reuse_fieldID) != 0);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return std::move(res);
}

void starSubscriptionTypeChannel::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_reuse_fieldID, can_reuse_);
  { jstring nextString = jni::to_jstring(env, invite_link_); if (nextString) { env->SetObjectField(s, invite_link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void starSubscriptionTypeChannel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarSubscriptionTypeChannel");
    s.store_field("canReuse", can_reuse_);
    s.store_field("inviteLink", invite_link_);
    s.store_class_end();
  }
}

void starSubscriptionTypeChannel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarSubscriptionTypeChannel").c_str());
    can_reuse_fieldID = jni::get_field_id(env, Class, "canReuse", "Z");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass starSubscriptionTypeBot::Class;
jfieldID starSubscriptionTypeBot::is_canceled_by_bot_fieldID;
jfieldID starSubscriptionTypeBot::title_fieldID;
jfieldID starSubscriptionTypeBot::photo_fieldID;
jfieldID starSubscriptionTypeBot::invoice_link_fieldID;

starSubscriptionTypeBot::starSubscriptionTypeBot()
  : is_canceled_by_bot_()
  , title_()
  , photo_()
  , invoice_link_()
{}

starSubscriptionTypeBot::starSubscriptionTypeBot(bool is_canceled_by_bot_, string const &title_, object_ptr<photo> &&photo_, string const &invoice_link_)
  : is_canceled_by_bot_(is_canceled_by_bot_)
  , title_(title_)
  , photo_(std::move(photo_))
  , invoice_link_(invoice_link_)
{}

const std::int32_t starSubscriptionTypeBot::ID;

object_ptr<StarSubscriptionType> starSubscriptionTypeBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starSubscriptionTypeBot> res = make_object<starSubscriptionTypeBot>();
  res->is_canceled_by_bot_ = (env->GetBooleanField(p, res->is_canceled_by_bot_fieldID) != 0);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->invoice_link_ = jni::fetch_string(env, p, res->invoice_link_fieldID);
  return std::move(res);
}

void starSubscriptionTypeBot::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_canceled_by_bot_fieldID, is_canceled_by_bot_);
  { 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); } }
  { jstring nextString = jni::to_jstring(env, invoice_link_); if (nextString) { env->SetObjectField(s, invoice_link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void starSubscriptionTypeBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarSubscriptionTypeBot");
    s.store_field("isCanceledByBot", is_canceled_by_bot_);
    s.store_field("title", title_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("invoiceLink", invoice_link_);
    s.store_class_end();
  }
}

void starSubscriptionTypeBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarSubscriptionTypeBot").c_str());
    is_canceled_by_bot_fieldID = jni::get_field_id(env, Class, "isCanceledByBot", "Z");
    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$Photo;").c_str());
    invoice_link_fieldID = jni::get_field_id(env, Class, "invoiceLink", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass starSubscriptions::Class;
jfieldID starSubscriptions::star_amount_fieldID;
jfieldID starSubscriptions::subscriptions_fieldID;
jfieldID starSubscriptions::required_star_count_fieldID;
jfieldID starSubscriptions::next_offset_fieldID;

starSubscriptions::starSubscriptions()
  : star_amount_()
  , subscriptions_()
  , required_star_count_()
  , next_offset_()
{}

starSubscriptions::starSubscriptions(object_ptr<starAmount> &&star_amount_, array<object_ptr<starSubscription>> &&subscriptions_, int53 required_star_count_, string const &next_offset_)
  : star_amount_(std::move(star_amount_))
  , subscriptions_(std::move(subscriptions_))
  , required_star_count_(required_star_count_)
  , next_offset_(next_offset_)
{}

const std::int32_t starSubscriptions::ID;

object_ptr<starSubscriptions> starSubscriptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starSubscriptions> res = make_object<starSubscriptions>();
  res->star_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->star_amount_fieldID));
  res->subscriptions_ = jni::FetchVector<starSubscription>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->subscriptions_fieldID));
  res->required_star_count_ = env->GetLongField(p, res->required_star_count_fieldID);
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

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

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

void starSubscriptions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarSubscriptions").c_str());
    star_amount_fieldID = jni::get_field_id(env, Class, "starAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    subscriptions_fieldID = jni::get_field_id(env, Class, "subscriptions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StarSubscription;").c_str());
    required_star_count_fieldID = jni::get_field_id(env, Class, "requiredStarCount", "J");
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass statisticalValue::Class;
jfieldID statisticalValue::value_fieldID;
jfieldID statisticalValue::previous_value_fieldID;
jfieldID statisticalValue::growth_rate_percentage_fieldID;

statisticalValue::statisticalValue()
  : value_()
  , previous_value_()
  , growth_rate_percentage_()
{}

statisticalValue::statisticalValue(double value_, double previous_value_, double growth_rate_percentage_)
  : value_(value_)
  , previous_value_(previous_value_)
  , growth_rate_percentage_(growth_rate_percentage_)
{}

const std::int32_t statisticalValue::ID;

object_ptr<statisticalValue> statisticalValue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<statisticalValue> res = make_object<statisticalValue>();
  res->value_ = env->GetDoubleField(p, res->value_fieldID);
  res->previous_value_ = env->GetDoubleField(p, res->previous_value_fieldID);
  res->growth_rate_percentage_ = env->GetDoubleField(p, res->growth_rate_percentage_fieldID);
  return res;
}

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

void statisticalValue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StatisticalValue");
    s.store_field("value", value_);
    s.store_field("previousValue", previous_value_);
    s.store_field("growthRatePercentage", growth_rate_percentage_);
    s.store_class_end();
  }
}

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

jclass StoreTransaction::Class;

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

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

jclass storeTransactionAppStore::Class;
jfieldID storeTransactionAppStore::receipt_fieldID;

storeTransactionAppStore::storeTransactionAppStore()
  : receipt_()
{}

storeTransactionAppStore::storeTransactionAppStore(bytes const &receipt_)
  : receipt_(std::move(receipt_))
{}

const std::int32_t storeTransactionAppStore::ID;

object_ptr<StoreTransaction> storeTransactionAppStore::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storeTransactionAppStore> res = make_object<storeTransactionAppStore>();
  res->receipt_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->receipt_fieldID));
  return std::move(res);
}

void storeTransactionAppStore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoreTransactionAppStore");
    s.store_bytes_field("receipt", receipt_);
    s.store_class_end();
  }
}

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

jclass storeTransactionGooglePlay::Class;
jfieldID storeTransactionGooglePlay::package_name_fieldID;
jfieldID storeTransactionGooglePlay::store_product_id_fieldID;
jfieldID storeTransactionGooglePlay::purchase_token_fieldID;

storeTransactionGooglePlay::storeTransactionGooglePlay()
  : package_name_()
  , store_product_id_()
  , purchase_token_()
{}

storeTransactionGooglePlay::storeTransactionGooglePlay(string const &package_name_, string const &store_product_id_, string const &purchase_token_)
  : package_name_(package_name_)
  , store_product_id_(store_product_id_)
  , purchase_token_(purchase_token_)
{}

const std::int32_t storeTransactionGooglePlay::ID;

object_ptr<StoreTransaction> storeTransactionGooglePlay::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storeTransactionGooglePlay> res = make_object<storeTransactionGooglePlay>();
  res->package_name_ = jni::fetch_string(env, p, res->package_name_fieldID);
  res->store_product_id_ = jni::fetch_string(env, p, res->store_product_id_fieldID);
  res->purchase_token_ = jni::fetch_string(env, p, res->purchase_token_fieldID);
  return std::move(res);
}

void storeTransactionGooglePlay::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoreTransactionGooglePlay");
    s.store_field("packageName", package_name_);
    s.store_field("storeProductId", store_product_id_);
    s.store_field("purchaseToken", purchase_token_);
    s.store_class_end();
  }
}

void storeTransactionGooglePlay::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoreTransactionGooglePlay").c_str());
    package_name_fieldID = jni::get_field_id(env, Class, "packageName", "Ljava/lang/String;");
    store_product_id_fieldID = jni::get_field_id(env, Class, "storeProductId", "Ljava/lang/String;");
    purchase_token_fieldID = jni::get_field_id(env, Class, "purchaseToken", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass StoryContentType::Class;

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

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

jclass storyContentTypePhoto::Class;

storyContentTypePhoto::storyContentTypePhoto() {
}

const std::int32_t storyContentTypePhoto::ID;

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

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

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

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

jclass storyContentTypeVideo::Class;

storyContentTypeVideo::storyContentTypeVideo() {
}

const std::int32_t storyContentTypeVideo::ID;

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

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

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

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

jclass storyContentTypeLive::Class;

storyContentTypeLive::storyContentTypeLive() {
}

const std::int32_t storyContentTypeLive::ID;

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

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

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

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

jclass storyContentTypeUnsupported::Class;

storyContentTypeUnsupported::storyContentTypeUnsupported() {
}

const std::int32_t storyContentTypeUnsupported::ID;

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

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

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

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

jclass textEntities::Class;
jfieldID textEntities::entities_fieldID;

textEntities::textEntities()
  : entities_()
{}

textEntities::textEntities(array<object_ptr<textEntity>> &&entities_)
  : entities_(std::move(entities_))
{}

const std::int32_t textEntities::ID;

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

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

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

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

jclass textQuote::Class;
jfieldID textQuote::text_fieldID;
jfieldID textQuote::position_fieldID;
jfieldID textQuote::is_manual_fieldID;

textQuote::textQuote()
  : text_()
  , position_()
  , is_manual_()
{}

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

const std::int32_t textQuote::ID;

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

void textQuote::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, position_fieldID, position_);
  env->SetBooleanField(s, is_manual_fieldID, is_manual_);
}

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

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

jclass trendingStickerSets::Class;
jfieldID trendingStickerSets::total_count_fieldID;
jfieldID trendingStickerSets::sets_fieldID;
jfieldID trendingStickerSets::is_premium_fieldID;

trendingStickerSets::trendingStickerSets()
  : total_count_()
  , sets_()
  , is_premium_()
{}

trendingStickerSets::trendingStickerSets(int32 total_count_, array<object_ptr<stickerSetInfo>> &&sets_, bool is_premium_)
  : total_count_(total_count_)
  , sets_(std::move(sets_))
  , is_premium_(is_premium_)
{}

const std::int32_t trendingStickerSets::ID;

object_ptr<trendingStickerSets> trendingStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<trendingStickerSets> res = make_object<trendingStickerSets>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->sets_ = jni::FetchVector<stickerSetInfo>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->sets_fieldID));
  res->is_premium_ = (env->GetBooleanField(p, res->is_premium_fieldID) != 0);
  return res;
}

void trendingStickerSets::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, sets_); if (arr_tmp_) { env->SetObjectField(s, sets_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_premium_fieldID, is_premium_);
}

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

void trendingStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TrendingStickerSets").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    sets_fieldID = jni::get_field_id(env, Class, "sets", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StickerSetInfo;").c_str());
    is_premium_fieldID = jni::get_field_id(env, Class, "isPremium", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass UpgradedGiftOrigin::Class;

object_ptr<UpgradedGiftOrigin> UpgradedGiftOrigin::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case upgradedGiftOriginUpgrade::ID:
      return upgradedGiftOriginUpgrade::fetch(env, p);
    case upgradedGiftOriginTransfer::ID:
      return upgradedGiftOriginTransfer::fetch(env, p);
    case upgradedGiftOriginResale::ID:
      return upgradedGiftOriginResale::fetch(env, p);
    case upgradedGiftOriginBlockchain::ID:
      return upgradedGiftOriginBlockchain::fetch(env, p);
    case upgradedGiftOriginPrepaidUpgrade::ID:
      return upgradedGiftOriginPrepaidUpgrade::fetch(env, p);
    case upgradedGiftOriginOffer::ID:
      return upgradedGiftOriginOffer::fetch(env, p);
    case upgradedGiftOriginCraft::ID:
      return upgradedGiftOriginCraft::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass upgradedGiftOriginUpgrade::Class;
jfieldID upgradedGiftOriginUpgrade::gift_message_id_fieldID;

upgradedGiftOriginUpgrade::upgradedGiftOriginUpgrade()
  : gift_message_id_()
{}

upgradedGiftOriginUpgrade::upgradedGiftOriginUpgrade(int53 gift_message_id_)
  : gift_message_id_(gift_message_id_)
{}

const std::int32_t upgradedGiftOriginUpgrade::ID;

object_ptr<UpgradedGiftOrigin> upgradedGiftOriginUpgrade::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftOriginUpgrade> res = make_object<upgradedGiftOriginUpgrade>();
  res->gift_message_id_ = env->GetLongField(p, res->gift_message_id_fieldID);
  return std::move(res);
}

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

void upgradedGiftOriginUpgrade::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftOriginUpgrade");
    s.store_field("giftMessageId", gift_message_id_);
    s.store_class_end();
  }
}

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

jclass upgradedGiftOriginTransfer::Class;

upgradedGiftOriginTransfer::upgradedGiftOriginTransfer() {
}

const std::int32_t upgradedGiftOriginTransfer::ID;

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

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

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

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

jclass upgradedGiftOriginResale::Class;
jfieldID upgradedGiftOriginResale::price_fieldID;

upgradedGiftOriginResale::upgradedGiftOriginResale()
  : price_()
{}

upgradedGiftOriginResale::upgradedGiftOriginResale(object_ptr<GiftResalePrice> &&price_)
  : price_(std::move(price_))
{}

const std::int32_t upgradedGiftOriginResale::ID;

object_ptr<UpgradedGiftOrigin> upgradedGiftOriginResale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftOriginResale> res = make_object<upgradedGiftOriginResale>();
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  return std::move(res);
}

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

void upgradedGiftOriginResale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftOriginResale");
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_class_end();
  }
}

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

jclass upgradedGiftOriginBlockchain::Class;

upgradedGiftOriginBlockchain::upgradedGiftOriginBlockchain() {
}

const std::int32_t upgradedGiftOriginBlockchain::ID;

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

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

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

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

jclass upgradedGiftOriginPrepaidUpgrade::Class;

upgradedGiftOriginPrepaidUpgrade::upgradedGiftOriginPrepaidUpgrade() {
}

const std::int32_t upgradedGiftOriginPrepaidUpgrade::ID;

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

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

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

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

jclass upgradedGiftOriginOffer::Class;
jfieldID upgradedGiftOriginOffer::price_fieldID;

upgradedGiftOriginOffer::upgradedGiftOriginOffer()
  : price_()
{}

upgradedGiftOriginOffer::upgradedGiftOriginOffer(object_ptr<GiftResalePrice> &&price_)
  : price_(std::move(price_))
{}

const std::int32_t upgradedGiftOriginOffer::ID;

object_ptr<UpgradedGiftOrigin> upgradedGiftOriginOffer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftOriginOffer> res = make_object<upgradedGiftOriginOffer>();
  res->price_ = jni::fetch_tl_object<GiftResalePrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  return std::move(res);
}

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

void upgradedGiftOriginOffer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftOriginOffer");
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_class_end();
  }
}

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

jclass upgradedGiftOriginCraft::Class;

upgradedGiftOriginCraft::upgradedGiftOriginCraft() {
}

const std::int32_t upgradedGiftOriginCraft::ID;

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

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

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

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

jclass userSupportInfo::Class;
jfieldID userSupportInfo::message_fieldID;
jfieldID userSupportInfo::author_fieldID;
jfieldID userSupportInfo::date_fieldID;

userSupportInfo::userSupportInfo()
  : message_()
  , author_()
  , date_()
{}

userSupportInfo::userSupportInfo(object_ptr<formattedText> &&message_, string const &author_, int32 date_)
  : message_(std::move(message_))
  , author_(author_)
  , date_(date_)
{}

const std::int32_t userSupportInfo::ID;

object_ptr<userSupportInfo> userSupportInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userSupportInfo> res = make_object<userSupportInfo>();
  res->message_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->message_fieldID));
  res->author_ = jni::fetch_string(env, p, res->author_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void userSupportInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (message_ != nullptr) { jobject next; message_->store(env, next); if (next) { env->SetObjectField(s, message_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, author_); if (nextString) { env->SetObjectField(s, author_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, date_fieldID, date_);
}

void userSupportInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserSupportInfo");
    s.store_object_field("message", static_cast<const BaseObject *>(message_.get()));
    s.store_field("author", author_);
    s.store_field("date", date_);
    s.store_class_end();
  }
}

void userSupportInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UserSupportInfo").c_str());
    message_fieldID = jni::get_field_id(env, Class, "message", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    author_fieldID = jni::get_field_id(env, Class, "author", "Ljava/lang/String;");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass webApp::Class;
jfieldID webApp::short_name_fieldID;
jfieldID webApp::title_fieldID;
jfieldID webApp::description_fieldID;
jfieldID webApp::photo_fieldID;
jfieldID webApp::animation_fieldID;

webApp::webApp()
  : short_name_()
  , title_()
  , description_()
  , photo_()
  , animation_()
{}

webApp::webApp(string const &short_name_, string const &title_, string const &description_, object_ptr<photo> &&photo_, object_ptr<animation> &&animation_)
  : short_name_(short_name_)
  , title_(title_)
  , description_(description_)
  , photo_(std::move(photo_))
  , animation_(std::move(animation_))
{}

const std::int32_t webApp::ID;

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

void webApp::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, short_name_); if (nextString) { env->SetObjectField(s, short_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (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); } }
}

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

void webApp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$WebApp").c_str());
    short_name_fieldID = jni::get_field_id(env, Class, "shortName", "Ljava/lang/String;");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    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());
    return true;
  }();
  (void)is_inited;
}

jclass addContact::Class;
jfieldID addContact::user_id_fieldID;
jfieldID addContact::contact_fieldID;
jfieldID addContact::share_phone_number_fieldID;

addContact::addContact()
  : user_id_()
  , contact_()
  , share_phone_number_()
{}

addContact::addContact(int53 user_id_, object_ptr<importedContact> &&contact_, bool share_phone_number_)
  : user_id_(user_id_)
  , contact_(std::move(contact_))
  , share_phone_number_(share_phone_number_)
{}

const std::int32_t addContact::ID;

object_ptr<addContact> addContact::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addContact> res = make_object<addContact>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->contact_ = jni::fetch_tl_object<importedContact>(env, jni::fetch_object(env, p, res->contact_fieldID));
  res->share_phone_number_ = (env->GetBooleanField(p, res->share_phone_number_fieldID) != 0);
  return res;
}

void addContact::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddContact");
    s.store_field("userId", user_id_);
    s.store_object_field("contact", static_cast<const BaseObject *>(contact_.get()));
    s.store_field("sharePhoneNumber", share_phone_number_);
    s.store_class_end();
  }
}

addContact::ReturnType addContact::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addContact::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddContact").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    contact_fieldID = jni::get_field_id(env, Class, "contact", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ImportedContact;").c_str());
    share_phone_number_fieldID = jni::get_field_id(env, Class, "sharePhoneNumber", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass addOffer::Class;
jfieldID addOffer::chat_id_fieldID;
jfieldID addOffer::message_id_fieldID;
jfieldID addOffer::options_fieldID;

addOffer::addOffer()
  : chat_id_()
  , message_id_()
  , options_()
{}

addOffer::addOffer(int53 chat_id_, int53 message_id_, object_ptr<messageSendOptions> &&options_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , options_(std::move(options_))
{}

const std::int32_t addOffer::ID;

object_ptr<addOffer> addOffer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addOffer> res = make_object<addOffer>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->options_ = jni::fetch_tl_object<messageSendOptions>(env, jni::fetch_object(env, p, res->options_fieldID));
  return res;
}

void addOffer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddOffer");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("options", static_cast<const BaseObject *>(options_.get()));
    s.store_class_end();
  }
}

addOffer::ReturnType addOffer::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void addOffer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddOffer").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    options_fieldID = jni::get_field_id(env, Class, "options", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSendOptions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addPendingLiveStoryReaction::Class;
jfieldID addPendingLiveStoryReaction::group_call_id_fieldID;
jfieldID addPendingLiveStoryReaction::star_count_fieldID;

addPendingLiveStoryReaction::addPendingLiveStoryReaction()
  : group_call_id_()
  , star_count_()
{}

addPendingLiveStoryReaction::addPendingLiveStoryReaction(int32 group_call_id_, int53 star_count_)
  : group_call_id_(group_call_id_)
  , star_count_(star_count_)
{}

const std::int32_t addPendingLiveStoryReaction::ID;

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

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

addPendingLiveStoryReaction::ReturnType addPendingLiveStoryReaction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass addStickerToSet::Class;
jfieldID addStickerToSet::user_id_fieldID;
jfieldID addStickerToSet::name_fieldID;
jfieldID addStickerToSet::sticker_fieldID;

addStickerToSet::addStickerToSet()
  : user_id_()
  , name_()
  , sticker_()
{}

addStickerToSet::addStickerToSet(int53 user_id_, string const &name_, object_ptr<inputSticker> &&sticker_)
  : user_id_(user_id_)
  , name_(name_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t addStickerToSet::ID;

object_ptr<addStickerToSet> addStickerToSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addStickerToSet> res = make_object<addStickerToSet>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->sticker_ = jni::fetch_tl_object<inputSticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void addStickerToSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddStickerToSet");
    s.store_field("userId", user_id_);
    s.store_field("name", name_);
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

addStickerToSet::ReturnType addStickerToSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addStickerToSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddStickerToSet").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputSticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass banChatMember::Class;
jfieldID banChatMember::chat_id_fieldID;
jfieldID banChatMember::member_id_fieldID;
jfieldID banChatMember::banned_until_date_fieldID;
jfieldID banChatMember::revoke_messages_fieldID;

banChatMember::banChatMember()
  : chat_id_()
  , member_id_()
  , banned_until_date_()
  , revoke_messages_()
{}

banChatMember::banChatMember(int53 chat_id_, object_ptr<MessageSender> &&member_id_, int32 banned_until_date_, bool revoke_messages_)
  : chat_id_(chat_id_)
  , member_id_(std::move(member_id_))
  , banned_until_date_(banned_until_date_)
  , revoke_messages_(revoke_messages_)
{}

const std::int32_t banChatMember::ID;

object_ptr<banChatMember> banChatMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<banChatMember> res = make_object<banChatMember>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->member_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->member_id_fieldID));
  res->banned_until_date_ = env->GetIntField(p, res->banned_until_date_fieldID);
  res->revoke_messages_ = (env->GetBooleanField(p, res->revoke_messages_fieldID) != 0);
  return res;
}

void banChatMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BanChatMember");
    s.store_field("chatId", chat_id_);
    s.store_object_field("memberId", static_cast<const BaseObject *>(member_id_.get()));
    s.store_field("bannedUntilDate", banned_until_date_);
    s.store_field("revokeMessages", revoke_messages_);
    s.store_class_end();
  }
}

banChatMember::ReturnType banChatMember::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void banChatMember::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BanChatMember").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    member_id_fieldID = jni::get_field_id(env, Class, "memberId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    banned_until_date_fieldID = jni::get_field_id(env, Class, "bannedUntilDate", "I");
    revoke_messages_fieldID = jni::get_field_id(env, Class, "revokeMessages", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass boostChat::Class;
jfieldID boostChat::chat_id_fieldID;
jfieldID boostChat::slot_ids_fieldID;

boostChat::boostChat()
  : chat_id_()
  , slot_ids_()
{}

boostChat::boostChat(int53 chat_id_, array<int32> &&slot_ids_)
  : chat_id_(chat_id_)
  , slot_ids_(std::move(slot_ids_))
{}

const std::int32_t boostChat::ID;

object_ptr<boostChat> boostChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<boostChat> res = make_object<boostChat>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->slot_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->slot_ids_fieldID));
  return res;
}

void boostChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BoostChat");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("slotIds", slot_ids_.size()); for (const auto &_value : slot_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

boostChat::ReturnType boostChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostSlots::fetch(env, p);
}

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

jclass canSendGift::Class;
jfieldID canSendGift::gift_id_fieldID;

canSendGift::canSendGift()
  : gift_id_()
{}

canSendGift::canSendGift(int64 gift_id_)
  : gift_id_(gift_id_)
{}

const std::int32_t canSendGift::ID;

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

void canSendGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanSendGift");
    s.store_field("giftId", gift_id_);
    s.store_class_end();
  }
}

canSendGift::ReturnType canSendGift::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return CanSendGiftResult::fetch(env, p);
}

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

jclass cancelRecoveryEmailAddressVerification::Class;

cancelRecoveryEmailAddressVerification::cancelRecoveryEmailAddressVerification() {
}

const std::int32_t cancelRecoveryEmailAddressVerification::ID;

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

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

cancelRecoveryEmailAddressVerification::ReturnType cancelRecoveryEmailAddressVerification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

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

jclass checkBotUsername::Class;
jfieldID checkBotUsername::username_fieldID;

checkBotUsername::checkBotUsername()
  : username_()
{}

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

const std::int32_t checkBotUsername::ID;

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

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

checkBotUsername::ReturnType checkBotUsername::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return CheckChatUsernameResult::fetch(env, p);
}

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

jclass checkCreatedPublicChatsLimit::Class;
jfieldID checkCreatedPublicChatsLimit::type_fieldID;

checkCreatedPublicChatsLimit::checkCreatedPublicChatsLimit()
  : type_()
{}

checkCreatedPublicChatsLimit::checkCreatedPublicChatsLimit(object_ptr<PublicChatType> &&type_)
  : type_(std::move(type_))
{}

const std::int32_t checkCreatedPublicChatsLimit::ID;

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

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

checkCreatedPublicChatsLimit::ReturnType checkCreatedPublicChatsLimit::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

checkQuickReplyShortcutName::checkQuickReplyShortcutName()
  : name_()
{}

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

const std::int32_t checkQuickReplyShortcutName::ID;

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

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

checkQuickReplyShortcutName::ReturnType checkQuickReplyShortcutName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clearSearchedForTags::Class;
jfieldID clearSearchedForTags::clear_cashtags_fieldID;

clearSearchedForTags::clearSearchedForTags()
  : clear_cashtags_()
{}

clearSearchedForTags::clearSearchedForTags(bool clear_cashtags_)
  : clear_cashtags_(clear_cashtags_)
{}

const std::int32_t clearSearchedForTags::ID;

object_ptr<clearSearchedForTags> clearSearchedForTags::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<clearSearchedForTags> res = make_object<clearSearchedForTags>();
  res->clear_cashtags_ = (env->GetBooleanField(p, res->clear_cashtags_fieldID) != 0);
  return res;
}

void clearSearchedForTags::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ClearSearchedForTags");
    s.store_field("clearCashtags", clear_cashtags_);
    s.store_class_end();
  }
}

clearSearchedForTags::ReturnType clearSearchedForTags::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass closeGiftAuction::Class;
jfieldID closeGiftAuction::gift_id_fieldID;

closeGiftAuction::closeGiftAuction()
  : gift_id_()
{}

closeGiftAuction::closeGiftAuction(int64 gift_id_)
  : gift_id_(gift_id_)
{}

const std::int32_t closeGiftAuction::ID;

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

void closeGiftAuction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CloseGiftAuction");
    s.store_field("giftId", gift_id_);
    s.store_class_end();
  }
}

closeGiftAuction::ReturnType closeGiftAuction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass createStoryAlbum::Class;
jfieldID createStoryAlbum::story_poster_chat_id_fieldID;
jfieldID createStoryAlbum::name_fieldID;
jfieldID createStoryAlbum::story_ids_fieldID;

createStoryAlbum::createStoryAlbum()
  : story_poster_chat_id_()
  , name_()
  , story_ids_()
{}

createStoryAlbum::createStoryAlbum(int53 story_poster_chat_id_, string const &name_, array<int32> &&story_ids_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , name_(name_)
  , story_ids_(std::move(story_ids_))
{}

const std::int32_t createStoryAlbum::ID;

object_ptr<createStoryAlbum> createStoryAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createStoryAlbum> res = make_object<createStoryAlbum>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->story_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->story_ids_fieldID));
  return res;
}

void createStoryAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateStoryAlbum");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("name", name_);
    { s.store_vector_begin("storyIds", story_ids_.size()); for (const auto &_value : story_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

createStoryAlbum::ReturnType createStoryAlbum::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyAlbum::fetch(env, p);
}

void createStoryAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateStoryAlbum").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    story_ids_fieldID = jni::get_field_id(env, Class, "storyIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass deleteBotMediaPreviews::Class;
jfieldID deleteBotMediaPreviews::bot_user_id_fieldID;
jfieldID deleteBotMediaPreviews::language_code_fieldID;
jfieldID deleteBotMediaPreviews::file_ids_fieldID;

deleteBotMediaPreviews::deleteBotMediaPreviews()
  : bot_user_id_()
  , language_code_()
  , file_ids_()
{}

deleteBotMediaPreviews::deleteBotMediaPreviews(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 deleteBotMediaPreviews::ID;

object_ptr<deleteBotMediaPreviews> deleteBotMediaPreviews::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteBotMediaPreviews> res = make_object<deleteBotMediaPreviews>();
  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 deleteBotMediaPreviews::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteBotMediaPreviews");
    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();
  }
}

deleteBotMediaPreviews::ReturnType deleteBotMediaPreviews::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

deleteChatBackground::deleteChatBackground()
  : chat_id_()
  , restore_previous_()
{}

deleteChatBackground::deleteChatBackground(int53 chat_id_, bool restore_previous_)
  : chat_id_(chat_id_)
  , restore_previous_(restore_previous_)
{}

const std::int32_t deleteChatBackground::ID;

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

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

deleteChatBackground::ReturnType deleteChatBackground::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteCommands::Class;
jfieldID deleteCommands::scope_fieldID;
jfieldID deleteCommands::language_code_fieldID;

deleteCommands::deleteCommands()
  : scope_()
  , language_code_()
{}

deleteCommands::deleteCommands(object_ptr<BotCommandScope> &&scope_, string const &language_code_)
  : scope_(std::move(scope_))
  , language_code_(language_code_)
{}

const std::int32_t deleteCommands::ID;

object_ptr<deleteCommands> deleteCommands::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteCommands> res = make_object<deleteCommands>();
  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 deleteCommands::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteCommands");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_field("languageCode", language_code_);
    s.store_class_end();
  }
}

deleteCommands::ReturnType deleteCommands::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

deleteQuickReplyShortcut::deleteQuickReplyShortcut()
  : shortcut_id_()
{}

deleteQuickReplyShortcut::deleteQuickReplyShortcut(int32 shortcut_id_)
  : shortcut_id_(shortcut_id_)
{}

const std::int32_t deleteQuickReplyShortcut::ID;

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

void deleteQuickReplyShortcut::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteQuickReplyShortcut");
    s.store_field("shortcutId", shortcut_id_);
    s.store_class_end();
  }
}

deleteQuickReplyShortcut::ReturnType deleteQuickReplyShortcut::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteSavedCredentials::Class;

deleteSavedCredentials::deleteSavedCredentials() {
}

const std::int32_t deleteSavedCredentials::ID;

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

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

deleteSavedCredentials::ReturnType deleteSavedCredentials::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass disconnectAllWebsites::Class;

disconnectAllWebsites::disconnectAllWebsites() {
}

const std::int32_t disconnectAllWebsites::ID;

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

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

disconnectAllWebsites::ReturnType disconnectAllWebsites::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass editBusinessMessageReplyMarkup::Class;
jfieldID editBusinessMessageReplyMarkup::business_connection_id_fieldID;
jfieldID editBusinessMessageReplyMarkup::chat_id_fieldID;
jfieldID editBusinessMessageReplyMarkup::message_id_fieldID;
jfieldID editBusinessMessageReplyMarkup::reply_markup_fieldID;

editBusinessMessageReplyMarkup::editBusinessMessageReplyMarkup()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
{}

editBusinessMessageReplyMarkup::editBusinessMessageReplyMarkup(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t editBusinessMessageReplyMarkup::ID;

object_ptr<editBusinessMessageReplyMarkup> editBusinessMessageReplyMarkup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessMessageReplyMarkup> res = make_object<editBusinessMessageReplyMarkup>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  return res;
}

void editBusinessMessageReplyMarkup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessMessageReplyMarkup");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_class_end();
  }
}

editBusinessMessageReplyMarkup::ReturnType editBusinessMessageReplyMarkup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

void editBusinessMessageReplyMarkup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessMessageReplyMarkup").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editCustomLanguagePackInfo::Class;
jfieldID editCustomLanguagePackInfo::info_fieldID;

editCustomLanguagePackInfo::editCustomLanguagePackInfo()
  : info_()
{}

editCustomLanguagePackInfo::editCustomLanguagePackInfo(object_ptr<languagePackInfo> &&info_)
  : info_(std::move(info_))
{}

const std::int32_t editCustomLanguagePackInfo::ID;

object_ptr<editCustomLanguagePackInfo> editCustomLanguagePackInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editCustomLanguagePackInfo> res = make_object<editCustomLanguagePackInfo>();
  res->info_ = jni::fetch_tl_object<languagePackInfo>(env, jni::fetch_object(env, p, res->info_fieldID));
  return res;
}

void editCustomLanguagePackInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditCustomLanguagePackInfo");
    s.store_object_field("info", static_cast<const BaseObject *>(info_.get()));
    s.store_class_end();
  }
}

editCustomLanguagePackInfo::ReturnType editCustomLanguagePackInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass editInlineMessageLiveLocation::Class;
jfieldID editInlineMessageLiveLocation::inline_message_id_fieldID;
jfieldID editInlineMessageLiveLocation::reply_markup_fieldID;
jfieldID editInlineMessageLiveLocation::location_fieldID;
jfieldID editInlineMessageLiveLocation::live_period_fieldID;
jfieldID editInlineMessageLiveLocation::heading_fieldID;
jfieldID editInlineMessageLiveLocation::proximity_alert_radius_fieldID;

editInlineMessageLiveLocation::editInlineMessageLiveLocation()
  : inline_message_id_()
  , reply_markup_()
  , location_()
  , live_period_()
  , heading_()
  , proximity_alert_radius_()
{}

editInlineMessageLiveLocation::editInlineMessageLiveLocation(string const &inline_message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<location> &&location_, int32 live_period_, int32 heading_, int32 proximity_alert_radius_)
  : inline_message_id_(inline_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 editInlineMessageLiveLocation::ID;

object_ptr<editInlineMessageLiveLocation> editInlineMessageLiveLocation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editInlineMessageLiveLocation> res = make_object<editInlineMessageLiveLocation>();
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->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 editInlineMessageLiveLocation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditInlineMessageLiveLocation");
    s.store_field("inlineMessageId", inline_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();
  }
}

editInlineMessageLiveLocation::ReturnType editInlineMessageLiveLocation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editInlineMessageLiveLocation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditInlineMessageLiveLocation").c_str());
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    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 editInlineMessageMedia::Class;
jfieldID editInlineMessageMedia::inline_message_id_fieldID;
jfieldID editInlineMessageMedia::reply_markup_fieldID;
jfieldID editInlineMessageMedia::input_message_content_fieldID;

editInlineMessageMedia::editInlineMessageMedia()
  : inline_message_id_()
  , reply_markup_()
  , input_message_content_()
{}

editInlineMessageMedia::editInlineMessageMedia(string const &inline_message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : inline_message_id_(inline_message_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editInlineMessageMedia::ID;

object_ptr<editInlineMessageMedia> editInlineMessageMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editInlineMessageMedia> res = make_object<editInlineMessageMedia>();
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void editInlineMessageMedia::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditInlineMessageMedia");
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

editInlineMessageMedia::ReturnType editInlineMessageMedia::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editInlineMessageMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditInlineMessageMedia").c_str());
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    input_message_content_fieldID = jni::get_field_id(env, Class, "inputMessageContent", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass endGroupCallRecording::Class;
jfieldID endGroupCallRecording::group_call_id_fieldID;

endGroupCallRecording::endGroupCallRecording()
  : group_call_id_()
{}

endGroupCallRecording::endGroupCallRecording(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t endGroupCallRecording::ID;

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

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

endGroupCallRecording::ReturnType endGroupCallRecording::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass getApplicationDownloadLink::Class;

getApplicationDownloadLink::getApplicationDownloadLink() {
}

const std::int32_t getApplicationDownloadLink::ID;

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

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

getApplicationDownloadLink::ReturnType getApplicationDownloadLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass getAuthorizationState::Class;

getAuthorizationState::getAuthorizationState() {
}

const std::int32_t getAuthorizationState::ID;

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

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

getAuthorizationState::ReturnType getAuthorizationState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return AuthorizationState::fetch(env, p);
}

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

jclass getChat::Class;
jfieldID getChat::chat_id_fieldID;

getChat::getChat()
  : chat_id_()
{}

getChat::getChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChat::ID;

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

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

getChat::ReturnType getChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

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

jclass getChatFolderDefaultIconName::Class;
jfieldID getChatFolderDefaultIconName::folder_fieldID;

getChatFolderDefaultIconName::getChatFolderDefaultIconName()
  : folder_()
{}

getChatFolderDefaultIconName::getChatFolderDefaultIconName(object_ptr<chatFolder> &&folder_)
  : folder_(std::move(folder_))
{}

const std::int32_t getChatFolderDefaultIconName::ID;

object_ptr<getChatFolderDefaultIconName> getChatFolderDefaultIconName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatFolderDefaultIconName> res = make_object<getChatFolderDefaultIconName>();
  res->folder_ = jni::fetch_tl_object<chatFolder>(env, jni::fetch_object(env, p, res->folder_fieldID));
  return res;
}

void getChatFolderDefaultIconName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatFolderDefaultIconName");
    s.store_object_field("folder", static_cast<const BaseObject *>(folder_.get()));
    s.store_class_end();
  }
}

getChatFolderDefaultIconName::ReturnType getChatFolderDefaultIconName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderIcon::fetch(env, p);
}

void getChatFolderDefaultIconName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatFolderDefaultIconName").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 getChatJoinRequests::Class;
jfieldID getChatJoinRequests::chat_id_fieldID;
jfieldID getChatJoinRequests::invite_link_fieldID;
jfieldID getChatJoinRequests::query_fieldID;
jfieldID getChatJoinRequests::offset_request_fieldID;
jfieldID getChatJoinRequests::limit_fieldID;

getChatJoinRequests::getChatJoinRequests()
  : chat_id_()
  , invite_link_()
  , query_()
  , offset_request_()
  , limit_()
{}

getChatJoinRequests::getChatJoinRequests(int53 chat_id_, string const &invite_link_, string const &query_, object_ptr<chatJoinRequest> &&offset_request_, int32 limit_)
  : chat_id_(chat_id_)
  , invite_link_(invite_link_)
  , query_(query_)
  , offset_request_(std::move(offset_request_))
  , limit_(limit_)
{}

const std::int32_t getChatJoinRequests::ID;

object_ptr<getChatJoinRequests> getChatJoinRequests::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatJoinRequests> res = make_object<getChatJoinRequests>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->offset_request_ = jni::fetch_tl_object<chatJoinRequest>(env, jni::fetch_object(env, p, res->offset_request_fieldID));
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatJoinRequests::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatJoinRequests");
    s.store_field("chatId", chat_id_);
    s.store_field("inviteLink", invite_link_);
    s.store_field("query", query_);
    s.store_object_field("offsetRequest", static_cast<const BaseObject *>(offset_request_.get()));
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatJoinRequests::ReturnType getChatJoinRequests::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatJoinRequests::fetch(env, p);
}

void getChatJoinRequests::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatJoinRequests").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    offset_request_fieldID = jni::get_field_id(env, Class, "offsetRequest", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatJoinRequest;").c_str());
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getCloseFriends::Class;

getCloseFriends::getCloseFriends() {
}

const std::int32_t getCloseFriends::ID;

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

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

getCloseFriends::ReturnType getCloseFriends::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return users::fetch(env, p);
}

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

jclass getCustomEmojiReactionAnimations::Class;

getCustomEmojiReactionAnimations::getCustomEmojiReactionAnimations() {
}

const std::int32_t getCustomEmojiReactionAnimations::ID;

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

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

getCustomEmojiReactionAnimations::ReturnType getCustomEmojiReactionAnimations::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getForumTopicLink::Class;
jfieldID getForumTopicLink::chat_id_fieldID;
jfieldID getForumTopicLink::forum_topic_id_fieldID;

getForumTopicLink::getForumTopicLink()
  : chat_id_()
  , forum_topic_id_()
{}

getForumTopicLink::getForumTopicLink(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t getForumTopicLink::ID;

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

getForumTopicLink::ReturnType getForumTopicLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageLink::fetch(env, p);
}

void getForumTopicLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetForumTopicLink").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 getGroupCallStreamSegment::Class;
jfieldID getGroupCallStreamSegment::group_call_id_fieldID;
jfieldID getGroupCallStreamSegment::time_offset_fieldID;
jfieldID getGroupCallStreamSegment::scale_fieldID;
jfieldID getGroupCallStreamSegment::channel_id_fieldID;
jfieldID getGroupCallStreamSegment::video_quality_fieldID;

getGroupCallStreamSegment::getGroupCallStreamSegment()
  : group_call_id_()
  , time_offset_()
  , scale_()
  , channel_id_()
  , video_quality_()
{}

getGroupCallStreamSegment::getGroupCallStreamSegment(int32 group_call_id_, int53 time_offset_, int32 scale_, int32 channel_id_, object_ptr<GroupCallVideoQuality> &&video_quality_)
  : group_call_id_(group_call_id_)
  , time_offset_(time_offset_)
  , scale_(scale_)
  , channel_id_(channel_id_)
  , video_quality_(std::move(video_quality_))
{}

const std::int32_t getGroupCallStreamSegment::ID;

object_ptr<getGroupCallStreamSegment> getGroupCallStreamSegment::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getGroupCallStreamSegment> res = make_object<getGroupCallStreamSegment>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->time_offset_ = env->GetLongField(p, res->time_offset_fieldID);
  res->scale_ = env->GetIntField(p, res->scale_fieldID);
  res->channel_id_ = env->GetIntField(p, res->channel_id_fieldID);
  res->video_quality_ = jni::fetch_tl_object<GroupCallVideoQuality>(env, jni::fetch_object(env, p, res->video_quality_fieldID));
  return res;
}

void getGroupCallStreamSegment::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGroupCallStreamSegment");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("timeOffset", time_offset_);
    s.store_field("scale", scale_);
    s.store_field("channelId", channel_id_);
    s.store_object_field("videoQuality", static_cast<const BaseObject *>(video_quality_.get()));
    s.store_class_end();
  }
}

getGroupCallStreamSegment::ReturnType getGroupCallStreamSegment::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return data::fetch(env, p);
}

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

jclass getLiveStoryTopDonors::Class;
jfieldID getLiveStoryTopDonors::group_call_id_fieldID;

getLiveStoryTopDonors::getLiveStoryTopDonors()
  : group_call_id_()
{}

getLiveStoryTopDonors::getLiveStoryTopDonors(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t getLiveStoryTopDonors::ID;

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

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

getLiveStoryTopDonors::ReturnType getLiveStoryTopDonors::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return liveStoryDonors::fetch(env, p);
}

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

jclass getLogTagVerbosityLevel::Class;
jfieldID getLogTagVerbosityLevel::tag_fieldID;

getLogTagVerbosityLevel::getLogTagVerbosityLevel()
  : tag_()
{}

getLogTagVerbosityLevel::getLogTagVerbosityLevel(string const &tag_)
  : tag_(tag_)
{}

const std::int32_t getLogTagVerbosityLevel::ID;

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

void getLogTagVerbosityLevel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLogTagVerbosityLevel");
    s.store_field("tag", tag_);
    s.store_class_end();
  }
}

getLogTagVerbosityLevel::ReturnType getLogTagVerbosityLevel::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return logVerbosityLevel::fetch(env, p);
}

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

jclass getLogVerbosityLevel::Class;

getLogVerbosityLevel::getLogVerbosityLevel() {
}

const std::int32_t getLogVerbosityLevel::ID;

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

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

getLogVerbosityLevel::ReturnType getLogVerbosityLevel::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return logVerbosityLevel::fetch(env, p);
}

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

jclass getMenuButton::Class;
jfieldID getMenuButton::user_id_fieldID;

getMenuButton::getMenuButton()
  : user_id_()
{}

getMenuButton::getMenuButton(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t getMenuButton::ID;

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

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

getMenuButton::ReturnType getMenuButton::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botMenuButton::fetch(env, p);
}

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

jclass getMessages::Class;
jfieldID getMessages::chat_id_fieldID;
jfieldID getMessages::message_ids_fieldID;

getMessages::getMessages()
  : chat_id_()
  , message_ids_()
{}

getMessages::getMessages(int53 chat_id_, array<int53> &&message_ids_)
  : chat_id_(chat_id_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t getMessages::ID;

object_ptr<getMessages> getMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessages> res = make_object<getMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return res;
}

void getMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessages");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

getMessages::ReturnType getMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

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

jclass getNetworkStatistics::Class;
jfieldID getNetworkStatistics::only_current_fieldID;

getNetworkStatistics::getNetworkStatistics()
  : only_current_()
{}

getNetworkStatistics::getNetworkStatistics(bool only_current_)
  : only_current_(only_current_)
{}

const std::int32_t getNetworkStatistics::ID;

object_ptr<getNetworkStatistics> getNetworkStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getNetworkStatistics> res = make_object<getNetworkStatistics>();
  res->only_current_ = (env->GetBooleanField(p, res->only_current_fieldID) != 0);
  return res;
}

void getNetworkStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetNetworkStatistics");
    s.store_field("onlyCurrent", only_current_);
    s.store_class_end();
  }
}

getNetworkStatistics::ReturnType getNetworkStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return networkStatistics::fetch(env, p);
}

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

jclass getPaidMessageRevenue::Class;
jfieldID getPaidMessageRevenue::user_id_fieldID;

getPaidMessageRevenue::getPaidMessageRevenue()
  : user_id_()
{}

getPaidMessageRevenue::getPaidMessageRevenue(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t getPaidMessageRevenue::ID;

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

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

getPaidMessageRevenue::ReturnType getPaidMessageRevenue::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starCount::fetch(env, p);
}

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

jclass getPremiumLimit::Class;
jfieldID getPremiumLimit::limit_type_fieldID;

getPremiumLimit::getPremiumLimit()
  : limit_type_()
{}

getPremiumLimit::getPremiumLimit(object_ptr<PremiumLimitType> &&limit_type_)
  : limit_type_(std::move(limit_type_))
{}

const std::int32_t getPremiumLimit::ID;

object_ptr<getPremiumLimit> getPremiumLimit::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPremiumLimit> res = make_object<getPremiumLimit>();
  res->limit_type_ = jni::fetch_tl_object<PremiumLimitType>(env, jni::fetch_object(env, p, res->limit_type_fieldID));
  return res;
}

void getPremiumLimit::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPremiumLimit");
    s.store_object_field("limitType", static_cast<const BaseObject *>(limit_type_.get()));
    s.store_class_end();
  }
}

getPremiumLimit::ReturnType getPremiumLimit::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return premiumLimit::fetch(env, p);
}

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

jclass getSearchedForTags::Class;
jfieldID getSearchedForTags::tag_prefix_fieldID;
jfieldID getSearchedForTags::limit_fieldID;

getSearchedForTags::getSearchedForTags()
  : tag_prefix_()
  , limit_()
{}

getSearchedForTags::getSearchedForTags(string const &tag_prefix_, int32 limit_)
  : tag_prefix_(tag_prefix_)
  , limit_(limit_)
{}

const std::int32_t getSearchedForTags::ID;

object_ptr<getSearchedForTags> getSearchedForTags::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getSearchedForTags> res = make_object<getSearchedForTags>();
  res->tag_prefix_ = jni::fetch_string(env, p, res->tag_prefix_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getSearchedForTags::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSearchedForTags");
    s.store_field("tagPrefix", tag_prefix_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getSearchedForTags::ReturnType getSearchedForTags::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return hashtags::fetch(env, p);
}

void getSearchedForTags::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetSearchedForTags").c_str());
    tag_prefix_fieldID = jni::get_field_id(env, Class, "tagPrefix", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getThemedChatEmojiStatuses::Class;

getThemedChatEmojiStatuses::getThemedChatEmojiStatuses() {
}

const std::int32_t getThemedChatEmojiStatuses::ID;

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

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

getThemedChatEmojiStatuses::ReturnType getThemedChatEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatusCustomEmojis::fetch(env, p);
}

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

jclass getThemedEmojiStatuses::Class;

getThemedEmojiStatuses::getThemedEmojiStatuses() {
}

const std::int32_t getThemedEmojiStatuses::ID;

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

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

getThemedEmojiStatuses::ReturnType getThemedEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatusCustomEmojis::fetch(env, p);
}

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

jclass getTonTransactions::Class;
jfieldID getTonTransactions::direction_fieldID;
jfieldID getTonTransactions::offset_fieldID;
jfieldID getTonTransactions::limit_fieldID;

getTonTransactions::getTonTransactions()
  : direction_()
  , offset_()
  , limit_()
{}

getTonTransactions::getTonTransactions(object_ptr<TransactionDirection> &&direction_, string const &offset_, int32 limit_)
  : direction_(std::move(direction_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getTonTransactions::ID;

object_ptr<getTonTransactions> getTonTransactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getTonTransactions> res = make_object<getTonTransactions>();
  res->direction_ = jni::fetch_tl_object<TransactionDirection>(env, jni::fetch_object(env, p, res->direction_fieldID));
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getTonTransactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetTonTransactions");
    s.store_object_field("direction", static_cast<const BaseObject *>(direction_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getTonTransactions::ReturnType getTonTransactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return tonTransactions::fetch(env, p);
}

void getTonTransactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetTonTransactions").c_str());
    direction_fieldID = jni::get_field_id(env, Class, "direction", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TransactionDirection;").c_str());
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getUserFullInfo::Class;
jfieldID getUserFullInfo::user_id_fieldID;

getUserFullInfo::getUserFullInfo()
  : user_id_()
{}

getUserFullInfo::getUserFullInfo(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t getUserFullInfo::ID;

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

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

getUserFullInfo::ReturnType getUserFullInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return userFullInfo::fetch(env, p);
}

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

jclass getUserSupportInfo::Class;
jfieldID getUserSupportInfo::user_id_fieldID;

getUserSupportInfo::getUserSupportInfo()
  : user_id_()
{}

getUserSupportInfo::getUserSupportInfo(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t getUserSupportInfo::ID;

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

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

getUserSupportInfo::ReturnType getUserSupportInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return userSupportInfo::fetch(env, p);
}

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

jclass getVideoChatRtmpUrl::Class;
jfieldID getVideoChatRtmpUrl::chat_id_fieldID;

getVideoChatRtmpUrl::getVideoChatRtmpUrl()
  : chat_id_()
{}

getVideoChatRtmpUrl::getVideoChatRtmpUrl(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getVideoChatRtmpUrl::ID;

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

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

getVideoChatRtmpUrl::ReturnType getVideoChatRtmpUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return rtmpUrl::fetch(env, p);
}

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

jclass processChatJoinRequest::Class;
jfieldID processChatJoinRequest::chat_id_fieldID;
jfieldID processChatJoinRequest::user_id_fieldID;
jfieldID processChatJoinRequest::approve_fieldID;

processChatJoinRequest::processChatJoinRequest()
  : chat_id_()
  , user_id_()
  , approve_()
{}

processChatJoinRequest::processChatJoinRequest(int53 chat_id_, int53 user_id_, bool approve_)
  : chat_id_(chat_id_)
  , user_id_(user_id_)
  , approve_(approve_)
{}

const std::int32_t processChatJoinRequest::ID;

object_ptr<processChatJoinRequest> processChatJoinRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<processChatJoinRequest> res = make_object<processChatJoinRequest>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->approve_ = (env->GetBooleanField(p, res->approve_fieldID) != 0);
  return res;
}

void processChatJoinRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProcessChatJoinRequest");
    s.store_field("chatId", chat_id_);
    s.store_field("userId", user_id_);
    s.store_field("approve", approve_);
    s.store_class_end();
  }
}

processChatJoinRequest::ReturnType processChatJoinRequest::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass rateSpeechRecognition::Class;
jfieldID rateSpeechRecognition::chat_id_fieldID;
jfieldID rateSpeechRecognition::message_id_fieldID;
jfieldID rateSpeechRecognition::is_good_fieldID;

rateSpeechRecognition::rateSpeechRecognition()
  : chat_id_()
  , message_id_()
  , is_good_()
{}

rateSpeechRecognition::rateSpeechRecognition(int53 chat_id_, int53 message_id_, bool is_good_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , is_good_(is_good_)
{}

const std::int32_t rateSpeechRecognition::ID;

object_ptr<rateSpeechRecognition> rateSpeechRecognition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<rateSpeechRecognition> res = make_object<rateSpeechRecognition>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_good_ = (env->GetBooleanField(p, res->is_good_fieldID) != 0);
  return res;
}

void rateSpeechRecognition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RateSpeechRecognition");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("isGood", is_good_);
    s.store_class_end();
  }
}

rateSpeechRecognition::ReturnType rateSpeechRecognition::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass readAllChatReactions::Class;
jfieldID readAllChatReactions::chat_id_fieldID;

readAllChatReactions::readAllChatReactions()
  : chat_id_()
{}

readAllChatReactions::readAllChatReactions(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t readAllChatReactions::ID;

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

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

readAllChatReactions::ReturnType readAllChatReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass readBusinessMessage::Class;
jfieldID readBusinessMessage::business_connection_id_fieldID;
jfieldID readBusinessMessage::chat_id_fieldID;
jfieldID readBusinessMessage::message_id_fieldID;

readBusinessMessage::readBusinessMessage()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
{}

readBusinessMessage::readBusinessMessage(string const &business_connection_id_, int53 chat_id_, int53 message_id_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
{}

const std::int32_t readBusinessMessage::ID;

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

void readBusinessMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReadBusinessMessage");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_class_end();
  }
}

readBusinessMessage::ReturnType readBusinessMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass readChatList::Class;
jfieldID readChatList::chat_list_fieldID;

readChatList::readChatList()
  : chat_list_()
{}

readChatList::readChatList(object_ptr<ChatList> &&chat_list_)
  : chat_list_(std::move(chat_list_))
{}

const std::int32_t readChatList::ID;

object_ptr<readChatList> readChatList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<readChatList> res = make_object<readChatList>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  return res;
}

void readChatList::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReadChatList");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_class_end();
  }
}

readChatList::ReturnType readChatList::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void readChatList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReadChatList").c_str());
    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 recoverAuthenticationPassword::Class;
jfieldID recoverAuthenticationPassword::recovery_code_fieldID;
jfieldID recoverAuthenticationPassword::new_password_fieldID;
jfieldID recoverAuthenticationPassword::new_hint_fieldID;

recoverAuthenticationPassword::recoverAuthenticationPassword()
  : recovery_code_()
  , new_password_()
  , new_hint_()
{}

recoverAuthenticationPassword::recoverAuthenticationPassword(string const &recovery_code_, string const &new_password_, string const &new_hint_)
  : recovery_code_(recovery_code_)
  , new_password_(new_password_)
  , new_hint_(new_hint_)
{}

const std::int32_t recoverAuthenticationPassword::ID;

object_ptr<recoverAuthenticationPassword> recoverAuthenticationPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<recoverAuthenticationPassword> res = make_object<recoverAuthenticationPassword>();
  res->recovery_code_ = jni::fetch_string(env, p, res->recovery_code_fieldID);
  res->new_password_ = jni::fetch_string(env, p, res->new_password_fieldID);
  res->new_hint_ = jni::fetch_string(env, p, res->new_hint_fieldID);
  return res;
}

void recoverAuthenticationPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RecoverAuthenticationPassword");
    s.store_field("recoveryCode", recovery_code_);
    s.store_field("newPassword", new_password_);
    s.store_field("newHint", new_hint_);
    s.store_class_end();
  }
}

recoverAuthenticationPassword::ReturnType recoverAuthenticationPassword::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void recoverAuthenticationPassword::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RecoverAuthenticationPassword").c_str());
    recovery_code_fieldID = jni::get_field_id(env, Class, "recoveryCode", "Ljava/lang/String;");
    new_password_fieldID = jni::get_field_id(env, Class, "newPassword", "Ljava/lang/String;");
    new_hint_fieldID = jni::get_field_id(env, Class, "newHint", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass removeFileFromDownloads::Class;
jfieldID removeFileFromDownloads::file_id_fieldID;
jfieldID removeFileFromDownloads::delete_from_cache_fieldID;

removeFileFromDownloads::removeFileFromDownloads()
  : file_id_()
  , delete_from_cache_()
{}

removeFileFromDownloads::removeFileFromDownloads(int32 file_id_, bool delete_from_cache_)
  : file_id_(file_id_)
  , delete_from_cache_(delete_from_cache_)
{}

const std::int32_t removeFileFromDownloads::ID;

object_ptr<removeFileFromDownloads> removeFileFromDownloads::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeFileFromDownloads> res = make_object<removeFileFromDownloads>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->delete_from_cache_ = (env->GetBooleanField(p, res->delete_from_cache_fieldID) != 0);
  return res;
}

void removeFileFromDownloads::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveFileFromDownloads");
    s.store_field("fileId", file_id_);
    s.store_field("deleteFromCache", delete_from_cache_);
    s.store_class_end();
  }
}

removeFileFromDownloads::ReturnType removeFileFromDownloads::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void removeFileFromDownloads::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveFileFromDownloads").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    delete_from_cache_fieldID = jni::get_field_id(env, Class, "deleteFromCache", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass replaceLiveStoryRtmpUrl::Class;
jfieldID replaceLiveStoryRtmpUrl::chat_id_fieldID;

replaceLiveStoryRtmpUrl::replaceLiveStoryRtmpUrl()
  : chat_id_()
{}

replaceLiveStoryRtmpUrl::replaceLiveStoryRtmpUrl(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t replaceLiveStoryRtmpUrl::ID;

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

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

replaceLiveStoryRtmpUrl::ReturnType replaceLiveStoryRtmpUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return rtmpUrl::fetch(env, p);
}

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

jclass reportVideoMessageAdvertisement::Class;
jfieldID reportVideoMessageAdvertisement::advertisement_unique_id_fieldID;
jfieldID reportVideoMessageAdvertisement::option_id_fieldID;

reportVideoMessageAdvertisement::reportVideoMessageAdvertisement()
  : advertisement_unique_id_()
  , option_id_()
{}

reportVideoMessageAdvertisement::reportVideoMessageAdvertisement(int53 advertisement_unique_id_, bytes const &option_id_)
  : advertisement_unique_id_(advertisement_unique_id_)
  , option_id_(std::move(option_id_))
{}

const std::int32_t reportVideoMessageAdvertisement::ID;

object_ptr<reportVideoMessageAdvertisement> reportVideoMessageAdvertisement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportVideoMessageAdvertisement> res = make_object<reportVideoMessageAdvertisement>();
  res->advertisement_unique_id_ = env->GetLongField(p, res->advertisement_unique_id_fieldID);
  res->option_id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->option_id_fieldID));
  return res;
}

void reportVideoMessageAdvertisement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportVideoMessageAdvertisement");
    s.store_field("advertisementUniqueId", advertisement_unique_id_);
    s.store_bytes_field("optionId", option_id_);
    s.store_class_end();
  }
}

reportVideoMessageAdvertisement::ReturnType reportVideoMessageAdvertisement::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ReportSponsoredResult::fetch(env, p);
}

void reportVideoMessageAdvertisement::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportVideoMessageAdvertisement").c_str());
    advertisement_unique_id_fieldID = jni::get_field_id(env, Class, "advertisementUniqueId", "J");
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass requestAuthenticationPasswordRecovery::Class;

requestAuthenticationPasswordRecovery::requestAuthenticationPasswordRecovery() {
}

const std::int32_t requestAuthenticationPasswordRecovery::ID;

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

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

requestAuthenticationPasswordRecovery::ReturnType requestAuthenticationPasswordRecovery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass resetNetworkStatistics::Class;

resetNetworkStatistics::resetNetworkStatistics() {
}

const std::int32_t resetNetworkStatistics::ID;

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

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

resetNetworkStatistics::ReturnType resetNetworkStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass searchChats::Class;
jfieldID searchChats::query_fieldID;
jfieldID searchChats::limit_fieldID;

searchChats::searchChats()
  : query_()
  , limit_()
{}

searchChats::searchChats(string const &query_, int32 limit_)
  : query_(query_)
  , limit_(limit_)
{}

const std::int32_t searchChats::ID;

object_ptr<searchChats> searchChats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchChats> res = make_object<searchChats>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchChats");
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchChats::ReturnType searchChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

void searchChats::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchChats").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchContacts::Class;
jfieldID searchContacts::query_fieldID;
jfieldID searchContacts::limit_fieldID;

searchContacts::searchContacts()
  : query_()
  , limit_()
{}

searchContacts::searchContacts(string const &query_, int32 limit_)
  : query_(query_)
  , limit_(limit_)
{}

const std::int32_t searchContacts::ID;

object_ptr<searchContacts> searchContacts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchContacts> res = make_object<searchContacts>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchContacts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchContacts");
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchContacts::ReturnType searchContacts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return users::fetch(env, p);
}

void searchContacts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchContacts").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchInstalledStickerSets::Class;
jfieldID searchInstalledStickerSets::sticker_type_fieldID;
jfieldID searchInstalledStickerSets::query_fieldID;
jfieldID searchInstalledStickerSets::limit_fieldID;

searchInstalledStickerSets::searchInstalledStickerSets()
  : sticker_type_()
  , query_()
  , limit_()
{}

searchInstalledStickerSets::searchInstalledStickerSets(object_ptr<StickerType> &&sticker_type_, string const &query_, int32 limit_)
  : sticker_type_(std::move(sticker_type_))
  , query_(query_)
  , limit_(limit_)
{}

const std::int32_t searchInstalledStickerSets::ID;

object_ptr<searchInstalledStickerSets> searchInstalledStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchInstalledStickerSets> res = make_object<searchInstalledStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchInstalledStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchInstalledStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchInstalledStickerSets::ReturnType searchInstalledStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSets::fetch(env, p);
}

void searchInstalledStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchInstalledStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchPublicStoriesByVenue::Class;
jfieldID searchPublicStoriesByVenue::venue_provider_fieldID;
jfieldID searchPublicStoriesByVenue::venue_id_fieldID;
jfieldID searchPublicStoriesByVenue::offset_fieldID;
jfieldID searchPublicStoriesByVenue::limit_fieldID;

searchPublicStoriesByVenue::searchPublicStoriesByVenue()
  : venue_provider_()
  , venue_id_()
  , offset_()
  , limit_()
{}

searchPublicStoriesByVenue::searchPublicStoriesByVenue(string const &venue_provider_, string const &venue_id_, string const &offset_, int32 limit_)
  : venue_provider_(venue_provider_)
  , venue_id_(venue_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchPublicStoriesByVenue::ID;

object_ptr<searchPublicStoriesByVenue> searchPublicStoriesByVenue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchPublicStoriesByVenue> res = make_object<searchPublicStoriesByVenue>();
  res->venue_provider_ = jni::fetch_string(env, p, res->venue_provider_fieldID);
  res->venue_id_ = jni::fetch_string(env, p, res->venue_id_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchPublicStoriesByVenue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchPublicStoriesByVenue");
    s.store_field("venueProvider", venue_provider_);
    s.store_field("venueId", venue_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchPublicStoriesByVenue::ReturnType searchPublicStoriesByVenue::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundStories::fetch(env, p);
}

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

sendCallSignalingData::sendCallSignalingData()
  : call_id_()
  , data_()
{}

sendCallSignalingData::sendCallSignalingData(int32 call_id_, bytes const &data_)
  : call_id_(call_id_)
  , data_(std::move(data_))
{}

const std::int32_t sendCallSignalingData::ID;

object_ptr<sendCallSignalingData> sendCallSignalingData::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendCallSignalingData> res = make_object<sendCallSignalingData>();
  res->call_id_ = env->GetIntField(p, res->call_id_fieldID);
  res->data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_fieldID));
  return res;
}

void sendCallSignalingData::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendCallSignalingData");
    s.store_field("callId", call_id_);
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

sendCallSignalingData::ReturnType sendCallSignalingData::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass sendInlineQueryResultMessage::Class;
jfieldID sendInlineQueryResultMessage::chat_id_fieldID;
jfieldID sendInlineQueryResultMessage::topic_id_fieldID;
jfieldID sendInlineQueryResultMessage::reply_to_fieldID;
jfieldID sendInlineQueryResultMessage::options_fieldID;
jfieldID sendInlineQueryResultMessage::query_id_fieldID;
jfieldID sendInlineQueryResultMessage::result_id_fieldID;
jfieldID sendInlineQueryResultMessage::hide_via_bot_fieldID;

sendInlineQueryResultMessage::sendInlineQueryResultMessage()
  : chat_id_()
  , topic_id_()
  , reply_to_()
  , options_()
  , query_id_()
  , result_id_()
  , hide_via_bot_()
{}

sendInlineQueryResultMessage::sendInlineQueryResultMessage(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, object_ptr<InputMessageReplyTo> &&reply_to_, object_ptr<messageSendOptions> &&options_, int64 query_id_, string const &result_id_, bool hide_via_bot_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , reply_to_(std::move(reply_to_))
  , options_(std::move(options_))
  , query_id_(query_id_)
  , result_id_(result_id_)
  , hide_via_bot_(hide_via_bot_)
{}

const std::int32_t sendInlineQueryResultMessage::ID;

object_ptr<sendInlineQueryResultMessage> sendInlineQueryResultMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendInlineQueryResultMessage> res = make_object<sendInlineQueryResultMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = jni::fetch_tl_object<MessageTopic>(env, jni::fetch_object(env, p, res->topic_id_fieldID));
  res->reply_to_ = jni::fetch_tl_object<InputMessageReplyTo>(env, jni::fetch_object(env, p, res->reply_to_fieldID));
  res->options_ = jni::fetch_tl_object<messageSendOptions>(env, jni::fetch_object(env, p, res->options_fieldID));
  res->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 sendInlineQueryResultMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendInlineQueryResultMessage");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_object_field("replyTo", static_cast<const BaseObject *>(reply_to_.get()));
    s.store_object_field("options", static_cast<const BaseObject *>(options_.get()));
    s.store_field("queryId", query_id_);
    s.store_field("resultId", result_id_);
    s.store_field("hideViaBot", hide_via_bot_);
    s.store_class_end();
  }
}

sendInlineQueryResultMessage::ReturnType sendInlineQueryResultMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void sendInlineQueryResultMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendInlineQueryResultMessage").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageTopic;").c_str());
    reply_to_fieldID = jni::get_field_id(env, Class, "replyTo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageReplyTo;").c_str());
    options_fieldID = jni::get_field_id(env, Class, "options", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSendOptions;").c_str());
    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 sendPaymentForm::Class;
jfieldID sendPaymentForm::input_invoice_fieldID;
jfieldID sendPaymentForm::payment_form_id_fieldID;
jfieldID sendPaymentForm::order_info_id_fieldID;
jfieldID sendPaymentForm::shipping_option_id_fieldID;
jfieldID sendPaymentForm::credentials_fieldID;
jfieldID sendPaymentForm::tip_amount_fieldID;

sendPaymentForm::sendPaymentForm()
  : input_invoice_()
  , payment_form_id_()
  , order_info_id_()
  , shipping_option_id_()
  , credentials_()
  , tip_amount_()
{}

sendPaymentForm::sendPaymentForm(object_ptr<InputInvoice> &&input_invoice_, int64 payment_form_id_, string const &order_info_id_, string const &shipping_option_id_, object_ptr<InputCredentials> &&credentials_, int53 tip_amount_)
  : input_invoice_(std::move(input_invoice_))
  , payment_form_id_(payment_form_id_)
  , order_info_id_(order_info_id_)
  , shipping_option_id_(shipping_option_id_)
  , credentials_(std::move(credentials_))
  , tip_amount_(tip_amount_)
{}

const std::int32_t sendPaymentForm::ID;

object_ptr<sendPaymentForm> sendPaymentForm::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendPaymentForm> res = make_object<sendPaymentForm>();
  res->input_invoice_ = jni::fetch_tl_object<InputInvoice>(env, jni::fetch_object(env, p, res->input_invoice_fieldID));
  res->payment_form_id_ = env->GetLongField(p, res->payment_form_id_fieldID);
  res->order_info_id_ = jni::fetch_string(env, p, res->order_info_id_fieldID);
  res->shipping_option_id_ = jni::fetch_string(env, p, res->shipping_option_id_fieldID);
  res->credentials_ = jni::fetch_tl_object<InputCredentials>(env, jni::fetch_object(env, p, res->credentials_fieldID));
  res->tip_amount_ = env->GetLongField(p, res->tip_amount_fieldID);
  return res;
}

void sendPaymentForm::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendPaymentForm");
    s.store_object_field("inputInvoice", static_cast<const BaseObject *>(input_invoice_.get()));
    s.store_field("paymentFormId", payment_form_id_);
    s.store_field("orderInfoId", order_info_id_);
    s.store_field("shippingOptionId", shipping_option_id_);
    s.store_object_field("credentials", static_cast<const BaseObject *>(credentials_.get()));
    s.store_field("tipAmount", tip_amount_);
    s.store_class_end();
  }
}

sendPaymentForm::ReturnType sendPaymentForm::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return paymentResult::fetch(env, p);
}

void sendPaymentForm::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendPaymentForm").c_str());
    input_invoice_fieldID = jni::get_field_id(env, Class, "inputInvoice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputInvoice;").c_str());
    payment_form_id_fieldID = jni::get_field_id(env, Class, "paymentFormId", "J");
    order_info_id_fieldID = jni::get_field_id(env, Class, "orderInfoId", "Ljava/lang/String;");
    shipping_option_id_fieldID = jni::get_field_id(env, Class, "shippingOptionId", "Ljava/lang/String;");
    credentials_fieldID = jni::get_field_id(env, Class, "credentials", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputCredentials;").c_str());
    tip_amount_fieldID = jni::get_field_id(env, Class, "tipAmount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessAccountGiftSettings::Class;
jfieldID setBusinessAccountGiftSettings::business_connection_id_fieldID;
jfieldID setBusinessAccountGiftSettings::settings_fieldID;

setBusinessAccountGiftSettings::setBusinessAccountGiftSettings()
  : business_connection_id_()
  , settings_()
{}

setBusinessAccountGiftSettings::setBusinessAccountGiftSettings(string const &business_connection_id_, object_ptr<giftSettings> &&settings_)
  : business_connection_id_(business_connection_id_)
  , settings_(std::move(settings_))
{}

const std::int32_t setBusinessAccountGiftSettings::ID;

object_ptr<setBusinessAccountGiftSettings> setBusinessAccountGiftSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessAccountGiftSettings> res = make_object<setBusinessAccountGiftSettings>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->settings_ = jni::fetch_tl_object<giftSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

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

setBusinessAccountGiftSettings::ReturnType setBusinessAccountGiftSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBusinessAccountGiftSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBusinessAccountGiftSettings").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    settings_fieldID = jni::get_field_id(env, Class, "settings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessGreetingMessageSettings::Class;
jfieldID setBusinessGreetingMessageSettings::greeting_message_settings_fieldID;

setBusinessGreetingMessageSettings::setBusinessGreetingMessageSettings()
  : greeting_message_settings_()
{}

setBusinessGreetingMessageSettings::setBusinessGreetingMessageSettings(object_ptr<businessGreetingMessageSettings> &&greeting_message_settings_)
  : greeting_message_settings_(std::move(greeting_message_settings_))
{}

const std::int32_t setBusinessGreetingMessageSettings::ID;

object_ptr<setBusinessGreetingMessageSettings> setBusinessGreetingMessageSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessGreetingMessageSettings> res = make_object<setBusinessGreetingMessageSettings>();
  res->greeting_message_settings_ = jni::fetch_tl_object<businessGreetingMessageSettings>(env, jni::fetch_object(env, p, res->greeting_message_settings_fieldID));
  return res;
}

void setBusinessGreetingMessageSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessGreetingMessageSettings");
    s.store_object_field("greetingMessageSettings", static_cast<const BaseObject *>(greeting_message_settings_.get()));
    s.store_class_end();
  }
}

setBusinessGreetingMessageSettings::ReturnType setBusinessGreetingMessageSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBusinessLocation::Class;
jfieldID setBusinessLocation::location_fieldID;

setBusinessLocation::setBusinessLocation()
  : location_()
{}

setBusinessLocation::setBusinessLocation(object_ptr<businessLocation> &&location_)
  : location_(std::move(location_))
{}

const std::int32_t setBusinessLocation::ID;

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

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

setBusinessLocation::ReturnType setBusinessLocation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatBackground::Class;
jfieldID setChatBackground::chat_id_fieldID;
jfieldID setChatBackground::background_fieldID;
jfieldID setChatBackground::type_fieldID;
jfieldID setChatBackground::dark_theme_dimming_fieldID;
jfieldID setChatBackground::only_for_self_fieldID;

setChatBackground::setChatBackground()
  : chat_id_()
  , background_()
  , type_()
  , dark_theme_dimming_()
  , only_for_self_()
{}

setChatBackground::setChatBackground(int53 chat_id_, object_ptr<InputBackground> &&background_, object_ptr<BackgroundType> &&type_, int32 dark_theme_dimming_, bool only_for_self_)
  : chat_id_(chat_id_)
  , background_(std::move(background_))
  , type_(std::move(type_))
  , dark_theme_dimming_(dark_theme_dimming_)
  , only_for_self_(only_for_self_)
{}

const std::int32_t setChatBackground::ID;

object_ptr<setChatBackground> setChatBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatBackground> res = make_object<setChatBackground>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->background_ = jni::fetch_tl_object<InputBackground>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->type_ = jni::fetch_tl_object<BackgroundType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->dark_theme_dimming_ = env->GetIntField(p, res->dark_theme_dimming_fieldID);
  res->only_for_self_ = (env->GetBooleanField(p, res->only_for_self_fieldID) != 0);
  return res;
}

void setChatBackground::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatBackground");
    s.store_field("chatId", chat_id_);
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("darkThemeDimming", dark_theme_dimming_);
    s.store_field("onlyForSelf", only_for_self_);
    s.store_class_end();
  }
}

setChatBackground::ReturnType setChatBackground::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatBackground::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatBackground").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputBackground;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BackgroundType;").c_str());
    dark_theme_dimming_fieldID = jni::get_field_id(env, Class, "darkThemeDimming", "I");
    only_for_self_fieldID = jni::get_field_id(env, Class, "onlyForSelf", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setChatMessageAutoDeleteTime::Class;
jfieldID setChatMessageAutoDeleteTime::chat_id_fieldID;
jfieldID setChatMessageAutoDeleteTime::message_auto_delete_time_fieldID;

setChatMessageAutoDeleteTime::setChatMessageAutoDeleteTime()
  : chat_id_()
  , message_auto_delete_time_()
{}

setChatMessageAutoDeleteTime::setChatMessageAutoDeleteTime(int53 chat_id_, int32 message_auto_delete_time_)
  : chat_id_(chat_id_)
  , message_auto_delete_time_(message_auto_delete_time_)
{}

const std::int32_t setChatMessageAutoDeleteTime::ID;

object_ptr<setChatMessageAutoDeleteTime> setChatMessageAutoDeleteTime::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatMessageAutoDeleteTime> res = make_object<setChatMessageAutoDeleteTime>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_auto_delete_time_ = env->GetIntField(p, res->message_auto_delete_time_fieldID);
  return res;
}

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

setChatMessageAutoDeleteTime::ReturnType setChatMessageAutoDeleteTime::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatPermissions::Class;
jfieldID setChatPermissions::chat_id_fieldID;
jfieldID setChatPermissions::permissions_fieldID;

setChatPermissions::setChatPermissions()
  : chat_id_()
  , permissions_()
{}

setChatPermissions::setChatPermissions(int53 chat_id_, object_ptr<chatPermissions> &&permissions_)
  : chat_id_(chat_id_)
  , permissions_(std::move(permissions_))
{}

const std::int32_t setChatPermissions::ID;

object_ptr<setChatPermissions> setChatPermissions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatPermissions> res = make_object<setChatPermissions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->permissions_ = jni::fetch_tl_object<chatPermissions>(env, jni::fetch_object(env, p, res->permissions_fieldID));
  return res;
}

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

setChatPermissions::ReturnType setChatPermissions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatTheme::Class;
jfieldID setChatTheme::chat_id_fieldID;
jfieldID setChatTheme::theme_fieldID;

setChatTheme::setChatTheme()
  : chat_id_()
  , theme_()
{}

setChatTheme::setChatTheme(int53 chat_id_, object_ptr<InputChatTheme> &&theme_)
  : chat_id_(chat_id_)
  , theme_(std::move(theme_))
{}

const std::int32_t setChatTheme::ID;

object_ptr<setChatTheme> setChatTheme::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatTheme> res = make_object<setChatTheme>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->theme_ = jni::fetch_tl_object<InputChatTheme>(env, jni::fetch_object(env, p, res->theme_fieldID));
  return res;
}

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

setChatTheme::ReturnType setChatTheme::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setInactiveSessionTtl::Class;
jfieldID setInactiveSessionTtl::inactive_session_ttl_days_fieldID;

setInactiveSessionTtl::setInactiveSessionTtl()
  : inactive_session_ttl_days_()
{}

setInactiveSessionTtl::setInactiveSessionTtl(int32 inactive_session_ttl_days_)
  : inactive_session_ttl_days_(inactive_session_ttl_days_)
{}

const std::int32_t setInactiveSessionTtl::ID;

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

void setInactiveSessionTtl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetInactiveSessionTtl");
    s.store_field("inactiveSessionTtlDays", inactive_session_ttl_days_);
    s.store_class_end();
  }
}

setInactiveSessionTtl::ReturnType setInactiveSessionTtl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setManagedBotAccessSettings::Class;
jfieldID setManagedBotAccessSettings::bot_user_id_fieldID;
jfieldID setManagedBotAccessSettings::settings_fieldID;

setManagedBotAccessSettings::setManagedBotAccessSettings()
  : bot_user_id_()
  , settings_()
{}

setManagedBotAccessSettings::setManagedBotAccessSettings(int53 bot_user_id_, object_ptr<botAccessSettings> &&settings_)
  : bot_user_id_(bot_user_id_)
  , settings_(std::move(settings_))
{}

const std::int32_t setManagedBotAccessSettings::ID;

object_ptr<setManagedBotAccessSettings> setManagedBotAccessSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setManagedBotAccessSettings> res = make_object<setManagedBotAccessSettings>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->settings_ = jni::fetch_tl_object<botAccessSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

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

setManagedBotAccessSettings::ReturnType setManagedBotAccessSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setPassportElementErrors::Class;
jfieldID setPassportElementErrors::user_id_fieldID;
jfieldID setPassportElementErrors::errors_fieldID;

setPassportElementErrors::setPassportElementErrors()
  : user_id_()
  , errors_()
{}

setPassportElementErrors::setPassportElementErrors(int53 user_id_, array<object_ptr<inputPassportElementError>> &&errors_)
  : user_id_(user_id_)
  , errors_(std::move(errors_))
{}

const std::int32_t setPassportElementErrors::ID;

object_ptr<setPassportElementErrors> setPassportElementErrors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPassportElementErrors> res = make_object<setPassportElementErrors>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->errors_ = jni::FetchVector<inputPassportElementError>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->errors_fieldID));
  return res;
}

void setPassportElementErrors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPassportElementErrors");
    s.store_field("userId", user_id_);
    { s.store_vector_begin("errors", errors_.size()); for (const auto &_value : errors_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

setPassportElementErrors::ReturnType setPassportElementErrors::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setProfileAccentColor::Class;
jfieldID setProfileAccentColor::profile_accent_color_id_fieldID;
jfieldID setProfileAccentColor::profile_background_custom_emoji_id_fieldID;

setProfileAccentColor::setProfileAccentColor()
  : profile_accent_color_id_()
  , profile_background_custom_emoji_id_()
{}

setProfileAccentColor::setProfileAccentColor(int32 profile_accent_color_id_, int64 profile_background_custom_emoji_id_)
  : profile_accent_color_id_(profile_accent_color_id_)
  , profile_background_custom_emoji_id_(profile_background_custom_emoji_id_)
{}

const std::int32_t setProfileAccentColor::ID;

object_ptr<setProfileAccentColor> setProfileAccentColor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setProfileAccentColor> res = make_object<setProfileAccentColor>();
  res->profile_accent_color_id_ = env->GetIntField(p, res->profile_accent_color_id_fieldID);
  res->profile_background_custom_emoji_id_ = env->GetLongField(p, res->profile_background_custom_emoji_id_fieldID);
  return res;
}

void setProfileAccentColor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetProfileAccentColor");
    s.store_field("profileAccentColorId", profile_accent_color_id_);
    s.store_field("profileBackgroundCustomEmojiId", profile_background_custom_emoji_id_);
    s.store_class_end();
  }
}

setProfileAccentColor::ReturnType setProfileAccentColor::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setProfileAccentColor::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetProfileAccentColor").c_str());
    profile_accent_color_id_fieldID = jni::get_field_id(env, Class, "profileAccentColorId", "I");
    profile_background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "profileBackgroundCustomEmojiId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setStickerPositionInSet::Class;
jfieldID setStickerPositionInSet::sticker_fieldID;
jfieldID setStickerPositionInSet::position_fieldID;

setStickerPositionInSet::setStickerPositionInSet()
  : sticker_()
  , position_()
{}

setStickerPositionInSet::setStickerPositionInSet(object_ptr<InputFile> &&sticker_, int32 position_)
  : sticker_(std::move(sticker_))
  , position_(position_)
{}

const std::int32_t setStickerPositionInSet::ID;

object_ptr<setStickerPositionInSet> setStickerPositionInSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setStickerPositionInSet> res = make_object<setStickerPositionInSet>();
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->position_ = env->GetIntField(p, res->position_fieldID);
  return res;
}

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

setStickerPositionInSet::ReturnType setStickerPositionInSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setStickerSetThumbnail::Class;
jfieldID setStickerSetThumbnail::user_id_fieldID;
jfieldID setStickerSetThumbnail::name_fieldID;
jfieldID setStickerSetThumbnail::thumbnail_fieldID;
jfieldID setStickerSetThumbnail::format_fieldID;

setStickerSetThumbnail::setStickerSetThumbnail()
  : user_id_()
  , name_()
  , thumbnail_()
  , format_()
{}

setStickerSetThumbnail::setStickerSetThumbnail(int53 user_id_, string const &name_, object_ptr<InputFile> &&thumbnail_, object_ptr<StickerFormat> &&format_)
  : user_id_(user_id_)
  , name_(name_)
  , thumbnail_(std::move(thumbnail_))
  , format_(std::move(format_))
{}

const std::int32_t setStickerSetThumbnail::ID;

object_ptr<setStickerSetThumbnail> setStickerSetThumbnail::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setStickerSetThumbnail> res = make_object<setStickerSetThumbnail>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->thumbnail_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->format_ = jni::fetch_tl_object<StickerFormat>(env, jni::fetch_object(env, p, res->format_fieldID));
  return res;
}

void setStickerSetThumbnail::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetStickerSetThumbnail");
    s.store_field("userId", user_id_);
    s.store_field("name", name_);
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("format", static_cast<const BaseObject *>(format_.get()));
    s.store_class_end();
  }
}

setStickerSetThumbnail::ReturnType setStickerSetThumbnail::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setStickerSetThumbnail::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetStickerSetThumbnail").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    format_fieldID = jni::get_field_id(env, Class, "format", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerFormat;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setSupergroupStickerSet::Class;
jfieldID setSupergroupStickerSet::supergroup_id_fieldID;
jfieldID setSupergroupStickerSet::sticker_set_id_fieldID;

setSupergroupStickerSet::setSupergroupStickerSet()
  : supergroup_id_()
  , sticker_set_id_()
{}

setSupergroupStickerSet::setSupergroupStickerSet(int53 supergroup_id_, int64 sticker_set_id_)
  : supergroup_id_(supergroup_id_)
  , sticker_set_id_(sticker_set_id_)
{}

const std::int32_t setSupergroupStickerSet::ID;

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

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

setSupergroupStickerSet::ReturnType setSupergroupStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass testCallVectorStringObject::Class;
jfieldID testCallVectorStringObject::x_fieldID;

testCallVectorStringObject::testCallVectorStringObject()
  : x_()
{}

testCallVectorStringObject::testCallVectorStringObject(array<object_ptr<testString>> &&x_)
  : x_(std::move(x_))
{}

const std::int32_t testCallVectorStringObject::ID;

object_ptr<testCallVectorStringObject> testCallVectorStringObject::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testCallVectorStringObject> res = make_object<testCallVectorStringObject>();
  res->x_ = jni::FetchVector<testString>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->x_fieldID));
  return res;
}

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

testCallVectorStringObject::ReturnType testCallVectorStringObject::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testVectorStringObject::fetch(env, p);
}

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

jclass toggleAllDownloadsArePaused::Class;
jfieldID toggleAllDownloadsArePaused::are_paused_fieldID;

toggleAllDownloadsArePaused::toggleAllDownloadsArePaused()
  : are_paused_()
{}

toggleAllDownloadsArePaused::toggleAllDownloadsArePaused(bool are_paused_)
  : are_paused_(are_paused_)
{}

const std::int32_t toggleAllDownloadsArePaused::ID;

object_ptr<toggleAllDownloadsArePaused> toggleAllDownloadsArePaused::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleAllDownloadsArePaused> res = make_object<toggleAllDownloadsArePaused>();
  res->are_paused_ = (env->GetBooleanField(p, res->are_paused_fieldID) != 0);
  return res;
}

void toggleAllDownloadsArePaused::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleAllDownloadsArePaused");
    s.store_field("arePaused", are_paused_);
    s.store_class_end();
  }
}

toggleAllDownloadsArePaused::ReturnType toggleAllDownloadsArePaused::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleBotUsernameIsActive::Class;
jfieldID toggleBotUsernameIsActive::bot_user_id_fieldID;
jfieldID toggleBotUsernameIsActive::username_fieldID;
jfieldID toggleBotUsernameIsActive::is_active_fieldID;

toggleBotUsernameIsActive::toggleBotUsernameIsActive()
  : bot_user_id_()
  , username_()
  , is_active_()
{}

toggleBotUsernameIsActive::toggleBotUsernameIsActive(int53 bot_user_id_, string const &username_, bool is_active_)
  : bot_user_id_(bot_user_id_)
  , username_(username_)
  , is_active_(is_active_)
{}

const std::int32_t toggleBotUsernameIsActive::ID;

object_ptr<toggleBotUsernameIsActive> toggleBotUsernameIsActive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleBotUsernameIsActive> res = make_object<toggleBotUsernameIsActive>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  return res;
}

void toggleBotUsernameIsActive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleBotUsernameIsActive");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("username", username_);
    s.store_field("isActive", is_active_);
    s.store_class_end();
  }
}

toggleBotUsernameIsActive::ReturnType toggleBotUsernameIsActive::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleBotUsernameIsActive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleBotUsernameIsActive").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    username_fieldID = jni::get_field_id(env, Class, "username", "Ljava/lang/String;");
    is_active_fieldID = jni::get_field_id(env, Class, "isActive", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleChatFolderTags::Class;
jfieldID toggleChatFolderTags::are_tags_enabled_fieldID;

toggleChatFolderTags::toggleChatFolderTags()
  : are_tags_enabled_()
{}

toggleChatFolderTags::toggleChatFolderTags(bool are_tags_enabled_)
  : are_tags_enabled_(are_tags_enabled_)
{}

const std::int32_t toggleChatFolderTags::ID;

object_ptr<toggleChatFolderTags> toggleChatFolderTags::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatFolderTags> res = make_object<toggleChatFolderTags>();
  res->are_tags_enabled_ = (env->GetBooleanField(p, res->are_tags_enabled_fieldID) != 0);
  return res;
}

void toggleChatFolderTags::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleChatFolderTags");
    s.store_field("areTagsEnabled", are_tags_enabled_);
    s.store_class_end();
  }
}

toggleChatFolderTags::ReturnType toggleChatFolderTags::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleGroupCallIsMyVideoEnabled::Class;
jfieldID toggleGroupCallIsMyVideoEnabled::group_call_id_fieldID;
jfieldID toggleGroupCallIsMyVideoEnabled::is_my_video_enabled_fieldID;

toggleGroupCallIsMyVideoEnabled::toggleGroupCallIsMyVideoEnabled()
  : group_call_id_()
  , is_my_video_enabled_()
{}

toggleGroupCallIsMyVideoEnabled::toggleGroupCallIsMyVideoEnabled(int32 group_call_id_, bool is_my_video_enabled_)
  : group_call_id_(group_call_id_)
  , is_my_video_enabled_(is_my_video_enabled_)
{}

const std::int32_t toggleGroupCallIsMyVideoEnabled::ID;

object_ptr<toggleGroupCallIsMyVideoEnabled> toggleGroupCallIsMyVideoEnabled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGroupCallIsMyVideoEnabled> res = make_object<toggleGroupCallIsMyVideoEnabled>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->is_my_video_enabled_ = (env->GetBooleanField(p, res->is_my_video_enabled_fieldID) != 0);
  return res;
}

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

toggleGroupCallIsMyVideoEnabled::ReturnType toggleGroupCallIsMyVideoEnabled::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSessionCanAcceptCalls::Class;
jfieldID toggleSessionCanAcceptCalls::session_id_fieldID;
jfieldID toggleSessionCanAcceptCalls::can_accept_calls_fieldID;

toggleSessionCanAcceptCalls::toggleSessionCanAcceptCalls()
  : session_id_()
  , can_accept_calls_()
{}

toggleSessionCanAcceptCalls::toggleSessionCanAcceptCalls(int64 session_id_, bool can_accept_calls_)
  : session_id_(session_id_)
  , can_accept_calls_(can_accept_calls_)
{}

const std::int32_t toggleSessionCanAcceptCalls::ID;

object_ptr<toggleSessionCanAcceptCalls> toggleSessionCanAcceptCalls::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSessionCanAcceptCalls> res = make_object<toggleSessionCanAcceptCalls>();
  res->session_id_ = env->GetLongField(p, res->session_id_fieldID);
  res->can_accept_calls_ = (env->GetBooleanField(p, res->can_accept_calls_fieldID) != 0);
  return res;
}

void toggleSessionCanAcceptCalls::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSessionCanAcceptCalls");
    s.store_field("sessionId", session_id_);
    s.store_field("canAcceptCalls", can_accept_calls_);
    s.store_class_end();
  }
}

toggleSessionCanAcceptCalls::ReturnType toggleSessionCanAcceptCalls::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleSessionCanAcceptCalls::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleSessionCanAcceptCalls").c_str());
    session_id_fieldID = jni::get_field_id(env, Class, "sessionId", "J");
    can_accept_calls_fieldID = jni::get_field_id(env, Class, "canAcceptCalls", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleUsernameIsActive::Class;
jfieldID toggleUsernameIsActive::username_fieldID;
jfieldID toggleUsernameIsActive::is_active_fieldID;

toggleUsernameIsActive::toggleUsernameIsActive()
  : username_()
  , is_active_()
{}

toggleUsernameIsActive::toggleUsernameIsActive(string const &username_, bool is_active_)
  : username_(username_)
  , is_active_(is_active_)
{}

const std::int32_t toggleUsernameIsActive::ID;

object_ptr<toggleUsernameIsActive> toggleUsernameIsActive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleUsernameIsActive> res = make_object<toggleUsernameIsActive>();
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  return res;
}

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

toggleUsernameIsActive::ReturnType toggleUsernameIsActive::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleVideoChatMuteNewParticipants::Class;
jfieldID toggleVideoChatMuteNewParticipants::group_call_id_fieldID;
jfieldID toggleVideoChatMuteNewParticipants::mute_new_participants_fieldID;

toggleVideoChatMuteNewParticipants::toggleVideoChatMuteNewParticipants()
  : group_call_id_()
  , mute_new_participants_()
{}

toggleVideoChatMuteNewParticipants::toggleVideoChatMuteNewParticipants(int32 group_call_id_, bool mute_new_participants_)
  : group_call_id_(group_call_id_)
  , mute_new_participants_(mute_new_participants_)
{}

const std::int32_t toggleVideoChatMuteNewParticipants::ID;

object_ptr<toggleVideoChatMuteNewParticipants> toggleVideoChatMuteNewParticipants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleVideoChatMuteNewParticipants> res = make_object<toggleVideoChatMuteNewParticipants>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->mute_new_participants_ = (env->GetBooleanField(p, res->mute_new_participants_fieldID) != 0);
  return res;
}

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

toggleVideoChatMuteNewParticipants::ReturnType toggleVideoChatMuteNewParticipants::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass transferChatOwnership::Class;
jfieldID transferChatOwnership::chat_id_fieldID;
jfieldID transferChatOwnership::user_id_fieldID;
jfieldID transferChatOwnership::password_fieldID;

transferChatOwnership::transferChatOwnership()
  : chat_id_()
  , user_id_()
  , password_()
{}

transferChatOwnership::transferChatOwnership(int53 chat_id_, int53 user_id_, string const &password_)
  : chat_id_(chat_id_)
  , user_id_(user_id_)
  , password_(password_)
{}

const std::int32_t transferChatOwnership::ID;

object_ptr<transferChatOwnership> transferChatOwnership::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<transferChatOwnership> res = make_object<transferChatOwnership>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void transferChatOwnership::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TransferChatOwnership");
    s.store_field("chatId", chat_id_);
    s.store_field("userId", user_id_);
    s.store_field("password", password_);
    s.store_class_end();
  }
}

transferChatOwnership::ReturnType transferChatOwnership::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass transferGift::Class;
jfieldID transferGift::business_connection_id_fieldID;
jfieldID transferGift::received_gift_id_fieldID;
jfieldID transferGift::new_owner_id_fieldID;
jfieldID transferGift::star_count_fieldID;

transferGift::transferGift()
  : business_connection_id_()
  , received_gift_id_()
  , new_owner_id_()
  , star_count_()
{}

transferGift::transferGift(string const &business_connection_id_, string const &received_gift_id_, object_ptr<MessageSender> &&new_owner_id_, int53 star_count_)
  : business_connection_id_(business_connection_id_)
  , received_gift_id_(received_gift_id_)
  , new_owner_id_(std::move(new_owner_id_))
  , star_count_(star_count_)
{}

const std::int32_t transferGift::ID;

object_ptr<transferGift> transferGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<transferGift> res = make_object<transferGift>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->new_owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->new_owner_id_fieldID));
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

void transferGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TransferGift");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_object_field("newOwnerId", static_cast<const BaseObject *>(new_owner_id_.get()));
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

transferGift::ReturnType transferGift::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void transferGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TransferGift").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    new_owner_id_fieldID = jni::get_field_id(env, Class, "newOwnerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass translateText::Class;
jfieldID translateText::text_fieldID;
jfieldID translateText::to_language_code_fieldID;
jfieldID translateText::tone_fieldID;

translateText::translateText()
  : text_()
  , to_language_code_()
  , tone_()
{}

translateText::translateText(object_ptr<formattedText> &&text_, string const &to_language_code_, string const &tone_)
  : text_(std::move(text_))
  , to_language_code_(to_language_code_)
  , tone_(tone_)
{}

const std::int32_t translateText::ID;

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

void translateText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TranslateText");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("toLanguageCode", to_language_code_);
    s.store_field("tone", tone_);
    s.store_class_end();
  }
}

translateText::ReturnType translateText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

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

jclass upgradeGift::Class;
jfieldID upgradeGift::business_connection_id_fieldID;
jfieldID upgradeGift::received_gift_id_fieldID;
jfieldID upgradeGift::keep_original_details_fieldID;
jfieldID upgradeGift::star_count_fieldID;

upgradeGift::upgradeGift()
  : business_connection_id_()
  , received_gift_id_()
  , keep_original_details_()
  , star_count_()
{}

upgradeGift::upgradeGift(string const &business_connection_id_, string const &received_gift_id_, bool keep_original_details_, int53 star_count_)
  : business_connection_id_(business_connection_id_)
  , received_gift_id_(received_gift_id_)
  , keep_original_details_(keep_original_details_)
  , star_count_(star_count_)
{}

const std::int32_t upgradeGift::ID;

object_ptr<upgradeGift> upgradeGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradeGift> res = make_object<upgradeGift>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->keep_original_details_ = (env->GetBooleanField(p, res->keep_original_details_fieldID) != 0);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

void upgradeGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradeGift");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_field("keepOriginalDetails", keep_original_details_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

upgradeGift::ReturnType upgradeGift::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return upgradeGiftResult::fetch(env, p);
}

void upgradeGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradeGift").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    keep_original_details_fieldID = jni::get_field_id(env, Class, "keepOriginalDetails", "Z");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass writeGeneratedFilePart::Class;
jfieldID writeGeneratedFilePart::generation_id_fieldID;
jfieldID writeGeneratedFilePart::offset_fieldID;
jfieldID writeGeneratedFilePart::data_fieldID;

writeGeneratedFilePart::writeGeneratedFilePart()
  : generation_id_()
  , offset_()
  , data_()
{}

writeGeneratedFilePart::writeGeneratedFilePart(int64 generation_id_, int53 offset_, bytes const &data_)
  : generation_id_(generation_id_)
  , offset_(offset_)
  , data_(std::move(data_))
{}

const std::int32_t writeGeneratedFilePart::ID;

object_ptr<writeGeneratedFilePart> writeGeneratedFilePart::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<writeGeneratedFilePart> res = make_object<writeGeneratedFilePart>();
  res->generation_id_ = env->GetLongField(p, res->generation_id_fieldID);
  res->offset_ = env->GetLongField(p, res->offset_fieldID);
  res->data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_fieldID));
  return res;
}

void writeGeneratedFilePart::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "WriteGeneratedFilePart");
    s.store_field("generationId", generation_id_);
    s.store_field("offset", offset_);
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

writeGeneratedFilePart::ReturnType writeGeneratedFilePart::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void writeGeneratedFilePart::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$WriteGeneratedFilePart").c_str());
    generation_id_fieldID = jni::get_field_id(env, Class, "generationId", "J");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "J");
    data_fieldID = jni::get_field_id(env, Class, "data", "[B");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
