#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 availableGift::Class;
jfieldID availableGift::gift_fieldID;
jfieldID availableGift::resale_count_fieldID;
jfieldID availableGift::min_resale_star_count_fieldID;
jfieldID availableGift::title_fieldID;

availableGift::availableGift()
  : gift_()
  , resale_count_()
  , min_resale_star_count_()
  , title_()
{}

availableGift::availableGift(object_ptr<gift> &&gift_, int32 resale_count_, int53 min_resale_star_count_, string const &title_)
  : gift_(std::move(gift_))
  , resale_count_(resale_count_)
  , min_resale_star_count_(min_resale_star_count_)
  , title_(title_)
{}

const std::int32_t availableGift::ID;

object_ptr<availableGift> availableGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<availableGift> res = make_object<availableGift>();
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->resale_count_ = env->GetIntField(p, res->resale_count_fieldID);
  res->min_resale_star_count_ = env->GetLongField(p, res->min_resale_star_count_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  return res;
}

void availableGift::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); } }
  env->SetIntField(s, resale_count_fieldID, resale_count_);
  env->SetLongField(s, min_resale_star_count_fieldID, min_resale_star_count_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void availableGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AvailableGift");
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_field("resaleCount", resale_count_);
    s.store_field("minResaleStarCount", min_resale_star_count_);
    s.store_field("title", title_);
    s.store_class_end();
  }
}

void availableGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AvailableGift").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").c_str());
    resale_count_fieldID = jni::get_field_id(env, Class, "resaleCount", "I");
    min_resale_star_count_fieldID = jni::get_field_id(env, Class, "minResaleStarCount", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass availableGifts::Class;
jfieldID availableGifts::gifts_fieldID;

availableGifts::availableGifts()
  : gifts_()
{}

availableGifts::availableGifts(array<object_ptr<availableGift>> &&gifts_)
  : gifts_(std::move(gifts_))
{}

const std::int32_t availableGifts::ID;

object_ptr<availableGifts> availableGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<availableGifts> res = make_object<availableGifts>();
  res->gifts_ = jni::FetchVector<availableGift>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->gifts_fieldID));
  return res;
}

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

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

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

jclass BotWriteAccessAllowReason::Class;

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

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

jclass botWriteAccessAllowReasonConnectedWebsite::Class;
jfieldID botWriteAccessAllowReasonConnectedWebsite::domain_name_fieldID;

botWriteAccessAllowReasonConnectedWebsite::botWriteAccessAllowReasonConnectedWebsite()
  : domain_name_()
{}

botWriteAccessAllowReasonConnectedWebsite::botWriteAccessAllowReasonConnectedWebsite(string const &domain_name_)
  : domain_name_(domain_name_)
{}

const std::int32_t botWriteAccessAllowReasonConnectedWebsite::ID;

object_ptr<BotWriteAccessAllowReason> botWriteAccessAllowReasonConnectedWebsite::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botWriteAccessAllowReasonConnectedWebsite> res = make_object<botWriteAccessAllowReasonConnectedWebsite>();
  res->domain_name_ = jni::fetch_string(env, p, res->domain_name_fieldID);
  return std::move(res);
}

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

void botWriteAccessAllowReasonConnectedWebsite::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotWriteAccessAllowReasonConnectedWebsite");
    s.store_field("domainName", domain_name_);
    s.store_class_end();
  }
}

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

jclass botWriteAccessAllowReasonAddedToAttachmentMenu::Class;

botWriteAccessAllowReasonAddedToAttachmentMenu::botWriteAccessAllowReasonAddedToAttachmentMenu() {
}

const std::int32_t botWriteAccessAllowReasonAddedToAttachmentMenu::ID;

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

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

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

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

jclass botWriteAccessAllowReasonLaunchedWebApp::Class;
jfieldID botWriteAccessAllowReasonLaunchedWebApp::web_app_fieldID;

botWriteAccessAllowReasonLaunchedWebApp::botWriteAccessAllowReasonLaunchedWebApp()
  : web_app_()
{}

botWriteAccessAllowReasonLaunchedWebApp::botWriteAccessAllowReasonLaunchedWebApp(object_ptr<webApp> &&web_app_)
  : web_app_(std::move(web_app_))
{}

const std::int32_t botWriteAccessAllowReasonLaunchedWebApp::ID;

object_ptr<BotWriteAccessAllowReason> botWriteAccessAllowReasonLaunchedWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botWriteAccessAllowReasonLaunchedWebApp> res = make_object<botWriteAccessAllowReasonLaunchedWebApp>();
  res->web_app_ = jni::fetch_tl_object<webApp>(env, jni::fetch_object(env, p, res->web_app_fieldID));
  return std::move(res);
}

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

void botWriteAccessAllowReasonLaunchedWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BotWriteAccessAllowReasonLaunchedWebApp");
    s.store_object_field("webApp", static_cast<const BaseObject *>(web_app_.get()));
    s.store_class_end();
  }
}

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

jclass botWriteAccessAllowReasonAcceptedRequest::Class;

botWriteAccessAllowReasonAcceptedRequest::botWriteAccessAllowReasonAcceptedRequest() {
}

const std::int32_t botWriteAccessAllowReasonAcceptedRequest::ID;

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

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

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

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

jclass BuiltInTheme::Class;

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

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

jclass builtInThemeClassic::Class;

builtInThemeClassic::builtInThemeClassic() {
}

const std::int32_t builtInThemeClassic::ID;

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

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

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

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

jclass builtInThemeDay::Class;

builtInThemeDay::builtInThemeDay() {
}

const std::int32_t builtInThemeDay::ID;

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

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

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

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

jclass builtInThemeNight::Class;

builtInThemeNight::builtInThemeNight() {
}

const std::int32_t builtInThemeNight::ID;

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

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

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

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

jclass builtInThemeTinted::Class;

builtInThemeTinted::builtInThemeTinted() {
}

const std::int32_t builtInThemeTinted::ID;

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

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

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

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

jclass builtInThemeArctic::Class;

builtInThemeArctic::builtInThemeArctic() {
}

const std::int32_t builtInThemeArctic::ID;

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

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

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

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

jclass businessChatLinkInfo::Class;
jfieldID businessChatLinkInfo::chat_id_fieldID;
jfieldID businessChatLinkInfo::text_fieldID;

businessChatLinkInfo::businessChatLinkInfo()
  : chat_id_()
  , text_()
{}

businessChatLinkInfo::businessChatLinkInfo(int53 chat_id_, object_ptr<formattedText> &&text_)
  : chat_id_(chat_id_)
  , text_(std::move(text_))
{}

const std::int32_t businessChatLinkInfo::ID;

object_ptr<businessChatLinkInfo> businessChatLinkInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessChatLinkInfo> res = make_object<businessChatLinkInfo>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return res;
}

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

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

void businessChatLinkInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessChatLinkInfo").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass businessConnectedBot::Class;
jfieldID businessConnectedBot::bot_user_id_fieldID;
jfieldID businessConnectedBot::recipients_fieldID;
jfieldID businessConnectedBot::rights_fieldID;

businessConnectedBot::businessConnectedBot()
  : bot_user_id_()
  , recipients_()
  , rights_()
{}

businessConnectedBot::businessConnectedBot(int53 bot_user_id_, object_ptr<businessRecipients> &&recipients_, object_ptr<businessBotRights> &&rights_)
  : bot_user_id_(bot_user_id_)
  , recipients_(std::move(recipients_))
  , rights_(std::move(rights_))
{}

const std::int32_t businessConnectedBot::ID;

object_ptr<businessConnectedBot> businessConnectedBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessConnectedBot> res = make_object<businessConnectedBot>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->recipients_ = jni::fetch_tl_object<businessRecipients>(env, jni::fetch_object(env, p, res->recipients_fieldID));
  res->rights_ = jni::fetch_tl_object<businessBotRights>(env, jni::fetch_object(env, p, res->rights_fieldID));
  return res;
}

void businessConnectedBot::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_);
  if (recipients_ != nullptr) { jobject next; recipients_->store(env, next); if (next) { env->SetObjectField(s, recipients_fieldID, next); env->DeleteLocalRef(next); } }
  if (rights_ != nullptr) { jobject next; rights_->store(env, next); if (next) { env->SetObjectField(s, rights_fieldID, next); env->DeleteLocalRef(next); } }
}

void businessConnectedBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessConnectedBot");
    s.store_field("botUserId", bot_user_id_);
    s.store_object_field("recipients", static_cast<const BaseObject *>(recipients_.get()));
    s.store_object_field("rights", static_cast<const BaseObject *>(rights_.get()));
    s.store_class_end();
  }
}

void businessConnectedBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessConnectedBot").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    recipients_fieldID = jni::get_field_id(env, Class, "recipients", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessRecipients;").c_str());
    rights_fieldID = jni::get_field_id(env, Class, "rights", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessBotRights;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass CanPostStoryResult::Class;

object_ptr<CanPostStoryResult> CanPostStoryResult::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case canPostStoryResultOk::ID:
      return canPostStoryResultOk::fetch(env, p);
    case canPostStoryResultPremiumNeeded::ID:
      return canPostStoryResultPremiumNeeded::fetch(env, p);
    case canPostStoryResultBoostNeeded::ID:
      return canPostStoryResultBoostNeeded::fetch(env, p);
    case canPostStoryResultActiveStoryLimitExceeded::ID:
      return canPostStoryResultActiveStoryLimitExceeded::fetch(env, p);
    case canPostStoryResultWeeklyLimitExceeded::ID:
      return canPostStoryResultWeeklyLimitExceeded::fetch(env, p);
    case canPostStoryResultMonthlyLimitExceeded::ID:
      return canPostStoryResultMonthlyLimitExceeded::fetch(env, p);
    case canPostStoryResultLiveStoryIsActive::ID:
      return canPostStoryResultLiveStoryIsActive::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass canPostStoryResultOk::Class;
jfieldID canPostStoryResultOk::story_count_fieldID;

canPostStoryResultOk::canPostStoryResultOk()
  : story_count_()
{}

canPostStoryResultOk::canPostStoryResultOk(int32 story_count_)
  : story_count_(story_count_)
{}

const std::int32_t canPostStoryResultOk::ID;

object_ptr<CanPostStoryResult> canPostStoryResultOk::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canPostStoryResultOk> res = make_object<canPostStoryResultOk>();
  res->story_count_ = env->GetIntField(p, res->story_count_fieldID);
  return std::move(res);
}

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

void canPostStoryResultOk::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanPostStoryResultOk");
    s.store_field("storyCount", story_count_);
    s.store_class_end();
  }
}

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

jclass canPostStoryResultPremiumNeeded::Class;

canPostStoryResultPremiumNeeded::canPostStoryResultPremiumNeeded() {
}

const std::int32_t canPostStoryResultPremiumNeeded::ID;

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

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

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

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

jclass canPostStoryResultBoostNeeded::Class;

canPostStoryResultBoostNeeded::canPostStoryResultBoostNeeded() {
}

const std::int32_t canPostStoryResultBoostNeeded::ID;

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

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

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

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

jclass canPostStoryResultActiveStoryLimitExceeded::Class;

canPostStoryResultActiveStoryLimitExceeded::canPostStoryResultActiveStoryLimitExceeded() {
}

const std::int32_t canPostStoryResultActiveStoryLimitExceeded::ID;

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

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

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

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

jclass canPostStoryResultWeeklyLimitExceeded::Class;
jfieldID canPostStoryResultWeeklyLimitExceeded::retry_after_fieldID;

canPostStoryResultWeeklyLimitExceeded::canPostStoryResultWeeklyLimitExceeded()
  : retry_after_()
{}

canPostStoryResultWeeklyLimitExceeded::canPostStoryResultWeeklyLimitExceeded(int32 retry_after_)
  : retry_after_(retry_after_)
{}

const std::int32_t canPostStoryResultWeeklyLimitExceeded::ID;

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

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

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

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

jclass canPostStoryResultMonthlyLimitExceeded::Class;
jfieldID canPostStoryResultMonthlyLimitExceeded::retry_after_fieldID;

canPostStoryResultMonthlyLimitExceeded::canPostStoryResultMonthlyLimitExceeded()
  : retry_after_()
{}

canPostStoryResultMonthlyLimitExceeded::canPostStoryResultMonthlyLimitExceeded(int32 retry_after_)
  : retry_after_(retry_after_)
{}

const std::int32_t canPostStoryResultMonthlyLimitExceeded::ID;

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

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

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

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

jclass canPostStoryResultLiveStoryIsActive::Class;
jfieldID canPostStoryResultLiveStoryIsActive::story_id_fieldID;

canPostStoryResultLiveStoryIsActive::canPostStoryResultLiveStoryIsActive()
  : story_id_()
{}

canPostStoryResultLiveStoryIsActive::canPostStoryResultLiveStoryIsActive(int32 story_id_)
  : story_id_(story_id_)
{}

const std::int32_t canPostStoryResultLiveStoryIsActive::ID;

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

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

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

jclass ChatActionBar::Class;

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

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

jclass chatActionBarReportSpam::Class;
jfieldID chatActionBarReportSpam::can_unarchive_fieldID;

chatActionBarReportSpam::chatActionBarReportSpam()
  : can_unarchive_()
{}

chatActionBarReportSpam::chatActionBarReportSpam(bool can_unarchive_)
  : can_unarchive_(can_unarchive_)
{}

const std::int32_t chatActionBarReportSpam::ID;

object_ptr<ChatActionBar> chatActionBarReportSpam::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionBarReportSpam> res = make_object<chatActionBarReportSpam>();
  res->can_unarchive_ = (env->GetBooleanField(p, res->can_unarchive_fieldID) != 0);
  return std::move(res);
}

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

void chatActionBarReportSpam::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionBarReportSpam");
    s.store_field("canUnarchive", can_unarchive_);
    s.store_class_end();
  }
}

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

jclass chatActionBarInviteMembers::Class;

chatActionBarInviteMembers::chatActionBarInviteMembers() {
}

const std::int32_t chatActionBarInviteMembers::ID;

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

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

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

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

jclass chatActionBarReportAddBlock::Class;
jfieldID chatActionBarReportAddBlock::can_unarchive_fieldID;
jfieldID chatActionBarReportAddBlock::account_info_fieldID;

chatActionBarReportAddBlock::chatActionBarReportAddBlock()
  : can_unarchive_()
  , account_info_()
{}

chatActionBarReportAddBlock::chatActionBarReportAddBlock(bool can_unarchive_, object_ptr<accountInfo> &&account_info_)
  : can_unarchive_(can_unarchive_)
  , account_info_(std::move(account_info_))
{}

const std::int32_t chatActionBarReportAddBlock::ID;

object_ptr<ChatActionBar> chatActionBarReportAddBlock::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionBarReportAddBlock> res = make_object<chatActionBarReportAddBlock>();
  res->can_unarchive_ = (env->GetBooleanField(p, res->can_unarchive_fieldID) != 0);
  res->account_info_ = jni::fetch_tl_object<accountInfo>(env, jni::fetch_object(env, p, res->account_info_fieldID));
  return std::move(res);
}

void chatActionBarReportAddBlock::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_unarchive_fieldID, can_unarchive_);
  if (account_info_ != nullptr) { jobject next; account_info_->store(env, next); if (next) { env->SetObjectField(s, account_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatActionBarReportAddBlock::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionBarReportAddBlock");
    s.store_field("canUnarchive", can_unarchive_);
    s.store_object_field("accountInfo", static_cast<const BaseObject *>(account_info_.get()));
    s.store_class_end();
  }
}

void chatActionBarReportAddBlock::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatActionBarReportAddBlock").c_str());
    can_unarchive_fieldID = jni::get_field_id(env, Class, "canUnarchive", "Z");
    account_info_fieldID = jni::get_field_id(env, Class, "accountInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AccountInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatActionBarAddContact::Class;

chatActionBarAddContact::chatActionBarAddContact() {
}

const std::int32_t chatActionBarAddContact::ID;

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

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

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

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

jclass chatActionBarSharePhoneNumber::Class;

chatActionBarSharePhoneNumber::chatActionBarSharePhoneNumber() {
}

const std::int32_t chatActionBarSharePhoneNumber::ID;

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

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

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

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

jclass chatActionBarJoinRequest::Class;
jfieldID chatActionBarJoinRequest::title_fieldID;
jfieldID chatActionBarJoinRequest::is_channel_fieldID;
jfieldID chatActionBarJoinRequest::request_date_fieldID;

chatActionBarJoinRequest::chatActionBarJoinRequest()
  : title_()
  , is_channel_()
  , request_date_()
{}

chatActionBarJoinRequest::chatActionBarJoinRequest(string const &title_, bool is_channel_, int32 request_date_)
  : title_(title_)
  , is_channel_(is_channel_)
  , request_date_(request_date_)
{}

const std::int32_t chatActionBarJoinRequest::ID;

object_ptr<ChatActionBar> chatActionBarJoinRequest::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActionBarJoinRequest> res = make_object<chatActionBarJoinRequest>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->is_channel_ = (env->GetBooleanField(p, res->is_channel_fieldID) != 0);
  res->request_date_ = env->GetIntField(p, res->request_date_fieldID);
  return std::move(res);
}

void chatActionBarJoinRequest::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_channel_fieldID, is_channel_);
  env->SetIntField(s, request_date_fieldID, request_date_);
}

void chatActionBarJoinRequest::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActionBarJoinRequest");
    s.store_field("title", title_);
    s.store_field("isChannel", is_channel_);
    s.store_field("requestDate", request_date_);
    s.store_class_end();
  }
}

void chatActionBarJoinRequest::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatActionBarJoinRequest").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    is_channel_fieldID = jni::get_field_id(env, Class, "isChannel", "Z");
    request_date_fieldID = jni::get_field_id(env, Class, "requestDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass chatBoostLevelFeatures::Class;
jfieldID chatBoostLevelFeatures::level_fieldID;
jfieldID chatBoostLevelFeatures::story_per_day_count_fieldID;
jfieldID chatBoostLevelFeatures::custom_emoji_reaction_count_fieldID;
jfieldID chatBoostLevelFeatures::title_color_count_fieldID;
jfieldID chatBoostLevelFeatures::profile_accent_color_count_fieldID;
jfieldID chatBoostLevelFeatures::can_set_profile_background_custom_emoji_fieldID;
jfieldID chatBoostLevelFeatures::accent_color_count_fieldID;
jfieldID chatBoostLevelFeatures::can_set_background_custom_emoji_fieldID;
jfieldID chatBoostLevelFeatures::can_set_emoji_status_fieldID;
jfieldID chatBoostLevelFeatures::chat_theme_background_count_fieldID;
jfieldID chatBoostLevelFeatures::can_set_custom_background_fieldID;
jfieldID chatBoostLevelFeatures::can_set_custom_emoji_sticker_set_fieldID;
jfieldID chatBoostLevelFeatures::can_enable_automatic_translation_fieldID;
jfieldID chatBoostLevelFeatures::can_recognize_speech_fieldID;
jfieldID chatBoostLevelFeatures::can_disable_sponsored_messages_fieldID;

chatBoostLevelFeatures::chatBoostLevelFeatures()
  : level_()
  , story_per_day_count_()
  , custom_emoji_reaction_count_()
  , title_color_count_()
  , profile_accent_color_count_()
  , can_set_profile_background_custom_emoji_()
  , accent_color_count_()
  , can_set_background_custom_emoji_()
  , can_set_emoji_status_()
  , chat_theme_background_count_()
  , can_set_custom_background_()
  , can_set_custom_emoji_sticker_set_()
  , can_enable_automatic_translation_()
  , can_recognize_speech_()
  , can_disable_sponsored_messages_()
{}

chatBoostLevelFeatures::chatBoostLevelFeatures(int32 level_, int32 story_per_day_count_, int32 custom_emoji_reaction_count_, int32 title_color_count_, int32 profile_accent_color_count_, bool can_set_profile_background_custom_emoji_, int32 accent_color_count_, bool can_set_background_custom_emoji_, bool can_set_emoji_status_, int32 chat_theme_background_count_, bool can_set_custom_background_, bool can_set_custom_emoji_sticker_set_, bool can_enable_automatic_translation_, bool can_recognize_speech_, bool can_disable_sponsored_messages_)
  : level_(level_)
  , story_per_day_count_(story_per_day_count_)
  , custom_emoji_reaction_count_(custom_emoji_reaction_count_)
  , title_color_count_(title_color_count_)
  , profile_accent_color_count_(profile_accent_color_count_)
  , can_set_profile_background_custom_emoji_(can_set_profile_background_custom_emoji_)
  , accent_color_count_(accent_color_count_)
  , can_set_background_custom_emoji_(can_set_background_custom_emoji_)
  , can_set_emoji_status_(can_set_emoji_status_)
  , chat_theme_background_count_(chat_theme_background_count_)
  , can_set_custom_background_(can_set_custom_background_)
  , can_set_custom_emoji_sticker_set_(can_set_custom_emoji_sticker_set_)
  , can_enable_automatic_translation_(can_enable_automatic_translation_)
  , can_recognize_speech_(can_recognize_speech_)
  , can_disable_sponsored_messages_(can_disable_sponsored_messages_)
{}

const std::int32_t chatBoostLevelFeatures::ID;

object_ptr<chatBoostLevelFeatures> chatBoostLevelFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostLevelFeatures> res = make_object<chatBoostLevelFeatures>();
  res->level_ = env->GetIntField(p, res->level_fieldID);
  res->story_per_day_count_ = env->GetIntField(p, res->story_per_day_count_fieldID);
  res->custom_emoji_reaction_count_ = env->GetIntField(p, res->custom_emoji_reaction_count_fieldID);
  res->title_color_count_ = env->GetIntField(p, res->title_color_count_fieldID);
  res->profile_accent_color_count_ = env->GetIntField(p, res->profile_accent_color_count_fieldID);
  res->can_set_profile_background_custom_emoji_ = (env->GetBooleanField(p, res->can_set_profile_background_custom_emoji_fieldID) != 0);
  res->accent_color_count_ = env->GetIntField(p, res->accent_color_count_fieldID);
  res->can_set_background_custom_emoji_ = (env->GetBooleanField(p, res->can_set_background_custom_emoji_fieldID) != 0);
  res->can_set_emoji_status_ = (env->GetBooleanField(p, res->can_set_emoji_status_fieldID) != 0);
  res->chat_theme_background_count_ = env->GetIntField(p, res->chat_theme_background_count_fieldID);
  res->can_set_custom_background_ = (env->GetBooleanField(p, res->can_set_custom_background_fieldID) != 0);
  res->can_set_custom_emoji_sticker_set_ = (env->GetBooleanField(p, res->can_set_custom_emoji_sticker_set_fieldID) != 0);
  res->can_enable_automatic_translation_ = (env->GetBooleanField(p, res->can_enable_automatic_translation_fieldID) != 0);
  res->can_recognize_speech_ = (env->GetBooleanField(p, res->can_recognize_speech_fieldID) != 0);
  res->can_disable_sponsored_messages_ = (env->GetBooleanField(p, res->can_disable_sponsored_messages_fieldID) != 0);
  return res;
}

void chatBoostLevelFeatures::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, level_fieldID, level_);
  env->SetIntField(s, story_per_day_count_fieldID, story_per_day_count_);
  env->SetIntField(s, custom_emoji_reaction_count_fieldID, custom_emoji_reaction_count_);
  env->SetIntField(s, title_color_count_fieldID, title_color_count_);
  env->SetIntField(s, profile_accent_color_count_fieldID, profile_accent_color_count_);
  env->SetBooleanField(s, can_set_profile_background_custom_emoji_fieldID, can_set_profile_background_custom_emoji_);
  env->SetIntField(s, accent_color_count_fieldID, accent_color_count_);
  env->SetBooleanField(s, can_set_background_custom_emoji_fieldID, can_set_background_custom_emoji_);
  env->SetBooleanField(s, can_set_emoji_status_fieldID, can_set_emoji_status_);
  env->SetIntField(s, chat_theme_background_count_fieldID, chat_theme_background_count_);
  env->SetBooleanField(s, can_set_custom_background_fieldID, can_set_custom_background_);
  env->SetBooleanField(s, can_set_custom_emoji_sticker_set_fieldID, can_set_custom_emoji_sticker_set_);
  env->SetBooleanField(s, can_enable_automatic_translation_fieldID, can_enable_automatic_translation_);
  env->SetBooleanField(s, can_recognize_speech_fieldID, can_recognize_speech_);
  env->SetBooleanField(s, can_disable_sponsored_messages_fieldID, can_disable_sponsored_messages_);
}

void chatBoostLevelFeatures::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatBoostLevelFeatures");
    s.store_field("level", level_);
    s.store_field("storyPerDayCount", story_per_day_count_);
    s.store_field("customEmojiReactionCount", custom_emoji_reaction_count_);
    s.store_field("titleColorCount", title_color_count_);
    s.store_field("profileAccentColorCount", profile_accent_color_count_);
    s.store_field("canSetProfileBackgroundCustomEmoji", can_set_profile_background_custom_emoji_);
    s.store_field("accentColorCount", accent_color_count_);
    s.store_field("canSetBackgroundCustomEmoji", can_set_background_custom_emoji_);
    s.store_field("canSetEmojiStatus", can_set_emoji_status_);
    s.store_field("chatThemeBackgroundCount", chat_theme_background_count_);
    s.store_field("canSetCustomBackground", can_set_custom_background_);
    s.store_field("canSetCustomEmojiStickerSet", can_set_custom_emoji_sticker_set_);
    s.store_field("canEnableAutomaticTranslation", can_enable_automatic_translation_);
    s.store_field("canRecognizeSpeech", can_recognize_speech_);
    s.store_field("canDisableSponsoredMessages", can_disable_sponsored_messages_);
    s.store_class_end();
  }
}

void chatBoostLevelFeatures::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatBoostLevelFeatures").c_str());
    level_fieldID = jni::get_field_id(env, Class, "level", "I");
    story_per_day_count_fieldID = jni::get_field_id(env, Class, "storyPerDayCount", "I");
    custom_emoji_reaction_count_fieldID = jni::get_field_id(env, Class, "customEmojiReactionCount", "I");
    title_color_count_fieldID = jni::get_field_id(env, Class, "titleColorCount", "I");
    profile_accent_color_count_fieldID = jni::get_field_id(env, Class, "profileAccentColorCount", "I");
    can_set_profile_background_custom_emoji_fieldID = jni::get_field_id(env, Class, "canSetProfileBackgroundCustomEmoji", "Z");
    accent_color_count_fieldID = jni::get_field_id(env, Class, "accentColorCount", "I");
    can_set_background_custom_emoji_fieldID = jni::get_field_id(env, Class, "canSetBackgroundCustomEmoji", "Z");
    can_set_emoji_status_fieldID = jni::get_field_id(env, Class, "canSetEmojiStatus", "Z");
    chat_theme_background_count_fieldID = jni::get_field_id(env, Class, "chatThemeBackgroundCount", "I");
    can_set_custom_background_fieldID = jni::get_field_id(env, Class, "canSetCustomBackground", "Z");
    can_set_custom_emoji_sticker_set_fieldID = jni::get_field_id(env, Class, "canSetCustomEmojiStickerSet", "Z");
    can_enable_automatic_translation_fieldID = jni::get_field_id(env, Class, "canEnableAutomaticTranslation", "Z");
    can_recognize_speech_fieldID = jni::get_field_id(env, Class, "canRecognizeSpeech", "Z");
    can_disable_sponsored_messages_fieldID = jni::get_field_id(env, Class, "canDisableSponsoredMessages", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatFolderInviteLinks::Class;
jfieldID chatFolderInviteLinks::invite_links_fieldID;

chatFolderInviteLinks::chatFolderInviteLinks()
  : invite_links_()
{}

chatFolderInviteLinks::chatFolderInviteLinks(array<object_ptr<chatFolderInviteLink>> &&invite_links_)
  : invite_links_(std::move(invite_links_))
{}

const std::int32_t chatFolderInviteLinks::ID;

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

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

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

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

jclass chatPhotos::Class;
jfieldID chatPhotos::total_count_fieldID;
jfieldID chatPhotos::photos_fieldID;

chatPhotos::chatPhotos()
  : total_count_()
  , photos_()
{}

chatPhotos::chatPhotos(int32 total_count_, array<object_ptr<chatPhoto>> &&photos_)
  : total_count_(total_count_)
  , photos_(std::move(photos_))
{}

const std::int32_t chatPhotos::ID;

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

void chatPhotos::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, photos_); if (arr_tmp_) { env->SetObjectField(s, photos_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

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

jclass chatRevenueAmount::Class;
jfieldID chatRevenueAmount::cryptocurrency_fieldID;
jfieldID chatRevenueAmount::total_amount_fieldID;
jfieldID chatRevenueAmount::balance_amount_fieldID;
jfieldID chatRevenueAmount::available_amount_fieldID;
jfieldID chatRevenueAmount::withdrawal_enabled_fieldID;

chatRevenueAmount::chatRevenueAmount()
  : cryptocurrency_()
  , total_amount_()
  , balance_amount_()
  , available_amount_()
  , withdrawal_enabled_()
{}

chatRevenueAmount::chatRevenueAmount(string const &cryptocurrency_, int64 total_amount_, int64 balance_amount_, int64 available_amount_, bool withdrawal_enabled_)
  : cryptocurrency_(cryptocurrency_)
  , total_amount_(total_amount_)
  , balance_amount_(balance_amount_)
  , available_amount_(available_amount_)
  , withdrawal_enabled_(withdrawal_enabled_)
{}

const std::int32_t chatRevenueAmount::ID;

object_ptr<chatRevenueAmount> chatRevenueAmount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueAmount> res = make_object<chatRevenueAmount>();
  res->cryptocurrency_ = jni::fetch_string(env, p, res->cryptocurrency_fieldID);
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->balance_amount_ = env->GetLongField(p, res->balance_amount_fieldID);
  res->available_amount_ = env->GetLongField(p, res->available_amount_fieldID);
  res->withdrawal_enabled_ = (env->GetBooleanField(p, res->withdrawal_enabled_fieldID) != 0);
  return res;
}

void chatRevenueAmount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, cryptocurrency_); if (nextString) { env->SetObjectField(s, cryptocurrency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, total_amount_fieldID, total_amount_);
  env->SetLongField(s, balance_amount_fieldID, balance_amount_);
  env->SetLongField(s, available_amount_fieldID, available_amount_);
  env->SetBooleanField(s, withdrawal_enabled_fieldID, withdrawal_enabled_);
}

void chatRevenueAmount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueAmount");
    s.store_field("cryptocurrency", cryptocurrency_);
    s.store_field("totalAmount", total_amount_);
    s.store_field("balanceAmount", balance_amount_);
    s.store_field("availableAmount", available_amount_);
    s.store_field("withdrawalEnabled", withdrawal_enabled_);
    s.store_class_end();
  }
}

void chatRevenueAmount::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueAmount").c_str());
    cryptocurrency_fieldID = jni::get_field_id(env, Class, "cryptocurrency", "Ljava/lang/String;");
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    balance_amount_fieldID = jni::get_field_id(env, Class, "balanceAmount", "J");
    available_amount_fieldID = jni::get_field_id(env, Class, "availableAmount", "J");
    withdrawal_enabled_fieldID = jni::get_field_id(env, Class, "withdrawalEnabled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass CheckStickerSetNameResult::Class;

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

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

jclass checkStickerSetNameResultOk::Class;

checkStickerSetNameResultOk::checkStickerSetNameResultOk() {
}

const std::int32_t checkStickerSetNameResultOk::ID;

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

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

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

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

jclass checkStickerSetNameResultNameInvalid::Class;

checkStickerSetNameResultNameInvalid::checkStickerSetNameResultNameInvalid() {
}

const std::int32_t checkStickerSetNameResultNameInvalid::ID;

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

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

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

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

jclass checkStickerSetNameResultNameOccupied::Class;

checkStickerSetNameResultNameOccupied::checkStickerSetNameResultNameOccupied() {
}

const std::int32_t checkStickerSetNameResultNameOccupied::ID;

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

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

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

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

jclass customRequestResult::Class;
jfieldID customRequestResult::result_fieldID;

customRequestResult::customRequestResult()
  : result_()
{}

customRequestResult::customRequestResult(string const &result_)
  : result_(result_)
{}

const std::int32_t customRequestResult::ID;

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

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

void customRequestResult::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CustomRequestResult");
    s.store_field("result", result_);
    s.store_class_end();
  }
}

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

jclass datedFile::Class;
jfieldID datedFile::file_fieldID;
jfieldID datedFile::date_fieldID;

datedFile::datedFile()
  : file_()
  , date_()
{}

datedFile::datedFile(object_ptr<file> &&file_, int32 date_)
  : file_(std::move(file_))
  , date_(date_)
{}

const std::int32_t datedFile::ID;

object_ptr<datedFile> datedFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<datedFile> res = make_object<datedFile>();
  res->file_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->file_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void datedFile::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (file_ != nullptr) { jobject next; file_->store(env, next); if (next) { env->SetObjectField(s, file_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
}

void datedFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DatedFile");
    s.store_object_field("file", static_cast<const BaseObject *>(file_.get()));
    s.store_field("date", date_);
    s.store_class_end();
  }
}

void datedFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DatedFile").c_str());
    file_fieldID = jni::get_field_id(env, Class, "file", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass emailAddressAuthenticationCodeInfo::Class;
jfieldID emailAddressAuthenticationCodeInfo::email_address_pattern_fieldID;
jfieldID emailAddressAuthenticationCodeInfo::length_fieldID;

emailAddressAuthenticationCodeInfo::emailAddressAuthenticationCodeInfo()
  : email_address_pattern_()
  , length_()
{}

emailAddressAuthenticationCodeInfo::emailAddressAuthenticationCodeInfo(string const &email_address_pattern_, int32 length_)
  : email_address_pattern_(email_address_pattern_)
  , length_(length_)
{}

const std::int32_t emailAddressAuthenticationCodeInfo::ID;

object_ptr<emailAddressAuthenticationCodeInfo> emailAddressAuthenticationCodeInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emailAddressAuthenticationCodeInfo> res = make_object<emailAddressAuthenticationCodeInfo>();
  res->email_address_pattern_ = jni::fetch_string(env, p, res->email_address_pattern_fieldID);
  res->length_ = env->GetIntField(p, res->length_fieldID);
  return res;
}

void emailAddressAuthenticationCodeInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, email_address_pattern_); if (nextString) { env->SetObjectField(s, email_address_pattern_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, length_fieldID, length_);
}

void emailAddressAuthenticationCodeInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmailAddressAuthenticationCodeInfo");
    s.store_field("emailAddressPattern", email_address_pattern_);
    s.store_field("length", length_);
    s.store_class_end();
  }
}

void emailAddressAuthenticationCodeInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmailAddressAuthenticationCodeInfo").c_str());
    email_address_pattern_fieldID = jni::get_field_id(env, Class, "emailAddressPattern", "Ljava/lang/String;");
    length_fieldID = jni::get_field_id(env, Class, "length", "I");
    return true;
  }();
  (void)is_inited;
}

jclass emojiStatus::Class;
jfieldID emojiStatus::type_fieldID;
jfieldID emojiStatus::expiration_date_fieldID;

emojiStatus::emojiStatus()
  : type_()
  , expiration_date_()
{}

emojiStatus::emojiStatus(object_ptr<EmojiStatusType> &&type_, int32 expiration_date_)
  : type_(std::move(type_))
  , expiration_date_(expiration_date_)
{}

const std::int32_t emojiStatus::ID;

object_ptr<emojiStatus> emojiStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiStatus> res = make_object<emojiStatus>();
  res->type_ = jni::fetch_tl_object<EmojiStatusType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  return res;
}

void emojiStatus::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->SetIntField(s, expiration_date_fieldID, expiration_date_);
}

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

void emojiStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiStatus").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiStatusType;").c_str());
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass FirebaseDeviceVerificationParameters::Class;

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

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

jclass firebaseDeviceVerificationParametersSafetyNet::Class;
jfieldID firebaseDeviceVerificationParametersSafetyNet::nonce_fieldID;

firebaseDeviceVerificationParametersSafetyNet::firebaseDeviceVerificationParametersSafetyNet()
  : nonce_()
{}

firebaseDeviceVerificationParametersSafetyNet::firebaseDeviceVerificationParametersSafetyNet(bytes const &nonce_)
  : nonce_(std::move(nonce_))
{}

const std::int32_t firebaseDeviceVerificationParametersSafetyNet::ID;

object_ptr<FirebaseDeviceVerificationParameters> firebaseDeviceVerificationParametersSafetyNet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<firebaseDeviceVerificationParametersSafetyNet> res = make_object<firebaseDeviceVerificationParametersSafetyNet>();
  res->nonce_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->nonce_fieldID));
  return std::move(res);
}

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

void firebaseDeviceVerificationParametersSafetyNet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FirebaseDeviceVerificationParametersSafetyNet");
    s.store_bytes_field("nonce", nonce_);
    s.store_class_end();
  }
}

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

jclass firebaseDeviceVerificationParametersPlayIntegrity::Class;
jfieldID firebaseDeviceVerificationParametersPlayIntegrity::nonce_fieldID;
jfieldID firebaseDeviceVerificationParametersPlayIntegrity::cloud_project_number_fieldID;

firebaseDeviceVerificationParametersPlayIntegrity::firebaseDeviceVerificationParametersPlayIntegrity()
  : nonce_()
  , cloud_project_number_()
{}

firebaseDeviceVerificationParametersPlayIntegrity::firebaseDeviceVerificationParametersPlayIntegrity(string const &nonce_, int64 cloud_project_number_)
  : nonce_(nonce_)
  , cloud_project_number_(cloud_project_number_)
{}

const std::int32_t firebaseDeviceVerificationParametersPlayIntegrity::ID;

object_ptr<FirebaseDeviceVerificationParameters> firebaseDeviceVerificationParametersPlayIntegrity::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<firebaseDeviceVerificationParametersPlayIntegrity> res = make_object<firebaseDeviceVerificationParametersPlayIntegrity>();
  res->nonce_ = jni::fetch_string(env, p, res->nonce_fieldID);
  res->cloud_project_number_ = env->GetLongField(p, res->cloud_project_number_fieldID);
  return std::move(res);
}

void firebaseDeviceVerificationParametersPlayIntegrity::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, nonce_); if (nextString) { env->SetObjectField(s, nonce_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, cloud_project_number_fieldID, cloud_project_number_);
}

void firebaseDeviceVerificationParametersPlayIntegrity::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FirebaseDeviceVerificationParametersPlayIntegrity");
    s.store_field("nonce", nonce_);
    s.store_field("cloudProjectNumber", cloud_project_number_);
    s.store_class_end();
  }
}

void firebaseDeviceVerificationParametersPlayIntegrity::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FirebaseDeviceVerificationParametersPlayIntegrity").c_str());
    nonce_fieldID = jni::get_field_id(env, Class, "nonce", "Ljava/lang/String;");
    cloud_project_number_fieldID = jni::get_field_id(env, Class, "cloudProjectNumber", "J");
    return true;
  }();
  (void)is_inited;
}

jclass foundAffiliateProgram::Class;
jfieldID foundAffiliateProgram::bot_user_id_fieldID;
jfieldID foundAffiliateProgram::info_fieldID;

foundAffiliateProgram::foundAffiliateProgram()
  : bot_user_id_()
  , info_()
{}

foundAffiliateProgram::foundAffiliateProgram(int53 bot_user_id_, object_ptr<affiliateProgramInfo> &&info_)
  : bot_user_id_(bot_user_id_)
  , info_(std::move(info_))
{}

const std::int32_t foundAffiliateProgram::ID;

object_ptr<foundAffiliateProgram> foundAffiliateProgram::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundAffiliateProgram> res = make_object<foundAffiliateProgram>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->info_ = jni::fetch_tl_object<affiliateProgramInfo>(env, jni::fetch_object(env, p, res->info_fieldID));
  return res;
}

void foundAffiliateProgram::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_);
  if (info_ != nullptr) { jobject next; info_->store(env, next); if (next) { env->SetObjectField(s, info_fieldID, next); env->DeleteLocalRef(next); } }
}

void foundAffiliateProgram::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FoundAffiliateProgram");
    s.store_field("botUserId", bot_user_id_);
    s.store_object_field("info", static_cast<const BaseObject *>(info_.get()));
    s.store_class_end();
  }
}

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

jclass foundPositions::Class;
jfieldID foundPositions::total_count_fieldID;
jfieldID foundPositions::positions_fieldID;

foundPositions::foundPositions()
  : total_count_()
  , positions_()
{}

foundPositions::foundPositions(int32 total_count_, array<int32> &&positions_)
  : total_count_(total_count_)
  , positions_(std::move(positions_))
{}

const std::int32_t foundPositions::ID;

object_ptr<foundPositions> foundPositions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundPositions> res = make_object<foundPositions>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->positions_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->positions_fieldID));
  return res;
}

void foundPositions::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, positions_); if (arr_tmp_) { env->SetObjectField(s, positions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void foundPositions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FoundPositions");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("positions", positions_.size()); for (const auto &_value : positions_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass foundWebApp::Class;
jfieldID foundWebApp::web_app_fieldID;
jfieldID foundWebApp::request_write_access_fieldID;
jfieldID foundWebApp::skip_confirmation_fieldID;

foundWebApp::foundWebApp()
  : web_app_()
  , request_write_access_()
  , skip_confirmation_()
{}

foundWebApp::foundWebApp(object_ptr<webApp> &&web_app_, bool request_write_access_, bool skip_confirmation_)
  : web_app_(std::move(web_app_))
  , request_write_access_(request_write_access_)
  , skip_confirmation_(skip_confirmation_)
{}

const std::int32_t foundWebApp::ID;

object_ptr<foundWebApp> foundWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<foundWebApp> res = make_object<foundWebApp>();
  res->web_app_ = jni::fetch_tl_object<webApp>(env, jni::fetch_object(env, p, res->web_app_fieldID));
  res->request_write_access_ = (env->GetBooleanField(p, res->request_write_access_fieldID) != 0);
  res->skip_confirmation_ = (env->GetBooleanField(p, res->skip_confirmation_fieldID) != 0);
  return res;
}

void foundWebApp::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (web_app_ != nullptr) { jobject next; web_app_->store(env, next); if (next) { env->SetObjectField(s, web_app_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, request_write_access_fieldID, request_write_access_);
  env->SetBooleanField(s, skip_confirmation_fieldID, skip_confirmation_);
}

void foundWebApp::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "FoundWebApp");
    s.store_object_field("webApp", static_cast<const BaseObject *>(web_app_.get()));
    s.store_field("requestWriteAccess", request_write_access_);
    s.store_field("skipConfirmation", skip_confirmation_);
    s.store_class_end();
  }
}

void foundWebApp::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$FoundWebApp").c_str());
    web_app_fieldID = jni::get_field_id(env, Class, "webApp", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$WebApp;").c_str());
    request_write_access_fieldID = jni::get_field_id(env, Class, "requestWriteAccess", "Z");
    skip_confirmation_fieldID = jni::get_field_id(env, Class, "skipConfirmation", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass GiftPurchaseOfferState::Class;

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

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

jclass giftPurchaseOfferStatePending::Class;

giftPurchaseOfferStatePending::giftPurchaseOfferStatePending() {
}

const std::int32_t giftPurchaseOfferStatePending::ID;

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

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

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

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

jclass giftPurchaseOfferStateAccepted::Class;

giftPurchaseOfferStateAccepted::giftPurchaseOfferStateAccepted() {
}

const std::int32_t giftPurchaseOfferStateAccepted::ID;

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

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

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

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

jclass giftPurchaseOfferStateRejected::Class;

giftPurchaseOfferStateRejected::giftPurchaseOfferStateRejected() {
}

const std::int32_t giftPurchaseOfferStateRejected::ID;

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

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

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

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

jclass groupCallMessageLevel::Class;
jfieldID groupCallMessageLevel::min_star_count_fieldID;
jfieldID groupCallMessageLevel::pin_duration_fieldID;
jfieldID groupCallMessageLevel::max_text_length_fieldID;
jfieldID groupCallMessageLevel::max_custom_emoji_count_fieldID;
jfieldID groupCallMessageLevel::first_color_fieldID;
jfieldID groupCallMessageLevel::second_color_fieldID;
jfieldID groupCallMessageLevel::background_color_fieldID;

groupCallMessageLevel::groupCallMessageLevel()
  : min_star_count_()
  , pin_duration_()
  , max_text_length_()
  , max_custom_emoji_count_()
  , first_color_()
  , second_color_()
  , background_color_()
{}

groupCallMessageLevel::groupCallMessageLevel(int53 min_star_count_, int32 pin_duration_, int32 max_text_length_, int32 max_custom_emoji_count_, int32 first_color_, int32 second_color_, int32 background_color_)
  : min_star_count_(min_star_count_)
  , pin_duration_(pin_duration_)
  , max_text_length_(max_text_length_)
  , max_custom_emoji_count_(max_custom_emoji_count_)
  , first_color_(first_color_)
  , second_color_(second_color_)
  , background_color_(background_color_)
{}

const std::int32_t groupCallMessageLevel::ID;

object_ptr<groupCallMessageLevel> groupCallMessageLevel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallMessageLevel> res = make_object<groupCallMessageLevel>();
  res->min_star_count_ = env->GetLongField(p, res->min_star_count_fieldID);
  res->pin_duration_ = env->GetIntField(p, res->pin_duration_fieldID);
  res->max_text_length_ = env->GetIntField(p, res->max_text_length_fieldID);
  res->max_custom_emoji_count_ = env->GetIntField(p, res->max_custom_emoji_count_fieldID);
  res->first_color_ = env->GetIntField(p, res->first_color_fieldID);
  res->second_color_ = env->GetIntField(p, res->second_color_fieldID);
  res->background_color_ = env->GetIntField(p, res->background_color_fieldID);
  return res;
}

void groupCallMessageLevel::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, min_star_count_fieldID, min_star_count_);
  env->SetIntField(s, pin_duration_fieldID, pin_duration_);
  env->SetIntField(s, max_text_length_fieldID, max_text_length_);
  env->SetIntField(s, max_custom_emoji_count_fieldID, max_custom_emoji_count_);
  env->SetIntField(s, first_color_fieldID, first_color_);
  env->SetIntField(s, second_color_fieldID, second_color_);
  env->SetIntField(s, background_color_fieldID, background_color_);
}

void groupCallMessageLevel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallMessageLevel");
    s.store_field("minStarCount", min_star_count_);
    s.store_field("pinDuration", pin_duration_);
    s.store_field("maxTextLength", max_text_length_);
    s.store_field("maxCustomEmojiCount", max_custom_emoji_count_);
    s.store_field("firstColor", first_color_);
    s.store_field("secondColor", second_color_);
    s.store_field("backgroundColor", background_color_);
    s.store_class_end();
  }
}

void groupCallMessageLevel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallMessageLevel").c_str());
    min_star_count_fieldID = jni::get_field_id(env, Class, "minStarCount", "J");
    pin_duration_fieldID = jni::get_field_id(env, Class, "pinDuration", "I");
    max_text_length_fieldID = jni::get_field_id(env, Class, "maxTextLength", "I");
    max_custom_emoji_count_fieldID = jni::get_field_id(env, Class, "maxCustomEmojiCount", "I");
    first_color_fieldID = jni::get_field_id(env, Class, "firstColor", "I");
    second_color_fieldID = jni::get_field_id(env, Class, "secondColor", "I");
    background_color_fieldID = jni::get_field_id(env, Class, "backgroundColor", "I");
    return true;
  }();
  (void)is_inited;
}

jclass groupCallRecentSpeaker::Class;
jfieldID groupCallRecentSpeaker::participant_id_fieldID;
jfieldID groupCallRecentSpeaker::is_speaking_fieldID;

groupCallRecentSpeaker::groupCallRecentSpeaker()
  : participant_id_()
  , is_speaking_()
{}

groupCallRecentSpeaker::groupCallRecentSpeaker(object_ptr<MessageSender> &&participant_id_, bool is_speaking_)
  : participant_id_(std::move(participant_id_))
  , is_speaking_(is_speaking_)
{}

const std::int32_t groupCallRecentSpeaker::ID;

object_ptr<groupCallRecentSpeaker> groupCallRecentSpeaker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallRecentSpeaker> res = make_object<groupCallRecentSpeaker>();
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->is_speaking_ = (env->GetBooleanField(p, res->is_speaking_fieldID) != 0);
  return res;
}

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

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

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

jclass GroupCallVideoQuality::Class;

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

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

jclass groupCallVideoQualityThumbnail::Class;

groupCallVideoQualityThumbnail::groupCallVideoQualityThumbnail() {
}

const std::int32_t groupCallVideoQualityThumbnail::ID;

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

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

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

jclass groupCallVideoQualityMedium::Class;

groupCallVideoQualityMedium::groupCallVideoQualityMedium() {
}

const std::int32_t groupCallVideoQualityMedium::ID;

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

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

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

jclass groupCallVideoQualityFull::Class;

groupCallVideoQualityFull::groupCallVideoQualityFull() {
}

const std::int32_t groupCallVideoQualityFull::ID;

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

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

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

jclass InputInvoice::Class;

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

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

jclass inputInvoiceMessage::Class;
jfieldID inputInvoiceMessage::chat_id_fieldID;
jfieldID inputInvoiceMessage::message_id_fieldID;

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

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

const std::int32_t inputInvoiceMessage::ID;

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

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

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

jclass inputInvoiceName::Class;
jfieldID inputInvoiceName::name_fieldID;

inputInvoiceName::inputInvoiceName()
  : name_()
{}

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

const std::int32_t inputInvoiceName::ID;

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

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

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

jclass inputInvoiceTelegram::Class;
jfieldID inputInvoiceTelegram::purpose_fieldID;

inputInvoiceTelegram::inputInvoiceTelegram()
  : purpose_()
{}

inputInvoiceTelegram::inputInvoiceTelegram(object_ptr<TelegramPaymentPurpose> &&purpose_)
  : purpose_(std::move(purpose_))
{}

const std::int32_t inputInvoiceTelegram::ID;

object_ptr<InputInvoice> inputInvoiceTelegram::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputInvoiceTelegram> res = make_object<inputInvoiceTelegram>();
  res->purpose_ = jni::fetch_tl_object<TelegramPaymentPurpose>(env, jni::fetch_object(env, p, res->purpose_fieldID));
  return std::move(res);
}

void inputInvoiceTelegram::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputInvoiceTelegram");
    s.store_object_field("purpose", static_cast<const BaseObject *>(purpose_.get()));
    s.store_class_end();
  }
}

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

jclass inputSuggestedPostInfo::Class;
jfieldID inputSuggestedPostInfo::price_fieldID;
jfieldID inputSuggestedPostInfo::send_date_fieldID;

inputSuggestedPostInfo::inputSuggestedPostInfo()
  : price_()
  , send_date_()
{}

inputSuggestedPostInfo::inputSuggestedPostInfo(object_ptr<SuggestedPostPrice> &&price_, int32 send_date_)
  : price_(std::move(price_))
  , send_date_(send_date_)
{}

const std::int32_t inputSuggestedPostInfo::ID;

object_ptr<inputSuggestedPostInfo> inputSuggestedPostInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputSuggestedPostInfo> res = make_object<inputSuggestedPostInfo>();
  res->price_ = jni::fetch_tl_object<SuggestedPostPrice>(env, jni::fetch_object(env, p, res->price_fieldID));
  res->send_date_ = env->GetIntField(p, res->send_date_fieldID);
  return res;
}

void inputSuggestedPostInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (price_ != nullptr) { jobject next; price_->store(env, next); if (next) { env->SetObjectField(s, price_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, send_date_fieldID, send_date_);
}

void inputSuggestedPostInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputSuggestedPostInfo");
    s.store_object_field("price", static_cast<const BaseObject *>(price_.get()));
    s.store_field("sendDate", send_date_);
    s.store_class_end();
  }
}

void inputSuggestedPostInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputSuggestedPostInfo").c_str());
    price_fieldID = jni::get_field_id(env, Class, "price", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SuggestedPostPrice;").c_str());
    send_date_fieldID = jni::get_field_id(env, Class, "sendDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass languagePackStrings::Class;
jfieldID languagePackStrings::strings_fieldID;

languagePackStrings::languagePackStrings()
  : strings_()
{}

languagePackStrings::languagePackStrings(array<object_ptr<languagePackString>> &&strings_)
  : strings_(std::move(strings_))
{}

const std::int32_t languagePackStrings::ID;

object_ptr<languagePackStrings> languagePackStrings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<languagePackStrings> res = make_object<languagePackStrings>();
  res->strings_ = jni::FetchVector<languagePackString>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->strings_fieldID));
  return res;
}

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

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

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

jclass LinkPreviewType::Class;

object_ptr<LinkPreviewType> LinkPreviewType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case linkPreviewTypeAlbum::ID:
      return linkPreviewTypeAlbum::fetch(env, p);
    case linkPreviewTypeAnimation::ID:
      return linkPreviewTypeAnimation::fetch(env, p);
    case linkPreviewTypeApp::ID:
      return linkPreviewTypeApp::fetch(env, p);
    case linkPreviewTypeArticle::ID:
      return linkPreviewTypeArticle::fetch(env, p);
    case linkPreviewTypeAudio::ID:
      return linkPreviewTypeAudio::fetch(env, p);
    case linkPreviewTypeBackground::ID:
      return linkPreviewTypeBackground::fetch(env, p);
    case linkPreviewTypeChannelBoost::ID:
      return linkPreviewTypeChannelBoost::fetch(env, p);
    case linkPreviewTypeChat::ID:
      return linkPreviewTypeChat::fetch(env, p);
    case linkPreviewTypeDirectMessagesChat::ID:
      return linkPreviewTypeDirectMessagesChat::fetch(env, p);
    case linkPreviewTypeDocument::ID:
      return linkPreviewTypeDocument::fetch(env, p);
    case linkPreviewTypeEmbeddedAnimationPlayer::ID:
      return linkPreviewTypeEmbeddedAnimationPlayer::fetch(env, p);
    case linkPreviewTypeEmbeddedAudioPlayer::ID:
      return linkPreviewTypeEmbeddedAudioPlayer::fetch(env, p);
    case linkPreviewTypeEmbeddedVideoPlayer::ID:
      return linkPreviewTypeEmbeddedVideoPlayer::fetch(env, p);
    case linkPreviewTypeExternalAudio::ID:
      return linkPreviewTypeExternalAudio::fetch(env, p);
    case linkPreviewTypeExternalVideo::ID:
      return linkPreviewTypeExternalVideo::fetch(env, p);
    case linkPreviewTypeGiftAuction::ID:
      return linkPreviewTypeGiftAuction::fetch(env, p);
    case linkPreviewTypeGiftCollection::ID:
      return linkPreviewTypeGiftCollection::fetch(env, p);
    case linkPreviewTypeGroupCall::ID:
      return linkPreviewTypeGroupCall::fetch(env, p);
    case linkPreviewTypeInvoice::ID:
      return linkPreviewTypeInvoice::fetch(env, p);
    case linkPreviewTypeLiveStory::ID:
      return linkPreviewTypeLiveStory::fetch(env, p);
    case linkPreviewTypeMessage::ID:
      return linkPreviewTypeMessage::fetch(env, p);
    case linkPreviewTypePhoto::ID:
      return linkPreviewTypePhoto::fetch(env, p);
    case linkPreviewTypePremiumGiftCode::ID:
      return linkPreviewTypePremiumGiftCode::fetch(env, p);
    case linkPreviewTypeRequestManagedBot::ID:
      return linkPreviewTypeRequestManagedBot::fetch(env, p);
    case linkPreviewTypeShareableChatFolder::ID:
      return linkPreviewTypeShareableChatFolder::fetch(env, p);
    case linkPreviewTypeSticker::ID:
      return linkPreviewTypeSticker::fetch(env, p);
    case linkPreviewTypeStickerSet::ID:
      return linkPreviewTypeStickerSet::fetch(env, p);
    case linkPreviewTypeStory::ID:
      return linkPreviewTypeStory::fetch(env, p);
    case linkPreviewTypeStoryAlbum::ID:
      return linkPreviewTypeStoryAlbum::fetch(env, p);
    case linkPreviewTypeSupergroupBoost::ID:
      return linkPreviewTypeSupergroupBoost::fetch(env, p);
    case linkPreviewTypeTextCompositionStyle::ID:
      return linkPreviewTypeTextCompositionStyle::fetch(env, p);
    case linkPreviewTypeTheme::ID:
      return linkPreviewTypeTheme::fetch(env, p);
    case linkPreviewTypeUnsupported::ID:
      return linkPreviewTypeUnsupported::fetch(env, p);
    case linkPreviewTypeUpgradedGift::ID:
      return linkPreviewTypeUpgradedGift::fetch(env, p);
    case linkPreviewTypeUser::ID:
      return linkPreviewTypeUser::fetch(env, p);
    case linkPreviewTypeVideo::ID:
      return linkPreviewTypeVideo::fetch(env, p);
    case linkPreviewTypeVideoChat::ID:
      return linkPreviewTypeVideoChat::fetch(env, p);
    case linkPreviewTypeVideoNote::ID:
      return linkPreviewTypeVideoNote::fetch(env, p);
    case linkPreviewTypeVoiceNote::ID:
      return linkPreviewTypeVoiceNote::fetch(env, p);
    case linkPreviewTypeWebApp::ID:
      return linkPreviewTypeWebApp::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass linkPreviewTypeAlbum::Class;
jfieldID linkPreviewTypeAlbum::media_fieldID;
jfieldID linkPreviewTypeAlbum::caption_fieldID;

linkPreviewTypeAlbum::linkPreviewTypeAlbum()
  : media_()
  , caption_()
{}

linkPreviewTypeAlbum::linkPreviewTypeAlbum(array<object_ptr<LinkPreviewAlbumMedia>> &&media_, string const &caption_)
  : media_(std::move(media_))
  , caption_(caption_)
{}

const std::int32_t linkPreviewTypeAlbum::ID;

object_ptr<LinkPreviewType> linkPreviewTypeAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeAlbum> res = make_object<linkPreviewTypeAlbum>();
  res->media_ = jni::FetchVector<LinkPreviewAlbumMedia>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->media_fieldID));
  res->caption_ = jni::fetch_string(env, p, res->caption_fieldID);
  return std::move(res);
}

void linkPreviewTypeAlbum::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, media_); if (arr_tmp_) { env->SetObjectField(s, media_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, caption_); if (nextString) { env->SetObjectField(s, caption_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

void linkPreviewTypeAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeAlbum").c_str());
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$LinkPreviewAlbumMedia;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeAnimation::Class;
jfieldID linkPreviewTypeAnimation::animation_fieldID;

linkPreviewTypeAnimation::linkPreviewTypeAnimation()
  : animation_()
{}

linkPreviewTypeAnimation::linkPreviewTypeAnimation(object_ptr<animation> &&animation_)
  : animation_(std::move(animation_))
{}

const std::int32_t linkPreviewTypeAnimation::ID;

object_ptr<LinkPreviewType> linkPreviewTypeAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeAnimation> res = make_object<linkPreviewTypeAnimation>();
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  return std::move(res);
}

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

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

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

linkPreviewTypeApp::linkPreviewTypeApp()
  : photo_()
{}

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

const std::int32_t linkPreviewTypeApp::ID;

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

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

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

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

jclass linkPreviewTypeArticle::Class;
jfieldID linkPreviewTypeArticle::photo_fieldID;

linkPreviewTypeArticle::linkPreviewTypeArticle()
  : photo_()
{}

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

const std::int32_t linkPreviewTypeArticle::ID;

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

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

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

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

jclass linkPreviewTypeAudio::Class;
jfieldID linkPreviewTypeAudio::audio_fieldID;

linkPreviewTypeAudio::linkPreviewTypeAudio()
  : audio_()
{}

linkPreviewTypeAudio::linkPreviewTypeAudio(object_ptr<audio> &&audio_)
  : audio_(std::move(audio_))
{}

const std::int32_t linkPreviewTypeAudio::ID;

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

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

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

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

jclass linkPreviewTypeBackground::Class;
jfieldID linkPreviewTypeBackground::document_fieldID;
jfieldID linkPreviewTypeBackground::background_type_fieldID;

linkPreviewTypeBackground::linkPreviewTypeBackground()
  : document_()
  , background_type_()
{}

linkPreviewTypeBackground::linkPreviewTypeBackground(object_ptr<document> &&document_, object_ptr<BackgroundType> &&background_type_)
  : document_(std::move(document_))
  , background_type_(std::move(background_type_))
{}

const std::int32_t linkPreviewTypeBackground::ID;

object_ptr<LinkPreviewType> linkPreviewTypeBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeBackground> res = make_object<linkPreviewTypeBackground>();
  res->document_ = jni::fetch_tl_object<document>(env, jni::fetch_object(env, p, res->document_fieldID));
  res->background_type_ = jni::fetch_tl_object<BackgroundType>(env, jni::fetch_object(env, p, res->background_type_fieldID));
  return std::move(res);
}

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

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

void linkPreviewTypeBackground::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeBackground").c_str());
    document_fieldID = jni::get_field_id(env, Class, "document", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Document;").c_str());
    background_type_fieldID = jni::get_field_id(env, Class, "backgroundType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BackgroundType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeChannelBoost::Class;
jfieldID linkPreviewTypeChannelBoost::photo_fieldID;

linkPreviewTypeChannelBoost::linkPreviewTypeChannelBoost()
  : photo_()
{}

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

const std::int32_t linkPreviewTypeChannelBoost::ID;

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

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

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

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

jclass linkPreviewTypeChat::Class;
jfieldID linkPreviewTypeChat::type_fieldID;
jfieldID linkPreviewTypeChat::photo_fieldID;
jfieldID linkPreviewTypeChat::creates_join_request_fieldID;

linkPreviewTypeChat::linkPreviewTypeChat()
  : type_()
  , photo_()
  , creates_join_request_()
{}

linkPreviewTypeChat::linkPreviewTypeChat(object_ptr<InviteLinkChatType> &&type_, object_ptr<chatPhoto> &&photo_, bool creates_join_request_)
  : type_(std::move(type_))
  , photo_(std::move(photo_))
  , creates_join_request_(creates_join_request_)
{}

const std::int32_t linkPreviewTypeChat::ID;

object_ptr<LinkPreviewType> linkPreviewTypeChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeChat> res = make_object<linkPreviewTypeChat>();
  res->type_ = jni::fetch_tl_object<InviteLinkChatType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->creates_join_request_ = (env->GetBooleanField(p, res->creates_join_request_fieldID) != 0);
  return std::move(res);
}

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

void linkPreviewTypeChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeChat");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("createsJoinRequest", creates_join_request_);
    s.store_class_end();
  }
}

void linkPreviewTypeChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeChat").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InviteLinkChatType;").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    creates_join_request_fieldID = jni::get_field_id(env, Class, "createsJoinRequest", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeDirectMessagesChat::Class;
jfieldID linkPreviewTypeDirectMessagesChat::photo_fieldID;

linkPreviewTypeDirectMessagesChat::linkPreviewTypeDirectMessagesChat()
  : photo_()
{}

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

const std::int32_t linkPreviewTypeDirectMessagesChat::ID;

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

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

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

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

jclass linkPreviewTypeDocument::Class;
jfieldID linkPreviewTypeDocument::document_fieldID;

linkPreviewTypeDocument::linkPreviewTypeDocument()
  : document_()
{}

linkPreviewTypeDocument::linkPreviewTypeDocument(object_ptr<document> &&document_)
  : document_(std::move(document_))
{}

const std::int32_t linkPreviewTypeDocument::ID;

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

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

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

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

jclass linkPreviewTypeEmbeddedAnimationPlayer::Class;
jfieldID linkPreviewTypeEmbeddedAnimationPlayer::url_fieldID;
jfieldID linkPreviewTypeEmbeddedAnimationPlayer::animation_fieldID;
jfieldID linkPreviewTypeEmbeddedAnimationPlayer::thumbnail_fieldID;
jfieldID linkPreviewTypeEmbeddedAnimationPlayer::duration_fieldID;
jfieldID linkPreviewTypeEmbeddedAnimationPlayer::width_fieldID;
jfieldID linkPreviewTypeEmbeddedAnimationPlayer::height_fieldID;

linkPreviewTypeEmbeddedAnimationPlayer::linkPreviewTypeEmbeddedAnimationPlayer()
  : url_()
  , animation_()
  , thumbnail_()
  , duration_()
  , width_()
  , height_()
{}

linkPreviewTypeEmbeddedAnimationPlayer::linkPreviewTypeEmbeddedAnimationPlayer(string const &url_, object_ptr<animation> &&animation_, object_ptr<photo> &&thumbnail_, int32 duration_, int32 width_, int32 height_)
  : url_(url_)
  , animation_(std::move(animation_))
  , thumbnail_(std::move(thumbnail_))
  , duration_(duration_)
  , width_(width_)
  , height_(height_)
{}

const std::int32_t linkPreviewTypeEmbeddedAnimationPlayer::ID;

object_ptr<LinkPreviewType> linkPreviewTypeEmbeddedAnimationPlayer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeEmbeddedAnimationPlayer> res = make_object<linkPreviewTypeEmbeddedAnimationPlayer>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  return std::move(res);
}

void linkPreviewTypeEmbeddedAnimationPlayer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
}

void linkPreviewTypeEmbeddedAnimationPlayer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeEmbeddedAnimationPlayer");
    s.store_field("url", url_);
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_class_end();
  }
}

void linkPreviewTypeEmbeddedAnimationPlayer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeEmbeddedAnimationPlayer").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeEmbeddedAudioPlayer::Class;
jfieldID linkPreviewTypeEmbeddedAudioPlayer::url_fieldID;
jfieldID linkPreviewTypeEmbeddedAudioPlayer::audio_fieldID;
jfieldID linkPreviewTypeEmbeddedAudioPlayer::thumbnail_fieldID;
jfieldID linkPreviewTypeEmbeddedAudioPlayer::duration_fieldID;
jfieldID linkPreviewTypeEmbeddedAudioPlayer::width_fieldID;
jfieldID linkPreviewTypeEmbeddedAudioPlayer::height_fieldID;

linkPreviewTypeEmbeddedAudioPlayer::linkPreviewTypeEmbeddedAudioPlayer()
  : url_()
  , audio_()
  , thumbnail_()
  , duration_()
  , width_()
  , height_()
{}

linkPreviewTypeEmbeddedAudioPlayer::linkPreviewTypeEmbeddedAudioPlayer(string const &url_, object_ptr<audio> &&audio_, object_ptr<photo> &&thumbnail_, int32 duration_, int32 width_, int32 height_)
  : url_(url_)
  , audio_(std::move(audio_))
  , thumbnail_(std::move(thumbnail_))
  , duration_(duration_)
  , width_(width_)
  , height_(height_)
{}

const std::int32_t linkPreviewTypeEmbeddedAudioPlayer::ID;

object_ptr<LinkPreviewType> linkPreviewTypeEmbeddedAudioPlayer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeEmbeddedAudioPlayer> res = make_object<linkPreviewTypeEmbeddedAudioPlayer>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->audio_ = jni::fetch_tl_object<audio>(env, jni::fetch_object(env, p, res->audio_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  return std::move(res);
}

void linkPreviewTypeEmbeddedAudioPlayer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (audio_ != nullptr) { jobject next; audio_->store(env, next); if (next) { env->SetObjectField(s, audio_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
}

void linkPreviewTypeEmbeddedAudioPlayer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeEmbeddedAudioPlayer");
    s.store_field("url", url_);
    s.store_object_field("audio", static_cast<const BaseObject *>(audio_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_class_end();
  }
}

void linkPreviewTypeEmbeddedAudioPlayer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeEmbeddedAudioPlayer").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    audio_fieldID = jni::get_field_id(env, Class, "audio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Audio;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeEmbeddedVideoPlayer::Class;
jfieldID linkPreviewTypeEmbeddedVideoPlayer::url_fieldID;
jfieldID linkPreviewTypeEmbeddedVideoPlayer::video_fieldID;
jfieldID linkPreviewTypeEmbeddedVideoPlayer::thumbnail_fieldID;
jfieldID linkPreviewTypeEmbeddedVideoPlayer::duration_fieldID;
jfieldID linkPreviewTypeEmbeddedVideoPlayer::width_fieldID;
jfieldID linkPreviewTypeEmbeddedVideoPlayer::height_fieldID;

linkPreviewTypeEmbeddedVideoPlayer::linkPreviewTypeEmbeddedVideoPlayer()
  : url_()
  , video_()
  , thumbnail_()
  , duration_()
  , width_()
  , height_()
{}

linkPreviewTypeEmbeddedVideoPlayer::linkPreviewTypeEmbeddedVideoPlayer(string const &url_, object_ptr<video> &&video_, object_ptr<photo> &&thumbnail_, int32 duration_, int32 width_, int32 height_)
  : url_(url_)
  , video_(std::move(video_))
  , thumbnail_(std::move(thumbnail_))
  , duration_(duration_)
  , width_(width_)
  , height_(height_)
{}

const std::int32_t linkPreviewTypeEmbeddedVideoPlayer::ID;

object_ptr<LinkPreviewType> linkPreviewTypeEmbeddedVideoPlayer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeEmbeddedVideoPlayer> res = make_object<linkPreviewTypeEmbeddedVideoPlayer>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  return std::move(res);
}

void linkPreviewTypeEmbeddedVideoPlayer::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
}

void linkPreviewTypeEmbeddedVideoPlayer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeEmbeddedVideoPlayer");
    s.store_field("url", url_);
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_class_end();
  }
}

void linkPreviewTypeEmbeddedVideoPlayer::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeEmbeddedVideoPlayer").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeExternalAudio::Class;
jfieldID linkPreviewTypeExternalAudio::url_fieldID;
jfieldID linkPreviewTypeExternalAudio::mime_type_fieldID;
jfieldID linkPreviewTypeExternalAudio::duration_fieldID;

linkPreviewTypeExternalAudio::linkPreviewTypeExternalAudio()
  : url_()
  , mime_type_()
  , duration_()
{}

linkPreviewTypeExternalAudio::linkPreviewTypeExternalAudio(string const &url_, string const &mime_type_, int32 duration_)
  : url_(url_)
  , mime_type_(mime_type_)
  , duration_(duration_)
{}

const std::int32_t linkPreviewTypeExternalAudio::ID;

object_ptr<LinkPreviewType> linkPreviewTypeExternalAudio::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeExternalAudio> res = make_object<linkPreviewTypeExternalAudio>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  return std::move(res);
}

void linkPreviewTypeExternalAudio::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, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, duration_fieldID, duration_);
}

void linkPreviewTypeExternalAudio::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeExternalAudio");
    s.store_field("url", url_);
    s.store_field("mimeType", mime_type_);
    s.store_field("duration", duration_);
    s.store_class_end();
  }
}

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

jclass linkPreviewTypeExternalVideo::Class;
jfieldID linkPreviewTypeExternalVideo::url_fieldID;
jfieldID linkPreviewTypeExternalVideo::mime_type_fieldID;
jfieldID linkPreviewTypeExternalVideo::width_fieldID;
jfieldID linkPreviewTypeExternalVideo::height_fieldID;
jfieldID linkPreviewTypeExternalVideo::duration_fieldID;

linkPreviewTypeExternalVideo::linkPreviewTypeExternalVideo()
  : url_()
  , mime_type_()
  , width_()
  , height_()
  , duration_()
{}

linkPreviewTypeExternalVideo::linkPreviewTypeExternalVideo(string const &url_, string const &mime_type_, int32 width_, int32 height_, int32 duration_)
  : url_(url_)
  , mime_type_(mime_type_)
  , width_(width_)
  , height_(height_)
  , duration_(duration_)
{}

const std::int32_t linkPreviewTypeExternalVideo::ID;

object_ptr<LinkPreviewType> linkPreviewTypeExternalVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeExternalVideo> res = make_object<linkPreviewTypeExternalVideo>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  return std::move(res);
}

void linkPreviewTypeExternalVideo::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, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  env->SetIntField(s, duration_fieldID, duration_);
}

void linkPreviewTypeExternalVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeExternalVideo");
    s.store_field("url", url_);
    s.store_field("mimeType", mime_type_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("duration", duration_);
    s.store_class_end();
  }
}

void linkPreviewTypeExternalVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeExternalVideo").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    mime_type_fieldID = jni::get_field_id(env, Class, "mimeType", "Ljava/lang/String;");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeGiftAuction::Class;
jfieldID linkPreviewTypeGiftAuction::gift_fieldID;
jfieldID linkPreviewTypeGiftAuction::auction_end_date_fieldID;

linkPreviewTypeGiftAuction::linkPreviewTypeGiftAuction()
  : gift_()
  , auction_end_date_()
{}

linkPreviewTypeGiftAuction::linkPreviewTypeGiftAuction(object_ptr<gift> &&gift_, int32 auction_end_date_)
  : gift_(std::move(gift_))
  , auction_end_date_(auction_end_date_)
{}

const std::int32_t linkPreviewTypeGiftAuction::ID;

object_ptr<LinkPreviewType> linkPreviewTypeGiftAuction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeGiftAuction> res = make_object<linkPreviewTypeGiftAuction>();
  res->gift_ = jni::fetch_tl_object<gift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->auction_end_date_ = env->GetIntField(p, res->auction_end_date_fieldID);
  return std::move(res);
}

void linkPreviewTypeGiftAuction::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); } }
  env->SetIntField(s, auction_end_date_fieldID, auction_end_date_);
}

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

void linkPreviewTypeGiftAuction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeGiftAuction").c_str());
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Gift;").c_str());
    auction_end_date_fieldID = jni::get_field_id(env, Class, "auctionEndDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeGiftCollection::Class;
jfieldID linkPreviewTypeGiftCollection::icons_fieldID;

linkPreviewTypeGiftCollection::linkPreviewTypeGiftCollection()
  : icons_()
{}

linkPreviewTypeGiftCollection::linkPreviewTypeGiftCollection(array<object_ptr<sticker>> &&icons_)
  : icons_(std::move(icons_))
{}

const std::int32_t linkPreviewTypeGiftCollection::ID;

object_ptr<LinkPreviewType> linkPreviewTypeGiftCollection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeGiftCollection> res = make_object<linkPreviewTypeGiftCollection>();
  res->icons_ = jni::FetchVector<sticker>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->icons_fieldID));
  return std::move(res);
}

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

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

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

jclass linkPreviewTypeGroupCall::Class;

linkPreviewTypeGroupCall::linkPreviewTypeGroupCall() {
}

const std::int32_t linkPreviewTypeGroupCall::ID;

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

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

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

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

jclass linkPreviewTypeInvoice::Class;

linkPreviewTypeInvoice::linkPreviewTypeInvoice() {
}

const std::int32_t linkPreviewTypeInvoice::ID;

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

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

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

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

jclass linkPreviewTypeLiveStory::Class;
jfieldID linkPreviewTypeLiveStory::story_poster_chat_id_fieldID;
jfieldID linkPreviewTypeLiveStory::story_id_fieldID;

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

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

const std::int32_t linkPreviewTypeLiveStory::ID;

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

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

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

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

jclass linkPreviewTypeMessage::Class;

linkPreviewTypeMessage::linkPreviewTypeMessage() {
}

const std::int32_t linkPreviewTypeMessage::ID;

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

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

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

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

jclass linkPreviewTypePhoto::Class;
jfieldID linkPreviewTypePhoto::photo_fieldID;

linkPreviewTypePhoto::linkPreviewTypePhoto()
  : photo_()
{}

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

const std::int32_t linkPreviewTypePhoto::ID;

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

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

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

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

jclass linkPreviewTypePremiumGiftCode::Class;

linkPreviewTypePremiumGiftCode::linkPreviewTypePremiumGiftCode() {
}

const std::int32_t linkPreviewTypePremiumGiftCode::ID;

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

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

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

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

jclass linkPreviewTypeRequestManagedBot::Class;

linkPreviewTypeRequestManagedBot::linkPreviewTypeRequestManagedBot() {
}

const std::int32_t linkPreviewTypeRequestManagedBot::ID;

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

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

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

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

jclass linkPreviewTypeShareableChatFolder::Class;

linkPreviewTypeShareableChatFolder::linkPreviewTypeShareableChatFolder() {
}

const std::int32_t linkPreviewTypeShareableChatFolder::ID;

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

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

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

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

jclass linkPreviewTypeSticker::Class;
jfieldID linkPreviewTypeSticker::sticker_fieldID;

linkPreviewTypeSticker::linkPreviewTypeSticker()
  : sticker_()
{}

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

const std::int32_t linkPreviewTypeSticker::ID;

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

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

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

linkPreviewTypeStickerSet::linkPreviewTypeStickerSet()
  : stickers_()
{}

linkPreviewTypeStickerSet::linkPreviewTypeStickerSet(array<object_ptr<sticker>> &&stickers_)
  : stickers_(std::move(stickers_))
{}

const std::int32_t linkPreviewTypeStickerSet::ID;

object_ptr<LinkPreviewType> linkPreviewTypeStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeStickerSet> res = make_object<linkPreviewTypeStickerSet>();
  res->stickers_ = jni::FetchVector<sticker>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->stickers_fieldID));
  return std::move(res);
}

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

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

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

jclass linkPreviewTypeStory::Class;
jfieldID linkPreviewTypeStory::story_poster_chat_id_fieldID;
jfieldID linkPreviewTypeStory::story_id_fieldID;

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

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

const std::int32_t linkPreviewTypeStory::ID;

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

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

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

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

jclass linkPreviewTypeStoryAlbum::Class;
jfieldID linkPreviewTypeStoryAlbum::photo_icon_fieldID;
jfieldID linkPreviewTypeStoryAlbum::video_icon_fieldID;

linkPreviewTypeStoryAlbum::linkPreviewTypeStoryAlbum()
  : photo_icon_()
  , video_icon_()
{}

linkPreviewTypeStoryAlbum::linkPreviewTypeStoryAlbum(object_ptr<photo> &&photo_icon_, object_ptr<video> &&video_icon_)
  : photo_icon_(std::move(photo_icon_))
  , video_icon_(std::move(video_icon_))
{}

const std::int32_t linkPreviewTypeStoryAlbum::ID;

object_ptr<LinkPreviewType> linkPreviewTypeStoryAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeStoryAlbum> res = make_object<linkPreviewTypeStoryAlbum>();
  res->photo_icon_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_icon_fieldID));
  res->video_icon_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_icon_fieldID));
  return std::move(res);
}

void linkPreviewTypeStoryAlbum::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (photo_icon_ != nullptr) { jobject next; photo_icon_->store(env, next); if (next) { env->SetObjectField(s, photo_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_icon_ != nullptr) { jobject next; video_icon_->store(env, next); if (next) { env->SetObjectField(s, video_icon_fieldID, next); env->DeleteLocalRef(next); } }
}

void linkPreviewTypeStoryAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeStoryAlbum");
    s.store_object_field("photoIcon", static_cast<const BaseObject *>(photo_icon_.get()));
    s.store_object_field("videoIcon", static_cast<const BaseObject *>(video_icon_.get()));
    s.store_class_end();
  }
}

void linkPreviewTypeStoryAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeStoryAlbum").c_str());
    photo_icon_fieldID = jni::get_field_id(env, Class, "photoIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    video_icon_fieldID = jni::get_field_id(env, Class, "videoIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeSupergroupBoost::Class;
jfieldID linkPreviewTypeSupergroupBoost::photo_fieldID;

linkPreviewTypeSupergroupBoost::linkPreviewTypeSupergroupBoost()
  : photo_()
{}

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

const std::int32_t linkPreviewTypeSupergroupBoost::ID;

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

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

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

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

jclass linkPreviewTypeTextCompositionStyle::Class;
jfieldID linkPreviewTypeTextCompositionStyle::custom_emoji_id_fieldID;

linkPreviewTypeTextCompositionStyle::linkPreviewTypeTextCompositionStyle()
  : custom_emoji_id_()
{}

linkPreviewTypeTextCompositionStyle::linkPreviewTypeTextCompositionStyle(int64 custom_emoji_id_)
  : custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t linkPreviewTypeTextCompositionStyle::ID;

object_ptr<LinkPreviewType> linkPreviewTypeTextCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeTextCompositionStyle> res = make_object<linkPreviewTypeTextCompositionStyle>();
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  return std::move(res);
}

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

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

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

jclass linkPreviewTypeTheme::Class;
jfieldID linkPreviewTypeTheme::documents_fieldID;
jfieldID linkPreviewTypeTheme::settings_fieldID;

linkPreviewTypeTheme::linkPreviewTypeTheme()
  : documents_()
  , settings_()
{}

linkPreviewTypeTheme::linkPreviewTypeTheme(array<object_ptr<document>> &&documents_, object_ptr<themeSettings> &&settings_)
  : documents_(std::move(documents_))
  , settings_(std::move(settings_))
{}

const std::int32_t linkPreviewTypeTheme::ID;

object_ptr<LinkPreviewType> linkPreviewTypeTheme::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeTheme> res = make_object<linkPreviewTypeTheme>();
  res->documents_ = jni::FetchVector<document>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->documents_fieldID));
  res->settings_ = jni::fetch_tl_object<themeSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return std::move(res);
}

void linkPreviewTypeTheme::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, documents_); if (arr_tmp_) { env->SetObjectField(s, documents_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (settings_ != nullptr) { jobject next; settings_->store(env, next); if (next) { env->SetObjectField(s, settings_fieldID, next); env->DeleteLocalRef(next); } }
}

void linkPreviewTypeTheme::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeTheme");
    { s.store_vector_begin("documents", documents_.size()); for (const auto &_value : documents_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("settings", static_cast<const BaseObject *>(settings_.get()));
    s.store_class_end();
  }
}

void linkPreviewTypeTheme::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeTheme").c_str());
    documents_fieldID = jni::get_field_id(env, Class, "documents", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Document;").c_str());
    settings_fieldID = jni::get_field_id(env, Class, "settings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ThemeSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeUnsupported::Class;

linkPreviewTypeUnsupported::linkPreviewTypeUnsupported() {
}

const std::int32_t linkPreviewTypeUnsupported::ID;

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

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

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

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

jclass linkPreviewTypeUpgradedGift::Class;
jfieldID linkPreviewTypeUpgradedGift::gift_fieldID;

linkPreviewTypeUpgradedGift::linkPreviewTypeUpgradedGift()
  : gift_()
{}

linkPreviewTypeUpgradedGift::linkPreviewTypeUpgradedGift(object_ptr<upgradedGift> &&gift_)
  : gift_(std::move(gift_))
{}

const std::int32_t linkPreviewTypeUpgradedGift::ID;

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

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

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

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

jclass linkPreviewTypeUser::Class;
jfieldID linkPreviewTypeUser::photo_fieldID;
jfieldID linkPreviewTypeUser::is_bot_fieldID;

linkPreviewTypeUser::linkPreviewTypeUser()
  : photo_()
  , is_bot_()
{}

linkPreviewTypeUser::linkPreviewTypeUser(object_ptr<chatPhoto> &&photo_, bool is_bot_)
  : photo_(std::move(photo_))
  , is_bot_(is_bot_)
{}

const std::int32_t linkPreviewTypeUser::ID;

object_ptr<LinkPreviewType> linkPreviewTypeUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeUser> res = make_object<linkPreviewTypeUser>();
  res->photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->is_bot_ = (env->GetBooleanField(p, res->is_bot_fieldID) != 0);
  return std::move(res);
}

void linkPreviewTypeUser::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); } }
  env->SetBooleanField(s, is_bot_fieldID, is_bot_);
}

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

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

jclass linkPreviewTypeVideo::Class;
jfieldID linkPreviewTypeVideo::video_fieldID;
jfieldID linkPreviewTypeVideo::cover_fieldID;
jfieldID linkPreviewTypeVideo::start_timestamp_fieldID;

linkPreviewTypeVideo::linkPreviewTypeVideo()
  : video_()
  , cover_()
  , start_timestamp_()
{}

linkPreviewTypeVideo::linkPreviewTypeVideo(object_ptr<video> &&video_, object_ptr<photo> &&cover_, int32 start_timestamp_)
  : video_(std::move(video_))
  , cover_(std::move(cover_))
  , start_timestamp_(start_timestamp_)
{}

const std::int32_t linkPreviewTypeVideo::ID;

object_ptr<LinkPreviewType> linkPreviewTypeVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeVideo> res = make_object<linkPreviewTypeVideo>();
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->cover_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->cover_fieldID));
  res->start_timestamp_ = env->GetIntField(p, res->start_timestamp_fieldID);
  return std::move(res);
}

void linkPreviewTypeVideo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
  if (cover_ != nullptr) { jobject next; cover_->store(env, next); if (next) { env->SetObjectField(s, cover_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, start_timestamp_fieldID, start_timestamp_);
}

void linkPreviewTypeVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_object_field("cover", static_cast<const BaseObject *>(cover_.get()));
    s.store_field("startTimestamp", start_timestamp_);
    s.store_class_end();
  }
}

void linkPreviewTypeVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewTypeVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    cover_fieldID = jni::get_field_id(env, Class, "cover", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    start_timestamp_fieldID = jni::get_field_id(env, Class, "startTimestamp", "I");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewTypeVideoChat::Class;
jfieldID linkPreviewTypeVideoChat::photo_fieldID;
jfieldID linkPreviewTypeVideoChat::is_live_stream_fieldID;
jfieldID linkPreviewTypeVideoChat::joins_as_speaker_fieldID;

linkPreviewTypeVideoChat::linkPreviewTypeVideoChat()
  : photo_()
  , is_live_stream_()
  , joins_as_speaker_()
{}

linkPreviewTypeVideoChat::linkPreviewTypeVideoChat(object_ptr<chatPhoto> &&photo_, bool is_live_stream_, bool joins_as_speaker_)
  : photo_(std::move(photo_))
  , is_live_stream_(is_live_stream_)
  , joins_as_speaker_(joins_as_speaker_)
{}

const std::int32_t linkPreviewTypeVideoChat::ID;

object_ptr<LinkPreviewType> linkPreviewTypeVideoChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeVideoChat> res = make_object<linkPreviewTypeVideoChat>();
  res->photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->is_live_stream_ = (env->GetBooleanField(p, res->is_live_stream_fieldID) != 0);
  res->joins_as_speaker_ = (env->GetBooleanField(p, res->joins_as_speaker_fieldID) != 0);
  return std::move(res);
}

void linkPreviewTypeVideoChat::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); } }
  env->SetBooleanField(s, is_live_stream_fieldID, is_live_stream_);
  env->SetBooleanField(s, joins_as_speaker_fieldID, joins_as_speaker_);
}

void linkPreviewTypeVideoChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeVideoChat");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("isLiveStream", is_live_stream_);
    s.store_field("joinsAsSpeaker", joins_as_speaker_);
    s.store_class_end();
  }
}

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

jclass linkPreviewTypeVideoNote::Class;
jfieldID linkPreviewTypeVideoNote::video_note_fieldID;

linkPreviewTypeVideoNote::linkPreviewTypeVideoNote()
  : video_note_()
{}

linkPreviewTypeVideoNote::linkPreviewTypeVideoNote(object_ptr<videoNote> &&video_note_)
  : video_note_(std::move(video_note_))
{}

const std::int32_t linkPreviewTypeVideoNote::ID;

object_ptr<LinkPreviewType> linkPreviewTypeVideoNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeVideoNote> res = make_object<linkPreviewTypeVideoNote>();
  res->video_note_ = jni::fetch_tl_object<videoNote>(env, jni::fetch_object(env, p, res->video_note_fieldID));
  return std::move(res);
}

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

void linkPreviewTypeVideoNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeVideoNote");
    s.store_object_field("videoNote", static_cast<const BaseObject *>(video_note_.get()));
    s.store_class_end();
  }
}

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

jclass linkPreviewTypeVoiceNote::Class;
jfieldID linkPreviewTypeVoiceNote::voice_note_fieldID;

linkPreviewTypeVoiceNote::linkPreviewTypeVoiceNote()
  : voice_note_()
{}

linkPreviewTypeVoiceNote::linkPreviewTypeVoiceNote(object_ptr<voiceNote> &&voice_note_)
  : voice_note_(std::move(voice_note_))
{}

const std::int32_t linkPreviewTypeVoiceNote::ID;

object_ptr<LinkPreviewType> linkPreviewTypeVoiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewTypeVoiceNote> res = make_object<linkPreviewTypeVoiceNote>();
  res->voice_note_ = jni::fetch_tl_object<voiceNote>(env, jni::fetch_object(env, p, res->voice_note_fieldID));
  return std::move(res);
}

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

void linkPreviewTypeVoiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewTypeVoiceNote");
    s.store_object_field("voiceNote", static_cast<const BaseObject *>(voice_note_.get()));
    s.store_class_end();
  }
}

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

jclass linkPreviewTypeWebApp::Class;
jfieldID linkPreviewTypeWebApp::photo_fieldID;

linkPreviewTypeWebApp::linkPreviewTypeWebApp()
  : photo_()
{}

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

const std::int32_t linkPreviewTypeWebApp::ID;

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

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

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

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

jclass location::Class;
jfieldID location::latitude_fieldID;
jfieldID location::longitude_fieldID;
jfieldID location::horizontal_accuracy_fieldID;

location::location()
  : latitude_()
  , longitude_()
  , horizontal_accuracy_()
{}

location::location(double latitude_, double longitude_, double horizontal_accuracy_)
  : latitude_(latitude_)
  , longitude_(longitude_)
  , horizontal_accuracy_(horizontal_accuracy_)
{}

const std::int32_t location::ID;

object_ptr<location> location::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<location> res = make_object<location>();
  res->latitude_ = env->GetDoubleField(p, res->latitude_fieldID);
  res->longitude_ = env->GetDoubleField(p, res->longitude_fieldID);
  res->horizontal_accuracy_ = env->GetDoubleField(p, res->horizontal_accuracy_fieldID);
  return res;
}

void location::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetDoubleField(s, latitude_fieldID, latitude_);
  env->SetDoubleField(s, longitude_fieldID, longitude_);
  env->SetDoubleField(s, horizontal_accuracy_fieldID, horizontal_accuracy_);
}

void location::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Location");
    s.store_field("latitude", latitude_);
    s.store_field("longitude", longitude_);
    s.store_field("horizontalAccuracy", horizontal_accuracy_);
    s.store_class_end();
  }
}

void location::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Location").c_str());
    latitude_fieldID = jni::get_field_id(env, Class, "latitude", "D");
    longitude_fieldID = jni::get_field_id(env, Class, "longitude", "D");
    horizontal_accuracy_fieldID = jni::get_field_id(env, Class, "horizontalAccuracy", "D");
    return true;
  }();
  (void)is_inited;
}

jclass messageReaction::Class;
jfieldID messageReaction::type_fieldID;
jfieldID messageReaction::total_count_fieldID;
jfieldID messageReaction::is_chosen_fieldID;
jfieldID messageReaction::used_sender_id_fieldID;
jfieldID messageReaction::recent_sender_ids_fieldID;

messageReaction::messageReaction()
  : type_()
  , total_count_()
  , is_chosen_()
  , used_sender_id_()
  , recent_sender_ids_()
{}

messageReaction::messageReaction(object_ptr<ReactionType> &&type_, int32 total_count_, bool is_chosen_, object_ptr<MessageSender> &&used_sender_id_, array<object_ptr<MessageSender>> &&recent_sender_ids_)
  : type_(std::move(type_))
  , total_count_(total_count_)
  , is_chosen_(is_chosen_)
  , used_sender_id_(std::move(used_sender_id_))
  , recent_sender_ids_(std::move(recent_sender_ids_))
{}

const std::int32_t messageReaction::ID;

object_ptr<messageReaction> messageReaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageReaction> res = make_object<messageReaction>();
  res->type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->is_chosen_ = (env->GetBooleanField(p, res->is_chosen_fieldID) != 0);
  res->used_sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->used_sender_id_fieldID));
  res->recent_sender_ids_ = jni::FetchVector<MessageSender>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->recent_sender_ids_fieldID));
  return res;
}

void messageReaction::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->SetIntField(s, total_count_fieldID, total_count_);
  env->SetBooleanField(s, is_chosen_fieldID, is_chosen_);
  if (used_sender_id_ != nullptr) { jobject next; used_sender_id_->store(env, next); if (next) { env->SetObjectField(s, used_sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, recent_sender_ids_); if (arr_tmp_) { env->SetObjectField(s, recent_sender_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void messageReaction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageReaction");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("totalCount", total_count_);
    s.store_field("isChosen", is_chosen_);
    s.store_object_field("usedSenderId", static_cast<const BaseObject *>(used_sender_id_.get()));
    { s.store_vector_begin("recentSenderIds", recent_sender_ids_.size()); for (const auto &_value : recent_sender_ids_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void messageReaction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageReaction").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    is_chosen_fieldID = jni::get_field_id(env, Class, "isChosen", "Z");
    used_sender_id_fieldID = jni::get_field_id(env, Class, "usedSenderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    recent_sender_ids_fieldID = jni::get_field_id(env, Class, "recentSenderIds", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass MessageSelfDestructType::Class;

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

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

jclass messageSelfDestructTypeTimer::Class;
jfieldID messageSelfDestructTypeTimer::self_destruct_time_fieldID;

messageSelfDestructTypeTimer::messageSelfDestructTypeTimer()
  : self_destruct_time_()
{}

messageSelfDestructTypeTimer::messageSelfDestructTypeTimer(int32 self_destruct_time_)
  : self_destruct_time_(self_destruct_time_)
{}

const std::int32_t messageSelfDestructTypeTimer::ID;

object_ptr<MessageSelfDestructType> messageSelfDestructTypeTimer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageSelfDestructTypeTimer> res = make_object<messageSelfDestructTypeTimer>();
  res->self_destruct_time_ = env->GetIntField(p, res->self_destruct_time_fieldID);
  return std::move(res);
}

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

void messageSelfDestructTypeTimer::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageSelfDestructTypeTimer");
    s.store_field("selfDestructTime", self_destruct_time_);
    s.store_class_end();
  }
}

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

jclass messageSelfDestructTypeImmediately::Class;

messageSelfDestructTypeImmediately::messageSelfDestructTypeImmediately() {
}

const std::int32_t messageSelfDestructTypeImmediately::ID;

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

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

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

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

jclass messages::Class;
jfieldID messages::total_count_fieldID;
jfieldID messages::messages_fieldID;

messages::messages()
  : total_count_()
  , messages_()
{}

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

const std::int32_t messages::ID;

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

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

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

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

jclass NetworkType::Class;

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

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

jclass networkTypeNone::Class;

networkTypeNone::networkTypeNone() {
}

const std::int32_t networkTypeNone::ID;

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

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

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

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

jclass networkTypeMobile::Class;

networkTypeMobile::networkTypeMobile() {
}

const std::int32_t networkTypeMobile::ID;

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

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

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

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

jclass networkTypeMobileRoaming::Class;

networkTypeMobileRoaming::networkTypeMobileRoaming() {
}

const std::int32_t networkTypeMobileRoaming::ID;

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

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

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

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

jclass networkTypeWiFi::Class;

networkTypeWiFi::networkTypeWiFi() {
}

const std::int32_t networkTypeWiFi::ID;

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

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

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

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

jclass networkTypeOther::Class;

networkTypeOther::networkTypeOther() {
}

const std::int32_t networkTypeOther::ID;

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

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

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

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

jclass pageBlockListItem::Class;
jfieldID pageBlockListItem::label_fieldID;
jfieldID pageBlockListItem::page_blocks_fieldID;

pageBlockListItem::pageBlockListItem()
  : label_()
  , page_blocks_()
{}

pageBlockListItem::pageBlockListItem(string const &label_, array<object_ptr<PageBlock>> &&page_blocks_)
  : label_(label_)
  , page_blocks_(std::move(page_blocks_))
{}

const std::int32_t pageBlockListItem::ID;

object_ptr<pageBlockListItem> pageBlockListItem::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockListItem> res = make_object<pageBlockListItem>();
  res->label_ = jni::fetch_string(env, p, res->label_fieldID);
  res->page_blocks_ = jni::FetchVector<PageBlock>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->page_blocks_fieldID));
  return res;
}

void pageBlockListItem::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, label_); if (nextString) { env->SetObjectField(s, label_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, page_blocks_); if (arr_tmp_) { env->SetObjectField(s, page_blocks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void pageBlockListItem::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockListItem");
    s.store_field("label", label_);
    { s.store_vector_begin("pageBlocks", page_blocks_.size()); for (const auto &_value : page_blocks_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void pageBlockListItem::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockListItem").c_str());
    label_fieldID = jni::get_field_id(env, Class, "label", "Ljava/lang/String;");
    page_blocks_fieldID = jni::get_field_id(env, Class, "pageBlocks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlock;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockRelatedArticle::Class;
jfieldID pageBlockRelatedArticle::url_fieldID;
jfieldID pageBlockRelatedArticle::title_fieldID;
jfieldID pageBlockRelatedArticle::description_fieldID;
jfieldID pageBlockRelatedArticle::photo_fieldID;
jfieldID pageBlockRelatedArticle::author_fieldID;
jfieldID pageBlockRelatedArticle::publish_date_fieldID;

pageBlockRelatedArticle::pageBlockRelatedArticle()
  : url_()
  , title_()
  , description_()
  , photo_()
  , author_()
  , publish_date_()
{}

pageBlockRelatedArticle::pageBlockRelatedArticle(string const &url_, string const &title_, string const &description_, object_ptr<photo> &&photo_, string const &author_, int32 publish_date_)
  : url_(url_)
  , title_(title_)
  , description_(description_)
  , photo_(std::move(photo_))
  , author_(author_)
  , publish_date_(publish_date_)
{}

const std::int32_t pageBlockRelatedArticle::ID;

object_ptr<pageBlockRelatedArticle> pageBlockRelatedArticle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockRelatedArticle> res = make_object<pageBlockRelatedArticle>();
  res->url_ = jni::fetch_string(env, p, res->url_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->author_ = jni::fetch_string(env, p, res->author_fieldID);
  res->publish_date_ = env->GetIntField(p, res->publish_date_fieldID);
  return res;
}

void pageBlockRelatedArticle::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, 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); } }
  { jstring nextString = jni::to_jstring(env, author_); if (nextString) { env->SetObjectField(s, author_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, publish_date_fieldID, publish_date_);
}

void pageBlockRelatedArticle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockRelatedArticle");
    s.store_field("url", url_);
    s.store_field("title", title_);
    s.store_field("description", description_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("author", author_);
    s.store_field("publishDate", publish_date_);
    s.store_class_end();
  }
}

void pageBlockRelatedArticle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockRelatedArticle").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "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());
    author_fieldID = jni::get_field_id(env, Class, "author", "Ljava/lang/String;");
    publish_date_fieldID = jni::get_field_id(env, Class, "publishDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass PaymentReceiptType::Class;

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

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

jclass paymentReceiptTypeRegular::Class;
jfieldID paymentReceiptTypeRegular::payment_provider_user_id_fieldID;
jfieldID paymentReceiptTypeRegular::invoice_fieldID;
jfieldID paymentReceiptTypeRegular::order_info_fieldID;
jfieldID paymentReceiptTypeRegular::shipping_option_fieldID;
jfieldID paymentReceiptTypeRegular::credentials_title_fieldID;
jfieldID paymentReceiptTypeRegular::tip_amount_fieldID;

paymentReceiptTypeRegular::paymentReceiptTypeRegular()
  : payment_provider_user_id_()
  , invoice_()
  , order_info_()
  , shipping_option_()
  , credentials_title_()
  , tip_amount_()
{}

paymentReceiptTypeRegular::paymentReceiptTypeRegular(int53 payment_provider_user_id_, object_ptr<invoice> &&invoice_, object_ptr<orderInfo> &&order_info_, object_ptr<shippingOption> &&shipping_option_, string const &credentials_title_, int53 tip_amount_)
  : payment_provider_user_id_(payment_provider_user_id_)
  , invoice_(std::move(invoice_))
  , order_info_(std::move(order_info_))
  , shipping_option_(std::move(shipping_option_))
  , credentials_title_(credentials_title_)
  , tip_amount_(tip_amount_)
{}

const std::int32_t paymentReceiptTypeRegular::ID;

object_ptr<PaymentReceiptType> paymentReceiptTypeRegular::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentReceiptTypeRegular> res = make_object<paymentReceiptTypeRegular>();
  res->payment_provider_user_id_ = env->GetLongField(p, res->payment_provider_user_id_fieldID);
  res->invoice_ = jni::fetch_tl_object<invoice>(env, jni::fetch_object(env, p, res->invoice_fieldID));
  res->order_info_ = jni::fetch_tl_object<orderInfo>(env, jni::fetch_object(env, p, res->order_info_fieldID));
  res->shipping_option_ = jni::fetch_tl_object<shippingOption>(env, jni::fetch_object(env, p, res->shipping_option_fieldID));
  res->credentials_title_ = jni::fetch_string(env, p, res->credentials_title_fieldID);
  res->tip_amount_ = env->GetLongField(p, res->tip_amount_fieldID);
  return std::move(res);
}

void paymentReceiptTypeRegular::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, payment_provider_user_id_fieldID, payment_provider_user_id_);
  if (invoice_ != nullptr) { jobject next; invoice_->store(env, next); if (next) { env->SetObjectField(s, invoice_fieldID, next); env->DeleteLocalRef(next); } }
  if (order_info_ != nullptr) { jobject next; order_info_->store(env, next); if (next) { env->SetObjectField(s, order_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (shipping_option_ != nullptr) { jobject next; shipping_option_->store(env, next); if (next) { env->SetObjectField(s, shipping_option_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, credentials_title_); if (nextString) { env->SetObjectField(s, credentials_title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, tip_amount_fieldID, tip_amount_);
}

void paymentReceiptTypeRegular::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentReceiptTypeRegular");
    s.store_field("paymentProviderUserId", payment_provider_user_id_);
    s.store_object_field("invoice", static_cast<const BaseObject *>(invoice_.get()));
    s.store_object_field("orderInfo", static_cast<const BaseObject *>(order_info_.get()));
    s.store_object_field("shippingOption", static_cast<const BaseObject *>(shipping_option_.get()));
    s.store_field("credentialsTitle", credentials_title_);
    s.store_field("tipAmount", tip_amount_);
    s.store_class_end();
  }
}

void paymentReceiptTypeRegular::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentReceiptTypeRegular").c_str());
    payment_provider_user_id_fieldID = jni::get_field_id(env, Class, "paymentProviderUserId", "J");
    invoice_fieldID = jni::get_field_id(env, Class, "invoice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Invoice;").c_str());
    order_info_fieldID = jni::get_field_id(env, Class, "orderInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$OrderInfo;").c_str());
    shipping_option_fieldID = jni::get_field_id(env, Class, "shippingOption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ShippingOption;").c_str());
    credentials_title_fieldID = jni::get_field_id(env, Class, "credentialsTitle", "Ljava/lang/String;");
    tip_amount_fieldID = jni::get_field_id(env, Class, "tipAmount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass paymentReceiptTypeStars::Class;
jfieldID paymentReceiptTypeStars::star_count_fieldID;
jfieldID paymentReceiptTypeStars::transaction_id_fieldID;

paymentReceiptTypeStars::paymentReceiptTypeStars()
  : star_count_()
  , transaction_id_()
{}

paymentReceiptTypeStars::paymentReceiptTypeStars(int53 star_count_, string const &transaction_id_)
  : star_count_(star_count_)
  , transaction_id_(transaction_id_)
{}

const std::int32_t paymentReceiptTypeStars::ID;

object_ptr<PaymentReceiptType> paymentReceiptTypeStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentReceiptTypeStars> res = make_object<paymentReceiptTypeStars>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->transaction_id_ = jni::fetch_string(env, p, res->transaction_id_fieldID);
  return std::move(res);
}

void paymentReceiptTypeStars::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, star_count_fieldID, star_count_);
  { jstring nextString = jni::to_jstring(env, transaction_id_); if (nextString) { env->SetObjectField(s, transaction_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass phoneNumberInfo::Class;
jfieldID phoneNumberInfo::country_fieldID;
jfieldID phoneNumberInfo::country_calling_code_fieldID;
jfieldID phoneNumberInfo::formatted_phone_number_fieldID;
jfieldID phoneNumberInfo::is_anonymous_fieldID;

phoneNumberInfo::phoneNumberInfo()
  : country_()
  , country_calling_code_()
  , formatted_phone_number_()
  , is_anonymous_()
{}

phoneNumberInfo::phoneNumberInfo(object_ptr<countryInfo> &&country_, string const &country_calling_code_, string const &formatted_phone_number_, bool is_anonymous_)
  : country_(std::move(country_))
  , country_calling_code_(country_calling_code_)
  , formatted_phone_number_(formatted_phone_number_)
  , is_anonymous_(is_anonymous_)
{}

const std::int32_t phoneNumberInfo::ID;

object_ptr<phoneNumberInfo> phoneNumberInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<phoneNumberInfo> res = make_object<phoneNumberInfo>();
  res->country_ = jni::fetch_tl_object<countryInfo>(env, jni::fetch_object(env, p, res->country_fieldID));
  res->country_calling_code_ = jni::fetch_string(env, p, res->country_calling_code_fieldID);
  res->formatted_phone_number_ = jni::fetch_string(env, p, res->formatted_phone_number_fieldID);
  res->is_anonymous_ = (env->GetBooleanField(p, res->is_anonymous_fieldID) != 0);
  return res;
}

void phoneNumberInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (country_ != nullptr) { jobject next; country_->store(env, next); if (next) { env->SetObjectField(s, country_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, country_calling_code_); if (nextString) { env->SetObjectField(s, country_calling_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, formatted_phone_number_); if (nextString) { env->SetObjectField(s, formatted_phone_number_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_anonymous_fieldID, is_anonymous_);
}

void phoneNumberInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PhoneNumberInfo");
    s.store_object_field("country", static_cast<const BaseObject *>(country_.get()));
    s.store_field("countryCallingCode", country_calling_code_);
    s.store_field("formattedPhoneNumber", formatted_phone_number_);
    s.store_field("isAnonymous", is_anonymous_);
    s.store_class_end();
  }
}

void phoneNumberInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PhoneNumberInfo").c_str());
    country_fieldID = jni::get_field_id(env, Class, "country", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$CountryInfo;").c_str());
    country_calling_code_fieldID = jni::get_field_id(env, Class, "countryCallingCode", "Ljava/lang/String;");
    formatted_phone_number_fieldID = jni::get_field_id(env, Class, "formattedPhoneNumber", "Ljava/lang/String;");
    is_anonymous_fieldID = jni::get_field_id(env, Class, "isAnonymous", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass photoSize::Class;
jfieldID photoSize::type_fieldID;
jfieldID photoSize::photo_fieldID;
jfieldID photoSize::width_fieldID;
jfieldID photoSize::height_fieldID;
jfieldID photoSize::progressive_sizes_fieldID;

photoSize::photoSize()
  : type_()
  , photo_()
  , width_()
  , height_()
  , progressive_sizes_()
{}

photoSize::photoSize(string const &type_, object_ptr<file> &&photo_, int32 width_, int32 height_, array<int32> &&progressive_sizes_)
  : type_(type_)
  , photo_(std::move(photo_))
  , width_(width_)
  , height_(height_)
  , progressive_sizes_(std::move(progressive_sizes_))
{}

const std::int32_t photoSize::ID;

object_ptr<photoSize> photoSize::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<photoSize> res = make_object<photoSize>();
  res->type_ = jni::fetch_string(env, p, res->type_fieldID);
  res->photo_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->progressive_sizes_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->progressive_sizes_fieldID));
  return res;
}

void photoSize::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, type_); if (nextString) { env->SetObjectField(s, type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  { auto arr_tmp_ = jni::store_vector(env, progressive_sizes_); if (arr_tmp_) { env->SetObjectField(s, progressive_sizes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void photoSize::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PhotoSize");
    s.store_field("type", type_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    { s.store_vector_begin("progressiveSizes", progressive_sizes_.size()); for (const auto &_value : progressive_sizes_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void photoSize::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PhotoSize").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    progressive_sizes_fieldID = jni::get_field_id(env, Class, "progressiveSizes", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass premiumLimit::Class;
jfieldID premiumLimit::type_fieldID;
jfieldID premiumLimit::default_value_fieldID;
jfieldID premiumLimit::premium_value_fieldID;

premiumLimit::premiumLimit()
  : type_()
  , default_value_()
  , premium_value_()
{}

premiumLimit::premiumLimit(object_ptr<PremiumLimitType> &&type_, int32 default_value_, int32 premium_value_)
  : type_(std::move(type_))
  , default_value_(default_value_)
  , premium_value_(premium_value_)
{}

const std::int32_t premiumLimit::ID;

object_ptr<premiumLimit> premiumLimit::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumLimit> res = make_object<premiumLimit>();
  res->type_ = jni::fetch_tl_object<PremiumLimitType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->default_value_ = env->GetIntField(p, res->default_value_fieldID);
  res->premium_value_ = env->GetIntField(p, res->premium_value_fieldID);
  return res;
}

void premiumLimit::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->SetIntField(s, default_value_fieldID, default_value_);
  env->SetIntField(s, premium_value_fieldID, premium_value_);
}

void premiumLimit::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumLimit");
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_field("defaultValue", default_value_);
    s.store_field("premiumValue", premium_value_);
    s.store_class_end();
  }
}

void premiumLimit::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumLimit").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PremiumLimitType;").c_str());
    default_value_fieldID = jni::get_field_id(env, Class, "defaultValue", "I");
    premium_value_fieldID = jni::get_field_id(env, Class, "premiumValue", "I");
    return true;
  }();
  (void)is_inited;
}

jclass premiumPaymentOption::Class;
jfieldID premiumPaymentOption::currency_fieldID;
jfieldID premiumPaymentOption::amount_fieldID;
jfieldID premiumPaymentOption::discount_percentage_fieldID;
jfieldID premiumPaymentOption::month_count_fieldID;
jfieldID premiumPaymentOption::store_product_id_fieldID;
jfieldID premiumPaymentOption::payment_link_fieldID;

premiumPaymentOption::premiumPaymentOption()
  : currency_()
  , amount_()
  , discount_percentage_()
  , month_count_()
  , store_product_id_()
  , payment_link_()
{}

premiumPaymentOption::premiumPaymentOption(string const &currency_, int53 amount_, int32 discount_percentage_, int32 month_count_, string const &store_product_id_, object_ptr<InternalLinkType> &&payment_link_)
  : currency_(currency_)
  , amount_(amount_)
  , discount_percentage_(discount_percentage_)
  , month_count_(month_count_)
  , store_product_id_(store_product_id_)
  , payment_link_(std::move(payment_link_))
{}

const std::int32_t premiumPaymentOption::ID;

object_ptr<premiumPaymentOption> premiumPaymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumPaymentOption> res = make_object<premiumPaymentOption>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->discount_percentage_ = env->GetIntField(p, res->discount_percentage_fieldID);
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->store_product_id_ = jni::fetch_string(env, p, res->store_product_id_fieldID);
  res->payment_link_ = jni::fetch_tl_object<InternalLinkType>(env, jni::fetch_object(env, p, res->payment_link_fieldID));
  return res;
}

void premiumPaymentOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  env->SetIntField(s, discount_percentage_fieldID, discount_percentage_);
  env->SetIntField(s, month_count_fieldID, month_count_);
  { jstring nextString = jni::to_jstring(env, store_product_id_); if (nextString) { env->SetObjectField(s, store_product_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (payment_link_ != nullptr) { jobject next; payment_link_->store(env, next); if (next) { env->SetObjectField(s, payment_link_fieldID, next); env->DeleteLocalRef(next); } }
}

void premiumPaymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumPaymentOption");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("discountPercentage", discount_percentage_);
    s.store_field("monthCount", month_count_);
    s.store_field("storeProductId", store_product_id_);
    s.store_object_field("paymentLink", static_cast<const BaseObject *>(payment_link_.get()));
    s.store_class_end();
  }
}

void premiumPaymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumPaymentOption").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    discount_percentage_fieldID = jni::get_field_id(env, Class, "discountPercentage", "I");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    store_product_id_fieldID = jni::get_field_id(env, Class, "storeProductId", "Ljava/lang/String;");
    payment_link_fieldID = jni::get_field_id(env, Class, "paymentLink", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass prepaidGiveaway::Class;
jfieldID prepaidGiveaway::id_fieldID;
jfieldID prepaidGiveaway::winner_count_fieldID;
jfieldID prepaidGiveaway::prize_fieldID;
jfieldID prepaidGiveaway::boost_count_fieldID;
jfieldID prepaidGiveaway::payment_date_fieldID;

prepaidGiveaway::prepaidGiveaway()
  : id_()
  , winner_count_()
  , prize_()
  , boost_count_()
  , payment_date_()
{}

prepaidGiveaway::prepaidGiveaway(int64 id_, int32 winner_count_, object_ptr<GiveawayPrize> &&prize_, int32 boost_count_, int32 payment_date_)
  : id_(id_)
  , winner_count_(winner_count_)
  , prize_(std::move(prize_))
  , boost_count_(boost_count_)
  , payment_date_(payment_date_)
{}

const std::int32_t prepaidGiveaway::ID;

object_ptr<prepaidGiveaway> prepaidGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<prepaidGiveaway> res = make_object<prepaidGiveaway>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->prize_ = jni::fetch_tl_object<GiveawayPrize>(env, jni::fetch_object(env, p, res->prize_fieldID));
  res->boost_count_ = env->GetIntField(p, res->boost_count_fieldID);
  res->payment_date_ = env->GetIntField(p, res->payment_date_fieldID);
  return res;
}

void prepaidGiveaway::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetIntField(s, winner_count_fieldID, winner_count_);
  if (prize_ != nullptr) { jobject next; prize_->store(env, next); if (next) { env->SetObjectField(s, prize_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, boost_count_fieldID, boost_count_);
  env->SetIntField(s, payment_date_fieldID, payment_date_);
}

void prepaidGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PrepaidGiveaway");
    s.store_field("id", id_);
    s.store_field("winnerCount", winner_count_);
    s.store_object_field("prize", static_cast<const BaseObject *>(prize_.get()));
    s.store_field("boostCount", boost_count_);
    s.store_field("paymentDate", payment_date_);
    s.store_class_end();
  }
}

void prepaidGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PrepaidGiveaway").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    prize_fieldID = jni::get_field_id(env, Class, "prize", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayPrize;").c_str());
    boost_count_fieldID = jni::get_field_id(env, Class, "boostCount", "I");
    payment_date_fieldID = jni::get_field_id(env, Class, "paymentDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass preparedInlineMessage::Class;
jfieldID preparedInlineMessage::inline_query_id_fieldID;
jfieldID preparedInlineMessage::result_fieldID;
jfieldID preparedInlineMessage::chat_types_fieldID;

preparedInlineMessage::preparedInlineMessage()
  : inline_query_id_()
  , result_()
  , chat_types_()
{}

preparedInlineMessage::preparedInlineMessage(int64 inline_query_id_, object_ptr<InlineQueryResult> &&result_, object_ptr<targetChatTypes> &&chat_types_)
  : inline_query_id_(inline_query_id_)
  , result_(std::move(result_))
  , chat_types_(std::move(chat_types_))
{}

const std::int32_t preparedInlineMessage::ID;

object_ptr<preparedInlineMessage> preparedInlineMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<preparedInlineMessage> res = make_object<preparedInlineMessage>();
  res->inline_query_id_ = env->GetLongField(p, res->inline_query_id_fieldID);
  res->result_ = jni::fetch_tl_object<InlineQueryResult>(env, jni::fetch_object(env, p, res->result_fieldID));
  res->chat_types_ = jni::fetch_tl_object<targetChatTypes>(env, jni::fetch_object(env, p, res->chat_types_fieldID));
  return res;
}

void preparedInlineMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, inline_query_id_fieldID, inline_query_id_);
  if (result_ != nullptr) { jobject next; result_->store(env, next); if (next) { env->SetObjectField(s, result_fieldID, next); env->DeleteLocalRef(next); } }
  if (chat_types_ != nullptr) { jobject next; chat_types_->store(env, next); if (next) { env->SetObjectField(s, chat_types_fieldID, next); env->DeleteLocalRef(next); } }
}

void preparedInlineMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PreparedInlineMessage");
    s.store_field("inlineQueryId", inline_query_id_);
    s.store_object_field("result", static_cast<const BaseObject *>(result_.get()));
    s.store_object_field("chatTypes", static_cast<const BaseObject *>(chat_types_.get()));
    s.store_class_end();
  }
}

void preparedInlineMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PreparedInlineMessage").c_str());
    inline_query_id_fieldID = jni::get_field_id(env, Class, "inlineQueryId", "J");
    result_fieldID = jni::get_field_id(env, Class, "result", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InlineQueryResult;").c_str());
    chat_types_fieldID = jni::get_field_id(env, Class, "chatTypes", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TargetChatTypes;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass ReactionNotificationSource::Class;

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

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

jclass reactionNotificationSourceNone::Class;

reactionNotificationSourceNone::reactionNotificationSourceNone() {
}

const std::int32_t reactionNotificationSourceNone::ID;

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

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

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

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

jclass reactionNotificationSourceContacts::Class;

reactionNotificationSourceContacts::reactionNotificationSourceContacts() {
}

const std::int32_t reactionNotificationSourceContacts::ID;

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

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

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

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

jclass reactionNotificationSourceAll::Class;

reactionNotificationSourceAll::reactionNotificationSourceAll() {
}

const std::int32_t reactionNotificationSourceAll::ID;

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

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

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

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

jclass ReactionUnavailabilityReason::Class;

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

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

jclass reactionUnavailabilityReasonAnonymousAdministrator::Class;

reactionUnavailabilityReasonAnonymousAdministrator::reactionUnavailabilityReasonAnonymousAdministrator() {
}

const std::int32_t reactionUnavailabilityReasonAnonymousAdministrator::ID;

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

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

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

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

jclass reactionUnavailabilityReasonGuest::Class;

reactionUnavailabilityReasonGuest::reactionUnavailabilityReasonGuest() {
}

const std::int32_t reactionUnavailabilityReasonGuest::ID;

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

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

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

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

jclass reactionUnavailabilityReasonRestricted::Class;

reactionUnavailabilityReasonRestricted::reactionUnavailabilityReasonRestricted() {
}

const std::int32_t reactionUnavailabilityReasonRestricted::ID;

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

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

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

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

jclass readDatePrivacySettings::Class;
jfieldID readDatePrivacySettings::show_read_date_fieldID;

readDatePrivacySettings::readDatePrivacySettings()
  : show_read_date_()
{}

readDatePrivacySettings::readDatePrivacySettings(bool show_read_date_)
  : show_read_date_(show_read_date_)
{}

const std::int32_t readDatePrivacySettings::ID;

object_ptr<readDatePrivacySettings> readDatePrivacySettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<readDatePrivacySettings> res = make_object<readDatePrivacySettings>();
  res->show_read_date_ = (env->GetBooleanField(p, res->show_read_date_fieldID) != 0);
  return res;
}

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

void readDatePrivacySettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReadDatePrivacySettings");
    s.store_field("showReadDate", show_read_date_);
    s.store_class_end();
  }
}

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

jclass recommendedChatFolder::Class;
jfieldID recommendedChatFolder::folder_fieldID;
jfieldID recommendedChatFolder::description_fieldID;

recommendedChatFolder::recommendedChatFolder()
  : folder_()
  , description_()
{}

recommendedChatFolder::recommendedChatFolder(object_ptr<chatFolder> &&folder_, string const &description_)
  : folder_(std::move(folder_))
  , description_(description_)
{}

const std::int32_t recommendedChatFolder::ID;

object_ptr<recommendedChatFolder> recommendedChatFolder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<recommendedChatFolder> res = make_object<recommendedChatFolder>();
  res->folder_ = jni::fetch_tl_object<chatFolder>(env, jni::fetch_object(env, p, res->folder_fieldID));
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return res;
}

void recommendedChatFolder::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (folder_ != nullptr) { jobject next; folder_->store(env, next); if (next) { env->SetObjectField(s, folder_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void recommendedChatFolder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RecommendedChatFolder");
    s.store_object_field("folder", static_cast<const BaseObject *>(folder_.get()));
    s.store_field("description", description_);
    s.store_class_end();
  }
}

void recommendedChatFolder::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RecommendedChatFolder").c_str());
    folder_fieldID = jni::get_field_id(env, Class, "folder", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatFolder;").c_str());
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass ReplyMarkup::Class;

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

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

jclass replyMarkupRemoveKeyboard::Class;
jfieldID replyMarkupRemoveKeyboard::is_personal_fieldID;

replyMarkupRemoveKeyboard::replyMarkupRemoveKeyboard()
  : is_personal_()
{}

replyMarkupRemoveKeyboard::replyMarkupRemoveKeyboard(bool is_personal_)
  : is_personal_(is_personal_)
{}

const std::int32_t replyMarkupRemoveKeyboard::ID;

object_ptr<ReplyMarkup> replyMarkupRemoveKeyboard::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<replyMarkupRemoveKeyboard> res = make_object<replyMarkupRemoveKeyboard>();
  res->is_personal_ = (env->GetBooleanField(p, res->is_personal_fieldID) != 0);
  return std::move(res);
}

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

void replyMarkupRemoveKeyboard::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReplyMarkupRemoveKeyboard");
    s.store_field("isPersonal", is_personal_);
    s.store_class_end();
  }
}

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

jclass replyMarkupForceReply::Class;
jfieldID replyMarkupForceReply::is_personal_fieldID;
jfieldID replyMarkupForceReply::input_field_placeholder_fieldID;

replyMarkupForceReply::replyMarkupForceReply()
  : is_personal_()
  , input_field_placeholder_()
{}

replyMarkupForceReply::replyMarkupForceReply(bool is_personal_, string const &input_field_placeholder_)
  : is_personal_(is_personal_)
  , input_field_placeholder_(input_field_placeholder_)
{}

const std::int32_t replyMarkupForceReply::ID;

object_ptr<ReplyMarkup> replyMarkupForceReply::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<replyMarkupForceReply> res = make_object<replyMarkupForceReply>();
  res->is_personal_ = (env->GetBooleanField(p, res->is_personal_fieldID) != 0);
  res->input_field_placeholder_ = jni::fetch_string(env, p, res->input_field_placeholder_fieldID);
  return std::move(res);
}

void replyMarkupForceReply::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_personal_fieldID, is_personal_);
  { jstring nextString = jni::to_jstring(env, input_field_placeholder_); if (nextString) { env->SetObjectField(s, input_field_placeholder_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void replyMarkupForceReply::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReplyMarkupForceReply");
    s.store_field("isPersonal", is_personal_);
    s.store_field("inputFieldPlaceholder", input_field_placeholder_);
    s.store_class_end();
  }
}

void replyMarkupForceReply::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReplyMarkupForceReply").c_str());
    is_personal_fieldID = jni::get_field_id(env, Class, "isPersonal", "Z");
    input_field_placeholder_fieldID = jni::get_field_id(env, Class, "inputFieldPlaceholder", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass replyMarkupShowKeyboard::Class;
jfieldID replyMarkupShowKeyboard::rows_fieldID;
jfieldID replyMarkupShowKeyboard::is_persistent_fieldID;
jfieldID replyMarkupShowKeyboard::resize_keyboard_fieldID;
jfieldID replyMarkupShowKeyboard::one_time_fieldID;
jfieldID replyMarkupShowKeyboard::is_personal_fieldID;
jfieldID replyMarkupShowKeyboard::input_field_placeholder_fieldID;

replyMarkupShowKeyboard::replyMarkupShowKeyboard()
  : rows_()
  , is_persistent_()
  , resize_keyboard_()
  , one_time_()
  , is_personal_()
  , input_field_placeholder_()
{}

replyMarkupShowKeyboard::replyMarkupShowKeyboard(array<array<object_ptr<keyboardButton>>> &&rows_, bool is_persistent_, bool resize_keyboard_, bool one_time_, bool is_personal_, string const &input_field_placeholder_)
  : rows_(std::move(rows_))
  , is_persistent_(is_persistent_)
  , resize_keyboard_(resize_keyboard_)
  , one_time_(one_time_)
  , is_personal_(is_personal_)
  , input_field_placeholder_(input_field_placeholder_)
{}

const std::int32_t replyMarkupShowKeyboard::ID;

object_ptr<ReplyMarkup> replyMarkupShowKeyboard::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<replyMarkupShowKeyboard> res = make_object<replyMarkupShowKeyboard>();
  res->rows_ = jni::FetchVector<array<keyboardButton>>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->rows_fieldID));
  res->is_persistent_ = (env->GetBooleanField(p, res->is_persistent_fieldID) != 0);
  res->resize_keyboard_ = (env->GetBooleanField(p, res->resize_keyboard_fieldID) != 0);
  res->one_time_ = (env->GetBooleanField(p, res->one_time_fieldID) != 0);
  res->is_personal_ = (env->GetBooleanField(p, res->is_personal_fieldID) != 0);
  res->input_field_placeholder_ = jni::fetch_string(env, p, res->input_field_placeholder_fieldID);
  return std::move(res);
}

void replyMarkupShowKeyboard::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, rows_); if (arr_tmp_) { env->SetObjectField(s, rows_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_persistent_fieldID, is_persistent_);
  env->SetBooleanField(s, resize_keyboard_fieldID, resize_keyboard_);
  env->SetBooleanField(s, one_time_fieldID, one_time_);
  env->SetBooleanField(s, is_personal_fieldID, is_personal_);
  { jstring nextString = jni::to_jstring(env, input_field_placeholder_); if (nextString) { env->SetObjectField(s, input_field_placeholder_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void replyMarkupShowKeyboard::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReplyMarkupShowKeyboard");
    { s.store_vector_begin("rows", rows_.size()); for (const auto &_value : rows_) { { s.store_vector_begin("", _value.size()); for (const auto &_value2 : _value) { s.store_object_field("", static_cast<const BaseObject *>(_value2.get())); } s.store_class_end(); } } s.store_class_end(); }
    s.store_field("isPersistent", is_persistent_);
    s.store_field("resizeKeyboard", resize_keyboard_);
    s.store_field("oneTime", one_time_);
    s.store_field("isPersonal", is_personal_);
    s.store_field("inputFieldPlaceholder", input_field_placeholder_);
    s.store_class_end();
  }
}

void replyMarkupShowKeyboard::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReplyMarkupShowKeyboard").c_str());
    rows_fieldID = jni::get_field_id(env, Class, "rows", (PSLICE() << "[[L" << get_package_name_ref() << "/TdApi$KeyboardButton;").c_str());
    is_persistent_fieldID = jni::get_field_id(env, Class, "isPersistent", "Z");
    resize_keyboard_fieldID = jni::get_field_id(env, Class, "resizeKeyboard", "Z");
    one_time_fieldID = jni::get_field_id(env, Class, "oneTime", "Z");
    is_personal_fieldID = jni::get_field_id(env, Class, "isPersonal", "Z");
    input_field_placeholder_fieldID = jni::get_field_id(env, Class, "inputFieldPlaceholder", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass replyMarkupInlineKeyboard::Class;
jfieldID replyMarkupInlineKeyboard::rows_fieldID;

replyMarkupInlineKeyboard::replyMarkupInlineKeyboard()
  : rows_()
{}

replyMarkupInlineKeyboard::replyMarkupInlineKeyboard(array<array<object_ptr<inlineKeyboardButton>>> &&rows_)
  : rows_(std::move(rows_))
{}

const std::int32_t replyMarkupInlineKeyboard::ID;

object_ptr<ReplyMarkup> replyMarkupInlineKeyboard::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<replyMarkupInlineKeyboard> res = make_object<replyMarkupInlineKeyboard>();
  res->rows_ = jni::FetchVector<array<inlineKeyboardButton>>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->rows_fieldID));
  return std::move(res);
}

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

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

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

jclass ReportStoryResult::Class;

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

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

jclass reportStoryResultOk::Class;

reportStoryResultOk::reportStoryResultOk() {
}

const std::int32_t reportStoryResultOk::ID;

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

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

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

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

jclass reportStoryResultOptionRequired::Class;
jfieldID reportStoryResultOptionRequired::title_fieldID;
jfieldID reportStoryResultOptionRequired::options_fieldID;

reportStoryResultOptionRequired::reportStoryResultOptionRequired()
  : title_()
  , options_()
{}

reportStoryResultOptionRequired::reportStoryResultOptionRequired(string const &title_, array<object_ptr<reportOption>> &&options_)
  : title_(title_)
  , options_(std::move(options_))
{}

const std::int32_t reportStoryResultOptionRequired::ID;

object_ptr<ReportStoryResult> reportStoryResultOptionRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportStoryResultOptionRequired> res = make_object<reportStoryResultOptionRequired>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->options_ = jni::FetchVector<reportOption>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->options_fieldID));
  return std::move(res);
}

void reportStoryResultOptionRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, options_); if (arr_tmp_) { env->SetObjectField(s, options_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void reportStoryResultOptionRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportStoryResultOptionRequired");
    s.store_field("title", title_);
    { s.store_vector_begin("options", options_.size()); for (const auto &_value : options_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass reportStoryResultTextRequired::Class;
jfieldID reportStoryResultTextRequired::option_id_fieldID;
jfieldID reportStoryResultTextRequired::is_optional_fieldID;

reportStoryResultTextRequired::reportStoryResultTextRequired()
  : option_id_()
  , is_optional_()
{}

reportStoryResultTextRequired::reportStoryResultTextRequired(bytes const &option_id_, bool is_optional_)
  : option_id_(std::move(option_id_))
  , is_optional_(is_optional_)
{}

const std::int32_t reportStoryResultTextRequired::ID;

object_ptr<ReportStoryResult> reportStoryResultTextRequired::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportStoryResultTextRequired> res = make_object<reportStoryResultTextRequired>();
  res->option_id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->option_id_fieldID));
  res->is_optional_ = (env->GetBooleanField(p, res->is_optional_fieldID) != 0);
  return std::move(res);
}

void reportStoryResultTextRequired::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jbyteArray nextBytes = jni::to_bytes(env, option_id_); if (nextBytes) { env->SetObjectField(s, option_id_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  env->SetBooleanField(s, is_optional_fieldID, is_optional_);
}

void reportStoryResultTextRequired::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportStoryResultTextRequired");
    s.store_bytes_field("optionId", option_id_);
    s.store_field("isOptional", is_optional_);
    s.store_class_end();
  }
}

void reportStoryResultTextRequired::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportStoryResultTextRequired").c_str());
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "[B");
    is_optional_fieldID = jni::get_field_id(env, Class, "isOptional", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass ResendCodeReason::Class;

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

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

jclass resendCodeReasonUserRequest::Class;

resendCodeReasonUserRequest::resendCodeReasonUserRequest() {
}

const std::int32_t resendCodeReasonUserRequest::ID;

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

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

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

jclass resendCodeReasonVerificationFailed::Class;
jfieldID resendCodeReasonVerificationFailed::error_message_fieldID;

resendCodeReasonVerificationFailed::resendCodeReasonVerificationFailed()
  : error_message_()
{}

resendCodeReasonVerificationFailed::resendCodeReasonVerificationFailed(string const &error_message_)
  : error_message_(error_message_)
{}

const std::int32_t resendCodeReasonVerificationFailed::ID;

object_ptr<ResendCodeReason> resendCodeReasonVerificationFailed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<resendCodeReasonVerificationFailed> res = make_object<resendCodeReasonVerificationFailed>();
  res->error_message_ = jni::fetch_string(env, p, res->error_message_fieldID);
  return std::move(res);
}

void resendCodeReasonVerificationFailed::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ResendCodeReasonVerificationFailed");
    s.store_field("errorMessage", error_message_);
    s.store_class_end();
  }
}

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

jclass starRevenueStatus::Class;
jfieldID starRevenueStatus::total_amount_fieldID;
jfieldID starRevenueStatus::current_amount_fieldID;
jfieldID starRevenueStatus::available_amount_fieldID;
jfieldID starRevenueStatus::withdrawal_enabled_fieldID;
jfieldID starRevenueStatus::next_withdrawal_in_fieldID;

starRevenueStatus::starRevenueStatus()
  : total_amount_()
  , current_amount_()
  , available_amount_()
  , withdrawal_enabled_()
  , next_withdrawal_in_()
{}

starRevenueStatus::starRevenueStatus(object_ptr<starAmount> &&total_amount_, object_ptr<starAmount> &&current_amount_, object_ptr<starAmount> &&available_amount_, bool withdrawal_enabled_, int32 next_withdrawal_in_)
  : total_amount_(std::move(total_amount_))
  , current_amount_(std::move(current_amount_))
  , available_amount_(std::move(available_amount_))
  , withdrawal_enabled_(withdrawal_enabled_)
  , next_withdrawal_in_(next_withdrawal_in_)
{}

const std::int32_t starRevenueStatus::ID;

object_ptr<starRevenueStatus> starRevenueStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<starRevenueStatus> res = make_object<starRevenueStatus>();
  res->total_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->total_amount_fieldID));
  res->current_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->current_amount_fieldID));
  res->available_amount_ = jni::fetch_tl_object<starAmount>(env, jni::fetch_object(env, p, res->available_amount_fieldID));
  res->withdrawal_enabled_ = (env->GetBooleanField(p, res->withdrawal_enabled_fieldID) != 0);
  res->next_withdrawal_in_ = env->GetIntField(p, res->next_withdrawal_in_fieldID);
  return res;
}

void starRevenueStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (total_amount_ != nullptr) { jobject next; total_amount_->store(env, next); if (next) { env->SetObjectField(s, total_amount_fieldID, next); env->DeleteLocalRef(next); } }
  if (current_amount_ != nullptr) { jobject next; current_amount_->store(env, next); if (next) { env->SetObjectField(s, current_amount_fieldID, next); env->DeleteLocalRef(next); } }
  if (available_amount_ != nullptr) { jobject next; available_amount_->store(env, next); if (next) { env->SetObjectField(s, available_amount_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, withdrawal_enabled_fieldID, withdrawal_enabled_);
  env->SetIntField(s, next_withdrawal_in_fieldID, next_withdrawal_in_);
}

void starRevenueStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StarRevenueStatus");
    s.store_object_field("totalAmount", static_cast<const BaseObject *>(total_amount_.get()));
    s.store_object_field("currentAmount", static_cast<const BaseObject *>(current_amount_.get()));
    s.store_object_field("availableAmount", static_cast<const BaseObject *>(available_amount_.get()));
    s.store_field("withdrawalEnabled", withdrawal_enabled_);
    s.store_field("nextWithdrawalIn", next_withdrawal_in_);
    s.store_class_end();
  }
}

void starRevenueStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StarRevenueStatus").c_str());
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    current_amount_fieldID = jni::get_field_id(env, Class, "currentAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    available_amount_fieldID = jni::get_field_id(env, Class, "availableAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StarAmount;").c_str());
    withdrawal_enabled_fieldID = jni::get_field_id(env, Class, "withdrawalEnabled", "Z");
    next_withdrawal_in_fieldID = jni::get_field_id(env, Class, "nextWithdrawalIn", "I");
    return true;
  }();
  (void)is_inited;
}

jclass storyAlbums::Class;
jfieldID storyAlbums::albums_fieldID;

storyAlbums::storyAlbums()
  : albums_()
{}

storyAlbums::storyAlbums(array<object_ptr<storyAlbum>> &&albums_)
  : albums_(std::move(albums_))
{}

const std::int32_t storyAlbums::ID;

object_ptr<storyAlbums> storyAlbums::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyAlbums> res = make_object<storyAlbums>();
  res->albums_ = jni::FetchVector<storyAlbum>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->albums_fieldID));
  return res;
}

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

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

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

jclass storyFullId::Class;
jfieldID storyFullId::poster_chat_id_fieldID;
jfieldID storyFullId::story_id_fieldID;

storyFullId::storyFullId()
  : poster_chat_id_()
  , story_id_()
{}

storyFullId::storyFullId(int53 poster_chat_id_, int32 story_id_)
  : poster_chat_id_(poster_chat_id_)
  , story_id_(story_id_)
{}

const std::int32_t storyFullId::ID;

object_ptr<storyFullId> storyFullId::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyFullId> res = make_object<storyFullId>();
  res->poster_chat_id_ = env->GetLongField(p, res->poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  return res;
}

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

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

jclass temporaryPasswordState::Class;
jfieldID temporaryPasswordState::has_password_fieldID;
jfieldID temporaryPasswordState::valid_for_fieldID;

temporaryPasswordState::temporaryPasswordState()
  : has_password_()
  , valid_for_()
{}

temporaryPasswordState::temporaryPasswordState(bool has_password_, int32 valid_for_)
  : has_password_(has_password_)
  , valid_for_(valid_for_)
{}

const std::int32_t temporaryPasswordState::ID;

object_ptr<temporaryPasswordState> temporaryPasswordState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<temporaryPasswordState> res = make_object<temporaryPasswordState>();
  res->has_password_ = (env->GetBooleanField(p, res->has_password_fieldID) != 0);
  res->valid_for_ = env->GetIntField(p, res->valid_for_fieldID);
  return res;
}

void temporaryPasswordState::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_);
  env->SetIntField(s, valid_for_fieldID, valid_for_);
}

void temporaryPasswordState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TemporaryPasswordState");
    s.store_field("hasPassword", has_password_);
    s.store_field("validFor", valid_for_);
    s.store_class_end();
  }
}

void temporaryPasswordState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TemporaryPasswordState").c_str());
    has_password_fieldID = jni::get_field_id(env, Class, "hasPassword", "Z");
    valid_for_fieldID = jni::get_field_id(env, Class, "validFor", "I");
    return true;
  }();
  (void)is_inited;
}

jclass testString::Class;
jfieldID testString::value_fieldID;

testString::testString()
  : value_()
{}

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

const std::int32_t testString::ID;

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

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

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

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

jclass tonRevenueStatus::Class;
jfieldID tonRevenueStatus::total_amount_fieldID;
jfieldID tonRevenueStatus::balance_amount_fieldID;
jfieldID tonRevenueStatus::available_amount_fieldID;
jfieldID tonRevenueStatus::withdrawal_enabled_fieldID;

tonRevenueStatus::tonRevenueStatus()
  : total_amount_()
  , balance_amount_()
  , available_amount_()
  , withdrawal_enabled_()
{}

tonRevenueStatus::tonRevenueStatus(int64 total_amount_, int64 balance_amount_, int64 available_amount_, bool withdrawal_enabled_)
  : total_amount_(total_amount_)
  , balance_amount_(balance_amount_)
  , available_amount_(available_amount_)
  , withdrawal_enabled_(withdrawal_enabled_)
{}

const std::int32_t tonRevenueStatus::ID;

object_ptr<tonRevenueStatus> tonRevenueStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonRevenueStatus> res = make_object<tonRevenueStatus>();
  res->total_amount_ = env->GetLongField(p, res->total_amount_fieldID);
  res->balance_amount_ = env->GetLongField(p, res->balance_amount_fieldID);
  res->available_amount_ = env->GetLongField(p, res->available_amount_fieldID);
  res->withdrawal_enabled_ = (env->GetBooleanField(p, res->withdrawal_enabled_fieldID) != 0);
  return res;
}

void tonRevenueStatus::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, total_amount_fieldID, total_amount_);
  env->SetLongField(s, balance_amount_fieldID, balance_amount_);
  env->SetLongField(s, available_amount_fieldID, available_amount_);
  env->SetBooleanField(s, withdrawal_enabled_fieldID, withdrawal_enabled_);
}

void tonRevenueStatus::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TonRevenueStatus");
    s.store_field("totalAmount", total_amount_);
    s.store_field("balanceAmount", balance_amount_);
    s.store_field("availableAmount", available_amount_);
    s.store_field("withdrawalEnabled", withdrawal_enabled_);
    s.store_class_end();
  }
}

void tonRevenueStatus::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TonRevenueStatus").c_str());
    total_amount_fieldID = jni::get_field_id(env, Class, "totalAmount", "J");
    balance_amount_fieldID = jni::get_field_id(env, Class, "balanceAmount", "J");
    available_amount_fieldID = jni::get_field_id(env, Class, "availableAmount", "J");
    withdrawal_enabled_fieldID = jni::get_field_id(env, Class, "withdrawalEnabled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass TonTransactionType::Class;

object_ptr<TonTransactionType> TonTransactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case tonTransactionTypeFragmentDeposit::ID:
      return tonTransactionTypeFragmentDeposit::fetch(env, p);
    case tonTransactionTypeFragmentWithdrawal::ID:
      return tonTransactionTypeFragmentWithdrawal::fetch(env, p);
    case tonTransactionTypeSuggestedPostPayment::ID:
      return tonTransactionTypeSuggestedPostPayment::fetch(env, p);
    case tonTransactionTypeGiftPurchaseOffer::ID:
      return tonTransactionTypeGiftPurchaseOffer::fetch(env, p);
    case tonTransactionTypeUpgradedGiftPurchase::ID:
      return tonTransactionTypeUpgradedGiftPurchase::fetch(env, p);
    case tonTransactionTypeUpgradedGiftSale::ID:
      return tonTransactionTypeUpgradedGiftSale::fetch(env, p);
    case tonTransactionTypeStakeDiceStake::ID:
      return tonTransactionTypeStakeDiceStake::fetch(env, p);
    case tonTransactionTypeStakeDicePayout::ID:
      return tonTransactionTypeStakeDicePayout::fetch(env, p);
    case tonTransactionTypeUnsupported::ID:
      return tonTransactionTypeUnsupported::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass tonTransactionTypeFragmentDeposit::Class;
jfieldID tonTransactionTypeFragmentDeposit::is_gift_fieldID;
jfieldID tonTransactionTypeFragmentDeposit::sticker_fieldID;

tonTransactionTypeFragmentDeposit::tonTransactionTypeFragmentDeposit()
  : is_gift_()
  , sticker_()
{}

tonTransactionTypeFragmentDeposit::tonTransactionTypeFragmentDeposit(bool is_gift_, object_ptr<sticker> &&sticker_)
  : is_gift_(is_gift_)
  , sticker_(std::move(sticker_))
{}

const std::int32_t tonTransactionTypeFragmentDeposit::ID;

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

void tonTransactionTypeFragmentDeposit::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_gift_fieldID, is_gift_);
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

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

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

jclass tonTransactionTypeFragmentWithdrawal::Class;
jfieldID tonTransactionTypeFragmentWithdrawal::withdrawal_state_fieldID;

tonTransactionTypeFragmentWithdrawal::tonTransactionTypeFragmentWithdrawal()
  : withdrawal_state_()
{}

tonTransactionTypeFragmentWithdrawal::tonTransactionTypeFragmentWithdrawal(object_ptr<RevenueWithdrawalState> &&withdrawal_state_)
  : withdrawal_state_(std::move(withdrawal_state_))
{}

const std::int32_t tonTransactionTypeFragmentWithdrawal::ID;

object_ptr<TonTransactionType> tonTransactionTypeFragmentWithdrawal::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonTransactionTypeFragmentWithdrawal> res = make_object<tonTransactionTypeFragmentWithdrawal>();
  res->withdrawal_state_ = jni::fetch_tl_object<RevenueWithdrawalState>(env, jni::fetch_object(env, p, res->withdrawal_state_fieldID));
  return std::move(res);
}

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

void tonTransactionTypeFragmentWithdrawal::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TonTransactionTypeFragmentWithdrawal");
    s.store_object_field("withdrawalState", static_cast<const BaseObject *>(withdrawal_state_.get()));
    s.store_class_end();
  }
}

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

jclass tonTransactionTypeSuggestedPostPayment::Class;
jfieldID tonTransactionTypeSuggestedPostPayment::chat_id_fieldID;

tonTransactionTypeSuggestedPostPayment::tonTransactionTypeSuggestedPostPayment()
  : chat_id_()
{}

tonTransactionTypeSuggestedPostPayment::tonTransactionTypeSuggestedPostPayment(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t tonTransactionTypeSuggestedPostPayment::ID;

object_ptr<TonTransactionType> tonTransactionTypeSuggestedPostPayment::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonTransactionTypeSuggestedPostPayment> res = make_object<tonTransactionTypeSuggestedPostPayment>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return std::move(res);
}

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

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

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

jclass tonTransactionTypeGiftPurchaseOffer::Class;
jfieldID tonTransactionTypeGiftPurchaseOffer::gift_fieldID;

tonTransactionTypeGiftPurchaseOffer::tonTransactionTypeGiftPurchaseOffer()
  : gift_()
{}

tonTransactionTypeGiftPurchaseOffer::tonTransactionTypeGiftPurchaseOffer(object_ptr<upgradedGift> &&gift_)
  : gift_(std::move(gift_))
{}

const std::int32_t tonTransactionTypeGiftPurchaseOffer::ID;

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

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

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

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

jclass tonTransactionTypeUpgradedGiftPurchase::Class;
jfieldID tonTransactionTypeUpgradedGiftPurchase::user_id_fieldID;
jfieldID tonTransactionTypeUpgradedGiftPurchase::gift_fieldID;

tonTransactionTypeUpgradedGiftPurchase::tonTransactionTypeUpgradedGiftPurchase()
  : user_id_()
  , gift_()
{}

tonTransactionTypeUpgradedGiftPurchase::tonTransactionTypeUpgradedGiftPurchase(int53 user_id_, object_ptr<upgradedGift> &&gift_)
  : user_id_(user_id_)
  , gift_(std::move(gift_))
{}

const std::int32_t tonTransactionTypeUpgradedGiftPurchase::ID;

object_ptr<TonTransactionType> tonTransactionTypeUpgradedGiftPurchase::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonTransactionTypeUpgradedGiftPurchase> res = make_object<tonTransactionTypeUpgradedGiftPurchase>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  return std::move(res);
}

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

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

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

jclass tonTransactionTypeUpgradedGiftSale::Class;
jfieldID tonTransactionTypeUpgradedGiftSale::user_id_fieldID;
jfieldID tonTransactionTypeUpgradedGiftSale::gift_fieldID;
jfieldID tonTransactionTypeUpgradedGiftSale::commission_per_mille_fieldID;
jfieldID tonTransactionTypeUpgradedGiftSale::commission_toncoin_amount_fieldID;
jfieldID tonTransactionTypeUpgradedGiftSale::via_offer_fieldID;

tonTransactionTypeUpgradedGiftSale::tonTransactionTypeUpgradedGiftSale()
  : user_id_()
  , gift_()
  , commission_per_mille_()
  , commission_toncoin_amount_()
  , via_offer_()
{}

tonTransactionTypeUpgradedGiftSale::tonTransactionTypeUpgradedGiftSale(int53 user_id_, object_ptr<upgradedGift> &&gift_, int32 commission_per_mille_, int53 commission_toncoin_amount_, bool via_offer_)
  : user_id_(user_id_)
  , gift_(std::move(gift_))
  , commission_per_mille_(commission_per_mille_)
  , commission_toncoin_amount_(commission_toncoin_amount_)
  , via_offer_(via_offer_)
{}

const std::int32_t tonTransactionTypeUpgradedGiftSale::ID;

object_ptr<TonTransactionType> tonTransactionTypeUpgradedGiftSale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tonTransactionTypeUpgradedGiftSale> res = make_object<tonTransactionTypeUpgradedGiftSale>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->gift_ = jni::fetch_tl_object<upgradedGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->commission_per_mille_ = env->GetIntField(p, res->commission_per_mille_fieldID);
  res->commission_toncoin_amount_ = env->GetLongField(p, res->commission_toncoin_amount_fieldID);
  res->via_offer_ = (env->GetBooleanField(p, res->via_offer_fieldID) != 0);
  return std::move(res);
}

void tonTransactionTypeUpgradedGiftSale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, commission_per_mille_fieldID, commission_per_mille_);
  env->SetLongField(s, commission_toncoin_amount_fieldID, commission_toncoin_amount_);
  env->SetBooleanField(s, via_offer_fieldID, via_offer_);
}

void tonTransactionTypeUpgradedGiftSale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TonTransactionTypeUpgradedGiftSale");
    s.store_field("userId", user_id_);
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    s.store_field("commissionPerMille", commission_per_mille_);
    s.store_field("commissionToncoinAmount", commission_toncoin_amount_);
    s.store_field("viaOffer", via_offer_);
    s.store_class_end();
  }
}

void tonTransactionTypeUpgradedGiftSale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TonTransactionTypeUpgradedGiftSale").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGift;").c_str());
    commission_per_mille_fieldID = jni::get_field_id(env, Class, "commissionPerMille", "I");
    commission_toncoin_amount_fieldID = jni::get_field_id(env, Class, "commissionToncoinAmount", "J");
    via_offer_fieldID = jni::get_field_id(env, Class, "viaOffer", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass tonTransactionTypeStakeDiceStake::Class;

tonTransactionTypeStakeDiceStake::tonTransactionTypeStakeDiceStake() {
}

const std::int32_t tonTransactionTypeStakeDiceStake::ID;

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

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

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

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

jclass tonTransactionTypeStakeDicePayout::Class;

tonTransactionTypeStakeDicePayout::tonTransactionTypeStakeDicePayout() {
}

const std::int32_t tonTransactionTypeStakeDicePayout::ID;

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

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

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

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

jclass tonTransactionTypeUnsupported::Class;

tonTransactionTypeUnsupported::tonTransactionTypeUnsupported() {
}

const std::int32_t tonTransactionTypeUnsupported::ID;

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

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

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

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

jclass UpgradedGiftAttributeId::Class;

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

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

jclass upgradedGiftAttributeIdModel::Class;
jfieldID upgradedGiftAttributeIdModel::sticker_id_fieldID;

upgradedGiftAttributeIdModel::upgradedGiftAttributeIdModel()
  : sticker_id_()
{}

upgradedGiftAttributeIdModel::upgradedGiftAttributeIdModel(int64 sticker_id_)
  : sticker_id_(sticker_id_)
{}

const std::int32_t upgradedGiftAttributeIdModel::ID;

object_ptr<UpgradedGiftAttributeId> upgradedGiftAttributeIdModel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftAttributeIdModel> res = make_object<upgradedGiftAttributeIdModel>();
  res->sticker_id_ = env->GetLongField(p, res->sticker_id_fieldID);
  return std::move(res);
}

void upgradedGiftAttributeIdModel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftAttributeIdModel");
    s.store_field("stickerId", sticker_id_);
    s.store_class_end();
  }
}

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

jclass upgradedGiftAttributeIdSymbol::Class;
jfieldID upgradedGiftAttributeIdSymbol::sticker_id_fieldID;

upgradedGiftAttributeIdSymbol::upgradedGiftAttributeIdSymbol()
  : sticker_id_()
{}

upgradedGiftAttributeIdSymbol::upgradedGiftAttributeIdSymbol(int64 sticker_id_)
  : sticker_id_(sticker_id_)
{}

const std::int32_t upgradedGiftAttributeIdSymbol::ID;

object_ptr<UpgradedGiftAttributeId> upgradedGiftAttributeIdSymbol::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftAttributeIdSymbol> res = make_object<upgradedGiftAttributeIdSymbol>();
  res->sticker_id_ = env->GetLongField(p, res->sticker_id_fieldID);
  return std::move(res);
}

void upgradedGiftAttributeIdSymbol::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftAttributeIdSymbol");
    s.store_field("stickerId", sticker_id_);
    s.store_class_end();
  }
}

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

jclass upgradedGiftAttributeIdBackdrop::Class;
jfieldID upgradedGiftAttributeIdBackdrop::backdrop_id_fieldID;

upgradedGiftAttributeIdBackdrop::upgradedGiftAttributeIdBackdrop()
  : backdrop_id_()
{}

upgradedGiftAttributeIdBackdrop::upgradedGiftAttributeIdBackdrop(int32 backdrop_id_)
  : backdrop_id_(backdrop_id_)
{}

const std::int32_t upgradedGiftAttributeIdBackdrop::ID;

object_ptr<UpgradedGiftAttributeId> upgradedGiftAttributeIdBackdrop::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftAttributeIdBackdrop> res = make_object<upgradedGiftAttributeIdBackdrop>();
  res->backdrop_id_ = env->GetIntField(p, res->backdrop_id_fieldID);
  return std::move(res);
}

void upgradedGiftAttributeIdBackdrop::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftAttributeIdBackdrop");
    s.store_field("backdropId", backdrop_id_);
    s.store_class_end();
  }
}

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

jclass upgradedGiftValueInfo::Class;
jfieldID upgradedGiftValueInfo::currency_fieldID;
jfieldID upgradedGiftValueInfo::value_fieldID;
jfieldID upgradedGiftValueInfo::is_value_average_fieldID;
jfieldID upgradedGiftValueInfo::initial_sale_date_fieldID;
jfieldID upgradedGiftValueInfo::initial_sale_star_count_fieldID;
jfieldID upgradedGiftValueInfo::initial_sale_price_fieldID;
jfieldID upgradedGiftValueInfo::last_sale_date_fieldID;
jfieldID upgradedGiftValueInfo::last_sale_price_fieldID;
jfieldID upgradedGiftValueInfo::is_last_sale_on_fragment_fieldID;
jfieldID upgradedGiftValueInfo::minimum_price_fieldID;
jfieldID upgradedGiftValueInfo::average_sale_price_fieldID;
jfieldID upgradedGiftValueInfo::telegram_listed_gift_count_fieldID;
jfieldID upgradedGiftValueInfo::fragment_listed_gift_count_fieldID;
jfieldID upgradedGiftValueInfo::fragment_url_fieldID;

upgradedGiftValueInfo::upgradedGiftValueInfo()
  : currency_()
  , value_()
  , is_value_average_()
  , initial_sale_date_()
  , initial_sale_star_count_()
  , initial_sale_price_()
  , last_sale_date_()
  , last_sale_price_()
  , is_last_sale_on_fragment_()
  , minimum_price_()
  , average_sale_price_()
  , telegram_listed_gift_count_()
  , fragment_listed_gift_count_()
  , fragment_url_()
{}

upgradedGiftValueInfo::upgradedGiftValueInfo(string const &currency_, int53 value_, bool is_value_average_, int32 initial_sale_date_, int53 initial_sale_star_count_, int53 initial_sale_price_, int32 last_sale_date_, int53 last_sale_price_, bool is_last_sale_on_fragment_, int53 minimum_price_, int53 average_sale_price_, int32 telegram_listed_gift_count_, int32 fragment_listed_gift_count_, string const &fragment_url_)
  : currency_(currency_)
  , value_(value_)
  , is_value_average_(is_value_average_)
  , initial_sale_date_(initial_sale_date_)
  , initial_sale_star_count_(initial_sale_star_count_)
  , initial_sale_price_(initial_sale_price_)
  , last_sale_date_(last_sale_date_)
  , last_sale_price_(last_sale_price_)
  , is_last_sale_on_fragment_(is_last_sale_on_fragment_)
  , minimum_price_(minimum_price_)
  , average_sale_price_(average_sale_price_)
  , telegram_listed_gift_count_(telegram_listed_gift_count_)
  , fragment_listed_gift_count_(fragment_listed_gift_count_)
  , fragment_url_(fragment_url_)
{}

const std::int32_t upgradedGiftValueInfo::ID;

object_ptr<upgradedGiftValueInfo> upgradedGiftValueInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftValueInfo> res = make_object<upgradedGiftValueInfo>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->value_ = env->GetLongField(p, res->value_fieldID);
  res->is_value_average_ = (env->GetBooleanField(p, res->is_value_average_fieldID) != 0);
  res->initial_sale_date_ = env->GetIntField(p, res->initial_sale_date_fieldID);
  res->initial_sale_star_count_ = env->GetLongField(p, res->initial_sale_star_count_fieldID);
  res->initial_sale_price_ = env->GetLongField(p, res->initial_sale_price_fieldID);
  res->last_sale_date_ = env->GetIntField(p, res->last_sale_date_fieldID);
  res->last_sale_price_ = env->GetLongField(p, res->last_sale_price_fieldID);
  res->is_last_sale_on_fragment_ = (env->GetBooleanField(p, res->is_last_sale_on_fragment_fieldID) != 0);
  res->minimum_price_ = env->GetLongField(p, res->minimum_price_fieldID);
  res->average_sale_price_ = env->GetLongField(p, res->average_sale_price_fieldID);
  res->telegram_listed_gift_count_ = env->GetIntField(p, res->telegram_listed_gift_count_fieldID);
  res->fragment_listed_gift_count_ = env->GetIntField(p, res->fragment_listed_gift_count_fieldID);
  res->fragment_url_ = jni::fetch_string(env, p, res->fragment_url_fieldID);
  return res;
}

void upgradedGiftValueInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, value_fieldID, value_);
  env->SetBooleanField(s, is_value_average_fieldID, is_value_average_);
  env->SetIntField(s, initial_sale_date_fieldID, initial_sale_date_);
  env->SetLongField(s, initial_sale_star_count_fieldID, initial_sale_star_count_);
  env->SetLongField(s, initial_sale_price_fieldID, initial_sale_price_);
  env->SetIntField(s, last_sale_date_fieldID, last_sale_date_);
  env->SetLongField(s, last_sale_price_fieldID, last_sale_price_);
  env->SetBooleanField(s, is_last_sale_on_fragment_fieldID, is_last_sale_on_fragment_);
  env->SetLongField(s, minimum_price_fieldID, minimum_price_);
  env->SetLongField(s, average_sale_price_fieldID, average_sale_price_);
  env->SetIntField(s, telegram_listed_gift_count_fieldID, telegram_listed_gift_count_);
  env->SetIntField(s, fragment_listed_gift_count_fieldID, fragment_listed_gift_count_);
  { jstring nextString = jni::to_jstring(env, fragment_url_); if (nextString) { env->SetObjectField(s, fragment_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void upgradedGiftValueInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftValueInfo");
    s.store_field("currency", currency_);
    s.store_field("value", value_);
    s.store_field("isValueAverage", is_value_average_);
    s.store_field("initialSaleDate", initial_sale_date_);
    s.store_field("initialSaleStarCount", initial_sale_star_count_);
    s.store_field("initialSalePrice", initial_sale_price_);
    s.store_field("lastSaleDate", last_sale_date_);
    s.store_field("lastSalePrice", last_sale_price_);
    s.store_field("isLastSaleOnFragment", is_last_sale_on_fragment_);
    s.store_field("minimumPrice", minimum_price_);
    s.store_field("averageSalePrice", average_sale_price_);
    s.store_field("telegramListedGiftCount", telegram_listed_gift_count_);
    s.store_field("fragmentListedGiftCount", fragment_listed_gift_count_);
    s.store_field("fragmentUrl", fragment_url_);
    s.store_class_end();
  }
}

void upgradedGiftValueInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftValueInfo").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    value_fieldID = jni::get_field_id(env, Class, "value", "J");
    is_value_average_fieldID = jni::get_field_id(env, Class, "isValueAverage", "Z");
    initial_sale_date_fieldID = jni::get_field_id(env, Class, "initialSaleDate", "I");
    initial_sale_star_count_fieldID = jni::get_field_id(env, Class, "initialSaleStarCount", "J");
    initial_sale_price_fieldID = jni::get_field_id(env, Class, "initialSalePrice", "J");
    last_sale_date_fieldID = jni::get_field_id(env, Class, "lastSaleDate", "I");
    last_sale_price_fieldID = jni::get_field_id(env, Class, "lastSalePrice", "J");
    is_last_sale_on_fragment_fieldID = jni::get_field_id(env, Class, "isLastSaleOnFragment", "Z");
    minimum_price_fieldID = jni::get_field_id(env, Class, "minimumPrice", "J");
    average_sale_price_fieldID = jni::get_field_id(env, Class, "averageSalePrice", "J");
    telegram_listed_gift_count_fieldID = jni::get_field_id(env, Class, "telegramListedGiftCount", "I");
    fragment_listed_gift_count_fieldID = jni::get_field_id(env, Class, "fragmentListedGiftCount", "I");
    fragment_url_fieldID = jni::get_field_id(env, Class, "fragmentUrl", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass userFullInfo::Class;
jfieldID userFullInfo::personal_photo_fieldID;
jfieldID userFullInfo::photo_fieldID;
jfieldID userFullInfo::public_photo_fieldID;
jfieldID userFullInfo::block_list_fieldID;
jfieldID userFullInfo::can_be_called_fieldID;
jfieldID userFullInfo::supports_video_calls_fieldID;
jfieldID userFullInfo::has_private_calls_fieldID;
jfieldID userFullInfo::has_private_forwards_fieldID;
jfieldID userFullInfo::has_restricted_voice_and_video_note_messages_fieldID;
jfieldID userFullInfo::has_posted_to_profile_stories_fieldID;
jfieldID userFullInfo::has_sponsored_messages_enabled_fieldID;
jfieldID userFullInfo::need_phone_number_privacy_exception_fieldID;
jfieldID userFullInfo::set_chat_background_fieldID;
jfieldID userFullInfo::uses_unofficial_app_fieldID;
jfieldID userFullInfo::bio_fieldID;
jfieldID userFullInfo::birthdate_fieldID;
jfieldID userFullInfo::personal_chat_id_fieldID;
jfieldID userFullInfo::gift_count_fieldID;
jfieldID userFullInfo::group_in_common_count_fieldID;
jfieldID userFullInfo::incoming_paid_message_star_count_fieldID;
jfieldID userFullInfo::outgoing_paid_message_star_count_fieldID;
jfieldID userFullInfo::gift_settings_fieldID;
jfieldID userFullInfo::bot_verification_fieldID;
jfieldID userFullInfo::main_profile_tab_fieldID;
jfieldID userFullInfo::first_profile_audio_fieldID;
jfieldID userFullInfo::rating_fieldID;
jfieldID userFullInfo::pending_rating_fieldID;
jfieldID userFullInfo::pending_rating_date_fieldID;
jfieldID userFullInfo::note_fieldID;
jfieldID userFullInfo::business_info_fieldID;
jfieldID userFullInfo::bot_info_fieldID;

userFullInfo::userFullInfo()
  : personal_photo_()
  , photo_()
  , public_photo_()
  , block_list_()
  , can_be_called_()
  , supports_video_calls_()
  , has_private_calls_()
  , has_private_forwards_()
  , has_restricted_voice_and_video_note_messages_()
  , has_posted_to_profile_stories_()
  , has_sponsored_messages_enabled_()
  , need_phone_number_privacy_exception_()
  , set_chat_background_()
  , uses_unofficial_app_()
  , bio_()
  , birthdate_()
  , personal_chat_id_()
  , gift_count_()
  , group_in_common_count_()
  , incoming_paid_message_star_count_()
  , outgoing_paid_message_star_count_()
  , gift_settings_()
  , bot_verification_()
  , main_profile_tab_()
  , first_profile_audio_()
  , rating_()
  , pending_rating_()
  , pending_rating_date_()
  , note_()
  , business_info_()
  , bot_info_()
{}

userFullInfo::userFullInfo(object_ptr<chatPhoto> &&personal_photo_, object_ptr<chatPhoto> &&photo_, object_ptr<chatPhoto> &&public_photo_, object_ptr<BlockList> &&block_list_, bool can_be_called_, bool supports_video_calls_, bool has_private_calls_, bool has_private_forwards_, bool has_restricted_voice_and_video_note_messages_, bool has_posted_to_profile_stories_, bool has_sponsored_messages_enabled_, bool need_phone_number_privacy_exception_, bool set_chat_background_, bool uses_unofficial_app_, object_ptr<formattedText> &&bio_, object_ptr<birthdate> &&birthdate_, int53 personal_chat_id_, int32 gift_count_, int32 group_in_common_count_, int53 incoming_paid_message_star_count_, int53 outgoing_paid_message_star_count_, object_ptr<giftSettings> &&gift_settings_, object_ptr<botVerification> &&bot_verification_, object_ptr<ProfileTab> &&main_profile_tab_, object_ptr<audio> &&first_profile_audio_, object_ptr<userRating> &&rating_, object_ptr<userRating> &&pending_rating_, int32 pending_rating_date_, object_ptr<formattedText> &&note_, object_ptr<businessInfo> &&business_info_, object_ptr<botInfo> &&bot_info_)
  : personal_photo_(std::move(personal_photo_))
  , photo_(std::move(photo_))
  , public_photo_(std::move(public_photo_))
  , block_list_(std::move(block_list_))
  , can_be_called_(can_be_called_)
  , supports_video_calls_(supports_video_calls_)
  , has_private_calls_(has_private_calls_)
  , has_private_forwards_(has_private_forwards_)
  , has_restricted_voice_and_video_note_messages_(has_restricted_voice_and_video_note_messages_)
  , has_posted_to_profile_stories_(has_posted_to_profile_stories_)
  , has_sponsored_messages_enabled_(has_sponsored_messages_enabled_)
  , need_phone_number_privacy_exception_(need_phone_number_privacy_exception_)
  , set_chat_background_(set_chat_background_)
  , uses_unofficial_app_(uses_unofficial_app_)
  , bio_(std::move(bio_))
  , birthdate_(std::move(birthdate_))
  , personal_chat_id_(personal_chat_id_)
  , gift_count_(gift_count_)
  , group_in_common_count_(group_in_common_count_)
  , incoming_paid_message_star_count_(incoming_paid_message_star_count_)
  , outgoing_paid_message_star_count_(outgoing_paid_message_star_count_)
  , gift_settings_(std::move(gift_settings_))
  , bot_verification_(std::move(bot_verification_))
  , main_profile_tab_(std::move(main_profile_tab_))
  , first_profile_audio_(std::move(first_profile_audio_))
  , rating_(std::move(rating_))
  , pending_rating_(std::move(pending_rating_))
  , pending_rating_date_(pending_rating_date_)
  , note_(std::move(note_))
  , business_info_(std::move(business_info_))
  , bot_info_(std::move(bot_info_))
{}

const std::int32_t userFullInfo::ID;

object_ptr<userFullInfo> userFullInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userFullInfo> res = make_object<userFullInfo>();
  res->personal_photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->personal_photo_fieldID));
  res->photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->public_photo_ = jni::fetch_tl_object<chatPhoto>(env, jni::fetch_object(env, p, res->public_photo_fieldID));
  res->block_list_ = jni::fetch_tl_object<BlockList>(env, jni::fetch_object(env, p, res->block_list_fieldID));
  res->can_be_called_ = (env->GetBooleanField(p, res->can_be_called_fieldID) != 0);
  res->supports_video_calls_ = (env->GetBooleanField(p, res->supports_video_calls_fieldID) != 0);
  res->has_private_calls_ = (env->GetBooleanField(p, res->has_private_calls_fieldID) != 0);
  res->has_private_forwards_ = (env->GetBooleanField(p, res->has_private_forwards_fieldID) != 0);
  res->has_restricted_voice_and_video_note_messages_ = (env->GetBooleanField(p, res->has_restricted_voice_and_video_note_messages_fieldID) != 0);
  res->has_posted_to_profile_stories_ = (env->GetBooleanField(p, res->has_posted_to_profile_stories_fieldID) != 0);
  res->has_sponsored_messages_enabled_ = (env->GetBooleanField(p, res->has_sponsored_messages_enabled_fieldID) != 0);
  res->need_phone_number_privacy_exception_ = (env->GetBooleanField(p, res->need_phone_number_privacy_exception_fieldID) != 0);
  res->set_chat_background_ = (env->GetBooleanField(p, res->set_chat_background_fieldID) != 0);
  res->uses_unofficial_app_ = (env->GetBooleanField(p, res->uses_unofficial_app_fieldID) != 0);
  res->bio_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->bio_fieldID));
  res->birthdate_ = jni::fetch_tl_object<birthdate>(env, jni::fetch_object(env, p, res->birthdate_fieldID));
  res->personal_chat_id_ = env->GetLongField(p, res->personal_chat_id_fieldID);
  res->gift_count_ = env->GetIntField(p, res->gift_count_fieldID);
  res->group_in_common_count_ = env->GetIntField(p, res->group_in_common_count_fieldID);
  res->incoming_paid_message_star_count_ = env->GetLongField(p, res->incoming_paid_message_star_count_fieldID);
  res->outgoing_paid_message_star_count_ = env->GetLongField(p, res->outgoing_paid_message_star_count_fieldID);
  res->gift_settings_ = jni::fetch_tl_object<giftSettings>(env, jni::fetch_object(env, p, res->gift_settings_fieldID));
  res->bot_verification_ = jni::fetch_tl_object<botVerification>(env, jni::fetch_object(env, p, res->bot_verification_fieldID));
  res->main_profile_tab_ = jni::fetch_tl_object<ProfileTab>(env, jni::fetch_object(env, p, res->main_profile_tab_fieldID));
  res->first_profile_audio_ = jni::fetch_tl_object<audio>(env, jni::fetch_object(env, p, res->first_profile_audio_fieldID));
  res->rating_ = jni::fetch_tl_object<userRating>(env, jni::fetch_object(env, p, res->rating_fieldID));
  res->pending_rating_ = jni::fetch_tl_object<userRating>(env, jni::fetch_object(env, p, res->pending_rating_fieldID));
  res->pending_rating_date_ = env->GetIntField(p, res->pending_rating_date_fieldID);
  res->note_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->note_fieldID));
  res->business_info_ = jni::fetch_tl_object<businessInfo>(env, jni::fetch_object(env, p, res->business_info_fieldID));
  res->bot_info_ = jni::fetch_tl_object<botInfo>(env, jni::fetch_object(env, p, res->bot_info_fieldID));
  return res;
}

void userFullInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (personal_photo_ != nullptr) { jobject next; personal_photo_->store(env, next); if (next) { env->SetObjectField(s, personal_photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (public_photo_ != nullptr) { jobject next; public_photo_->store(env, next); if (next) { env->SetObjectField(s, public_photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (block_list_ != nullptr) { jobject next; block_list_->store(env, next); if (next) { env->SetObjectField(s, block_list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_be_called_fieldID, can_be_called_);
  env->SetBooleanField(s, supports_video_calls_fieldID, supports_video_calls_);
  env->SetBooleanField(s, has_private_calls_fieldID, has_private_calls_);
  env->SetBooleanField(s, has_private_forwards_fieldID, has_private_forwards_);
  env->SetBooleanField(s, has_restricted_voice_and_video_note_messages_fieldID, has_restricted_voice_and_video_note_messages_);
  env->SetBooleanField(s, has_posted_to_profile_stories_fieldID, has_posted_to_profile_stories_);
  env->SetBooleanField(s, has_sponsored_messages_enabled_fieldID, has_sponsored_messages_enabled_);
  env->SetBooleanField(s, need_phone_number_privacy_exception_fieldID, need_phone_number_privacy_exception_);
  env->SetBooleanField(s, set_chat_background_fieldID, set_chat_background_);
  env->SetBooleanField(s, uses_unofficial_app_fieldID, uses_unofficial_app_);
  if (bio_ != nullptr) { jobject next; bio_->store(env, next); if (next) { env->SetObjectField(s, bio_fieldID, next); env->DeleteLocalRef(next); } }
  if (birthdate_ != nullptr) { jobject next; birthdate_->store(env, next); if (next) { env->SetObjectField(s, birthdate_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, personal_chat_id_fieldID, personal_chat_id_);
  env->SetIntField(s, gift_count_fieldID, gift_count_);
  env->SetIntField(s, group_in_common_count_fieldID, group_in_common_count_);
  env->SetLongField(s, incoming_paid_message_star_count_fieldID, incoming_paid_message_star_count_);
  env->SetLongField(s, outgoing_paid_message_star_count_fieldID, outgoing_paid_message_star_count_);
  if (gift_settings_ != nullptr) { jobject next; gift_settings_->store(env, next); if (next) { env->SetObjectField(s, gift_settings_fieldID, next); env->DeleteLocalRef(next); } }
  if (bot_verification_ != nullptr) { jobject next; bot_verification_->store(env, next); if (next) { env->SetObjectField(s, bot_verification_fieldID, next); env->DeleteLocalRef(next); } }
  if (main_profile_tab_ != nullptr) { jobject next; main_profile_tab_->store(env, next); if (next) { env->SetObjectField(s, main_profile_tab_fieldID, next); env->DeleteLocalRef(next); } }
  if (first_profile_audio_ != nullptr) { jobject next; first_profile_audio_->store(env, next); if (next) { env->SetObjectField(s, first_profile_audio_fieldID, next); env->DeleteLocalRef(next); } }
  if (rating_ != nullptr) { jobject next; rating_->store(env, next); if (next) { env->SetObjectField(s, rating_fieldID, next); env->DeleteLocalRef(next); } }
  if (pending_rating_ != nullptr) { jobject next; pending_rating_->store(env, next); if (next) { env->SetObjectField(s, pending_rating_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, pending_rating_date_fieldID, pending_rating_date_);
  if (note_ != nullptr) { jobject next; note_->store(env, next); if (next) { env->SetObjectField(s, note_fieldID, next); env->DeleteLocalRef(next); } }
  if (business_info_ != nullptr) { jobject next; business_info_->store(env, next); if (next) { env->SetObjectField(s, business_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (bot_info_ != nullptr) { jobject next; bot_info_->store(env, next); if (next) { env->SetObjectField(s, bot_info_fieldID, next); env->DeleteLocalRef(next); } }
}

void userFullInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserFullInfo");
    s.store_object_field("personalPhoto", static_cast<const BaseObject *>(personal_photo_.get()));
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_object_field("publicPhoto", static_cast<const BaseObject *>(public_photo_.get()));
    s.store_object_field("blockList", static_cast<const BaseObject *>(block_list_.get()));
    s.store_field("canBeCalled", can_be_called_);
    s.store_field("supportsVideoCalls", supports_video_calls_);
    s.store_field("hasPrivateCalls", has_private_calls_);
    s.store_field("hasPrivateForwards", has_private_forwards_);
    s.store_field("hasRestrictedVoiceAndVideoNoteMessages", has_restricted_voice_and_video_note_messages_);
    s.store_field("hasPostedToProfileStories", has_posted_to_profile_stories_);
    s.store_field("hasSponsoredMessagesEnabled", has_sponsored_messages_enabled_);
    s.store_field("needPhoneNumberPrivacyException", need_phone_number_privacy_exception_);
    s.store_field("setChatBackground", set_chat_background_);
    s.store_field("usesUnofficialApp", uses_unofficial_app_);
    s.store_object_field("bio", static_cast<const BaseObject *>(bio_.get()));
    s.store_object_field("birthdate", static_cast<const BaseObject *>(birthdate_.get()));
    s.store_field("personalChatId", personal_chat_id_);
    s.store_field("giftCount", gift_count_);
    s.store_field("groupInCommonCount", group_in_common_count_);
    s.store_field("incomingPaidMessageStarCount", incoming_paid_message_star_count_);
    s.store_field("outgoingPaidMessageStarCount", outgoing_paid_message_star_count_);
    s.store_object_field("giftSettings", static_cast<const BaseObject *>(gift_settings_.get()));
    s.store_object_field("botVerification", static_cast<const BaseObject *>(bot_verification_.get()));
    s.store_object_field("mainProfileTab", static_cast<const BaseObject *>(main_profile_tab_.get()));
    s.store_object_field("firstProfileAudio", static_cast<const BaseObject *>(first_profile_audio_.get()));
    s.store_object_field("rating", static_cast<const BaseObject *>(rating_.get()));
    s.store_object_field("pendingRating", static_cast<const BaseObject *>(pending_rating_.get()));
    s.store_field("pendingRatingDate", pending_rating_date_);
    s.store_object_field("note", static_cast<const BaseObject *>(note_.get()));
    s.store_object_field("businessInfo", static_cast<const BaseObject *>(business_info_.get()));
    s.store_object_field("botInfo", static_cast<const BaseObject *>(bot_info_.get()));
    s.store_class_end();
  }
}

void userFullInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UserFullInfo").c_str());
    personal_photo_fieldID = jni::get_field_id(env, Class, "personalPhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    public_photo_fieldID = jni::get_field_id(env, Class, "publicPhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhoto;").c_str());
    block_list_fieldID = jni::get_field_id(env, Class, "blockList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BlockList;").c_str());
    can_be_called_fieldID = jni::get_field_id(env, Class, "canBeCalled", "Z");
    supports_video_calls_fieldID = jni::get_field_id(env, Class, "supportsVideoCalls", "Z");
    has_private_calls_fieldID = jni::get_field_id(env, Class, "hasPrivateCalls", "Z");
    has_private_forwards_fieldID = jni::get_field_id(env, Class, "hasPrivateForwards", "Z");
    has_restricted_voice_and_video_note_messages_fieldID = jni::get_field_id(env, Class, "hasRestrictedVoiceAndVideoNoteMessages", "Z");
    has_posted_to_profile_stories_fieldID = jni::get_field_id(env, Class, "hasPostedToProfileStories", "Z");
    has_sponsored_messages_enabled_fieldID = jni::get_field_id(env, Class, "hasSponsoredMessagesEnabled", "Z");
    need_phone_number_privacy_exception_fieldID = jni::get_field_id(env, Class, "needPhoneNumberPrivacyException", "Z");
    set_chat_background_fieldID = jni::get_field_id(env, Class, "setChatBackground", "Z");
    uses_unofficial_app_fieldID = jni::get_field_id(env, Class, "usesUnofficialApp", "Z");
    bio_fieldID = jni::get_field_id(env, Class, "bio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    birthdate_fieldID = jni::get_field_id(env, Class, "birthdate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Birthdate;").c_str());
    personal_chat_id_fieldID = jni::get_field_id(env, Class, "personalChatId", "J");
    gift_count_fieldID = jni::get_field_id(env, Class, "giftCount", "I");
    group_in_common_count_fieldID = jni::get_field_id(env, Class, "groupInCommonCount", "I");
    incoming_paid_message_star_count_fieldID = jni::get_field_id(env, Class, "incomingPaidMessageStarCount", "J");
    outgoing_paid_message_star_count_fieldID = jni::get_field_id(env, Class, "outgoingPaidMessageStarCount", "J");
    gift_settings_fieldID = jni::get_field_id(env, Class, "giftSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftSettings;").c_str());
    bot_verification_fieldID = jni::get_field_id(env, Class, "botVerification", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotVerification;").c_str());
    main_profile_tab_fieldID = jni::get_field_id(env, Class, "mainProfileTab", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProfileTab;").c_str());
    first_profile_audio_fieldID = jni::get_field_id(env, Class, "firstProfileAudio", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Audio;").c_str());
    rating_fieldID = jni::get_field_id(env, Class, "rating", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserRating;").c_str());
    pending_rating_fieldID = jni::get_field_id(env, Class, "pendingRating", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UserRating;").c_str());
    pending_rating_date_fieldID = jni::get_field_id(env, Class, "pendingRatingDate", "I");
    note_fieldID = jni::get_field_id(env, Class, "note", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    business_info_fieldID = jni::get_field_id(env, Class, "businessInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BusinessInfo;").c_str());
    bot_info_fieldID = jni::get_field_id(env, Class, "botInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BotInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass venue::Class;
jfieldID venue::location_fieldID;
jfieldID venue::title_fieldID;
jfieldID venue::address_fieldID;
jfieldID venue::provider_fieldID;
jfieldID venue::id_fieldID;
jfieldID venue::type_fieldID;

venue::venue()
  : location_()
  , title_()
  , address_()
  , provider_()
  , id_()
  , type_()
{}

venue::venue(object_ptr<location> &&location_, string const &title_, string const &address_, string const &provider_, string const &id_, string const &type_)
  : location_(std::move(location_))
  , title_(title_)
  , address_(address_)
  , provider_(provider_)
  , id_(id_)
  , type_(type_)
{}

const std::int32_t venue::ID;

object_ptr<venue> venue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<venue> res = make_object<venue>();
  res->location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->address_ = jni::fetch_string(env, p, res->address_fieldID);
  res->provider_ = jni::fetch_string(env, p, res->provider_fieldID);
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->type_ = jni::fetch_string(env, p, res->type_fieldID);
  return res;
}

void venue::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, address_); if (nextString) { env->SetObjectField(s, address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, provider_); if (nextString) { env->SetObjectField(s, provider_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, type_); if (nextString) { env->SetObjectField(s, type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void venue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Venue");
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("title", title_);
    s.store_field("address", address_);
    s.store_field("provider", provider_);
    s.store_field("id", id_);
    s.store_field("type", type_);
    s.store_class_end();
  }
}

void venue::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Venue").c_str());
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    address_fieldID = jni::get_field_id(env, Class, "address", "Ljava/lang/String;");
    provider_fieldID = jni::get_field_id(env, Class, "provider", "Ljava/lang/String;");
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    type_fieldID = jni::get_field_id(env, Class, "type", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass videoMessageAdvertisement::Class;
jfieldID videoMessageAdvertisement::unique_id_fieldID;
jfieldID videoMessageAdvertisement::text_fieldID;
jfieldID videoMessageAdvertisement::min_display_duration_fieldID;
jfieldID videoMessageAdvertisement::max_display_duration_fieldID;
jfieldID videoMessageAdvertisement::can_be_reported_fieldID;
jfieldID videoMessageAdvertisement::sponsor_fieldID;
jfieldID videoMessageAdvertisement::title_fieldID;
jfieldID videoMessageAdvertisement::additional_info_fieldID;

videoMessageAdvertisement::videoMessageAdvertisement()
  : unique_id_()
  , text_()
  , min_display_duration_()
  , max_display_duration_()
  , can_be_reported_()
  , sponsor_()
  , title_()
  , additional_info_()
{}

videoMessageAdvertisement::videoMessageAdvertisement(int53 unique_id_, string const &text_, int32 min_display_duration_, int32 max_display_duration_, bool can_be_reported_, object_ptr<advertisementSponsor> &&sponsor_, string const &title_, string const &additional_info_)
  : unique_id_(unique_id_)
  , text_(text_)
  , min_display_duration_(min_display_duration_)
  , max_display_duration_(max_display_duration_)
  , can_be_reported_(can_be_reported_)
  , sponsor_(std::move(sponsor_))
  , title_(title_)
  , additional_info_(additional_info_)
{}

const std::int32_t videoMessageAdvertisement::ID;

object_ptr<videoMessageAdvertisement> videoMessageAdvertisement::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<videoMessageAdvertisement> res = make_object<videoMessageAdvertisement>();
  res->unique_id_ = env->GetLongField(p, res->unique_id_fieldID);
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  res->min_display_duration_ = env->GetIntField(p, res->min_display_duration_fieldID);
  res->max_display_duration_ = env->GetIntField(p, res->max_display_duration_fieldID);
  res->can_be_reported_ = (env->GetBooleanField(p, res->can_be_reported_fieldID) != 0);
  res->sponsor_ = jni::fetch_tl_object<advertisementSponsor>(env, jni::fetch_object(env, p, res->sponsor_fieldID));
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->additional_info_ = jni::fetch_string(env, p, res->additional_info_fieldID);
  return res;
}

void videoMessageAdvertisement::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, unique_id_fieldID, unique_id_);
  { jstring nextString = jni::to_jstring(env, text_); if (nextString) { env->SetObjectField(s, text_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, min_display_duration_fieldID, min_display_duration_);
  env->SetIntField(s, max_display_duration_fieldID, max_display_duration_);
  env->SetBooleanField(s, can_be_reported_fieldID, can_be_reported_);
  if (sponsor_ != nullptr) { jobject next; sponsor_->store(env, next); if (next) { env->SetObjectField(s, sponsor_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, additional_info_); if (nextString) { env->SetObjectField(s, additional_info_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void videoMessageAdvertisement::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VideoMessageAdvertisement");
    s.store_field("uniqueId", unique_id_);
    s.store_field("text", text_);
    s.store_field("minDisplayDuration", min_display_duration_);
    s.store_field("maxDisplayDuration", max_display_duration_);
    s.store_field("canBeReported", can_be_reported_);
    s.store_object_field("sponsor", static_cast<const BaseObject *>(sponsor_.get()));
    s.store_field("title", title_);
    s.store_field("additionalInfo", additional_info_);
    s.store_class_end();
  }
}

void videoMessageAdvertisement::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VideoMessageAdvertisement").c_str());
    unique_id_fieldID = jni::get_field_id(env, Class, "uniqueId", "J");
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    min_display_duration_fieldID = jni::get_field_id(env, Class, "minDisplayDuration", "I");
    max_display_duration_fieldID = jni::get_field_id(env, Class, "maxDisplayDuration", "I");
    can_be_reported_fieldID = jni::get_field_id(env, Class, "canBeReported", "Z");
    sponsor_fieldID = jni::get_field_id(env, Class, "sponsor", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AdvertisementSponsor;").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    additional_info_fieldID = jni::get_field_id(env, Class, "additionalInfo", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass videoStoryboard::Class;
jfieldID videoStoryboard::storyboard_file_fieldID;
jfieldID videoStoryboard::width_fieldID;
jfieldID videoStoryboard::height_fieldID;
jfieldID videoStoryboard::map_file_fieldID;

videoStoryboard::videoStoryboard()
  : storyboard_file_()
  , width_()
  , height_()
  , map_file_()
{}

videoStoryboard::videoStoryboard(object_ptr<file> &&storyboard_file_, int32 width_, int32 height_, object_ptr<file> &&map_file_)
  : storyboard_file_(std::move(storyboard_file_))
  , width_(width_)
  , height_(height_)
  , map_file_(std::move(map_file_))
{}

const std::int32_t videoStoryboard::ID;

object_ptr<videoStoryboard> videoStoryboard::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<videoStoryboard> res = make_object<videoStoryboard>();
  res->storyboard_file_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->storyboard_file_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->map_file_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->map_file_fieldID));
  return res;
}

void videoStoryboard::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (storyboard_file_ != nullptr) { jobject next; storyboard_file_->store(env, next); if (next) { env->SetObjectField(s, storyboard_file_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  if (map_file_ != nullptr) { jobject next; map_file_->store(env, next); if (next) { env->SetObjectField(s, map_file_fieldID, next); env->DeleteLocalRef(next); } }
}

void videoStoryboard::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VideoStoryboard");
    s.store_object_field("storyboardFile", static_cast<const BaseObject *>(storyboard_file_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_object_field("mapFile", static_cast<const BaseObject *>(map_file_.get()));
    s.store_class_end();
  }
}

void videoStoryboard::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VideoStoryboard").c_str());
    storyboard_file_fieldID = jni::get_field_id(env, Class, "storyboardFile", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    map_file_fieldID = jni::get_field_id(env, Class, "mapFile", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass acceptTermsOfService::Class;
jfieldID acceptTermsOfService::terms_of_service_id_fieldID;

acceptTermsOfService::acceptTermsOfService()
  : terms_of_service_id_()
{}

acceptTermsOfService::acceptTermsOfService(string const &terms_of_service_id_)
  : terms_of_service_id_(terms_of_service_id_)
{}

const std::int32_t acceptTermsOfService::ID;

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

void acceptTermsOfService::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AcceptTermsOfService");
    s.store_field("termsOfServiceId", terms_of_service_id_);
    s.store_class_end();
  }
}

acceptTermsOfService::ReturnType acceptTermsOfService::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass allowUnpaidMessagesFromUser::Class;
jfieldID allowUnpaidMessagesFromUser::user_id_fieldID;
jfieldID allowUnpaidMessagesFromUser::refund_payments_fieldID;

allowUnpaidMessagesFromUser::allowUnpaidMessagesFromUser()
  : user_id_()
  , refund_payments_()
{}

allowUnpaidMessagesFromUser::allowUnpaidMessagesFromUser(int53 user_id_, bool refund_payments_)
  : user_id_(user_id_)
  , refund_payments_(refund_payments_)
{}

const std::int32_t allowUnpaidMessagesFromUser::ID;

object_ptr<allowUnpaidMessagesFromUser> allowUnpaidMessagesFromUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<allowUnpaidMessagesFromUser> res = make_object<allowUnpaidMessagesFromUser>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->refund_payments_ = (env->GetBooleanField(p, res->refund_payments_fieldID) != 0);
  return res;
}

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

allowUnpaidMessagesFromUser::ReturnType allowUnpaidMessagesFromUser::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass canSendMessageToUser::Class;
jfieldID canSendMessageToUser::user_id_fieldID;
jfieldID canSendMessageToUser::only_local_fieldID;

canSendMessageToUser::canSendMessageToUser()
  : user_id_()
  , only_local_()
{}

canSendMessageToUser::canSendMessageToUser(int53 user_id_, bool only_local_)
  : user_id_(user_id_)
  , only_local_(only_local_)
{}

const std::int32_t canSendMessageToUser::ID;

object_ptr<canSendMessageToUser> canSendMessageToUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canSendMessageToUser> res = make_object<canSendMessageToUser>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->only_local_ = (env->GetBooleanField(p, res->only_local_fieldID) != 0);
  return res;
}

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

canSendMessageToUser::ReturnType canSendMessageToUser::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return CanSendMessageToUserResult::fetch(env, p);
}

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

jclass clearAllDraftMessages::Class;
jfieldID clearAllDraftMessages::exclude_secret_chats_fieldID;

clearAllDraftMessages::clearAllDraftMessages()
  : exclude_secret_chats_()
{}

clearAllDraftMessages::clearAllDraftMessages(bool exclude_secret_chats_)
  : exclude_secret_chats_(exclude_secret_chats_)
{}

const std::int32_t clearAllDraftMessages::ID;

object_ptr<clearAllDraftMessages> clearAllDraftMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<clearAllDraftMessages> res = make_object<clearAllDraftMessages>();
  res->exclude_secret_chats_ = (env->GetBooleanField(p, res->exclude_secret_chats_fieldID) != 0);
  return res;
}

void clearAllDraftMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ClearAllDraftMessages");
    s.store_field("excludeSecretChats", exclude_secret_chats_);
    s.store_class_end();
  }
}

clearAllDraftMessages::ReturnType clearAllDraftMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass commitPendingLiveStoryReactions::Class;
jfieldID commitPendingLiveStoryReactions::group_call_id_fieldID;

commitPendingLiveStoryReactions::commitPendingLiveStoryReactions()
  : group_call_id_()
{}

commitPendingLiveStoryReactions::commitPendingLiveStoryReactions(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t commitPendingLiveStoryReactions::ID;

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

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

commitPendingLiveStoryReactions::ReturnType commitPendingLiveStoryReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass createForumTopic::Class;
jfieldID createForumTopic::chat_id_fieldID;
jfieldID createForumTopic::name_fieldID;
jfieldID createForumTopic::is_name_implicit_fieldID;
jfieldID createForumTopic::icon_fieldID;

createForumTopic::createForumTopic()
  : chat_id_()
  , name_()
  , is_name_implicit_()
  , icon_()
{}

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

const std::int32_t createForumTopic::ID;

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

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

createForumTopic::ReturnType createForumTopic::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return forumTopicInfo::fetch(env, p);
}

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

jclass createPrivateChat::Class;
jfieldID createPrivateChat::user_id_fieldID;
jfieldID createPrivateChat::force_fieldID;

createPrivateChat::createPrivateChat()
  : user_id_()
  , force_()
{}

createPrivateChat::createPrivateChat(int53 user_id_, bool force_)
  : user_id_(user_id_)
  , force_(force_)
{}

const std::int32_t createPrivateChat::ID;

object_ptr<createPrivateChat> createPrivateChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createPrivateChat> res = make_object<createPrivateChat>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->force_ = (env->GetBooleanField(p, res->force_fieldID) != 0);
  return res;
}

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

createPrivateChat::ReturnType createPrivateChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

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

jclass declineGroupCallInvitation::Class;
jfieldID declineGroupCallInvitation::chat_id_fieldID;
jfieldID declineGroupCallInvitation::message_id_fieldID;

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

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

const std::int32_t declineGroupCallInvitation::ID;

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

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

declineGroupCallInvitation::ReturnType declineGroupCallInvitation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteAccount::Class;
jfieldID deleteAccount::reason_fieldID;
jfieldID deleteAccount::password_fieldID;

deleteAccount::deleteAccount()
  : reason_()
  , password_()
{}

deleteAccount::deleteAccount(string const &reason_, string const &password_)
  : reason_(reason_)
  , password_(password_)
{}

const std::int32_t deleteAccount::ID;

object_ptr<deleteAccount> deleteAccount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteAccount> res = make_object<deleteAccount>();
  res->reason_ = jni::fetch_string(env, p, res->reason_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void deleteAccount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteAccount");
    s.store_field("reason", reason_);
    s.store_field("password", password_);
    s.store_class_end();
  }
}

deleteAccount::ReturnType deleteAccount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteBusinessMessages::Class;
jfieldID deleteBusinessMessages::business_connection_id_fieldID;
jfieldID deleteBusinessMessages::message_ids_fieldID;

deleteBusinessMessages::deleteBusinessMessages()
  : business_connection_id_()
  , message_ids_()
{}

deleteBusinessMessages::deleteBusinessMessages(string const &business_connection_id_, array<int53> &&message_ids_)
  : business_connection_id_(business_connection_id_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t deleteBusinessMessages::ID;

object_ptr<deleteBusinessMessages> deleteBusinessMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteBusinessMessages> res = make_object<deleteBusinessMessages>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return res;
}

void deleteBusinessMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteBusinessMessages");
    s.store_field("businessConnectionId", business_connection_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();
  }
}

deleteBusinessMessages::ReturnType deleteBusinessMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteBusinessMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteBusinessMessages").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass deleteChatMessagesByDate::Class;
jfieldID deleteChatMessagesByDate::chat_id_fieldID;
jfieldID deleteChatMessagesByDate::min_date_fieldID;
jfieldID deleteChatMessagesByDate::max_date_fieldID;
jfieldID deleteChatMessagesByDate::revoke_fieldID;

deleteChatMessagesByDate::deleteChatMessagesByDate()
  : chat_id_()
  , min_date_()
  , max_date_()
  , revoke_()
{}

deleteChatMessagesByDate::deleteChatMessagesByDate(int53 chat_id_, int32 min_date_, int32 max_date_, bool revoke_)
  : chat_id_(chat_id_)
  , min_date_(min_date_)
  , max_date_(max_date_)
  , revoke_(revoke_)
{}

const std::int32_t deleteChatMessagesByDate::ID;

object_ptr<deleteChatMessagesByDate> deleteChatMessagesByDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteChatMessagesByDate> res = make_object<deleteChatMessagesByDate>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->min_date_ = env->GetIntField(p, res->min_date_fieldID);
  res->max_date_ = env->GetIntField(p, res->max_date_fieldID);
  res->revoke_ = (env->GetBooleanField(p, res->revoke_fieldID) != 0);
  return res;
}

void deleteChatMessagesByDate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteChatMessagesByDate");
    s.store_field("chatId", chat_id_);
    s.store_field("minDate", min_date_);
    s.store_field("maxDate", max_date_);
    s.store_field("revoke", revoke_);
    s.store_class_end();
  }
}

deleteChatMessagesByDate::ReturnType deleteChatMessagesByDate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteChatMessagesByDate::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteChatMessagesByDate").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    min_date_fieldID = jni::get_field_id(env, Class, "minDate", "I");
    max_date_fieldID = jni::get_field_id(env, Class, "maxDate", "I");
    revoke_fieldID = jni::get_field_id(env, Class, "revoke", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass deleteChatReplyMarkup::Class;
jfieldID deleteChatReplyMarkup::chat_id_fieldID;
jfieldID deleteChatReplyMarkup::message_id_fieldID;

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

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

const std::int32_t deleteChatReplyMarkup::ID;

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

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

deleteChatReplyMarkup::ReturnType deleteChatReplyMarkup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteDirectMessagesChatTopicMessagesByDate::Class;
jfieldID deleteDirectMessagesChatTopicMessagesByDate::chat_id_fieldID;
jfieldID deleteDirectMessagesChatTopicMessagesByDate::topic_id_fieldID;
jfieldID deleteDirectMessagesChatTopicMessagesByDate::min_date_fieldID;
jfieldID deleteDirectMessagesChatTopicMessagesByDate::max_date_fieldID;

deleteDirectMessagesChatTopicMessagesByDate::deleteDirectMessagesChatTopicMessagesByDate()
  : chat_id_()
  , topic_id_()
  , min_date_()
  , max_date_()
{}

deleteDirectMessagesChatTopicMessagesByDate::deleteDirectMessagesChatTopicMessagesByDate(int53 chat_id_, int53 topic_id_, int32 min_date_, int32 max_date_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
  , min_date_(min_date_)
  , max_date_(max_date_)
{}

const std::int32_t deleteDirectMessagesChatTopicMessagesByDate::ID;

object_ptr<deleteDirectMessagesChatTopicMessagesByDate> deleteDirectMessagesChatTopicMessagesByDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteDirectMessagesChatTopicMessagesByDate> res = make_object<deleteDirectMessagesChatTopicMessagesByDate>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = env->GetLongField(p, res->topic_id_fieldID);
  res->min_date_ = env->GetIntField(p, res->min_date_fieldID);
  res->max_date_ = env->GetIntField(p, res->max_date_fieldID);
  return res;
}

void deleteDirectMessagesChatTopicMessagesByDate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteDirectMessagesChatTopicMessagesByDate");
    s.store_field("chatId", chat_id_);
    s.store_field("topicId", topic_id_);
    s.store_field("minDate", min_date_);
    s.store_field("maxDate", max_date_);
    s.store_class_end();
  }
}

deleteDirectMessagesChatTopicMessagesByDate::ReturnType deleteDirectMessagesChatTopicMessagesByDate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteDirectMessagesChatTopicMessagesByDate::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteDirectMessagesChatTopicMessagesByDate").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", "J");
    min_date_fieldID = jni::get_field_id(env, Class, "minDate", "I");
    max_date_fieldID = jni::get_field_id(env, Class, "maxDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass deleteForumTopic::Class;
jfieldID deleteForumTopic::chat_id_fieldID;
jfieldID deleteForumTopic::forum_topic_id_fieldID;

deleteForumTopic::deleteForumTopic()
  : chat_id_()
  , forum_topic_id_()
{}

deleteForumTopic::deleteForumTopic(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t deleteForumTopic::ID;

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

deleteForumTopic::ReturnType deleteForumTopic::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

deleteQuickReplyShortcutMessages::deleteQuickReplyShortcutMessages()
  : shortcut_id_()
  , message_ids_()
{}

deleteQuickReplyShortcutMessages::deleteQuickReplyShortcutMessages(int32 shortcut_id_, array<int53> &&message_ids_)
  : shortcut_id_(shortcut_id_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t deleteQuickReplyShortcutMessages::ID;

object_ptr<deleteQuickReplyShortcutMessages> deleteQuickReplyShortcutMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteQuickReplyShortcutMessages> res = make_object<deleteQuickReplyShortcutMessages>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return res;
}

void deleteQuickReplyShortcutMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteQuickReplyShortcutMessages");
    s.store_field("shortcutId", shortcut_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();
  }
}

deleteQuickReplyShortcutMessages::ReturnType deleteQuickReplyShortcutMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void deleteQuickReplyShortcutMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeleteQuickReplyShortcutMessages").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass disconnectWebsite::Class;
jfieldID disconnectWebsite::website_id_fieldID;

disconnectWebsite::disconnectWebsite()
  : website_id_()
{}

disconnectWebsite::disconnectWebsite(int64 website_id_)
  : website_id_(website_id_)
{}

const std::int32_t disconnectWebsite::ID;

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

void disconnectWebsite::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DisconnectWebsite");
    s.store_field("websiteId", website_id_);
    s.store_class_end();
  }
}

disconnectWebsite::ReturnType disconnectWebsite::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass dropGiftOriginalDetails::Class;
jfieldID dropGiftOriginalDetails::received_gift_id_fieldID;
jfieldID dropGiftOriginalDetails::star_count_fieldID;

dropGiftOriginalDetails::dropGiftOriginalDetails()
  : received_gift_id_()
  , star_count_()
{}

dropGiftOriginalDetails::dropGiftOriginalDetails(string const &received_gift_id_, int53 star_count_)
  : received_gift_id_(received_gift_id_)
  , star_count_(star_count_)
{}

const std::int32_t dropGiftOriginalDetails::ID;

object_ptr<dropGiftOriginalDetails> dropGiftOriginalDetails::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<dropGiftOriginalDetails> res = make_object<dropGiftOriginalDetails>();
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return res;
}

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

dropGiftOriginalDetails::ReturnType dropGiftOriginalDetails::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass editBusinessMessageChecklist::Class;
jfieldID editBusinessMessageChecklist::business_connection_id_fieldID;
jfieldID editBusinessMessageChecklist::chat_id_fieldID;
jfieldID editBusinessMessageChecklist::message_id_fieldID;
jfieldID editBusinessMessageChecklist::reply_markup_fieldID;
jfieldID editBusinessMessageChecklist::checklist_fieldID;

editBusinessMessageChecklist::editBusinessMessageChecklist()
  : business_connection_id_()
  , chat_id_()
  , message_id_()
  , reply_markup_()
  , checklist_()
{}

editBusinessMessageChecklist::editBusinessMessageChecklist(string const &business_connection_id_, int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<inputChecklist> &&checklist_)
  : business_connection_id_(business_connection_id_)
  , chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , checklist_(std::move(checklist_))
{}

const std::int32_t editBusinessMessageChecklist::ID;

object_ptr<editBusinessMessageChecklist> editBusinessMessageChecklist::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessMessageChecklist> res = make_object<editBusinessMessageChecklist>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->checklist_ = jni::fetch_tl_object<inputChecklist>(env, jni::fetch_object(env, p, res->checklist_fieldID));
  return res;
}

void editBusinessMessageChecklist::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessMessageChecklist");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("checklist", static_cast<const BaseObject *>(checklist_.get()));
    s.store_class_end();
  }
}

editBusinessMessageChecklist::ReturnType editBusinessMessageChecklist::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessMessage::fetch(env, p);
}

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

jclass editChatFolder::Class;
jfieldID editChatFolder::chat_folder_id_fieldID;
jfieldID editChatFolder::folder_fieldID;

editChatFolder::editChatFolder()
  : chat_folder_id_()
  , folder_()
{}

editChatFolder::editChatFolder(int32 chat_folder_id_, object_ptr<chatFolder> &&folder_)
  : chat_folder_id_(chat_folder_id_)
  , folder_(std::move(folder_))
{}

const std::int32_t editChatFolder::ID;

object_ptr<editChatFolder> editChatFolder::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editChatFolder> res = make_object<editChatFolder>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  res->folder_ = jni::fetch_tl_object<chatFolder>(env, jni::fetch_object(env, p, res->folder_fieldID));
  return res;
}

void editChatFolder::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditChatFolder");
    s.store_field("chatFolderId", chat_folder_id_);
    s.store_object_field("folder", static_cast<const BaseObject *>(folder_.get()));
    s.store_class_end();
  }
}

editChatFolder::ReturnType editChatFolder::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderInfo::fetch(env, p);
}

void editChatFolder::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditChatFolder").c_str());
    chat_folder_id_fieldID = jni::get_field_id(env, Class, "chatFolderId", "I");
    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 editInlineMessageCaption::Class;
jfieldID editInlineMessageCaption::inline_message_id_fieldID;
jfieldID editInlineMessageCaption::reply_markup_fieldID;
jfieldID editInlineMessageCaption::caption_fieldID;
jfieldID editInlineMessageCaption::show_caption_above_media_fieldID;

editInlineMessageCaption::editInlineMessageCaption()
  : inline_message_id_()
  , reply_markup_()
  , caption_()
  , show_caption_above_media_()
{}

editInlineMessageCaption::editInlineMessageCaption(string const &inline_message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<formattedText> &&caption_, bool show_caption_above_media_)
  : inline_message_id_(inline_message_id_)
  , reply_markup_(std::move(reply_markup_))
  , caption_(std::move(caption_))
  , show_caption_above_media_(show_caption_above_media_)
{}

const std::int32_t editInlineMessageCaption::ID;

object_ptr<editInlineMessageCaption> editInlineMessageCaption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editInlineMessageCaption> res = make_object<editInlineMessageCaption>();
  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->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->show_caption_above_media_ = (env->GetBooleanField(p, res->show_caption_above_media_fieldID) != 0);
  return res;
}

void editInlineMessageCaption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditInlineMessageCaption");
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("showCaptionAboveMedia", show_caption_above_media_);
    s.store_class_end();
  }
}

editInlineMessageCaption::ReturnType editInlineMessageCaption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass editMessageChecklist::Class;
jfieldID editMessageChecklist::chat_id_fieldID;
jfieldID editMessageChecklist::message_id_fieldID;
jfieldID editMessageChecklist::reply_markup_fieldID;
jfieldID editMessageChecklist::checklist_fieldID;

editMessageChecklist::editMessageChecklist()
  : chat_id_()
  , message_id_()
  , reply_markup_()
  , checklist_()
{}

editMessageChecklist::editMessageChecklist(int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<inputChecklist> &&checklist_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , checklist_(std::move(checklist_))
{}

const std::int32_t editMessageChecklist::ID;

object_ptr<editMessageChecklist> editMessageChecklist::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editMessageChecklist> res = make_object<editMessageChecklist>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->checklist_ = jni::fetch_tl_object<inputChecklist>(env, jni::fetch_object(env, p, res->checklist_fieldID));
  return res;
}

void editMessageChecklist::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditMessageChecklist");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("checklist", static_cast<const BaseObject *>(checklist_.get()));
    s.store_class_end();
  }
}

editMessageChecklist::ReturnType editMessageChecklist::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void editMessageChecklist::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditMessageChecklist").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    checklist_fieldID = jni::get_field_id(env, Class, "checklist", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputChecklist;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editMessageMedia::Class;
jfieldID editMessageMedia::chat_id_fieldID;
jfieldID editMessageMedia::message_id_fieldID;
jfieldID editMessageMedia::reply_markup_fieldID;
jfieldID editMessageMedia::input_message_content_fieldID;

editMessageMedia::editMessageMedia()
  : chat_id_()
  , message_id_()
  , reply_markup_()
  , input_message_content_()
{}

editMessageMedia::editMessageMedia(int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editMessageMedia::ID;

object_ptr<editMessageMedia> editMessageMedia::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editMessageMedia> res = make_object<editMessageMedia>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void editMessageMedia::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditMessageMedia");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

editMessageMedia::ReturnType editMessageMedia::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void editMessageMedia::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditMessageMedia").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    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 editMessageText::Class;
jfieldID editMessageText::chat_id_fieldID;
jfieldID editMessageText::message_id_fieldID;
jfieldID editMessageText::reply_markup_fieldID;
jfieldID editMessageText::input_message_content_fieldID;

editMessageText::editMessageText()
  : chat_id_()
  , message_id_()
  , reply_markup_()
  , input_message_content_()
{}

editMessageText::editMessageText(int53 chat_id_, int53 message_id_, object_ptr<ReplyMarkup> &&reply_markup_, object_ptr<InputMessageContent> &&input_message_content_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reply_markup_(std::move(reply_markup_))
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editMessageText::ID;

object_ptr<editMessageText> editMessageText::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editMessageText> res = make_object<editMessageText>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void editMessageText::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditMessageText");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

editMessageText::ReturnType editMessageText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void editMessageText::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditMessageText").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    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 endGroupCallScreenSharing::Class;
jfieldID endGroupCallScreenSharing::group_call_id_fieldID;

endGroupCallScreenSharing::endGroupCallScreenSharing()
  : group_call_id_()
{}

endGroupCallScreenSharing::endGroupCallScreenSharing(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t endGroupCallScreenSharing::ID;

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

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

endGroupCallScreenSharing::ReturnType endGroupCallScreenSharing::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass fixTextWithAi::Class;
jfieldID fixTextWithAi::text_fieldID;

fixTextWithAi::fixTextWithAi()
  : text_()
{}

fixTextWithAi::fixTextWithAi(object_ptr<formattedText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t fixTextWithAi::ID;

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

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

fixTextWithAi::ReturnType fixTextWithAi::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return fixedText::fetch(env, p);
}

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

jclass getAllPassportElements::Class;
jfieldID getAllPassportElements::password_fieldID;

getAllPassportElements::getAllPassportElements()
  : password_()
{}

getAllPassportElements::getAllPassportElements(string const &password_)
  : password_(password_)
{}

const std::int32_t getAllPassportElements::ID;

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

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

getAllPassportElements::ReturnType getAllPassportElements::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passportElements::fetch(env, p);
}

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

jclass getAttachedStickerSets::Class;
jfieldID getAttachedStickerSets::file_id_fieldID;

getAttachedStickerSets::getAttachedStickerSets()
  : file_id_()
{}

getAttachedStickerSets::getAttachedStickerSets(int32 file_id_)
  : file_id_(file_id_)
{}

const std::int32_t getAttachedStickerSets::ID;

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

void getAttachedStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetAttachedStickerSets");
    s.store_field("fileId", file_id_);
    s.store_class_end();
  }
}

getAttachedStickerSets::ReturnType getAttachedStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSets::fetch(env, p);
}

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

jclass getBasicGroup::Class;
jfieldID getBasicGroup::basic_group_id_fieldID;

getBasicGroup::getBasicGroup()
  : basic_group_id_()
{}

getBasicGroup::getBasicGroup(int53 basic_group_id_)
  : basic_group_id_(basic_group_id_)
{}

const std::int32_t getBasicGroup::ID;

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

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

getBasicGroup::ReturnType getBasicGroup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return basicGroup::fetch(env, p);
}

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

jclass getBasicGroupFullInfo::Class;
jfieldID getBasicGroupFullInfo::basic_group_id_fieldID;

getBasicGroupFullInfo::getBasicGroupFullInfo()
  : basic_group_id_()
{}

getBasicGroupFullInfo::getBasicGroupFullInfo(int53 basic_group_id_)
  : basic_group_id_(basic_group_id_)
{}

const std::int32_t getBasicGroupFullInfo::ID;

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

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

getBasicGroupFullInfo::ReturnType getBasicGroupFullInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return basicGroupFullInfo::fetch(env, p);
}

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

jclass getBotMediaPreviewInfo::Class;
jfieldID getBotMediaPreviewInfo::bot_user_id_fieldID;
jfieldID getBotMediaPreviewInfo::language_code_fieldID;

getBotMediaPreviewInfo::getBotMediaPreviewInfo()
  : bot_user_id_()
  , language_code_()
{}

getBotMediaPreviewInfo::getBotMediaPreviewInfo(int53 bot_user_id_, string const &language_code_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
{}

const std::int32_t getBotMediaPreviewInfo::ID;

object_ptr<getBotMediaPreviewInfo> getBotMediaPreviewInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotMediaPreviewInfo> res = make_object<getBotMediaPreviewInfo>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  return res;
}

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

getBotMediaPreviewInfo::ReturnType getBotMediaPreviewInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botMediaPreviewInfo::fetch(env, p);
}

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

jclass getChatActiveStories::Class;
jfieldID getChatActiveStories::chat_id_fieldID;

getChatActiveStories::getChatActiveStories()
  : chat_id_()
{}

getChatActiveStories::getChatActiveStories(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatActiveStories::ID;

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

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

getChatActiveStories::ReturnType getChatActiveStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatActiveStories::fetch(env, p);
}

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

jclass getChatAvailablePaidMessageReactionSenders::Class;
jfieldID getChatAvailablePaidMessageReactionSenders::chat_id_fieldID;

getChatAvailablePaidMessageReactionSenders::getChatAvailablePaidMessageReactionSenders()
  : chat_id_()
{}

getChatAvailablePaidMessageReactionSenders::getChatAvailablePaidMessageReactionSenders(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatAvailablePaidMessageReactionSenders::ID;

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

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

getChatAvailablePaidMessageReactionSenders::ReturnType getChatAvailablePaidMessageReactionSenders::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageSenders::fetch(env, p);
}

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

jclass getChatInviteLinkCounts::Class;
jfieldID getChatInviteLinkCounts::chat_id_fieldID;

getChatInviteLinkCounts::getChatInviteLinkCounts()
  : chat_id_()
{}

getChatInviteLinkCounts::getChatInviteLinkCounts(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatInviteLinkCounts::ID;

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

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

getChatInviteLinkCounts::ReturnType getChatInviteLinkCounts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLinkCounts::fetch(env, p);
}

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

jclass getChatRevenueStatistics::Class;
jfieldID getChatRevenueStatistics::chat_id_fieldID;
jfieldID getChatRevenueStatistics::is_dark_fieldID;

getChatRevenueStatistics::getChatRevenueStatistics()
  : chat_id_()
  , is_dark_()
{}

getChatRevenueStatistics::getChatRevenueStatistics(int53 chat_id_, bool is_dark_)
  : chat_id_(chat_id_)
  , is_dark_(is_dark_)
{}

const std::int32_t getChatRevenueStatistics::ID;

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

void getChatRevenueStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatRevenueStatistics");
    s.store_field("chatId", chat_id_);
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getChatRevenueStatistics::ReturnType getChatRevenueStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatRevenueStatistics::fetch(env, p);
}

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

jclass getChatScheduledMessages::Class;
jfieldID getChatScheduledMessages::chat_id_fieldID;

getChatScheduledMessages::getChatScheduledMessages()
  : chat_id_()
{}

getChatScheduledMessages::getChatScheduledMessages(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatScheduledMessages::ID;

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

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

getChatScheduledMessages::ReturnType getChatScheduledMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

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

jclass getCountryFlagEmoji::Class;
jfieldID getCountryFlagEmoji::country_code_fieldID;

getCountryFlagEmoji::getCountryFlagEmoji()
  : country_code_()
{}

getCountryFlagEmoji::getCountryFlagEmoji(string const &country_code_)
  : country_code_(country_code_)
{}

const std::int32_t getCountryFlagEmoji::ID;

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

void getCountryFlagEmoji::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetCountryFlagEmoji");
    s.store_field("countryCode", country_code_);
    s.store_class_end();
  }
}

getCountryFlagEmoji::ReturnType getCountryFlagEmoji::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getCurrentState::Class;

getCurrentState::getCurrentState() {
}

const std::int32_t getCurrentState::ID;

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

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

getCurrentState::ReturnType getCurrentState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return updates::fetch(env, p);
}

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

jclass getDirectMessagesChatTopicRevenue::Class;
jfieldID getDirectMessagesChatTopicRevenue::chat_id_fieldID;
jfieldID getDirectMessagesChatTopicRevenue::topic_id_fieldID;

getDirectMessagesChatTopicRevenue::getDirectMessagesChatTopicRevenue()
  : chat_id_()
  , topic_id_()
{}

getDirectMessagesChatTopicRevenue::getDirectMessagesChatTopicRevenue(int53 chat_id_, int53 topic_id_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
{}

const std::int32_t getDirectMessagesChatTopicRevenue::ID;

object_ptr<getDirectMessagesChatTopicRevenue> getDirectMessagesChatTopicRevenue::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getDirectMessagesChatTopicRevenue> res = make_object<getDirectMessagesChatTopicRevenue>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = env->GetLongField(p, res->topic_id_fieldID);
  return res;
}

void getDirectMessagesChatTopicRevenue::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetDirectMessagesChatTopicRevenue");
    s.store_field("chatId", chat_id_);
    s.store_field("topicId", topic_id_);
    s.store_class_end();
  }
}

getDirectMessagesChatTopicRevenue::ReturnType getDirectMessagesChatTopicRevenue::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starCount::fetch(env, p);
}

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

jclass getExternalLink::Class;
jfieldID getExternalLink::link_fieldID;
jfieldID getExternalLink::allow_write_access_fieldID;

getExternalLink::getExternalLink()
  : link_()
  , allow_write_access_()
{}

getExternalLink::getExternalLink(string const &link_, bool allow_write_access_)
  : link_(link_)
  , allow_write_access_(allow_write_access_)
{}

const std::int32_t getExternalLink::ID;

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

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

getExternalLink::ReturnType getExternalLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass getFileExtension::Class;
jfieldID getFileExtension::mime_type_fieldID;

getFileExtension::getFileExtension()
  : mime_type_()
{}

getFileExtension::getFileExtension(string const &mime_type_)
  : mime_type_(mime_type_)
{}

const std::int32_t getFileExtension::ID;

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

void getFileExtension::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetFileExtension");
    s.store_field("mimeType", mime_type_);
    s.store_class_end();
  }
}

getFileExtension::ReturnType getFileExtension::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getGiveawayInfo::Class;
jfieldID getGiveawayInfo::chat_id_fieldID;
jfieldID getGiveawayInfo::message_id_fieldID;

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

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

const std::int32_t getGiveawayInfo::ID;

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

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

getGiveawayInfo::ReturnType getGiveawayInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return GiveawayInfo::fetch(env, p);
}

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

jclass getInternalLinkType::Class;
jfieldID getInternalLinkType::link_fieldID;

getInternalLinkType::getInternalLinkType()
  : link_()
{}

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

const std::int32_t getInternalLinkType::ID;

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

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

getInternalLinkType::ReturnType getInternalLinkType::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return InternalLinkType::fetch(env, p);
}

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

jclass getLiveStoryAvailableMessageSenders::Class;
jfieldID getLiveStoryAvailableMessageSenders::group_call_id_fieldID;

getLiveStoryAvailableMessageSenders::getLiveStoryAvailableMessageSenders()
  : group_call_id_()
{}

getLiveStoryAvailableMessageSenders::getLiveStoryAvailableMessageSenders(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t getLiveStoryAvailableMessageSenders::ID;

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

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

getLiveStoryAvailableMessageSenders::ReturnType getLiveStoryAvailableMessageSenders::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatMessageSenders::fetch(env, p);
}

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

jclass getLocalizationTargetInfo::Class;
jfieldID getLocalizationTargetInfo::only_local_fieldID;

getLocalizationTargetInfo::getLocalizationTargetInfo()
  : only_local_()
{}

getLocalizationTargetInfo::getLocalizationTargetInfo(bool only_local_)
  : only_local_(only_local_)
{}

const std::int32_t getLocalizationTargetInfo::ID;

object_ptr<getLocalizationTargetInfo> getLocalizationTargetInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getLocalizationTargetInfo> res = make_object<getLocalizationTargetInfo>();
  res->only_local_ = (env->GetBooleanField(p, res->only_local_fieldID) != 0);
  return res;
}

void getLocalizationTargetInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetLocalizationTargetInfo");
    s.store_field("onlyLocal", only_local_);
    s.store_class_end();
  }
}

getLocalizationTargetInfo::ReturnType getLocalizationTargetInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return localizationTargetInfo::fetch(env, p);
}

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

jclass getMessageAvailableReactions::Class;
jfieldID getMessageAvailableReactions::chat_id_fieldID;
jfieldID getMessageAvailableReactions::message_id_fieldID;
jfieldID getMessageAvailableReactions::row_size_fieldID;

getMessageAvailableReactions::getMessageAvailableReactions()
  : chat_id_()
  , message_id_()
  , row_size_()
{}

getMessageAvailableReactions::getMessageAvailableReactions(int53 chat_id_, int53 message_id_, int32 row_size_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , row_size_(row_size_)
{}

const std::int32_t getMessageAvailableReactions::ID;

object_ptr<getMessageAvailableReactions> getMessageAvailableReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageAvailableReactions> res = make_object<getMessageAvailableReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->row_size_ = env->GetIntField(p, res->row_size_fieldID);
  return res;
}

void getMessageAvailableReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageAvailableReactions");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("rowSize", row_size_);
    s.store_class_end();
  }
}

getMessageAvailableReactions::ReturnType getMessageAvailableReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return availableReactions::fetch(env, p);
}

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

jclass getMessageLink::Class;
jfieldID getMessageLink::chat_id_fieldID;
jfieldID getMessageLink::message_id_fieldID;
jfieldID getMessageLink::media_timestamp_fieldID;
jfieldID getMessageLink::checklist_task_id_fieldID;
jfieldID getMessageLink::poll_option_id_fieldID;
jfieldID getMessageLink::for_album_fieldID;
jfieldID getMessageLink::in_message_thread_fieldID;

getMessageLink::getMessageLink()
  : chat_id_()
  , message_id_()
  , media_timestamp_()
  , checklist_task_id_()
  , poll_option_id_()
  , for_album_()
  , in_message_thread_()
{}

getMessageLink::getMessageLink(int53 chat_id_, int53 message_id_, int32 media_timestamp_, int32 checklist_task_id_, string const &poll_option_id_, bool for_album_, bool in_message_thread_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , media_timestamp_(media_timestamp_)
  , checklist_task_id_(checklist_task_id_)
  , poll_option_id_(poll_option_id_)
  , for_album_(for_album_)
  , in_message_thread_(in_message_thread_)
{}

const std::int32_t getMessageLink::ID;

object_ptr<getMessageLink> getMessageLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageLink> res = make_object<getMessageLink>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->media_timestamp_ = env->GetIntField(p, res->media_timestamp_fieldID);
  res->checklist_task_id_ = env->GetIntField(p, res->checklist_task_id_fieldID);
  res->poll_option_id_ = jni::fetch_string(env, p, res->poll_option_id_fieldID);
  res->for_album_ = (env->GetBooleanField(p, res->for_album_fieldID) != 0);
  res->in_message_thread_ = (env->GetBooleanField(p, res->in_message_thread_fieldID) != 0);
  return res;
}

void getMessageLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageLink");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("mediaTimestamp", media_timestamp_);
    s.store_field("checklistTaskId", checklist_task_id_);
    s.store_field("pollOptionId", poll_option_id_);
    s.store_field("forAlbum", for_album_);
    s.store_field("inMessageThread", in_message_thread_);
    s.store_class_end();
  }
}

getMessageLink::ReturnType getMessageLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messageLink::fetch(env, p);
}

void getMessageLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessageLink").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    media_timestamp_fieldID = jni::get_field_id(env, Class, "mediaTimestamp", "I");
    checklist_task_id_fieldID = jni::get_field_id(env, Class, "checklistTaskId", "I");
    poll_option_id_fieldID = jni::get_field_id(env, Class, "pollOptionId", "Ljava/lang/String;");
    for_album_fieldID = jni::get_field_id(env, Class, "forAlbum", "Z");
    in_message_thread_fieldID = jni::get_field_id(env, Class, "inMessageThread", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getMessageThreadHistory::Class;
jfieldID getMessageThreadHistory::chat_id_fieldID;
jfieldID getMessageThreadHistory::message_id_fieldID;
jfieldID getMessageThreadHistory::from_message_id_fieldID;
jfieldID getMessageThreadHistory::offset_fieldID;
jfieldID getMessageThreadHistory::limit_fieldID;

getMessageThreadHistory::getMessageThreadHistory()
  : chat_id_()
  , message_id_()
  , from_message_id_()
  , offset_()
  , limit_()
{}

getMessageThreadHistory::getMessageThreadHistory(int53 chat_id_, int53 message_id_, int53 from_message_id_, int32 offset_, int32 limit_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getMessageThreadHistory::ID;

object_ptr<getMessageThreadHistory> getMessageThreadHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getMessageThreadHistory> res = make_object<getMessageThreadHistory>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getMessageThreadHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetMessageThreadHistory");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getMessageThreadHistory::ReturnType getMessageThreadHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void getMessageThreadHistory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetMessageThreadHistory").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    from_message_id_fieldID = jni::get_field_id(env, Class, "fromMessageId", "J");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getOwnedBots::Class;

getOwnedBots::getOwnedBots() {
}

const std::int32_t getOwnedBots::ID;

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

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

getOwnedBots::ReturnType getOwnedBots::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return users::fetch(env, p);
}

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

jclass getPollVoteStatistics::Class;
jfieldID getPollVoteStatistics::chat_id_fieldID;
jfieldID getPollVoteStatistics::message_id_fieldID;
jfieldID getPollVoteStatistics::is_dark_fieldID;

getPollVoteStatistics::getPollVoteStatistics()
  : chat_id_()
  , message_id_()
  , is_dark_()
{}

getPollVoteStatistics::getPollVoteStatistics(int53 chat_id_, int53 message_id_, bool is_dark_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , is_dark_(is_dark_)
{}

const std::int32_t getPollVoteStatistics::ID;

object_ptr<getPollVoteStatistics> getPollVoteStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPollVoteStatistics> res = make_object<getPollVoteStatistics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_dark_ = (env->GetBooleanField(p, res->is_dark_fieldID) != 0);
  return res;
}

void getPollVoteStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPollVoteStatistics");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getPollVoteStatistics::ReturnType getPollVoteStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return pollVoteStatistics::fetch(env, p);
}

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

jclass getPremiumFeatures::Class;
jfieldID getPremiumFeatures::source_fieldID;

getPremiumFeatures::getPremiumFeatures()
  : source_()
{}

getPremiumFeatures::getPremiumFeatures(object_ptr<PremiumSource> &&source_)
  : source_(std::move(source_))
{}

const std::int32_t getPremiumFeatures::ID;

object_ptr<getPremiumFeatures> getPremiumFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPremiumFeatures> res = make_object<getPremiumFeatures>();
  res->source_ = jni::fetch_tl_object<PremiumSource>(env, jni::fetch_object(env, p, res->source_fieldID));
  return res;
}

void getPremiumFeatures::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPremiumFeatures");
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_class_end();
  }
}

getPremiumFeatures::ReturnType getPremiumFeatures::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return premiumFeatures::fetch(env, p);
}

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

jclass getRecentStickers::Class;
jfieldID getRecentStickers::is_attached_fieldID;

getRecentStickers::getRecentStickers()
  : is_attached_()
{}

getRecentStickers::getRecentStickers(bool is_attached_)
  : is_attached_(is_attached_)
{}

const std::int32_t getRecentStickers::ID;

object_ptr<getRecentStickers> getRecentStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getRecentStickers> res = make_object<getRecentStickers>();
  res->is_attached_ = (env->GetBooleanField(p, res->is_attached_fieldID) != 0);
  return res;
}

void getRecentStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetRecentStickers");
    s.store_field("isAttached", is_attached_);
    s.store_class_end();
  }
}

getRecentStickers::ReturnType getRecentStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getRepliedMessage::Class;
jfieldID getRepliedMessage::chat_id_fieldID;
jfieldID getRepliedMessage::message_id_fieldID;

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

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

const std::int32_t getRepliedMessage::ID;

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

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

getRepliedMessage::ReturnType getRepliedMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

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

jclass getSavedOrderInfo::Class;

getSavedOrderInfo::getSavedOrderInfo() {
}

const std::int32_t getSavedOrderInfo::ID;

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

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

getSavedOrderInfo::ReturnType getSavedOrderInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return orderInfo::fetch(env, p);
}

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

jclass getStarTransactions::Class;
jfieldID getStarTransactions::owner_id_fieldID;
jfieldID getStarTransactions::subscription_id_fieldID;
jfieldID getStarTransactions::direction_fieldID;
jfieldID getStarTransactions::offset_fieldID;
jfieldID getStarTransactions::limit_fieldID;

getStarTransactions::getStarTransactions()
  : owner_id_()
  , subscription_id_()
  , direction_()
  , offset_()
  , limit_()
{}

getStarTransactions::getStarTransactions(object_ptr<MessageSender> &&owner_id_, string const &subscription_id_, object_ptr<TransactionDirection> &&direction_, string const &offset_, int32 limit_)
  : owner_id_(std::move(owner_id_))
  , subscription_id_(subscription_id_)
  , direction_(std::move(direction_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getStarTransactions::ID;

object_ptr<getStarTransactions> getStarTransactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStarTransactions> res = make_object<getStarTransactions>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->subscription_id_ = jni::fetch_string(env, p, res->subscription_id_fieldID);
  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 getStarTransactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStarTransactions");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("subscriptionId", subscription_id_);
    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();
  }
}

getStarTransactions::ReturnType getStarTransactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starTransactions::fetch(env, p);
}

void getStarTransactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStarTransactions").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    subscription_id_fieldID = jni::get_field_id(env, Class, "subscriptionId", "Ljava/lang/String;");
    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 getStickers::Class;
jfieldID getStickers::sticker_type_fieldID;
jfieldID getStickers::query_fieldID;
jfieldID getStickers::limit_fieldID;
jfieldID getStickers::chat_id_fieldID;

getStickers::getStickers()
  : sticker_type_()
  , query_()
  , limit_()
  , chat_id_()
{}

getStickers::getStickers(object_ptr<StickerType> &&sticker_type_, string const &query_, int32 limit_, int53 chat_id_)
  : sticker_type_(std::move(sticker_type_))
  , query_(query_)
  , limit_(limit_)
  , chat_id_(chat_id_)
{}

const std::int32_t getStickers::ID;

object_ptr<getStickers> getStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStickers> res = make_object<getStickers>();
  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);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return res;
}

void getStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStickers");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("query", query_);
    s.store_field("limit", limit_);
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

getStickers::ReturnType getStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getStoryPublicForwards::Class;
jfieldID getStoryPublicForwards::story_poster_chat_id_fieldID;
jfieldID getStoryPublicForwards::story_id_fieldID;
jfieldID getStoryPublicForwards::offset_fieldID;
jfieldID getStoryPublicForwards::limit_fieldID;

getStoryPublicForwards::getStoryPublicForwards()
  : story_poster_chat_id_()
  , story_id_()
  , offset_()
  , limit_()
{}

getStoryPublicForwards::getStoryPublicForwards(int53 story_poster_chat_id_, int32 story_id_, string const &offset_, int32 limit_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getStoryPublicForwards::ID;

object_ptr<getStoryPublicForwards> getStoryPublicForwards::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStoryPublicForwards> res = make_object<getStoryPublicForwards>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getStoryPublicForwards::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStoryPublicForwards");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getStoryPublicForwards::ReturnType getStoryPublicForwards::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return publicForwards::fetch(env, p);
}

void getStoryPublicForwards::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStoryPublicForwards").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    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 getSupergroup::Class;
jfieldID getSupergroup::supergroup_id_fieldID;

getSupergroup::getSupergroup()
  : supergroup_id_()
{}

getSupergroup::getSupergroup(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t getSupergroup::ID;

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

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

getSupergroup::ReturnType getSupergroup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return supergroup::fetch(env, p);
}

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

jclass getSupportName::Class;

getSupportName::getSupportName() {
}

const std::int32_t getSupportName::ID;

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

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

getSupportName::ReturnType getSupportName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getTimeZones::Class;

getTimeZones::getTimeZones() {
}

const std::int32_t getTimeZones::ID;

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

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

getTimeZones::ReturnType getTimeZones::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return timeZones::fetch(env, p);
}

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

jclass hideSuggestedAction::Class;
jfieldID hideSuggestedAction::action_fieldID;

hideSuggestedAction::hideSuggestedAction()
  : action_()
{}

hideSuggestedAction::hideSuggestedAction(object_ptr<SuggestedAction> &&action_)
  : action_(std::move(action_))
{}

const std::int32_t hideSuggestedAction::ID;

object_ptr<hideSuggestedAction> hideSuggestedAction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<hideSuggestedAction> res = make_object<hideSuggestedAction>();
  res->action_ = jni::fetch_tl_object<SuggestedAction>(env, jni::fetch_object(env, p, res->action_fieldID));
  return res;
}

void hideSuggestedAction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "HideSuggestedAction");
    s.store_object_field("action", static_cast<const BaseObject *>(action_.get()));
    s.store_class_end();
  }
}

hideSuggestedAction::ReturnType hideSuggestedAction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass pingProxy::Class;
jfieldID pingProxy::proxy_fieldID;

pingProxy::pingProxy()
  : proxy_()
{}

pingProxy::pingProxy(object_ptr<proxy> &&proxy_)
  : proxy_(std::move(proxy_))
{}

const std::int32_t pingProxy::ID;

object_ptr<pingProxy> pingProxy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pingProxy> res = make_object<pingProxy>();
  res->proxy_ = jni::fetch_tl_object<proxy>(env, jni::fetch_object(env, p, res->proxy_fieldID));
  return res;
}

void pingProxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PingProxy");
    s.store_object_field("proxy", static_cast<const BaseObject *>(proxy_.get()));
    s.store_class_end();
  }
}

pingProxy::ReturnType pingProxy::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return seconds::fetch(env, p);
}

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

jclass preliminaryUploadFile::Class;
jfieldID preliminaryUploadFile::file_fieldID;
jfieldID preliminaryUploadFile::file_type_fieldID;
jfieldID preliminaryUploadFile::priority_fieldID;

preliminaryUploadFile::preliminaryUploadFile()
  : file_()
  , file_type_()
  , priority_()
{}

preliminaryUploadFile::preliminaryUploadFile(object_ptr<InputFile> &&file_, object_ptr<FileType> &&file_type_, int32 priority_)
  : file_(std::move(file_))
  , file_type_(std::move(file_type_))
  , priority_(priority_)
{}

const std::int32_t preliminaryUploadFile::ID;

object_ptr<preliminaryUploadFile> preliminaryUploadFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<preliminaryUploadFile> res = make_object<preliminaryUploadFile>();
  res->file_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->file_fieldID));
  res->file_type_ = jni::fetch_tl_object<FileType>(env, jni::fetch_object(env, p, res->file_type_fieldID));
  res->priority_ = env->GetIntField(p, res->priority_fieldID);
  return res;
}

void preliminaryUploadFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PreliminaryUploadFile");
    s.store_object_field("file", static_cast<const BaseObject *>(file_.get()));
    s.store_object_field("fileType", static_cast<const BaseObject *>(file_type_.get()));
    s.store_field("priority", priority_);
    s.store_class_end();
  }
}

preliminaryUploadFile::ReturnType preliminaryUploadFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return file::fetch(env, p);
}

void preliminaryUploadFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PreliminaryUploadFile").c_str());
    file_fieldID = jni::get_field_id(env, Class, "file", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    file_type_fieldID = jni::get_field_id(env, Class, "fileType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FileType;").c_str());
    priority_fieldID = jni::get_field_id(env, Class, "priority", "I");
    return true;
  }();
  (void)is_inited;
}

jclass refundStarPayment::Class;
jfieldID refundStarPayment::user_id_fieldID;
jfieldID refundStarPayment::telegram_payment_charge_id_fieldID;

refundStarPayment::refundStarPayment()
  : user_id_()
  , telegram_payment_charge_id_()
{}

refundStarPayment::refundStarPayment(int53 user_id_, string const &telegram_payment_charge_id_)
  : user_id_(user_id_)
  , telegram_payment_charge_id_(telegram_payment_charge_id_)
{}

const std::int32_t refundStarPayment::ID;

object_ptr<refundStarPayment> refundStarPayment::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<refundStarPayment> res = make_object<refundStarPayment>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->telegram_payment_charge_id_ = jni::fetch_string(env, p, res->telegram_payment_charge_id_fieldID);
  return res;
}

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

refundStarPayment::ReturnType refundStarPayment::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeChatActionBar::Class;
jfieldID removeChatActionBar::chat_id_fieldID;

removeChatActionBar::removeChatActionBar()
  : chat_id_()
{}

removeChatActionBar::removeChatActionBar(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t removeChatActionBar::ID;

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

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

removeChatActionBar::ReturnType removeChatActionBar::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeStoryAlbumStories::Class;
jfieldID removeStoryAlbumStories::chat_id_fieldID;
jfieldID removeStoryAlbumStories::story_album_id_fieldID;
jfieldID removeStoryAlbumStories::story_ids_fieldID;

removeStoryAlbumStories::removeStoryAlbumStories()
  : chat_id_()
  , story_album_id_()
  , story_ids_()
{}

removeStoryAlbumStories::removeStoryAlbumStories(int53 chat_id_, int32 story_album_id_, array<int32> &&story_ids_)
  : chat_id_(chat_id_)
  , story_album_id_(story_album_id_)
  , story_ids_(std::move(story_ids_))
{}

const std::int32_t removeStoryAlbumStories::ID;

object_ptr<removeStoryAlbumStories> removeStoryAlbumStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<removeStoryAlbumStories> res = make_object<removeStoryAlbumStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_album_id_ = env->GetIntField(p, res->story_album_id_fieldID);
  res->story_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->story_ids_fieldID));
  return res;
}

void removeStoryAlbumStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveStoryAlbumStories");
    s.store_field("chatId", chat_id_);
    s.store_field("storyAlbumId", story_album_id_);
    { s.store_vector_begin("storyIds", story_ids_.size()); for (const auto &_value : story_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

removeStoryAlbumStories::ReturnType removeStoryAlbumStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return storyAlbum::fetch(env, p);
}

void removeStoryAlbumStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$RemoveStoryAlbumStories").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    story_album_id_fieldID = jni::get_field_id(env, Class, "storyAlbumId", "I");
    story_ids_fieldID = jni::get_field_id(env, Class, "storyIds", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass replaceStickerInSet::Class;
jfieldID replaceStickerInSet::user_id_fieldID;
jfieldID replaceStickerInSet::name_fieldID;
jfieldID replaceStickerInSet::old_sticker_fieldID;
jfieldID replaceStickerInSet::new_sticker_fieldID;

replaceStickerInSet::replaceStickerInSet()
  : user_id_()
  , name_()
  , old_sticker_()
  , new_sticker_()
{}

replaceStickerInSet::replaceStickerInSet(int53 user_id_, string const &name_, object_ptr<InputFile> &&old_sticker_, object_ptr<inputSticker> &&new_sticker_)
  : user_id_(user_id_)
  , name_(name_)
  , old_sticker_(std::move(old_sticker_))
  , new_sticker_(std::move(new_sticker_))
{}

const std::int32_t replaceStickerInSet::ID;

object_ptr<replaceStickerInSet> replaceStickerInSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<replaceStickerInSet> res = make_object<replaceStickerInSet>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->old_sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->old_sticker_fieldID));
  res->new_sticker_ = jni::fetch_tl_object<inputSticker>(env, jni::fetch_object(env, p, res->new_sticker_fieldID));
  return res;
}

void replaceStickerInSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReplaceStickerInSet");
    s.store_field("userId", user_id_);
    s.store_field("name", name_);
    s.store_object_field("oldSticker", static_cast<const BaseObject *>(old_sticker_.get()));
    s.store_object_field("newSticker", static_cast<const BaseObject *>(new_sticker_.get()));
    s.store_class_end();
  }
}

replaceStickerInSet::ReturnType replaceStickerInSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void replaceStickerInSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReplaceStickerInSet").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;");
    old_sticker_fieldID = jni::get_field_id(env, Class, "oldSticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    new_sticker_fieldID = jni::get_field_id(env, Class, "newSticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputSticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass reportChat::Class;
jfieldID reportChat::chat_id_fieldID;
jfieldID reportChat::option_id_fieldID;
jfieldID reportChat::message_ids_fieldID;
jfieldID reportChat::text_fieldID;

reportChat::reportChat()
  : chat_id_()
  , option_id_()
  , message_ids_()
  , text_()
{}

reportChat::reportChat(int53 chat_id_, bytes const &option_id_, array<int53> &&message_ids_, string const &text_)
  : chat_id_(chat_id_)
  , option_id_(std::move(option_id_))
  , message_ids_(std::move(message_ids_))
  , text_(text_)
{}

const std::int32_t reportChat::ID;

object_ptr<reportChat> reportChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportChat> res = make_object<reportChat>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->option_id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->option_id_fieldID));
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  return res;
}

void reportChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportChat");
    s.store_field("chatId", chat_id_);
    s.store_bytes_field("optionId", option_id_);
    { s.store_vector_begin("messageIds", message_ids_.size()); for (const auto &_value : message_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("text", text_);
    s.store_class_end();
  }
}

reportChat::ReturnType reportChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ReportChatResult::fetch(env, p);
}

void reportChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportChat").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "[B");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass reportStory::Class;
jfieldID reportStory::story_poster_chat_id_fieldID;
jfieldID reportStory::story_id_fieldID;
jfieldID reportStory::option_id_fieldID;
jfieldID reportStory::text_fieldID;

reportStory::reportStory()
  : story_poster_chat_id_()
  , story_id_()
  , option_id_()
  , text_()
{}

reportStory::reportStory(int53 story_poster_chat_id_, int32 story_id_, bytes const &option_id_, string const &text_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , option_id_(std::move(option_id_))
  , text_(text_)
{}

const std::int32_t reportStory::ID;

object_ptr<reportStory> reportStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportStory> res = make_object<reportStory>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->option_id_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->option_id_fieldID));
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  return res;
}

void reportStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReportStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_bytes_field("optionId", option_id_);
    s.store_field("text", text_);
    s.store_class_end();
  }
}

reportStory::ReturnType reportStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ReportStoryResult::fetch(env, p);
}

void reportStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReportStory").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    option_id_fieldID = jni::get_field_id(env, Class, "optionId", "[B");
    text_fieldID = jni::get_field_id(env, Class, "text", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass reportSupergroupSpam::Class;
jfieldID reportSupergroupSpam::supergroup_id_fieldID;
jfieldID reportSupergroupSpam::message_ids_fieldID;

reportSupergroupSpam::reportSupergroupSpam()
  : supergroup_id_()
  , message_ids_()
{}

reportSupergroupSpam::reportSupergroupSpam(int53 supergroup_id_, array<int53> &&message_ids_)
  : supergroup_id_(supergroup_id_)
  , message_ids_(std::move(message_ids_))
{}

const std::int32_t reportSupergroupSpam::ID;

object_ptr<reportSupergroupSpam> reportSupergroupSpam::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reportSupergroupSpam> res = make_object<reportSupergroupSpam>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  return res;
}

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

reportSupergroupSpam::ReturnType reportSupergroupSpam::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass resendMessages::Class;
jfieldID resendMessages::chat_id_fieldID;
jfieldID resendMessages::message_ids_fieldID;
jfieldID resendMessages::quote_fieldID;
jfieldID resendMessages::paid_message_star_count_fieldID;

resendMessages::resendMessages()
  : chat_id_()
  , message_ids_()
  , quote_()
  , paid_message_star_count_()
{}

resendMessages::resendMessages(int53 chat_id_, array<int53> &&message_ids_, object_ptr<inputTextQuote> &&quote_, int53 paid_message_star_count_)
  : chat_id_(chat_id_)
  , message_ids_(std::move(message_ids_))
  , quote_(std::move(quote_))
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t resendMessages::ID;

object_ptr<resendMessages> resendMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<resendMessages> res = make_object<resendMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->message_ids_fieldID));
  res->quote_ = jni::fetch_tl_object<inputTextQuote>(env, jni::fetch_object(env, p, res->quote_fieldID));
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

void resendMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ResendMessages");
    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_object_field("quote", static_cast<const BaseObject *>(quote_.get()));
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

resendMessages::ReturnType resendMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void resendMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ResendMessages").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_ids_fieldID = jni::get_field_id(env, Class, "messageIds", "[J");
    quote_fieldID = jni::get_field_id(env, Class, "quote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputTextQuote;").c_str());
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass savePreparedInlineMessage::Class;
jfieldID savePreparedInlineMessage::user_id_fieldID;
jfieldID savePreparedInlineMessage::result_fieldID;
jfieldID savePreparedInlineMessage::chat_types_fieldID;

savePreparedInlineMessage::savePreparedInlineMessage()
  : user_id_()
  , result_()
  , chat_types_()
{}

savePreparedInlineMessage::savePreparedInlineMessage(int53 user_id_, object_ptr<InputInlineQueryResult> &&result_, object_ptr<targetChatTypes> &&chat_types_)
  : user_id_(user_id_)
  , result_(std::move(result_))
  , chat_types_(std::move(chat_types_))
{}

const std::int32_t savePreparedInlineMessage::ID;

object_ptr<savePreparedInlineMessage> savePreparedInlineMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<savePreparedInlineMessage> res = make_object<savePreparedInlineMessage>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->result_ = jni::fetch_tl_object<InputInlineQueryResult>(env, jni::fetch_object(env, p, res->result_fieldID));
  res->chat_types_ = jni::fetch_tl_object<targetChatTypes>(env, jni::fetch_object(env, p, res->chat_types_fieldID));
  return res;
}

void savePreparedInlineMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SavePreparedInlineMessage");
    s.store_field("userId", user_id_);
    s.store_object_field("result", static_cast<const BaseObject *>(result_.get()));
    s.store_object_field("chatTypes", static_cast<const BaseObject *>(chat_types_.get()));
    s.store_class_end();
  }
}

savePreparedInlineMessage::ReturnType savePreparedInlineMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return preparedInlineMessageId::fetch(env, p);
}

void savePreparedInlineMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SavePreparedInlineMessage").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    result_fieldID = jni::get_field_id(env, Class, "result", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputInlineQueryResult;").c_str());
    chat_types_fieldID = jni::get_field_id(env, Class, "chatTypes", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$TargetChatTypes;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass searchCallMessages::Class;
jfieldID searchCallMessages::offset_fieldID;
jfieldID searchCallMessages::limit_fieldID;
jfieldID searchCallMessages::only_missed_fieldID;

searchCallMessages::searchCallMessages()
  : offset_()
  , limit_()
  , only_missed_()
{}

searchCallMessages::searchCallMessages(string const &offset_, int32 limit_, bool only_missed_)
  : offset_(offset_)
  , limit_(limit_)
  , only_missed_(only_missed_)
{}

const std::int32_t searchCallMessages::ID;

object_ptr<searchCallMessages> searchCallMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchCallMessages> res = make_object<searchCallMessages>();
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->only_missed_ = (env->GetBooleanField(p, res->only_missed_fieldID) != 0);
  return res;
}

void searchCallMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchCallMessages");
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_field("onlyMissed", only_missed_);
    s.store_class_end();
  }
}

searchCallMessages::ReturnType searchCallMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundMessages::fetch(env, p);
}

void searchCallMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchCallMessages").c_str());
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    only_missed_fieldID = jni::get_field_id(env, Class, "onlyMissed", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass searchChatMessages::Class;
jfieldID searchChatMessages::chat_id_fieldID;
jfieldID searchChatMessages::topic_id_fieldID;
jfieldID searchChatMessages::query_fieldID;
jfieldID searchChatMessages::sender_id_fieldID;
jfieldID searchChatMessages::from_message_id_fieldID;
jfieldID searchChatMessages::offset_fieldID;
jfieldID searchChatMessages::limit_fieldID;
jfieldID searchChatMessages::filter_fieldID;

searchChatMessages::searchChatMessages()
  : chat_id_()
  , topic_id_()
  , query_()
  , sender_id_()
  , from_message_id_()
  , offset_()
  , limit_()
  , filter_()
{}

searchChatMessages::searchChatMessages(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, string const &query_, object_ptr<MessageSender> &&sender_id_, int53 from_message_id_, int32 offset_, int32 limit_, object_ptr<SearchMessagesFilter> &&filter_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , query_(query_)
  , sender_id_(std::move(sender_id_))
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
  , filter_(std::move(filter_))
{}

const std::int32_t searchChatMessages::ID;

object_ptr<searchChatMessages> searchChatMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchChatMessages> res = make_object<searchChatMessages>();
  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->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  return res;
}

void searchChatMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchChatMessages");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_field("query", query_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_class_end();
  }
}

searchChatMessages::ReturnType searchChatMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundChatMessages::fetch(env, p);
}

void searchChatMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchChatMessages").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());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    from_message_id_fieldID = jni::get_field_id(env, Class, "fromMessageId", "J");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesFilter;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass searchChatRecentLocationMessages::Class;
jfieldID searchChatRecentLocationMessages::chat_id_fieldID;
jfieldID searchChatRecentLocationMessages::limit_fieldID;

searchChatRecentLocationMessages::searchChatRecentLocationMessages()
  : chat_id_()
  , limit_()
{}

searchChatRecentLocationMessages::searchChatRecentLocationMessages(int53 chat_id_, int32 limit_)
  : chat_id_(chat_id_)
  , limit_(limit_)
{}

const std::int32_t searchChatRecentLocationMessages::ID;

object_ptr<searchChatRecentLocationMessages> searchChatRecentLocationMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchChatRecentLocationMessages> res = make_object<searchChatRecentLocationMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchChatRecentLocationMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchChatRecentLocationMessages");
    s.store_field("chatId", chat_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchChatRecentLocationMessages::ReturnType searchChatRecentLocationMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void searchChatRecentLocationMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchChatRecentLocationMessages").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchStickerSets::Class;
jfieldID searchStickerSets::sticker_type_fieldID;
jfieldID searchStickerSets::query_fieldID;

searchStickerSets::searchStickerSets()
  : sticker_type_()
  , query_()
{}

searchStickerSets::searchStickerSets(object_ptr<StickerType> &&sticker_type_, string const &query_)
  : sticker_type_(std::move(sticker_type_))
  , query_(query_)
{}

const std::int32_t searchStickerSets::ID;

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

void searchStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("query", query_);
    s.store_class_end();
  }
}

searchStickerSets::ReturnType searchStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSets::fetch(env, p);
}

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

jclass sendChatAction::Class;
jfieldID sendChatAction::chat_id_fieldID;
jfieldID sendChatAction::topic_id_fieldID;
jfieldID sendChatAction::business_connection_id_fieldID;
jfieldID sendChatAction::action_fieldID;

sendChatAction::sendChatAction()
  : chat_id_()
  , topic_id_()
  , business_connection_id_()
  , action_()
{}

sendChatAction::sendChatAction(int53 chat_id_, object_ptr<MessageTopic> &&topic_id_, string const &business_connection_id_, object_ptr<ChatAction> &&action_)
  : chat_id_(chat_id_)
  , topic_id_(std::move(topic_id_))
  , business_connection_id_(business_connection_id_)
  , action_(std::move(action_))
{}

const std::int32_t sendChatAction::ID;

object_ptr<sendChatAction> sendChatAction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendChatAction> res = make_object<sendChatAction>();
  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->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->action_ = jni::fetch_tl_object<ChatAction>(env, jni::fetch_object(env, p, res->action_fieldID));
  return res;
}

void sendChatAction::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendChatAction");
    s.store_field("chatId", chat_id_);
    s.store_object_field("topicId", static_cast<const BaseObject *>(topic_id_.get()));
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_object_field("action", static_cast<const BaseObject *>(action_.get()));
    s.store_class_end();
  }
}

sendChatAction::ReturnType sendChatAction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendChatAction::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendChatAction").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());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    action_fieldID = jni::get_field_id(env, Class, "action", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAction;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setAlarm::Class;
jfieldID setAlarm::seconds_fieldID;

setAlarm::setAlarm()
  : seconds_()
{}

setAlarm::setAlarm(double seconds_)
  : seconds_(seconds_)
{}

const std::int32_t setAlarm::ID;

object_ptr<setAlarm> setAlarm::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAlarm> res = make_object<setAlarm>();
  res->seconds_ = env->GetDoubleField(p, res->seconds_fieldID);
  return res;
}

void setAlarm::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetAlarm");
    s.store_field("seconds", seconds_);
    s.store_class_end();
  }
}

setAlarm::ReturnType setAlarm::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setApplicationVerificationToken::Class;
jfieldID setApplicationVerificationToken::verification_id_fieldID;
jfieldID setApplicationVerificationToken::token_fieldID;

setApplicationVerificationToken::setApplicationVerificationToken()
  : verification_id_()
  , token_()
{}

setApplicationVerificationToken::setApplicationVerificationToken(int53 verification_id_, string const &token_)
  : verification_id_(verification_id_)
  , token_(token_)
{}

const std::int32_t setApplicationVerificationToken::ID;

object_ptr<setApplicationVerificationToken> setApplicationVerificationToken::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setApplicationVerificationToken> res = make_object<setApplicationVerificationToken>();
  res->verification_id_ = env->GetLongField(p, res->verification_id_fieldID);
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return res;
}

void setApplicationVerificationToken::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetApplicationVerificationToken");
    s.store_field("verificationId", verification_id_);
    s.store_field("token", token_);
    s.store_class_end();
  }
}

setApplicationVerificationToken::ReturnType setApplicationVerificationToken::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setApplicationVerificationToken::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetApplicationVerificationToken").c_str());
    verification_id_fieldID = jni::get_field_id(env, Class, "verificationId", "J");
    token_fieldID = jni::get_field_id(env, Class, "token", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessAccountUsername::Class;
jfieldID setBusinessAccountUsername::business_connection_id_fieldID;
jfieldID setBusinessAccountUsername::username_fieldID;

setBusinessAccountUsername::setBusinessAccountUsername()
  : business_connection_id_()
  , username_()
{}

setBusinessAccountUsername::setBusinessAccountUsername(string const &business_connection_id_, string const &username_)
  : business_connection_id_(business_connection_id_)
  , username_(username_)
{}

const std::int32_t setBusinessAccountUsername::ID;

object_ptr<setBusinessAccountUsername> setBusinessAccountUsername::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessAccountUsername> res = make_object<setBusinessAccountUsername>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  return res;
}

void setBusinessAccountUsername::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessAccountUsername");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("username", username_);
    s.store_class_end();
  }
}

setBusinessAccountUsername::ReturnType setBusinessAccountUsername::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBusinessOpeningHours::Class;
jfieldID setBusinessOpeningHours::opening_hours_fieldID;

setBusinessOpeningHours::setBusinessOpeningHours()
  : opening_hours_()
{}

setBusinessOpeningHours::setBusinessOpeningHours(object_ptr<businessOpeningHours> &&opening_hours_)
  : opening_hours_(std::move(opening_hours_))
{}

const std::int32_t setBusinessOpeningHours::ID;

object_ptr<setBusinessOpeningHours> setBusinessOpeningHours::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessOpeningHours> res = make_object<setBusinessOpeningHours>();
  res->opening_hours_ = jni::fetch_tl_object<businessOpeningHours>(env, jni::fetch_object(env, p, res->opening_hours_fieldID));
  return res;
}

void setBusinessOpeningHours::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessOpeningHours");
    s.store_object_field("openingHours", static_cast<const BaseObject *>(opening_hours_.get()));
    s.store_class_end();
  }
}

setBusinessOpeningHours::ReturnType setBusinessOpeningHours::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatActiveStoriesList::Class;
jfieldID setChatActiveStoriesList::chat_id_fieldID;
jfieldID setChatActiveStoriesList::story_list_fieldID;

setChatActiveStoriesList::setChatActiveStoriesList()
  : chat_id_()
  , story_list_()
{}

setChatActiveStoriesList::setChatActiveStoriesList(int53 chat_id_, object_ptr<StoryList> &&story_list_)
  : chat_id_(chat_id_)
  , story_list_(std::move(story_list_))
{}

const std::int32_t setChatActiveStoriesList::ID;

object_ptr<setChatActiveStoriesList> setChatActiveStoriesList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatActiveStoriesList> res = make_object<setChatActiveStoriesList>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_list_ = jni::fetch_tl_object<StoryList>(env, jni::fetch_object(env, p, res->story_list_fieldID));
  return res;
}

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

setChatActiveStoriesList::ReturnType setChatActiveStoriesList::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatActiveStoriesList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatActiveStoriesList").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    story_list_fieldID = jni::get_field_id(env, Class, "storyList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryList;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setChatDescription::Class;
jfieldID setChatDescription::chat_id_fieldID;
jfieldID setChatDescription::description_fieldID;

setChatDescription::setChatDescription()
  : chat_id_()
  , description_()
{}

setChatDescription::setChatDescription(int53 chat_id_, string const &description_)
  : chat_id_(chat_id_)
  , description_(description_)
{}

const std::int32_t setChatDescription::ID;

object_ptr<setChatDescription> setChatDescription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatDescription> res = make_object<setChatDescription>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  return res;
}

void setChatDescription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatDescription");
    s.store_field("chatId", chat_id_);
    s.store_field("description", description_);
    s.store_class_end();
  }
}

setChatDescription::ReturnType setChatDescription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatDescription::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatDescription").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setChatDiscussionGroup::Class;
jfieldID setChatDiscussionGroup::chat_id_fieldID;
jfieldID setChatDiscussionGroup::discussion_chat_id_fieldID;

setChatDiscussionGroup::setChatDiscussionGroup()
  : chat_id_()
  , discussion_chat_id_()
{}

setChatDiscussionGroup::setChatDiscussionGroup(int53 chat_id_, int53 discussion_chat_id_)
  : chat_id_(chat_id_)
  , discussion_chat_id_(discussion_chat_id_)
{}

const std::int32_t setChatDiscussionGroup::ID;

object_ptr<setChatDiscussionGroup> setChatDiscussionGroup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatDiscussionGroup> res = make_object<setChatDiscussionGroup>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->discussion_chat_id_ = env->GetLongField(p, res->discussion_chat_id_fieldID);
  return res;
}

void setChatDiscussionGroup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatDiscussionGroup");
    s.store_field("chatId", chat_id_);
    s.store_field("discussionChatId", discussion_chat_id_);
    s.store_class_end();
  }
}

setChatDiscussionGroup::ReturnType setChatDiscussionGroup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDefaultBackground::Class;
jfieldID setDefaultBackground::background_fieldID;
jfieldID setDefaultBackground::type_fieldID;
jfieldID setDefaultBackground::for_dark_theme_fieldID;

setDefaultBackground::setDefaultBackground()
  : background_()
  , type_()
  , for_dark_theme_()
{}

setDefaultBackground::setDefaultBackground(object_ptr<InputBackground> &&background_, object_ptr<BackgroundType> &&type_, bool for_dark_theme_)
  : background_(std::move(background_))
  , type_(std::move(type_))
  , for_dark_theme_(for_dark_theme_)
{}

const std::int32_t setDefaultBackground::ID;

object_ptr<setDefaultBackground> setDefaultBackground::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDefaultBackground> res = make_object<setDefaultBackground>();
  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->for_dark_theme_ = (env->GetBooleanField(p, res->for_dark_theme_fieldID) != 0);
  return res;
}

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

setDefaultBackground::ReturnType setDefaultBackground::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return background::fetch(env, p);
}

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

jclass setGameScore::Class;
jfieldID setGameScore::chat_id_fieldID;
jfieldID setGameScore::message_id_fieldID;
jfieldID setGameScore::edit_message_fieldID;
jfieldID setGameScore::user_id_fieldID;
jfieldID setGameScore::score_fieldID;
jfieldID setGameScore::force_fieldID;

setGameScore::setGameScore()
  : chat_id_()
  , message_id_()
  , edit_message_()
  , user_id_()
  , score_()
  , force_()
{}

setGameScore::setGameScore(int53 chat_id_, int53 message_id_, bool edit_message_, int53 user_id_, int32 score_, bool force_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , edit_message_(edit_message_)
  , user_id_(user_id_)
  , score_(score_)
  , force_(force_)
{}

const std::int32_t setGameScore::ID;

object_ptr<setGameScore> setGameScore::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setGameScore> res = make_object<setGameScore>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->edit_message_ = (env->GetBooleanField(p, res->edit_message_fieldID) != 0);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->score_ = env->GetIntField(p, res->score_fieldID);
  res->force_ = (env->GetBooleanField(p, res->force_fieldID) != 0);
  return res;
}

void setGameScore::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetGameScore");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("editMessage", edit_message_);
    s.store_field("userId", user_id_);
    s.store_field("score", score_);
    s.store_field("force", force_);
    s.store_class_end();
  }
}

setGameScore::ReturnType setGameScore::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void setGameScore::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetGameScore").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    edit_message_fieldID = jni::get_field_id(env, Class, "editMessage", "Z");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    score_fieldID = jni::get_field_id(env, Class, "score", "I");
    force_fieldID = jni::get_field_id(env, Class, "force", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setLogVerbosityLevel::Class;
jfieldID setLogVerbosityLevel::new_verbosity_level_fieldID;

setLogVerbosityLevel::setLogVerbosityLevel()
  : new_verbosity_level_()
{}

setLogVerbosityLevel::setLogVerbosityLevel(int32 new_verbosity_level_)
  : new_verbosity_level_(new_verbosity_level_)
{}

const std::int32_t setLogVerbosityLevel::ID;

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

void setLogVerbosityLevel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetLogVerbosityLevel");
    s.store_field("newVerbosityLevel", new_verbosity_level_);
    s.store_class_end();
  }
}

setLogVerbosityLevel::ReturnType setLogVerbosityLevel::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setMessageReactions::Class;
jfieldID setMessageReactions::chat_id_fieldID;
jfieldID setMessageReactions::message_id_fieldID;
jfieldID setMessageReactions::reaction_types_fieldID;
jfieldID setMessageReactions::is_big_fieldID;

setMessageReactions::setMessageReactions()
  : chat_id_()
  , message_id_()
  , reaction_types_()
  , is_big_()
{}

setMessageReactions::setMessageReactions(int53 chat_id_, int53 message_id_, array<object_ptr<ReactionType>> &&reaction_types_, bool is_big_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , reaction_types_(std::move(reaction_types_))
  , is_big_(is_big_)
{}

const std::int32_t setMessageReactions::ID;

object_ptr<setMessageReactions> setMessageReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setMessageReactions> res = make_object<setMessageReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->reaction_types_ = jni::FetchVector<ReactionType>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->reaction_types_fieldID));
  res->is_big_ = (env->GetBooleanField(p, res->is_big_fieldID) != 0);
  return res;
}

void setMessageReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetMessageReactions");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    { s.store_vector_begin("reactionTypes", reaction_types_.size()); for (const auto &_value : reaction_types_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("isBig", is_big_);
    s.store_class_end();
  }
}

setMessageReactions::ReturnType setMessageReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setMessageReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetMessageReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    reaction_types_fieldID = jni::get_field_id(env, Class, "reactionTypes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    is_big_fieldID = jni::get_field_id(env, Class, "isBig", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass setMessageSenderBotVerification::Class;
jfieldID setMessageSenderBotVerification::bot_user_id_fieldID;
jfieldID setMessageSenderBotVerification::verified_id_fieldID;
jfieldID setMessageSenderBotVerification::custom_description_fieldID;

setMessageSenderBotVerification::setMessageSenderBotVerification()
  : bot_user_id_()
  , verified_id_()
  , custom_description_()
{}

setMessageSenderBotVerification::setMessageSenderBotVerification(int53 bot_user_id_, object_ptr<MessageSender> &&verified_id_, string const &custom_description_)
  : bot_user_id_(bot_user_id_)
  , verified_id_(std::move(verified_id_))
  , custom_description_(custom_description_)
{}

const std::int32_t setMessageSenderBotVerification::ID;

object_ptr<setMessageSenderBotVerification> setMessageSenderBotVerification::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setMessageSenderBotVerification> res = make_object<setMessageSenderBotVerification>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->verified_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->verified_id_fieldID));
  res->custom_description_ = jni::fetch_string(env, p, res->custom_description_fieldID);
  return res;
}

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

setMessageSenderBotVerification::ReturnType setMessageSenderBotVerification::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setMessageSenderBotVerification::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetMessageSenderBotVerification").c_str());
    bot_user_id_fieldID = jni::get_field_id(env, Class, "botUserId", "J");
    verified_id_fieldID = jni::get_field_id(env, Class, "verifiedId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    custom_description_fieldID = jni::get_field_id(env, Class, "customDescription", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setReactionNotificationSettings::Class;
jfieldID setReactionNotificationSettings::notification_settings_fieldID;

setReactionNotificationSettings::setReactionNotificationSettings()
  : notification_settings_()
{}

setReactionNotificationSettings::setReactionNotificationSettings(object_ptr<reactionNotificationSettings> &&notification_settings_)
  : notification_settings_(std::move(notification_settings_))
{}

const std::int32_t setReactionNotificationSettings::ID;

object_ptr<setReactionNotificationSettings> setReactionNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setReactionNotificationSettings> res = make_object<setReactionNotificationSettings>();
  res->notification_settings_ = jni::fetch_tl_object<reactionNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return res;
}

void setReactionNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetReactionNotificationSettings");
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_class_end();
  }
}

setReactionNotificationSettings::ReturnType setReactionNotificationSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setSavedMessagesTagLabel::Class;
jfieldID setSavedMessagesTagLabel::tag_fieldID;
jfieldID setSavedMessagesTagLabel::label_fieldID;

setSavedMessagesTagLabel::setSavedMessagesTagLabel()
  : tag_()
  , label_()
{}

setSavedMessagesTagLabel::setSavedMessagesTagLabel(object_ptr<ReactionType> &&tag_, string const &label_)
  : tag_(std::move(tag_))
  , label_(label_)
{}

const std::int32_t setSavedMessagesTagLabel::ID;

object_ptr<setSavedMessagesTagLabel> setSavedMessagesTagLabel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setSavedMessagesTagLabel> res = make_object<setSavedMessagesTagLabel>();
  res->tag_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->tag_fieldID));
  res->label_ = jni::fetch_string(env, p, res->label_fieldID);
  return res;
}

void setSavedMessagesTagLabel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetSavedMessagesTagLabel");
    s.store_object_field("tag", static_cast<const BaseObject *>(tag_.get()));
    s.store_field("label", label_);
    s.store_class_end();
  }
}

setSavedMessagesTagLabel::ReturnType setSavedMessagesTagLabel::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setSavedMessagesTagLabel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetSavedMessagesTagLabel").c_str());
    tag_fieldID = jni::get_field_id(env, Class, "tag", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    label_fieldID = jni::get_field_id(env, Class, "label", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setStickerSetTitle::Class;
jfieldID setStickerSetTitle::name_fieldID;
jfieldID setStickerSetTitle::title_fieldID;

setStickerSetTitle::setStickerSetTitle()
  : name_()
  , title_()
{}

setStickerSetTitle::setStickerSetTitle(string const &name_, string const &title_)
  : name_(name_)
  , title_(title_)
{}

const std::int32_t setStickerSetTitle::ID;

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

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

setStickerSetTitle::ReturnType setStickerSetTitle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setStoryPrivacySettings::Class;
jfieldID setStoryPrivacySettings::story_id_fieldID;
jfieldID setStoryPrivacySettings::privacy_settings_fieldID;

setStoryPrivacySettings::setStoryPrivacySettings()
  : story_id_()
  , privacy_settings_()
{}

setStoryPrivacySettings::setStoryPrivacySettings(int32 story_id_, object_ptr<StoryPrivacySettings> &&privacy_settings_)
  : story_id_(story_id_)
  , privacy_settings_(std::move(privacy_settings_))
{}

const std::int32_t setStoryPrivacySettings::ID;

object_ptr<setStoryPrivacySettings> setStoryPrivacySettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setStoryPrivacySettings> res = make_object<setStoryPrivacySettings>();
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->privacy_settings_ = jni::fetch_tl_object<StoryPrivacySettings>(env, jni::fetch_object(env, p, res->privacy_settings_fieldID));
  return res;
}

void setStoryPrivacySettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetStoryPrivacySettings");
    s.store_field("storyId", story_id_);
    s.store_object_field("privacySettings", static_cast<const BaseObject *>(privacy_settings_.get()));
    s.store_class_end();
  }
}

setStoryPrivacySettings::ReturnType setStoryPrivacySettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setUserEmojiStatus::Class;
jfieldID setUserEmojiStatus::user_id_fieldID;
jfieldID setUserEmojiStatus::emoji_status_fieldID;

setUserEmojiStatus::setUserEmojiStatus()
  : user_id_()
  , emoji_status_()
{}

setUserEmojiStatus::setUserEmojiStatus(int53 user_id_, object_ptr<emojiStatus> &&emoji_status_)
  : user_id_(user_id_)
  , emoji_status_(std::move(emoji_status_))
{}

const std::int32_t setUserEmojiStatus::ID;

object_ptr<setUserEmojiStatus> setUserEmojiStatus::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setUserEmojiStatus> res = make_object<setUserEmojiStatus>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->emoji_status_ = jni::fetch_tl_object<emojiStatus>(env, jni::fetch_object(env, p, res->emoji_status_fieldID));
  return res;
}

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

setUserEmojiStatus::ReturnType setUserEmojiStatus::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass suggestUserProfilePhoto::Class;
jfieldID suggestUserProfilePhoto::user_id_fieldID;
jfieldID suggestUserProfilePhoto::photo_fieldID;

suggestUserProfilePhoto::suggestUserProfilePhoto()
  : user_id_()
  , photo_()
{}

suggestUserProfilePhoto::suggestUserProfilePhoto(int53 user_id_, object_ptr<InputChatPhoto> &&photo_)
  : user_id_(user_id_)
  , photo_(std::move(photo_))
{}

const std::int32_t suggestUserProfilePhoto::ID;

object_ptr<suggestUserProfilePhoto> suggestUserProfilePhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<suggestUserProfilePhoto> res = make_object<suggestUserProfilePhoto>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->photo_ = jni::fetch_tl_object<InputChatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return res;
}

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

suggestUserProfilePhoto::ReturnType suggestUserProfilePhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass testCallVectorIntObject::Class;
jfieldID testCallVectorIntObject::x_fieldID;

testCallVectorIntObject::testCallVectorIntObject()
  : x_()
{}

testCallVectorIntObject::testCallVectorIntObject(array<object_ptr<testInt>> &&x_)
  : x_(std::move(x_))
{}

const std::int32_t testCallVectorIntObject::ID;

object_ptr<testCallVectorIntObject> testCallVectorIntObject::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testCallVectorIntObject> res = make_object<testCallVectorIntObject>();
  res->x_ = jni::FetchVector<testInt>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->x_fieldID));
  return res;
}

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

testCallVectorIntObject::ReturnType testCallVectorIntObject::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testVectorIntObject::fetch(env, p);
}

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

jclass toggleBusinessConnectedBotChatIsPaused::Class;
jfieldID toggleBusinessConnectedBotChatIsPaused::chat_id_fieldID;
jfieldID toggleBusinessConnectedBotChatIsPaused::is_paused_fieldID;

toggleBusinessConnectedBotChatIsPaused::toggleBusinessConnectedBotChatIsPaused()
  : chat_id_()
  , is_paused_()
{}

toggleBusinessConnectedBotChatIsPaused::toggleBusinessConnectedBotChatIsPaused(int53 chat_id_, bool is_paused_)
  : chat_id_(chat_id_)
  , is_paused_(is_paused_)
{}

const std::int32_t toggleBusinessConnectedBotChatIsPaused::ID;

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

void toggleBusinessConnectedBotChatIsPaused::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleBusinessConnectedBotChatIsPaused");
    s.store_field("chatId", chat_id_);
    s.store_field("isPaused", is_paused_);
    s.store_class_end();
  }
}

toggleBusinessConnectedBotChatIsPaused::ReturnType toggleBusinessConnectedBotChatIsPaused::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleGroupCallAreMessagesAllowed::Class;
jfieldID toggleGroupCallAreMessagesAllowed::group_call_id_fieldID;
jfieldID toggleGroupCallAreMessagesAllowed::are_messages_allowed_fieldID;

toggleGroupCallAreMessagesAllowed::toggleGroupCallAreMessagesAllowed()
  : group_call_id_()
  , are_messages_allowed_()
{}

toggleGroupCallAreMessagesAllowed::toggleGroupCallAreMessagesAllowed(int32 group_call_id_, bool are_messages_allowed_)
  : group_call_id_(group_call_id_)
  , are_messages_allowed_(are_messages_allowed_)
{}

const std::int32_t toggleGroupCallAreMessagesAllowed::ID;

object_ptr<toggleGroupCallAreMessagesAllowed> toggleGroupCallAreMessagesAllowed::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGroupCallAreMessagesAllowed> res = make_object<toggleGroupCallAreMessagesAllowed>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->are_messages_allowed_ = (env->GetBooleanField(p, res->are_messages_allowed_fieldID) != 0);
  return res;
}

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

toggleGroupCallAreMessagesAllowed::ReturnType toggleGroupCallAreMessagesAllowed::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSavedMessagesTopicIsPinned::Class;
jfieldID toggleSavedMessagesTopicIsPinned::saved_messages_topic_id_fieldID;
jfieldID toggleSavedMessagesTopicIsPinned::is_pinned_fieldID;

toggleSavedMessagesTopicIsPinned::toggleSavedMessagesTopicIsPinned()
  : saved_messages_topic_id_()
  , is_pinned_()
{}

toggleSavedMessagesTopicIsPinned::toggleSavedMessagesTopicIsPinned(int53 saved_messages_topic_id_, bool is_pinned_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t toggleSavedMessagesTopicIsPinned::ID;

object_ptr<toggleSavedMessagesTopicIsPinned> toggleSavedMessagesTopicIsPinned::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSavedMessagesTopicIsPinned> res = make_object<toggleSavedMessagesTopicIsPinned>();
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return res;
}

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

toggleSavedMessagesTopicIsPinned::ReturnType toggleSavedMessagesTopicIsPinned::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupHasAggressiveAntiSpamEnabled::Class;
jfieldID toggleSupergroupHasAggressiveAntiSpamEnabled::supergroup_id_fieldID;
jfieldID toggleSupergroupHasAggressiveAntiSpamEnabled::has_aggressive_anti_spam_enabled_fieldID;

toggleSupergroupHasAggressiveAntiSpamEnabled::toggleSupergroupHasAggressiveAntiSpamEnabled()
  : supergroup_id_()
  , has_aggressive_anti_spam_enabled_()
{}

toggleSupergroupHasAggressiveAntiSpamEnabled::toggleSupergroupHasAggressiveAntiSpamEnabled(int53 supergroup_id_, bool has_aggressive_anti_spam_enabled_)
  : supergroup_id_(supergroup_id_)
  , has_aggressive_anti_spam_enabled_(has_aggressive_anti_spam_enabled_)
{}

const std::int32_t toggleSupergroupHasAggressiveAntiSpamEnabled::ID;

object_ptr<toggleSupergroupHasAggressiveAntiSpamEnabled> toggleSupergroupHasAggressiveAntiSpamEnabled::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupHasAggressiveAntiSpamEnabled> res = make_object<toggleSupergroupHasAggressiveAntiSpamEnabled>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->has_aggressive_anti_spam_enabled_ = (env->GetBooleanField(p, res->has_aggressive_anti_spam_enabled_fieldID) != 0);
  return res;
}

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

toggleSupergroupHasAggressiveAntiSpamEnabled::ReturnType toggleSupergroupHasAggressiveAntiSpamEnabled::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupHasAutomaticTranslation::Class;
jfieldID toggleSupergroupHasAutomaticTranslation::supergroup_id_fieldID;
jfieldID toggleSupergroupHasAutomaticTranslation::has_automatic_translation_fieldID;

toggleSupergroupHasAutomaticTranslation::toggleSupergroupHasAutomaticTranslation()
  : supergroup_id_()
  , has_automatic_translation_()
{}

toggleSupergroupHasAutomaticTranslation::toggleSupergroupHasAutomaticTranslation(int53 supergroup_id_, bool has_automatic_translation_)
  : supergroup_id_(supergroup_id_)
  , has_automatic_translation_(has_automatic_translation_)
{}

const std::int32_t toggleSupergroupHasAutomaticTranslation::ID;

object_ptr<toggleSupergroupHasAutomaticTranslation> toggleSupergroupHasAutomaticTranslation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupHasAutomaticTranslation> res = make_object<toggleSupergroupHasAutomaticTranslation>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->has_automatic_translation_ = (env->GetBooleanField(p, res->has_automatic_translation_fieldID) != 0);
  return res;
}

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

toggleSupergroupHasAutomaticTranslation::ReturnType toggleSupergroupHasAutomaticTranslation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupHasHiddenMembers::Class;
jfieldID toggleSupergroupHasHiddenMembers::supergroup_id_fieldID;
jfieldID toggleSupergroupHasHiddenMembers::has_hidden_members_fieldID;

toggleSupergroupHasHiddenMembers::toggleSupergroupHasHiddenMembers()
  : supergroup_id_()
  , has_hidden_members_()
{}

toggleSupergroupHasHiddenMembers::toggleSupergroupHasHiddenMembers(int53 supergroup_id_, bool has_hidden_members_)
  : supergroup_id_(supergroup_id_)
  , has_hidden_members_(has_hidden_members_)
{}

const std::int32_t toggleSupergroupHasHiddenMembers::ID;

object_ptr<toggleSupergroupHasHiddenMembers> toggleSupergroupHasHiddenMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupHasHiddenMembers> res = make_object<toggleSupergroupHasHiddenMembers>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->has_hidden_members_ = (env->GetBooleanField(p, res->has_hidden_members_fieldID) != 0);
  return res;
}

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

toggleSupergroupHasHiddenMembers::ReturnType toggleSupergroupHasHiddenMembers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupIsBroadcastGroup::Class;
jfieldID toggleSupergroupIsBroadcastGroup::supergroup_id_fieldID;

toggleSupergroupIsBroadcastGroup::toggleSupergroupIsBroadcastGroup()
  : supergroup_id_()
{}

toggleSupergroupIsBroadcastGroup::toggleSupergroupIsBroadcastGroup(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t toggleSupergroupIsBroadcastGroup::ID;

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

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

toggleSupergroupIsBroadcastGroup::ReturnType toggleSupergroupIsBroadcastGroup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass viewPremiumFeature::Class;
jfieldID viewPremiumFeature::feature_fieldID;

viewPremiumFeature::viewPremiumFeature()
  : feature_()
{}

viewPremiumFeature::viewPremiumFeature(object_ptr<PremiumFeature> &&feature_)
  : feature_(std::move(feature_))
{}

const std::int32_t viewPremiumFeature::ID;

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

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

viewPremiumFeature::ReturnType viewPremiumFeature::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass viewSponsoredChat::Class;
jfieldID viewSponsoredChat::sponsored_chat_unique_id_fieldID;

viewSponsoredChat::viewSponsoredChat()
  : sponsored_chat_unique_id_()
{}

viewSponsoredChat::viewSponsoredChat(int53 sponsored_chat_unique_id_)
  : sponsored_chat_unique_id_(sponsored_chat_unique_id_)
{}

const std::int32_t viewSponsoredChat::ID;

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

void viewSponsoredChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ViewSponsoredChat");
    s.store_field("sponsoredChatUniqueId", sponsored_chat_unique_id_);
    s.store_class_end();
  }
}

viewSponsoredChat::ReturnType viewSponsoredChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void viewSponsoredChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ViewSponsoredChat").c_str());
    sponsored_chat_unique_id_fieldID = jni::get_field_id(env, Class, "sponsoredChatUniqueId", "J");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
